Base class for utility classes that encapsulate information necessary for rendering of map layers.
More...
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 check errors() and report them
- Since
- QGIS 2.4
Definition at line 54 of file qgsmaplayerrenderer.h.
virtual bool QgsMapLayerRenderer::forceRasterRender |
( |
| ) |
const |
|
inlinevirtual |
Returns true
if the renderer must be rendered to a raster paint device (e.g.
QImage).
Some layer settings require layers to be effectively "flattened" while rendering maps, which is achieved by first rendering the layer onto a raster paint device and then compositing the resultant image onto the final map render.
E.g. if a layer contains features with transparency or alternative blending modes, and the effects of these opacity or blending modes should be restricted to only affect other features within the SAME layer, then a flattened raster based render is required.
Subclasses should return true
whenever their corresponding layer settings require the layer to always be rendered using a raster paint device.
- Since
- QGIS 3.18
Reimplemented in QgsAnnotationLayerRenderer, QgsMeshLayerRenderer, QgsPointCloudLayerRenderer, QgsGroupLayerRenderer, QgsRasterLayerRenderer, QgsVectorLayerRenderer, and QgsVectorTileLayerRenderer.
Definition at line 92 of file qgsmaplayerrenderer.h.
virtual void QgsMapLayerRenderer::setLayerRenderingTimeHint |
( |
int |
time | ) |
|
|
inlinevirtual |
Sets approximate render time (in ms) for the layer to render.
This can be used to specifies a hint at the expected render times for the layer, so that the individual layer renderer subclasses can apply heuristics and determine appropriate update intervals during the render operation.
- Note
- Not available in Python bindings.
- Since
- QGIS 3.18
Reimplemented in QgsPointCloudLayerRenderer, and QgsVectorLayerRenderer.
Definition at line 139 of file qgsmaplayerrenderer.h.