mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:30:05 +00:00
Hover over time for additional product information
This commit is contained in:
parent
c2918daebf
commit
1e7df9f236
6 changed files with 107 additions and 6 deletions
|
|
@ -44,9 +44,7 @@ class OverlayLayerImpl
|
||||||
public:
|
public:
|
||||||
explicit OverlayLayerImpl(std::shared_ptr<MapContext> context) :
|
explicit OverlayLayerImpl(std::shared_ptr<MapContext> context) :
|
||||||
activeBoxOuter_ {std::make_shared<gl::draw::Rectangle>(context)},
|
activeBoxOuter_ {std::make_shared<gl::draw::Rectangle>(context)},
|
||||||
activeBoxInner_ {std::make_shared<gl::draw::Rectangle>(context)},
|
activeBoxInner_ {std::make_shared<gl::draw::Rectangle>(context)}
|
||||||
sweepTimeString_ {},
|
|
||||||
sweepTimeNeedsUpdate_ {true}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~OverlayLayerImpl() = default;
|
~OverlayLayerImpl() = default;
|
||||||
|
|
@ -54,8 +52,9 @@ public:
|
||||||
std::shared_ptr<gl::draw::Rectangle> activeBoxOuter_;
|
std::shared_ptr<gl::draw::Rectangle> activeBoxOuter_;
|
||||||
std::shared_ptr<gl::draw::Rectangle> activeBoxInner_;
|
std::shared_ptr<gl::draw::Rectangle> activeBoxInner_;
|
||||||
|
|
||||||
std::string sweepTimeString_;
|
std::string sweepTimeString_ {};
|
||||||
bool sweepTimeNeedsUpdate_;
|
bool sweepTimeNeedsUpdate_ {true};
|
||||||
|
bool sweepTimePicked_ {false};
|
||||||
};
|
};
|
||||||
|
|
||||||
OverlayLayer::OverlayLayer(std::shared_ptr<MapContext> context) :
|
OverlayLayer::OverlayLayer(std::shared_ptr<MapContext> context) :
|
||||||
|
|
@ -96,6 +95,8 @@ void OverlayLayer::Render(
|
||||||
|
|
||||||
context()->set_render_parameters(params);
|
context()->set_render_parameters(params);
|
||||||
|
|
||||||
|
p->sweepTimePicked_ = false;
|
||||||
|
|
||||||
if (p->sweepTimeNeedsUpdate_ && radarProductView != nullptr)
|
if (p->sweepTimeNeedsUpdate_ && radarProductView != nullptr)
|
||||||
{
|
{
|
||||||
const scwx::util::time_zone* currentZone;
|
const scwx::util::time_zone* currentZone;
|
||||||
|
|
@ -154,7 +155,38 @@ void OverlayLayer::Render(
|
||||||
nullptr,
|
nullptr,
|
||||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
|
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
|
||||||
ImGuiWindowFlags_AlwaysAutoResize);
|
ImGuiWindowFlags_AlwaysAutoResize);
|
||||||
ImGui::TextUnformatted(p->sweepTimeString_.c_str());
|
|
||||||
|
if (ImGui::IsWindowHovered())
|
||||||
|
{
|
||||||
|
// Show a detailed product description when the sweep time is hovered
|
||||||
|
p->sweepTimePicked_ = true;
|
||||||
|
|
||||||
|
auto fields = radarProductView->GetDescriptionFields();
|
||||||
|
if (fields.empty())
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted(p->sweepTimeString_.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ImGui::BeginTable("Description Fields", 2))
|
||||||
|
{
|
||||||
|
for (auto& field : fields)
|
||||||
|
{
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted(field.first.c_str());
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted(field.second.c_str());
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted(p->sweepTimeString_.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,6 +210,16 @@ void OverlayLayer::Deinitialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OverlayLayer::RunMousePicking(
|
||||||
|
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||||
|
const QPointF& /* mouseLocalPos */,
|
||||||
|
const QPointF& /* mouseGlobalPos */,
|
||||||
|
const glm::vec2& /* mouseCoords */)
|
||||||
|
{
|
||||||
|
// If sweep time was picked, don't process additional items
|
||||||
|
return p->sweepTimePicked_;
|
||||||
|
}
|
||||||
|
|
||||||
void OverlayLayer::UpdateSweepTimeNextFrame()
|
void OverlayLayer::UpdateSweepTimeNextFrame()
|
||||||
{
|
{
|
||||||
p->sweepTimeNeedsUpdate_ = true;
|
p->sweepTimeNeedsUpdate_ = true;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@ public:
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
|
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
|
const QPointF& mouseLocalPos,
|
||||||
|
const QPointF& mouseGlobalPos,
|
||||||
|
const glm::vec2& mouseCoords) override final;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateSweepTimeNextFrame();
|
void UpdateSweepTimeNextFrame();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
#include <boost/range/irange.hpp>
|
#include <boost/range/irange.hpp>
|
||||||
#include <boost/timer/timer.hpp>
|
#include <boost/timer/timer.hpp>
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
|
# include <date/date.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
|
|
@ -153,6 +157,44 @@ void Level3ProductView::SelectProduct(const std::string& productName)
|
||||||
p->product_ = productName;
|
p->product_ = productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::pair<std::string, std::string>>
|
||||||
|
Level3ProductView::GetDescriptionFields() const
|
||||||
|
{
|
||||||
|
std::vector<std::pair<std::string, std::string>> description {};
|
||||||
|
|
||||||
|
if (p->graphicMessage_ != nullptr)
|
||||||
|
{
|
||||||
|
const scwx::util::time_zone* currentZone;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
currentZone = std::chrono::current_zone();
|
||||||
|
#else
|
||||||
|
currentZone = date::current_zone();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
auto descriptionBlock = p->graphicMessage_->description_block();
|
||||||
|
|
||||||
|
if (descriptionBlock != nullptr)
|
||||||
|
{
|
||||||
|
auto volumeTime = scwx::util::TimePoint(
|
||||||
|
descriptionBlock->volume_scan_date(),
|
||||||
|
descriptionBlock->volume_scan_start_time() * 1000);
|
||||||
|
auto productTime = scwx::util::TimePoint(
|
||||||
|
descriptionBlock->generation_date_of_product(),
|
||||||
|
descriptionBlock->generation_time_of_product() * 1000);
|
||||||
|
|
||||||
|
description.emplace_back(
|
||||||
|
"Volume Time",
|
||||||
|
scwx::util::TimeString(volumeTime, currentZone, false));
|
||||||
|
description.emplace_back(
|
||||||
|
"Product Time",
|
||||||
|
scwx::util::TimeString(productTime, currentZone, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
void Level3ProductView::LoadColorTable(
|
void Level3ProductView::LoadColorTable(
|
||||||
std::shared_ptr<common::ColorTable> colorTable)
|
std::shared_ptr<common::ColorTable> colorTable)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@ public:
|
||||||
|
|
||||||
void SelectProduct(const std::string& productName) override;
|
void SelectProduct(const std::string& productName) override;
|
||||||
|
|
||||||
|
std::vector<std::pair<std::string, std::string>>
|
||||||
|
GetDescriptionFields() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<wsr88d::rpg::GraphicProductMessage>
|
std::shared_ptr<wsr88d::rpg::GraphicProductMessage>
|
||||||
graphic_product_message() const;
|
graphic_product_message() const;
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,12 @@ RadarProductView::GetCfpMomentData() const
|
||||||
return std::tie(data, dataSize, componentSize);
|
return std::tie(data, dataSize, componentSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::pair<std::string, std::string>>
|
||||||
|
RadarProductView::GetDescriptionFields() const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
std::chrono::system_clock::time_point RadarProductView::GetSelectedTime() const
|
std::chrono::system_clock::time_point RadarProductView::GetSelectedTime() const
|
||||||
{
|
{
|
||||||
return p->selectedTime_;
|
return p->selectedTime_;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,9 @@ public:
|
||||||
GetCfpMomentData() const;
|
GetCfpMomentData() const;
|
||||||
std::chrono::system_clock::time_point GetSelectedTime() const;
|
std::chrono::system_clock::time_point GetSelectedTime() const;
|
||||||
|
|
||||||
|
virtual std::vector<std::pair<std::string, std::string>>
|
||||||
|
GetDescriptionFields() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual boost::asio::thread_pool& thread_pool() = 0;
|
virtual boost::asio::thread_pool& thread_pool() = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue