mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:00:05 +00:00
Refactor color table functions to reference the lookup table where appropriate
This commit is contained in:
parent
c1280c05aa
commit
03f08d54f1
11 changed files with 30 additions and 29 deletions
|
|
@ -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_);
|
||||
|
|
|
|||
|
|
@ -182,8 +182,6 @@ public:
|
|||
manager::PlacefileManager::Instance()};
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||
|
||||
std::shared_ptr<common::ColorTable> colorTable_;
|
||||
|
||||
std::shared_ptr<RadarProductLayer> radarProductLayer_;
|
||||
std::shared_ptr<AlertLayer> alertLayer_;
|
||||
std::shared_ptr<OverlayLayer> 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(),
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ RadarProductLayer::RadarProductLayer(std::shared_ptr<MapContext> 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<boost::gil::rgba8_pixel_t>& colorTable =
|
||||
radarProductView->color_table();
|
||||
radarProductView->color_table_lut();
|
||||
const uint16_t rangeMin = radarProductView->color_table_min();
|
||||
const uint16_t rangeMax = radarProductView->color_table_max();
|
||||
|
||||
|
|
|
|||
|
|
@ -164,11 +164,11 @@ boost::asio::thread_pool& Level2ProductView::thread_pool()
|
|||
}
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
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<common::ColorTable> 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ public:
|
|||
std::shared_ptr<manager::RadarProductManager> radarProductManager);
|
||||
~Level2ProductView();
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>& color_table() const override;
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ void Level3ProductView::DisconnectRadarProductManager()
|
|||
}
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
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<common::ColorTable> 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
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ public:
|
|||
std::shared_ptr<manager::RadarProductManager> radarProductManager);
|
||||
virtual ~Level3ProductView();
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>& color_table() const override;
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ void Level3RadialView::ComputeSweep()
|
|||
timer.stop();
|
||||
logger_->debug("Vertices calculated in {}", timer.format(6, "%ws"));
|
||||
|
||||
UpdateColorTable();
|
||||
UpdateColorTableLut();
|
||||
|
||||
Q_EMIT SweepComputed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ void Level3RasterView::ComputeSweep()
|
|||
timer.stop();
|
||||
logger_->debug("Vertices calculated in {}", timer.format(6, "%ws"));
|
||||
|
||||
UpdateColorTable();
|
||||
UpdateColorTableLut();
|
||||
|
||||
Q_EMIT SweepComputed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ RadarProductView::RadarProductView(
|
|||
RadarProductView::~RadarProductView() = default;
|
||||
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
RadarProductView::color_table() const
|
||||
RadarProductView::color_table_lut() const
|
||||
{
|
||||
return kDefaultColorTable_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ public:
|
|||
std::shared_ptr<manager::RadarProductManager> radarProductManager);
|
||||
virtual ~RadarProductView();
|
||||
|
||||
virtual const std::vector<boost::gil::rgba8_pixel_t>& color_table() const;
|
||||
virtual const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue