mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:40:06 +00:00 
			
		
		
		
	Add Level 3 Products Changed signal to Map Widget
This commit is contained in:
		
							parent
							
								
									c2e56b8e32
								
							
						
					
					
						commit
						7e084d28e9
					
				
					 2 changed files with 40 additions and 6 deletions
				
			
		|  | @ -81,9 +81,9 @@ public: | |||
|    void AddLayer(const std::string&            id, | ||||
|                  std::shared_ptr<GenericLayer> layer, | ||||
|                  const std::string&            before = {}); | ||||
|    void AutoRefreshConnect(); | ||||
|    void AutoRefreshDisconnect(); | ||||
|    void InitializeNewRadarProductView(const std::string& colorPalette); | ||||
|    void RadarProductManagerConnect(); | ||||
|    void RadarProductManagerDisconnect(); | ||||
|    void RadarProductViewConnect(); | ||||
|    void RadarProductViewDisconnect(); | ||||
|    void SetRadarSite(const std::string& radarSite); | ||||
|  | @ -139,6 +139,18 @@ MapWidget::~MapWidget() | |||
|    makeCurrent(); | ||||
| } | ||||
| 
 | ||||
| common::Level3ProductCategoryMap MapWidget::GetAvailableLevel3Categories() | ||||
| { | ||||
|    if (p->radarProductManager_ != nullptr) | ||||
|    { | ||||
|       return p->radarProductManager_->GetAvailableLevel3Categories(); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return {}; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| float MapWidget::GetElevation() const | ||||
| { | ||||
|    if (p->context_->radarProductView_ != nullptr) | ||||
|  | @ -192,6 +204,18 @@ MapWidgetImpl::GetLevel2ProductOrDefault(const std::string& productName) const | |||
|    return level2Product; | ||||
| } | ||||
| 
 | ||||
| std::vector<std::string> MapWidget::GetLevel3Products() | ||||
| { | ||||
|    if (p->radarProductManager_ != nullptr) | ||||
|    { | ||||
|       return p->radarProductManager_->GetLevel3Products(); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return {}; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| common::RadarProductGroup MapWidget::GetRadarProductGroup() const | ||||
| { | ||||
|    if (p->context_->radarProductView_ != nullptr) | ||||
|  | @ -584,10 +608,15 @@ void MapWidget::mapChanged(QMapboxGL::MapChange mapChange) | |||
|    } | ||||
| } | ||||
| 
 | ||||
| void MapWidgetImpl::AutoRefreshConnect() | ||||
| void MapWidgetImpl::RadarProductManagerConnect() | ||||
| { | ||||
|    if (radarProductManager_ != nullptr) | ||||
|    { | ||||
|       connect(radarProductManager_.get(), | ||||
|               &manager::RadarProductManager::Level3ProductsChanged, | ||||
|               this, | ||||
|               [&]() { emit widget_->Level3ProductsChanged(); }); | ||||
| 
 | ||||
|       connect( | ||||
|          radarProductManager_.get(), | ||||
|          &manager::RadarProductManager::NewDataAvailable, | ||||
|  | @ -640,7 +669,7 @@ void MapWidgetImpl::AutoRefreshConnect() | |||
|    } | ||||
| } | ||||
| 
 | ||||
| void MapWidgetImpl::AutoRefreshDisconnect() | ||||
| void MapWidgetImpl::RadarProductManagerDisconnect() | ||||
| { | ||||
|    if (radarProductManager_ != nullptr) | ||||
|    { | ||||
|  | @ -727,13 +756,15 @@ void MapWidgetImpl::SetRadarSite(const std::string& radarSite) | |||
|        radarSite != radarProductManager_->radar_site()->id()) | ||||
|    { | ||||
|       // Disconnect signals from old RadarProductManager
 | ||||
|       AutoRefreshDisconnect(); | ||||
|       RadarProductManagerDisconnect(); | ||||
| 
 | ||||
|       // Set new RadarProductManager
 | ||||
|       radarProductManager_ = manager::RadarProductManager::Instance(radarSite); | ||||
| 
 | ||||
|       // Connect signals to new RadarProductManager
 | ||||
|       AutoRefreshConnect(); | ||||
|       RadarProductManagerConnect(); | ||||
| 
 | ||||
|       radarProductManager_->UpdateAvailableProducts(); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -34,8 +34,10 @@ public: | |||
|    explicit MapWidget(const QMapboxGLSettings&); | ||||
|    ~MapWidget(); | ||||
| 
 | ||||
|    common::Level3ProductCategoryMap   GetAvailableLevel3Categories(); | ||||
|    float                              GetElevation() const; | ||||
|    std::vector<float>                 GetElevationCuts() const; | ||||
|    std::vector<std::string>           GetLevel3Products(); | ||||
|    common::RadarProductGroup          GetRadarProductGroup() const; | ||||
|    std::string                        GetRadarProductName() const; | ||||
|    std::shared_ptr<config::RadarSite> GetRadarSite() const; | ||||
|  | @ -78,6 +80,7 @@ private slots: | |||
|    void mapChanged(QMapboxGL::MapChange); | ||||
| 
 | ||||
| signals: | ||||
|    void Level3ProductsChanged(); | ||||
|    void MapParametersChanged(double latitude, | ||||
|                              double longitude, | ||||
|                              double zoom, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat