mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Refactoring Radar{Layer,Manager,View} to RadarProduct{Layer,Manager,View}
This commit is contained in:
parent
6373728242
commit
5214f866d4
12 changed files with 160 additions and 138 deletions
|
|
@ -31,7 +31,7 @@
|
|||
</packagedElement>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_knPeIAKhEeyIXMJVZXHk6Q" name="qt">
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_md5dwAKhEeyIXMJVZXHk6Q" name="manager">
|
||||
<packagedElement xmi:type="uml:Class" xmi:id="_UwnjsAKhEeyIXMJVZXHk6Q" name="RadarManager">
|
||||
<packagedElement xmi:type="uml:Class" xmi:id="_UwnjsAKhEeyIXMJVZXHk6Q" name="RadarProductManager">
|
||||
<ownedOperation xmi:type="uml:Operation" xmi:id="_6sXFoC9YEeyWgvKLGfX-VA" name="coordinates">
|
||||
<ownedParameter xmi:type="uml:Parameter" xmi:id="_CXovQC9ZEeyWgvKLGfX-VA" type="_NOlLAC9WEeyWaqg4hauF0A"/>
|
||||
<ownedParameter xmi:type="uml:Parameter" xmi:id="_Xk9LIC9lEeyWgvKLGfX-VA" direction="return">
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
</packagedElement>
|
||||
</packagedElement>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_oVSdMAKhEeyIXMJVZXHk6Q" name="view">
|
||||
<packagedElement xmi:type="uml:Class" xmi:id="_Yt2OQAKhEeyIXMJVZXHk6Q" name="RadarView">
|
||||
<packagedElement xmi:type="uml:Class" xmi:id="_Yt2OQAKhEeyIXMJVZXHk6Q" name="RadarProductView">
|
||||
<ownedOperation xmi:type="uml:Operation" xmi:id="_Ra89oC9-EeyWgvKLGfX-VA" name="RadarView">
|
||||
<ownedParameter xmi:type="uml:Parameter" xmi:id="_fn3IQC9-EeyWgvKLGfX-VA" type="_UwnjsAKhEeyIXMJVZXHk6Q"/>
|
||||
<ownedParameter xmi:type="uml:Parameter" xmi:id="_rTMG8C9-EeyWgvKLGfX-VA">
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
</packagedElement>
|
||||
</packagedElement>
|
||||
<packagedElement xmi:type="uml:Package" xmi:id="_qBoqQAKhEeyIXMJVZXHk6Q" name="map">
|
||||
<packagedElement xmi:type="uml:Class" xmi:id="_a0ejkAKhEeyIXMJVZXHk6Q" name="RadarLayer">
|
||||
<packagedElement xmi:type="uml:Class" xmi:id="_a0ejkAKhEeyIXMJVZXHk6Q" name="RadarProductLayer">
|
||||
<ownedOperation xmi:type="uml:Operation" xmi:id="_X9HDIALIEeyIXMJVZXHk6Q" name="initialize"/>
|
||||
<ownedOperation xmi:type="uml:Operation" xmi:id="_Y0k2oALIEeyIXMJVZXHk6Q" name="render">
|
||||
<ownedParameter xmi:type="uml:Parameter" xmi:id="_yX_UkALKEeyIXMJVZXHk6Q" direction="inout">
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
#Sat Oct 23 08:00:47 CDT 2021
|
||||
#Sat Oct 30 22:49:04 CDT 2021
|
||||
_label_asdf=asdf2
|
||||
|
|
|
|||
|
|
@ -58,20 +58,20 @@ set(HDR_GL source/scwx/qt/gl/gl.hpp
|
|||
source/scwx/qt/gl/text_shader.hpp)
|
||||
set(SRC_GL source/scwx/qt/gl/shader_program.cpp
|
||||
source/scwx/qt/gl/text_shader.cpp)
|
||||
set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp
|
||||
set(HDR_MANAGER source/scwx/qt/manager/radar_product_manager.hpp
|
||||
source/scwx/qt/manager/resource_manager.hpp
|
||||
source/scwx/qt/manager/settings_manager.hpp)
|
||||
set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp
|
||||
set(SRC_MANAGER source/scwx/qt/manager/radar_product_manager.cpp
|
||||
source/scwx/qt/manager/resource_manager.cpp
|
||||
source/scwx/qt/manager/settings_manager.cpp)
|
||||
set(HDR_MAP source/scwx/qt/map/map_widget.hpp
|
||||
source/scwx/qt/map/overlay_layer.hpp
|
||||
source/scwx/qt/map/radar_layer.hpp
|
||||
source/scwx/qt/map/radar_product_layer.hpp
|
||||
source/scwx/qt/map/radar_range_layer.hpp
|
||||
source/scwx/qt/map/triangle_layer.hpp)
|
||||
set(SRC_MAP source/scwx/qt/map/map_widget.cpp
|
||||
source/scwx/qt/map/overlay_layer.cpp
|
||||
source/scwx/qt/map/radar_layer.cpp
|
||||
source/scwx/qt/map/radar_product_layer.cpp
|
||||
source/scwx/qt/map/radar_range_layer.cpp
|
||||
source/scwx/qt/map/triangle_layer.cpp)
|
||||
set(HDR_SETTINGS source/scwx/qt/settings/general_settings.hpp)
|
||||
|
|
@ -82,8 +82,8 @@ set(HDR_UTIL source/scwx/qt/util/font.hpp
|
|||
set(SRC_UTIL source/scwx/qt/util/font.cpp
|
||||
source/scwx/qt/util/font_buffer.cpp
|
||||
source/scwx/qt/util/json.cpp)
|
||||
set(HDR_VIEW source/scwx/qt/view/radar_view.hpp)
|
||||
set(SRC_VIEW source/scwx/qt/view/radar_view.cpp)
|
||||
set(HDR_VIEW source/scwx/qt/view/radar_product_view.hpp)
|
||||
set(SRC_VIEW source/scwx/qt/view/radar_product_view.cpp)
|
||||
|
||||
set(RESOURCE_FILES scwx-qt.qrc)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <scwx/qt/manager/radar_manager.hpp>
|
||||
#include <scwx/qt/manager/radar_product_manager.hpp>
|
||||
#include <scwx/common/constants.hpp>
|
||||
|
||||
#include <deque>
|
||||
|
|
@ -17,7 +17,8 @@ namespace qt
|
|||
namespace manager
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::qt::manager::radar_manager] ";
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::qt::manager::radar_product_manager] ";
|
||||
|
||||
static constexpr uint32_t NUM_RADIAL_GATES_0_5_DEGREE =
|
||||
common::MAX_0_5_DEGREE_RADIALS * common::MAX_DATA_MOMENT_GATES;
|
||||
|
|
@ -31,11 +32,11 @@ static constexpr uint32_t NUM_COORIDNATES_1_DEGREE =
|
|||
// TODO: Configure this in settings for radar loop
|
||||
static constexpr size_t MAX_LEVEL2_FILES = 6;
|
||||
|
||||
class RadarManagerImpl
|
||||
class RadarProductManagerImpl
|
||||
{
|
||||
public:
|
||||
explicit RadarManagerImpl() {}
|
||||
~RadarManagerImpl() = default;
|
||||
explicit RadarProductManagerImpl() {}
|
||||
~RadarProductManagerImpl() = default;
|
||||
|
||||
std::vector<float> coordinates0_5Degree_;
|
||||
std::vector<float> coordinates1Degree_;
|
||||
|
|
@ -43,11 +44,14 @@ public:
|
|||
std::deque<std::shared_ptr<wsr88d::Ar2vFile>> level2Data_;
|
||||
};
|
||||
|
||||
RadarManager::RadarManager() : p(std::make_unique<RadarManagerImpl>()) {}
|
||||
RadarManager::~RadarManager() = default;
|
||||
RadarProductManager::RadarProductManager() :
|
||||
p(std::make_unique<RadarProductManagerImpl>())
|
||||
{
|
||||
}
|
||||
RadarProductManager::~RadarProductManager() = default;
|
||||
|
||||
const std::vector<float>&
|
||||
RadarManager::coordinates(common::RadialSize radialSize) const
|
||||
RadarProductManager::coordinates(common::RadialSize radialSize) const
|
||||
{
|
||||
switch (radialSize)
|
||||
{
|
||||
|
|
@ -58,7 +62,7 @@ RadarManager::coordinates(common::RadialSize radialSize) const
|
|||
throw std::exception("Invalid radial size");
|
||||
}
|
||||
|
||||
std::shared_ptr<const wsr88d::Ar2vFile> RadarManager::level2_data() const
|
||||
std::shared_ptr<const wsr88d::Ar2vFile> RadarProductManager::level2_data() const
|
||||
{
|
||||
std::shared_ptr<const wsr88d::Ar2vFile> level2Data = nullptr;
|
||||
|
||||
|
|
@ -70,7 +74,7 @@ std::shared_ptr<const wsr88d::Ar2vFile> RadarManager::level2_data() const
|
|||
return level2Data;
|
||||
}
|
||||
|
||||
void RadarManager::Initialize()
|
||||
void RadarProductManager::Initialize()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Initialize()";
|
||||
|
||||
|
|
@ -157,7 +161,7 @@ void RadarManager::Initialize()
|
|||
<< timer.format(6, "%ws");
|
||||
}
|
||||
|
||||
void RadarManager::LoadLevel2Data(const std::string& filename)
|
||||
void RadarProductManager::LoadLevel2Data(const std::string& filename)
|
||||
{
|
||||
std::shared_ptr<wsr88d::Ar2vFile> ar2vFile =
|
||||
std::make_shared<wsr88d::Ar2vFile>();
|
||||
|
|
@ -15,15 +15,15 @@ namespace qt
|
|||
namespace manager
|
||||
{
|
||||
|
||||
class RadarManagerImpl;
|
||||
class RadarProductManagerImpl;
|
||||
|
||||
class RadarManager : public QObject
|
||||
class RadarProductManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadarManager();
|
||||
~RadarManager();
|
||||
explicit RadarProductManager();
|
||||
~RadarProductManager();
|
||||
|
||||
const std::vector<float>& coordinates(common::RadialSize radialSize) const;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ signals:
|
|||
void Level2DataLoaded();
|
||||
|
||||
private:
|
||||
std::unique_ptr<RadarManagerImpl> p;
|
||||
std::unique_ptr<RadarProductManagerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace manager
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#include <scwx/qt/map/map_widget.hpp>
|
||||
#include <scwx/qt/gl/gl.hpp>
|
||||
#include <scwx/qt/map/overlay_layer.hpp>
|
||||
#include <scwx/qt/map/radar_layer.hpp>
|
||||
#include <scwx/qt/map/radar_product_layer.hpp>
|
||||
#include <scwx/qt/map/radar_range_layer.hpp>
|
||||
|
||||
#include <QApplication>
|
||||
|
|
@ -41,7 +41,7 @@ public:
|
|||
gl_(),
|
||||
settings_(settings),
|
||||
map_(),
|
||||
radarManager_ {std::make_shared<manager::RadarManager>()},
|
||||
radarProductManager_ {std::make_shared<manager::RadarProductManager>()},
|
||||
lastPos_(),
|
||||
frameDraws_(0)
|
||||
{
|
||||
|
|
@ -53,7 +53,7 @@ public:
|
|||
QMapboxGLSettings settings_;
|
||||
std::shared_ptr<QMapboxGL> map_;
|
||||
|
||||
std::shared_ptr<manager::RadarManager> radarManager_;
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||
|
||||
QPointF lastPos_;
|
||||
|
||||
|
|
@ -65,11 +65,11 @@ MapWidget::MapWidget(const QMapboxGLSettings& settings) :
|
|||
{
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
p->radarManager_->Initialize();
|
||||
p->radarProductManager_->Initialize();
|
||||
QString ar2vFile = qgetenv("AR2V_FILE");
|
||||
if (!ar2vFile.isEmpty())
|
||||
{
|
||||
p->radarManager_->LoadLevel2Data(ar2vFile.toUtf8().constData());
|
||||
p->radarProductManager_->LoadLevel2Data(ar2vFile.toUtf8().constData());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -103,24 +103,25 @@ void MapWidget::changeStyle()
|
|||
|
||||
void MapWidget::AddLayers()
|
||||
{
|
||||
std::shared_ptr<view::RadarView> radarView =
|
||||
std::make_shared<view::RadarView>(p->radarManager_, p->map_);
|
||||
std::shared_ptr<view::RadarProductView> radarProductView =
|
||||
std::make_shared<view::RadarProductView>(p->radarProductManager_,
|
||||
p->map_);
|
||||
|
||||
radarView->Initialize();
|
||||
radarProductView->Initialize();
|
||||
|
||||
QString colorTableFile = qgetenv("COLOR_TABLE");
|
||||
if (!colorTableFile.isEmpty())
|
||||
{
|
||||
std::shared_ptr<common::ColorTable> colorTable =
|
||||
common::ColorTable::Load(colorTableFile.toUtf8().constData());
|
||||
radarView->LoadColorTable(colorTable);
|
||||
radarProductView->LoadColorTable(colorTable);
|
||||
}
|
||||
|
||||
// QMapboxGL::addCustomLayer will take ownership of the QScopedPointer
|
||||
QScopedPointer<QMapbox::CustomLayerHostInterface> pHost(
|
||||
new RadarLayer(radarView, p->gl_));
|
||||
new RadarProductLayer(radarProductView, p->gl_));
|
||||
QScopedPointer<QMapbox::CustomLayerHostInterface> pOverlayHost(
|
||||
new OverlayLayer(radarView, p->gl_));
|
||||
new OverlayLayer(radarProductView, p->gl_));
|
||||
|
||||
QString before = "ferry";
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@ static const std::string logPrefix_ = "[scwx::qt::map::overlay_layer] ";
|
|||
class OverlayLayerImpl
|
||||
{
|
||||
public:
|
||||
explicit OverlayLayerImpl(std::shared_ptr<view::RadarView> radarView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
radarView_(radarView),
|
||||
explicit OverlayLayerImpl(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
radarProductView_(radarProductView),
|
||||
gl_(gl),
|
||||
textShader_(gl),
|
||||
font_(util::Font::Create(":/res/fonts/din1451alt.ttf")),
|
||||
|
|
@ -48,8 +49,8 @@ public:
|
|||
}
|
||||
~OverlayLayerImpl() = default;
|
||||
|
||||
std::shared_ptr<view::RadarView> radarView_;
|
||||
gl::OpenGLFunctions& gl_;
|
||||
std::shared_ptr<view::RadarProductView> radarProductView_;
|
||||
gl::OpenGLFunctions& gl_;
|
||||
|
||||
gl::TextShader textShader_;
|
||||
std::shared_ptr<util::Font> font_;
|
||||
|
|
@ -66,9 +67,10 @@ public:
|
|||
bool plotUpdated_;
|
||||
};
|
||||
|
||||
OverlayLayer::OverlayLayer(std::shared_ptr<view::RadarView> radarView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
p(std::make_unique<OverlayLayerImpl>(radarView, gl))
|
||||
OverlayLayer::OverlayLayer(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
p(std::make_unique<OverlayLayerImpl>(radarProductView, gl))
|
||||
{
|
||||
}
|
||||
OverlayLayer::~OverlayLayer() = default;
|
||||
|
|
@ -124,8 +126,8 @@ void OverlayLayer::initialize()
|
|||
// Bottom panel color
|
||||
gl.glUniform4f(p->uColorLocation_, 0.0f, 0.0f, 0.0f, 0.75f);
|
||||
|
||||
connect(p->radarView_.get(),
|
||||
&view::RadarView::PlotUpdated,
|
||||
connect(p->radarProductView_.get(),
|
||||
&view::RadarProductView::PlotUpdated,
|
||||
this,
|
||||
&OverlayLayer::ReceivePlotUpdate);
|
||||
}
|
||||
|
|
@ -139,7 +141,8 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
|||
if (p->plotUpdated_)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto plotTime = time_point_cast<seconds>(p->radarView_->PlotTime());
|
||||
auto plotTime =
|
||||
time_point_cast<seconds>(p->radarProductView_->PlotTime());
|
||||
|
||||
if (plotTime.time_since_epoch().count() != 0)
|
||||
{
|
||||
|
|
@ -207,8 +210,8 @@ void OverlayLayer::deinitialize()
|
|||
p->vbo_ = {GL_INVALID_INDEX};
|
||||
p->texture_ = GL_INVALID_INDEX;
|
||||
|
||||
disconnect(p->radarView_.get(),
|
||||
&view::RadarView::PlotUpdated,
|
||||
disconnect(p->radarProductView_.get(),
|
||||
&view::RadarProductView::PlotUpdated,
|
||||
this,
|
||||
&OverlayLayer::ReceivePlotUpdate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/qt/gl/gl.hpp>
|
||||
#include <scwx/qt/view/radar_view.hpp>
|
||||
#include <scwx/qt/view/radar_product_view.hpp>
|
||||
|
||||
#include <QMapboxGL>
|
||||
|
||||
|
|
@ -19,8 +19,9 @@ class OverlayLayer : public QObject, public QMapbox::CustomLayerHostInterface
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OverlayLayer(std::shared_ptr<view::RadarView> radarView,
|
||||
gl::OpenGLFunctions& gl);
|
||||
explicit OverlayLayer(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView,
|
||||
gl::OpenGLFunctions& gl);
|
||||
~OverlayLayer();
|
||||
|
||||
void initialize() override final;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <scwx/qt/map/radar_layer.hpp>
|
||||
#include <scwx/qt/map/radar_product_layer.hpp>
|
||||
#include <scwx/qt/gl/shader_program.hpp>
|
||||
|
||||
#include <execution>
|
||||
|
|
@ -21,17 +21,18 @@ namespace map
|
|||
static constexpr uint32_t MAX_RADIALS = 720;
|
||||
static constexpr uint32_t MAX_DATA_MOMENT_GATES = 1840;
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::qt::map::radar_layer] ";
|
||||
static const std::string logPrefix_ = "[scwx::qt::map::radar_product_layer] ";
|
||||
|
||||
static glm::vec2
|
||||
LatLongToScreenCoordinate(const QMapbox::Coordinate& coordinate);
|
||||
|
||||
class RadarLayerImpl
|
||||
class RadarProductLayerImpl
|
||||
{
|
||||
public:
|
||||
explicit RadarLayerImpl(std::shared_ptr<view::RadarView> radarView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
radarView_(radarView),
|
||||
explicit RadarProductLayerImpl(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
radarProductView_(radarProductView),
|
||||
gl_(gl),
|
||||
shaderProgram_(gl),
|
||||
uMVPMatrixLocation_(GL_INVALID_INDEX),
|
||||
|
|
@ -44,10 +45,10 @@ public:
|
|||
plotUpdated_(false)
|
||||
{
|
||||
}
|
||||
~RadarLayerImpl() = default;
|
||||
~RadarProductLayerImpl() = default;
|
||||
|
||||
std::shared_ptr<view::RadarView> radarView_;
|
||||
gl::OpenGLFunctions& gl_;
|
||||
std::shared_ptr<view::RadarProductView> radarProductView_;
|
||||
gl::OpenGLFunctions& gl_;
|
||||
|
||||
gl::ShaderProgram shaderProgram_;
|
||||
GLint uMVPMatrixLocation_;
|
||||
|
|
@ -62,14 +63,15 @@ public:
|
|||
bool plotUpdated_;
|
||||
};
|
||||
|
||||
RadarLayer::RadarLayer(std::shared_ptr<view::RadarView> radarView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
p(std::make_unique<RadarLayerImpl>(radarView, gl))
|
||||
RadarProductLayer::RadarProductLayer(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView,
|
||||
gl::OpenGLFunctions& gl) :
|
||||
p(std::make_unique<RadarProductLayerImpl>(radarProductView, gl))
|
||||
{
|
||||
}
|
||||
RadarLayer::~RadarLayer() = default;
|
||||
RadarProductLayer::~RadarProductLayer() = default;
|
||||
|
||||
void RadarLayer::initialize()
|
||||
void RadarProductLayer::initialize()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "initialize()";
|
||||
|
||||
|
|
@ -99,27 +101,27 @@ void RadarLayer::initialize()
|
|||
// Generate vertex buffer objects
|
||||
gl.glGenBuffers(2, p->vbo_.data());
|
||||
|
||||
// Update radar plot
|
||||
UpdatePlot();
|
||||
// Update radar sweep
|
||||
UpdateSweep();
|
||||
|
||||
// Create color table
|
||||
gl.glGenTextures(1, &p->texture_);
|
||||
UpdateColorTable();
|
||||
gl.glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
|
||||
connect(p->radarView_.get(),
|
||||
&view::RadarView::ColorTableLoaded,
|
||||
connect(p->radarProductView_.get(),
|
||||
&view::RadarProductView::ColorTableLoaded,
|
||||
this,
|
||||
&RadarLayer::ReceiveColorTableUpdate);
|
||||
connect(p->radarView_.get(),
|
||||
&view::RadarView::PlotUpdated,
|
||||
&RadarProductLayer::ReceiveColorTableUpdate);
|
||||
connect(p->radarProductView_.get(),
|
||||
&view::RadarProductView::PlotUpdated,
|
||||
this,
|
||||
&RadarLayer::ReceivePlotUpdate);
|
||||
&RadarProductLayer::ReceivePlotUpdate);
|
||||
}
|
||||
|
||||
void RadarLayer::UpdatePlot()
|
||||
void RadarProductLayer::UpdateSweep()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdatePlot()";
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateSweep()";
|
||||
|
||||
p->plotUpdated_ = false;
|
||||
|
||||
|
|
@ -127,9 +129,11 @@ void RadarLayer::UpdatePlot()
|
|||
|
||||
boost::timer::cpu_timer timer;
|
||||
|
||||
const std::vector<float>& vertices = p->radarView_->vertices();
|
||||
const std::vector<uint8_t>& dataMoments8 = p->radarView_->data_moments8();
|
||||
const std::vector<uint16_t>& dataMoments16 = p->radarView_->data_moments16();
|
||||
const std::vector<float>& vertices = p->radarProductView_->vertices();
|
||||
const std::vector<uint8_t>& dataMoments8 =
|
||||
p->radarProductView_->data_moments8();
|
||||
const std::vector<uint16_t>& dataMoments16 =
|
||||
p->radarProductView_->data_moments16();
|
||||
|
||||
// Bind a vertex array object
|
||||
gl.glBindVertexArray(p->vao_);
|
||||
|
|
@ -182,7 +186,8 @@ void RadarLayer::UpdatePlot()
|
|||
p->numVertices_ = vertices.size() / 2;
|
||||
}
|
||||
|
||||
void RadarLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||
void RadarProductLayer::render(
|
||||
const QMapbox::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = p->gl_;
|
||||
|
||||
|
|
@ -193,13 +198,13 @@ void RadarLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
|||
|
||||
if (p->plotUpdated_)
|
||||
{
|
||||
UpdatePlot();
|
||||
UpdateSweep();
|
||||
}
|
||||
|
||||
p->shaderProgram_.Use();
|
||||
|
||||
const float scale = p->radarView_->scale() * 2.0f * mbgl::util::tileSize /
|
||||
mbgl::util::DEGREES_MAX;
|
||||
const float scale = p->radarProductView_->scale() * 2.0f *
|
||||
mbgl::util::tileSize / mbgl::util::DEGREES_MAX;
|
||||
const float xScale = scale / params.width;
|
||||
const float yScale = scale / params.height;
|
||||
|
||||
|
|
@ -223,7 +228,7 @@ void RadarLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
|||
gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
|
||||
}
|
||||
|
||||
void RadarLayer::deinitialize()
|
||||
void RadarProductLayer::deinitialize()
|
||||
{
|
||||
gl::OpenGLFunctions& gl = p->gl_;
|
||||
|
||||
|
|
@ -237,17 +242,17 @@ void RadarLayer::deinitialize()
|
|||
p->vbo_ = {GL_INVALID_INDEX};
|
||||
p->texture_ = GL_INVALID_INDEX;
|
||||
|
||||
disconnect(p->radarView_.get(),
|
||||
&view::RadarView::ColorTableLoaded,
|
||||
disconnect(p->radarProductView_.get(),
|
||||
&view::RadarProductView::ColorTableLoaded,
|
||||
this,
|
||||
&RadarLayer::ReceiveColorTableUpdate);
|
||||
disconnect(p->radarView_.get(),
|
||||
&view::RadarView::PlotUpdated,
|
||||
&RadarProductLayer::ReceiveColorTableUpdate);
|
||||
disconnect(p->radarProductView_.get(),
|
||||
&view::RadarProductView::PlotUpdated,
|
||||
this,
|
||||
&RadarLayer::ReceivePlotUpdate);
|
||||
&RadarProductLayer::ReceivePlotUpdate);
|
||||
}
|
||||
|
||||
void RadarLayer::UpdateColorTable()
|
||||
void RadarProductLayer::UpdateColorTable()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdateColorTable()";
|
||||
|
||||
|
|
@ -256,7 +261,7 @@ void RadarLayer::UpdateColorTable()
|
|||
gl::OpenGLFunctions& gl = p->gl_;
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>& colorTable =
|
||||
p->radarView_->color_table();
|
||||
p->radarProductView_->color_table();
|
||||
|
||||
gl.glActiveTexture(GL_TEXTURE0);
|
||||
gl.glBindTexture(GL_TEXTURE_1D, p->texture_);
|
||||
|
|
@ -271,12 +276,12 @@ void RadarLayer::UpdateColorTable()
|
|||
gl.glGenerateMipmap(GL_TEXTURE_1D);
|
||||
}
|
||||
|
||||
void RadarLayer::ReceiveColorTableUpdate()
|
||||
void RadarProductLayer::ReceiveColorTableUpdate()
|
||||
{
|
||||
p->colorTableUpdated_ = true;
|
||||
}
|
||||
|
||||
void RadarLayer::ReceivePlotUpdate()
|
||||
void RadarProductLayer::ReceivePlotUpdate()
|
||||
{
|
||||
p->plotUpdated_ = true;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/qt/gl/gl.hpp>
|
||||
#include <scwx/qt/view/radar_view.hpp>
|
||||
#include <scwx/qt/view/radar_product_view.hpp>
|
||||
|
||||
#include <QMapboxGL>
|
||||
|
||||
|
|
@ -12,30 +12,33 @@ namespace qt
|
|||
namespace map
|
||||
{
|
||||
|
||||
class RadarLayerImpl;
|
||||
class RadarProductLayerImpl;
|
||||
|
||||
class RadarLayer : public QObject, public QMapbox::CustomLayerHostInterface
|
||||
class RadarProductLayer :
|
||||
public QObject,
|
||||
public QMapbox::CustomLayerHostInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadarLayer(std::shared_ptr<view::RadarView> radarView,
|
||||
gl::OpenGLFunctions& gl);
|
||||
~RadarLayer();
|
||||
explicit RadarProductLayer(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView,
|
||||
gl::OpenGLFunctions& gl);
|
||||
~RadarProductLayer();
|
||||
|
||||
void initialize() override final;
|
||||
void render(const QMapbox::CustomLayerRenderParameters&) override final;
|
||||
void deinitialize() override final;
|
||||
|
||||
void UpdateColorTable();
|
||||
void UpdatePlot();
|
||||
void UpdateSweep();
|
||||
|
||||
public slots:
|
||||
void ReceiveColorTableUpdate();
|
||||
void ReceivePlotUpdate();
|
||||
|
||||
private:
|
||||
std::unique_ptr<RadarLayerImpl> p;
|
||||
std::unique_ptr<RadarProductLayerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <scwx/qt/view/radar_view.hpp>
|
||||
#include <scwx/qt/view/radar_product_view.hpp>
|
||||
#include <scwx/common/constants.hpp>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
|
@ -12,7 +12,7 @@ namespace qt
|
|||
namespace view
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::qt::view::radar_view] ";
|
||||
static const std::string logPrefix_ = "[scwx::qt::view::radar_product_view] ";
|
||||
|
||||
static constexpr uint32_t VERTICES_PER_BIN = 6;
|
||||
static constexpr uint32_t VALUES_PER_VERTEX = 2;
|
||||
|
|
@ -20,12 +20,13 @@ static constexpr uint32_t VALUES_PER_VERTEX = 2;
|
|||
static std::chrono::system_clock::time_point
|
||||
TimePoint(uint16_t modifiedJulianDate, uint32_t milliseconds);
|
||||
|
||||
class RadarViewImpl
|
||||
class RadarProductViewImpl
|
||||
{
|
||||
public:
|
||||
explicit RadarViewImpl(std::shared_ptr<manager::RadarManager> radarManager,
|
||||
std::shared_ptr<QMapboxGL> map) :
|
||||
radarManager_(radarManager),
|
||||
explicit RadarProductViewImpl(
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager,
|
||||
std::shared_ptr<QMapboxGL> map) :
|
||||
radarProductManager_(radarProductManager),
|
||||
map_(map),
|
||||
plotTime_(),
|
||||
colorTable_ {boost::gil::rgba8_pixel_t(0, 128, 0, 255),
|
||||
|
|
@ -33,10 +34,10 @@ public:
|
|||
boost::gil::rgba8_pixel_t(255, 0, 0, 255)}
|
||||
{
|
||||
}
|
||||
~RadarViewImpl() = default;
|
||||
~RadarProductViewImpl() = default;
|
||||
|
||||
std::shared_ptr<manager::RadarManager> radarManager_;
|
||||
std::shared_ptr<QMapboxGL> map_;
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||
std::shared_ptr<QMapboxGL> map_;
|
||||
|
||||
std::vector<float> vertices_;
|
||||
std::vector<uint8_t> dataMoments8_;
|
||||
|
|
@ -47,53 +48,56 @@ public:
|
|||
std::vector<boost::gil::rgba8_pixel_t> colorTable_;
|
||||
};
|
||||
|
||||
RadarView::RadarView(std::shared_ptr<manager::RadarManager> radarManager,
|
||||
std::shared_ptr<QMapboxGL> map) :
|
||||
p(std::make_unique<RadarViewImpl>(radarManager, map))
|
||||
RadarProductView::RadarProductView(
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager,
|
||||
std::shared_ptr<QMapboxGL> map) :
|
||||
p(std::make_unique<RadarProductViewImpl>(radarProductManager, map))
|
||||
{
|
||||
connect(radarManager.get(),
|
||||
&manager::RadarManager::Level2DataLoaded,
|
||||
connect(radarProductManager.get(),
|
||||
&manager::RadarProductManager::Level2DataLoaded,
|
||||
this,
|
||||
&RadarView::UpdatePlot);
|
||||
&RadarProductView::UpdatePlot);
|
||||
}
|
||||
RadarView::~RadarView() = default;
|
||||
RadarProductView::~RadarProductView() = default;
|
||||
|
||||
double RadarView::bearing() const
|
||||
double RadarProductView::bearing() const
|
||||
{
|
||||
return p->map_->bearing();
|
||||
}
|
||||
|
||||
double RadarView::scale() const
|
||||
double RadarProductView::scale() const
|
||||
{
|
||||
return p->map_->scale();
|
||||
}
|
||||
|
||||
const std::vector<uint8_t>& RadarView::data_moments8() const
|
||||
const std::vector<uint8_t>& RadarProductView::data_moments8() const
|
||||
{
|
||||
return p->dataMoments8_;
|
||||
}
|
||||
|
||||
const std::vector<uint16_t>& RadarView::data_moments16() const
|
||||
const std::vector<uint16_t>& RadarProductView::data_moments16() const
|
||||
{
|
||||
return p->dataMoments16_;
|
||||
}
|
||||
|
||||
const std::vector<float>& RadarView::vertices() const
|
||||
const std::vector<float>& RadarProductView::vertices() const
|
||||
{
|
||||
return p->vertices_;
|
||||
}
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>& RadarView::color_table() const
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
RadarProductView::color_table() const
|
||||
{
|
||||
return p->colorTable_;
|
||||
}
|
||||
|
||||
void RadarView::Initialize()
|
||||
void RadarProductView::Initialize()
|
||||
{
|
||||
UpdatePlot();
|
||||
}
|
||||
|
||||
void RadarView::LoadColorTable(std::shared_ptr<common::ColorTable> colorTable)
|
||||
void RadarProductView::LoadColorTable(
|
||||
std::shared_ptr<common::ColorTable> colorTable)
|
||||
{
|
||||
// TODO: Make size, offset and scale dynamic
|
||||
const float offset = 66.0f;
|
||||
|
|
@ -115,12 +119,12 @@ void RadarView::LoadColorTable(std::shared_ptr<common::ColorTable> colorTable)
|
|||
emit ColorTableLoaded();
|
||||
}
|
||||
|
||||
std::chrono::system_clock::time_point RadarView::PlotTime()
|
||||
std::chrono::system_clock::time_point RadarProductView::PlotTime()
|
||||
{
|
||||
return p->plotTime_;
|
||||
}
|
||||
|
||||
void RadarView::UpdatePlot()
|
||||
void RadarProductView::UpdatePlot()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "UpdatePlot()";
|
||||
|
||||
|
|
@ -128,10 +132,10 @@ void RadarView::UpdatePlot()
|
|||
|
||||
// TODO: Pick this based on radar data
|
||||
const std::vector<float>& coordinates =
|
||||
p->radarManager_->coordinates(common::RadialSize::_0_5Degree);
|
||||
p->radarProductManager_->coordinates(common::RadialSize::_0_5Degree);
|
||||
|
||||
std::shared_ptr<const wsr88d::Ar2vFile> level2Data =
|
||||
p->radarManager_->level2_data();
|
||||
p->radarProductManager_->level2_data();
|
||||
if (level2Data == nullptr)
|
||||
{
|
||||
return;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/common/color_table.hpp>
|
||||
#include <scwx/qt/manager/radar_manager.hpp>
|
||||
#include <scwx/qt/manager/radar_product_manager.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
|
@ -16,16 +16,17 @@ namespace qt
|
|||
namespace view
|
||||
{
|
||||
|
||||
class RadarViewImpl;
|
||||
class RadarProductViewImpl;
|
||||
|
||||
class RadarView : public QObject
|
||||
class RadarProductView : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadarView(std::shared_ptr<manager::RadarManager> radarManager,
|
||||
std::shared_ptr<QMapboxGL> map);
|
||||
~RadarView();
|
||||
explicit RadarProductView(
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager,
|
||||
std::shared_ptr<QMapboxGL> map);
|
||||
~RadarProductView();
|
||||
|
||||
double bearing() const;
|
||||
double scale() const;
|
||||
|
|
@ -48,7 +49,7 @@ signals:
|
|||
void PlotUpdated();
|
||||
|
||||
private:
|
||||
std::unique_ptr<RadarViewImpl> p;
|
||||
std::unique_ptr<RadarProductViewImpl> p;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
Loading…
Add table
Add a link
Reference in a new issue