mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Select level 3 radar products
This commit is contained in:
parent
ab83b50e0a
commit
732a7e233c
4 changed files with 74 additions and 13 deletions
|
|
@ -252,10 +252,7 @@ void MainWindow::on_actionOpen_triggered()
|
||||||
|
|
||||||
if (record != nullptr)
|
if (record != nullptr)
|
||||||
{
|
{
|
||||||
currentMap->SelectRadarProduct(record->radar_id(),
|
currentMap->SelectRadarProduct(record);
|
||||||
record->radar_product_group(),
|
|
||||||
record->radar_product(),
|
|
||||||
record->time());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -293,11 +293,22 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::SelectRadarProduct(const std::string& radarId,
|
void MapWidget::SelectRadarProduct(
|
||||||
common::RadarProductGroup group,
|
std::shared_ptr<types::RadarProductRecord> record)
|
||||||
const std::string& product,
|
|
||||||
std::chrono::system_clock::time_point time)
|
|
||||||
{
|
{
|
||||||
|
const std::string radarId = record->radar_id();
|
||||||
|
common::RadarProductGroup group = record->radar_product_group();
|
||||||
|
const std::string product = record->radar_product();
|
||||||
|
std::chrono::system_clock::time_point time = record->time();
|
||||||
|
|
||||||
|
int16_t productCode = 0;
|
||||||
|
|
||||||
|
std::shared_ptr<wsr88d::Level3File> level3File = record->level3_file();
|
||||||
|
if (level3File != nullptr && level3File->message() != nullptr)
|
||||||
|
{
|
||||||
|
productCode = level3File->message()->header().message_code();
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug)
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
<< logPrefix_ << "SelectRadarProduct(" << radarId << ", "
|
<< logPrefix_ << "SelectRadarProduct(" << radarId << ", "
|
||||||
<< common::GetRadarProductGroupName(group) << ", " << product << ", "
|
<< common::GetRadarProductGroupName(group) << ", " << product << ", "
|
||||||
|
|
@ -313,6 +324,61 @@ void MapWidget::SelectRadarProduct(const std::string& radarId,
|
||||||
|
|
||||||
SelectRadarProduct(level2Product);
|
SelectRadarProduct(level2Product);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: Combine this with the SelectRadarProduct(Level2Product) function
|
||||||
|
std::shared_ptr<view::RadarProductView>& radarProductView =
|
||||||
|
p->context_->radarProductView_;
|
||||||
|
|
||||||
|
radarProductView = view::RadarProductViewFactory::Create(
|
||||||
|
group, product, 0.0f, p->radarProductManager_);
|
||||||
|
radarProductView->SelectTime(p->selectedTime_);
|
||||||
|
|
||||||
|
connect(
|
||||||
|
radarProductView.get(),
|
||||||
|
&view::RadarProductView::ColorTableUpdated,
|
||||||
|
this,
|
||||||
|
[&]() { update(); },
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(
|
||||||
|
radarProductView.get(),
|
||||||
|
&view::RadarProductView::SweepComputed,
|
||||||
|
this,
|
||||||
|
[&]()
|
||||||
|
{
|
||||||
|
std::shared_ptr<config::RadarSite> radarSite =
|
||||||
|
p->radarProductManager_->radar_site();
|
||||||
|
|
||||||
|
RadarRangeLayer::Update(
|
||||||
|
p->map_,
|
||||||
|
radarProductView->range(),
|
||||||
|
{radarSite->latitude(), radarSite->longitude()});
|
||||||
|
update();
|
||||||
|
emit RadarSweepUpdated();
|
||||||
|
},
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
util::async(
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidget::SetActive(bool isActive)
|
void MapWidget::SetActive(bool isActive)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/common/products.hpp>
|
#include <scwx/common/products.hpp>
|
||||||
|
#include <scwx/qt/types/radar_product_record.hpp>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
@ -40,10 +41,7 @@ public:
|
||||||
|
|
||||||
void SelectElevation(float elevation);
|
void SelectElevation(float elevation);
|
||||||
void SelectRadarProduct(common::Level2Product product);
|
void SelectRadarProduct(common::Level2Product product);
|
||||||
void SelectRadarProduct(const std::string& radarId,
|
void SelectRadarProduct(std::shared_ptr<types::RadarProductRecord> record);
|
||||||
common::RadarProductGroup group,
|
|
||||||
const std::string& product,
|
|
||||||
std::chrono::system_clock::time_point time);
|
|
||||||
void SetActive(bool isActive);
|
void SetActive(bool isActive);
|
||||||
void SetMapParameters(double latitude,
|
void SetMapParameters(double latitude,
|
||||||
double longitude,
|
double longitude,
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>scwx::qt::main::MainWindow</name>
|
<name>scwx::qt::main::MainWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../source/scwx/qt/main/main_window.cpp" line="265"/>
|
<location filename="../source/scwx/qt/main/main_window.cpp" line="262"/>
|
||||||
<source>Unrecognized NEXRAD Product:</source>
|
<source>Unrecognized NEXRAD Product:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue