Moving isActive from radar product view to map settings

This commit is contained in:
Dan Paulat 2021-11-27 19:17:31 -06:00
parent f7f86ec24a
commit b78011a2d3
7 changed files with 35 additions and 30 deletions

View file

@ -68,6 +68,7 @@ set(HDR_MAP source/scwx/qt/map/color_table_layer.hpp
source/scwx/qt/map/generic_layer.hpp
source/scwx/qt/map/layer_wrapper.hpp
source/scwx/qt/map/map_context.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/radar_product_layer.hpp

View file

@ -1,6 +1,7 @@
#pragma once
#include <scwx/qt/gl/gl.hpp>
#include <scwx/qt/map/map_settings.hpp>
#include <scwx/qt/view/radar_product_view.hpp>
namespace scwx
@ -14,7 +15,7 @@ struct MapContext
{
explicit MapContext(
std::shared_ptr<view::RadarProductView> radarProductView = nullptr) :
gl_ {}, radarProductView_ {radarProductView}
gl_ {}, settings_ {}, radarProductView_ {radarProductView}
{
}
~MapContext() = default;
@ -26,6 +27,7 @@ struct MapContext
MapContext& operator=(MapContext&&) noexcept = default;
gl::OpenGLFunctions gl_;
MapSettings settings_;
std::shared_ptr<view::RadarProductView> radarProductView_;
};

View file

@ -0,0 +1,26 @@
#pragma once
namespace scwx
{
namespace qt
{
namespace map
{
struct MapSettings
{
explicit MapSettings() : isActive_ {false} {}
~MapSettings() = default;
MapSettings(const MapSettings&) = delete;
MapSettings& operator=(const MapSettings&) = delete;
MapSettings(MapSettings&&) noexcept = default;
MapSettings& operator=(MapSettings&&) noexcept = default;
bool isActive_;
};
} // namespace map
} // namespace qt
} // namespace scwx

View file

@ -58,7 +58,6 @@ public:
radarProductLayer_ {nullptr},
overlayLayer_ {nullptr},
colorTableLayer_ {nullptr},
isActive_ {false},
lastPos_(),
currentStyleIndex_ {0},
frameDraws_(0),
@ -87,7 +86,6 @@ public:
std::shared_ptr<OverlayLayer> overlayLayer_;
std::shared_ptr<ColorTableLayer> colorTableLayer_;
bool isActive_;
QPointF lastPos_;
uint8_t currentStyleIndex_;
@ -145,7 +143,6 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
radarProductView = view::RadarProductViewFactory::Create(
product, currentElevation, p->radarProductManager_);
radarProductView->SetActive(p->isActive_);
connect(
radarProductView.get(),
@ -184,14 +181,9 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
void MapWidget::SetActive(bool isActive)
{
p->isActive_ = isActive;
if (p->context_->radarProductView_ != nullptr)
{
p->context_->radarProductView_->SetActive(isActive);
p->context_->settings_.isActive_ = isActive;
update();
}
}
void MapWidget::SetMapParameters(
double latitude, double longitude, double zoom, double bearing, double pitch)

View file

@ -159,7 +159,7 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
gl.glUniformMatrix4fv(
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
if (context()->radarProductView_->IsActive())
if (context()->settings_.isActive_)
{
const float vertexLX = 1.0f;
const float vertexRX = static_cast<float>(params.width) - 1.0f;

View file

@ -24,10 +24,8 @@ static const uint16_t DEFAULT_COLOR_TABLE_MAX = 255u;
class RadarProductViewImpl
{
public:
explicit RadarProductViewImpl() : isActive_ {false} {};
explicit RadarProductViewImpl() = default;
~RadarProductViewImpl() = default;
bool isActive_;
};
RadarProductView::RadarProductView() :
@ -87,16 +85,6 @@ RadarProductView::GetCfpMomentData() const
return std::tie(data, dataSize, componentSize);
}
bool RadarProductView::IsActive() const
{
return p->isActive_;
}
void RadarProductView::SetActive(bool isActive)
{
p->isActive_ = isActive;
}
void RadarProductView::ComputeSweep()
{
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";

View file

@ -42,10 +42,6 @@ public:
virtual std::tuple<const void*, size_t, size_t> GetMomentData() const = 0;
virtual std::tuple<const void*, size_t, size_t> GetCfpMomentData() const;
bool IsActive() const;
void SetActive(bool isActive);
protected:
virtual void UpdateColorTable() = 0;