mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 11:00:06 +00:00 
			
		
		
		
	Add map weak reference to map context
This commit is contained in:
		
							parent
							
								
									aadf948656
								
							
						
					
					
						commit
						241f910220
					
				
					 3 changed files with 17 additions and 0 deletions
				
			
		|  | @ -11,6 +11,7 @@ class MapContext::Impl | |||
| { | ||||
| public: | ||||
|    explicit Impl(std::shared_ptr<view::RadarProductView> radarProductView) : | ||||
|        map_ {}, | ||||
|        settings_ {}, | ||||
|        radarProductView_ {radarProductView}, | ||||
|        radarProductGroup_ {common::RadarProductGroup::Unknown}, | ||||
|  | @ -21,6 +22,7 @@ public: | |||
| 
 | ||||
|    ~Impl() {} | ||||
| 
 | ||||
|    std::weak_ptr<QMapboxGL>                map_; | ||||
|    MapSettings                             settings_; | ||||
|    std::shared_ptr<view::RadarProductView> radarProductView_; | ||||
|    common::RadarProductGroup               radarProductGroup_; | ||||
|  | @ -38,6 +40,11 @@ MapContext::~MapContext() = default; | |||
| MapContext::MapContext(MapContext&&) noexcept            = default; | ||||
| MapContext& MapContext::operator=(MapContext&&) noexcept = default; | ||||
| 
 | ||||
| std::weak_ptr<QMapboxGL> MapContext::map() const | ||||
| { | ||||
|    return p->map_; | ||||
| } | ||||
| 
 | ||||
| MapSettings& MapContext::settings() | ||||
| { | ||||
|    return p->settings_; | ||||
|  | @ -63,6 +70,11 @@ int16_t MapContext::radar_product_code() const | |||
|    return p->radarProductCode_; | ||||
| } | ||||
| 
 | ||||
| void MapContext::set_map(std::shared_ptr<QMapboxGL> map) | ||||
| { | ||||
|    p->map_ = map; | ||||
| } | ||||
| 
 | ||||
| void MapContext::set_radar_product_view( | ||||
|    std::shared_ptr<view::RadarProductView> radarProductView) | ||||
| { | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ | |||
| #include <scwx/qt/map/map_settings.hpp> | ||||
| #include <scwx/qt/view/radar_product_view.hpp> | ||||
| 
 | ||||
| class QMapboxGL; | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
|  | @ -24,12 +26,14 @@ public: | |||
|    MapContext(MapContext&&) noexcept; | ||||
|    MapContext& operator=(MapContext&&) noexcept; | ||||
| 
 | ||||
|    std::weak_ptr<QMapboxGL>                map() const; | ||||
|    MapSettings&                            settings(); | ||||
|    std::shared_ptr<view::RadarProductView> radar_product_view() const; | ||||
|    common::RadarProductGroup               radar_product_group() const; | ||||
|    std::string                             radar_product() const; | ||||
|    int16_t                                 radar_product_code() const; | ||||
| 
 | ||||
|    void set_map(std::shared_ptr<QMapboxGL> map); | ||||
|    void set_radar_product_view( | ||||
|       std::shared_ptr<view::RadarProductView> radarProductView); | ||||
|    void set_radar_product_group(common::RadarProductGroup radarProductGroup); | ||||
|  |  | |||
|  | @ -639,6 +639,7 @@ void MapWidget::initializeGL() | |||
|    p->context_->gl().initializeOpenGLFunctions(); | ||||
| 
 | ||||
|    p->map_.reset(new QMapboxGL(nullptr, p->settings_, size(), pixelRatio())); | ||||
|    p->context_->set_map(p->map_); | ||||
|    connect(p->map_.get(), | ||||
|            &QMapboxGL::needsRendering, | ||||
|            p.get(), | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat