mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 21:30:05 +00:00 
			
		
		
		
	Add current radar site to map context
This commit is contained in:
		
							parent
							
								
									b84c36c91a
								
							
						
					
					
						commit
						d21a11963f
					
				
					 3 changed files with 25 additions and 11 deletions
				
			
		|  | @ -27,6 +27,7 @@ public: | |||
|       common::RadarProductGroup::Unknown}; | ||||
|    std::string                            radarProduct_ {"???"}; | ||||
|    int16_t                                radarProductCode_ {0}; | ||||
|    std::shared_ptr<config::RadarSite>     radarSite_ {nullptr}; | ||||
| 
 | ||||
|    MapProvider mapProvider_ {MapProvider::Unknown}; | ||||
|    std::string mapCopyrights_ {}; | ||||
|  | @ -106,6 +107,11 @@ std::string MapContext::radar_product() const | |||
|    return p->radarProduct_; | ||||
| } | ||||
| 
 | ||||
| std::shared_ptr<config::RadarSite> MapContext::radar_site() const | ||||
| { | ||||
|    return p->radarSite_; | ||||
| } | ||||
| 
 | ||||
| int16_t MapContext::radar_product_code() const | ||||
| { | ||||
|    return p->radarProductCode_; | ||||
|  | @ -174,6 +180,11 @@ void MapContext::set_radar_product_code(int16_t radarProductCode) | |||
|    p->radarProductCode_ = radarProductCode; | ||||
| } | ||||
| 
 | ||||
| void MapContext::set_radar_site(const std::shared_ptr<config::RadarSite>& site) | ||||
| { | ||||
|    p->radarSite_ = site; | ||||
| } | ||||
| 
 | ||||
| void MapContext::set_widget(QWidget* widget) | ||||
| { | ||||
|    p->widget_ = widget; | ||||
|  |  | |||
|  | @ -4,13 +4,12 @@ | |||
| #include <scwx/qt/map/map_provider.hpp> | ||||
| #include <scwx/common/geographic.hpp> | ||||
| #include <scwx/common/products.hpp> | ||||
| #include <scwx/qt/config/radar_site.hpp> | ||||
| 
 | ||||
| #include <qmaplibre.hpp> | ||||
| #include <QMargins> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| namespace scwx::qt | ||||
| { | ||||
| namespace view | ||||
| { | ||||
|  | @ -30,7 +29,7 @@ class MapContext : public gl::GlContext | |||
| public: | ||||
|    explicit MapContext( | ||||
|       std::shared_ptr<view::RadarProductView> radarProductView = nullptr); | ||||
|    ~MapContext(); | ||||
|    ~MapContext() override; | ||||
| 
 | ||||
|    MapContext(const MapContext&)            = delete; | ||||
|    MapContext& operator=(const MapContext&) = delete; | ||||
|  | @ -52,6 +51,7 @@ public: | |||
|    [[nodiscard]] common::RadarProductGroup          radar_product_group() const; | ||||
|    [[nodiscard]] std::string                        radar_product() const; | ||||
|    [[nodiscard]] int16_t                            radar_product_code() const; | ||||
|    [[nodiscard]] std::shared_ptr<config::RadarSite> radar_site() const; | ||||
|    [[nodiscard]] QWidget*                           widget() const; | ||||
| 
 | ||||
|    void set_map(const std::shared_ptr<QMapLibre::Map>& map); | ||||
|  | @ -67,6 +67,7 @@ public: | |||
|    void set_radar_product_group(common::RadarProductGroup radarProductGroup); | ||||
|    void set_radar_product(const std::string& radarProduct); | ||||
|    void set_radar_product_code(int16_t radarProductCode); | ||||
|    void set_radar_site(const std::shared_ptr<config::RadarSite>& site); | ||||
|    void set_widget(QWidget* widget); | ||||
| 
 | ||||
| private: | ||||
|  | @ -76,5 +77,4 @@ private: | |||
| }; | ||||
| 
 | ||||
| } // namespace map
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
| } // namespace scwx::qt
 | ||||
|  |  | |||
|  | @ -2008,6 +2008,9 @@ void MapWidgetImpl::SelectNearestRadarSite(double                     latitude, | |||
| void MapWidgetImpl::SetRadarSite(const std::string& radarSite, | ||||
|                                  bool               checkProductAvailability) | ||||
| { | ||||
|    // Set the radar site in the context
 | ||||
|    context_->set_radar_site(config::RadarSite::Get(radarSite)); | ||||
| 
 | ||||
|    // Check if radar site has changed
 | ||||
|    if (radarProductManager_ == nullptr || | ||||
|        radarSite != radarProductManager_->radar_site()->id()) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak