mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 15:50:05 +00:00
Smooth transition between level 3 tilts
This commit is contained in:
parent
690f60f3e3
commit
889fe698e6
8 changed files with 53 additions and 23 deletions
|
|
@ -301,7 +301,9 @@ void MapWidget::SelectRadarProduct(common::RadarProductGroup group,
|
|||
|
||||
if (radarProductView == nullptr ||
|
||||
radarProductView->GetRadarProductGroup() != group ||
|
||||
radarProductView->GetRadarProductName() != productName ||
|
||||
(radarProductView->GetRadarProductGroup() ==
|
||||
common::RadarProductGroup::Level2 &&
|
||||
radarProductView->GetRadarProductName() != productName) ||
|
||||
p->context_->radarProductCode_ != productCode)
|
||||
{
|
||||
p->RadarProductViewDisconnect();
|
||||
|
|
@ -313,6 +315,10 @@ void MapWidget::SelectRadarProduct(common::RadarProductGroup group,
|
|||
|
||||
radarProductViewCreated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
radarProductView->SelectProduct(productName);
|
||||
}
|
||||
|
||||
p->context_->radarProductGroup_ = group;
|
||||
p->context_->radarProduct_ = productName;
|
||||
|
|
|
|||
|
|
@ -65,21 +65,13 @@ public:
|
|||
savedScale_ {0.0f},
|
||||
savedOffset_ {0.0f}
|
||||
{
|
||||
auto it = blockTypes_.find(product);
|
||||
|
||||
if (it != blockTypes_.end())
|
||||
{
|
||||
dataBlockType_ = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger_->warn("Unknown product: \"{}\"",
|
||||
common::GetLevel2Name(product));
|
||||
dataBlockType_ = wsr88d::rda::DataBlockType::Unknown;
|
||||
}
|
||||
SetProduct(product);
|
||||
}
|
||||
~Level2ProductViewImpl() = default;
|
||||
|
||||
void SetProduct(const std::string& productName);
|
||||
void SetProduct(common::Level2Product product);
|
||||
|
||||
common::Level2Product product_;
|
||||
wsr88d::rda::DataBlockType dataBlockType_;
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||
|
|
@ -249,11 +241,38 @@ void Level2ProductView::SelectElevation(float elevation)
|
|||
p->selectedElevation_ = elevation;
|
||||
}
|
||||
|
||||
void Level2ProductView::SelectProduct(const std::string& productName)
|
||||
{
|
||||
p->SetProduct(productName);
|
||||
}
|
||||
|
||||
void Level2ProductView::SelectTime(std::chrono::system_clock::time_point time)
|
||||
{
|
||||
p->selectedTime_ = time;
|
||||
}
|
||||
|
||||
void Level2ProductViewImpl::SetProduct(const std::string& productName)
|
||||
{
|
||||
SetProduct(common::GetLevel2Product(productName));
|
||||
}
|
||||
|
||||
void Level2ProductViewImpl::SetProduct(common::Level2Product product)
|
||||
{
|
||||
product_ = product;
|
||||
|
||||
auto it = blockTypes_.find(product);
|
||||
|
||||
if (it != blockTypes_.end())
|
||||
{
|
||||
dataBlockType_ = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
logger_->warn("Unknown product: \"{}\"", common::GetLevel2Name(product));
|
||||
dataBlockType_ = wsr88d::rda::DataBlockType::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
void Level2ProductView::Update()
|
||||
{
|
||||
util::async([=]() { ComputeSweep(); });
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
|
||||
void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) override;
|
||||
void SelectElevation(float elevation) override;
|
||||
void SelectProduct(const std::string& productName) override;
|
||||
void SelectTime(std::chrono::system_clock::time_point time) override;
|
||||
void Update() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@ std::string Level3ProductView::GetRadarProductName() const
|
|||
return p->product_;
|
||||
}
|
||||
|
||||
void Level3ProductView::SelectProduct(const std::string& productName)
|
||||
{
|
||||
p->product_ = productName;
|
||||
}
|
||||
|
||||
void Level3ProductView::LoadColorTable(
|
||||
std::shared_ptr<common::ColorTable> colorTable)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public:
|
|||
common::RadarProductGroup GetRadarProductGroup() const override;
|
||||
std::string GetRadarProductName() const override;
|
||||
|
||||
void SelectProduct(const std::string& productName) override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<wsr88d::rpg::GraphicProductMessage>
|
||||
graphic_product_message() const;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@ class Level3RadialViewImpl
|
|||
{
|
||||
public:
|
||||
explicit Level3RadialViewImpl(
|
||||
const std::string& product,
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
||||
product_ {product},
|
||||
radarProductManager_ {radarProductManager},
|
||||
selectedTime_ {},
|
||||
latitude_ {},
|
||||
|
|
@ -41,7 +39,6 @@ public:
|
|||
}
|
||||
~Level3RadialViewImpl() = default;
|
||||
|
||||
std::string product_;
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||
|
||||
std::chrono::system_clock::time_point selectedTime_;
|
||||
|
|
@ -61,7 +58,7 @@ Level3RadialView::Level3RadialView(
|
|||
const std::string& product,
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
||||
Level3ProductView(product),
|
||||
p(std::make_unique<Level3RadialViewImpl>(product, radarProductManager))
|
||||
p(std::make_unique<Level3RadialViewImpl>(radarProductManager))
|
||||
{
|
||||
}
|
||||
Level3RadialView::~Level3RadialView() = default;
|
||||
|
|
@ -114,7 +111,8 @@ void Level3RadialView::ComputeSweep()
|
|||
|
||||
// Retrieve message from Radar Product Manager
|
||||
std::shared_ptr<wsr88d::rpg::Level3Message> message =
|
||||
p->radarProductManager_->GetLevel3Data(p->product_, p->selectedTime_);
|
||||
p->radarProductManager_->GetLevel3Data(GetRadarProductName(),
|
||||
p->selectedTime_);
|
||||
if (message == nullptr)
|
||||
{
|
||||
logger_->debug("Level 3 data not found");
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@ class Level3RasterViewImpl
|
|||
{
|
||||
public:
|
||||
explicit Level3RasterViewImpl(
|
||||
const std::string& product,
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
||||
product_ {product},
|
||||
radarProductManager_ {radarProductManager},
|
||||
selectedTime_ {},
|
||||
latitude_ {},
|
||||
|
|
@ -41,7 +39,6 @@ public:
|
|||
}
|
||||
~Level3RasterViewImpl() = default;
|
||||
|
||||
std::string product_;
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager_;
|
||||
|
||||
std::chrono::system_clock::time_point selectedTime_;
|
||||
|
|
@ -61,7 +58,7 @@ Level3RasterView::Level3RasterView(
|
|||
const std::string& product,
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager) :
|
||||
Level3ProductView(product),
|
||||
p(std::make_unique<Level3RasterViewImpl>(product, radarProductManager))
|
||||
p(std::make_unique<Level3RasterViewImpl>(radarProductManager))
|
||||
{
|
||||
}
|
||||
Level3RasterView::~Level3RasterView() = default;
|
||||
|
|
@ -114,7 +111,8 @@ void Level3RasterView::ComputeSweep()
|
|||
|
||||
// Retrieve message from Radar Product Manager
|
||||
std::shared_ptr<wsr88d::rpg::Level3Message> message =
|
||||
p->radarProductManager_->GetLevel3Data(p->product_, p->selectedTime_);
|
||||
p->radarProductManager_->GetLevel3Data(GetRadarProductName(),
|
||||
p->selectedTime_);
|
||||
if (message == nullptr)
|
||||
{
|
||||
logger_->debug("Level 3 data not found");
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public:
|
|||
virtual void
|
||||
LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) = 0;
|
||||
virtual void SelectElevation(float elevation);
|
||||
virtual void SelectProduct(const std::string& productName) = 0;
|
||||
virtual void SelectTime(std::chrono::system_clock::time_point time) = 0;
|
||||
virtual void Update() = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue