mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Refactor QMapLibreGL to QMapLibre
This commit is contained in:
parent
db0d26a4ad
commit
1fd52f771c
55 changed files with 305 additions and 313 deletions
|
|
@ -43,18 +43,18 @@ DrawItem::DrawItem(DrawItem&&) noexcept = default;
|
||||||
DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default;
|
DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default;
|
||||||
|
|
||||||
void DrawItem::Render(
|
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 */)
|
bool /* textureAtlasChanged */)
|
||||||
{
|
{
|
||||||
Render(params);
|
Render(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrawItem::RunMousePicking(
|
bool DrawItem::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibre::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& /* mouseGlobalPos */,
|
const QPointF& /* mouseGlobalPos */,
|
||||||
const glm::vec2& /* mouseCoords */,
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
|
@ -66,7 +66,7 @@ bool DrawItem::RunMousePicking(
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawItem::UseDefaultProjection(
|
void DrawItem::UseDefaultProjection(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation)
|
GLint uMVPMatrixLocation)
|
||||||
{
|
{
|
||||||
glm::mat4 projection = glm::ortho(0.0f,
|
glm::mat4 projection = glm::ortho(0.0f,
|
||||||
|
|
@ -79,7 +79,7 @@ void DrawItem::UseDefaultProjection(
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawItem::UseRotationProjection(
|
void DrawItem::UseRotationProjection(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation)
|
GLint uMVPMatrixLocation)
|
||||||
{
|
{
|
||||||
glm::mat4 projection = glm::ortho(0.0f,
|
glm::mat4 projection = glm::ortho(0.0f,
|
||||||
|
|
@ -96,7 +96,7 @@ void DrawItem::UseRotationProjection(
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawItem::UseMapProjection(
|
void DrawItem::UseMapProjection(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation,
|
GLint uMVPMatrixLocation,
|
||||||
GLint uMapScreenCoordLocation)
|
GLint uMapScreenCoordLocation)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QMapLibreGL/QMapLibreGL>
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
#include <qmaplibre.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -31,8 +31,8 @@ public:
|
||||||
DrawItem& operator=(DrawItem&&) noexcept;
|
DrawItem& operator=(DrawItem&&) noexcept;
|
||||||
|
|
||||||
virtual void Initialize() = 0;
|
virtual void Initialize() = 0;
|
||||||
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters& params);
|
virtual void Render(const QMapLibre::CustomLayerRenderParameters& params);
|
||||||
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
virtual void Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged);
|
bool textureAtlasChanged);
|
||||||
virtual void Deinitialize() = 0;
|
virtual void Deinitialize() = 0;
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
* @return true if the draw item was picked, otherwise false
|
* @return true if the draw item was picked, otherwise false
|
||||||
*/
|
*/
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
@ -58,12 +58,12 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void
|
void
|
||||||
UseDefaultProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
UseDefaultProjection(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation);
|
GLint uMVPMatrixLocation);
|
||||||
void
|
void
|
||||||
UseRotationProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
UseRotationProjection(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation);
|
GLint uMVPMatrixLocation);
|
||||||
void UseMapProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void UseMapProjection(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation,
|
GLint uMVPMatrixLocation,
|
||||||
GLint uMapScreenCoordLocation);
|
GLint uMapScreenCoordLocation);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ void GeoIcons::Initialize()
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeoIcons::Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void GeoIcons::Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged)
|
bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
if (!p->visible_)
|
if (!p->visible_)
|
||||||
|
|
@ -732,7 +732,7 @@ void GeoIcons::Impl::Update(bool textureAtlasChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeoIcons::RunMousePicking(
|
bool GeoIcons::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged) override;
|
bool textureAtlasChanged) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ void GeoLines::Initialize()
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeoLines::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
void GeoLines::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
if (!p->visible_)
|
if (!p->visible_)
|
||||||
{
|
{
|
||||||
|
|
@ -513,7 +513,7 @@ void GeoLines::Impl::Update()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeoLines::RunMousePicking(
|
bool GeoLines::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ void Icons::Initialize()
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Icons::Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void Icons::Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged)
|
bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
if (!p->visible_)
|
if (!p->visible_)
|
||||||
|
|
@ -575,7 +575,7 @@ void Icons::Impl::Update(bool textureAtlasChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Icons::RunMousePicking(
|
bool Icons::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& /* mouseCoords */,
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@ public:
|
||||||
Icons& operator=(Icons&&) noexcept;
|
Icons& operator=(Icons&&) noexcept;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged) override;
|
bool textureAtlasChanged) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,7 @@ void LinkedVectors::Initialize()
|
||||||
p->geoLines_->Initialize();
|
p->geoLines_->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkedVectors::Render(
|
void LinkedVectors::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
|
||||||
{
|
{
|
||||||
if (!p->visible_)
|
if (!p->visible_)
|
||||||
{
|
{
|
||||||
|
|
@ -337,7 +336,7 @@ void LinkedVectors::FinishVectors()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LinkedVectors::RunMousePicking(
|
bool LinkedVectors::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ void PlacefileIcons::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileIcons::Render(
|
void PlacefileIcons::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged)
|
bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->iconMutex_};
|
std::unique_lock lock {p->iconMutex_};
|
||||||
|
|
@ -685,7 +685,7 @@ void PlacefileIcons::Impl::Update(bool textureAtlasChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlacefileIcons::RunMousePicking(
|
bool PlacefileIcons::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged) override;
|
bool textureAtlasChanged) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ void PlacefileImages::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileImages::Render(
|
void PlacefileImages::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged)
|
bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->imageMutex_};
|
std::unique_lock lock {p->imageMutex_};
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void Render(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
bool textureAtlasChanged) override;
|
bool textureAtlasChanged) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ void PlacefileLines::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileLines::Render(
|
void PlacefileLines::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->lineMutex_};
|
std::unique_lock lock {p->lineMutex_};
|
||||||
|
|
||||||
|
|
@ -496,7 +496,7 @@ void PlacefileLines::Impl::Update()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlacefileLines::RunMousePicking(
|
bool PlacefileLines::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ void PlacefilePolygons::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefilePolygons::Render(
|
void PlacefilePolygons::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
if (!p->currentBuffer_.empty())
|
if (!p->currentBuffer_.empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ public:
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
void RenderTextDrawItem(
|
void RenderTextDrawItem(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const std::shared_ptr<const gr::Placefile::TextDrawItem>& di);
|
const std::shared_ptr<const gr::Placefile::TextDrawItem>& di);
|
||||||
void RenderText(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void RenderText(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const std::string& text,
|
const std::string& text,
|
||||||
const std::string& hoverText,
|
const std::string& hoverText,
|
||||||
boost::gil::rgba8_pixel_t color,
|
boost::gil::rgba8_pixel_t color,
|
||||||
|
|
@ -98,8 +98,7 @@ void PlacefileText::set_thresholded(bool thresholded)
|
||||||
|
|
||||||
void PlacefileText::Initialize() {}
|
void PlacefileText::Initialize() {}
|
||||||
|
|
||||||
void PlacefileText::Render(
|
void PlacefileText::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->listMutex_};
|
std::unique_lock lock {p->listMutex_};
|
||||||
|
|
||||||
|
|
@ -128,7 +127,7 @@ void PlacefileText::Render(
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileText::Impl::RenderTextDrawItem(
|
void PlacefileText::Impl::RenderTextDrawItem(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const std::shared_ptr<const gr::Placefile::TextDrawItem>& di)
|
const std::shared_ptr<const gr::Placefile::TextDrawItem>& di)
|
||||||
{
|
{
|
||||||
// If no time has been selected, use the current time
|
// If no time has been selected, use the current time
|
||||||
|
|
@ -191,7 +190,7 @@ void PlacefileText::Impl::RenderTextDrawItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileText::Impl::RenderText(
|
void PlacefileText::Impl::RenderText(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const std::string& text,
|
const std::string& text,
|
||||||
const std::string& hoverText,
|
const std::string& hoverText,
|
||||||
boost::gil::rgba8_pixel_t color,
|
boost::gil::rgba8_pixel_t color,
|
||||||
|
|
@ -238,7 +237,7 @@ void PlacefileText::Deinitialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlacefileText::RunMousePicking(
|
bool PlacefileText::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibre::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& /* mouseCoords */,
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ void PlacefileTriangles::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileTriangles::Render(
|
void PlacefileTriangles::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
if (!p->currentBuffer_.empty())
|
if (!p->currentBuffer_.empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
void set_thresholded(bool thresholded);
|
void set_thresholded(bool thresholded);
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ void Rectangle::Initialize()
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rectangle::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
void Rectangle::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
if (p->visible_)
|
if (p->visible_)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public:
|
||||||
Rectangle& operator=(Rectangle&&) noexcept;
|
Rectangle& operator=(Rectangle&&) noexcept;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibre::CustomLayerRenderParameters& params) override;
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
void SetBorder(float width, boost::gil::rgba8_pixel_t color);
|
void SetBorder(float width, boost::gil::rgba8_pixel_t color);
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ public:
|
||||||
boost::asio::thread_pool threadPool_ {1u};
|
boost::asio::thread_pool threadPool_ {1u};
|
||||||
|
|
||||||
MainWindow* mainWindow_;
|
MainWindow* mainWindow_;
|
||||||
QMapLibreGL::Settings settings_;
|
QMapLibre::Settings settings_;
|
||||||
map::MapProvider mapProvider_;
|
map::MapProvider mapProvider_;
|
||||||
map::MapWidget* activeMap_;
|
map::MapWidget* activeMap_;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <boost/range/irange.hpp>
|
#include <boost/range/irange.hpp>
|
||||||
#include <boost/timer/timer.hpp>
|
#include <boost/timer/timer.hpp>
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#include <QMapLibreGL/QMapLibreGL>
|
#include <qmaplibre.hpp>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
|
|
@ -423,7 +423,7 @@ void RadarProductManager::Initialize()
|
||||||
const GeographicLib::Geodesic& geodesic(
|
const GeographicLib::Geodesic& geodesic(
|
||||||
util::GeographicLib::DefaultGeodesic());
|
util::GeographicLib::DefaultGeodesic());
|
||||||
|
|
||||||
const QMapLibreGL::Coordinate radar(p->radarSite_->latitude(),
|
const QMapLibre::Coordinate radar(p->radarSite_->latitude(),
|
||||||
p->radarSite_->longitude());
|
p->radarSite_->longitude());
|
||||||
|
|
||||||
const float gateSize = gate_size();
|
const float gateSize = gate_size();
|
||||||
|
|
|
||||||
|
|
@ -24,22 +24,22 @@ static const std::string logPrefix_ = "scwx::qt::map::alert_layer";
|
||||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
static std::vector<std::string>
|
static std::vector<std::string>
|
||||||
AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
|
AddAlertLayer(std::shared_ptr<QMapLibre::Map> map,
|
||||||
awips::Phenomenon phenomenon,
|
awips::Phenomenon phenomenon,
|
||||||
bool alertActive,
|
bool alertActive,
|
||||||
const QString& beforeLayer);
|
const QString& beforeLayer);
|
||||||
static QMapLibreGL::Feature
|
static QMapLibre::Feature
|
||||||
CreateFeature(const awips::CodedLocation& codedLocation);
|
CreateFeature(const awips::CodedLocation& codedLocation);
|
||||||
static QMapLibreGL::Coordinate
|
static QMapLibre::Coordinate
|
||||||
GetMapboxCoordinate(const common::Coordinate& coordinate);
|
GetMapboxCoordinate(const common::Coordinate& coordinate);
|
||||||
static QMapLibreGL::Coordinates
|
static QMapLibre::Coordinates
|
||||||
GetMapboxCoordinates(const awips::CodedLocation& codedLocation);
|
GetMapboxCoordinates(const awips::CodedLocation& codedLocation);
|
||||||
static QString GetSourceId(awips::Phenomenon phenomenon, bool alertActive);
|
static QString GetSourceId(awips::Phenomenon phenomenon, bool alertActive);
|
||||||
static QString GetSuffix(awips::Phenomenon phenomenon, bool alertActive);
|
static QString GetSuffix(awips::Phenomenon phenomenon, bool alertActive);
|
||||||
|
|
||||||
static const QVariantMap kEmptyFeatureCollection_ {
|
static const QVariantMap kEmptyFeatureCollection_ {
|
||||||
{"type", "geojson"},
|
{"type", "geojson"},
|
||||||
{"data", QVariant::fromValue(std::list<QMapLibreGL::Feature> {})}};
|
{"data", QVariant::fromValue(std::list<QMapLibre::Feature> {})}};
|
||||||
static const std::vector<awips::Phenomenon> kAlertPhenomena_ {
|
static const std::vector<awips::Phenomenon> kAlertPhenomena_ {
|
||||||
awips::Phenomenon::Marine,
|
awips::Phenomenon::Marine,
|
||||||
awips::Phenomenon::FlashFlood,
|
awips::Phenomenon::FlashFlood,
|
||||||
|
|
@ -87,7 +87,7 @@ class AlertLayerHandler : public QObject
|
||||||
|
|
||||||
static std::shared_ptr<AlertLayerHandler> Instance();
|
static std::shared_ptr<AlertLayerHandler> Instance();
|
||||||
|
|
||||||
std::list<QMapLibreGL::Feature>* FeatureList(awips::Phenomenon phenomenon,
|
std::list<QMapLibre::Feature>* FeatureList(awips::Phenomenon phenomenon,
|
||||||
bool alertActive);
|
bool alertActive);
|
||||||
|
|
||||||
void HandleAlert(const types::TextEventKey& key, size_t messageIndex);
|
void HandleAlert(const types::TextEventKey& key, size_t messageIndex);
|
||||||
|
|
@ -103,7 +103,7 @@ class AlertLayerHandler : public QObject
|
||||||
std::unordered_multimap<types::TextEventKey,
|
std::unordered_multimap<types::TextEventKey,
|
||||||
std::tuple<awips::Phenomenon,
|
std::tuple<awips::Phenomenon,
|
||||||
bool,
|
bool,
|
||||||
std::list<QMapLibreGL::Feature>::iterator,
|
std::list<QMapLibre::Feature>::iterator,
|
||||||
std::chrono::system_clock::time_point>,
|
std::chrono::system_clock::time_point>,
|
||||||
types::TextEventHash<types::TextEventKey>>
|
types::TextEventHash<types::TextEventKey>>
|
||||||
featureMap_;
|
featureMap_;
|
||||||
|
|
@ -166,16 +166,16 @@ std::vector<std::string> AlertLayer::AddLayers(awips::Phenomenon phenomenon,
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QMapLibreGL::Feature>*
|
std::list<QMapLibre::Feature>*
|
||||||
AlertLayerHandler::FeatureList(awips::Phenomenon phenomenon, bool alertActive)
|
AlertLayerHandler::FeatureList(awips::Phenomenon phenomenon, bool alertActive)
|
||||||
{
|
{
|
||||||
std::list<QMapLibreGL::Feature>* featureList = nullptr;
|
std::list<QMapLibre::Feature>* featureList = nullptr;
|
||||||
|
|
||||||
auto key = std::make_pair(phenomenon, alertActive);
|
auto key = std::make_pair(phenomenon, alertActive);
|
||||||
auto it = alertSourceMap_.find(key);
|
auto it = alertSourceMap_.find(key);
|
||||||
if (it != alertSourceMap_.cend())
|
if (it != alertSourceMap_.cend())
|
||||||
{
|
{
|
||||||
featureList = reinterpret_cast<std::list<QMapLibreGL::Feature>*>(
|
featureList = reinterpret_cast<std::list<QMapLibre::Feature>*>(
|
||||||
it->second["data"].data());
|
it->second["data"].data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ std::shared_ptr<AlertLayerHandler> AlertLayerHandler::Instance()
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string>
|
static std::vector<std::string>
|
||||||
AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
|
AddAlertLayer(std::shared_ptr<QMapLibre::Map> map,
|
||||||
awips::Phenomenon phenomenon,
|
awips::Phenomenon phenomenon,
|
||||||
bool alertActive,
|
bool alertActive,
|
||||||
const QString& beforeLayer)
|
const QString& beforeLayer)
|
||||||
|
|
@ -426,33 +426,33 @@ AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
return {bgLayerId.toStdString(), fgLayerId.toStdString()};
|
return {bgLayerId.toStdString(), fgLayerId.toStdString()};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMapLibreGL::Feature
|
static QMapLibre::Feature
|
||||||
CreateFeature(const awips::CodedLocation& codedLocation)
|
CreateFeature(const awips::CodedLocation& codedLocation)
|
||||||
{
|
{
|
||||||
auto mapboxCoordinates = GetMapboxCoordinates(codedLocation);
|
auto mapboxCoordinates = GetMapboxCoordinates(codedLocation);
|
||||||
|
|
||||||
return {QMapLibreGL::Feature::PolygonType,
|
return {
|
||||||
std::initializer_list<QMapLibreGL::CoordinatesCollection> {
|
QMapLibre::Feature::PolygonType,
|
||||||
std::initializer_list<QMapLibreGL::Coordinates> {
|
std::initializer_list<QMapLibre::CoordinatesCollection> {
|
||||||
{mapboxCoordinates}}}};
|
std::initializer_list<QMapLibre::Coordinates> {{mapboxCoordinates}}}};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMapLibreGL::Coordinate
|
static QMapLibre::Coordinate
|
||||||
GetMapboxCoordinate(const common::Coordinate& coordinate)
|
GetMapboxCoordinate(const common::Coordinate& coordinate)
|
||||||
{
|
{
|
||||||
return {coordinate.latitude_, coordinate.longitude_};
|
return {coordinate.latitude_, coordinate.longitude_};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMapLibreGL::Coordinates
|
static QMapLibre::Coordinates
|
||||||
GetMapboxCoordinates(const awips::CodedLocation& codedLocation)
|
GetMapboxCoordinates(const awips::CodedLocation& codedLocation)
|
||||||
{
|
{
|
||||||
auto scwxCoordinates = codedLocation.coordinates();
|
auto scwxCoordinates = codedLocation.coordinates();
|
||||||
QMapLibreGL::Coordinates mapboxCoordinates(scwxCoordinates.size() + 1u);
|
QMapLibre::Coordinates mapboxCoordinates(scwxCoordinates.size() + 1u);
|
||||||
|
|
||||||
std::transform(scwxCoordinates.cbegin(),
|
std::transform(scwxCoordinates.cbegin(),
|
||||||
scwxCoordinates.cend(),
|
scwxCoordinates.cend(),
|
||||||
mapboxCoordinates.begin(),
|
mapboxCoordinates.begin(),
|
||||||
[](auto& coordinate) -> QMapLibreGL::Coordinate
|
[](auto& coordinate) -> QMapLibre::Coordinate
|
||||||
{ return GetMapboxCoordinate(coordinate); });
|
{ return GetMapboxCoordinate(coordinate); });
|
||||||
|
|
||||||
mapboxCoordinates.back() = GetMapboxCoordinate(scwxCoordinates.front());
|
mapboxCoordinates.back() = GetMapboxCoordinate(scwxCoordinates.front());
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ void ColorTableLayer::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorTableLayer::Render(
|
void ColorTableLayer::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
auto radarProductView = context()->radar_product_view();
|
auto radarProductView = context()->radar_product_view();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
~ColorTableLayer();
|
~ColorTableLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ void DrawLayer::Initialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawLayer::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
void DrawLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = p->context_->gl();
|
gl::OpenGLFunctions& gl = p->context_->gl();
|
||||||
p->textureAtlas_ = p->context_->GetTextureAtlas();
|
p->textureAtlas_ = p->context_->GetTextureAtlas();
|
||||||
|
|
@ -77,7 +77,7 @@ void DrawLayer::Deinitialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrawLayer::RunMousePicking(
|
bool DrawLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,11 @@ public:
|
||||||
virtual ~DrawLayer();
|
virtual ~DrawLayer();
|
||||||
|
|
||||||
virtual void Initialize() override;
|
virtual void Initialize() override;
|
||||||
virtual void
|
virtual void Render(const QMapLibre::CustomLayerRenderParameters&) override;
|
||||||
Render(const QMapLibreGL::CustomLayerRenderParameters&) override;
|
|
||||||
virtual void Deinitialize() override;
|
virtual void Deinitialize() override;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ GenericLayer::GenericLayer(std::shared_ptr<MapContext> context) :
|
||||||
GenericLayer::~GenericLayer() = default;
|
GenericLayer::~GenericLayer() = default;
|
||||||
|
|
||||||
bool GenericLayer::RunMousePicking(
|
bool GenericLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibre::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& /* mouseGlobalPos */,
|
const QPointF& /* mouseGlobalPos */,
|
||||||
const glm::vec2& /* mousePos */,
|
const glm::vec2& /* mousePos */,
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMapLibreGL/QMapLibreGL>
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
#include <qmaplibre.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
virtual ~GenericLayer();
|
virtual ~GenericLayer();
|
||||||
|
|
||||||
virtual void Initialize() = 0;
|
virtual void Initialize() = 0;
|
||||||
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters&) = 0;
|
virtual void Render(const QMapLibre::CustomLayerRenderParameters&) = 0;
|
||||||
virtual void Deinitialize() = 0;
|
virtual void Deinitialize() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
* @return true if a draw item was picked, otherwise false
|
* @return true if a draw item was picked, otherwise false
|
||||||
*/
|
*/
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ void LayerWrapper::initialize()
|
||||||
p->layer_->Initialize();
|
p->layer_->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWrapper::render(
|
void LayerWrapper::render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
|
||||||
{
|
{
|
||||||
p->layer_->Render(params);
|
p->layer_->Render(params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace map
|
||||||
|
|
||||||
class LayerWrapperImpl;
|
class LayerWrapperImpl;
|
||||||
|
|
||||||
class LayerWrapper : public QMapLibreGL::CustomLayerHostInterface
|
class LayerWrapper : public QMapLibre::CustomLayerHostInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit LayerWrapper(std::shared_ptr<GenericLayer> layer);
|
explicit LayerWrapper(std::shared_ptr<GenericLayer> layer);
|
||||||
|
|
@ -24,7 +24,7 @@ public:
|
||||||
LayerWrapper& operator=(LayerWrapper&&) noexcept;
|
LayerWrapper& operator=(LayerWrapper&&) noexcept;
|
||||||
|
|
||||||
void initialize() override final;
|
void initialize() override final;
|
||||||
void render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void deinitialize() override final;
|
void deinitialize() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@ public:
|
||||||
|
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
std::weak_ptr<QMapLibreGL::Map> map_ {};
|
std::weak_ptr<QMapLibre::Map> map_ {};
|
||||||
MapSettings settings_ {};
|
MapSettings settings_ {};
|
||||||
float pixelRatio_ {1.0f};
|
float pixelRatio_ {1.0f};
|
||||||
common::RadarProductGroup radarProductGroup_ {
|
common::RadarProductGroup radarProductGroup_ {
|
||||||
common::RadarProductGroup::Unknown};
|
common::RadarProductGroup::Unknown};
|
||||||
std::string radarProduct_ {"???"};
|
std::string radarProduct_ {"???"};
|
||||||
int16_t radarProductCode_ {0};
|
int16_t radarProductCode_ {0};
|
||||||
QMapLibreGL::CustomLayerRenderParameters renderParameters_ {};
|
QMapLibre::CustomLayerRenderParameters renderParameters_ {};
|
||||||
|
|
||||||
std::shared_ptr<view::OverlayProductView> overlayProductView_ {nullptr};
|
std::shared_ptr<view::OverlayProductView> overlayProductView_ {nullptr};
|
||||||
std::shared_ptr<view::RadarProductView> radarProductView_;
|
std::shared_ptr<view::RadarProductView> radarProductView_;
|
||||||
|
|
@ -43,7 +43,7 @@ MapContext::~MapContext() = default;
|
||||||
MapContext::MapContext(MapContext&&) noexcept = default;
|
MapContext::MapContext(MapContext&&) noexcept = default;
|
||||||
MapContext& MapContext::operator=(MapContext&&) noexcept = default;
|
MapContext& MapContext::operator=(MapContext&&) noexcept = default;
|
||||||
|
|
||||||
std::weak_ptr<QMapLibreGL::Map> MapContext::map() const
|
std::weak_ptr<QMapLibre::Map> MapContext::map() const
|
||||||
{
|
{
|
||||||
return p->map_;
|
return p->map_;
|
||||||
}
|
}
|
||||||
|
|
@ -84,12 +84,12 @@ int16_t MapContext::radar_product_code() const
|
||||||
return p->radarProductCode_;
|
return p->radarProductCode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMapLibreGL::CustomLayerRenderParameters MapContext::render_parameters() const
|
QMapLibre::CustomLayerRenderParameters MapContext::render_parameters() const
|
||||||
{
|
{
|
||||||
return p->renderParameters_;
|
return p->renderParameters_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapContext::set_map(const std::shared_ptr<QMapLibreGL::Map>& map)
|
void MapContext::set_map(const std::shared_ptr<QMapLibre::Map>& map)
|
||||||
{
|
{
|
||||||
p->map_ = map;
|
p->map_ = map;
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +128,7 @@ void MapContext::set_radar_product_code(int16_t radarProductCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapContext::set_render_parameters(
|
void MapContext::set_render_parameters(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
p->renderParameters_ = params;
|
p->renderParameters_ = params;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <scwx/qt/gl/gl_context.hpp>
|
#include <scwx/qt/gl/gl_context.hpp>
|
||||||
#include <scwx/common/products.hpp>
|
#include <scwx/common/products.hpp>
|
||||||
|
|
||||||
#include <QMapLibreGL/QMapLibreGL>
|
#include <qmaplibre.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -35,7 +35,7 @@ public:
|
||||||
MapContext(MapContext&&) noexcept;
|
MapContext(MapContext&&) noexcept;
|
||||||
MapContext& operator=(MapContext&&) noexcept;
|
MapContext& operator=(MapContext&&) noexcept;
|
||||||
|
|
||||||
std::weak_ptr<QMapLibreGL::Map> map() const;
|
std::weak_ptr<QMapLibre::Map> map() const;
|
||||||
MapSettings& settings();
|
MapSettings& settings();
|
||||||
float pixel_ratio() const;
|
float pixel_ratio() const;
|
||||||
std::shared_ptr<view::OverlayProductView> overlay_product_view() const;
|
std::shared_ptr<view::OverlayProductView> overlay_product_view() const;
|
||||||
|
|
@ -43,9 +43,9 @@ public:
|
||||||
common::RadarProductGroup radar_product_group() const;
|
common::RadarProductGroup radar_product_group() const;
|
||||||
std::string radar_product() const;
|
std::string radar_product() const;
|
||||||
int16_t radar_product_code() const;
|
int16_t radar_product_code() const;
|
||||||
QMapLibreGL::CustomLayerRenderParameters render_parameters() const;
|
QMapLibre::CustomLayerRenderParameters render_parameters() const;
|
||||||
|
|
||||||
void set_map(const std::shared_ptr<QMapLibreGL::Map>& map);
|
void set_map(const std::shared_ptr<QMapLibre::Map>& map);
|
||||||
void set_overlay_product_view(
|
void set_overlay_product_view(
|
||||||
const std::shared_ptr<view::OverlayProductView>& overlayProductView);
|
const std::shared_ptr<view::OverlayProductView>& overlayProductView);
|
||||||
void set_pixel_ratio(float pixelRatio);
|
void set_pixel_ratio(float pixelRatio);
|
||||||
|
|
@ -54,8 +54,8 @@ public:
|
||||||
void set_radar_product_group(common::RadarProductGroup radarProductGroup);
|
void set_radar_product_group(common::RadarProductGroup radarProductGroup);
|
||||||
void set_radar_product(const std::string& radarProduct);
|
void set_radar_product(const std::string& radarProduct);
|
||||||
void set_radar_product_code(int16_t radarProductCode);
|
void set_radar_product_code(int16_t radarProductCode);
|
||||||
void set_render_parameters(
|
void
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params);
|
set_render_parameters(const QMapLibre::CustomLayerRenderParameters& params);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ {
|
||||||
.mapProvider_ {MapProvider::Mapbox},
|
.mapProvider_ {MapProvider::Mapbox},
|
||||||
.cacheDbName_ {"mbgl-cache.db"},
|
.cacheDbName_ {"mbgl-cache.db"},
|
||||||
.settingsTemplate_ {
|
.settingsTemplate_ {
|
||||||
QMapLibreGL::Settings::SettingsTemplate::MapboxSettings},
|
QMapLibre::Settings::SettingsTemplate::MapboxSettings},
|
||||||
.mapStyles_ {{.name_ {"Streets"},
|
.mapStyles_ {{.name_ {"Streets"},
|
||||||
.url_ {"mapbox://styles/mapbox/streets-v11"},
|
.url_ {"mapbox://styles/mapbox/streets-v11"},
|
||||||
.drawBelow_ {mapboxDrawBelow_}},
|
.drawBelow_ {mapboxDrawBelow_}},
|
||||||
|
|
@ -51,7 +51,7 @@ static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ {
|
||||||
.mapProvider_ {MapProvider::MapTiler},
|
.mapProvider_ {MapProvider::MapTiler},
|
||||||
.cacheDbName_ {"maptiler-cache.db"},
|
.cacheDbName_ {"maptiler-cache.db"},
|
||||||
.settingsTemplate_ {
|
.settingsTemplate_ {
|
||||||
QMapLibreGL::Settings::SettingsTemplate::MapTilerSettings},
|
QMapLibre::Settings::SettingsTemplate::MapTilerSettings},
|
||||||
.mapStyles_ {
|
.mapStyles_ {
|
||||||
{.name_ {"Satellite"},
|
{.name_ {"Satellite"},
|
||||||
.url_ {"maptiler://maps/hybrid"},
|
.url_ {"maptiler://maps/hybrid"},
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QMapLibreGL/settings.hpp>
|
#include <QMapLibre/Settings>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -34,7 +34,7 @@ struct MapProviderInfo
|
||||||
{
|
{
|
||||||
MapProvider mapProvider_ {MapProvider::Unknown};
|
MapProvider mapProvider_ {MapProvider::Unknown};
|
||||||
std::string cacheDbName_ {};
|
std::string cacheDbName_ {};
|
||||||
QMapLibreGL::Settings::SettingsTemplate settingsTemplate_ {};
|
QMapLibre::Settings::SettingsTemplate settingsTemplate_ {};
|
||||||
std::vector<MapStyle> mapStyles_ {};
|
std::vector<MapStyle> mapStyles_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class MapWidgetImpl : public QObject
|
||||||
public:
|
public:
|
||||||
explicit MapWidgetImpl(MapWidget* widget,
|
explicit MapWidgetImpl(MapWidget* widget,
|
||||||
std::size_t id,
|
std::size_t id,
|
||||||
const QMapLibreGL::Settings& settings) :
|
const QMapLibre::Settings& settings) :
|
||||||
id_ {id},
|
id_ {id},
|
||||||
uuid_ {boost::uuids::random_generator()()},
|
uuid_ {boost::uuids::random_generator()()},
|
||||||
context_ {std::make_shared<MapContext>()},
|
context_ {std::make_shared<MapContext>()},
|
||||||
|
|
@ -171,8 +171,8 @@ public:
|
||||||
|
|
||||||
MapWidget* widget_;
|
MapWidget* widget_;
|
||||||
MapProvider mapProvider_;
|
MapProvider mapProvider_;
|
||||||
QMapLibreGL::Settings settings_;
|
QMapLibre::Settings settings_;
|
||||||
std::shared_ptr<QMapLibreGL::Map> map_;
|
std::shared_ptr<QMapLibre::Map> map_;
|
||||||
std::list<std::string> layerList_;
|
std::list<std::string> layerList_;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<GenericLayer>> genericLayers_ {};
|
std::vector<std::shared_ptr<GenericLayer>> genericLayers_ {};
|
||||||
|
|
@ -229,7 +229,7 @@ public slots:
|
||||||
void Update();
|
void Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
MapWidget::MapWidget(std::size_t id, const QMapLibreGL::Settings& settings) :
|
MapWidget::MapWidget(std::size_t id, const QMapLibre::Settings& settings) :
|
||||||
p(std::make_unique<MapWidgetImpl>(this, id, settings))
|
p(std::make_unique<MapWidgetImpl>(this, id, settings))
|
||||||
{
|
{
|
||||||
if (settings::GeneralSettings::Instance().anti_aliasing_enabled().GetValue())
|
if (settings::GeneralSettings::Instance().anti_aliasing_enabled().GetValue())
|
||||||
|
|
@ -246,7 +246,7 @@ MapWidget::MapWidget(std::size_t id, const QMapLibreGL::Settings& settings) :
|
||||||
|
|
||||||
MapWidget::~MapWidget()
|
MapWidget::~MapWidget()
|
||||||
{
|
{
|
||||||
// Make sure we have a valid context so we can delete the QMapLibreGL.
|
// Make sure we have a valid context so we can delete the QMapLibre.
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -987,8 +987,8 @@ void MapWidgetImpl::AddLayer(const std::string& id,
|
||||||
std::shared_ptr<GenericLayer> layer,
|
std::shared_ptr<GenericLayer> layer,
|
||||||
const std::string& before)
|
const std::string& before)
|
||||||
{
|
{
|
||||||
// QMapLibreGL::addCustomLayer will take ownership of the std::unique_ptr
|
// QMapLibre::addCustomLayer will take ownership of the std::unique_ptr
|
||||||
std::unique_ptr<QMapLibreGL::CustomLayerHostInterface> pHost =
|
std::unique_ptr<QMapLibre::CustomLayerHostInterface> pHost =
|
||||||
std::make_unique<LayerWrapper>(layer);
|
std::make_unique<LayerWrapper>(layer);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
@ -1131,10 +1131,10 @@ void MapWidget::initializeGL()
|
||||||
p->imGuiRendererInitialized_ = true;
|
p->imGuiRendererInitialized_ = true;
|
||||||
|
|
||||||
p->map_.reset(
|
p->map_.reset(
|
||||||
new QMapLibreGL::Map(nullptr, p->settings_, size(), pixelRatio()));
|
new QMapLibre::Map(nullptr, p->settings_, size(), pixelRatio()));
|
||||||
p->context_->set_map(p->map_);
|
p->context_->set_map(p->map_);
|
||||||
connect(p->map_.get(),
|
connect(p->map_.get(),
|
||||||
&QMapLibreGL::Map::needsRendering,
|
&QMapLibre::Map::needsRendering,
|
||||||
p.get(),
|
p.get(),
|
||||||
&MapWidgetImpl::Update);
|
&MapWidgetImpl::Update);
|
||||||
|
|
||||||
|
|
@ -1160,10 +1160,8 @@ void MapWidget::initializeGL()
|
||||||
SetMapStyle(p->initialStyleName_);
|
SetMapStyle(p->initialStyleName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(p->map_.get(),
|
connect(
|
||||||
&QMapLibreGL::Map::mapChanged,
|
p->map_.get(), &QMapLibre::Map::mapChanged, this, &MapWidget::mapChanged);
|
||||||
this,
|
|
||||||
&MapWidget::mapChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::paintGL()
|
void MapWidget::paintGL()
|
||||||
|
|
@ -1192,7 +1190,7 @@ void MapWidget::paintGL()
|
||||||
// Update pixel ratio
|
// Update pixel ratio
|
||||||
p->context_->set_pixel_ratio(pixelRatio());
|
p->context_->set_pixel_ratio(pixelRatio());
|
||||||
|
|
||||||
// Render QMapLibreGL Map
|
// Render QMapLibre Map
|
||||||
p->map_->resize(size());
|
p->map_->resize(size());
|
||||||
p->map_->setFramebufferObject(defaultFramebufferObject(),
|
p->map_->setFramebufferObject(defaultFramebufferObject(),
|
||||||
size() * pixelRatio());
|
size() * pixelRatio());
|
||||||
|
|
@ -1243,7 +1241,7 @@ void MapWidgetImpl::ImGuiCheckFonts()
|
||||||
|
|
||||||
void MapWidgetImpl::RunMousePicking()
|
void MapWidgetImpl::RunMousePicking()
|
||||||
{
|
{
|
||||||
const QMapLibreGL::CustomLayerRenderParameters params =
|
const QMapLibre::CustomLayerRenderParameters params =
|
||||||
context_->render_parameters();
|
context_->render_parameters();
|
||||||
|
|
||||||
auto coordinate = map_->coordinateForPixel(lastPos_);
|
auto coordinate = map_->coordinateForPixel(lastPos_);
|
||||||
|
|
@ -1318,11 +1316,11 @@ void MapWidgetImpl::RunMousePicking()
|
||||||
lastItemPicked_ = itemPicked;
|
lastItemPicked_ = itemPicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::mapChanged(QMapLibreGL::Map::MapChange mapChange)
|
void MapWidget::mapChanged(QMapLibre::Map::MapChange mapChange)
|
||||||
{
|
{
|
||||||
switch (mapChange)
|
switch (mapChange)
|
||||||
{
|
{
|
||||||
case QMapLibreGL::Map::MapChangeDidFinishLoadingStyle:
|
case QMapLibre::Map::MapChangeDidFinishLoadingStyle:
|
||||||
p->UpdateLoadedStyle();
|
p->UpdateLoadedStyle();
|
||||||
p->AddLayers();
|
p->AddLayers();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QMapLibreGL/QMapLibreGL>
|
#include <qmaplibre.hpp>
|
||||||
|
|
||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
@ -33,7 +33,7 @@ class MapWidget : public QOpenGLWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MapWidget(std::size_t id, const QMapLibreGL::Settings&);
|
explicit MapWidget(std::size_t id, const QMapLibre::Settings&);
|
||||||
~MapWidget();
|
~MapWidget();
|
||||||
|
|
||||||
void DumpLayerList() const;
|
void DumpLayerList() const;
|
||||||
|
|
@ -139,7 +139,7 @@ private:
|
||||||
friend class MapWidgetImpl;
|
friend class MapWidgetImpl;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void mapChanged(QMapLibreGL::Map::MapChange);
|
void mapChanged(QMapLibre::Map::MapChange);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Level3ProductsChanged();
|
void Level3ProductsChanged();
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,7 @@ void OverlayLayer::Initialize()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayLayer::Render(
|
void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
auto radarProductView = context()->radar_product_view();
|
auto radarProductView = context()->radar_product_view();
|
||||||
|
|
@ -393,7 +392,7 @@ void OverlayLayer::Deinitialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayLayer::RunMousePicking(
|
bool OverlayLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ public:
|
||||||
~OverlayLayer();
|
~OverlayLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
bool RunMousePicking(
|
bool RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ void OverlayProductLayer::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayProductLayer::Render(
|
void OverlayProductLayer::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
|
|
@ -436,7 +436,7 @@ std::string OverlayProductLayer::Impl::BuildHoverText(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverlayProductLayer::RunMousePicking(
|
bool OverlayProductLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ public:
|
||||||
~OverlayProductLayer();
|
~OverlayProductLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
bool RunMousePicking(
|
bool RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ void PlacefileLayer::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacefileLayer::Render(
|
void PlacefileLayer::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public:
|
||||||
void set_placefile_name(const std::string& placefileName);
|
void set_placefile_name(const std::string& placefileName);
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
void ReloadData();
|
void ReloadData();
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ void RadarProductLayer::UpdateSweep()
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarProductLayer::Render(
|
void RadarProductLayer::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
|
|
@ -329,7 +329,7 @@ void RadarProductLayer::Deinitialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadarProductLayer::RunMousePicking(
|
bool RadarProductLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibre::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& /* mouseCoords */,
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ public:
|
||||||
~RadarProductLayer();
|
~RadarProductLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ namespace map
|
||||||
static const std::string logPrefix_ = "scwx::qt::map::radar_range_layer";
|
static const std::string logPrefix_ = "scwx::qt::map::radar_range_layer";
|
||||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
static std::shared_ptr<QMapLibreGL::Feature>
|
static std::shared_ptr<QMapLibre::Feature>
|
||||||
GetRangeCircle(float range, QMapLibreGL::Coordinate center);
|
GetRangeCircle(float range, QMapLibre::Coordinate center);
|
||||||
|
|
||||||
void RadarRangeLayer::Add(std::shared_ptr<QMapLibreGL::Map> map,
|
void RadarRangeLayer::Add(std::shared_ptr<QMapLibre::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapLibreGL::Coordinate center,
|
QMapLibre::Coordinate center,
|
||||||
const QString& before)
|
const QString& before)
|
||||||
{
|
{
|
||||||
static const QString layerId = QString::fromStdString(types::GetLayerName(
|
static const QString layerId = QString::fromStdString(types::GetLayerName(
|
||||||
|
|
@ -37,7 +37,7 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
map->removeSource("rangeCircleSource");
|
map->removeSource("rangeCircleSource");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
|
std::shared_ptr<QMapLibre::Feature> rangeCircle =
|
||||||
GetRangeCircle(range, center);
|
GetRangeCircle(range, center);
|
||||||
|
|
||||||
map->addSource(
|
map->addSource(
|
||||||
|
|
@ -49,19 +49,19 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
map->setPaintProperty(layerId, "line-color", "rgba(128, 128, 128, 128)");
|
map->setPaintProperty(layerId, "line-color", "rgba(128, 128, 128, 128)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarRangeLayer::Update(std::shared_ptr<QMapLibreGL::Map> map,
|
void RadarRangeLayer::Update(std::shared_ptr<QMapLibre::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapLibreGL::Coordinate center)
|
QMapLibre::Coordinate center)
|
||||||
{
|
{
|
||||||
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
|
std::shared_ptr<QMapLibre::Feature> rangeCircle =
|
||||||
GetRangeCircle(range, center);
|
GetRangeCircle(range, center);
|
||||||
|
|
||||||
map->updateSource("rangeCircleSource",
|
map->updateSource("rangeCircleSource",
|
||||||
{{"data", QVariant::fromValue(*rangeCircle)}});
|
{{"data", QVariant::fromValue(*rangeCircle)}});
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<QMapLibreGL::Feature>
|
static std::shared_ptr<QMapLibre::Feature>
|
||||||
GetRangeCircle(float range, QMapLibreGL::Coordinate center)
|
GetRangeCircle(float range, QMapLibre::Coordinate center)
|
||||||
{
|
{
|
||||||
const GeographicLib::Geodesic& geodesic(
|
const GeographicLib::Geodesic& geodesic(
|
||||||
util::GeographicLib::DefaultGeodesic());
|
util::GeographicLib::DefaultGeodesic());
|
||||||
|
|
@ -71,7 +71,7 @@ GetRangeCircle(float range, QMapLibreGL::Coordinate center)
|
||||||
|
|
||||||
float angle = -angleDeltaH;
|
float angle = -angleDeltaH;
|
||||||
|
|
||||||
QMapLibreGL::Coordinates geometry;
|
QMapLibre::Coordinates geometry;
|
||||||
|
|
||||||
for (uint16_t azimuth = 0; azimuth <= 720; ++azimuth)
|
for (uint16_t azimuth = 0; azimuth <= 720; ++azimuth)
|
||||||
{
|
{
|
||||||
|
|
@ -90,11 +90,11 @@ GetRangeCircle(float range, QMapLibreGL::Coordinate center)
|
||||||
angle += angleDelta;
|
angle += angleDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
|
std::shared_ptr<QMapLibre::Feature> rangeCircle =
|
||||||
std::make_shared<QMapLibreGL::Feature>(
|
std::make_shared<QMapLibre::Feature>(
|
||||||
QMapLibreGL::Feature::LineStringType,
|
QMapLibre::Feature::LineStringType,
|
||||||
std::initializer_list<QMapLibreGL::CoordinatesCollection> {
|
std::initializer_list<QMapLibre::CoordinatesCollection> {
|
||||||
std::initializer_list<QMapLibreGL::Coordinates> {geometry}});
|
std::initializer_list<QMapLibre::Coordinates> {geometry}});
|
||||||
|
|
||||||
return rangeCircle;
|
return rangeCircle;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMapLibreGL/QMapLibreGL>
|
#include <qmaplibre.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -11,13 +11,13 @@ namespace map
|
||||||
namespace RadarRangeLayer
|
namespace RadarRangeLayer
|
||||||
{
|
{
|
||||||
|
|
||||||
void Add(std::shared_ptr<QMapLibreGL::Map> map,
|
void Add(std::shared_ptr<QMapLibre::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapLibreGL::Coordinate center,
|
QMapLibre::Coordinate center,
|
||||||
const QString& before = QString());
|
const QString& before = QString());
|
||||||
void Update(std::shared_ptr<QMapLibreGL::Map> map,
|
void Update(std::shared_ptr<QMapLibre::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapLibreGL::Coordinate center);
|
QMapLibre::Coordinate center);
|
||||||
|
|
||||||
} // namespace RadarRangeLayer
|
} // namespace RadarRangeLayer
|
||||||
} // namespace map
|
} // namespace map
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#include <scwx/common/geographic.hpp>
|
#include <scwx/common/geographic.hpp>
|
||||||
#include <scwx/util/logger.hpp>
|
#include <scwx/util/logger.hpp>
|
||||||
|
|
||||||
// #include <GeographicLib/Geodesic.hpp>
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <mbgl/util/constants.hpp>
|
#include <mbgl/util/constants.hpp>
|
||||||
|
|
||||||
|
|
@ -26,7 +25,7 @@ public:
|
||||||
explicit Impl(RadarSiteLayer* self) : self_ {self} {}
|
explicit Impl(RadarSiteLayer* self) : self_ {self} {}
|
||||||
~Impl() = default;
|
~Impl() = default;
|
||||||
|
|
||||||
void RenderRadarSite(const QMapLibreGL::CustomLayerRenderParameters& params,
|
void RenderRadarSite(const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
std::shared_ptr<config::RadarSite>& radarSite);
|
std::shared_ptr<config::RadarSite>& radarSite);
|
||||||
|
|
||||||
RadarSiteLayer* self_;
|
RadarSiteLayer* self_;
|
||||||
|
|
@ -58,7 +57,7 @@ void RadarSiteLayer::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarSiteLayer::Render(
|
void RadarSiteLayer::Render(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
|
|
@ -90,7 +89,7 @@ void RadarSiteLayer::Render(
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarSiteLayer::Impl::RenderRadarSite(
|
void RadarSiteLayer::Impl::RenderRadarSite(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
std::shared_ptr<config::RadarSite>& radarSite)
|
std::shared_ptr<config::RadarSite>& radarSite)
|
||||||
{
|
{
|
||||||
const std::string windowName = fmt::format("radar-site-{}", radarSite->id());
|
const std::string windowName = fmt::format("radar-site-{}", radarSite->id());
|
||||||
|
|
@ -158,7 +157,7 @@ void RadarSiteLayer::Deinitialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadarSiteLayer::RunMousePicking(
|
bool RadarSiteLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibre::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& /* mouseCoords */,
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ public:
|
||||||
~RadarSiteLayer();
|
~RadarSiteLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
bool RunMousePicking(
|
bool RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibre::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords,
|
const glm::vec2& mouseCoords,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <scwx/qt/util/maplibre.hpp>
|
#include <scwx/qt/util/maplibre.hpp>
|
||||||
|
|
||||||
#include <QMapLibreGL/utils.hpp>
|
#include <QMapLibre/Utils>
|
||||||
#include <mbgl/util/constants.hpp>
|
#include <mbgl/util/constants.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
|
|
@ -13,14 +13,14 @@ namespace maplibre
|
||||||
{
|
{
|
||||||
|
|
||||||
units::length::meters<double>
|
units::length::meters<double>
|
||||||
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params)
|
GetMapDistance(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
return units::length::meters<double>(
|
return units::length::meters<double>(
|
||||||
QMapLibreGL::metersPerPixelAtLatitude(params.latitude, params.zoom) *
|
QMapLibre::metersPerPixelAtLatitude(params.latitude, params.zoom) *
|
||||||
(params.width + params.height) / 2.0);
|
(params.width + params.height) / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params)
|
glm::mat4 GetMapMatrix(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
glm::vec2 scale = GetMapScale(params);
|
glm::vec2 scale = GetMapScale(params);
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
return mapMatrix;
|
return mapMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params)
|
glm::vec2 GetMapScale(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
const float scale = std::pow(2.0, params.zoom) * 2.0f *
|
const float scale = std::pow(2.0, params.zoom) * 2.0f *
|
||||||
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
||||||
|
|
@ -73,7 +73,7 @@ bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
|
||||||
return inPolygon;
|
return inPolygon;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
|
glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate)
|
||||||
{
|
{
|
||||||
static constexpr double RAD2DEG_D = 180.0 / M_PI;
|
static constexpr double RAD2DEG_D = 180.0 / M_PI;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMapLibreGL/types.hpp>
|
#include <QMapLibre/Types>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
#include <units/length.h>
|
#include <units/length.h>
|
||||||
|
|
||||||
|
|
@ -14,9 +14,9 @@ namespace maplibre
|
||||||
{
|
{
|
||||||
|
|
||||||
units::length::meters<double>
|
units::length::meters<double>
|
||||||
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params);
|
GetMapDistance(const QMapLibre::CustomLayerRenderParameters& params);
|
||||||
glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params);
|
glm::mat4 GetMapMatrix(const QMapLibre::CustomLayerRenderParameters& params);
|
||||||
glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params);
|
glm::vec2 GetMapScale(const QMapLibre::CustomLayerRenderParameters& params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determine whether a point lies within a polygon
|
* @brief Determine whether a point lies within a polygon
|
||||||
|
|
@ -29,7 +29,7 @@ glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params);
|
||||||
bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
|
bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
|
||||||
const glm::vec2& point);
|
const glm::vec2& point);
|
||||||
|
|
||||||
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate);
|
glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate);
|
||||||
|
|
||||||
} // namespace maplibre
|
} // namespace maplibre
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue