mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:20:06 +00:00 
			
		
		
		
	Add radar wireframe debug menu selection
This commit is contained in:
		
							parent
							
								
									77e02b76b1
								
							
						
					
					
						commit
						f010ea8fad
					
				
					 7 changed files with 53 additions and 5 deletions
				
			
		|  | @ -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() | ||||
|  |  | |||
|  | @ -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(); | ||||
|  |  | |||
|  | @ -97,6 +97,8 @@ | |||
|     <addaction name="separator"/> | ||||
|     <addaction name="actionDumpLayerList"/> | ||||
|     <addaction name="actionDumpRadarProductRecords"/> | ||||
|     <addaction name="separator"/> | ||||
|     <addaction name="actionRadarWireframe"/> | ||||
|    </widget> | ||||
|    <widget class="QMenu" name="menuTools"> | ||||
|     <property name="title"> | ||||
|  | @ -504,6 +506,14 @@ | |||
|     <string>Location &Marker Manager</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionRadarWireframe"> | ||||
|    <property name="checkable"> | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Radar &Wireframe</string> | ||||
|    </property> | ||||
|   </action> | ||||
|  </widget> | ||||
|  <resources> | ||||
|   <include location="../../../../scwx-qt.qrc"/> | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ namespace map | |||
| 
 | ||||
| struct MapSettings | ||||
| { | ||||
|    explicit MapSettings() : isActive_ {false} {} | ||||
|    explicit MapSettings() {} | ||||
|    ~MapSettings() = default; | ||||
| 
 | ||||
|    MapSettings(const MapSettings&)            = delete; | ||||
|  | @ -18,7 +18,8 @@ struct MapSettings | |||
|    MapSettings(MapSettings&&) noexcept            = default; | ||||
|    MapSettings& operator=(MapSettings&&) noexcept = default; | ||||
| 
 | ||||
|    bool isActive_; | ||||
|    bool isActive_ {false}; | ||||
|    bool radarWireframeEnabled_ {false}; | ||||
| }; | ||||
| 
 | ||||
| } // namespace map
 | ||||
|  |  | |||
|  | @ -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_; | ||||
|  |  | |||
|  | @ -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); | ||||
| 
 | ||||
|    /**
 | ||||
|  |  | |||
|  | @ -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(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat