Add elevation to product label. Mainly for level 3 products

This commit is contained in:
AdenKoperczak 2025-04-12 11:10:42 -04:00
parent 5968fd981c
commit be972cdb7e
No known key found for this signature in database
GPG key ID: 9843017036F62EE7
4 changed files with 24 additions and 8 deletions

View file

@ -275,7 +275,7 @@ public:
bool productAvailabilityProductSelected_ {false};
std::unordered_map<std::string, size_t> tiltsToIndices_;
size_t currentTiltIndex_ {0};
size_t currentTiltIndex_ {0};
public slots:
void Update();
@ -2163,7 +2163,6 @@ void MapWidgetImpl::CheckLevel3Availability()
availableTilts[availableTilts.size() - 1],
0,
widget_->GetSelectedTime());
}
else
{

View file

@ -1,3 +1,4 @@
#include <scwx/common/characters.hpp>
#include <scwx/qt/gl/draw/geo_icons.hpp>
#include <scwx/qt/gl/draw/icons.hpp>
#include <scwx/qt/gl/draw/rectangle.hpp>
@ -426,15 +427,22 @@ void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
if (radarProductView != nullptr)
{
// Render product name
std::string productName = radarProductView->GetRadarProductName();
const std::string productName = radarProductView->GetRadarProductName();
const 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(productName.c_str());
ImGui::TextUnformatted(
fmt::format("{} ({})", productName, elevationString).c_str());
ImGui::End();
}
}

View file

@ -67,6 +67,7 @@ public:
float latitude_;
float longitude_;
float elevation_;
float range_;
std::uint16_t vcp_;
@ -91,6 +92,11 @@ boost::asio::thread_pool& Level3RadialView::thread_pool()
return p->threadPool_;
}
float Level3RadialView::elevation() const
{
return p->elevation_;
}
float Level3RadialView::range() const
{
return p->range_;
@ -306,6 +312,7 @@ 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->sweepTime_ =
scwx::util::TimePoint(descriptionBlock->volume_scan_date(),
descriptionBlock->volume_scan_start_time() * 1000);

View file

@ -23,10 +23,12 @@ public:
std::shared_ptr<manager::RadarProductManager> radarProductManager);
~Level3RadialView();
float range() const override;
std::chrono::system_clock::time_point sweep_time() const override;
std::uint16_t vcp() const override;
const std::vector<float>& vertices() const override;
[[nodiscard]] 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>
GetMomentData() const override;