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

View file

@ -164,10 +164,10 @@ public:
boost::asio::thread_pool threadPool_ {1u};
MainWindow* mainWindow_;
QMapLibreGL::Settings settings_;
map::MapProvider mapProvider_;
map::MapWidget* activeMap_;
MainWindow* mainWindow_;
QMapLibre::Settings settings_;
map::MapProvider mapProvider_;
map::MapWidget* activeMap_;
ui::CollapsibleGroup* mapSettingsGroup_;
ui::CollapsibleGroup* level2ProductsGroup_;

View file

@ -26,7 +26,7 @@
#include <boost/range/irange.hpp>
#include <boost/timer/timer.hpp>
#include <fmt/chrono.h>
#include <QMapLibreGL/QMapLibreGL>
#include <qmaplibre.hpp>
#if defined(_MSC_VER)
# pragma warning(pop)
@ -423,8 +423,8 @@ void RadarProductManager::Initialize()
const GeographicLib::Geodesic& geodesic(
util::GeographicLib::DefaultGeodesic());
const QMapLibreGL::Coordinate radar(p->radarSite_->latitude(),
p->radarSite_->longitude());
const QMapLibre::Coordinate radar(p->radarSite_->latitude(),
p->radarSite_->longitude());
const float gateSize = gate_size();

View file

@ -24,22 +24,22 @@ static const std::string logPrefix_ = "scwx::qt::map::alert_layer";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static std::vector<std::string>
AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
awips::Phenomenon phenomenon,
bool alertActive,
const QString& beforeLayer);
static QMapLibreGL::Feature
AddAlertLayer(std::shared_ptr<QMapLibre::Map> map,
awips::Phenomenon phenomenon,
bool alertActive,
const QString& beforeLayer);
static QMapLibre::Feature
CreateFeature(const awips::CodedLocation& codedLocation);
static QMapLibreGL::Coordinate
static QMapLibre::Coordinate
GetMapboxCoordinate(const common::Coordinate& coordinate);
static QMapLibreGL::Coordinates
static QMapLibre::Coordinates
GetMapboxCoordinates(const awips::CodedLocation& codedLocation);
static QString GetSourceId(awips::Phenomenon phenomenon, bool alertActive);
static QString GetSuffix(awips::Phenomenon phenomenon, bool alertActive);
static const QVariantMap kEmptyFeatureCollection_ {
{"type", "geojson"},
{"data", QVariant::fromValue(std::list<QMapLibreGL::Feature> {})}};
{"data", QVariant::fromValue(std::list<QMapLibre::Feature> {})}};
static const std::vector<awips::Phenomenon> kAlertPhenomena_ {
awips::Phenomenon::Marine,
awips::Phenomenon::FlashFlood,
@ -87,8 +87,8 @@ class AlertLayerHandler : public QObject
static std::shared_ptr<AlertLayerHandler> Instance();
std::list<QMapLibreGL::Feature>* FeatureList(awips::Phenomenon phenomenon,
bool alertActive);
std::list<QMapLibre::Feature>* FeatureList(awips::Phenomenon phenomenon,
bool alertActive);
void HandleAlert(const types::TextEventKey& key, size_t messageIndex);
void UpdateAlerts();
@ -103,7 +103,7 @@ class AlertLayerHandler : public QObject
std::unordered_multimap<types::TextEventKey,
std::tuple<awips::Phenomenon,
bool,
std::list<QMapLibreGL::Feature>::iterator,
std::list<QMapLibre::Feature>::iterator,
std::chrono::system_clock::time_point>,
types::TextEventHash<types::TextEventKey>>
featureMap_;
@ -166,16 +166,16 @@ std::vector<std::string> AlertLayer::AddLayers(awips::Phenomenon phenomenon,
return layers;
}
std::list<QMapLibreGL::Feature>*
std::list<QMapLibre::Feature>*
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 it = alertSourceMap_.find(key);
if (it != alertSourceMap_.cend())
{
featureList = reinterpret_cast<std::list<QMapLibreGL::Feature>*>(
featureList = reinterpret_cast<std::list<QMapLibre::Feature>*>(
it->second["data"].data());
}
@ -371,10 +371,10 @@ std::shared_ptr<AlertLayerHandler> AlertLayerHandler::Instance()
}
static std::vector<std::string>
AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
awips::Phenomenon phenomenon,
bool alertActive,
const QString& beforeLayer)
AddAlertLayer(std::shared_ptr<QMapLibre::Map> map,
awips::Phenomenon phenomenon,
bool alertActive,
const QString& beforeLayer)
{
settings::PaletteSettings& paletteSettings =
settings::PaletteSettings::Instance();
@ -426,33 +426,33 @@ AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
return {bgLayerId.toStdString(), fgLayerId.toStdString()};
}
static QMapLibreGL::Feature
static QMapLibre::Feature
CreateFeature(const awips::CodedLocation& codedLocation)
{
auto mapboxCoordinates = GetMapboxCoordinates(codedLocation);
return {QMapLibreGL::Feature::PolygonType,
std::initializer_list<QMapLibreGL::CoordinatesCollection> {
std::initializer_list<QMapLibreGL::Coordinates> {
{mapboxCoordinates}}}};
return {
QMapLibre::Feature::PolygonType,
std::initializer_list<QMapLibre::CoordinatesCollection> {
std::initializer_list<QMapLibre::Coordinates> {{mapboxCoordinates}}}};
}
static QMapLibreGL::Coordinate
static QMapLibre::Coordinate
GetMapboxCoordinate(const common::Coordinate& coordinate)
{
return {coordinate.latitude_, coordinate.longitude_};
}
static QMapLibreGL::Coordinates
static QMapLibre::Coordinates
GetMapboxCoordinates(const awips::CodedLocation& codedLocation)
{
auto scwxCoordinates = codedLocation.coordinates();
QMapLibreGL::Coordinates mapboxCoordinates(scwxCoordinates.size() + 1u);
auto scwxCoordinates = codedLocation.coordinates();
QMapLibre::Coordinates mapboxCoordinates(scwxCoordinates.size() + 1u);
std::transform(scwxCoordinates.cbegin(),
scwxCoordinates.cend(),
mapboxCoordinates.begin(),
[](auto& coordinate) -> QMapLibreGL::Coordinate
[](auto& coordinate) -> QMapLibre::Coordinate
{ return GetMapboxCoordinate(coordinate); });
mapboxCoordinates.back() = GetMapboxCoordinate(scwxCoordinates.front());

View file

@ -116,7 +116,7 @@ void ColorTableLayer::Initialize()
}
void ColorTableLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();
auto radarProductView = context()->radar_product_view();

View file

@ -18,7 +18,7 @@ public:
~ColorTableLayer();
void Initialize() override final;
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
void Deinitialize() override final;
private:

View file

@ -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();
p->textureAtlas_ = p->context_->GetTextureAtlas();
@ -77,12 +77,12 @@ void DrawLayer::Deinitialize()
}
bool DrawLayer::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)
{
bool itemPicked = false;

View file

@ -19,16 +19,15 @@ public:
virtual ~DrawLayer();
virtual void Initialize() override;
virtual void
Render(const QMapLibreGL::CustomLayerRenderParameters&) override;
virtual void Render(const QMapLibre::CustomLayerRenderParameters&) override;
virtual void Deinitialize() override;
virtual 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;
protected:

View file

@ -27,7 +27,7 @@ GenericLayer::GenericLayer(std::shared_ptr<MapContext> context) :
GenericLayer::~GenericLayer() = default;
bool GenericLayer::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
const QMapLibre::CustomLayerRenderParameters& /* params */,
const QPointF& /* mouseLocalPos */,
const QPointF& /* mouseGlobalPos */,
const glm::vec2& /* mousePos */,

View file

@ -7,8 +7,8 @@
#include <memory>
#include <QObject>
#include <QMapLibreGL/QMapLibreGL>
#include <glm/gtc/type_ptr.hpp>
#include <qmaplibre.hpp>
namespace scwx
{
@ -27,9 +27,9 @@ public:
explicit GenericLayer(std::shared_ptr<MapContext> context);
virtual ~GenericLayer();
virtual void Initialize() = 0;
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters&) = 0;
virtual void Deinitialize() = 0;
virtual void Initialize() = 0;
virtual void Render(const QMapLibre::CustomLayerRenderParameters&) = 0;
virtual void Deinitialize() = 0;
/**
* @brief Run mouse picking on the layer.
@ -44,12 +44,12 @@ public:
* @return true if a 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);
signals:
void NeedsRendering();

View file

@ -34,8 +34,7 @@ void LayerWrapper::initialize()
p->layer_->Initialize();
}
void LayerWrapper::render(
const QMapLibreGL::CustomLayerRenderParameters& params)
void LayerWrapper::render(const QMapLibre::CustomLayerRenderParameters& params)
{
p->layer_->Render(params);
}

View file

@ -11,7 +11,7 @@ namespace map
class LayerWrapperImpl;
class LayerWrapper : public QMapLibreGL::CustomLayerHostInterface
class LayerWrapper : public QMapLibre::CustomLayerHostInterface
{
public:
explicit LayerWrapper(std::shared_ptr<GenericLayer> layer);
@ -24,7 +24,7 @@ public:
LayerWrapper& operator=(LayerWrapper&&) noexcept;
void initialize() override final;
void render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void render(const QMapLibre::CustomLayerRenderParameters&) override final;
void deinitialize() override final;
private:

View file

@ -20,14 +20,14 @@ public:
~Impl() {}
std::weak_ptr<QMapLibreGL::Map> map_ {};
MapSettings settings_ {};
float pixelRatio_ {1.0f};
common::RadarProductGroup radarProductGroup_ {
std::weak_ptr<QMapLibre::Map> map_ {};
MapSettings settings_ {};
float pixelRatio_ {1.0f};
common::RadarProductGroup radarProductGroup_ {
common::RadarProductGroup::Unknown};
std::string radarProduct_ {"???"};
int16_t radarProductCode_ {0};
QMapLibreGL::CustomLayerRenderParameters renderParameters_ {};
std::string radarProduct_ {"???"};
int16_t radarProductCode_ {0};
QMapLibre::CustomLayerRenderParameters renderParameters_ {};
std::shared_ptr<view::OverlayProductView> overlayProductView_ {nullptr};
std::shared_ptr<view::RadarProductView> radarProductView_;
@ -43,7 +43,7 @@ MapContext::~MapContext() = default;
MapContext::MapContext(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_;
}
@ -84,12 +84,12 @@ int16_t MapContext::radar_product_code() const
return p->radarProductCode_;
}
QMapLibreGL::CustomLayerRenderParameters MapContext::render_parameters() const
QMapLibre::CustomLayerRenderParameters MapContext::render_parameters() const
{
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;
}
@ -128,7 +128,7 @@ void MapContext::set_radar_product_code(int16_t radarProductCode)
}
void MapContext::set_render_parameters(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
p->renderParameters_ = params;
}

View file

@ -3,7 +3,7 @@
#include <scwx/qt/gl/gl_context.hpp>
#include <scwx/common/products.hpp>
#include <QMapLibreGL/QMapLibreGL>
#include <qmaplibre.hpp>
namespace scwx
{
@ -35,7 +35,7 @@ public:
MapContext(MapContext&&) noexcept;
MapContext& operator=(MapContext&&) noexcept;
std::weak_ptr<QMapLibreGL::Map> map() const;
std::weak_ptr<QMapLibre::Map> map() const;
MapSettings& settings();
float pixel_ratio() const;
std::shared_ptr<view::OverlayProductView> overlay_product_view() const;
@ -43,9 +43,9 @@ public:
common::RadarProductGroup radar_product_group() const;
std::string radar_product() 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(
const std::shared_ptr<view::OverlayProductView>& overlayProductView);
void set_pixel_ratio(float pixelRatio);
@ -54,8 +54,8 @@ public:
void set_radar_product_group(common::RadarProductGroup radarProductGroup);
void set_radar_product(const std::string& radarProduct);
void set_radar_product_code(int16_t radarProductCode);
void set_render_parameters(
const QMapLibreGL::CustomLayerRenderParameters& params);
void
set_render_parameters(const QMapLibre::CustomLayerRenderParameters& params);
private:
class Impl;

View file

@ -27,7 +27,7 @@ static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ {
.mapProvider_ {MapProvider::Mapbox},
.cacheDbName_ {"mbgl-cache.db"},
.settingsTemplate_ {
QMapLibreGL::Settings::SettingsTemplate::MapboxSettings},
QMapLibre::Settings::SettingsTemplate::MapboxSettings},
.mapStyles_ {{.name_ {"Streets"},
.url_ {"mapbox://styles/mapbox/streets-v11"},
.drawBelow_ {mapboxDrawBelow_}},
@ -51,7 +51,7 @@ static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ {
.mapProvider_ {MapProvider::MapTiler},
.cacheDbName_ {"maptiler-cache.db"},
.settingsTemplate_ {
QMapLibreGL::Settings::SettingsTemplate::MapTilerSettings},
QMapLibre::Settings::SettingsTemplate::MapTilerSettings},
.mapStyles_ {
{.name_ {"Satellite"},
.url_ {"maptiler://maps/hybrid"},

View file

@ -4,7 +4,7 @@
#include <string>
#include <QMapLibreGL/settings.hpp>
#include <QMapLibre/Settings>
namespace scwx
{
@ -32,10 +32,10 @@ struct MapStyle
struct MapProviderInfo
{
MapProvider mapProvider_ {MapProvider::Unknown};
std::string cacheDbName_ {};
QMapLibreGL::Settings::SettingsTemplate settingsTemplate_ {};
std::vector<MapStyle> mapStyles_ {};
MapProvider mapProvider_ {MapProvider::Unknown};
std::string cacheDbName_ {};
QMapLibre::Settings::SettingsTemplate settingsTemplate_ {};
std::vector<MapStyle> mapStyles_ {};
};
MapProvider GetMapProvider(const std::string& name);

View file

@ -60,9 +60,9 @@ class MapWidgetImpl : public QObject
Q_OBJECT
public:
explicit MapWidgetImpl(MapWidget* widget,
std::size_t id,
const QMapLibreGL::Settings& settings) :
explicit MapWidgetImpl(MapWidget* widget,
std::size_t id,
const QMapLibre::Settings& settings) :
id_ {id},
uuid_ {boost::uuids::random_generator()()},
context_ {std::make_shared<MapContext>()},
@ -169,11 +169,11 @@ public:
std::shared_ptr<MapContext> context_;
MapWidget* widget_;
MapProvider mapProvider_;
QMapLibreGL::Settings settings_;
std::shared_ptr<QMapLibreGL::Map> map_;
std::list<std::string> layerList_;
MapWidget* widget_;
MapProvider mapProvider_;
QMapLibre::Settings settings_;
std::shared_ptr<QMapLibre::Map> map_;
std::list<std::string> layerList_;
std::vector<std::shared_ptr<GenericLayer>> genericLayers_ {};
@ -229,7 +229,7 @@ public slots:
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))
{
if (settings::GeneralSettings::Instance().anti_aliasing_enabled().GetValue())
@ -246,7 +246,7 @@ MapWidget::MapWidget(std::size_t id, const QMapLibreGL::Settings& settings) :
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();
}
@ -987,8 +987,8 @@ void MapWidgetImpl::AddLayer(const std::string& id,
std::shared_ptr<GenericLayer> layer,
const std::string& before)
{
// QMapLibreGL::addCustomLayer will take ownership of the std::unique_ptr
std::unique_ptr<QMapLibreGL::CustomLayerHostInterface> pHost =
// QMapLibre::addCustomLayer will take ownership of the std::unique_ptr
std::unique_ptr<QMapLibre::CustomLayerHostInterface> pHost =
std::make_unique<LayerWrapper>(layer);
try
@ -1131,10 +1131,10 @@ void MapWidget::initializeGL()
p->imGuiRendererInitialized_ = true;
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_);
connect(p->map_.get(),
&QMapLibreGL::Map::needsRendering,
&QMapLibre::Map::needsRendering,
p.get(),
&MapWidgetImpl::Update);
@ -1160,10 +1160,8 @@ void MapWidget::initializeGL()
SetMapStyle(p->initialStyleName_);
}
connect(p->map_.get(),
&QMapLibreGL::Map::mapChanged,
this,
&MapWidget::mapChanged);
connect(
p->map_.get(), &QMapLibre::Map::mapChanged, this, &MapWidget::mapChanged);
}
void MapWidget::paintGL()
@ -1192,7 +1190,7 @@ void MapWidget::paintGL()
// Update pixel ratio
p->context_->set_pixel_ratio(pixelRatio());
// Render QMapLibreGL Map
// Render QMapLibre Map
p->map_->resize(size());
p->map_->setFramebufferObject(defaultFramebufferObject(),
size() * pixelRatio());
@ -1243,7 +1241,7 @@ void MapWidgetImpl::ImGuiCheckFonts()
void MapWidgetImpl::RunMousePicking()
{
const QMapLibreGL::CustomLayerRenderParameters params =
const QMapLibre::CustomLayerRenderParameters params =
context_->render_parameters();
auto coordinate = map_->coordinateForPixel(lastPos_);
@ -1318,11 +1316,11 @@ void MapWidgetImpl::RunMousePicking()
lastItemPicked_ = itemPicked;
}
void MapWidget::mapChanged(QMapLibreGL::Map::MapChange mapChange)
void MapWidget::mapChanged(QMapLibre::Map::MapChange mapChange)
{
switch (mapChange)
{
case QMapLibreGL::Map::MapChangeDidFinishLoadingStyle:
case QMapLibre::Map::MapChangeDidFinishLoadingStyle:
p->UpdateLoadedStyle();
p->AddLayers();
break;

View file

@ -9,7 +9,7 @@
#include <chrono>
#include <memory>
#include <QMapLibreGL/QMapLibreGL>
#include <qmaplibre.hpp>
#include <QOpenGLWidget>
#include <QPropertyAnimation>
@ -33,7 +33,7 @@ class MapWidget : public QOpenGLWidget
Q_OBJECT
public:
explicit MapWidget(std::size_t id, const QMapLibreGL::Settings&);
explicit MapWidget(std::size_t id, const QMapLibre::Settings&);
~MapWidget();
void DumpLayerList() const;
@ -139,7 +139,7 @@ private:
friend class MapWidgetImpl;
private slots:
void mapChanged(QMapLibreGL::Map::MapChange);
void mapChanged(QMapLibre::Map::MapChange);
signals:
void Level3ProductsChanged();

View file

@ -204,8 +204,7 @@ void OverlayLayer::Initialize()
});
}
void OverlayLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();
auto radarProductView = context()->radar_product_view();
@ -393,12 +392,12 @@ void OverlayLayer::Deinitialize()
}
bool OverlayLayer::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)
{
// If sweep time was picked, don't process additional items
if (p->sweepTimePicked_)

View file

@ -18,15 +18,15 @@ public:
~OverlayLayer();
void Initialize() override final;
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
void Deinitialize() override final;
bool RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
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 final;
public slots:

View file

@ -139,7 +139,7 @@ void OverlayProductLayer::Initialize()
}
void OverlayProductLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();
@ -436,12 +436,12 @@ std::string OverlayProductLayer::Impl::BuildHoverText(
}
bool OverlayProductLayer::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 DrawLayer::RunMousePicking(params,
mouseLocalPos,

View file

@ -16,15 +16,15 @@ public:
~OverlayProductLayer();
void Initialize() override final;
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
void Deinitialize() override final;
bool RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
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 final;
private:

View file

@ -124,7 +124,7 @@ void PlacefileLayer::Initialize()
}
void PlacefileLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();

View file

@ -25,7 +25,7 @@ public:
void set_placefile_name(const std::string& placefileName);
void Initialize() override final;
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
void Deinitialize() override final;
void ReloadData();

View file

@ -261,7 +261,7 @@ void RadarProductLayer::UpdateSweep()
}
void RadarProductLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();
@ -329,7 +329,7 @@ void RadarProductLayer::Deinitialize()
}
bool RadarProductLayer::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
const QMapLibre::CustomLayerRenderParameters& /* params */,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& /* mouseCoords */,

View file

@ -18,15 +18,15 @@ public:
~RadarProductLayer();
void Initialize() override final;
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
void Deinitialize() override final;
virtual 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;
private:

View file

@ -15,13 +15,13 @@ namespace map
static const std::string logPrefix_ = "scwx::qt::map::radar_range_layer";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
static std::shared_ptr<QMapLibreGL::Feature>
GetRangeCircle(float range, QMapLibreGL::Coordinate center);
static std::shared_ptr<QMapLibre::Feature>
GetRangeCircle(float range, QMapLibre::Coordinate center);
void RadarRangeLayer::Add(std::shared_ptr<QMapLibreGL::Map> map,
float range,
QMapLibreGL::Coordinate center,
const QString& before)
void RadarRangeLayer::Add(std::shared_ptr<QMapLibre::Map> map,
float range,
QMapLibre::Coordinate center,
const QString& before)
{
static const QString layerId = QString::fromStdString(types::GetLayerName(
types::LayerType::Data, types::DataLayer::RadarRange));
@ -37,7 +37,7 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapLibreGL::Map> map,
map->removeSource("rangeCircleSource");
}
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
std::shared_ptr<QMapLibre::Feature> rangeCircle =
GetRangeCircle(range, center);
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)");
}
void RadarRangeLayer::Update(std::shared_ptr<QMapLibreGL::Map> map,
float range,
QMapLibreGL::Coordinate center)
void RadarRangeLayer::Update(std::shared_ptr<QMapLibre::Map> map,
float range,
QMapLibre::Coordinate center)
{
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
std::shared_ptr<QMapLibre::Feature> rangeCircle =
GetRangeCircle(range, center);
map->updateSource("rangeCircleSource",
{{"data", QVariant::fromValue(*rangeCircle)}});
}
static std::shared_ptr<QMapLibreGL::Feature>
GetRangeCircle(float range, QMapLibreGL::Coordinate center)
static std::shared_ptr<QMapLibre::Feature>
GetRangeCircle(float range, QMapLibre::Coordinate center)
{
const GeographicLib::Geodesic& geodesic(
util::GeographicLib::DefaultGeodesic());
@ -71,7 +71,7 @@ GetRangeCircle(float range, QMapLibreGL::Coordinate center)
float angle = -angleDeltaH;
QMapLibreGL::Coordinates geometry;
QMapLibre::Coordinates geometry;
for (uint16_t azimuth = 0; azimuth <= 720; ++azimuth)
{
@ -90,11 +90,11 @@ GetRangeCircle(float range, QMapLibreGL::Coordinate center)
angle += angleDelta;
}
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
std::make_shared<QMapLibreGL::Feature>(
QMapLibreGL::Feature::LineStringType,
std::initializer_list<QMapLibreGL::CoordinatesCollection> {
std::initializer_list<QMapLibreGL::Coordinates> {geometry}});
std::shared_ptr<QMapLibre::Feature> rangeCircle =
std::make_shared<QMapLibre::Feature>(
QMapLibre::Feature::LineStringType,
std::initializer_list<QMapLibre::CoordinatesCollection> {
std::initializer_list<QMapLibre::Coordinates> {geometry}});
return rangeCircle;
}

View file

@ -1,6 +1,6 @@
#pragma once
#include <QMapLibreGL/QMapLibreGL>
#include <qmaplibre.hpp>
namespace scwx
{
@ -11,13 +11,13 @@ namespace map
namespace RadarRangeLayer
{
void Add(std::shared_ptr<QMapLibreGL::Map> map,
float range,
QMapLibreGL::Coordinate center,
const QString& before = QString());
void Update(std::shared_ptr<QMapLibreGL::Map> map,
float range,
QMapLibreGL::Coordinate center);
void Add(std::shared_ptr<QMapLibre::Map> map,
float range,
QMapLibre::Coordinate center,
const QString& before = QString());
void Update(std::shared_ptr<QMapLibre::Map> map,
float range,
QMapLibre::Coordinate center);
} // namespace RadarRangeLayer
} // namespace map

View file

@ -6,7 +6,6 @@
#include <scwx/common/geographic.hpp>
#include <scwx/util/logger.hpp>
// #include <GeographicLib/Geodesic.hpp>
#include <imgui.h>
#include <mbgl/util/constants.hpp>
@ -26,7 +25,7 @@ public:
explicit Impl(RadarSiteLayer* self) : self_ {self} {}
~Impl() = default;
void RenderRadarSite(const QMapLibreGL::CustomLayerRenderParameters& params,
void RenderRadarSite(const QMapLibre::CustomLayerRenderParameters& params,
std::shared_ptr<config::RadarSite>& radarSite);
RadarSiteLayer* self_;
@ -58,7 +57,7 @@ void RadarSiteLayer::Initialize()
}
void RadarSiteLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
const QMapLibre::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();
@ -90,8 +89,8 @@ void RadarSiteLayer::Render(
}
void RadarSiteLayer::Impl::RenderRadarSite(
const QMapLibreGL::CustomLayerRenderParameters& params,
std::shared_ptr<config::RadarSite>& radarSite)
const QMapLibre::CustomLayerRenderParameters& params,
std::shared_ptr<config::RadarSite>& radarSite)
{
const std::string windowName = fmt::format("radar-site-{}", radarSite->id());
@ -158,7 +157,7 @@ void RadarSiteLayer::Deinitialize()
}
bool RadarSiteLayer::RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
const QMapLibre::CustomLayerRenderParameters& /* params */,
const QPointF& /* mouseLocalPos */,
const QPointF& mouseGlobalPos,
const glm::vec2& /* mouseCoords */,

View file

@ -19,15 +19,15 @@ public:
~RadarSiteLayer();
void Initialize() override final;
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
void Render(const QMapLibre::CustomLayerRenderParameters&) override final;
void Deinitialize() override final;
bool RunMousePicking(
const QMapLibreGL::CustomLayerRenderParameters& params,
const QPointF& mouseLocalPos,
const QPointF& mouseGlobalPos,
const glm::vec2& mouseCoords,
const common::Coordinate& mouseGeoCoords,
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 final;
signals:

View file

@ -1,6 +1,6 @@
#include <scwx/qt/util/maplibre.hpp>
#include <QMapLibreGL/utils.hpp>
#include <QMapLibre/Utils>
#include <mbgl/util/constants.hpp>
namespace scwx
@ -13,14 +13,14 @@ namespace maplibre
{
units::length::meters<double>
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params)
GetMapDistance(const QMapLibre::CustomLayerRenderParameters& params)
{
return units::length::meters<double>(
QMapLibreGL::metersPerPixelAtLatitude(params.latitude, params.zoom) *
QMapLibre::metersPerPixelAtLatitude(params.latitude, params.zoom) *
(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);
@ -33,7 +33,7 @@ glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params)
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 *
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
@ -73,7 +73,7 @@ bool IsPointInPolygon(const std::vector<glm::vec2>& vertices,
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;

View file

@ -1,6 +1,6 @@
#pragma once
#include <QMapLibreGL/types.hpp>
#include <QMapLibre/Types>
#include <glm/gtc/type_ptr.hpp>
#include <units/length.h>
@ -14,9 +14,9 @@ namespace maplibre
{
units::length::meters<double>
GetMapDistance(const QMapLibreGL::CustomLayerRenderParameters& params);
glm::mat4 GetMapMatrix(const QMapLibreGL::CustomLayerRenderParameters& params);
glm::vec2 GetMapScale(const QMapLibreGL::CustomLayerRenderParameters& params);
GetMapDistance(const QMapLibre::CustomLayerRenderParameters& params);
glm::mat4 GetMapMatrix(const QMapLibre::CustomLayerRenderParameters& params);
glm::vec2 GetMapScale(const QMapLibre::CustomLayerRenderParameters& params);
/**
* @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,
const glm::vec2& point);
glm::vec2 LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate);
glm::vec2 LatLongToScreenCoordinate(const QMapLibre::Coordinate& coordinate);
} // namespace maplibre
} // namespace util