From 03f08d54f123bb1074e5423205d18bf6e0ab15a1 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 4 Jan 2024 23:16:05 -0600 Subject: [PATCH] Refactor color table functions to reference the lookup table where appropriate --- scwx-qt/source/scwx/qt/map/color_table_layer.cpp | 4 ++-- scwx-qt/source/scwx/qt/map/map_widget.cpp | 6 ++---- scwx-qt/source/scwx/qt/map/radar_product_layer.cpp | 4 ++-- scwx-qt/source/scwx/qt/view/level2_product_view.cpp | 12 ++++++------ scwx-qt/source/scwx/qt/view/level2_product_view.hpp | 5 +++-- scwx-qt/source/scwx/qt/view/level3_product_view.cpp | 10 +++++----- scwx-qt/source/scwx/qt/view/level3_product_view.hpp | 5 +++-- scwx-qt/source/scwx/qt/view/level3_radial_view.cpp | 2 +- scwx-qt/source/scwx/qt/view/level3_raster_view.cpp | 2 +- scwx-qt/source/scwx/qt/view/radar_product_view.cpp | 2 +- scwx-qt/source/scwx/qt/view/radar_product_view.hpp | 7 ++++--- 11 files changed, 30 insertions(+), 29 deletions(-) diff --git a/scwx-qt/source/scwx/qt/map/color_table_layer.cpp b/scwx-qt/source/scwx/qt/map/color_table_layer.cpp index f6181b5c..bd5ff9ff 100644 --- a/scwx-qt/source/scwx/qt/map/color_table_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/color_table_layer.cpp @@ -109,7 +109,7 @@ void ColorTableLayer::Initialize() gl.glEnableVertexAttribArray(1); connect(context()->radar_product_view().get(), - &view::RadarProductView::ColorTableUpdated, + &view::RadarProductView::ColorTableLutUpdated, this, [this]() { p->colorTableNeedsUpdate_ = true; }); } @@ -142,7 +142,7 @@ void ColorTableLayer::Render( if (p->colorTableNeedsUpdate_) { - p->colorTable_ = radarProductView->color_table(); + p->colorTable_ = radarProductView->color_table_lut(); gl.glActiveTexture(GL_TEXTURE0); gl.glBindTexture(GL_TEXTURE_1D, p->texture_); diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index 53b234e2..913ab0b8 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -182,8 +182,6 @@ public: manager::PlacefileManager::Instance()}; std::shared_ptr radarProductManager_; - std::shared_ptr colorTable_; - std::shared_ptr radarProductLayer_; std::shared_ptr alertLayer_; std::shared_ptr overlayLayer_; @@ -1377,7 +1375,7 @@ void MapWidgetImpl::RadarProductViewConnect() { connect( radarProductView.get(), - &view::RadarProductView::ColorTableUpdated, + &view::RadarProductView::ColorTableLutUpdated, this, [this]() { widget_->update(); }, Qt::QueuedConnection); @@ -1412,7 +1410,7 @@ void MapWidgetImpl::RadarProductViewDisconnect() if (radarProductView != nullptr) { disconnect(radarProductView.get(), - &view::RadarProductView::ColorTableUpdated, + &view::RadarProductView::ColorTableLutUpdated, this, nullptr); disconnect(radarProductView.get(), diff --git a/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp b/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp index c495e23a..959d1455 100644 --- a/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp @@ -77,7 +77,7 @@ RadarProductLayer::RadarProductLayer(std::shared_ptr context) : { auto radarProductView = context->radar_product_view(); connect(radarProductView.get(), - &view::RadarProductView::ColorTableUpdated, + &view::RadarProductView::ColorTableLutUpdated, this, [this]() { p->colorTableNeedsUpdate_ = true; }); connect(radarProductView.get(), @@ -334,7 +334,7 @@ void RadarProductLayer::UpdateColorTable() context()->radar_product_view(); const std::vector& colorTable = - radarProductView->color_table(); + radarProductView->color_table_lut(); const uint16_t rangeMin = radarProductView->color_table_min(); const uint16_t rangeMax = radarProductView->color_table_max(); diff --git a/scwx-qt/source/scwx/qt/view/level2_product_view.cpp b/scwx-qt/source/scwx/qt/view/level2_product_view.cpp index 29c23d76..d8dcc950 100644 --- a/scwx-qt/source/scwx/qt/view/level2_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level2_product_view.cpp @@ -164,11 +164,11 @@ boost::asio::thread_pool& Level2ProductView::thread_pool() } const std::vector& -Level2ProductView::color_table() const +Level2ProductView::color_table_lut() const { if (p->colorTableLut_.size() == 0) { - return RadarProductView::color_table(); + return RadarProductView::color_table_lut(); } else { @@ -282,7 +282,7 @@ void Level2ProductView::LoadColorTable( std::shared_ptr colorTable) { p->colorTable_ = colorTable; - UpdateColorTable(); + UpdateColorTableLut(); } void Level2ProductView::SelectElevation(float elevation) @@ -317,7 +317,7 @@ void Level2ProductViewImpl::SetProduct(common::Level2Product product) } } -void Level2ProductView::UpdateColorTable() +void Level2ProductView::UpdateColorTableLut() { if (p->momentDataBlock0_ == nullptr || // p->colorTable_ == nullptr || // @@ -398,7 +398,7 @@ void Level2ProductView::UpdateColorTable() p->savedOffset_ = offset; p->savedScale_ = scale; - Q_EMIT ColorTableUpdated(); + Q_EMIT ColorTableLutUpdated(); } void Level2ProductView::ComputeSweep() @@ -702,7 +702,7 @@ void Level2ProductView::ComputeSweep() timer.stop(); logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); - UpdateColorTable(); + UpdateColorTableLut(); Q_EMIT SweepComputed(); } diff --git a/scwx-qt/source/scwx/qt/view/level2_product_view.hpp b/scwx-qt/source/scwx/qt/view/level2_product_view.hpp index 1e23f5fd..09a441c1 100644 --- a/scwx-qt/source/scwx/qt/view/level2_product_view.hpp +++ b/scwx-qt/source/scwx/qt/view/level2_product_view.hpp @@ -27,7 +27,8 @@ public: std::shared_ptr radarProductManager); ~Level2ProductView(); - const std::vector& color_table() const override; + const std::vector& + color_table_lut() const override; std::uint16_t color_table_min() const override; std::uint16_t color_table_max() const override; float elevation() const override; @@ -63,7 +64,7 @@ protected: void ConnectRadarProductManager() override; void DisconnectRadarProductManager() override; - void UpdateColorTable() override; + void UpdateColorTableLut() override; protected slots: void ComputeSweep() override; diff --git a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp index 7a5204c8..efb7b15b 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp @@ -97,11 +97,11 @@ void Level3ProductView::DisconnectRadarProductManager() } const std::vector& -Level3ProductView::color_table() const +Level3ProductView::color_table_lut() const { if (p->colorTableLut_.size() == 0) { - return RadarProductView::color_table(); + return RadarProductView::color_table_lut(); } else { @@ -218,10 +218,10 @@ void Level3ProductView::LoadColorTable( std::shared_ptr colorTable) { p->colorTable_ = colorTable; - UpdateColorTable(); + UpdateColorTableLut(); } -void Level3ProductView::UpdateColorTable() +void Level3ProductView::UpdateColorTableLut() { logger_->debug("UpdateColorTable()"); @@ -346,7 +346,7 @@ void Level3ProductView::UpdateColorTable() p->savedOffset_ = offset; p->savedScale_ = scale; - Q_EMIT ColorTableUpdated(); + Q_EMIT ColorTableLutUpdated(); } } // namespace view diff --git a/scwx-qt/source/scwx/qt/view/level3_product_view.hpp b/scwx-qt/source/scwx/qt/view/level3_product_view.hpp index f37e44e3..4ba528dd 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.hpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.hpp @@ -25,7 +25,8 @@ public: std::shared_ptr radarProductManager); virtual ~Level3ProductView(); - const std::vector& color_table() const override; + const std::vector& + color_table_lut() const override; std::uint16_t color_table_min() const override; std::uint16_t color_table_max() const override; @@ -47,7 +48,7 @@ protected: void ConnectRadarProductManager() override; void DisconnectRadarProductManager() override; - void UpdateColorTable() override; + void UpdateColorTableLut() override; private: class Impl; diff --git a/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp b/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp index 964f2d8e..1c0d5912 100644 --- a/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_radial_view.cpp @@ -423,7 +423,7 @@ void Level3RadialView::ComputeSweep() timer.stop(); logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); - UpdateColorTable(); + UpdateColorTableLut(); Q_EMIT SweepComputed(); } diff --git a/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp b/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp index 11c2d2ac..77d431a8 100644 --- a/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_raster_view.cpp @@ -347,7 +347,7 @@ void Level3RasterView::ComputeSweep() timer.stop(); logger_->debug("Vertices calculated in {}", timer.format(6, "%ws")); - UpdateColorTable(); + UpdateColorTableLut(); Q_EMIT SweepComputed(); } diff --git a/scwx-qt/source/scwx/qt/view/radar_product_view.cpp b/scwx-qt/source/scwx/qt/view/radar_product_view.cpp index a47cbd70..3a7dac1c 100644 --- a/scwx-qt/source/scwx/qt/view/radar_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/radar_product_view.cpp @@ -51,7 +51,7 @@ RadarProductView::RadarProductView( RadarProductView::~RadarProductView() = default; const std::vector& -RadarProductView::color_table() const +RadarProductView::color_table_lut() const { return kDefaultColorTable_; } diff --git a/scwx-qt/source/scwx/qt/view/radar_product_view.hpp b/scwx-qt/source/scwx/qt/view/radar_product_view.hpp index 4348591a..f204429e 100644 --- a/scwx-qt/source/scwx/qt/view/radar_product_view.hpp +++ b/scwx-qt/source/scwx/qt/view/radar_product_view.hpp @@ -34,7 +34,8 @@ public: std::shared_ptr radarProductManager); virtual ~RadarProductView(); - virtual const std::vector& color_table() const; + virtual const std::vector& + color_table_lut() const; virtual std::uint16_t color_table_min() const; virtual std::uint16_t color_table_max() const; virtual float elevation() const; @@ -84,13 +85,13 @@ protected: virtual void ConnectRadarProductManager() = 0; virtual void DisconnectRadarProductManager() = 0; - virtual void UpdateColorTable() = 0; + virtual void UpdateColorTableLut() = 0; protected slots: virtual void ComputeSweep(); signals: - void ColorTableUpdated(); + void ColorTableLutUpdated(); void SweepComputed(); void SweepNotComputed(types::NoUpdateReason reason);