diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index a59de3d5..710da1e9 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -94,6 +95,8 @@ public: // Set Map Provider Details mapProvider_ = GetMapProvider(generalSettings.map_provider().GetValue()); + + ConnectSignals(); } ~MapWidgetImpl() @@ -115,6 +118,7 @@ public: void AddLayer(const std::string& id, std::shared_ptr layer, const std::string& before = {}); + void ConnectSignals(); void InitializeNewRadarProductView(const std::string& colorPalette); void RadarProductManagerConnect(); void RadarProductManagerDisconnect(); @@ -142,6 +146,8 @@ public: std::string imGuiContextName_; bool imGuiRendererInitialized_; + std::shared_ptr placefileManager_ { + manager::PlacefileManager::Instance()}; std::shared_ptr radarProductManager_; std::shared_ptr colorTable_; @@ -188,6 +194,22 @@ MapWidget::~MapWidget() makeCurrent(); } +void MapWidgetImpl::ConnectSignals() +{ + connect(placefileManager_.get(), + &manager::PlacefileManager::PlacefileEnabled, + widget_, + [this]() { widget_->update(); }); + connect(placefileManager_.get(), + &manager::PlacefileManager::PlacefileRenamed, + widget_, + [this]() { widget_->update(); }); + connect(placefileManager_.get(), + &manager::PlacefileManager::PlacefileUpdated, + widget_, + [this]() { widget_->update(); }); +} + common::Level3ProductCategoryMap MapWidget::GetAvailableLevel3Categories() { if (p->radarProductManager_ != nullptr) diff --git a/scwx-qt/source/scwx/qt/map/placefile_layer.cpp b/scwx-qt/source/scwx/qt/map/placefile_layer.cpp index 31eb1f46..c796cc93 100644 --- a/scwx-qt/source/scwx/qt/map/placefile_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/placefile_layer.cpp @@ -42,6 +42,7 @@ public: float mapScale_ {1.0f}; float halfWidth_ {}; float halfHeight_ {}; + bool thresholded_ {true}; ImFont* monospaceFont_ {}; }; @@ -63,8 +64,11 @@ void PlacefileLayer::Impl::RenderTextDrawItem( const QMapLibreGL::CustomLayerRenderParameters& params, std::shared_ptr di) { - auto distance = util::GeographicLib::GetDistance( - params.latitude, params.longitude, di->latitude_, di->longitude_); + auto distance = + (thresholded_) ? + util::GeographicLib::GetDistance( + params.latitude, params.longitude, di->latitude_, di->longitude_) : + 0; if (distance < di->threshold_) { @@ -145,7 +149,11 @@ void PlacefileLayer::Render( std::size_t fontSize = 16; auto fontSizes = manager::SettingsManager::general_settings().font_sizes().GetValue(); - if (fontSizes.size() > 0) + if (fontSizes.size() > 1) + { + fontSize = fontSizes[1]; + } + else if (fontSizes.size() > 0) { fontSize = fontSizes[0]; } @@ -159,6 +167,9 @@ void PlacefileLayer::Render( // Render text for (auto& placefile : placefileManager->GetActivePlacefiles()) { + p->thresholded_ = + placefileManager->placefile_thresholded(placefile->name()); + for (auto& drawItem : placefile->GetDrawItems()) { switch (drawItem->itemType_)