Refactor QMapLibreGL to QMapLibre

This commit is contained in:
Dan Paulat 2024-02-27 23:33:57 -06:00
parent db0d26a4ad
commit 1fd52f771c
55 changed files with 305 additions and 313 deletions

View file

@ -43,18 +43,18 @@ DrawItem::DrawItem(DrawItem&&) noexcept = default;
DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default;
void DrawItem::Render(
const QMapLibreGL::CustomLayerRenderParameters& /* params */)
const QMapLibre::CustomLayerRenderParameters& /* params */)
{
}
void DrawItem::Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void DrawItem::Render(const QMapLibre::CustomLayerRenderParameters& params,
bool /* textureAtlasChanged */)
{
Render(params);
}
bool DrawItem::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
const QMapLibre::CustomLayerRenderParameters& /* params */,
const QPointF& /* mouseLocalPos */,
const QPointF& /* mouseGlobalPos */,
const glm::vec2& /* mouseCoords */,
@ -66,8 +66,8 @@ bool DrawItem::RunMousePicking(
}
void DrawItem::UseDefaultProjection(
const QMapLibreGL::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation)
const QMapLibre::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation)
{
glm::mat4 projection = glm::ortho(0.0f,
static_cast<float>(params.width),
@ -79,8 +79,8 @@ void DrawItem::UseDefaultProjection(
}
void DrawItem::UseRotationProjection(
const QMapLibreGL::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation)
const QMapLibre::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation)
{
glm::mat4 projection = glm::ortho(0.0f,
static_cast<float>(params.width),
@ -96,9 +96,9 @@ void DrawItem::UseRotationProjection(
}
void DrawItem::UseMapProjection(
const QMapLibreGL::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation,
GLint uMapScreenCoordLocation)
const QMapLibre::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation,
GLint uMapScreenCoordLocation)
{
OpenGLFunctions& gl = p->gl_;

View file

@ -6,8 +6,8 @@
#include <memory>
#include <QMapLibreGL/QMapLibreGL>
#include <glm/gtc/type_ptr.hpp>
#include <qmaplibre.hpp>
namespace scwx
{
@ -31,8 +31,8 @@ public:
DrawItem& operator=(DrawItem&&) noexcept;
virtual void Initialize() = 0;
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters& params);
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
virtual void Render(const QMapLibre::CustomLayerRenderParameters& params);
virtual void Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged);
virtual void Deinitialize() = 0;
@ -49,21 +49,21 @@ public:
* @return true if the draw item was picked, otherwise false
*/
virtual bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler);
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler);
protected:
void
UseDefaultProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
UseDefaultProjection(const QMapLibre::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation);
void
UseRotationProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
UseRotationProjection(const QMapLibre::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation);
void UseMapProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
void UseMapProjection(const QMapLibre::CustomLayerRenderParameters& params,
GLint uMVPMatrixLocation,
GLint uMapScreenCoordLocation);

View file

@ -243,7 +243,7 @@ void GeoIcons::Initialize()
p->dirty_ = true;
}
void GeoIcons::Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void GeoIcons::Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged)
{
if (!p->visible_)
@ -732,7 +732,7 @@ void GeoIcons::Impl::Update(bool textureAtlasChanged)
}
bool GeoIcons::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,

View file

@ -33,16 +33,16 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -218,7 +218,7 @@ void GeoLines::Initialize()
p->dirty_ = true;
}
void GeoLines::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
void GeoLines::Render(const QMapLibre::CustomLayerRenderParameters& params)
{
if (!p->visible_)
{
@ -513,7 +513,7 @@ void GeoLines::Impl::Update()
}
bool GeoLines::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,

View file

@ -32,15 +32,15 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -182,7 +182,7 @@ void Icons::Initialize()
p->dirty_ = true;
}
void Icons::Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void Icons::Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged)
{
if (!p->visible_)
@ -575,9 +575,9 @@ void Icons::Impl::Update(bool textureAtlasChanged)
}
bool Icons::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& /* mouseCoords */,
const common::Coordinate& /* mouseGeoCoords */,
std::shared_ptr<types::EventHandler>& eventHandler)

View file

@ -32,16 +32,16 @@ public:
Icons& operator=(Icons&&) noexcept;
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -103,8 +103,7 @@ void LinkedVectors::Initialize()
p->geoLines_->Initialize();
}
void LinkedVectors::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
void LinkedVectors::Render(const QMapLibre::CustomLayerRenderParameters& params)
{
if (!p->visible_)
{
@ -337,12 +336,12 @@ void LinkedVectors::FinishVectors()
}
bool LinkedVectors::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler)
const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler)
{
return p->geoLines_->RunMousePicking(params,
mouseLocalPos,

View file

@ -43,15 +43,15 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -255,8 +255,8 @@ void PlacefileIcons::Initialize()
}
void PlacefileIcons::Render(
const QMapLibreGL::CustomLayerRenderParameters& params,
bool textureAtlasChanged)
const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged)
{
std::unique_lock lock {p->iconMutex_};
@ -685,7 +685,7 @@ void PlacefileIcons::Impl::Update(bool textureAtlasChanged)
}
bool PlacefileIcons::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,

View file

@ -31,16 +31,16 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -224,8 +224,8 @@ void PlacefileImages::Initialize()
}
void PlacefileImages::Render(
const QMapLibreGL::CustomLayerRenderParameters& params,
bool textureAtlasChanged)
const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged)
{
std::unique_lock lock {p->imageMutex_};

View file

@ -29,7 +29,7 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
void Render(const QMapLibre::CustomLayerRenderParameters& params,
bool textureAtlasChanged) override;
void Deinitialize() override;

View file

@ -213,7 +213,7 @@ void PlacefileLines::Initialize()
}
void PlacefileLines::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
std::unique_lock lock {p->lineMutex_};
@ -496,7 +496,7 @@ void PlacefileLines::Impl::Update()
}
bool PlacefileLines::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,

View file

@ -29,15 +29,15 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -221,7 +221,7 @@ void PlacefilePolygons::Initialize()
}
void PlacefilePolygons::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
if (!p->currentBuffer_.empty())
{

View file

@ -31,7 +31,7 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
/**

View file

@ -34,14 +34,14 @@ public:
~Impl() {}
void RenderTextDrawItem(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QMapLibre::CustomLayerRenderParameters& params,
const std::shared_ptr<const gr::Placefile::TextDrawItem>& di);
void RenderText(const QMapLibreGL::CustomLayerRenderParameters& params,
const std::string& text,
const std::string& hoverText,
boost::gil::rgba8_pixel_t color,
float x,
float y);
void RenderText(const QMapLibre::CustomLayerRenderParameters& params,
const std::string& text,
const std::string& hoverText,
boost::gil::rgba8_pixel_t color,
float x,
float y);
std::shared_ptr<GlContext> context_;
@ -98,8 +98,7 @@ void PlacefileText::set_thresholded(bool thresholded)
void PlacefileText::Initialize() {}
void PlacefileText::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
void PlacefileText::Render(const QMapLibre::CustomLayerRenderParameters& params)
{
std::unique_lock lock {p->listMutex_};
@ -128,7 +127,7 @@ void PlacefileText::Render(
}
void PlacefileText::Impl::RenderTextDrawItem(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QMapLibre::CustomLayerRenderParameters& params,
const std::shared_ptr<const gr::Placefile::TextDrawItem>& di)
{
// If no time has been selected, use the current time
@ -191,12 +190,12 @@ void PlacefileText::Impl::RenderTextDrawItem(
}
void PlacefileText::Impl::RenderText(
const QMapLibreGL::CustomLayerRenderParameters& params,
const std::string& text,
const std::string& hoverText,
boost::gil::rgba8_pixel_t color,
float x,
float y)
const QMapLibre::CustomLayerRenderParameters& params,
const std::string& text,
const std::string& hoverText,
boost::gil::rgba8_pixel_t color,
float x,
float y)
{
const std::string windowName {
fmt::format("PlacefileText-{}-{}", placefileName_, ++textId_)};
@ -238,7 +237,7 @@ void PlacefileText::Deinitialize()
}
bool PlacefileText::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
const QMapLibre::CustomLayerRenderParameters& /* params */,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& /* mouseCoords */,

View file

@ -34,15 +34,15 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
bool
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
std::shared_ptr<types::EventHandler>& eventHandler) override;
/**

View file

@ -169,7 +169,7 @@ void PlacefileTriangles::Initialize()
}
void PlacefileTriangles::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
if (!p->currentBuffer_.empty())
{

View file

@ -29,7 +29,7 @@ public:
void set_thresholded(bool thresholded);
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
/**

View file

@ -122,7 +122,7 @@ void Rectangle::Initialize()
p->dirty_ = true;
}
void Rectangle::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
void Rectangle::Render(const QMapLibre::CustomLayerRenderParameters& params)
{
if (p->visible_)
{

View file

@ -27,7 +27,7 @@ public:
Rectangle& operator=(Rectangle&&) noexcept;
void Initialize() override;
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
void Deinitialize() override;
void SetBorder(float width, boost::gil::rgba8_pixel_t color);