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

@ -644,6 +644,11 @@ void MainWindow::on_actionDumpRadarProductRecords_triggered()
manager::RadarProductManager::DumpRecords(); manager::RadarProductManager::DumpRecords();
} }
void MainWindow::on_actionRadarWireframe_triggered(bool checked)
{
p->activeMap_->SetRadarWireframeEnabled(checked);
}
void MainWindow::on_actionUserManual_triggered() void MainWindow::on_actionUserManual_triggered()
{ {
QDesktopServices::openUrl(QUrl {"https://supercell-wx.readthedocs.io/"}); QDesktopServices::openUrl(QUrl {"https://supercell-wx.readthedocs.io/"});
@ -1487,6 +1492,9 @@ void MainWindowImpl::UpdateRadarProductSettings()
mainWindow_->ui->smoothRadarDataCheckBox->setCheckState( mainWindow_->ui->smoothRadarDataCheckBox->setCheckState(
activeMap_->GetSmoothingEnabled() ? Qt::CheckState::Checked : activeMap_->GetSmoothingEnabled() ? Qt::CheckState::Checked :
Qt::CheckState::Unchecked); Qt::CheckState::Unchecked);
mainWindow_->ui->actionRadarWireframe->setChecked(
activeMap_->GetRadarWireframeEnabled());
} }
void MainWindowImpl::UpdateRadarSite() void MainWindowImpl::UpdateRadarSite()

View file

@ -29,7 +29,7 @@ public:
void keyPressEvent(QKeyEvent* ev) override final; void keyPressEvent(QKeyEvent* ev) override final;
void keyReleaseEvent(QKeyEvent* ev) override final; void keyReleaseEvent(QKeyEvent* ev) override final;
void showEvent(QShowEvent* event) override; void showEvent(QShowEvent* event) override;
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent* event) override;
signals: signals:
void ActiveMapMoved(double latitude, double longitude); void ActiveMapMoved(double latitude, double longitude);
@ -49,6 +49,7 @@ private slots:
void on_actionImGuiDebug_triggered(); void on_actionImGuiDebug_triggered();
void on_actionDumpLayerList_triggered(); void on_actionDumpLayerList_triggered();
void on_actionDumpRadarProductRecords_triggered(); void on_actionDumpRadarProductRecords_triggered();
void on_actionRadarWireframe_triggered(bool checked);
void on_actionUserManual_triggered(); void on_actionUserManual_triggered();
void on_actionDiscord_triggered(); void on_actionDiscord_triggered();
void on_actionGitHubRepository_triggered(); void on_actionGitHubRepository_triggered();

View file

@ -97,6 +97,8 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionDumpLayerList"/> <addaction name="actionDumpLayerList"/>
<addaction name="actionDumpRadarProductRecords"/> <addaction name="actionDumpRadarProductRecords"/>
<addaction name="separator"/>
<addaction name="actionRadarWireframe"/>
</widget> </widget>
<widget class="QMenu" name="menuTools"> <widget class="QMenu" name="menuTools">
<property name="title"> <property name="title">
@ -504,6 +506,14 @@
<string>Location &amp;Marker Manager</string> <string>Location &amp;Marker Manager</string>
</property> </property>
</action> </action>
<action name="actionRadarWireframe">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Radar &amp;Wireframe</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../../../../scwx-qt.qrc"/> <include location="../../../../scwx-qt.qrc"/>

View file

@ -9,7 +9,7 @@ namespace map
struct MapSettings struct MapSettings
{ {
explicit MapSettings() : isActive_ {false} {} explicit MapSettings() {}
~MapSettings() = default; ~MapSettings() = default;
MapSettings(const MapSettings&) = delete; MapSettings(const MapSettings&) = delete;
@ -18,7 +18,8 @@ struct MapSettings
MapSettings(MapSettings&&) noexcept = default; MapSettings(MapSettings&&) noexcept = default;
MapSettings& operator=(MapSettings&&) noexcept = default; MapSettings& operator=(MapSettings&&) noexcept = default;
bool isActive_; bool isActive_ {false};
bool radarWireframeEnabled_ {false};
}; };
} // namespace map } // 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 bool MapWidget::GetSmoothingEnabled() const
{ {
return p->smoothingEnabled_; return p->smoothingEnabled_;

View file

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

View file

@ -1,4 +1,5 @@
#include <scwx/qt/map/radar_product_layer.hpp> #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/gl/shader_program.hpp>
#include <scwx/qt/util/maplibre.hpp> #include <scwx/qt/util/maplibre.hpp>
#include <scwx/qt/util/tooltip.hpp> #include <scwx/qt/util/tooltip.hpp>
@ -267,6 +268,13 @@ void RadarProductLayer::Render(
// Set OpenGL blend mode for transparency // Set OpenGL blend mode for transparency
gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 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_) if (p->colorTableNeedsUpdate_)
{ {
UpdateColorTable(); UpdateColorTable();
@ -303,6 +311,12 @@ void RadarProductLayer::Render(
gl.glBindVertexArray(p->vao_); gl.glBindVertexArray(p->vao_);
gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_); 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(); SCWX_GL_CHECK_ERROR();
} }