mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:30:06 +00:00
Check selected product and elevation
This commit is contained in:
parent
1aa9a9c0f0
commit
22efc9b9f1
2 changed files with 56 additions and 27 deletions
|
|
@ -34,7 +34,9 @@ public:
|
||||||
~MainWindowImpl() = default;
|
~MainWindowImpl() = default;
|
||||||
|
|
||||||
void InitializeConnections();
|
void InitializeConnections();
|
||||||
|
void SelectElevation(map::MapWidget* mapWidget, float elevation);
|
||||||
void SelectRadarProduct(common::Level2Product product);
|
void SelectRadarProduct(common::Level2Product product);
|
||||||
|
void UpdateElevationSelection(float elevation);
|
||||||
void UpdateRadarProductSettings(map::MapWidget* mapWidget);
|
void UpdateRadarProductSettings(map::MapWidget* mapWidget);
|
||||||
|
|
||||||
MainWindow* mainWindow_;
|
MainWindow* mainWindow_;
|
||||||
|
|
@ -86,6 +88,8 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||||
ui->declutterCheckbox->setVisible(false);
|
ui->declutterCheckbox->setVisible(false);
|
||||||
|
|
||||||
p->InitializeConnections();
|
p->InitializeConnections();
|
||||||
|
|
||||||
|
p->SelectRadarProduct(common::Level2Product::Reflectivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|
@ -163,6 +167,12 @@ void MainWindowImpl::InitializeConnections()
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindowImpl::SelectElevation(map::MapWidget* mapWidget, float elevation)
|
||||||
|
{
|
||||||
|
mapWidget->SelectElevation(elevation);
|
||||||
|
UpdateElevationSelection(elevation);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindowImpl::SelectRadarProduct(common::Level2Product product)
|
void MainWindowImpl::SelectRadarProduct(common::Level2Product product)
|
||||||
{
|
{
|
||||||
const std::string& productName = common::GetLevel2Name(product);
|
const std::string& productName = common::GetLevel2Name(product);
|
||||||
|
|
@ -188,16 +198,34 @@ void MainWindowImpl::SelectRadarProduct(common::Level2Product product)
|
||||||
map_->SelectRadarProduct(product);
|
map_->SelectRadarProduct(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindowImpl::UpdateElevationSelection(float elevation)
|
||||||
|
{
|
||||||
|
QString buttonText {QString::number(elevation, 'f', 1) +
|
||||||
|
common::Characters::DEGREE};
|
||||||
|
|
||||||
|
for (QToolButton* toolButton :
|
||||||
|
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
|
{
|
||||||
|
if (toolButton->text() == buttonText)
|
||||||
|
{
|
||||||
|
toolButton->setCheckable(true);
|
||||||
|
toolButton->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolButton->setChecked(false);
|
||||||
|
toolButton->setCheckable(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
||||||
{
|
{
|
||||||
float currentElevation = mapWidget->GetElevation();
|
float currentElevation = mapWidget->GetElevation();
|
||||||
std::vector<float> elevationCuts = mapWidget->GetElevationCuts();
|
std::vector<float> elevationCuts = mapWidget->GetElevationCuts();
|
||||||
|
|
||||||
if (elevationCuts_ == elevationCuts)
|
if (elevationCuts_ != elevationCuts)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (QToolButton* toolButton :
|
for (QToolButton* toolButton :
|
||||||
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
mainWindow_->ui->elevationGroupBox->findChildren<QToolButton*>())
|
||||||
{
|
{
|
||||||
|
|
@ -215,7 +243,7 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
||||||
layout->addWidget(toolButton);
|
layout->addWidget(toolButton);
|
||||||
|
|
||||||
connect(toolButton, &QToolButton::clicked, this, [=]() {
|
connect(toolButton, &QToolButton::clicked, this, [=]() {
|
||||||
mapWidget->SelectElevation(elevationCut);
|
SelectElevation(mapWidget, elevationCut);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,6 +251,9 @@ void MainWindowImpl::UpdateRadarProductSettings(map::MapWidget* mapWidget)
|
||||||
resizeElevationButtons_ = true;
|
resizeElevationButtons_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateElevationSelection(currentElevation);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace main
|
} // namespace main
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,6 @@ MapWidget::MapWidget(const QMapboxGLSettings& settings) :
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
p->radarProductManager_->Initialize();
|
p->radarProductManager_->Initialize();
|
||||||
|
|
||||||
SelectRadarProduct(common::Level2Product::Reflectivity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MapWidget::~MapWidget()
|
MapWidget::~MapWidget()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue