Class: QgsMapLayerRenderer¶
- class qgis.core.QgsMapLayerRenderer(layerID: str, context: QgsRenderContext = None)¶
Bases:
sip.wrapper
Constructor for
QgsMapLayerRenderer
, with the associatedlayerID
and rendercontext
.QgsMapLayerRenderer(
QgsMapLayerRenderer
)Base class for utility classes that encapsulate information necessary for rendering of map layers.
The rendering is typically done in a background thread, so it is necessary to keep all structures required for rendering away from the original map layer because it may change any time.
Because the data needs to be copied (to avoid the need for locking), it is highly desirable to use copy-on-write where possible. This way, the overhead of copying (both memory and CPU) will be kept low. Qt containers and various Qt classes use implicit sharing.
The scenario will be:
- # renderer job (doing preparation in the GUI thread) calls
QgsMapLayer.createMapRenderer()
and gets instance of this class. The instance is initialized at that point and should not need additional calls to QgsVectorLayer.
# renderer job (still in GUI thread) stores the renderer for later use. # renderer job (in worker thread) calls
QgsMapLayerRenderer.render()
# renderer job (again in GUI thread) will checkerrors()
and report themNew in version 2.4:
Methods
Returns list of errors (problems) that happened during the rendering
Access to feedback object of the layer renderer (may be
None
)Gets access to the ID of the layer rendered by this class
Do the rendering (based on data stored in the class)
Returns the render context associated with the renderer.
- errors(self) List[str] ¶
Returns list of errors (problems) that happened during the rendering
- Return type
List[str]
- feedback(self) QgsFeedback ¶
Access to feedback object of the layer renderer (may be
None
)New in version 3.0.
- Return type
- layerId(self) str ¶
Gets access to the ID of the layer rendered by this class
- Return type
str
- render(self) bool ¶
Do the rendering (based on data stored in the class)
- Return type
bool
- renderContext(self) QgsRenderContext ¶
Returns the render context associated with the renderer.
New in version 3.10.
- Return type