diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index e21484c4..ca2cde28 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -644,6 +644,11 @@ void MainWindow::on_actionDumpRadarProductRecords_triggered() manager::RadarProductManager::DumpRecords(); } +void MainWindow::on_actionRadarWireframe_triggered(bool checked) +{ + p->activeMap_->SetRadarWireframeEnabled(checked); +} + void MainWindow::on_actionUserManual_triggered() { QDesktopServices::openUrl(QUrl {"https://supercell-wx.readthedocs.io/"}); @@ -1487,6 +1492,9 @@ void MainWindowImpl::UpdateRadarProductSettings() mainWindow_->ui->smoothRadarDataCheckBox->setCheckState( activeMap_->GetSmoothingEnabled() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); + + mainWindow_->ui->actionRadarWireframe->setChecked( + activeMap_->GetRadarWireframeEnabled()); } void MainWindowImpl::UpdateRadarSite() diff --git a/scwx-qt/source/scwx/qt/main/main_window.hpp b/scwx-qt/source/scwx/qt/main/main_window.hpp index 6a4fb5b4..6eb7fee2 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.hpp +++ b/scwx-qt/source/scwx/qt/main/main_window.hpp @@ -29,7 +29,7 @@ public: void keyPressEvent(QKeyEvent* ev) override final; void keyReleaseEvent(QKeyEvent* ev) override final; void showEvent(QShowEvent* event) override; - void closeEvent(QCloseEvent *event) override; + void closeEvent(QCloseEvent* event) override; signals: void ActiveMapMoved(double latitude, double longitude); @@ -49,6 +49,7 @@ private slots: void on_actionImGuiDebug_triggered(); void on_actionDumpLayerList_triggered(); void on_actionDumpRadarProductRecords_triggered(); + void on_actionRadarWireframe_triggered(bool checked); void on_actionUserManual_triggered(); void on_actionDiscord_triggered(); void on_actionGitHubRepository_triggered(); diff --git a/scwx-qt/source/scwx/qt/main/main_window.ui b/scwx-qt/source/scwx/qt/main/main_window.ui index 42525199..5d856663 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.ui +++ b/scwx-qt/source/scwx/qt/main/main_window.ui @@ -97,6 +97,8 @@ + + @@ -504,6 +506,14 @@ Location &Marker Manager + + + true + + + Radar &Wireframe + + diff --git a/scwx-qt/source/scwx/qt/map/map_settings.hpp b/scwx-qt/source/scwx/qt/map/map_settings.hpp index 642c8fa1..a5d445cf 100644 --- a/scwx-qt/source/scwx/qt/map/map_settings.hpp +++ b/scwx-qt/source/scwx/qt/map/map_settings.hpp @@ -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 diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index d7b1dff7..1fa62f97 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -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(&QWidget::update)); +} + bool MapWidget::GetSmoothingEnabled() const { return p->smoothingEnabled_; diff --git a/scwx-qt/source/scwx/qt/map/map_widget.hpp b/scwx-qt/source/scwx/qt/map/map_widget.hpp index 4254453e..8f5b2951 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.hpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.hpp @@ -47,6 +47,7 @@ public: common::RadarProductGroup GetRadarProductGroup() const; std::string GetRadarProductName() const; std::shared_ptr 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); /** diff --git a/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp b/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp index be564926..53067ccc 100644 --- a/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/radar_product_layer.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -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(); }