mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:30:05 +00:00
Display the selected speed units for level 2 data
This commit is contained in:
parent
a29256d77e
commit
3df6363211
8 changed files with 117 additions and 16 deletions
|
|
@ -1,4 +1,6 @@
|
|||
#include <scwx/qt/view/level2_product_view.hpp>
|
||||
#include <scwx/qt/settings/unit_settings.hpp>
|
||||
#include <scwx/qt/types/unit_types.hpp>
|
||||
#include <scwx/qt/util/geographic_lib.hpp>
|
||||
#include <scwx/common/constants.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
|
@ -68,17 +70,33 @@ public:
|
|||
savedScale_ {0.0f},
|
||||
savedOffset_ {0.0f}
|
||||
{
|
||||
auto& unitSettings = settings::UnitSettings::Instance();
|
||||
|
||||
coordinates_.resize(kMaxCoordinates_);
|
||||
|
||||
SetProduct(product);
|
||||
|
||||
speedUnitsCallbackUuid_ =
|
||||
unitSettings.speed_units().RegisterValueChangedCallback(
|
||||
[this](const std::string& value) { UpdateSpeedUnits(value); });
|
||||
|
||||
UpdateSpeedUnits(unitSettings.speed_units().GetValue());
|
||||
}
|
||||
~Level2ProductViewImpl() { threadPool_.join(); };
|
||||
~Level2ProductViewImpl()
|
||||
{
|
||||
auto& unitSettings = settings::UnitSettings::Instance();
|
||||
unitSettings.speed_units().UnregisterValueChangedCallback(
|
||||
speedUnitsCallbackUuid_);
|
||||
|
||||
threadPool_.join();
|
||||
};
|
||||
|
||||
void
|
||||
ComputeCoordinates(std::shared_ptr<wsr88d::rda::ElevationScan> radarData);
|
||||
|
||||
void SetProduct(const std::string& productName);
|
||||
void SetProduct(common::Level2Product product);
|
||||
void UpdateSpeedUnits(const std::string& name);
|
||||
|
||||
Level2ProductView* self_;
|
||||
|
||||
|
|
@ -116,6 +134,9 @@ public:
|
|||
std::shared_ptr<common::ColorTable> savedColorTable_;
|
||||
float savedScale_;
|
||||
float savedOffset_;
|
||||
|
||||
boost::uuids::uuid speedUnitsCallbackUuid_ {};
|
||||
types::SpeedUnits speedUnits_ {types::SpeedUnits::Unknown};
|
||||
};
|
||||
|
||||
Level2ProductView::Level2ProductView(
|
||||
|
|
@ -221,6 +242,36 @@ std::chrono::system_clock::time_point Level2ProductView::sweep_time() const
|
|||
return p->sweepTime_;
|
||||
}
|
||||
|
||||
float Level2ProductView::unit_scale() const
|
||||
{
|
||||
switch (p->dataBlockType_)
|
||||
{
|
||||
case wsr88d::rda::DataBlockType::MomentVel:
|
||||
case wsr88d::rda::DataBlockType::MomentSw:
|
||||
return types::GetSpeedUnitsScale(p->speedUnits_);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
std::string Level2ProductView::units() const
|
||||
{
|
||||
switch (p->dataBlockType_)
|
||||
{
|
||||
case wsr88d::rda::DataBlockType::MomentVel:
|
||||
case wsr88d::rda::DataBlockType::MomentSw:
|
||||
return types::GetSpeedUnitsAbbreviation(p->speedUnits_);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
uint16_t Level2ProductView::vcp() const
|
||||
{
|
||||
return p->vcp_;
|
||||
|
|
@ -323,6 +374,11 @@ void Level2ProductViewImpl::SetProduct(common::Level2Product product)
|
|||
}
|
||||
}
|
||||
|
||||
void Level2ProductViewImpl::UpdateSpeedUnits(const std::string& name)
|
||||
{
|
||||
speedUnits_ = types::GetSpeedUnitsFromName(name);
|
||||
}
|
||||
|
||||
void Level2ProductView::UpdateColorTableLut()
|
||||
{
|
||||
if (p->momentDataBlock0_ == nullptr || //
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public:
|
|||
float elevation() const override;
|
||||
float range() const override;
|
||||
std::chrono::system_clock::time_point sweep_time() const override;
|
||||
float unit_scale() const override;
|
||||
std::string units() const override;
|
||||
std::uint16_t vcp() const override;
|
||||
const std::vector<float>& vertices() const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,16 @@ uint16_t Level3ProductView::color_table_max() const
|
|||
}
|
||||
}
|
||||
|
||||
float Level3ProductView::unit_scale() const
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
std::string Level3ProductView::units() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::shared_ptr<wsr88d::rpg::GraphicProductMessage>
|
||||
Level3ProductView::graphic_product_message() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public:
|
|||
color_table_lut() const override;
|
||||
std::uint16_t color_table_min() const override;
|
||||
std::uint16_t color_table_max() const override;
|
||||
float unit_scale() const override;
|
||||
std::string units() const override;
|
||||
|
||||
void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@ public:
|
|||
virtual float elevation() const;
|
||||
virtual float range() const;
|
||||
virtual std::chrono::system_clock::time_point sweep_time() const;
|
||||
virtual std::uint16_t vcp() const = 0;
|
||||
virtual const std::vector<float>& vertices() const = 0;
|
||||
virtual float unit_scale() const = 0;
|
||||
virtual std::string units() const = 0;
|
||||
virtual std::uint16_t vcp() const = 0;
|
||||
virtual const std::vector<float>& vertices() const = 0;
|
||||
|
||||
std::shared_ptr<manager::RadarProductManager> radar_product_manager() const;
|
||||
std::chrono::system_clock::time_point selected_time() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue