Add overlay product layer, to hold the following overlay products:

- Storm Structure (NSS/62)
- Hail Index (NHI/59)
- Mesocyclone (NME/60, NMD/141)
- Tornadic Vortex Signature (NTV/61)
- Storm Tracking Information (NST/58)
This commit is contained in:
Dan Paulat 2024-02-04 21:09:34 -06:00
parent a5d97933dc
commit b8398b4ad0
7 changed files with 136 additions and 8 deletions

View file

@ -115,6 +115,7 @@ set(HDR_MAP source/scwx/qt/map/alert_layer.hpp
source/scwx/qt/map/map_settings.hpp
source/scwx/qt/map/map_widget.hpp
source/scwx/qt/map/overlay_layer.hpp
source/scwx/qt/map/overlay_product_layer.hpp
source/scwx/qt/map/placefile_layer.hpp
source/scwx/qt/map/radar_product_layer.hpp
source/scwx/qt/map/radar_range_layer.hpp
@ -128,6 +129,7 @@ set(SRC_MAP source/scwx/qt/map/alert_layer.cpp
source/scwx/qt/map/map_provider.cpp
source/scwx/qt/map/map_widget.cpp
source/scwx/qt/map/overlay_layer.cpp
source/scwx/qt/map/overlay_product_layer.cpp
source/scwx/qt/map/placefile_layer.cpp
source/scwx/qt/map/radar_product_layer.cpp
source/scwx/qt/map/radar_range_layer.cpp

View file

@ -8,6 +8,7 @@
#include <scwx/qt/map/layer_wrapper.hpp>
#include <scwx/qt/map/map_provider.hpp>
#include <scwx/qt/map/overlay_layer.hpp>
#include <scwx/qt/map/overlay_product_layer.hpp>
#include <scwx/qt/map/placefile_layer.hpp>
#include <scwx/qt/map/radar_product_layer.hpp>
#include <scwx/qt/map/radar_range_layer.hpp>
@ -181,12 +182,13 @@ public:
manager::PlacefileManager::Instance()};
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
std::shared_ptr<RadarProductLayer> radarProductLayer_;
std::shared_ptr<AlertLayer> alertLayer_;
std::shared_ptr<OverlayLayer> overlayLayer_;
std::shared_ptr<PlacefileLayer> placefileLayer_;
std::shared_ptr<ColorTableLayer> colorTableLayer_;
std::shared_ptr<RadarSiteLayer> radarSiteLayer_ {nullptr};
std::shared_ptr<RadarProductLayer> radarProductLayer_;
std::shared_ptr<AlertLayer> alertLayer_;
std::shared_ptr<OverlayLayer> overlayLayer_;
std::shared_ptr<OverlayProductLayer> overlayProductLayer_ {nullptr};
std::shared_ptr<PlacefileLayer> placefileLayer_;
std::shared_ptr<ColorTableLayer> colorTableLayer_;
std::shared_ptr<RadarSiteLayer> radarSiteLayer_ {nullptr};
std::list<std::shared_ptr<PlacefileLayer>> placefileLayers_ {};
@ -912,6 +914,16 @@ void MapWidgetImpl::AddLayer(types::LayerType type,
{
switch (std::get<types::DataLayer>(description))
{
// If there is a radar product view, create the overlay product layer
case types::DataLayer::OverlayProduct:
if (radarProductView != nullptr)
{
overlayProductLayer_ =
std::make_shared<OverlayProductLayer>(context_);
AddLayer(layerName, overlayProductLayer_, before);
}
break;
// If there is a radar product view, create the radar range layer
case types::DataLayer::RadarRange:
if (radarProductView != nullptr)

View file

@ -0,0 +1,73 @@
#include <scwx/qt/map/overlay_product_layer.hpp>
#include <scwx/util/logger.hpp>
namespace scwx
{
namespace qt
{
namespace map
{
static const std::string logPrefix_ = "scwx::qt::map::overlay_product_layer";
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
class OverlayProductLayer::Impl
{
public:
explicit Impl(std::shared_ptr<MapContext> context) {}
~Impl() = default;
};
OverlayProductLayer::OverlayProductLayer(std::shared_ptr<MapContext> context) :
DrawLayer(context), p(std::make_unique<Impl>(context))
{
}
OverlayProductLayer::~OverlayProductLayer() = default;
void OverlayProductLayer::Initialize()
{
logger_->debug("Initialize()");
DrawLayer::Initialize();
}
void OverlayProductLayer::Render(
const QMapLibreGL::CustomLayerRenderParameters& params)
{
gl::OpenGLFunctions& gl = context()->gl();
// Set OpenGL blend mode for transparency
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawLayer::Render(params);
SCWX_GL_CHECK_ERROR();
}
void OverlayProductLayer::Deinitialize()
{
logger_->debug("Deinitialize()");
DrawLayer::Deinitialize();
}
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)
{
return DrawLayer::RunMousePicking(params,
mouseLocalPos,
mouseGlobalPos,
mouseCoords,
mouseGeoCoords,
eventHandler);
}
} // namespace map
} // namespace qt
} // namespace scwx

View file

@ -0,0 +1,37 @@
#pragma once
#include <scwx/qt/map/draw_layer.hpp>
namespace scwx
{
namespace qt
{
namespace map
{
class OverlayProductLayer : public DrawLayer
{
public:
explicit OverlayProductLayer(std::shared_ptr<MapContext> context);
~OverlayProductLayer();
void Initialize() override final;
void Render(const QMapLibreGL::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,
std::shared_ptr<types::EventHandler>& eventHandler) override final;
private:
class Impl;
std::unique_ptr<Impl> p;
};
} // namespace map
} // namespace qt
} // namespace scwx

View file

@ -43,6 +43,7 @@ static const std::vector<types::LayerInfo> kDefaultLayers_ {
types::InformationLayer::RadarSite,
false,
{false, false, false, false}},
{types::LayerType::Data, types::DataLayer::OverlayProduct, true},
{types::LayerType::Data, types::DataLayer::RadarRange, true},
{types::LayerType::Alert, awips::Phenomenon::Tornado, true},
{types::LayerType::Alert, awips::Phenomenon::SnowSquall, true},

View file

@ -23,7 +23,9 @@ static const std::unordered_map<LayerType, std::string> layerTypeName_ {
{LayerType::Unknown, "?"}};
static const std::unordered_map<DataLayer, std::string> dataLayerName_ {
{DataLayer::RadarRange, "Radar Range"}, {DataLayer::Unknown, "?"}};
{DataLayer::OverlayProduct, "Overlay Product"},
{DataLayer::RadarRange, "Radar Range"},
{DataLayer::Unknown, "?"}};
static const std::unordered_map<InformationLayer, std::string>
informationLayerName_ {{InformationLayer::MapOverlay, "Map Overlay"},

View file

@ -31,11 +31,12 @@ enum class LayerType
enum class DataLayer
{
OverlayProduct,
RadarRange,
Unknown
};
typedef scwx::util::
Iterator<DataLayer, DataLayer::RadarRange, DataLayer::RadarRange>
Iterator<DataLayer, DataLayer::OverlayProduct, DataLayer::RadarRange>
DataLayerIterator;
enum class InformationLayer