mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:20:04 +00:00 
			
		
		
		
	Moving isActive from radar product view to map settings
This commit is contained in:
		
							parent
							
								
									f7f86ec24a
								
							
						
					
					
						commit
						b78011a2d3
					
				
					 7 changed files with 35 additions and 30 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <scwx/qt/gl/gl.hpp> | ||||
| #include <scwx/qt/map/map_settings.hpp> | ||||
| #include <scwx/qt/view/radar_product_view.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
|  | @ -14,7 +15,7 @@ struct MapContext | |||
| { | ||||
|    explicit MapContext( | ||||
|       std::shared_ptr<view::RadarProductView> radarProductView = nullptr) : | ||||
|        gl_ {}, radarProductView_ {radarProductView} | ||||
|        gl_ {}, settings_ {}, radarProductView_ {radarProductView} | ||||
|    { | ||||
|    } | ||||
|    ~MapContext() = default; | ||||
|  | @ -26,6 +27,7 @@ struct MapContext | |||
|    MapContext& operator=(MapContext&&) noexcept = default; | ||||
| 
 | ||||
|    gl::OpenGLFunctions                     gl_; | ||||
|    MapSettings                             settings_; | ||||
|    std::shared_ptr<view::RadarProductView> radarProductView_; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										26
									
								
								scwx-qt/source/scwx/qt/map/map_settings.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								scwx-qt/source/scwx/qt/map/map_settings.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| #pragma once | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace map | ||||
| { | ||||
| 
 | ||||
| struct MapSettings | ||||
| { | ||||
|    explicit MapSettings() : isActive_ {false} {} | ||||
|    ~MapSettings() = default; | ||||
| 
 | ||||
|    MapSettings(const MapSettings&) = delete; | ||||
|    MapSettings& operator=(const MapSettings&) = delete; | ||||
| 
 | ||||
|    MapSettings(MapSettings&&) noexcept = default; | ||||
|    MapSettings& operator=(MapSettings&&) noexcept = default; | ||||
| 
 | ||||
|    bool isActive_; | ||||
| }; | ||||
| 
 | ||||
| } // namespace map
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
|  | @ -58,7 +58,6 @@ public: | |||
|        radarProductLayer_ {nullptr}, | ||||
|        overlayLayer_ {nullptr}, | ||||
|        colorTableLayer_ {nullptr}, | ||||
|        isActive_ {false}, | ||||
|        lastPos_(), | ||||
|        currentStyleIndex_ {0}, | ||||
|        frameDraws_(0), | ||||
|  | @ -87,7 +86,6 @@ public: | |||
|    std::shared_ptr<OverlayLayer>      overlayLayer_; | ||||
|    std::shared_ptr<ColorTableLayer>   colorTableLayer_; | ||||
| 
 | ||||
|    bool    isActive_; | ||||
|    QPointF lastPos_; | ||||
|    uint8_t currentStyleIndex_; | ||||
| 
 | ||||
|  | @ -145,7 +143,6 @@ void MapWidget::SelectRadarProduct(common::Level2Product product) | |||
| 
 | ||||
|    radarProductView = view::RadarProductViewFactory::Create( | ||||
|       product, currentElevation, p->radarProductManager_); | ||||
|    radarProductView->SetActive(p->isActive_); | ||||
| 
 | ||||
|    connect( | ||||
|       radarProductView.get(), | ||||
|  | @ -184,13 +181,8 @@ void MapWidget::SelectRadarProduct(common::Level2Product product) | |||
| 
 | ||||
| void MapWidget::SetActive(bool isActive) | ||||
| { | ||||
|    p->isActive_ = isActive; | ||||
| 
 | ||||
|    if (p->context_->radarProductView_ != nullptr) | ||||
|    { | ||||
|       p->context_->radarProductView_->SetActive(isActive); | ||||
|       update(); | ||||
|    } | ||||
|    p->context_->settings_.isActive_ = isActive; | ||||
|    update(); | ||||
| } | ||||
| 
 | ||||
| void MapWidget::SetMapParameters( | ||||
|  |  | |||
|  | @ -159,7 +159,7 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params) | |||
|    gl.glUniformMatrix4fv( | ||||
|       p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection)); | ||||
| 
 | ||||
|    if (context()->radarProductView_->IsActive()) | ||||
|    if (context()->settings_.isActive_) | ||||
|    { | ||||
|       const float vertexLX       = 1.0f; | ||||
|       const float vertexRX       = static_cast<float>(params.width) - 1.0f; | ||||
|  |  | |||
|  | @ -24,10 +24,8 @@ static const uint16_t DEFAULT_COLOR_TABLE_MAX = 255u; | |||
| class RadarProductViewImpl | ||||
| { | ||||
| public: | ||||
|    explicit RadarProductViewImpl() : isActive_ {false} {}; | ||||
|    ~RadarProductViewImpl() = default; | ||||
| 
 | ||||
|    bool isActive_; | ||||
|    explicit RadarProductViewImpl() = default; | ||||
|    ~RadarProductViewImpl()         = default; | ||||
| }; | ||||
| 
 | ||||
| RadarProductView::RadarProductView() : | ||||
|  | @ -87,16 +85,6 @@ RadarProductView::GetCfpMomentData() const | |||
|    return std::tie(data, dataSize, componentSize); | ||||
| } | ||||
| 
 | ||||
| bool RadarProductView::IsActive() const | ||||
| { | ||||
|    return p->isActive_; | ||||
| } | ||||
| 
 | ||||
| void RadarProductView::SetActive(bool isActive) | ||||
| { | ||||
|    p->isActive_ = isActive; | ||||
| } | ||||
| 
 | ||||
| void RadarProductView::ComputeSweep() | ||||
| { | ||||
|    BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "ComputeSweep()"; | ||||
|  |  | |||
|  | @ -42,10 +42,6 @@ public: | |||
|    virtual std::tuple<const void*, size_t, size_t> GetMomentData() const = 0; | ||||
|    virtual std::tuple<const void*, size_t, size_t> GetCfpMomentData() const; | ||||
| 
 | ||||
|    bool IsActive() const; | ||||
| 
 | ||||
|    void SetActive(bool isActive); | ||||
| 
 | ||||
| protected: | ||||
|    virtual void UpdateColorTable() = 0; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat