QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
Base class for utility classes that encapsulate information necessary for rendering of map layers. More...
#include <qgsmaplayerrenderer.h>
Public Member Functions | |
QgsMapLayerRenderer (const QString &layerID, QgsRenderContext *context=nullptr) | |
Constructor for QgsMapLayerRenderer, with the associated layerID and render context. | |
virtual | ~QgsMapLayerRenderer () |
QStringList | errors () const |
Returns list of errors (problems) that happened during the rendering. | |
virtual QgsFeedback * | feedback () const |
Access to feedback object of the layer renderer (may be nullptr ) | |
virtual Qgis::MapLayerRendererFlags | flags () const |
Returns flags which control how the map layer rendering behaves. | |
virtual bool | forceRasterRender () const |
Returns true if the renderer must be rendered to a raster paint device (e.g. | |
bool | isReadyToCompose () const |
Returns whether the renderer has already drawn (at least partially) some data. | |
QString | layerId () const |
Gets access to the ID of the layer rendered by this class. | |
virtual bool | render ()=0 |
Do the rendering (based on data stored in the class). | |
QgsRenderContext * | renderContext () |
Returns the render context associated with the renderer. | |
const QgsRenderContext * | renderContext () const |
Returns the render context associated with the renderer. | |
virtual void | setLayerRenderingTimeHint (int time) |
Sets approximate render time (in ms) for the layer to render. | |
QList< QgsRenderedItemDetails * > | takeRenderedItemDetails () |
Takes the list of rendered item details from the renderer. | |
Protected Member Functions | |
void | appendRenderedItemDetails (QgsRenderedItemDetails *details) |
Appends the details of a rendered item to the renderer. | |
Protected Attributes | |
QStringList | mErrors |
QString | mLayerID |
bool | mReadyToCompose = true |
The flag must be set to false in renderer's constructor if wants to use the smarter map redraws functionality https://github.com/qgis/QGIS-Enhancement-Proposals/issues/181. | |
Static Protected Attributes | |
static constexpr int | MAX_TIME_TO_USE_CACHED_PREVIEW_IMAGE = 3000 |
Maximum time (in ms) to allow display of a previously cached preview image while rendering layers, before switching to a progressive rendering display. | |
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:
Definition at line 51 of file qgsmaplayerrenderer.h.
|
inline |
Constructor for QgsMapLayerRenderer, with the associated layerID and render context.
Definition at line 58 of file qgsmaplayerrenderer.h.
|
virtualdefault |
|
protected |
Appends the details of a rendered item to the renderer.
Rendered item details can be retrieved by calling takeRenderedItemDetails().
Ownership of details is transferred to the renderer.
Definition at line 42 of file qgsmaplayerrenderer.cpp.
|
inline |
Returns list of errors (problems) that happened during the rendering.
Definition at line 104 of file qgsmaplayerrenderer.h.
|
virtual |
Access to feedback object of the layer renderer (may be nullptr
)
Reimplemented in QgsAnnotationLayerRenderer, QgsMeshLayerRenderer, QgsPointCloudLayerRenderer, QgsGroupLayerRenderer, QgsRasterLayerRenderer, QgsTiledSceneLayerRenderer, QgsVectorLayerRenderer, and QgsVectorTileLayerRenderer.
Definition at line 32 of file qgsmaplayerrenderer.cpp.
|
virtual |
Returns flags which control how the map layer rendering behaves.
Reimplemented in QgsPointCloudLayerRenderer, QgsTiledSceneLayerRenderer, and QgsVectorLayerRenderer.
Definition at line 27 of file qgsmaplayerrenderer.cpp.
|
virtual |
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.
Reimplemented in QgsAnnotationLayerRenderer, QgsMeshLayerRenderer, QgsPointCloudLayerRenderer, QgsGroupLayerRenderer, QgsRasterLayerRenderer, QgsTiledSceneLayerRenderer, QgsVectorLayerRenderer, and QgsVectorTileLayerRenderer.
Definition at line 22 of file qgsmaplayerrenderer.cpp.
|
inline |
Returns whether the renderer has already drawn (at least partially) some data.
Definition at line 130 of file qgsmaplayerrenderer.h.
|
inline |
Gets access to the ID of the layer rendered by this class.
Definition at line 107 of file qgsmaplayerrenderer.h.
|
pure virtual |
Do the rendering (based on data stored in the class).
Returns true
if the layer was completely rendered successfully (i.e. the render was not canceled early).
Implemented in QgsAnnotationLayerRenderer, QgsMeshLayerRenderer, QgsPointCloudLayerRenderer, QgsGroupLayerRenderer, QgsRasterLayerRenderer, QgsTiledSceneLayerRenderer, QgsVectorLayerRenderer, and QgsVectorTileLayerRenderer.
|
inline |
Returns the render context associated with the renderer.
Definition at line 114 of file qgsmaplayerrenderer.h.
|
inline |
Returns the render context associated with the renderer.
Definition at line 122 of file qgsmaplayerrenderer.h.
|
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.
Reimplemented in QgsPointCloudLayerRenderer, and QgsVectorLayerRenderer.
Definition at line 142 of file qgsmaplayerrenderer.h.
QList< QgsRenderedItemDetails * > QgsMapLayerRenderer::takeRenderedItemDetails | ( | ) |
Takes the list of rendered item details from the renderer.
Ownership of items is transferred to the caller.
Definition at line 37 of file qgsmaplayerrenderer.cpp.
|
staticconstexprprotected |
Maximum time (in ms) to allow display of a previously cached preview image while rendering layers, before switching to a progressive rendering display.
Definition at line 184 of file qgsmaplayerrenderer.h.
|
protected |
Definition at line 155 of file qgsmaplayerrenderer.h.
|
protected |
Definition at line 156 of file qgsmaplayerrenderer.h.
|
protected |
The flag must be set to false in renderer's constructor if wants to use the smarter map redraws functionality https://github.com/qgis/QGIS-Enhancement-Proposals/issues/181.
The flag must be set to true by renderer when the data is fetched and the renderer actually started to update the destination image.
When the flag is set to false, the image from QgsMapRendererCache is used instead to avoid flickering.
Definition at line 174 of file qgsmaplayerrenderer.h.