Update to latest maplibre-gl-native, including rename from QMapboxGL to QMapLibreGL

This commit is contained in:
Dan Paulat 2022-10-20 22:54:53 -05:00
parent 243e874b55
commit 2ac141ea1a
30 changed files with 143 additions and 133 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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_)
{

View file

@ -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;
/**

View file

@ -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_)
{

View file

@ -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);