QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Member Functions | List of all members
QgsVectorLayerRenderer Class Reference

Implementation of threaded rendering for vector layers. More...

#include <qgsvectorlayerrenderer.h>

Inheritance diagram for QgsVectorLayerRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsVectorLayerRenderer (QgsVectorLayer *layer, QgsRenderContext &context)
 
 ~QgsVectorLayerRenderer () override
 
QgsFeatureRendererfeatureRenderer ()
 Returns the feature renderer. More...
 
QgsFeedbackfeedback () const override
 Access to feedback object of the layer renderer (may be nullptr) More...
 
bool forceRasterRender () const override
 Returns true if the renderer must be rendered to a raster paint device (e.g. More...
 
bool render () override
 Do the rendering (based on data stored in the class). More...
 
void setLayerRenderingTimeHint (int time) override
 Sets approximate render time (in ms) for the layer to render. More...
 
- Public Member Functions inherited from QgsMapLayerRenderer
 QgsMapLayerRenderer (const QString &layerID, QgsRenderContext *context=nullptr)
 Constructor for QgsMapLayerRenderer, with the associated layerID and render context. More...
 
virtual ~QgsMapLayerRenderer ()
 
QStringList errors () const
 Returns list of errors (problems) that happened during the rendering. More...
 
virtual QgsFeedbackfeedback () const
 Access to feedback object of the layer renderer (may be nullptr) More...
 
virtual bool forceRasterRender () const
 Returns true if the renderer must be rendered to a raster paint device (e.g. More...
 
bool isReadyToCompose () const
 Returns whether the renderer has already drawn (at least partially) some data. More...
 
QString layerId () const
 Gets access to the ID of the layer rendered by this class. More...
 
virtual bool render ()=0
 Do the rendering (based on data stored in the class). More...
 
QgsRenderContextrenderContext ()
 Returns the render context associated with the renderer. More...
 
const QgsRenderContextrenderContext () const
 Returns the render context associated with the renderer. More...
 
virtual void setLayerRenderingTimeHint (int time)
 Sets approximate render time (in ms) for the layer to render. More...
 
QList< QgsRenderedItemDetails * > takeRenderedItemDetails ()
 Takes the list of rendered item details from the renderer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from QgsMapLayerRenderer
void appendRenderedItemDetails (QgsRenderedItemDetails *details)
 Appends the details of a rendered item to the renderer. More...
 
- Protected Attributes inherited from QgsMapLayerRenderer
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. More...
 
- Static Protected Attributes inherited from QgsMapLayerRenderer
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. More...
 

Detailed Description

Implementation of threaded rendering for vector layers.

Note
not available in Python bindings
Since
QGIS 2.4

Definition at line 58 of file qgsvectorlayerrenderer.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerRenderer()

QgsVectorLayerRenderer::QgsVectorLayerRenderer ( QgsVectorLayer layer,
QgsRenderContext context 
)

Definition at line 47 of file qgsvectorlayerrenderer.cpp.

◆ ~QgsVectorLayerRenderer()

QgsVectorLayerRenderer::~QgsVectorLayerRenderer ( )
overridedefault

Member Function Documentation

◆ featureRenderer()

QgsFeatureRenderer * QgsVectorLayerRenderer::featureRenderer ( )
inline

Returns the feature renderer.

This may be used for tweaking it before the actual rendering of the layer.

Since
QGIS 3.12

Definition at line 71 of file qgsvectorlayerrenderer.h.

◆ feedback()

QgsFeedback * QgsVectorLayerRenderer::feedback ( ) const
overridevirtual

Access to feedback object of the layer renderer (may be nullptr)

Since
QGIS 3.0

Reimplemented from QgsMapLayerRenderer.

Definition at line 187 of file qgsvectorlayerrenderer.cpp.

◆ forceRasterRender()

bool QgsVectorLayerRenderer::forceRasterRender ( ) const
overridevirtual

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 from QgsMapLayerRenderer.

Definition at line 192 of file qgsvectorlayerrenderer.cpp.

◆ render()

bool QgsVectorLayerRenderer::render ( )
overridevirtual

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).

Implements QgsMapLayerRenderer.

Definition at line 197 of file qgsvectorlayerrenderer.cpp.

◆ setLayerRenderingTimeHint()

void QgsVectorLayerRenderer::setLayerRenderingTimeHint ( int  time)
overridevirtual

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 from QgsMapLayerRenderer.

Definition at line 182 of file qgsvectorlayerrenderer.cpp.


The documentation for this class was generated from the following files: