Pushing data level code and value implementations from level 3 radial view to product view

This commit is contained in:
Dan Paulat 2024-01-05 23:47:59 -06:00
parent e96808d14d
commit 3f8bd22f77
6 changed files with 51 additions and 68 deletions

View file

@ -339,6 +339,53 @@ void Level3ProductView::UpdateColorTableLut()
Q_EMIT ColorTableLutUpdated(); Q_EMIT ColorTableLutUpdated();
} }
std::optional<wsr88d::DataLevelCode>
Level3ProductView::GetDataLevelCode(std::uint16_t level) const
{
if (level > std::numeric_limits<std::uint8_t>::max())
{
return std::nullopt;
}
auto gpm = graphic_product_message();
if (gpm == nullptr)
{
return std::nullopt;
}
std::shared_ptr<wsr88d::rpg::ProductDescriptionBlock> descriptionBlock =
gpm->description_block();
if (descriptionBlock == nullptr)
{
return std::nullopt;
}
return descriptionBlock->data_level_code(static_cast<std::uint8_t>(level));
}
std::optional<float> Level3ProductView::GetDataValue(std::uint16_t level) const
{
if (level > std::numeric_limits<std::uint8_t>::max())
{
return std::nullopt;
}
auto gpm = graphic_product_message();
if (gpm == nullptr)
{
return std::nullopt;
}
std::shared_ptr<wsr88d::rpg::ProductDescriptionBlock> descriptionBlock =
gpm->description_block();
if (descriptionBlock == nullptr)
{
return std::nullopt;
}
return descriptionBlock->data_value(static_cast<std::uint8_t>(level));
}
} // namespace view } // namespace view
} // namespace qt } // namespace qt
} // namespace scwx } // namespace scwx

View file

@ -36,6 +36,10 @@ public:
common::RadarProductGroup GetRadarProductGroup() const override; common::RadarProductGroup GetRadarProductGroup() const override;
std::string GetRadarProductName() const override; std::string GetRadarProductName() const override;
std::optional<wsr88d::DataLevelCode>
GetDataLevelCode(std::uint16_t level) const override;
std::optional<float> GetDataValue(std::uint16_t level) const override;
void SelectProduct(const std::string& productName) override; void SelectProduct(const std::string& productName) override;
std::vector<std::pair<std::string, std::string>> std::vector<std::pair<std::string, std::string>>

View file

@ -605,53 +605,6 @@ Level3RadialView::GetBinLevel(const common::Coordinate& coordinate) const
return level; return level;
} }
std::optional<wsr88d::DataLevelCode>
Level3RadialView::GetDataLevelCode(std::uint16_t level) const
{
if (level > std::numeric_limits<std::uint8_t>::max())
{
return std::nullopt;
}
auto gpm = graphic_product_message();
if (gpm == nullptr)
{
return std::nullopt;
}
std::shared_ptr<wsr88d::rpg::ProductDescriptionBlock> descriptionBlock =
gpm->description_block();
if (descriptionBlock == nullptr)
{
return std::nullopt;
}
return descriptionBlock->data_level_code(static_cast<std::uint8_t>(level));
}
std::optional<float> Level3RadialView::GetDataValue(std::uint16_t level) const
{
if (level > std::numeric_limits<std::uint8_t>::max())
{
return std::nullopt;
}
auto gpm = graphic_product_message();
if (gpm == nullptr)
{
return std::nullopt;
}
std::shared_ptr<wsr88d::rpg::ProductDescriptionBlock> descriptionBlock =
gpm->description_block();
if (descriptionBlock == nullptr)
{
return std::nullopt;
}
return descriptionBlock->data_value(static_cast<std::uint8_t>(level));
}
std::shared_ptr<Level3RadialView> Level3RadialView::Create( std::shared_ptr<Level3RadialView> Level3RadialView::Create(
const std::string& product, const std::string& product,
std::shared_ptr<manager::RadarProductManager> radarProductManager) std::shared_ptr<manager::RadarProductManager> radarProductManager)

View file

@ -33,9 +33,6 @@ public:
std::optional<std::uint16_t> std::optional<std::uint16_t>
GetBinLevel(const common::Coordinate& coordinate) const override; GetBinLevel(const common::Coordinate& coordinate) const override;
std::optional<wsr88d::DataLevelCode>
GetDataLevelCode(std::uint16_t level) const override;
std::optional<float> GetDataValue(std::uint16_t level) const override;
static std::shared_ptr<Level3RadialView> static std::shared_ptr<Level3RadialView>
Create(const std::string& product, Create(const std::string& product,

View file

@ -360,21 +360,6 @@ Level3RasterView::GetBinLevel(const common::Coordinate& coordinate) const
return std::nullopt; return std::nullopt;
} }
std::optional<wsr88d::DataLevelCode>
Level3RasterView::GetDataLevelCode(std::uint16_t level) const
{
// TODO
Q_UNUSED(level);
return std::nullopt;
}
std::optional<float> Level3RasterView::GetDataValue(std::uint16_t level) const
{
// TODO
Q_UNUSED(level);
return std::nullopt;
}
std::shared_ptr<Level3RasterView> Level3RasterView::Create( std::shared_ptr<Level3RasterView> Level3RasterView::Create(
const std::string& product, const std::string& product,
std::shared_ptr<manager::RadarProductManager> radarProductManager) std::shared_ptr<manager::RadarProductManager> radarProductManager)

View file

@ -35,9 +35,6 @@ public:
std::optional<std::uint16_t> std::optional<std::uint16_t>
GetBinLevel(const common::Coordinate& coordinate) const override; GetBinLevel(const common::Coordinate& coordinate) const override;
std::optional<wsr88d::DataLevelCode>
GetDataLevelCode(std::uint16_t level) const override;
std::optional<float> GetDataValue(std::uint16_t level) const override;
static std::shared_ptr<Level3RasterView> static std::shared_ptr<Level3RasterView>
Create(const std::string& product, Create(const std::string& product,