mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:10:05 +00:00
Refactoring radar product view initialization
This commit is contained in:
parent
6059c3117b
commit
0b040e8b75
2 changed files with 29 additions and 40 deletions
|
|
@ -83,6 +83,7 @@ public:
|
||||||
const std::string& before = {});
|
const std::string& before = {});
|
||||||
void AutoRefreshConnect();
|
void AutoRefreshConnect();
|
||||||
void AutoRefreshDisconnect();
|
void AutoRefreshDisconnect();
|
||||||
|
void InitializeNewRadarProductView(const std::string& colorPalette);
|
||||||
void RadarProductViewConnect();
|
void RadarProductViewConnect();
|
||||||
void RadarProductViewDisconnect();
|
void RadarProductViewDisconnect();
|
||||||
void SetRadarSite(const std::string& radarSite);
|
void SetRadarSite(const std::string& radarSite);
|
||||||
|
|
@ -276,26 +277,7 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
|
||||||
|
|
||||||
if (radarProductViewCreated)
|
if (radarProductViewCreated)
|
||||||
{
|
{
|
||||||
util::async(
|
p->InitializeNewRadarProductView(common::GetLevel2Palette(product));
|
||||||
[=]()
|
|
||||||
{
|
|
||||||
std::string colorTableFile =
|
|
||||||
manager::SettingsManager::palette_settings()->palette(
|
|
||||||
common::GetLevel2Palette(product));
|
|
||||||
if (!colorTableFile.empty())
|
|
||||||
{
|
|
||||||
std::shared_ptr<common::ColorTable> colorTable =
|
|
||||||
common::ColorTable::Load(colorTableFile);
|
|
||||||
radarProductView->LoadColorTable(colorTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
radarProductView->Initialize();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (p->map_ != nullptr)
|
|
||||||
{
|
|
||||||
AddLayers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -364,26 +346,7 @@ void MapWidget::SelectRadarProduct(
|
||||||
|
|
||||||
p->RadarProductViewConnect();
|
p->RadarProductViewConnect();
|
||||||
|
|
||||||
util::async(
|
p->InitializeNewRadarProductView(common::GetLevel3Palette(productCode));
|
||||||
[=]()
|
|
||||||
{
|
|
||||||
std::string colorTableFile =
|
|
||||||
manager::SettingsManager::palette_settings()->palette(
|
|
||||||
common::GetLevel3Palette(productCode));
|
|
||||||
if (!colorTableFile.empty())
|
|
||||||
{
|
|
||||||
std::shared_ptr<common::ColorTable> colorTable =
|
|
||||||
common::ColorTable::Load(colorTableFile);
|
|
||||||
radarProductView->LoadColorTable(colorTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
radarProductView->Initialize();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (p->map_ != nullptr)
|
|
||||||
{
|
|
||||||
AddLayers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -676,6 +639,30 @@ void MapWidgetImpl::AutoRefreshDisconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapWidgetImpl::InitializeNewRadarProductView(
|
||||||
|
const std::string& colorPalette)
|
||||||
|
{
|
||||||
|
util::async(
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
std::string colorTableFile =
|
||||||
|
manager::SettingsManager::palette_settings()->palette(colorPalette);
|
||||||
|
if (!colorTableFile.empty())
|
||||||
|
{
|
||||||
|
std::shared_ptr<common::ColorTable> colorTable =
|
||||||
|
common::ColorTable::Load(colorTableFile);
|
||||||
|
context_->radarProductView_->LoadColorTable(colorTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
context_->radarProductView_->Initialize();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (map_ != nullptr)
|
||||||
|
{
|
||||||
|
widget_->AddLayers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MapWidgetImpl::RadarProductViewConnect()
|
void MapWidgetImpl::RadarProductViewConnect()
|
||||||
{
|
{
|
||||||
if (context_->radarProductView_ != nullptr)
|
if (context_->radarProductView_ != nullptr)
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,8 @@ private:
|
||||||
|
|
||||||
std::unique_ptr<MapWidgetImpl> p;
|
std::unique_ptr<MapWidgetImpl> p;
|
||||||
|
|
||||||
|
friend class MapWidgetImpl;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void mapChanged(QMapboxGL::MapChange);
|
void mapChanged(QMapboxGL::MapChange);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue