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