mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:30:04 +00:00
First attempt at using current radar site for alerts
This commit is contained in:
parent
dea53bddb4
commit
91eb3d3b87
3 changed files with 41 additions and 5 deletions
|
|
@ -1466,6 +1466,7 @@ void MainWindowImpl::UpdateRadarSite()
|
||||||
timelineManager_->SetRadarSite("?");
|
timelineManager_->SetRadarSite("?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alertManager_->SetRadarSite(radarSite);
|
||||||
placefileManager_->SetRadarSite(radarSite);
|
placefileManager_->SetRadarSite(radarSite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ public:
|
||||||
PositionManager::Instance()};
|
PositionManager::Instance()};
|
||||||
std::shared_ptr<TextEventManager> textEventManager_ {
|
std::shared_ptr<TextEventManager> textEventManager_ {
|
||||||
TextEventManager::Instance()};
|
TextEventManager::Instance()};
|
||||||
|
|
||||||
|
std::shared_ptr<config::RadarSite> radarSite_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
AlertManager::AlertManager() : p(std::make_unique<Impl>(this)) {}
|
AlertManager::AlertManager() : p(std::make_unique<Impl>(this)) {}
|
||||||
|
|
@ -104,11 +106,23 @@ common::Coordinate AlertManager::Impl::CurrentCoordinate(
|
||||||
}
|
}
|
||||||
else if (locationMethod == types::LocationMethod::RadarSite)
|
else if (locationMethod == types::LocationMethod::RadarSite)
|
||||||
{
|
{
|
||||||
std::string siteId =
|
std::shared_ptr<config::RadarSite> radarSite;
|
||||||
settings::GeneralSettings::Instance().default_radar_site().GetValue();
|
if (radarSite_ == nullptr)
|
||||||
auto radarSite = config::RadarSite::Get(siteId);
|
{
|
||||||
coordinate.latitude_ = radarSite->latitude();
|
std::string siteId =
|
||||||
coordinate.longitude_ = radarSite->longitude();
|
settings::GeneralSettings::Instance().default_radar_site().GetValue();
|
||||||
|
radarSite = config::RadarSite::Get(siteId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
radarSite = radarSite_;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (radarSite != nullptr)
|
||||||
|
{
|
||||||
|
coordinate.latitude_ = radarSite->latitude();
|
||||||
|
coordinate.longitude_ = radarSite->longitude();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return coordinate;
|
return coordinate;
|
||||||
|
|
@ -198,6 +212,26 @@ void AlertManager::Impl::UpdateLocationTracking(
|
||||||
positionManager_->EnablePositionUpdates(uuid_, locationEnabled);
|
positionManager_->EnablePositionUpdates(uuid_, locationEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlertManager::SetRadarSite(std::shared_ptr<config::RadarSite> radarSite)
|
||||||
|
{
|
||||||
|
if (p->radarSite_ == radarSite)
|
||||||
|
{
|
||||||
|
// No action needed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (radarSite == nullptr)
|
||||||
|
{
|
||||||
|
logger_->debug("SetRadarSite: ?");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger_->debug("SetRadarSite: {}", radarSite->id());
|
||||||
|
}
|
||||||
|
|
||||||
|
p->radarSite_ = radarSite;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<AlertManager> AlertManager::Instance()
|
std::shared_ptr<AlertManager> AlertManager::Instance()
|
||||||
{
|
{
|
||||||
static std::weak_ptr<AlertManager> alertManagerReference_ {};
|
static std::weak_ptr<AlertManager> alertManagerReference_ {};
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ public:
|
||||||
explicit AlertManager();
|
explicit AlertManager();
|
||||||
~AlertManager();
|
~AlertManager();
|
||||||
|
|
||||||
|
void AlertManager::SetRadarSite(const std::string& radarSite);
|
||||||
static std::shared_ptr<AlertManager> Instance();
|
static std::shared_ptr<AlertManager> Instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue