mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Moving isActive from radar product view to map settings
This commit is contained in:
parent
f7f86ec24a
commit
b78011a2d3
7 changed files with 35 additions and 30 deletions
|
|
@ -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/generic_layer.hpp
|
||||||
source/scwx/qt/map/layer_wrapper.hpp
|
source/scwx/qt/map/layer_wrapper.hpp
|
||||||
source/scwx/qt/map/map_context.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/map_widget.hpp
|
||||||
source/scwx/qt/map/overlay_layer.hpp
|
source/scwx/qt/map/overlay_layer.hpp
|
||||||
source/scwx/qt/map/radar_product_layer.hpp
|
source/scwx/qt/map/radar_product_layer.hpp
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/gl/gl.hpp>
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
|
#include <scwx/qt/map/map_settings.hpp>
|
||||||
#include <scwx/qt/view/radar_product_view.hpp>
|
#include <scwx/qt/view/radar_product_view.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
|
|
@ -14,7 +15,7 @@ struct MapContext
|
||||||
{
|
{
|
||||||
explicit MapContext(
|
explicit MapContext(
|
||||||
std::shared_ptr<view::RadarProductView> radarProductView = nullptr) :
|
std::shared_ptr<view::RadarProductView> radarProductView = nullptr) :
|
||||||
gl_ {}, radarProductView_ {radarProductView}
|
gl_ {}, settings_ {}, radarProductView_ {radarProductView}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~MapContext() = default;
|
~MapContext() = default;
|
||||||
|
|
@ -26,6 +27,7 @@ struct MapContext
|
||||||
MapContext& operator=(MapContext&&) noexcept = default;
|
MapContext& operator=(MapContext&&) noexcept = default;
|
||||||
|
|
||||||
gl::OpenGLFunctions gl_;
|
gl::OpenGLFunctions gl_;
|
||||||
|
MapSettings settings_;
|
||||||
std::shared_ptr<view::RadarProductView> radarProductView_;
|
std::shared_ptr<view::RadarProductView> radarProductView_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
26
scwx-qt/source/scwx/qt/map/map_settings.hpp
Normal file
26
scwx-qt/source/scwx/qt/map/map_settings.hpp
Normal 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
|
||||||
|
|
@ -58,7 +58,6 @@ public:
|
||||||
radarProductLayer_ {nullptr},
|
radarProductLayer_ {nullptr},
|
||||||
overlayLayer_ {nullptr},
|
overlayLayer_ {nullptr},
|
||||||
colorTableLayer_ {nullptr},
|
colorTableLayer_ {nullptr},
|
||||||
isActive_ {false},
|
|
||||||
lastPos_(),
|
lastPos_(),
|
||||||
currentStyleIndex_ {0},
|
currentStyleIndex_ {0},
|
||||||
frameDraws_(0),
|
frameDraws_(0),
|
||||||
|
|
@ -87,7 +86,6 @@ public:
|
||||||
std::shared_ptr<OverlayLayer> overlayLayer_;
|
std::shared_ptr<OverlayLayer> overlayLayer_;
|
||||||
std::shared_ptr<ColorTableLayer> colorTableLayer_;
|
std::shared_ptr<ColorTableLayer> colorTableLayer_;
|
||||||
|
|
||||||
bool isActive_;
|
|
||||||
QPointF lastPos_;
|
QPointF lastPos_;
|
||||||
uint8_t currentStyleIndex_;
|
uint8_t currentStyleIndex_;
|
||||||
|
|
||||||
|
|
@ -145,7 +143,6 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
|
||||||
|
|
||||||
radarProductView = view::RadarProductViewFactory::Create(
|
radarProductView = view::RadarProductViewFactory::Create(
|
||||||
product, currentElevation, p->radarProductManager_);
|
product, currentElevation, p->radarProductManager_);
|
||||||
radarProductView->SetActive(p->isActive_);
|
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
radarProductView.get(),
|
radarProductView.get(),
|
||||||
|
|
@ -184,13 +181,8 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
|
||||||
|
|
||||||
void MapWidget::SetActive(bool isActive)
|
void MapWidget::SetActive(bool isActive)
|
||||||
{
|
{
|
||||||
p->isActive_ = isActive;
|
p->context_->settings_.isActive_ = isActive;
|
||||||
|
update();
|
||||||
if (p->context_->radarProductView_ != nullptr)
|
|
||||||
{
|
|
||||||
p->context_->radarProductView_->SetActive(isActive);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::SetMapParameters(
|
void MapWidget::SetMapParameters(
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
gl.glUniformMatrix4fv(
|
gl.glUniformMatrix4fv(
|
||||||
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
||||||
|
|
||||||
if (context()->radarProductView_->IsActive())
|
if (context()->settings_.isActive_)
|
||||||
{
|
{
|
||||||
const float vertexLX = 1.0f;
|
const float vertexLX = 1.0f;
|
||||||
const float vertexRX = static_cast<float>(params.width) - 1.0f;
|
const float vertexRX = static_cast<float>(params.width) - 1.0f;
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,8 @@ static const uint16_t DEFAULT_COLOR_TABLE_MAX = 255u;
|
||||||
class RadarProductViewImpl
|
class RadarProductViewImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RadarProductViewImpl() : isActive_ {false} {};
|
explicit RadarProductViewImpl() = default;
|
||||||
~RadarProductViewImpl() = default;
|
~RadarProductViewImpl() = default;
|
||||||
|
|
||||||
bool isActive_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RadarProductView::RadarProductView() :
|
RadarProductView::RadarProductView() :
|
||||||
|
|
@ -87,16 +85,6 @@ RadarProductView::GetCfpMomentData() const
|
||||||
return std::tie(data, dataSize, componentSize);
|
return std::tie(data, dataSize, componentSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadarProductView::IsActive() const
|
|
||||||
{
|
|
||||||
return p->isActive_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RadarProductView::SetActive(bool isActive)
|
|
||||||
{
|
|
||||||
p->isActive_ = isActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RadarProductView::ComputeSweep()
|
void RadarProductView::ComputeSweep()
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()";
|
||||||
|
|
|
||||||
|
|
@ -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> GetMomentData() const = 0;
|
||||||
virtual std::tuple<const void*, size_t, size_t> GetCfpMomentData() const;
|
virtual std::tuple<const void*, size_t, size_t> GetCfpMomentData() const;
|
||||||
|
|
||||||
bool IsActive() const;
|
|
||||||
|
|
||||||
void SetActive(bool isActive);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void UpdateColorTable() = 0;
|
virtual void UpdateColorTable() = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue