QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | Protected Attributes | List of all members
QgsMapLayerRenderer Class Referenceabstract

Base class for utility classes that encapsulate information necessary for rendering of map layers. More...

#include <qgsmaplayerrenderer.h>

Inheritance diagram for QgsMapLayerRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsMapLayerRenderer (const QString &layerID)
 
virtual ~QgsMapLayerRenderer ()
 
QStringList errors () const
 Return list of errors (problems) that happened during the rendering. More...
 
virtual QgsFeedbackfeedback () const
 Access to feedback object of the layer renderer (may be null) More...
 
QString layerID () const
 Get 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...
 

Protected Attributes

QStringList mErrors
 
QString mLayerID
 

Detailed Description

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), is 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:

  1. 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.
  2. renderer job (still in GUI thread) stores the renderer for later use.
  3. renderer job (in worker thread) calls QgsMapLayerRenderer::render()
  4. renderer job (again in GUI thread) will check errors() and report them
Note
added in 2.4

Definition at line 45 of file qgsmaplayerrenderer.h.

Constructor & Destructor Documentation

◆ QgsMapLayerRenderer()

QgsMapLayerRenderer::QgsMapLayerRenderer ( const QString layerID)
inline

Definition at line 48 of file qgsmaplayerrenderer.h.

◆ ~QgsMapLayerRenderer()

virtual QgsMapLayerRenderer::~QgsMapLayerRenderer ( )
inlinevirtual

Definition at line 49 of file qgsmaplayerrenderer.h.

Member Function Documentation

◆ errors()

QStringList QgsMapLayerRenderer::errors ( ) const
inline

Return list of errors (problems) that happened during the rendering.

Definition at line 59 of file qgsmaplayerrenderer.h.

◆ feedback()

virtual QgsFeedback* QgsMapLayerRenderer::feedback ( ) const
inlinevirtual

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

Note
added in QGIS 2.18

Reimplemented in QgsRasterLayerRenderer.

Definition at line 56 of file qgsmaplayerrenderer.h.

◆ layerID()

QString QgsMapLayerRenderer::layerID ( ) const
inline

Get access to the ID of the layer rendered by this class.

Definition at line 62 of file qgsmaplayerrenderer.h.

◆ render()

virtual bool QgsMapLayerRenderer::render ( )
pure virtual

Do the rendering (based on data stored in the class)

Implemented in QgsVectorLayerRenderer, QgsPluginLayerRenderer, and QgsRasterLayerRenderer.

Member Data Documentation

◆ mErrors

QStringList QgsMapLayerRenderer::mErrors
protected

Definition at line 65 of file qgsmaplayerrenderer.h.

◆ mLayerID

QString QgsMapLayerRenderer::mLayerID
protected

Definition at line 66 of file qgsmaplayerrenderer.h.


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