mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:50:05 +00:00
switch level2 incoming elevation to optional
This commit is contained in:
parent
f481d57ed1
commit
e10ebdeb5e
9 changed files with 41 additions and 32 deletions
|
|
@ -967,7 +967,8 @@ void MainWindowImpl::ConnectMapSignals()
|
|||
mapWidget,
|
||||
&map::MapWidget::IncomingLevel2ElevationChanged,
|
||||
this,
|
||||
[this](float) { level2SettingsWidget_->UpdateSettings(activeMap_); },
|
||||
[this](std::optional<float>)
|
||||
{ level2SettingsWidget_->UpdateSettings(activeMap_); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,8 +272,7 @@ public:
|
|||
common::Level3ProductCategoryMap availableCategoryMap_ {};
|
||||
std::shared_mutex availableCategoryMutex_ {};
|
||||
|
||||
float incomingLevel2Elevation_ {
|
||||
provider::AwsLevel2ChunksDataProvider::INVALID_ELEVATION};
|
||||
std::optional<float> incomingLevel2Elevation_ {};
|
||||
|
||||
std::unordered_map<boost::uuids::uuid,
|
||||
std::shared_ptr<ProviderManager>,
|
||||
|
|
@ -454,7 +453,7 @@ float RadarProductManager::gate_size() const
|
|||
return (is_tdwr()) ? 150.0f : 250.0f;
|
||||
}
|
||||
|
||||
float RadarProductManager::incoming_level_2_elevation() const
|
||||
std::optional<float> RadarProductManager::incoming_level_2_elevation() const
|
||||
{
|
||||
return p->incomingLevel2Elevation_;
|
||||
}
|
||||
|
|
@ -1552,7 +1551,7 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
|||
scwx::util::TimePoint(radarData0->modified_julian_date(),
|
||||
radarData0->collection_time()));
|
||||
|
||||
const float incomingElevation =
|
||||
const std::optional<float> incomingElevation =
|
||||
std::dynamic_pointer_cast<provider::AwsLevel2ChunksDataProvider>(
|
||||
p->level2ChunksProviderManager_->provider_)
|
||||
->GetCurrentElevation();
|
||||
|
|
@ -1597,14 +1596,11 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
|||
elevationCuts = std::move(recordElevationCuts);
|
||||
foundTime = collectionTime;
|
||||
|
||||
if (p->incomingLevel2Elevation_ !=
|
||||
provider::AwsLevel2ChunksDataProvider::INVALID_ELEVATION)
|
||||
if (!p->incomingLevel2Elevation_.has_value())
|
||||
{
|
||||
p->incomingLevel2Elevation_ = provider::
|
||||
AwsLevel2ChunksDataProvider::INVALID_ELEVATION;
|
||||
p->incomingLevel2Elevation_ = {};
|
||||
Q_EMIT IncomingLevel2ElevationChanged(
|
||||
provider::AwsLevel2ChunksDataProvider::
|
||||
INVALID_ELEVATION);
|
||||
p->incomingLevel2Elevation_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ public:
|
|||
coordinates(common::RadialSize radialSize, bool smoothingEnabled) const;
|
||||
[[nodiscard]] const scwx::util::time_zone* default_time_zone() const;
|
||||
[[nodiscard]] float gate_size() const;
|
||||
[[nodiscard]] float incoming_level_2_elevation() const;
|
||||
[[nodiscard]] bool is_tdwr() const;
|
||||
[[nodiscard]] std::string radar_id() const;
|
||||
[[nodiscard]] std::optional<float> incoming_level_2_elevation() const;
|
||||
[[nodiscard]] bool is_tdwr() const;
|
||||
[[nodiscard]] std::string radar_id() const;
|
||||
[[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const;
|
||||
|
||||
void Initialize();
|
||||
|
|
@ -149,7 +149,7 @@ signals:
|
|||
void NewDataAvailable(common::RadarProductGroup group,
|
||||
const std::string& product,
|
||||
std::chrono::system_clock::time_point latestTime);
|
||||
void IncomingLevel2ElevationChanged(float incomingElevation);
|
||||
void IncomingLevel2ElevationChanged(std::optional<float> incomingElevation);
|
||||
|
||||
private:
|
||||
std::unique_ptr<RadarProductManagerImpl> p;
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ std::vector<float> MapWidget::GetElevationCuts() const
|
|||
}
|
||||
}
|
||||
|
||||
float MapWidget::GetIncomingLevel2Elevation() const
|
||||
std::optional<float> MapWidget::GetIncomingLevel2Elevation() const
|
||||
{
|
||||
return p->radarProductManager_->incoming_level_2_elevation();
|
||||
}
|
||||
|
|
@ -1804,7 +1804,7 @@ void MapWidgetImpl::RadarProductManagerConnect()
|
|||
connect(radarProductManager_.get(),
|
||||
&manager::RadarProductManager::IncomingLevel2ElevationChanged,
|
||||
this,
|
||||
[this](float incomingElevation)
|
||||
[this](std::optional<float> incomingElevation)
|
||||
{
|
||||
Q_EMIT widget_->IncomingLevel2ElevationChanged(
|
||||
incomingElevation);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
GetAvailableLevel3Categories();
|
||||
[[nodiscard]] std::optional<float> GetElevation() const;
|
||||
[[nodiscard]] std::vector<float> GetElevationCuts() const;
|
||||
[[nodiscard]] float GetIncomingLevel2Elevation() const;
|
||||
[[nodiscard]] std::optional<float> GetIncomingLevel2Elevation() const;
|
||||
[[nodiscard]] std::vector<std::string> GetLevel3Products();
|
||||
[[nodiscard]] std::string GetMapStyle() const;
|
||||
[[nodiscard]] common::RadarProductGroup GetRadarProductGroup() const;
|
||||
|
|
@ -185,7 +185,7 @@ signals:
|
|||
void RadarSweepUpdated();
|
||||
void RadarSweepNotUpdated(types::NoUpdateReason reason);
|
||||
void WidgetPainted();
|
||||
void IncomingLevel2ElevationChanged(float incomingElevation);
|
||||
void IncomingLevel2ElevationChanged(std::optional<float> incomingElevation);
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
|
|
|
|||
|
|
@ -242,11 +242,19 @@ void Level2SettingsWidget::UpdateElevationSelection(float elevation)
|
|||
p->currentElevationButton_ = newElevationButton;
|
||||
}
|
||||
|
||||
void Level2SettingsWidget::UpdateIncomingElevation(float incomingElevation)
|
||||
void Level2SettingsWidget::UpdateIncomingElevation(
|
||||
std::optional<float> incomingElevation)
|
||||
{
|
||||
p->incomingElevationLabel_->setText(
|
||||
"Incoming Elevation: " + QString::number(incomingElevation, 'f', 1) +
|
||||
common::Characters::DEGREE);
|
||||
if (incomingElevation.has_value())
|
||||
{
|
||||
p->incomingElevationLabel_->setText(
|
||||
"Incoming Elevation: " + QString::number(*incomingElevation, 'f', 1) +
|
||||
common::Characters::DEGREE);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->incomingElevationLabel_->setText("Incoming Elevation: None");
|
||||
}
|
||||
}
|
||||
|
||||
void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap)
|
||||
|
|
@ -254,8 +262,9 @@ void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap)
|
|||
std::optional<float> currentElevationOption = activeMap->GetElevation();
|
||||
const float currentElevation =
|
||||
currentElevationOption.has_value() ? *currentElevationOption : 0.0f;
|
||||
const std::vector<float> elevationCuts = activeMap->GetElevationCuts();
|
||||
const float incomingElevation = activeMap->GetIncomingLevel2Elevation();
|
||||
const std::vector<float> elevationCuts = activeMap->GetElevationCuts();
|
||||
const std::optional<float> incomingElevation =
|
||||
activeMap->GetIncomingLevel2Elevation();
|
||||
|
||||
if (p->elevationCuts_ != elevationCuts)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <scwx/qt/map/map_widget.hpp>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
|
|
@ -23,7 +25,7 @@ public:
|
|||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
void UpdateElevationSelection(float elevation);
|
||||
void UpdateIncomingElevation(float incomingElevation);
|
||||
void UpdateIncomingElevation(std::optional<float> incomingElevation);
|
||||
void UpdateSettings(map::MapWidget* activeMap);
|
||||
|
||||
signals:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue