mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:30:06 +00:00
Update to latest maplibre-gl-native, including rename from QMapboxGL to QMapLibreGL
This commit is contained in:
parent
243e874b55
commit
2ac141ea1a
30 changed files with 143 additions and 133 deletions
2
external/mapbox-gl-native
vendored
2
external/mapbox-gl-native
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 225f8a4bfe7ad30fd59d693c1fb3ca0ba70d2806
|
Subproject commit 61caddd0848a658ec938645eec64ea522d0eab6a
|
||||||
2
external/mapbox-gl-native.cmake
vendored
2
external/mapbox-gl-native.cmake
vendored
|
|
@ -29,4 +29,4 @@ set_target_properties(mbgl-core PROPERTIES FOLDER mbgl)
|
||||||
set_target_properties(mbgl-vendor-csscolorparser PROPERTIES FOLDER mbgl)
|
set_target_properties(mbgl-vendor-csscolorparser PROPERTIES FOLDER mbgl)
|
||||||
set_target_properties(mbgl-vendor-nunicode PROPERTIES FOLDER mbgl)
|
set_target_properties(mbgl-vendor-nunicode PROPERTIES FOLDER mbgl)
|
||||||
set_target_properties(mbgl-vendor-parsedate PROPERTIES FOLDER mbgl)
|
set_target_properties(mbgl-vendor-parsedate PROPERTIES FOLDER mbgl)
|
||||||
set_target_properties(qmapboxgl PROPERTIES FOLDER mbgl)
|
set_target_properties(qmaplibregl PROPERTIES FOLDER mbgl)
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ target_link_libraries(scwx-qt PUBLIC Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
Qt${QT_VERSION_MAJOR}::OpenGLWidgets
|
Qt${QT_VERSION_MAJOR}::OpenGLWidgets
|
||||||
Boost::json
|
Boost::json
|
||||||
Boost::timer
|
Boost::timer
|
||||||
qmapboxgl
|
qmaplibregl
|
||||||
opengl32
|
opengl32
|
||||||
freetype-gl
|
freetype-gl
|
||||||
GeographicLib::GeographicLib
|
GeographicLib::GeographicLib
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ DrawItem::DrawItem(DrawItem&&) noexcept = default;
|
||||||
DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default;
|
DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default;
|
||||||
|
|
||||||
void DrawItem::UseDefaultProjection(
|
void DrawItem::UseDefaultProjection(
|
||||||
const QMapbox::CustomLayerRenderParameters& params, GLint uMVPMatrixLocation)
|
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
|
GLint uMVPMatrixLocation)
|
||||||
{
|
{
|
||||||
glm::mat4 projection = glm::ortho(0.0f,
|
glm::mat4 projection = glm::ortho(0.0f,
|
||||||
static_cast<float>(params.width),
|
static_cast<float>(params.width),
|
||||||
|
|
@ -49,29 +50,29 @@ void DrawItem::UseDefaultProjection(
|
||||||
|
|
||||||
// TODO: Refactor to utility class
|
// TODO: Refactor to utility class
|
||||||
static glm::vec2
|
static glm::vec2
|
||||||
LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate)
|
LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
|
||||||
{
|
{
|
||||||
double latitude = std::clamp(
|
double latitude = std::clamp(
|
||||||
coordinate.first, -mbgl::util::LATITUDE_MAX, mbgl::util::LATITUDE_MAX);
|
coordinate.first, -mbgl::util::LATITUDE_MAX, mbgl::util::LATITUDE_MAX);
|
||||||
glm::vec2 screen {
|
glm::vec2 screen {
|
||||||
mbgl::util::LONGITUDE_MAX + coordinate.second,
|
mbgl::util::LONGITUDE_MAX + coordinate.second,
|
||||||
-(mbgl::util::LONGITUDE_MAX -
|
-(mbgl::util::LONGITUDE_MAX -
|
||||||
mbgl::util::RAD2DEG *
|
mbgl::util::RAD2DEG_D *
|
||||||
std::log(std::tan(M_PI / 4.0 +
|
std::log(std::tan(M_PI / 4.0 +
|
||||||
latitude * M_PI / mbgl::util::DEGREES_MAX)))};
|
latitude * M_PI / mbgl::util::DEGREES_MAX)))};
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawItem::UseMapProjection(
|
void DrawItem::UseMapProjection(
|
||||||
const QMapbox::CustomLayerRenderParameters& params,
|
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation,
|
GLint uMVPMatrixLocation,
|
||||||
GLint uMapScreenCoordLocation)
|
GLint uMapScreenCoordLocation)
|
||||||
{
|
{
|
||||||
OpenGLFunctions& gl = p->gl_;
|
OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
// TODO: Refactor to utility class
|
// TODO: Refactor to utility class
|
||||||
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 / mbgl::util::DEGREES_MAX;
|
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
||||||
const float xScale = scale / params.width;
|
const float xScale = scale / params.width;
|
||||||
const float yScale = scale / params.height;
|
const float yScale = scale / params.height;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QMapbox>
|
#include <QMapLibreGL/QMapLibreGL>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -27,14 +27,16 @@ public:
|
||||||
DrawItem(DrawItem&&) noexcept;
|
DrawItem(DrawItem&&) noexcept;
|
||||||
DrawItem& operator=(DrawItem&&) noexcept;
|
DrawItem& operator=(DrawItem&&) noexcept;
|
||||||
|
|
||||||
virtual void Initialize() = 0;
|
virtual void Initialize() = 0;
|
||||||
virtual void Render(const QMapbox::CustomLayerRenderParameters& params) = 0;
|
virtual void
|
||||||
virtual void Deinitialize() = 0;
|
Render(const QMapLibreGL::CustomLayerRenderParameters& params) = 0;
|
||||||
|
virtual void Deinitialize() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UseDefaultProjection(const QMapbox::CustomLayerRenderParameters& params,
|
void
|
||||||
GLint uMVPMatrixLocation);
|
UseDefaultProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
void UseMapProjection(const QMapbox::CustomLayerRenderParameters& params,
|
GLint uMVPMatrixLocation);
|
||||||
|
void UseMapProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
GLint uMVPMatrixLocation,
|
GLint uMVPMatrixLocation,
|
||||||
GLint uMapScreenCoordLocation);
|
GLint uMapScreenCoordLocation);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ void GeoLine::Initialize()
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeoLine::Render(const QMapbox::CustomLayerRenderParameters& params)
|
void GeoLine::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
if (p->visible_)
|
if (p->visible_)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public:
|
||||||
GeoLine& operator=(GeoLine&&) noexcept;
|
GeoLine& operator=(GeoLine&&) noexcept;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
void Render(const QMapbox::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibreGL::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 QMapbox::CustomLayerRenderParameters& params)
|
void Rectangle::Render(const QMapLibreGL::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 QMapbox::CustomLayerRenderParameters& params) override;
|
void Render(const QMapLibreGL::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);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public:
|
||||||
std::string mapboxApiKey =
|
std::string mapboxApiKey =
|
||||||
manager::SettingsManager::general_settings()->mapbox_api_key();
|
manager::SettingsManager::general_settings()->mapbox_api_key();
|
||||||
|
|
||||||
settings_.resetToTemplate(QMapboxGLSettings::MapboxSettings);
|
settings_.resetToTemplate(QMapLibreGL::Settings::MapboxSettings);
|
||||||
settings_.setApiKey(QString {mapboxApiKey.c_str()});
|
settings_.setApiKey(QString {mapboxApiKey.c_str()});
|
||||||
settings_.setCacheDatabasePath(QString {cacheDbPath.c_str()});
|
settings_.setCacheDatabasePath(QString {cacheDbPath.c_str()});
|
||||||
settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
|
settings_.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
|
||||||
|
|
@ -80,7 +80,6 @@ public:
|
||||||
~MainWindowImpl() = default;
|
~MainWindowImpl() = default;
|
||||||
|
|
||||||
void ConfigureMapLayout();
|
void ConfigureMapLayout();
|
||||||
void ConnectAlertSignals();
|
|
||||||
void ConnectMapSignals();
|
void ConnectMapSignals();
|
||||||
void ConnectOtherSignals();
|
void ConnectOtherSignals();
|
||||||
void HandleFocusChange(QWidget* focused);
|
void HandleFocusChange(QWidget* focused);
|
||||||
|
|
@ -98,9 +97,9 @@ public:
|
||||||
void UpdateRadarSite();
|
void UpdateRadarSite();
|
||||||
void UpdateVcp();
|
void UpdateVcp();
|
||||||
|
|
||||||
MainWindow* mainWindow_;
|
MainWindow* mainWindow_;
|
||||||
QMapboxGLSettings settings_;
|
QMapLibreGL::Settings settings_;
|
||||||
map::MapWidget* activeMap_;
|
map::MapWidget* activeMap_;
|
||||||
|
|
||||||
ui::Level2ProductsWidget* level2ProductsWidget_;
|
ui::Level2ProductsWidget* level2ProductsWidget_;
|
||||||
ui::Level2SettingsWidget* level2SettingsWidget_;
|
ui::Level2SettingsWidget* level2SettingsWidget_;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include <boost/timer/timer.hpp>
|
#include <boost/timer/timer.hpp>
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
#include <GeographicLib/Geodesic.hpp>
|
#include <GeographicLib/Geodesic.hpp>
|
||||||
#include <QMapbox>
|
#include <QMapLibreGL/QMapLibreGL>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -304,8 +304,8 @@ void RadarProductManager::Initialize()
|
||||||
GeographicLib::Geodesic geodesic(GeographicLib::Constants::WGS84_a(),
|
GeographicLib::Geodesic geodesic(GeographicLib::Constants::WGS84_a(),
|
||||||
GeographicLib::Constants::WGS84_f());
|
GeographicLib::Constants::WGS84_f());
|
||||||
|
|
||||||
const QMapbox::Coordinate radar(p->radarSite_->latitude(),
|
const QMapLibreGL::Coordinate radar(p->radarSite_->latitude(),
|
||||||
p->radarSite_->longitude());
|
p->radarSite_->longitude());
|
||||||
|
|
||||||
const float gateSize = gate_size();
|
const float gateSize = gate_size();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,22 +16,22 @@ namespace map
|
||||||
static const std::string logPrefix_ = "scwx::qt::map::alert_layer";
|
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 void AddAlertLayer(std::shared_ptr<QMapboxGL> map,
|
static void AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
const QString& idSuffix,
|
const QString& idSuffix,
|
||||||
const QString& sourceId,
|
const QString& sourceId,
|
||||||
const QString& beforeLayer,
|
const QString& beforeLayer,
|
||||||
boost::gil::rgba8_pixel_t outlineColor);
|
boost::gil::rgba8_pixel_t outlineColor);
|
||||||
static QMapbox::Feature
|
static QMapLibreGL::Feature
|
||||||
CreateFeature(const awips::CodedLocation& codedLocation);
|
CreateFeature(const awips::CodedLocation& codedLocation);
|
||||||
static QMapbox::Coordinate
|
static QMapLibreGL::Coordinate
|
||||||
GetMapboxCoordinate(const common::Coordinate& coordinate);
|
GetMapboxCoordinate(const common::Coordinate& coordinate);
|
||||||
static QMapbox::Coordinates
|
static QMapLibreGL::Coordinates
|
||||||
GetMapboxCoordinates(const awips::CodedLocation& codedLocation);
|
GetMapboxCoordinates(const awips::CodedLocation& codedLocation);
|
||||||
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(QList<QMapbox::Feature> {})}};
|
{"data", QVariant::fromValue(QList<QMapLibreGL::Feature> {})}};
|
||||||
static const std::list<awips::Phenomenon> kAlertPhenomena_ {
|
static const std::list<awips::Phenomenon> kAlertPhenomena_ {
|
||||||
awips::Phenomenon::Marine,
|
awips::Phenomenon::Marine,
|
||||||
awips::Phenomenon::FlashFlood,
|
awips::Phenomenon::FlashFlood,
|
||||||
|
|
@ -70,8 +70,8 @@ class AlertLayerHandler : public QObject
|
||||||
|
|
||||||
static AlertLayerHandler& Instance();
|
static AlertLayerHandler& Instance();
|
||||||
|
|
||||||
QList<QMapbox::Feature>* FeatureList(awips::Phenomenon phenomenon,
|
QList<QMapLibreGL::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);
|
||||||
|
|
||||||
std::unordered_map<std::pair<awips::Phenomenon, bool>,
|
std::unordered_map<std::pair<awips::Phenomenon, bool>,
|
||||||
|
|
@ -116,7 +116,7 @@ void AlertLayer::Initialize()
|
||||||
DrawLayer::Initialize();
|
DrawLayer::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlertLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
void AlertLayer::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
|
|
@ -210,17 +210,17 @@ void AlertLayer::AddLayers(const std::string& before)
|
||||||
{255, 0, 0, 255});
|
{255, 0, 0, 255});
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QMapbox::Feature>*
|
QList<QMapLibreGL::Feature>*
|
||||||
AlertLayerHandler::FeatureList(awips::Phenomenon phenomenon, bool alertActive)
|
AlertLayerHandler::FeatureList(awips::Phenomenon phenomenon, bool alertActive)
|
||||||
{
|
{
|
||||||
QList<QMapbox::Feature>* featureList = nullptr;
|
QList<QMapLibreGL::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 =
|
featureList = reinterpret_cast<QList<QMapLibreGL::Feature>*>(
|
||||||
reinterpret_cast<QList<QMapbox::Feature>*>(it->second["data"].data());
|
it->second["data"].data());
|
||||||
}
|
}
|
||||||
|
|
||||||
return featureList;
|
return featureList;
|
||||||
|
|
@ -286,11 +286,11 @@ AlertLayerHandler& AlertLayerHandler::Instance()
|
||||||
return alertLayerHandler;
|
return alertLayerHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddAlertLayer(std::shared_ptr<QMapboxGL> map,
|
static void AddAlertLayer(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
const QString& idSuffix,
|
const QString& idSuffix,
|
||||||
const QString& sourceId,
|
const QString& sourceId,
|
||||||
const QString& beforeLayer,
|
const QString& beforeLayer,
|
||||||
boost::gil::rgba8_pixel_t outlineColor)
|
boost::gil::rgba8_pixel_t outlineColor)
|
||||||
{
|
{
|
||||||
QString bgLayerId = QString("alertPolygonLayerBg-%1").arg(idSuffix);
|
QString bgLayerId = QString("alertPolygonLayerBg-%1").arg(idSuffix);
|
||||||
QString fgLayerId = QString("alertPolygonLayerFg-%1").arg(idSuffix);
|
QString fgLayerId = QString("alertPolygonLayerFg-%1").arg(idSuffix);
|
||||||
|
|
@ -325,32 +325,33 @@ static void AddAlertLayer(std::shared_ptr<QMapboxGL> map,
|
||||||
map->setPaintProperty(fgLayerId, "line-width", "3");
|
map->setPaintProperty(fgLayerId, "line-width", "3");
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMapbox::Feature CreateFeature(const awips::CodedLocation& codedLocation)
|
static QMapLibreGL::Feature
|
||||||
|
CreateFeature(const awips::CodedLocation& codedLocation)
|
||||||
{
|
{
|
||||||
auto mapboxCoordinates = GetMapboxCoordinates(codedLocation);
|
auto mapboxCoordinates = GetMapboxCoordinates(codedLocation);
|
||||||
|
|
||||||
return {
|
return {QMapLibreGL::Feature::PolygonType,
|
||||||
QMapbox::Feature::PolygonType,
|
std::initializer_list<QMapLibreGL::CoordinatesCollection> {
|
||||||
std::initializer_list<QMapbox::CoordinatesCollection> {
|
std::initializer_list<QMapLibreGL::Coordinates> {
|
||||||
std::initializer_list<QMapbox::Coordinates> {{mapboxCoordinates}}}};
|
{mapboxCoordinates}}}};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMapbox::Coordinate
|
static QMapLibreGL::Coordinate
|
||||||
GetMapboxCoordinate(const common::Coordinate& coordinate)
|
GetMapboxCoordinate(const common::Coordinate& coordinate)
|
||||||
{
|
{
|
||||||
return {coordinate.latitude_, coordinate.longitude_};
|
return {coordinate.latitude_, coordinate.longitude_};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QMapbox::Coordinates
|
static QMapLibreGL::Coordinates
|
||||||
GetMapboxCoordinates(const awips::CodedLocation& codedLocation)
|
GetMapboxCoordinates(const awips::CodedLocation& codedLocation)
|
||||||
{
|
{
|
||||||
auto scwxCoordinates = codedLocation.coordinates();
|
auto scwxCoordinates = codedLocation.coordinates();
|
||||||
QMapbox::Coordinates mapboxCoordinates(scwxCoordinates.size() + 1u);
|
QMapLibreGL::Coordinates mapboxCoordinates(scwxCoordinates.size() + 1u);
|
||||||
|
|
||||||
std::transform(scwxCoordinates.cbegin(),
|
std::transform(scwxCoordinates.cbegin(),
|
||||||
scwxCoordinates.cend(),
|
scwxCoordinates.cend(),
|
||||||
mapboxCoordinates.begin(),
|
mapboxCoordinates.begin(),
|
||||||
[](auto& coordinate) -> QMapbox::Coordinate
|
[](auto& coordinate) -> QMapLibreGL::Coordinate
|
||||||
{ return GetMapboxCoordinate(coordinate); });
|
{ return GetMapboxCoordinate(coordinate); });
|
||||||
|
|
||||||
mapboxCoordinates.back() = GetMapboxCoordinate(scwxCoordinates.front());
|
mapboxCoordinates.back() = GetMapboxCoordinate(scwxCoordinates.front());
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
~AlertLayer();
|
~AlertLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapbox::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
void AddLayers(const std::string& before = {});
|
void AddLayers(const std::string& before = {});
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,8 @@ void ColorTableLayer::Initialize()
|
||||||
[=]() { p->colorTableNeedsUpdate_ = true; });
|
[=]() { p->colorTableNeedsUpdate_ = true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorTableLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
void ColorTableLayer::Render(
|
||||||
|
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();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
~ColorTableLayer();
|
~ColorTableLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapbox::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ void DrawLayer::Initialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
void DrawLayer::Render(const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = p->context_->gl();
|
gl::OpenGLFunctions& gl = p->context_->gl();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual ~DrawLayer();
|
virtual ~DrawLayer();
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual void Render(const QMapbox::CustomLayerRenderParameters&);
|
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters&);
|
||||||
virtual void Deinitialize();
|
virtual void Deinitialize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMapboxGL>
|
#include <QMapLibreGL/QMapLibreGL>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -24,9 +24,9 @@ public:
|
||||||
explicit GenericLayer(std::shared_ptr<MapContext> context);
|
explicit GenericLayer(std::shared_ptr<MapContext> context);
|
||||||
virtual ~GenericLayer();
|
virtual ~GenericLayer();
|
||||||
|
|
||||||
virtual void Initialize() = 0;
|
virtual void Initialize() = 0;
|
||||||
virtual void Render(const QMapbox::CustomLayerRenderParameters&) = 0;
|
virtual void Render(const QMapLibreGL::CustomLayerRenderParameters&) = 0;
|
||||||
virtual void Deinitialize() = 0;
|
virtual void Deinitialize() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<MapContext> context() const;
|
std::shared_ptr<MapContext> context() const;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ LayerWrapper::LayerWrapper(std::shared_ptr<GenericLayer> layer) :
|
||||||
}
|
}
|
||||||
LayerWrapper::~LayerWrapper() = default;
|
LayerWrapper::~LayerWrapper() = default;
|
||||||
|
|
||||||
LayerWrapper::LayerWrapper(LayerWrapper&&) noexcept = default;
|
LayerWrapper::LayerWrapper(LayerWrapper&&) noexcept = default;
|
||||||
LayerWrapper& LayerWrapper::operator=(LayerWrapper&&) noexcept = default;
|
LayerWrapper& LayerWrapper::operator=(LayerWrapper&&) noexcept = default;
|
||||||
|
|
||||||
void LayerWrapper::initialize()
|
void LayerWrapper::initialize()
|
||||||
|
|
@ -34,7 +34,8 @@ void LayerWrapper::initialize()
|
||||||
p->layer_->Initialize();
|
p->layer_->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWrapper::render(const QMapbox::CustomLayerRenderParameters& params)
|
void LayerWrapper::render(
|
||||||
|
const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
p->layer_->Render(params);
|
p->layer_->Render(params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,20 @@ namespace map
|
||||||
|
|
||||||
class LayerWrapperImpl;
|
class LayerWrapperImpl;
|
||||||
|
|
||||||
class LayerWrapper : public QMapbox::CustomLayerHostInterface
|
class LayerWrapper : public QMapLibreGL::CustomLayerHostInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit LayerWrapper(std::shared_ptr<GenericLayer> layer);
|
explicit LayerWrapper(std::shared_ptr<GenericLayer> layer);
|
||||||
~LayerWrapper();
|
~LayerWrapper();
|
||||||
|
|
||||||
LayerWrapper(const LayerWrapper&) = delete;
|
LayerWrapper(const LayerWrapper&) = delete;
|
||||||
LayerWrapper& operator=(const LayerWrapper&) = delete;
|
LayerWrapper& operator=(const LayerWrapper&) = delete;
|
||||||
|
|
||||||
LayerWrapper(LayerWrapper&&) noexcept;
|
LayerWrapper(LayerWrapper&&) noexcept;
|
||||||
LayerWrapper& operator=(LayerWrapper&&) noexcept;
|
LayerWrapper& operator=(LayerWrapper&&) noexcept;
|
||||||
|
|
||||||
void initialize() override final;
|
void initialize() override final;
|
||||||
void render(const QMapbox::CustomLayerRenderParameters&) override final;
|
void render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void deinitialize() override final;
|
void deinitialize() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
std::weak_ptr<QMapboxGL> map_;
|
std::weak_ptr<QMapLibreGL::Map> map_;
|
||||||
MapSettings settings_;
|
MapSettings settings_;
|
||||||
std::shared_ptr<view::RadarProductView> radarProductView_;
|
std::shared_ptr<view::RadarProductView> radarProductView_;
|
||||||
common::RadarProductGroup radarProductGroup_;
|
common::RadarProductGroup radarProductGroup_;
|
||||||
|
|
@ -40,7 +40,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<QMapboxGL> MapContext::map() const
|
std::weak_ptr<QMapLibreGL::Map> MapContext::map() const
|
||||||
{
|
{
|
||||||
return p->map_;
|
return p->map_;
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +70,7 @@ int16_t MapContext::radar_product_code() const
|
||||||
return p->radarProductCode_;
|
return p->radarProductCode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapContext::set_map(std::shared_ptr<QMapboxGL> map)
|
void MapContext::set_map(std::shared_ptr<QMapLibreGL::Map> map)
|
||||||
{
|
{
|
||||||
p->map_ = map;
|
p->map_ = map;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <scwx/qt/map/map_settings.hpp>
|
#include <scwx/qt/map/map_settings.hpp>
|
||||||
#include <scwx/qt/view/radar_product_view.hpp>
|
#include <scwx/qt/view/radar_product_view.hpp>
|
||||||
|
|
||||||
class QMapboxGL;
|
#include <QMapLibreGL/QMapLibreGL>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -26,14 +26,14 @@ public:
|
||||||
MapContext(MapContext&&) noexcept;
|
MapContext(MapContext&&) noexcept;
|
||||||
MapContext& operator=(MapContext&&) noexcept;
|
MapContext& operator=(MapContext&&) noexcept;
|
||||||
|
|
||||||
std::weak_ptr<QMapboxGL> map() const;
|
std::weak_ptr<QMapLibreGL::Map> map() const;
|
||||||
MapSettings& settings();
|
MapSettings& settings();
|
||||||
std::shared_ptr<view::RadarProductView> radar_product_view() const;
|
std::shared_ptr<view::RadarProductView> radar_product_view() const;
|
||||||
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;
|
||||||
|
|
||||||
void set_map(std::shared_ptr<QMapboxGL> map);
|
void set_map(std::shared_ptr<QMapLibreGL::Map> map);
|
||||||
void set_radar_product_view(
|
void set_radar_product_view(
|
||||||
std::shared_ptr<view::RadarProductView> radarProductView);
|
std::shared_ptr<view::RadarProductView> radarProductView);
|
||||||
void set_radar_product_group(common::RadarProductGroup radarProductGroup);
|
void set_radar_product_group(common::RadarProductGroup radarProductGroup);
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ class MapWidgetImpl : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MapWidgetImpl(MapWidget* widget,
|
explicit MapWidgetImpl(MapWidget* widget,
|
||||||
const QMapboxGLSettings& settings) :
|
const QMapLibreGL::Settings& settings) :
|
||||||
context_ {std::make_shared<MapContext>()},
|
context_ {std::make_shared<MapContext>()},
|
||||||
widget_ {widget},
|
widget_ {widget},
|
||||||
settings_(settings),
|
settings_(settings),
|
||||||
|
|
@ -96,10 +96,10 @@ public:
|
||||||
|
|
||||||
std::shared_ptr<MapContext> context_;
|
std::shared_ptr<MapContext> context_;
|
||||||
|
|
||||||
MapWidget* widget_;
|
MapWidget* widget_;
|
||||||
QMapboxGLSettings settings_;
|
QMapLibreGL::Settings settings_;
|
||||||
std::shared_ptr<QMapboxGL> map_;
|
std::shared_ptr<QMapLibreGL::Map> map_;
|
||||||
std::list<std::string> layerList_;
|
std::list<std::string> layerList_;
|
||||||
|
|
||||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ public slots:
|
||||||
void Update();
|
void Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
MapWidget::MapWidget(const QMapboxGLSettings& settings) :
|
MapWidget::MapWidget(const QMapLibreGL::Settings& settings) :
|
||||||
p(std::make_unique<MapWidgetImpl>(this, settings))
|
p(std::make_unique<MapWidgetImpl>(this, settings))
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
@ -138,7 +138,7 @@ MapWidget::MapWidget(const QMapboxGLSettings& settings) :
|
||||||
|
|
||||||
MapWidget::~MapWidget()
|
MapWidget::~MapWidget()
|
||||||
{
|
{
|
||||||
// Make sure we have a valid context so we can delete the QMapboxGL.
|
// Make sure we have a valid context so we can delete the QMapLibreGL.
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -534,8 +534,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)
|
||||||
{
|
{
|
||||||
// QMapboxGL::addCustomLayer will take ownership of the std::unique_ptr
|
// QMapLibreGL::addCustomLayer will take ownership of the std::unique_ptr
|
||||||
std::unique_ptr<QMapbox::CustomLayerHostInterface> pHost =
|
std::unique_ptr<QMapLibreGL::CustomLayerHostInterface> pHost =
|
||||||
std::make_unique<LayerWrapper>(layer);
|
std::make_unique<LayerWrapper>(layer);
|
||||||
|
|
||||||
map_->addCustomLayer(id.c_str(), std::move(pHost), before.c_str());
|
map_->addCustomLayer(id.c_str(), std::move(pHost), before.c_str());
|
||||||
|
|
@ -642,10 +642,11 @@ void MapWidget::initializeGL()
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
p->context_->gl().initializeOpenGLFunctions();
|
p->context_->gl().initializeOpenGLFunctions();
|
||||||
|
|
||||||
p->map_.reset(new QMapboxGL(nullptr, p->settings_, size(), pixelRatio()));
|
p->map_.reset(
|
||||||
|
new QMapLibreGL::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(),
|
||||||
&QMapboxGL::needsRendering,
|
&QMapLibreGL::Map::needsRendering,
|
||||||
p.get(),
|
p.get(),
|
||||||
&MapWidgetImpl::Update);
|
&MapWidgetImpl::Update);
|
||||||
|
|
||||||
|
|
@ -672,7 +673,10 @@ void MapWidget::initializeGL()
|
||||||
setWindowTitle(QString("Mapbox GL: ") + styleUrl);
|
setWindowTitle(QString("Mapbox GL: ") + styleUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(p->map_.get(), &QMapboxGL::mapChanged, this, &MapWidget::mapChanged);
|
connect(p->map_.get(),
|
||||||
|
&QMapLibreGL::Map::mapChanged,
|
||||||
|
this,
|
||||||
|
&MapWidget::mapChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::paintGL()
|
void MapWidget::paintGL()
|
||||||
|
|
@ -684,11 +688,11 @@ void MapWidget::paintGL()
|
||||||
p->map_->render();
|
p->map_->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::mapChanged(QMapboxGL::MapChange mapChange)
|
void MapWidget::mapChanged(QMapLibreGL::Map::MapChange mapChange)
|
||||||
{
|
{
|
||||||
switch (mapChange)
|
switch (mapChange)
|
||||||
{
|
{
|
||||||
case QMapboxGL::MapChangeDidFinishLoadingStyle:
|
case QMapLibreGL::Map::MapChangeDidFinishLoadingStyle:
|
||||||
AddLayers();
|
AddLayers();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QMapboxGL>
|
#include <QMapLibreGL/QMapLibreGL>
|
||||||
|
|
||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
@ -31,7 +31,7 @@ class MapWidget : public QOpenGLWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MapWidget(const QMapboxGLSettings&);
|
explicit MapWidget(const QMapLibreGL::Settings&);
|
||||||
~MapWidget();
|
~MapWidget();
|
||||||
|
|
||||||
common::Level3ProductCategoryMap GetAvailableLevel3Categories();
|
common::Level3ProductCategoryMap GetAvailableLevel3Categories();
|
||||||
|
|
@ -79,7 +79,7 @@ private:
|
||||||
friend class MapWidgetImpl;
|
friend class MapWidgetImpl;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void mapChanged(QMapboxGL::MapChange);
|
void mapChanged(QMapLibreGL::Map::MapChange);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Level3ProductsChanged();
|
void Level3ProductsChanged();
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,8 @@ void OverlayLayer::Initialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
void OverlayLayer::Render(
|
||||||
|
const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
constexpr float fontSize = 16.0f;
|
constexpr float fontSize = 16.0f;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
~OverlayLayer();
|
~OverlayLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapbox::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ static const std::string logPrefix_ = "scwx::qt::map::radar_product_layer";
|
||||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
static glm::vec2
|
static glm::vec2
|
||||||
LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate);
|
LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate);
|
||||||
|
|
||||||
class RadarProductLayerImpl
|
class RadarProductLayerImpl
|
||||||
{
|
{
|
||||||
|
|
@ -253,7 +253,7 @@ void RadarProductLayer::UpdateSweep()
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarProductLayer::Render(
|
void RadarProductLayer::Render(
|
||||||
const QMapbox::CustomLayerRenderParameters& params)
|
const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
|
|
@ -270,7 +270,7 @@ void RadarProductLayer::Render(
|
||||||
}
|
}
|
||||||
|
|
||||||
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 / mbgl::util::DEGREES_MAX;
|
mbgl::util::tileSize_D / mbgl::util::DEGREES_MAX;
|
||||||
const float xScale = scale / params.width;
|
const float xScale = scale / params.width;
|
||||||
const float yScale = scale / params.height;
|
const float yScale = scale / params.height;
|
||||||
|
|
||||||
|
|
@ -351,14 +351,14 @@ void RadarProductLayer::UpdateColorTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
static glm::vec2
|
static glm::vec2
|
||||||
LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate)
|
LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
|
||||||
{
|
{
|
||||||
double latitude = std::clamp(
|
double latitude = std::clamp(
|
||||||
coordinate.first, -mbgl::util::LATITUDE_MAX, mbgl::util::LATITUDE_MAX);
|
coordinate.first, -mbgl::util::LATITUDE_MAX, mbgl::util::LATITUDE_MAX);
|
||||||
glm::vec2 screen {
|
glm::vec2 screen {
|
||||||
mbgl::util::LONGITUDE_MAX + coordinate.second,
|
mbgl::util::LONGITUDE_MAX + coordinate.second,
|
||||||
-(mbgl::util::LONGITUDE_MAX -
|
-(mbgl::util::LONGITUDE_MAX -
|
||||||
mbgl::util::RAD2DEG *
|
mbgl::util::RAD2DEG_D *
|
||||||
std::log(std::tan(M_PI / 4.0 +
|
std::log(std::tan(M_PI / 4.0 +
|
||||||
latitude * M_PI / mbgl::util::DEGREES_MAX)))};
|
latitude * M_PI / mbgl::util::DEGREES_MAX)))};
|
||||||
return screen;
|
return screen;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
~RadarProductLayer();
|
~RadarProductLayer();
|
||||||
|
|
||||||
void Initialize() override final;
|
void Initialize() override final;
|
||||||
void Render(const QMapbox::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ 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<QMapbox::Feature>
|
static std::shared_ptr<QMapLibreGL::Feature>
|
||||||
GetRangeCircle(float range, QMapbox::Coordinate center);
|
GetRangeCircle(float range, QMapLibreGL::Coordinate center);
|
||||||
|
|
||||||
void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map,
|
void RadarRangeLayer::Add(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapbox::Coordinate center,
|
QMapLibreGL::Coordinate center,
|
||||||
const QString& before)
|
const QString& before)
|
||||||
{
|
{
|
||||||
logger_->debug("Add()");
|
logger_->debug("Add()");
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map,
|
||||||
map->removeSource("rangeCircleSource");
|
map->removeSource("rangeCircleSource");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<QMapbox::Feature> rangeCircle =
|
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
|
||||||
GetRangeCircle(range, center);
|
GetRangeCircle(range, center);
|
||||||
|
|
||||||
map->addSource(
|
map->addSource(
|
||||||
|
|
@ -47,19 +47,19 @@ void RadarRangeLayer::Add(std::shared_ptr<QMapboxGL> map,
|
||||||
"rangeCircleLayer", "line-color", "rgba(128, 128, 128, 128)");
|
"rangeCircleLayer", "line-color", "rgba(128, 128, 128, 128)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadarRangeLayer::Update(std::shared_ptr<QMapboxGL> map,
|
void RadarRangeLayer::Update(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapbox::Coordinate center)
|
QMapLibreGL::Coordinate center)
|
||||||
{
|
{
|
||||||
std::shared_ptr<QMapbox::Feature> rangeCircle =
|
std::shared_ptr<QMapLibreGL::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<QMapbox::Feature>
|
static std::shared_ptr<QMapLibreGL::Feature>
|
||||||
GetRangeCircle(float range, QMapbox::Coordinate center)
|
GetRangeCircle(float range, QMapLibreGL::Coordinate center)
|
||||||
{
|
{
|
||||||
GeographicLib::Geodesic geodesic(GeographicLib::Constants::WGS84_a(),
|
GeographicLib::Geodesic geodesic(GeographicLib::Constants::WGS84_a(),
|
||||||
GeographicLib::Constants::WGS84_f());
|
GeographicLib::Constants::WGS84_f());
|
||||||
|
|
@ -69,7 +69,7 @@ GetRangeCircle(float range, QMapbox::Coordinate center)
|
||||||
|
|
||||||
float angle = -angleDeltaH;
|
float angle = -angleDeltaH;
|
||||||
|
|
||||||
QMapbox::Coordinates geometry;
|
QMapLibreGL::Coordinates geometry;
|
||||||
|
|
||||||
for (uint16_t azimuth = 0; azimuth <= 720; ++azimuth)
|
for (uint16_t azimuth = 0; azimuth <= 720; ++azimuth)
|
||||||
{
|
{
|
||||||
|
|
@ -88,11 +88,11 @@ GetRangeCircle(float range, QMapbox::Coordinate center)
|
||||||
angle += angleDelta;
|
angle += angleDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<QMapbox::Feature> rangeCircle =
|
std::shared_ptr<QMapLibreGL::Feature> rangeCircle =
|
||||||
std::make_shared<QMapbox::Feature>(
|
std::make_shared<QMapLibreGL::Feature>(
|
||||||
QMapbox::Feature::LineStringType,
|
QMapLibreGL::Feature::LineStringType,
|
||||||
std::initializer_list<QMapbox::CoordinatesCollection> {
|
std::initializer_list<QMapLibreGL::CoordinatesCollection> {
|
||||||
std::initializer_list<QMapbox::Coordinates> {geometry}});
|
std::initializer_list<QMapLibreGL::Coordinates> {geometry}});
|
||||||
|
|
||||||
return rangeCircle;
|
return rangeCircle;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMapboxGL>
|
#include <QMapLibreGL/QMapLibreGL>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -11,13 +11,13 @@ namespace map
|
||||||
namespace RadarRangeLayer
|
namespace RadarRangeLayer
|
||||||
{
|
{
|
||||||
|
|
||||||
void Add(std::shared_ptr<QMapboxGL> map,
|
void Add(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapbox::Coordinate center,
|
QMapLibreGL::Coordinate center,
|
||||||
const QString& before = QString());
|
const QString& before = QString());
|
||||||
void Update(std::shared_ptr<QMapboxGL> map,
|
void Update(std::shared_ptr<QMapLibreGL::Map> map,
|
||||||
float range,
|
float range,
|
||||||
QMapbox::Coordinate center);
|
QMapLibreGL::Coordinate center);
|
||||||
|
|
||||||
} // namespace RadarRangeLayer
|
} // namespace RadarRangeLayer
|
||||||
} // namespace map
|
} // namespace map
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue