diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index 5b2a2e8a..1526daa7 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -186,6 +187,7 @@ public: std::shared_ptr overlayLayer_; std::shared_ptr placefileLayer_; std::shared_ptr colorTableLayer_; + std::shared_ptr radarSiteLayer_ {nullptr}; std::list> placefileLayers_ {}; @@ -890,6 +892,12 @@ void MapWidgetImpl::AddLayer(types::LayerType type, } break; + // Create the radar site layer + case types::InformationLayer::RadarSite: + radarSiteLayer_ = std::make_shared(context_); + AddLayer(layerName, radarSiteLayer_, before); + break; + default: break; } diff --git a/scwx-qt/source/scwx/qt/model/layer_model.cpp b/scwx-qt/source/scwx/qt/model/layer_model.cpp index a153f4f2..0e545d96 100644 --- a/scwx-qt/source/scwx/qt/model/layer_model.cpp +++ b/scwx-qt/source/scwx/qt/model/layer_model.cpp @@ -39,6 +39,10 @@ static const QString kMimeFormat {"application/x.scwx-layer-model"}; static const std::vector kDefaultLayers_ { {types::LayerType::Information, types::InformationLayer::MapOverlay, false}, {types::LayerType::Information, types::InformationLayer::ColorTable, false}, + {types::LayerType::Information, + types::InformationLayer::RadarSite, + false, + {false, false, false, false}}, {types::LayerType::Data, types::DataLayer::RadarRange, true}, {types::LayerType::Alert, awips::Phenomenon::Tornado, true}, {types::LayerType::Alert, awips::Phenomenon::SnowSquall, true}, @@ -53,6 +57,10 @@ static const std::vector kDefaultLayers_ { static const std::vector kImmovableLayers_ { {types::LayerType::Information, types::InformationLayer::MapOverlay, false}, {types::LayerType::Information, types::InformationLayer::ColorTable, false}, + {types::LayerType::Information, + types::InformationLayer::RadarSite, + false, + {false, false, false, false}}, {types::LayerType::Map, types::MapLayer::MapSymbology, false}, {types::LayerType::Map, types::MapLayer::MapUnderlay, false}, }; @@ -235,13 +243,13 @@ void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers) // Validate immovable layers std::vector immovableIterators {}; - types::LayerVector::iterator colorTableIterator {}; + types::LayerVector::iterator radarSiteIterator {}; types::LayerVector::iterator mapSymbologyIterator {}; types::LayerVector::iterator mapUnderlayIterator {}; for (auto& immovableLayer : kImmovableLayers_) { // Set the default displayed state for a layer that is not found - std::array displayed {true, true, true, true}; + std::array displayed = immovableLayer.displayed_; // Find the immovable layer auto it = std::find_if(layers.begin(), @@ -285,8 +293,8 @@ void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers) { switch (std::get(it->description_)) { - case types::InformationLayer::ColorTable: - colorTableIterator = it; + case types::InformationLayer::RadarSite: + radarSiteIterator = it; break; default: @@ -330,10 +338,10 @@ void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers) if (it == layers.end()) { - // If this is the first data layer, insert after the color table layer, + // If this is the first data layer, insert after the radar site layer, // otherwise, insert after the previous data layer types::LayerVector::iterator insertPosition = - dataIterators.empty() ? colorTableIterator + 1 : + dataIterators.empty() ? radarSiteIterator + 1 : dataIterators.back() + 1; it = layers.insert(insertPosition, {types::LayerType::Data, dataLayer}); @@ -398,7 +406,7 @@ void LayerModel::ResetLayers() types::LayerVector newLayers {}; newLayers.assign(kDefaultLayers_.cbegin(), kDefaultLayers_.cend()); - auto colorTableIterator = std::find_if( + auto radarSiteIterator = std::find_if( newLayers.begin(), newLayers.end(), [](const types::LayerInfo& layerInfo) @@ -406,7 +414,7 @@ void LayerModel::ResetLayers() return std::holds_alternative( layerInfo.description_) && std::get(layerInfo.description_) == - types::InformationLayer::ColorTable; + types::InformationLayer::RadarSite; }); // Add all existing placefile layers @@ -415,7 +423,7 @@ void LayerModel::ResetLayers() if (it->type_ == types::LayerType::Placefile) { newLayers.insert( - colorTableIterator + 1, + radarSiteIterator + 1, {it->type_, it->description_, it->movable_, it->displayed_}); } } @@ -1007,7 +1015,7 @@ void LayerModel::Impl::HandlePlacefileUpdate(const std::string& name, void LayerModel::Impl::AddPlacefile(const std::string& name) { - // Insert after color table + // Insert after radar site auto insertPosition = std::find_if( layers_.begin(), layers_.end(), @@ -1016,7 +1024,7 @@ void LayerModel::Impl::AddPlacefile(const std::string& name) return std::holds_alternative( layerInfo.description_) && std::get(layerInfo.description_) == - types::InformationLayer::ColorTable; + types::InformationLayer::RadarSite; }); if (insertPosition != layers_.end()) { diff --git a/scwx-qt/source/scwx/qt/types/layer_types.cpp b/scwx-qt/source/scwx/qt/types/layer_types.cpp index 0f7e1db8..b0bc9632 100644 --- a/scwx-qt/source/scwx/qt/types/layer_types.cpp +++ b/scwx-qt/source/scwx/qt/types/layer_types.cpp @@ -27,6 +27,7 @@ static const std::unordered_map dataLayerName_ { static const std::unordered_map informationLayerName_ {{InformationLayer::MapOverlay, "Map Overlay"}, + {InformationLayer::RadarSite, "Radar Site"}, {InformationLayer::ColorTable, "Color Table"}, {InformationLayer::Unknown, "?"}}; diff --git a/scwx-qt/source/scwx/qt/types/layer_types.hpp b/scwx-qt/source/scwx/qt/types/layer_types.hpp index 6a00d03b..1309b648 100644 --- a/scwx-qt/source/scwx/qt/types/layer_types.hpp +++ b/scwx-qt/source/scwx/qt/types/layer_types.hpp @@ -41,6 +41,7 @@ typedef scwx::util:: enum class InformationLayer { MapOverlay, + RadarSite, ColorTable, Unknown };