Get data level code and value from level 3 radial data, stubs for raster and level 2

This commit is contained in:
Dan Paulat 2024-01-04 23:00:55 -06:00
parent a652ac460b
commit c1280c05aa
7 changed files with 95 additions and 0 deletions

View file

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

View file

@ -47,8 +47,12 @@ public:
GetMomentData() const override;
std::tuple<const void*, std::size_t, std::size_t>
GetCfpMomentData() const override;
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<Level2ProductView>
Create(common::Level2Product product,

View file

@ -605,6 +605,53 @@ 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)

View file

@ -30,8 +30,12 @@ public:
std::tuple<const void*, std::size_t, std::size_t>
GetMomentData() const override;
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,

View file

@ -360,6 +360,21 @@ 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)

View file

@ -32,8 +32,12 @@ public:
std::tuple<const void*, std::size_t, std::size_t>
GetMomentData() const override;
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,

View file

@ -5,6 +5,7 @@
#include <scwx/common/products.hpp>
#include <scwx/qt/manager/radar_product_manager.hpp>
#include <scwx/qt/types/map_types.hpp>
#include <scwx/wsr88d/wsr88d_types.hpp>
#include <chrono>
#include <memory>
@ -66,8 +67,13 @@ public:
GetMomentData() const = 0;
virtual std::tuple<const void*, std::size_t, std::size_t>
GetCfpMomentData() const;
virtual std::optional<std::uint16_t>
GetBinLevel(const common::Coordinate& coordinate) const = 0;
virtual std::optional<wsr88d::DataLevelCode>
GetDataLevelCode(std::uint16_t level) const = 0;
virtual std::optional<float> GetDataValue(std::uint16_t level) const = 0;
std::chrono::system_clock::time_point GetSelectedTime() const;
virtual std::vector<std::pair<std::string, std::string>>