Add NoUpdateReason of NotAvailable, driven by ProductNotAvailable

This commit is contained in:
Dan Paulat 2025-08-30 18:24:50 -05:00
parent 449d8cb796
commit a306fb4363
8 changed files with 49 additions and 16 deletions

View file

@ -317,7 +317,8 @@ void TimelineManager::ReceiveRadarSweepNotUpdated(std::size_t mapIndex,
types::NoUpdateReason reason) types::NoUpdateReason reason)
{ {
if (!p->radarSweepMonitorActive_ || if (!p->radarSweepMonitorActive_ ||
reason == types::NoUpdateReason::NotLoaded) (reason == types::NoUpdateReason::NotLoaded ||
reason == types::NoUpdateReason::NotAvailable))
{ {
return; return;
} }

View file

@ -25,6 +25,7 @@ enum class NoUpdateReason
{ {
NoChange, NoChange,
NotLoaded, NotLoaded,
NotAvailable,
InvalidProduct, InvalidProduct,
InvalidData InvalidData
}; };

View file

@ -7,6 +7,7 @@ namespace scwx::qt::types
enum class RadarProductLoadStatus : std::uint8_t enum class RadarProductLoadStatus : std::uint8_t
{ {
ProductNotLoaded,
ProductLoaded, ProductLoaded,
ListingProducts, ListingProducts,
LoadingProduct, LoadingProduct,

View file

@ -548,17 +548,20 @@ void Level2ProductView::ComputeSweep()
std::shared_ptr<wsr88d::rda::ElevationScan> radarData; std::shared_ptr<wsr88d::rda::ElevationScan> radarData;
std::chrono::system_clock::time_point requestedTime {selected_time()}; std::chrono::system_clock::time_point requestedTime {selected_time()};
std::tie(radarData, types::RadarProductLoadStatus loadStatus {};
p->elevationCut_, std::tie(
p->elevationCuts_, radarData, p->elevationCut_, p->elevationCuts_, std::ignore, loadStatus) =
std::ignore,
std::ignore) =
radarProductManager->GetLevel2Data( radarProductManager->GetLevel2Data(
p->dataBlockType_, p->selectedElevation_, requestedTime); p->dataBlockType_, p->selectedElevation_, requestedTime);
set_load_status(loadStatus);
if (radarData == nullptr) if (radarData == nullptr)
{ {
Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); Q_EMIT SweepNotComputed(
loadStatus == types::RadarProductLoadStatus::ProductNotAvailable ?
types::NoUpdateReason::NotAvailable :
types::NoUpdateReason::NotLoaded);
return; return;
} }
if ((radarData == p->elevationScan_) && if ((radarData == p->elevationScan_) &&

View file

@ -136,9 +136,12 @@ void Level3RadialView::ComputeSweep()
std::shared_ptr<wsr88d::rpg::Level3Message> message; std::shared_ptr<wsr88d::rpg::Level3Message> message;
std::chrono::system_clock::time_point requestedTime {selected_time()}; std::chrono::system_clock::time_point requestedTime {selected_time()};
std::chrono::system_clock::time_point foundTime; std::chrono::system_clock::time_point foundTime;
std::tie(message, foundTime, std::ignore) = types::RadarProductLoadStatus loadStatus {};
std::tie(message, foundTime, loadStatus) =
radarProductManager->GetLevel3Data(GetRadarProductName(), requestedTime); radarProductManager->GetLevel3Data(GetRadarProductName(), requestedTime);
set_load_status(loadStatus);
// If a different time was found than what was requested, update it // If a different time was found than what was requested, update it
if (requestedTime != foundTime) if (requestedTime != foundTime)
{ {
@ -148,7 +151,10 @@ void Level3RadialView::ComputeSweep()
if (message == nullptr) if (message == nullptr)
{ {
logger_->debug("Level 3 data not found"); logger_->debug("Level 3 data not found");
Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); Q_EMIT SweepNotComputed(
loadStatus == types::RadarProductLoadStatus::ProductNotAvailable ?
types::NoUpdateReason::NotAvailable :
types::NoUpdateReason::NotLoaded);
return; return;
} }

View file

@ -121,9 +121,12 @@ void Level3RasterView::ComputeSweep()
std::shared_ptr<wsr88d::rpg::Level3Message> message; std::shared_ptr<wsr88d::rpg::Level3Message> message;
std::chrono::system_clock::time_point requestedTime {selected_time()}; std::chrono::system_clock::time_point requestedTime {selected_time()};
std::chrono::system_clock::time_point foundTime; std::chrono::system_clock::time_point foundTime;
std::tie(message, foundTime, std::ignore) = types::RadarProductLoadStatus loadStatus {};
std::tie(message, foundTime, loadStatus) =
radarProductManager->GetLevel3Data(GetRadarProductName(), requestedTime); radarProductManager->GetLevel3Data(GetRadarProductName(), requestedTime);
set_load_status(loadStatus);
// If a different time was found than what was requested, update it // If a different time was found than what was requested, update it
if (requestedTime != foundTime) if (requestedTime != foundTime)
{ {
@ -133,7 +136,10 @@ void Level3RasterView::ComputeSweep()
if (message == nullptr) if (message == nullptr)
{ {
logger_->debug("Level 3 data not found"); logger_->debug("Level 3 data not found");
Q_EMIT SweepNotComputed(types::NoUpdateReason::NotLoaded); Q_EMIT SweepNotComputed(
loadStatus == types::RadarProductLoadStatus::ProductNotAvailable ?
types::NoUpdateReason::NotAvailable :
types::NoUpdateReason::NotLoaded);
return; return;
} }

View file

@ -58,6 +58,8 @@ public:
std::chrono::system_clock::time_point selectedTime_; std::chrono::system_clock::time_point selectedTime_;
bool showSmoothedRangeFolding_ {false}; bool showSmoothedRangeFolding_ {false};
bool smoothingEnabled_ {false}; bool smoothingEnabled_ {false};
types::RadarProductLoadStatus loadStatus_ {
types::RadarProductLoadStatus::ProductNotLoaded};
std::shared_ptr<manager::RadarProductManager> radarProductManager_; std::shared_ptr<manager::RadarProductManager> radarProductManager_;
@ -90,6 +92,11 @@ std::optional<float> RadarProductView::elevation() const
return {}; return {};
} }
types::RadarProductLoadStatus RadarProductView::load_status() const
{
return p->loadStatus_;
}
std::shared_ptr<manager::RadarProductManager> std::shared_ptr<manager::RadarProductManager>
RadarProductView::radar_product_manager() const RadarProductView::radar_product_manager() const
{ {
@ -126,6 +133,11 @@ std::mutex& RadarProductView::sweep_mutex()
return p->sweepMutex_; return p->sweepMutex_;
} }
void RadarProductView::set_load_status(types::RadarProductLoadStatus loadStatus)
{
p->loadStatus_ = loadStatus;
}
void RadarProductView::set_radar_product_manager( void RadarProductView::set_radar_product_manager(
std::shared_ptr<manager::RadarProductManager> radarProductManager) std::shared_ptr<manager::RadarProductManager> radarProductManager)
{ {

View file

@ -42,6 +42,7 @@ public:
[[nodiscard]] virtual std::uint16_t color_table_min() const; [[nodiscard]] virtual std::uint16_t color_table_min() const;
[[nodiscard]] virtual std::uint16_t color_table_max() const; [[nodiscard]] virtual std::uint16_t color_table_max() const;
[[nodiscard]] virtual std::optional<float> elevation() const; [[nodiscard]] virtual std::optional<float> elevation() const;
[[nodiscard]] types::RadarProductLoadStatus load_status() const;
[[nodiscard]] virtual float range() const; [[nodiscard]] virtual float range() const;
[[nodiscard]] virtual std::chrono::system_clock::time_point [[nodiscard]] virtual std::chrono::system_clock::time_point
sweep_time() const; sweep_time() const;
@ -98,6 +99,8 @@ protected:
virtual void DisconnectRadarProductManager() = 0; virtual void DisconnectRadarProductManager() = 0;
virtual void UpdateColorTableLut() = 0; virtual void UpdateColorTableLut() = 0;
void set_load_status(types::RadarProductLoadStatus loadStatus);
protected slots: protected slots:
virtual void ComputeSweep(); virtual void ComputeSweep();