QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Member Functions | Protected Attributes | 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 ()=default
 
QStringList errors () const
 Returns list of errors (problems) that happened during the rendering. 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...
 
QgsRenderContextrenderContext ()
 Returns the render context associated with the renderer. More...
 
const QgsRenderContextrenderContext () const
 Returns the render context associated with the renderer. More...
 

Protected Attributes

bool mApplyClipFilter = false
 
bool mApplyClipGeometries = false
 
bool mApplyLabelClipGeometries = false
 
QSet< QString > mAttrNames
 
bool mBlockRenderUpdates = false
 
QgsGeometry mClipFeatureGeom
 
QgsGeometry mClipFilterGeom
 
QList< QgsMapClippingRegionmClippingRegions
 
QgsVectorLayerDiagramProvidermDiagramProvider = nullptr
 used with new labeling engine (QgsLabelingEngine): provider for diagrams. More...
 
bool mDiagrams
 used with new labeling engine (QgsPalLabeling): whether diagrams are enabled More...
 
bool mDrawVertexMarkers
 
QElapsedTimer mElapsedTimer
 
QPainter::CompositionMode mFeatureBlendMode
 
QgsFields mFields
 
bool mForceRasterRender = false
 
QgsWkbTypes::GeometryType mGeometryType
 
std::unique_ptr< QgsVectorLayerRendererInterruptionCheckermInterruptionChecker
 
QgsGeometry mLabelClipFeatureGeom
 
bool mLabeling
 used with old labeling engine (QgsPalLabeling): whether labeling is enabled More...
 
QgsVectorLayerLabelProvidermLabelProvider = nullptr
 used with new labeling engine (QgsLabelingEngine): provider for labels. More...
 
QgsVectorLayermLayer = nullptr
 The rendered layer. More...
 
QgsFeatureRenderermRenderer = nullptr
 
std::vector< std::unique_ptr< QgsFeatureRenderer > > mRenderers
 
int mRenderTimeHint = 0
 
QgsFeatureIds mSelectedFeatureIds
 
bool mSimplifyGeometry
 
QgsVectorSimplifyMethod mSimplifyMethod
 
std::unique_ptr< QgsVectorLayerFeatureSourcemSource
 
QString mTemporalFilter
 
bool mVertexMarkerOnlyForSelection
 
double mVertexMarkerSize = 2.0
 
int mVertexMarkerStyle = 0
 
- 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...
 

Additional Inherited Members

- 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 76 of file qgsvectorlayerrenderer.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerRenderer()

QgsVectorLayerRenderer::QgsVectorLayerRenderer ( QgsVectorLayer layer,
QgsRenderContext context 
)

Definition at line 48 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 89 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 191 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 196 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 201 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 186 of file qgsvectorlayerrenderer.cpp.

Member Data Documentation

◆ mApplyClipFilter

bool QgsVectorLayerRenderer::mApplyClipFilter = false
protected

Definition at line 171 of file qgsvectorlayerrenderer.h.

◆ mApplyClipGeometries

bool QgsVectorLayerRenderer::mApplyClipGeometries = false
protected

Definition at line 173 of file qgsvectorlayerrenderer.h.

◆ mApplyLabelClipGeometries

bool QgsVectorLayerRenderer::mApplyLabelClipGeometries = false
protected

Definition at line 175 of file qgsvectorlayerrenderer.h.

◆ mAttrNames

QSet<QString> QgsVectorLayerRenderer::mAttrNames
protected

Definition at line 145 of file qgsvectorlayerrenderer.h.

◆ mBlockRenderUpdates

bool QgsVectorLayerRenderer::mBlockRenderUpdates = false
protected

Definition at line 179 of file qgsvectorlayerrenderer.h.

◆ mClipFeatureGeom

QgsGeometry QgsVectorLayerRenderer::mClipFeatureGeom
protected

Definition at line 172 of file qgsvectorlayerrenderer.h.

◆ mClipFilterGeom

QgsGeometry QgsVectorLayerRenderer::mClipFilterGeom
protected

Definition at line 170 of file qgsvectorlayerrenderer.h.

◆ mClippingRegions

QList< QgsMapClippingRegion > QgsVectorLayerRenderer::mClippingRegions
protected

Definition at line 169 of file qgsvectorlayerrenderer.h.

◆ mDiagramProvider

QgsVectorLayerDiagramProvider* QgsVectorLayerRenderer::mDiagramProvider = nullptr
protected

used with new labeling engine (QgsLabelingEngine): provider for diagrams.

may be nullptr. no need to delete: if exists it is owned by labeling engine

Definition at line 162 of file qgsvectorlayerrenderer.h.

◆ mDiagrams

bool QgsVectorLayerRenderer::mDiagrams
protected

used with new labeling engine (QgsPalLabeling): whether diagrams are enabled

Definition at line 150 of file qgsvectorlayerrenderer.h.

◆ mDrawVertexMarkers

bool QgsVectorLayerRenderer::mDrawVertexMarkers
protected

Definition at line 138 of file qgsvectorlayerrenderer.h.

◆ mElapsedTimer

QElapsedTimer QgsVectorLayerRenderer::mElapsedTimer
protected

Definition at line 180 of file qgsvectorlayerrenderer.h.

◆ mFeatureBlendMode

QPainter::CompositionMode QgsVectorLayerRenderer::mFeatureBlendMode
protected

Definition at line 164 of file qgsvectorlayerrenderer.h.

◆ mFields

QgsFields QgsVectorLayerRenderer::mFields
protected

Definition at line 127 of file qgsvectorlayerrenderer.h.

◆ mForceRasterRender

bool QgsVectorLayerRenderer::mForceRasterRender = false
protected

Definition at line 176 of file qgsvectorlayerrenderer.h.

◆ mGeometryType

QgsWkbTypes::GeometryType QgsVectorLayerRenderer::mGeometryType
protected

Definition at line 143 of file qgsvectorlayerrenderer.h.

◆ mInterruptionChecker

std::unique_ptr< QgsVectorLayerRendererInterruptionChecker > QgsVectorLayerRenderer::mInterruptionChecker
protected

Definition at line 122 of file qgsvectorlayerrenderer.h.

◆ mLabelClipFeatureGeom

QgsGeometry QgsVectorLayerRenderer::mLabelClipFeatureGeom
protected

Definition at line 174 of file qgsvectorlayerrenderer.h.

◆ mLabeling

bool QgsVectorLayerRenderer::mLabeling
protected

used with old labeling engine (QgsPalLabeling): whether labeling is enabled

Definition at line 148 of file qgsvectorlayerrenderer.h.

◆ mLabelProvider

QgsVectorLayerLabelProvider* QgsVectorLayerRenderer::mLabelProvider = nullptr
protected

used with new labeling engine (QgsLabelingEngine): provider for labels.

may be nullptr. no need to delete: if exists it is owned by labeling engine

Definition at line 156 of file qgsvectorlayerrenderer.h.

◆ mLayer

QgsVectorLayer* QgsVectorLayerRenderer::mLayer = nullptr
protected

The rendered layer.

Definition at line 125 of file qgsvectorlayerrenderer.h.

◆ mRenderer

QgsFeatureRenderer* QgsVectorLayerRenderer::mRenderer = nullptr
protected

Definition at line 135 of file qgsvectorlayerrenderer.h.

◆ mRenderers

std::vector< std::unique_ptr< QgsFeatureRenderer> > QgsVectorLayerRenderer::mRenderers
protected

Definition at line 136 of file qgsvectorlayerrenderer.h.

◆ mRenderTimeHint

int QgsVectorLayerRenderer::mRenderTimeHint = 0
protected

Definition at line 178 of file qgsvectorlayerrenderer.h.

◆ mSelectedFeatureIds

QgsFeatureIds QgsVectorLayerRenderer::mSelectedFeatureIds
protected

Definition at line 129 of file qgsvectorlayerrenderer.h.

◆ mSimplifyGeometry

bool QgsVectorLayerRenderer::mSimplifyGeometry
protected

Definition at line 167 of file qgsvectorlayerrenderer.h.

◆ mSimplifyMethod

QgsVectorSimplifyMethod QgsVectorLayerRenderer::mSimplifyMethod
protected

Definition at line 166 of file qgsvectorlayerrenderer.h.

◆ mSource

std::unique_ptr< QgsVectorLayerFeatureSource > QgsVectorLayerRenderer::mSource
protected

Definition at line 133 of file qgsvectorlayerrenderer.h.

◆ mTemporalFilter

QString QgsVectorLayerRenderer::mTemporalFilter
protected

Definition at line 131 of file qgsvectorlayerrenderer.h.

◆ mVertexMarkerOnlyForSelection

bool QgsVectorLayerRenderer::mVertexMarkerOnlyForSelection
protected

Definition at line 139 of file qgsvectorlayerrenderer.h.

◆ mVertexMarkerSize

double QgsVectorLayerRenderer::mVertexMarkerSize = 2.0
protected

Definition at line 141 of file qgsvectorlayerrenderer.h.

◆ mVertexMarkerStyle

int QgsVectorLayerRenderer::mVertexMarkerStyle = 0
protected

Definition at line 140 of file qgsvectorlayerrenderer.h.


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