mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:40:05 +00:00 
			
		
		
		
	Remove GlContext from MapContext, layers receive MapContext from Initialize/Render
This commit is contained in:
		
							parent
							
								
									2d4ad2737e
								
							
						
					
					
						commit
						44a864f50f
					
				
					 25 changed files with 446 additions and 398 deletions
				
			
		|  | @ -5,11 +5,11 @@ | |||
| #include <scwx/qt/types/marker_types.hpp> | ||||
| #include <scwx/qt/ui/edit_marker_dialog.hpp> | ||||
| 
 | ||||
| #include <string> | ||||
| 
 | ||||
| #include <QGeoPositionInfo> | ||||
| #include <QMouseEvent> | ||||
| 
 | ||||
| #include <string> | ||||
| 
 | ||||
| namespace scwx::qt::map | ||||
| { | ||||
| 
 | ||||
|  | @ -19,15 +19,21 @@ static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | |||
| class MarkerLayer::Impl | ||||
| { | ||||
| public: | ||||
|    explicit Impl(MarkerLayer* self, std::shared_ptr<gl::GlContext> context) : | ||||
|    explicit Impl(MarkerLayer*                          self, | ||||
|                  const std::shared_ptr<gl::GlContext>& glContext) : | ||||
|        self_ {self}, | ||||
|        geoIcons_ {std::make_shared<gl::draw::GeoIcons>(context)}, | ||||
|        geoIcons_ {std::make_shared<gl::draw::GeoIcons>(glContext)}, | ||||
|        editMarkerDialog_ {std::make_shared<ui::EditMarkerDialog>()} | ||||
|    { | ||||
|       ConnectSignals(); | ||||
|    } | ||||
|    ~Impl() = default; | ||||
| 
 | ||||
|    Impl(const Impl&)             = delete; | ||||
|    Impl& operator=(const Impl&)  = delete; | ||||
|    Impl(const Impl&&)            = delete; | ||||
|    Impl& operator=(const Impl&&) = delete; | ||||
| 
 | ||||
|    void ReloadMarkers(); | ||||
|    void ConnectSignals(); | ||||
| 
 | ||||
|  | @ -124,19 +130,19 @@ void MarkerLayer::Impl::ReloadMarkers() | |||
|    Q_EMIT self_->NeedsRendering(); | ||||
| } | ||||
| 
 | ||||
| MarkerLayer::MarkerLayer(const std::shared_ptr<MapContext>& context) : | ||||
|     DrawLayer(context, "MarkerLayer"), | ||||
|     p(std::make_unique<MarkerLayer::Impl>(this, context->gl_context())) | ||||
| MarkerLayer::MarkerLayer(const std::shared_ptr<gl::GlContext>& glContext) : | ||||
|     DrawLayer(glContext, "MarkerLayer"), | ||||
|     p(std::make_unique<MarkerLayer::Impl>(this, glContext)) | ||||
| { | ||||
|    AddDrawItem(p->geoIcons_); | ||||
| } | ||||
| 
 | ||||
| MarkerLayer::~MarkerLayer() = default; | ||||
| 
 | ||||
| void MarkerLayer::Initialize() | ||||
| void MarkerLayer::Initialize(const std::shared_ptr<MapContext>& mapContext) | ||||
| { | ||||
|    logger_->debug("Initialize()"); | ||||
|    DrawLayer::Initialize(); | ||||
|    DrawLayer::Initialize(mapContext); | ||||
| 
 | ||||
|    p->set_icon_sheets(); | ||||
|    p->ReloadMarkers(); | ||||
|  | @ -156,11 +162,12 @@ void MarkerLayer::Impl::set_icon_sheets() | |||
|    geoIcons_->FinishIconSheets(); | ||||
| } | ||||
| 
 | ||||
| void MarkerLayer::Render(const QMapLibre::CustomLayerRenderParameters& params) | ||||
| void MarkerLayer::Render(const std::shared_ptr<MapContext>& mapContext, | ||||
|                          const QMapLibre::CustomLayerRenderParameters& params) | ||||
| { | ||||
|    gl::OpenGLFunctions& gl = context()->gl_context()->gl(); | ||||
|    gl::OpenGLFunctions& gl = gl_context()->gl(); | ||||
| 
 | ||||
|    DrawLayer::Render(params); | ||||
|    DrawLayer::Render(mapContext, params); | ||||
| 
 | ||||
|    SCWX_GL_CHECK_ERROR(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat