mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:30: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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue