mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:40:05 +00:00
Update to latest maplibre-gl-native, including rename from QMapboxGL to QMapLibreGL
This commit is contained in:
parent
243e874b55
commit
2ac141ea1a
30 changed files with 143 additions and 133 deletions
|
|
@ -36,7 +36,8 @@ DrawItem::DrawItem(DrawItem&&) noexcept = default;
|
|||
DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default;
|
||||
|
||||
void DrawItem::UseDefaultProjection(
|
||||
const QMapbox::CustomLayerRenderParameters& params, GLint uMVPMatrixLocation)
|
||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation)
|
||||
{
|
||||
glm::mat4 projection = glm::ortho(0.0f,
|
||||
static_cast<float>(params.width),
|
||||
|
|
@ -49,29 +50,29 @@ void DrawItem::UseDefaultProjection(
|
|||
|
||||
// TODO: Refactor to utility class
|
||||
static glm::vec2
|
||||
LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate)
|
||||
LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
|
||||
{
|
||||
double latitude = std::clamp(
|
||||
coordinate.first, -mbgl::util::LATITUDE_MAX, mbgl::util::LATITUDE_MAX);
|
||||
glm::vec2 screen {
|
||||
mbgl::util::LONGITUDE_MAX + coordinate.second,
|
||||
-(mbgl::util::LONGITUDE_MAX -
|
||||
mbgl::util::RAD2DEG *
|
||||
mbgl::util::RAD2DEG_D *
|
||||
std::log(std::tan(M_PI / 4.0 +
|
||||
latitude * M_PI / mbgl::util::DEGREES_MAX)))};
|
||||
return screen;
|
||||
}
|
||||
|
||||
void DrawItem::UseMapProjection(
|
||||
const QMapbox::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation,
|
||||
GLint uMapScreenCoordLocation)
|
||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation,
|
||||
GLint uMapScreenCoordLocation)
|
||||
{
|
||||
OpenGLFunctions& gl = p->gl_;
|
||||
|
||||
// TODO: Refactor to utility class
|
||||
const float scale = std::pow(2.0, params.zoom) * 2.0f *
|
||||
mbgl::util::tileSize / mbgl::util::DEGREES_MAX;
|
||||
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
||||
const float xScale = scale / params.width;
|
||||
const float yScale = scale / params.height;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <QMapbox>
|
||||
#include <QMapLibreGL/QMapLibreGL>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -27,14 +27,16 @@ public:
|
|||
DrawItem(DrawItem&&) noexcept;
|
||||
DrawItem& operator=(DrawItem&&) noexcept;
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
virtual void Render(const QMapbox::CustomLayerRenderParameters& params) = 0;
|
||||
virtual void Deinitialize() = 0;
|
||||
virtual void Initialize() = 0;
|
||||
virtual void
|
||||
Render(const QMapLibreGL::CustomLayerRenderParameters& params) = 0;
|
||||
virtual void Deinitialize() = 0;
|
||||
|
||||
protected:
|
||||
void UseDefaultProjection(const QMapbox::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation);
|
||||
void UseMapProjection(const QMapbox::CustomLayerRenderParameters& params,
|
||||
void
|
||||
UseDefaultProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation);
|
||||
void UseMapProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation,
|
||||
GLint uMapScreenCoordLocation);
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void GeoLine::Initialize()
|
|||
p->dirty_ = true;
|
||||
}
|
||||
|
||||
void GeoLine::Render(const QMapbox::CustomLayerRenderParameters& params)
|
||||
void GeoLine::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||
{
|
||||
if (p->visible_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
GeoLine& operator=(GeoLine&&) noexcept;
|
||||
|
||||
void Initialize() override;
|
||||
void Render(const QMapbox::CustomLayerRenderParameters& params) override;
|
||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
||||
void Deinitialize() override;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ void Rectangle::Initialize()
|
|||
p->dirty_ = true;
|
||||
}
|
||||
|
||||
void Rectangle::Render(const QMapbox::CustomLayerRenderParameters& params)
|
||||
void Rectangle::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||
{
|
||||
if (p->visible_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public:
|
|||
Rectangle& operator=(Rectangle&&) noexcept;
|
||||
|
||||
void Initialize() override;
|
||||
void Render(const QMapbox::CustomLayerRenderParameters& params) override;
|
||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
||||
void Deinitialize() override;
|
||||
|
||||
void SetBorder(float width, boost::gil::rgba8_pixel_t color);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue