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