mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:00: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,
|
mapWidget,
|
||||||
&map::MapWidget::IncomingLevel2ElevationChanged,
|
&map::MapWidget::IncomingLevel2ElevationChanged,
|
||||||
this,
|
this,
|
||||||
[this](float) { level2SettingsWidget_->UpdateSettings(activeMap_); },
|
[this](std::optional<float>)
|
||||||
|
{ level2SettingsWidget_->UpdateSettings(activeMap_); },
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -272,8 +272,7 @@ public:
|
||||||
common::Level3ProductCategoryMap availableCategoryMap_ {};
|
common::Level3ProductCategoryMap availableCategoryMap_ {};
|
||||||
std::shared_mutex availableCategoryMutex_ {};
|
std::shared_mutex availableCategoryMutex_ {};
|
||||||
|
|
||||||
float incomingLevel2Elevation_ {
|
std::optional<float> incomingLevel2Elevation_ {};
|
||||||
provider::AwsLevel2ChunksDataProvider::INVALID_ELEVATION};
|
|
||||||
|
|
||||||
std::unordered_map<boost::uuids::uuid,
|
std::unordered_map<boost::uuids::uuid,
|
||||||
std::shared_ptr<ProviderManager>,
|
std::shared_ptr<ProviderManager>,
|
||||||
|
|
@ -454,7 +453,7 @@ float RadarProductManager::gate_size() const
|
||||||
return (is_tdwr()) ? 150.0f : 250.0f;
|
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_;
|
return p->incomingLevel2Elevation_;
|
||||||
}
|
}
|
||||||
|
|
@ -1552,7 +1551,7 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
||||||
scwx::util::TimePoint(radarData0->modified_julian_date(),
|
scwx::util::TimePoint(radarData0->modified_julian_date(),
|
||||||
radarData0->collection_time()));
|
radarData0->collection_time()));
|
||||||
|
|
||||||
const float incomingElevation =
|
const std::optional<float> incomingElevation =
|
||||||
std::dynamic_pointer_cast<provider::AwsLevel2ChunksDataProvider>(
|
std::dynamic_pointer_cast<provider::AwsLevel2ChunksDataProvider>(
|
||||||
p->level2ChunksProviderManager_->provider_)
|
p->level2ChunksProviderManager_->provider_)
|
||||||
->GetCurrentElevation();
|
->GetCurrentElevation();
|
||||||
|
|
@ -1597,14 +1596,11 @@ RadarProductManager::GetLevel2Data(wsr88d::rda::DataBlockType dataBlockType,
|
||||||
elevationCuts = std::move(recordElevationCuts);
|
elevationCuts = std::move(recordElevationCuts);
|
||||||
foundTime = collectionTime;
|
foundTime = collectionTime;
|
||||||
|
|
||||||
if (p->incomingLevel2Elevation_ !=
|
if (!p->incomingLevel2Elevation_.has_value())
|
||||||
provider::AwsLevel2ChunksDataProvider::INVALID_ELEVATION)
|
|
||||||
{
|
{
|
||||||
p->incomingLevel2Elevation_ = provider::
|
p->incomingLevel2Elevation_ = {};
|
||||||
AwsLevel2ChunksDataProvider::INVALID_ELEVATION;
|
|
||||||
Q_EMIT IncomingLevel2ElevationChanged(
|
Q_EMIT IncomingLevel2ElevationChanged(
|
||||||
provider::AwsLevel2ChunksDataProvider::
|
p->incomingLevel2Elevation_);
|
||||||
INVALID_ELEVATION);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ public:
|
||||||
coordinates(common::RadialSize radialSize, bool smoothingEnabled) const;
|
coordinates(common::RadialSize radialSize, bool smoothingEnabled) const;
|
||||||
[[nodiscard]] const scwx::util::time_zone* default_time_zone() const;
|
[[nodiscard]] const scwx::util::time_zone* default_time_zone() const;
|
||||||
[[nodiscard]] float gate_size() const;
|
[[nodiscard]] float gate_size() const;
|
||||||
[[nodiscard]] float incoming_level_2_elevation() const;
|
[[nodiscard]] std::optional<float> incoming_level_2_elevation() const;
|
||||||
[[nodiscard]] bool is_tdwr() const;
|
[[nodiscard]] bool is_tdwr() const;
|
||||||
[[nodiscard]] std::string radar_id() const;
|
[[nodiscard]] std::string radar_id() const;
|
||||||
[[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const;
|
[[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const;
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
@ -149,7 +149,7 @@ signals:
|
||||||
void NewDataAvailable(common::RadarProductGroup group,
|
void NewDataAvailable(common::RadarProductGroup group,
|
||||||
const std::string& product,
|
const std::string& product,
|
||||||
std::chrono::system_clock::time_point latestTime);
|
std::chrono::system_clock::time_point latestTime);
|
||||||
void IncomingLevel2ElevationChanged(float incomingElevation);
|
void IncomingLevel2ElevationChanged(std::optional<float> incomingElevation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<RadarProductManagerImpl> p;
|
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();
|
return p->radarProductManager_->incoming_level_2_elevation();
|
||||||
}
|
}
|
||||||
|
|
@ -1804,7 +1804,7 @@ void MapWidgetImpl::RadarProductManagerConnect()
|
||||||
connect(radarProductManager_.get(),
|
connect(radarProductManager_.get(),
|
||||||
&manager::RadarProductManager::IncomingLevel2ElevationChanged,
|
&manager::RadarProductManager::IncomingLevel2ElevationChanged,
|
||||||
this,
|
this,
|
||||||
[this](float incomingElevation)
|
[this](std::optional<float> incomingElevation)
|
||||||
{
|
{
|
||||||
Q_EMIT widget_->IncomingLevel2ElevationChanged(
|
Q_EMIT widget_->IncomingLevel2ElevationChanged(
|
||||||
incomingElevation);
|
incomingElevation);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
GetAvailableLevel3Categories();
|
GetAvailableLevel3Categories();
|
||||||
[[nodiscard]] std::optional<float> GetElevation() const;
|
[[nodiscard]] std::optional<float> GetElevation() const;
|
||||||
[[nodiscard]] std::vector<float> GetElevationCuts() 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::vector<std::string> GetLevel3Products();
|
||||||
[[nodiscard]] std::string GetMapStyle() const;
|
[[nodiscard]] std::string GetMapStyle() const;
|
||||||
[[nodiscard]] common::RadarProductGroup GetRadarProductGroup() const;
|
[[nodiscard]] common::RadarProductGroup GetRadarProductGroup() const;
|
||||||
|
|
@ -185,7 +185,7 @@ signals:
|
||||||
void RadarSweepUpdated();
|
void RadarSweepUpdated();
|
||||||
void RadarSweepNotUpdated(types::NoUpdateReason reason);
|
void RadarSweepNotUpdated(types::NoUpdateReason reason);
|
||||||
void WidgetPainted();
|
void WidgetPainted();
|
||||||
void IncomingLevel2ElevationChanged(float incomingElevation);
|
void IncomingLevel2ElevationChanged(std::optional<float> incomingElevation);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace map
|
} // namespace map
|
||||||
|
|
|
||||||
|
|
@ -242,11 +242,19 @@ void Level2SettingsWidget::UpdateElevationSelection(float elevation)
|
||||||
p->currentElevationButton_ = newElevationButton;
|
p->currentElevationButton_ = newElevationButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level2SettingsWidget::UpdateIncomingElevation(float incomingElevation)
|
void Level2SettingsWidget::UpdateIncomingElevation(
|
||||||
|
std::optional<float> incomingElevation)
|
||||||
{
|
{
|
||||||
p->incomingElevationLabel_->setText(
|
if (incomingElevation.has_value())
|
||||||
"Incoming Elevation: " + QString::number(incomingElevation, 'f', 1) +
|
{
|
||||||
common::Characters::DEGREE);
|
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)
|
void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap)
|
||||||
|
|
@ -254,8 +262,9 @@ void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap)
|
||||||
std::optional<float> currentElevationOption = activeMap->GetElevation();
|
std::optional<float> currentElevationOption = activeMap->GetElevation();
|
||||||
const float currentElevation =
|
const float currentElevation =
|
||||||
currentElevationOption.has_value() ? *currentElevationOption : 0.0f;
|
currentElevationOption.has_value() ? *currentElevationOption : 0.0f;
|
||||||
const std::vector<float> elevationCuts = activeMap->GetElevationCuts();
|
const std::vector<float> elevationCuts = activeMap->GetElevationCuts();
|
||||||
const float incomingElevation = activeMap->GetIncomingLevel2Elevation();
|
const std::optional<float> incomingElevation =
|
||||||
|
activeMap->GetIncomingLevel2Elevation();
|
||||||
|
|
||||||
if (p->elevationCuts_ != elevationCuts)
|
if (p->elevationCuts_ != elevationCuts)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <scwx/qt/map/map_widget.hpp>
|
#include <scwx/qt/map/map_widget.hpp>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
|
|
@ -23,7 +25,7 @@ public:
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
void UpdateElevationSelection(float elevation);
|
void UpdateElevationSelection(float elevation);
|
||||||
void UpdateIncomingElevation(float incomingElevation);
|
void UpdateIncomingElevation(std::optional<float> incomingElevation);
|
||||||
void UpdateSettings(map::MapWidget* activeMap);
|
void UpdateSettings(map::MapWidget* activeMap);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <scwx/provider/nexrad_data_provider.hpp>
|
#include <scwx/provider/nexrad_data_provider.hpp>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace Aws::S3
|
namespace Aws::S3
|
||||||
{
|
{
|
||||||
class S3Client;
|
class S3Client;
|
||||||
|
|
@ -16,7 +18,6 @@ namespace scwx::provider
|
||||||
class AwsLevel2ChunksDataProvider : public NexradDataProvider
|
class AwsLevel2ChunksDataProvider : public NexradDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
constexpr static const float INVALID_ELEVATION = -90.0;
|
|
||||||
explicit AwsLevel2ChunksDataProvider(const std::string& radarSite);
|
explicit AwsLevel2ChunksDataProvider(const std::string& radarSite);
|
||||||
explicit AwsLevel2ChunksDataProvider(const std::string& radarSite,
|
explicit AwsLevel2ChunksDataProvider(const std::string& radarSite,
|
||||||
const std::string& bucketName,
|
const std::string& bucketName,
|
||||||
|
|
@ -58,7 +59,7 @@ public:
|
||||||
void RequestAvailableProducts() override;
|
void RequestAvailableProducts() override;
|
||||||
std::vector<std::string> GetAvailableProducts() override;
|
std::vector<std::string> GetAvailableProducts() override;
|
||||||
|
|
||||||
float GetCurrentElevation();
|
std::optional<float> GetCurrentElevation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
|
||||||
|
|
@ -699,12 +699,12 @@ AwsLevel2ChunksDataProvider::AwsLevel2ChunksDataProvider(
|
||||||
AwsLevel2ChunksDataProvider& AwsLevel2ChunksDataProvider::operator=(
|
AwsLevel2ChunksDataProvider& AwsLevel2ChunksDataProvider::operator=(
|
||||||
AwsLevel2ChunksDataProvider&&) noexcept = default;
|
AwsLevel2ChunksDataProvider&&) noexcept = default;
|
||||||
|
|
||||||
float AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
std::optional<float> AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
||||||
{
|
{
|
||||||
if (!p->currentScan_.valid_ || p->currentScan_.nexradFile_ == nullptr)
|
if (!p->currentScan_.valid_ || p->currentScan_.nexradFile_ == nullptr)
|
||||||
{
|
{
|
||||||
// Does not have any scan elevation. -90 is beyond what is possible
|
// Does not have any scan elevation. -90 is beyond what is possible
|
||||||
return INVALID_ELEVATION;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vcpData = p->currentScan_.nexradFile_->vcp_data();
|
auto vcpData = p->currentScan_.nexradFile_->vcp_data();
|
||||||
|
|
@ -712,7 +712,7 @@ float AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
||||||
if (radarData.size() == 0)
|
if (radarData.size() == 0)
|
||||||
{
|
{
|
||||||
// Does not have any scan elevation. -90 is beyond what is possible
|
// Does not have any scan elevation. -90 is beyond what is possible
|
||||||
return INVALID_ELEVATION;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& lastElevation = radarData.crbegin();
|
const auto& lastElevation = radarData.crbegin();
|
||||||
|
|
@ -729,7 +729,7 @@ float AwsLevel2ChunksDataProvider::GetCurrentElevation()
|
||||||
return digitalRadarData0->elevation_angle().value();
|
return digitalRadarData0->elevation_angle().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
return INVALID_ELEVATION;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace scwx::provider
|
} // namespace scwx::provider
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue