Skip to content

Commit

Permalink
Pushing data level code and value implementations from level 3 radial…
Browse files Browse the repository at this point in the history
… view to product view
  • Loading branch information
dpaulat committed Jan 6, 2024
1 parent e96808d commit 3f8bd22
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 68 deletions.
47 changes: 47 additions & 0 deletions scwx-qt/source/scwx/qt/view/level3_product_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,53 @@ void Level3ProductView::UpdateColorTableLut()
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 qt
} // namespace scwx
4 changes: 4 additions & 0 deletions scwx-qt/source/scwx/qt/view/level3_product_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Level3ProductView : public RadarProductView
common::RadarProductGroup GetRadarProductGroup() 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;

std::vector<std::pair<std::string, std::string>>
Expand Down
47 changes: 0 additions & 47 deletions scwx-qt/source/scwx/qt/view/level3_radial_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,53 +605,6 @@ Level3RadialView::GetBinLevel(const common::Coordinate& coordinate) const
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(
const std::string& product,
std::shared_ptr<manager::RadarProductManager> radarProductManager)
Expand Down
3 changes: 0 additions & 3 deletions scwx-qt/source/scwx/qt/view/level3_radial_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ class Level3RadialView : public Level3ProductView

std::optional<std::uint16_t>
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>
Create(const std::string& product,
Expand Down
15 changes: 0 additions & 15 deletions scwx-qt/source/scwx/qt/view/level3_raster_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,21 +360,6 @@ Level3RasterView::GetBinLevel(const common::Coordinate& coordinate) const
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(
const std::string& product,
std::shared_ptr<manager::RadarProductManager> radarProductManager)
Expand Down
3 changes: 0 additions & 3 deletions scwx-qt/source/scwx/qt/view/level3_raster_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class Level3RasterView : public Level3ProductView

std::optional<std::uint16_t>
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>
Create(const std::string& product,
Expand Down

0 comments on commit 3f8bd22

Please sign in to comment.