mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:20:05 +00:00
Do not display an elevation number when there is non
This commit is contained in:
parent
484c08c455
commit
24f5f0a3e3
12 changed files with 166 additions and 145 deletions
|
|
@ -615,7 +615,7 @@ common::Level3ProductCategoryMap MapWidget::GetAvailableLevel3Categories()
|
|||
}
|
||||
}
|
||||
|
||||
float MapWidget::GetElevation() const
|
||||
std::optional<float> MapWidget::GetElevation() const
|
||||
{
|
||||
auto radarProductView = p->context_->radar_product_view();
|
||||
|
||||
|
|
@ -625,7 +625,7 @@ float MapWidget::GetElevation() const
|
|||
}
|
||||
else
|
||||
{
|
||||
return 0.0f;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include <qmaplibre.hpp>
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ public:
|
|||
|
||||
[[nodiscard]] common::Level3ProductCategoryMap
|
||||
GetAvailableLevel3Categories();
|
||||
[[nodiscard]] float GetElevation() const;
|
||||
[[nodiscard]] std::optional<float> GetElevation() const;
|
||||
[[nodiscard]] std::vector<float> GetElevationCuts() const;
|
||||
[[nodiscard]] std::vector<std::string> GetLevel3Products();
|
||||
[[nodiscard]] std::string GetMapStyle() const;
|
||||
|
|
|
|||
|
|
@ -428,21 +428,30 @@ void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
|||
{
|
||||
// Render product name
|
||||
const std::string productName = radarProductView->GetRadarProductName();
|
||||
const float elevation = radarProductView->elevation();
|
||||
const std::optional<float> elevation = radarProductView->elevation();
|
||||
|
||||
if (productName.length() > 0 && !productName.starts_with('?'))
|
||||
{
|
||||
const std::string elevationString =
|
||||
(QString::number(elevation, 'f', 1) + common::Characters::DEGREE)
|
||||
.toStdString();
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2 {0.0f, 0.0f});
|
||||
ImGui::Begin("Product Name",
|
||||
nullptr,
|
||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::TextUnformatted(
|
||||
fmt::format("{} ({})", productName, elevationString).c_str());
|
||||
|
||||
if (elevation.has_value())
|
||||
{
|
||||
const std::string elevationString =
|
||||
(QString::number(*elevation, 'f', 1) +
|
||||
common::Characters::DEGREE)
|
||||
.toStdString();
|
||||
ImGui::TextUnformatted(
|
||||
fmt::format("{} ({})", productName, elevationString).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextUnformatted(productName.c_str());
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,9 @@ void Level2SettingsWidget::UpdateElevationSelection(float elevation)
|
|||
|
||||
void Level2SettingsWidget::UpdateSettings(map::MapWidget* activeMap)
|
||||
{
|
||||
float currentElevation = activeMap->GetElevation();
|
||||
std::optional<float> currentElevationOption = activeMap->GetElevation();
|
||||
float currentElevation =
|
||||
currentElevationOption.has_value() ? *currentElevationOption : 0.0f;
|
||||
std::vector<float> elevationCuts = activeMap->GetElevationCuts();
|
||||
|
||||
if (p->elevationCuts_ != elevationCuts)
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ uint16_t Level2ProductView::color_table_max() const
|
|||
}
|
||||
}
|
||||
|
||||
float Level2ProductView::elevation() const
|
||||
std::optional<float> Level2ProductView::elevation() const
|
||||
{
|
||||
return p->elevationCut_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace view
|
||||
namespace scwx::qt::view
|
||||
{
|
||||
|
||||
class Level2ProductView : public RadarProductView
|
||||
|
|
@ -23,38 +19,47 @@ public:
|
|||
explicit Level2ProductView(
|
||||
common::Level2Product product,
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager);
|
||||
~Level2ProductView();
|
||||
~Level2ProductView() override;
|
||||
|
||||
std::shared_ptr<common::ColorTable> color_table() const override;
|
||||
const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
color_table_lut() const override;
|
||||
std::uint16_t color_table_min() const override;
|
||||
std::uint16_t color_table_max() const override;
|
||||
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;
|
||||
Level2ProductView(const Level2ProductView&) = delete;
|
||||
Level2ProductView(Level2ProductView&&) = delete;
|
||||
Level2ProductView& operator=(const Level2ProductView&) = delete;
|
||||
Level2ProductView& operator=(Level2ProductView&&) = delete;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<common::ColorTable>
|
||||
color_table() const override;
|
||||
[[nodiscard]] const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
color_table_lut() const override;
|
||||
[[nodiscard]] std::uint16_t color_table_min() const override;
|
||||
[[nodiscard]] std::uint16_t color_table_max() const override;
|
||||
[[nodiscard]] std::optional<float> elevation() const override;
|
||||
[[nodiscard]] float range() const override;
|
||||
[[nodiscard]] std::chrono::system_clock::time_point
|
||||
sweep_time() const override;
|
||||
[[nodiscard]] float unit_scale() const override;
|
||||
[[nodiscard]] std::string units() const override;
|
||||
[[nodiscard]] std::uint16_t vcp() const override;
|
||||
[[nodiscard]] const std::vector<float>& vertices() const override;
|
||||
|
||||
void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) override;
|
||||
void SelectElevation(float elevation) override;
|
||||
void SelectProduct(const std::string& productName) override;
|
||||
|
||||
common::RadarProductGroup GetRadarProductGroup() const override;
|
||||
std::string GetRadarProductName() const override;
|
||||
std::vector<float> GetElevationCuts() const override;
|
||||
std::tuple<const void*, std::size_t, std::size_t>
|
||||
[[nodiscard]] common::RadarProductGroup
|
||||
GetRadarProductGroup() const override;
|
||||
[[nodiscard]] std::string GetRadarProductName() const override;
|
||||
[[nodiscard]] std::vector<float> GetElevationCuts() const override;
|
||||
[[nodiscard]] std::tuple<const void*, std::size_t, std::size_t>
|
||||
GetMomentData() const override;
|
||||
std::tuple<const void*, std::size_t, std::size_t>
|
||||
[[nodiscard]] std::tuple<const void*, std::size_t, std::size_t>
|
||||
GetCfpMomentData() const override;
|
||||
|
||||
std::optional<std::uint16_t>
|
||||
[[nodiscard]] 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;
|
||||
[[nodiscard]] std::optional<wsr88d::DataLevelCode>
|
||||
GetDataLevelCode(std::uint16_t level) const override;
|
||||
[[nodiscard]] std::optional<float>
|
||||
GetDataValue(std::uint16_t level) const override;
|
||||
|
||||
static std::shared_ptr<Level2ProductView>
|
||||
Create(common::Level2Product product,
|
||||
|
|
@ -75,6 +80,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::view
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
float latitude_;
|
||||
float longitude_;
|
||||
float elevation_;
|
||||
std::optional<float> elevation_ {};
|
||||
float range_;
|
||||
std::uint16_t vcp_;
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ boost::asio::thread_pool& Level3RadialView::thread_pool()
|
|||
return p->threadPool_;
|
||||
}
|
||||
|
||||
float Level3RadialView::elevation() const
|
||||
std::optional<float> Level3RadialView::elevation() const
|
||||
{
|
||||
return p->elevation_;
|
||||
}
|
||||
|
|
@ -312,7 +312,10 @@ void Level3RadialView::ComputeSweep()
|
|||
p->latitude_ = descriptionBlock->latitude_of_radar();
|
||||
p->longitude_ = descriptionBlock->longitude_of_radar();
|
||||
p->range_ = descriptionBlock->range();
|
||||
p->elevation_ = static_cast<float>(descriptionBlock->elevation().value());
|
||||
p->elevation_ =
|
||||
descriptionBlock->has_elevation() ?
|
||||
static_cast<float>(descriptionBlock->elevation().value()) :
|
||||
std::optional<float> {};
|
||||
p->sweepTime_ =
|
||||
scwx::util::TimePoint(descriptionBlock->volume_scan_date(),
|
||||
descriptionBlock->volume_scan_start_time() * 1000);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace view
|
||||
namespace scwx::qt::view
|
||||
{
|
||||
|
||||
class Level3RadialView : public Level3ProductView
|
||||
|
|
@ -21,19 +17,24 @@ public:
|
|||
explicit Level3RadialView(
|
||||
const std::string& product,
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager);
|
||||
~Level3RadialView();
|
||||
~Level3RadialView() override;
|
||||
|
||||
[[nodiscard]] float elevation() const override;
|
||||
[[nodiscard]] float range() const override;
|
||||
Level3RadialView(const Level3RadialView&) = delete;
|
||||
Level3RadialView(Level3RadialView&&) = delete;
|
||||
Level3RadialView& operator=(const Level3RadialView&) = delete;
|
||||
Level3RadialView& operator=(Level3RadialView&&) = delete;
|
||||
|
||||
[[nodiscard]] std::optional<float> elevation() const override;
|
||||
[[nodiscard]] float range() const override;
|
||||
[[nodiscard]] std::chrono::system_clock::time_point
|
||||
sweep_time() const override;
|
||||
[[nodiscard]] std::uint16_t vcp() const override;
|
||||
[[nodiscard]] const std::vector<float>& vertices() const override;
|
||||
|
||||
std::tuple<const void*, std::size_t, std::size_t>
|
||||
[[nodiscard]] std::tuple<const void*, std::size_t, std::size_t>
|
||||
GetMomentData() const override;
|
||||
|
||||
std::optional<std::uint16_t>
|
||||
[[nodiscard]] std::optional<std::uint16_t>
|
||||
GetBinLevel(const common::Coordinate& coordinate) const override;
|
||||
|
||||
static std::shared_ptr<Level3RadialView>
|
||||
|
|
@ -51,6 +52,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::view
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ std::uint16_t RadarProductView::color_table_max() const
|
|||
return kDefaultColorTableMax_;
|
||||
}
|
||||
|
||||
float RadarProductView::elevation() const
|
||||
std::optional<float> RadarProductView::elevation() const
|
||||
{
|
||||
return 0.0f;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::shared_ptr<manager::RadarProductManager>
|
||||
|
|
|
|||
|
|
@ -16,11 +16,7 @@
|
|||
#include <QObject>
|
||||
#include <boost/asio/thread_pool.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace view
|
||||
namespace scwx::qt::view
|
||||
{
|
||||
|
||||
class RadarProductViewImpl;
|
||||
|
|
@ -32,20 +28,27 @@ class RadarProductView : public QObject
|
|||
public:
|
||||
explicit RadarProductView(
|
||||
std::shared_ptr<manager::RadarProductManager> radarProductManager);
|
||||
virtual ~RadarProductView();
|
||||
~RadarProductView() override;
|
||||
|
||||
virtual std::shared_ptr<common::ColorTable> color_table() const = 0;
|
||||
virtual const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
color_table_lut() const;
|
||||
virtual std::uint16_t color_table_min() const;
|
||||
virtual std::uint16_t color_table_max() const;
|
||||
virtual float elevation() const;
|
||||
virtual float range() const;
|
||||
virtual std::chrono::system_clock::time_point sweep_time() const;
|
||||
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;
|
||||
RadarProductView(const RadarProductView&) = delete;
|
||||
RadarProductView(RadarProductView&&) = delete;
|
||||
RadarProductView& operator=(const RadarProductView&) = delete;
|
||||
RadarProductView& operator=(RadarProductView&&) = delete;
|
||||
|
||||
[[nodiscard]] virtual std::shared_ptr<common::ColorTable>
|
||||
color_table() const = 0;
|
||||
[[nodiscard]] virtual const std::vector<boost::gil::rgba8_pixel_t>&
|
||||
color_table_lut() const;
|
||||
[[nodiscard]] virtual std::uint16_t color_table_min() const;
|
||||
[[nodiscard]] virtual std::uint16_t color_table_max() const;
|
||||
[[nodiscard]] virtual std::optional<float> elevation() const;
|
||||
[[nodiscard]] virtual float range() const;
|
||||
[[nodiscard]] virtual std::chrono::system_clock::time_point
|
||||
sweep_time() const;
|
||||
[[nodiscard]] virtual float unit_scale() const = 0;
|
||||
[[nodiscard]] virtual std::string units() const = 0;
|
||||
[[nodiscard]] virtual std::uint16_t vcp() const = 0;
|
||||
[[nodiscard]] virtual const std::vector<float>& vertices() const = 0;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<manager::RadarProductManager>
|
||||
radar_product_manager() const;
|
||||
|
|
@ -66,24 +69,26 @@ public:
|
|||
void SelectTime(std::chrono::system_clock::time_point time);
|
||||
void Update();
|
||||
|
||||
bool IsInitialized() const;
|
||||
[[nodiscard]] bool IsInitialized() const;
|
||||
|
||||
virtual common::RadarProductGroup GetRadarProductGroup() const = 0;
|
||||
virtual std::string GetRadarProductName() const = 0;
|
||||
virtual std::vector<float> GetElevationCuts() const;
|
||||
virtual std::tuple<const void*, std::size_t, std::size_t>
|
||||
[[nodiscard]] virtual common::RadarProductGroup
|
||||
GetRadarProductGroup() const = 0;
|
||||
[[nodiscard]] virtual std::string GetRadarProductName() const = 0;
|
||||
[[nodiscard]] virtual std::vector<float> GetElevationCuts() const;
|
||||
[[nodiscard]] virtual std::tuple<const void*, std::size_t, std::size_t>
|
||||
GetMomentData() const = 0;
|
||||
virtual std::tuple<const void*, std::size_t, std::size_t>
|
||||
[[nodiscard]] virtual std::tuple<const void*, std::size_t, std::size_t>
|
||||
GetCfpMomentData() const;
|
||||
|
||||
virtual std::optional<std::uint16_t>
|
||||
[[nodiscard]] 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;
|
||||
virtual bool IgnoreUnits() const;
|
||||
[[nodiscard]] virtual std::optional<wsr88d::DataLevelCode>
|
||||
GetDataLevelCode(std::uint16_t level) const = 0;
|
||||
[[nodiscard]] virtual std::optional<float>
|
||||
GetDataValue(std::uint16_t level) const = 0;
|
||||
[[nodiscard]] virtual bool IgnoreUnits() const;
|
||||
|
||||
virtual std::vector<std::pair<std::string, std::string>>
|
||||
[[nodiscard]] virtual std::vector<std::pair<std::string, std::string>>
|
||||
GetDescriptionFields() const;
|
||||
|
||||
protected:
|
||||
|
|
@ -105,6 +110,4 @@ private:
|
|||
std::unique_ptr<RadarProductViewImpl> p;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::view
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue