Map widget time selection

This commit is contained in:
Dan Paulat 2023-05-24 00:02:00 -05:00
parent f6de4d0742
commit 63a746d25f
2 changed files with 27 additions and 5 deletions

View file

@ -63,7 +63,6 @@ public:
colorTableLayer_ {nullptr},
autoRefreshEnabled_ {true},
selectedLevel2Product_ {common::Level2Product::Unknown},
selectedTime_ {},
lastPos_(),
currentStyleIndex_ {0},
currentStyle_ {nullptr},
@ -149,7 +148,6 @@ public:
bool autoRefreshEnabled_;
common::Level2Product selectedLevel2Product_;
std::chrono::system_clock::time_point selectedTime_;
QPointF lastPos_;
std::size_t currentStyleIndex_;
@ -434,9 +432,8 @@ void MapWidget::SelectRadarProduct(
scwx::util::TimeString(time));
p->SetRadarSite(radarId);
p->selectedTime_ = time;
SelectRadarProduct(group, product, productCode);
SelectRadarProduct(group, product, productCode, time);
}
void MapWidget::SelectRadarSite(const std::string& id, bool updateCoordinates)
@ -478,6 +475,23 @@ void MapWidget::SelectRadarSite(std::shared_ptr<config::RadarSite> radarSite,
AddLayers();
// TODO: Disable refresh from old site
emit RadarSiteUpdated(radarSite);
}
}
void MapWidget::SelectTime(std::chrono::system_clock::time_point time)
{
auto radarProductView = p->context_->radar_product_view();
// If there is an active radar product view
if (radarProductView != nullptr)
{
// Select the time associated with the active radar product
radarProductView->SelectTime(time);
// Trigger an update of the radar product view
radarProductView->Update();
}
}

View file

@ -80,6 +80,13 @@ public:
void SelectRadarSite(std::shared_ptr<config::RadarSite> radarSite,
bool updateCoordinates = true);
/**
* @brief Selects the time associated with the active radar product.
*
* @param [in] time Product time
*/
void SelectTime(std::chrono::system_clock::time_point time);
void SetActive(bool isActive);
void SetAutoRefresh(bool enabled);
@ -132,6 +139,7 @@ signals:
double bearing,
double pitch);
void MapStyleChanged(const std::string& styleName);
void RadarSiteUpdated(std::shared_ptr<config::RadarSite> radarSite);
void RadarSweepUpdated();
};