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

@ -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,13 +181,8 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
void MapWidget::SetActive(bool isActive)
{
p->isActive_ = isActive;
if (p->context_->radarProductView_ != nullptr)
{
p->context_->radarProductView_->SetActive(isActive);
update();
}
p->context_->settings_.isActive_ = isActive;
update();
}
void MapWidget::SetMapParameters(

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;