Selectable elevation cuts

This commit is contained in:
Dan Paulat 2021-11-14 22:41:25 -06:00
parent 19f1207384
commit e76ac3bc36
15 changed files with 230 additions and 51 deletions

View file

@ -88,23 +88,33 @@ MapWidget::~MapWidget()
makeCurrent();
}
float MapWidget::GetElevation() const
{
return p->radarProductView_->elevation();
}
std::vector<float> MapWidget::GetElevationCuts() const
{
return p->radarProductView_->GetElevationCuts();
}
void MapWidget::SelectElevation(float elevation)
{
p->radarProductView_->SelectElevation(elevation);
}
void MapWidget::SelectRadarProduct(common::Level2Product product)
{
p->radarProductView_ =
view::RadarProductViewFactory::Create(product, p->radarProductManager_);
float currentElevation = 0.0f;
p->radarProductView_->Initialize();
std::string colorTableFile =
manager::SettingsManager::palette_settings()->palette(
common::GetLevel2Palette(product));
if (!colorTableFile.empty())
if (p->radarProductView_ != nullptr)
{
std::shared_ptr<common::ColorTable> colorTable =
common::ColorTable::Load(colorTableFile);
p->radarProductView_->LoadColorTable(colorTable);
currentElevation = p->radarProductView_->elevation();
}
p->radarProductView_ = view::RadarProductViewFactory::Create(
product, currentElevation, p->radarProductManager_);
connect(
p->radarProductView_.get(),
&view::RadarProductView::ColorTableUpdated,
@ -118,9 +128,22 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
[&]() {
RadarRangeLayer::Update(p->map_, p->radarProductView_->range());
update();
emit RadarSweepUpdated();
},
Qt::QueuedConnection);
p->radarProductView_->Initialize();
std::string colorTableFile =
manager::SettingsManager::palette_settings()->palette(
common::GetLevel2Palette(product));
if (!colorTableFile.empty())
{
std::shared_ptr<common::ColorTable> colorTable =
common::ColorTable::Load(colorTableFile);
p->radarProductView_->LoadColorTable(colorTable);
}
if (p->map_ != nullptr)
{
AddLayers();

View file

@ -31,7 +31,10 @@ public:
explicit MapWidget(const QMapboxGLSettings&);
~MapWidget();
void SelectRadarProduct(common::Level2Product product);
float GetElevation() const;
std::vector<float> GetElevationCuts() const;
void SelectElevation(float elevation);
void SelectRadarProduct(common::Level2Product product);
private:
void changeStyle();
@ -53,6 +56,9 @@ private:
private slots:
void mapChanged(QMapboxGL::MapChange);
signals:
void RadarSweepUpdated();
};
} // namespace map