mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 09:30:05 +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, |    void AddLayer(const std::string&            id, | ||||||
|                  std::shared_ptr<GenericLayer> layer, |                  std::shared_ptr<GenericLayer> layer, | ||||||
|                  const std::string&            before = {}); |                  const std::string&            before = {}); | ||||||
|    void AutoRefreshConnect(); |  | ||||||
|    void AutoRefreshDisconnect(); |  | ||||||
|    void InitializeNewRadarProductView(const std::string& colorPalette); |    void InitializeNewRadarProductView(const std::string& colorPalette); | ||||||
|  |    void RadarProductManagerConnect(); | ||||||
|  |    void RadarProductManagerDisconnect(); | ||||||
|    void RadarProductViewConnect(); |    void RadarProductViewConnect(); | ||||||
|    void RadarProductViewDisconnect(); |    void RadarProductViewDisconnect(); | ||||||
|    void SetRadarSite(const std::string& radarSite); |    void SetRadarSite(const std::string& radarSite); | ||||||
|  | @ -139,6 +139,18 @@ MapWidget::~MapWidget() | ||||||
|    makeCurrent(); |    makeCurrent(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | common::Level3ProductCategoryMap MapWidget::GetAvailableLevel3Categories() | ||||||
|  | { | ||||||
|  |    if (p->radarProductManager_ != nullptr) | ||||||
|  |    { | ||||||
|  |       return p->radarProductManager_->GetAvailableLevel3Categories(); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       return {}; | ||||||
|  |    } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| float MapWidget::GetElevation() const | float MapWidget::GetElevation() const | ||||||
| { | { | ||||||
|    if (p->context_->radarProductView_ != nullptr) |    if (p->context_->radarProductView_ != nullptr) | ||||||
|  | @ -192,6 +204,18 @@ MapWidgetImpl::GetLevel2ProductOrDefault(const std::string& productName) const | ||||||
|    return level2Product; |    return level2Product; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | std::vector<std::string> MapWidget::GetLevel3Products() | ||||||
|  | { | ||||||
|  |    if (p->radarProductManager_ != nullptr) | ||||||
|  |    { | ||||||
|  |       return p->radarProductManager_->GetLevel3Products(); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       return {}; | ||||||
|  |    } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| common::RadarProductGroup MapWidget::GetRadarProductGroup() const | common::RadarProductGroup MapWidget::GetRadarProductGroup() const | ||||||
| { | { | ||||||
|    if (p->context_->radarProductView_ != nullptr) |    if (p->context_->radarProductView_ != nullptr) | ||||||
|  | @ -584,10 +608,15 @@ void MapWidget::mapChanged(QMapboxGL::MapChange mapChange) | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MapWidgetImpl::AutoRefreshConnect() | void MapWidgetImpl::RadarProductManagerConnect() | ||||||
| { | { | ||||||
|    if (radarProductManager_ != nullptr) |    if (radarProductManager_ != nullptr) | ||||||
|    { |    { | ||||||
|  |       connect(radarProductManager_.get(), | ||||||
|  |               &manager::RadarProductManager::Level3ProductsChanged, | ||||||
|  |               this, | ||||||
|  |               [&]() { emit widget_->Level3ProductsChanged(); }); | ||||||
|  | 
 | ||||||
|       connect( |       connect( | ||||||
|          radarProductManager_.get(), |          radarProductManager_.get(), | ||||||
|          &manager::RadarProductManager::NewDataAvailable, |          &manager::RadarProductManager::NewDataAvailable, | ||||||
|  | @ -640,7 +669,7 @@ void MapWidgetImpl::AutoRefreshConnect() | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MapWidgetImpl::AutoRefreshDisconnect() | void MapWidgetImpl::RadarProductManagerDisconnect() | ||||||
| { | { | ||||||
|    if (radarProductManager_ != nullptr) |    if (radarProductManager_ != nullptr) | ||||||
|    { |    { | ||||||
|  | @ -727,13 +756,15 @@ void MapWidgetImpl::SetRadarSite(const std::string& radarSite) | ||||||
|        radarSite != radarProductManager_->radar_site()->id()) |        radarSite != radarProductManager_->radar_site()->id()) | ||||||
|    { |    { | ||||||
|       // Disconnect signals from old RadarProductManager
 |       // Disconnect signals from old RadarProductManager
 | ||||||
|       AutoRefreshDisconnect(); |       RadarProductManagerDisconnect(); | ||||||
| 
 | 
 | ||||||
|       // Set new RadarProductManager
 |       // Set new RadarProductManager
 | ||||||
|       radarProductManager_ = manager::RadarProductManager::Instance(radarSite); |       radarProductManager_ = manager::RadarProductManager::Instance(radarSite); | ||||||
| 
 | 
 | ||||||
|       // Connect signals to new RadarProductManager
 |       // Connect signals to new RadarProductManager
 | ||||||
|       AutoRefreshConnect(); |       RadarProductManagerConnect(); | ||||||
|  | 
 | ||||||
|  |       radarProductManager_->UpdateAvailableProducts(); | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -34,8 +34,10 @@ public: | ||||||
|    explicit MapWidget(const QMapboxGLSettings&); |    explicit MapWidget(const QMapboxGLSettings&); | ||||||
|    ~MapWidget(); |    ~MapWidget(); | ||||||
| 
 | 
 | ||||||
|  |    common::Level3ProductCategoryMap   GetAvailableLevel3Categories(); | ||||||
|    float                              GetElevation() const; |    float                              GetElevation() const; | ||||||
|    std::vector<float>                 GetElevationCuts() const; |    std::vector<float>                 GetElevationCuts() const; | ||||||
|  |    std::vector<std::string>           GetLevel3Products(); | ||||||
|    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; | ||||||
|  | @ -78,6 +80,7 @@ private slots: | ||||||
|    void mapChanged(QMapboxGL::MapChange); |    void mapChanged(QMapboxGL::MapChange); | ||||||
| 
 | 
 | ||||||
| signals: | signals: | ||||||
|  |    void Level3ProductsChanged(); | ||||||
|    void MapParametersChanged(double latitude, |    void MapParametersChanged(double latitude, | ||||||
|                              double longitude, |                              double longitude, | ||||||
|                              double zoom, |                              double zoom, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat