Add radar wireframe debug menu selection

This commit is contained in:
Dan Paulat 2024-12-14 23:08:53 -06:00
parent 77e02b76b1
commit f010ea8fad
7 changed files with 53 additions and 5 deletions

View file

@ -9,16 +9,17 @@ namespace map
struct MapSettings
{
explicit MapSettings() : isActive_ {false} {}
explicit MapSettings() {}
~MapSettings() = default;
MapSettings(const MapSettings&) = delete;
MapSettings(const MapSettings&) = delete;
MapSettings& operator=(const MapSettings&) = delete;
MapSettings(MapSettings&&) noexcept = default;
MapSettings(MapSettings&&) noexcept = default;
MapSettings& operator=(MapSettings&&) noexcept = default;
bool isActive_;
bool isActive_ {false};
bool radarWireframeEnabled_ {false};
};
} // namespace map

View file

@ -728,6 +728,18 @@ std::uint16_t MapWidget::GetVcp() const
}
}
bool MapWidget::GetRadarWireframeEnabled() const
{
return p->context_->settings().radarWireframeEnabled_;
}
void MapWidget::SetRadarWireframeEnabled(bool wireframeEnabled)
{
p->context_->settings().radarWireframeEnabled_ = wireframeEnabled;
QMetaObject::invokeMethod(
this, static_cast<void (QWidget::*)()>(&QWidget::update));
}
bool MapWidget::GetSmoothingEnabled() const
{
return p->smoothingEnabled_;

View file

@ -47,6 +47,7 @@ public:
common::RadarProductGroup GetRadarProductGroup() const;
std::string GetRadarProductName() const;
std::shared_ptr<config::RadarSite> GetRadarSite() const;
bool GetRadarWireframeEnabled() const;
std::chrono::system_clock::time_point GetSelectedTime() const;
bool GetSmoothingEnabled() const;
std::uint16_t GetVcp() const;
@ -118,6 +119,7 @@ public:
double pitch);
void SetInitialMapStyle(const std::string& styleName);
void SetMapStyle(const std::string& styleName);
void SetRadarWireframeEnabled(bool enabled);
void SetSmoothingEnabled(bool enabled);
/**

View file

@ -1,4 +1,5 @@
#include <scwx/qt/map/radar_product_layer.hpp>
#include <scwx/qt/map/map_settings.hpp>
#include <scwx/qt/gl/shader_program.hpp>
#include <scwx/qt/util/maplibre.hpp>
#include <scwx/qt/util/tooltip.hpp>
@ -267,6 +268,13 @@ void RadarProductLayer::Render(
// Set OpenGL blend mode for transparency
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bool wireframeEnabled = context()->settings().radarWireframeEnabled_;
if (wireframeEnabled)
{
// Set polygon mode to draw wireframe
gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
if (p->colorTableNeedsUpdate_)
{
UpdateColorTable();
@ -303,6 +311,12 @@ void RadarProductLayer::Render(
gl.glBindVertexArray(p->vao_);
gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
if (wireframeEnabled)
{
// Restore polygon mode to default
gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
SCWX_GL_CHECK_ERROR();
}