QGIS API Documentation  3.0.2-Girona (307d082)
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
QgsFeatureRenderer Class Referenceabstract

#include <qgsrenderer.h>

Inheritance diagram for QgsFeatureRenderer:
Inheritance graph
[legend]

Public Types

enum  Capability { SymbolLevels = 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3, ScaleDependent = 1 << 4 }
 Used to specify details about a renderer. More...
 

Public Member Functions

virtual ~QgsFeatureRenderer ()
 
virtual QgsFeatureRenderer::Capabilities capabilities ()
 Returns details about internals of this renderer. More...
 
virtual void checkLegendSymbolItem (const QString &key, bool state=true)
 item in symbology was checked More...
 
virtual QgsFeatureRendererclone () const =0
 Create a deep copy of this renderer. More...
 
virtual QString dump () const
 Returns debug information about this renderer. More...
 
virtual const QgsFeatureRendererembeddedRenderer () const
 Returns the current embedded renderer (subrenderer) for this feature renderer. More...
 
virtual QString filter (const QgsFields &fields=QgsFields())
 If a renderer does not require all the features this method may be overridden and return an expression used as where clause. More...
 
virtual bool filterNeedsGeometry () const
 Returns true if this renderer requires the geometry to apply the filter. More...
 
bool forceRasterRender () const
 Returns whether the renderer must render as a raster. More...
 
virtual QString legendClassificationAttribute () const
 If supported by the renderer, return classification attribute for the use in legend. More...
 
virtual QSet< QString > legendKeysForFeature (QgsFeature &feature, QgsRenderContext &context)
 Return legend keys matching a specified feature. More...
 
virtual bool legendSymbolItemChecked (const QString &key)
 items of symbology items in legend is checked More...
 
virtual QgsLegendSymbolList legendSymbolItems () const
 Returns a list of symbology items for the legend. More...
 
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable More...
 
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context)
 Allows for a renderer to modify the extent of a feature request prior to rendering. More...
 
QgsFeatureRequest::OrderBy orderBy () const
 Get the order in which features shall be processed by this renderer. More...
 
bool orderByEnabled () const
 Returns whether custom ordering will be applied before features are processed by this renderer. More...
 
virtual QgsSymboloriginalSymbolForFeature (QgsFeature &feature, QgsRenderContext &context)
 Return symbol for feature. More...
 
virtual QgsSymbolList originalSymbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the renderer. More...
 
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
 Render a feature using this renderer in the given context. More...
 
virtual QDomElement save (QDomDocument &doc, const QgsReadWriteContext &context)
 store renderer info to XML element More...
 
virtual void setEmbeddedRenderer (QgsFeatureRenderer *subRenderer)
 Sets an embedded renderer (subrenderer) for this feature renderer. More...
 
void setForceRasterRender (bool forceRaster)
 Sets whether the renderer should be rendered to a raster destination. More...
 
virtual void setLegendSymbolItem (const QString &key, QgsSymbol *symbol)
 Sets the symbol to be used for a legend symbol item. More...
 
void setOrderBy (const QgsFeatureRequest::OrderBy &orderBy)
 Define the order in which features shall be processed by this renderer. More...
 
void setOrderByEnabled (bool enabled)
 Sets whether custom ordering should be applied before features are processed by this renderer. More...
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for the renderer. More...
 
void setUsingSymbolLevels (bool usingSymbolLevels)
 
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering More...
 
virtual void startRender (QgsRenderContext &context, const QgsFields &fields)
 Must be called when a new render cycle is started. More...
 
virtual void stopRender (QgsRenderContext &context)
 Must be called when a render cycle has finished, to allow the renderer to clean up. More...
 
virtual QgsSymbolsymbolForFeature (QgsFeature &feature, QgsRenderContext &context)=0
 To be overridden. More...
 
virtual QgsSymbolList symbols (QgsRenderContext &context)
 Returns list of symbols used by the renderer. More...
 
virtual QgsSymbolList symbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns list of symbols used for rendering the feature. More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element, const QgsStringMap &props=QgsStringMap()) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
QString type () const
 
virtual QSet< QString > usedAttributes (const QgsRenderContext &context) const =0
 Return a list of attributes required by this renderer. More...
 
bool usingSymbolLevels () const
 
virtual bool willRenderFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns whether the renderer will render a feature or not. More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName, const QgsStringMap &props=QgsStringMap()) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 

Static Public Member Functions

static QgsFeatureRendererdefaultRenderer (QgsWkbTypes::GeometryType geomType)
 return a new renderer - used by default in vector layers More...
 
static QgsFeatureRendererload (QDomElement &symbologyElem, const QgsReadWriteContext &context)
 create a renderer from XML element More...
 
static QgsFeatureRendererloadSld (const QDomNode &node, QgsWkbTypes::GeometryType geomType, QString &errorMessage)
 Create a new renderer according to the information contained in the UserStyle element of a SLD style document. More...
 

Protected Member Functions

 QgsFeatureRenderer (const QString &type)
 
void copyRendererData (QgsFeatureRenderer *destRenderer) const
 Clones generic renderer data to another renderer. More...
 
void renderFeatureWithSymbol (QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
 
void renderVertexMarker (QPointF pt, QgsRenderContext &context)
 render editing vertex marker at specified point More...
 
void renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
 render editing vertex marker for a polygon More...
 
void renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context)
 render editing vertex marker for a polyline More...
 

Static Protected Member Functions

static QPointF _getPoint (QgsRenderContext &context, const QgsPoint &point)
 Creates a point in screen coordinates from a wkb string in map coordinates. More...
 
static void convertSymbolRotation (QgsSymbol *symbol, const QString &field)
 
static void convertSymbolSizeScale (QgsSymbol *symbol, QgsSymbol::ScaleMethod method, const QString &field)
 

Protected Attributes

int mCurrentVertexMarkerSize
 The current size of editing marker. More...
 
int mCurrentVertexMarkerType
 The current type of editing marker. More...
 
bool mForceRaster
 
QgsFeatureRequest::OrderBy mOrderBy
 
bool mOrderByEnabled
 
QgsPaintEffectmPaintEffect = nullptr
 
QString mType
 
bool mUsingSymbolLevels
 

Detailed Description

Definition at line 90 of file qgsrenderer.h.

Member Enumeration Documentation

◆ Capability

Used to specify details about a renderer.

Is returned from the capabilities() method.

Enumerator
SymbolLevels 

Rendering with symbol levels (i.e. implements symbols(), symbolForFeature())

MoreSymbolsPerFeature 

May use more than one symbol to render a feature: symbolsForFeature() will return them.

Filter 

Features may be filtered, i.e. some features may not be rendered (categorized, rule based ...)

ScaleDependent 

Depends on scale if feature will be rendered (rule based )

Definition at line 237 of file qgsrenderer.h.

Constructor & Destructor Documentation

◆ ~QgsFeatureRenderer()

QgsFeatureRenderer::~QgsFeatureRenderer ( )
virtual

Definition at line 70 of file qgsrenderer.cpp.

◆ QgsFeatureRenderer()

QgsFeatureRenderer::QgsFeatureRenderer ( const QString &  type)
protected

Definition at line 58 of file qgsrenderer.cpp.

Member Function Documentation

◆ _getPoint()

QPointF QgsFeatureRenderer::_getPoint ( QgsRenderContext context,
const QgsPoint point 
)
staticprotected

Creates a point in screen coordinates from a wkb string in map coordinates.

Definition at line 43 of file qgsrenderer.cpp.

◆ capabilities()

virtual QgsFeatureRenderer::Capabilities QgsFeatureRenderer::capabilities ( )
inlinevirtual

Returns details about internals of this renderer.

E.g. if you only want to deal with visible features:

if not renderer.capabilities().testFlag(QgsFeatureRenderer.Filter) or renderer.willRenderFeature(feature, context):
deal_with_my_feature()
else:
skip_the_curren_feature()

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, and QgsSingleSymbolRenderer.

Definition at line 259 of file qgsrenderer.h.

◆ checkLegendSymbolItem()

void QgsFeatureRenderer::checkLegendSymbolItem ( const QString &  key,
bool  state = true 
)
virtual

item in symbology was checked

Since
QGIS 2.5

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 312 of file qgsrenderer.cpp.

◆ clone()

virtual QgsFeatureRenderer* QgsFeatureRenderer::clone ( ) const
pure virtual

Create a deep copy of this renderer.

Should be implemented by all subclasses and generate a proper subclass.

Returns
A copy of this renderer

Implemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, Qgs25DRenderer, QgsHeatmapRenderer, QgsNullSymbolRenderer, QgsSingleSymbolRenderer, and QgsPointClusterRenderer.

◆ convertSymbolRotation()

void QgsFeatureRenderer::convertSymbolRotation ( QgsSymbol symbol,
const QString &  field 
)
staticprotected
Note
this function is used to convert old rotations expressions to symbol level DataDefined angle

Definition at line 437 of file qgsrenderer.cpp.

◆ convertSymbolSizeScale()

void QgsFeatureRenderer::convertSymbolSizeScale ( QgsSymbol symbol,
QgsSymbol::ScaleMethod  method,
const QString &  field 
)
staticprotected
Note
this function is used to convert old sizeScale expressions to symbol level DataDefined size

Definition at line 415 of file qgsrenderer.cpp.

◆ copyRendererData()

void QgsFeatureRenderer::copyRendererData ( QgsFeatureRenderer destRenderer) const
protected

Clones generic renderer data to another renderer.

Currently clones

  • Order By
  • Paint Effect
Parameters
destRendererdestination renderer for copied effect

Definition at line 48 of file qgsrenderer.cpp.

◆ defaultRenderer()

QgsFeatureRenderer * QgsFeatureRenderer::defaultRenderer ( QgsWkbTypes::GeometryType  geomType)
static

return a new renderer - used by default in vector layers

Definition at line 75 of file qgsrenderer.cpp.

◆ dump()

QString QgsFeatureRenderer::dump ( ) const
virtual

◆ embeddedRenderer()

virtual const QgsFeatureRenderer* QgsFeatureRenderer::embeddedRenderer ( ) const
inlinevirtual

Returns the current embedded renderer (subrenderer) for this feature renderer.

The base class implementation does not use subrenderers and will always return null.

See also
setEmbeddedRenderer()
Since
QGIS 2.16

Reimplemented in QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 457 of file qgsrenderer.h.

◆ filter()

virtual QString QgsFeatureRenderer::filter ( const QgsFields fields = QgsFields())
inlinevirtual

If a renderer does not require all the features this method may be overridden and return an expression used as where clause.

This will be called once after startRender() and before the first call to renderFeature(). By default this returns a null string and all features will be requested. You do not need to specify the extent in here, this is taken care of separately and will be combined with a filter returned from this method.

Returns
An expression used as where clause

Reimplemented in QgsRuleBasedRenderer, QgsCategorizedSymbolRenderer, and QgsPointDistanceRenderer.

Definition at line 190 of file qgsrenderer.h.

◆ filterNeedsGeometry()

bool QgsFeatureRenderer::filterNeedsGeometry ( ) const
virtual

Returns true if this renderer requires the geometry to apply the filter.

Reimplemented in QgsRuleBasedRenderer.

Definition at line 113 of file qgsrenderer.cpp.

◆ forceRasterRender()

bool QgsFeatureRenderer::forceRasterRender ( ) const
inline

Returns whether the renderer must render as a raster.

Since
QGIS 2.12
See also
setForceRasterRender

Definition at line 397 of file qgsrenderer.h.

◆ legendClassificationAttribute()

virtual QString QgsFeatureRenderer::legendClassificationAttribute ( ) const
inlinevirtual

If supported by the renderer, return classification attribute for the use in legend.

Since
QGIS 2.6

Reimplemented in QgsGraduatedSymbolRenderer, and QgsCategorizedSymbolRenderer.

Definition at line 339 of file qgsrenderer.h.

◆ legendKeysForFeature()

QSet< QString > QgsFeatureRenderer::legendKeysForFeature ( QgsFeature feature,
QgsRenderContext context 
)
virtual

Return legend keys matching a specified feature.

Since
QGIS 2.14

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.

Definition at line 85 of file qgsrenderer.cpp.

◆ legendSymbolItemChecked()

bool QgsFeatureRenderer::legendSymbolItemChecked ( const QString &  key)
virtual

items of symbology items in legend is checked

Since
QGIS 2.5

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 306 of file qgsrenderer.cpp.

◆ legendSymbolItems()

QgsLegendSymbolList QgsFeatureRenderer::legendSymbolItems ( ) const
virtual

Returns a list of symbology items for the legend.

Since
QGIS 2.6

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.

Definition at line 324 of file qgsrenderer.cpp.

◆ legendSymbolItemsCheckable()

bool QgsFeatureRenderer::legendSymbolItemsCheckable ( ) const
virtual

items of symbology items in legend should be checkable

Since
QGIS 2.5

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 301 of file qgsrenderer.cpp.

◆ load()

QgsFeatureRenderer * QgsFeatureRenderer::load ( QDomElement &  symbologyElem,
const QgsReadWriteContext context 
)
static

create a renderer from XML element

Definition at line 142 of file qgsrenderer.cpp.

◆ loadSld()

QgsFeatureRenderer * QgsFeatureRenderer::loadSld ( const QDomNode &  node,
QgsWkbTypes::GeometryType  geomType,
QString &  errorMessage 
)
static

Create a new renderer according to the information contained in the UserStyle element of a SLD style document.

Parameters
nodethe node in the SLD document whose the UserStyle element is a child
geomTypethe geometry type of the features, used to convert Symbolizer elements
errorMessageit will contain the error message if something went wrong
Returns
the renderer

Definition at line 197 of file qgsrenderer.cpp.

◆ modifyRequestExtent()

virtual void QgsFeatureRenderer::modifyRequestExtent ( QgsRectangle extent,
QgsRenderContext context 
)
inlinevirtual

Allows for a renderer to modify the extent of a feature request prior to rendering.

Parameters
extentreference to request's filter extent. Modify extent to change the extent of feature request
contextrender context
Since
QGIS 2.7

Reimplemented in QgsHeatmapRenderer.

Definition at line 374 of file qgsrenderer.h.

◆ orderBy()

QgsFeatureRequest::OrderBy QgsFeatureRenderer::orderBy ( ) const

Get the order in which features shall be processed by this renderer.

Since
QGIS 2.14
Note
this property has no effect if orderByEnabled() is false
See also
orderByEnabled()

Definition at line 395 of file qgsrenderer.cpp.

◆ orderByEnabled()

bool QgsFeatureRenderer::orderByEnabled ( ) const

Returns whether custom ordering will be applied before features are processed by this renderer.

Since
QGIS 2.14
See also
orderBy()
setOrderByEnabled()

Definition at line 405 of file qgsrenderer.cpp.

◆ originalSymbolForFeature()

QgsSymbol * QgsFeatureRenderer::originalSymbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
virtual

Return symbol for feature.

The difference compared to symbolForFeature() is that it returns original symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement of a symbol for use in rendering.

Since
QGIS 2.12

Reimplemented in QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, QgsNullSymbolRenderer, and QgsSingleSymbolRenderer.

Definition at line 80 of file qgsrenderer.cpp.

◆ originalSymbolsForFeature()

QgsSymbolList QgsFeatureRenderer::originalSymbolsForFeature ( QgsFeature feat,
QgsRenderContext context 
)
virtual

Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()

Since
QGIS 2.12

Reimplemented in QgsRuleBasedRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 376 of file qgsrenderer.cpp.

◆ paintEffect()

QgsPaintEffect * QgsFeatureRenderer::paintEffect ( ) const

Returns the current paint effect for the renderer.

Returns
paint effect
Since
QGIS 2.9
See also
setPaintEffect

Definition at line 384 of file qgsrenderer.cpp.

◆ renderFeature()

bool QgsFeatureRenderer::renderFeature ( QgsFeature feature,
QgsRenderContext context,
int  layer = -1,
bool  selected = false,
bool  drawVertexMarker = false 
)
virtual

Render a feature using this renderer in the given context.

Must be called between startRender() and stopRender() calls. Default implementation renders a symbol as determined by symbolForFeature() call. Returns true if the feature has been returned (this is used for example to determine whether the feature may be labelled).

If layer is not -1, the renderer should draw only a particula layer from symbols (in order to support symbol level rendering).

See also
startRender()
stopRender()

Reimplemented in QgsRuleBasedRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsHeatmapRenderer, and QgsNullSymbolRenderer.

Definition at line 118 of file qgsrenderer.cpp.

◆ renderFeatureWithSymbol()

void QgsFeatureRenderer::renderFeatureWithSymbol ( QgsFeature feature,
QgsSymbol symbol,
QgsRenderContext context,
int  layer,
bool  selected,
bool  drawVertexMarker 
)
protected

Definition at line 132 of file qgsrenderer.cpp.

◆ renderVertexMarker()

void QgsFeatureRenderer::renderVertexMarker ( QPointF  pt,
QgsRenderContext context 
)
protected

render editing vertex marker at specified point

Definition at line 340 of file qgsrenderer.cpp.

◆ renderVertexMarkerPolygon()

void QgsFeatureRenderer::renderVertexMarkerPolygon ( QPolygonF &  pts,
QList< QPolygonF > *  rings,
QgsRenderContext context 
)
protected

render editing vertex marker for a polygon

Definition at line 353 of file qgsrenderer.cpp.

◆ renderVertexMarkerPolyline()

void QgsFeatureRenderer::renderVertexMarkerPolyline ( QPolygonF &  pts,
QgsRenderContext context 
)
protected

render editing vertex marker for a polyline

Definition at line 347 of file qgsrenderer.cpp.

◆ save()

QDomElement QgsFeatureRenderer::save ( QDomDocument &  doc,
const QgsReadWriteContext context 
)
virtual

◆ setEmbeddedRenderer()

virtual void QgsFeatureRenderer::setEmbeddedRenderer ( QgsFeatureRenderer subRenderer)
inlinevirtual

Sets an embedded renderer (subrenderer) for this feature renderer.

The base class implementation does nothing with subrenderers, but individual derived classes can use these to modify their behavior.

Parameters
subRendererthe embedded renderer. Ownership will be transferred.
See also
embeddedRenderer()
Since
QGIS 2.16

Reimplemented in QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 449 of file qgsrenderer.h.

◆ setForceRasterRender()

void QgsFeatureRenderer::setForceRasterRender ( bool  forceRaster)
inline

Sets whether the renderer should be rendered to a raster destination.

Parameters
forceRasterset to true if renderer must be drawn on a raster surface. This may be desirable for highly detailed layers where rendering as a vector would result in a large, complex vector output.
See also
forceRasterRender
Since
QGIS 2.12

Definition at line 407 of file qgsrenderer.h.

◆ setLegendSymbolItem()

void QgsFeatureRenderer::setLegendSymbolItem ( const QString &  key,
QgsSymbol symbol 
)
virtual

Sets the symbol to be used for a legend symbol item.

Parameters
keyrule key for legend symbol
symbolnew symbol for legend item. Ownership is transferred to renderer.
Since
QGIS 2.14

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.

Definition at line 318 of file qgsrenderer.cpp.

◆ setOrderBy()

void QgsFeatureRenderer::setOrderBy ( const QgsFeatureRequest::OrderBy orderBy)

Define the order in which features shall be processed by this renderer.

Note
this property has no effect if orderByEnabled() is false
Since
QGIS 2.14
See also
setOrderByEnabled()

Definition at line 400 of file qgsrenderer.cpp.

◆ setOrderByEnabled()

void QgsFeatureRenderer::setOrderByEnabled ( bool  enabled)

Sets whether custom ordering should be applied before features are processed by this renderer.

Parameters
enabledset to true to enable custom feature ordering
Since
QGIS 2.14
See also
setOrderBy()
orderByEnabled()

Definition at line 410 of file qgsrenderer.cpp.

◆ setPaintEffect()

void QgsFeatureRenderer::setPaintEffect ( QgsPaintEffect effect)

Sets the current paint effect for the renderer.

Parameters
effectpaint effect. Ownership is transferred to the renderer.
Since
QGIS 2.9
See also
paintEffect

Definition at line 389 of file qgsrenderer.cpp.

◆ setUsingSymbolLevels()

void QgsFeatureRenderer::setUsingSymbolLevels ( bool  usingSymbolLevels)
inline

Definition at line 269 of file qgsrenderer.h.

◆ setVertexMarkerAppearance()

void QgsFeatureRenderer::setVertexMarkerAppearance ( int  type,
int  size 
)

set type and size of editing vertex markers for subsequent rendering

Definition at line 329 of file qgsrenderer.cpp.

◆ startRender()

void QgsFeatureRenderer::startRender ( QgsRenderContext context,
const QgsFields fields 
)
virtual

Must be called when a new render cycle is started.

A call to startRender() must always be followed by a corresponding call to stopRender() after all features have been rendered.

Parameters
contextAdditional information passed to the renderer about the job which will be rendered
fieldsThe fields available for rendering
See also
stopRender()
Warning
This method is not thread safe. Before calling startRender() in a non-main thread, the renderer should instead be cloned and startRender()/stopRender() called on the clone.

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, QgsHeatmapRenderer, Qgs25DRenderer, QgsPointClusterRenderer, and QgsSingleSymbolRenderer.

Definition at line 92 of file qgsrenderer.cpp.

◆ stopRender()

void QgsFeatureRenderer::stopRender ( QgsRenderContext context)
virtual

Must be called when a render cycle has finished, to allow the renderer to clean up.

Calls to stopRender() must always be preceded by a call to startRender().

Warning
This method is not thread safe. Before calling startRender() in a non-main thread, the renderer should instead be cloned and startRender()/stopRender() called on the clone.
See also
startRender()

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, QgsHeatmapRenderer, Qgs25DRenderer, QgsNullSymbolRenderer, QgsPointClusterRenderer, and QgsSingleSymbolRenderer.

Definition at line 106 of file qgsrenderer.cpp.

◆ symbolForFeature()

virtual QgsSymbol* QgsFeatureRenderer::symbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
pure virtual

To be overridden.

Must be called between startRender() and stopRender() calls.

Parameters
featurefeature
contextrender context
Returns
returns pointer to symbol or 0 if symbol was not found
Since
QGIS 2.12

Implemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, QgsHeatmapRenderer, Qgs25DRenderer, QgsNullSymbolRenderer, and QgsSingleSymbolRenderer.

◆ symbols()

virtual QgsSymbolList QgsFeatureRenderer::symbols ( QgsRenderContext context)
inlinevirtual

Returns list of symbols used by the renderer.

Parameters
contextrender context
Since
QGIS 2.12

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsHeatmapRenderer, QgsSingleSymbolRenderer, Qgs25DRenderer, and QgsNullSymbolRenderer.

Definition at line 266 of file qgsrenderer.h.

◆ symbolsForFeature()

QgsSymbolList QgsFeatureRenderer::symbolsForFeature ( QgsFeature feat,
QgsRenderContext context 
)
virtual

Returns list of symbols used for rendering the feature.

For renderers that do not support MoreSymbolsPerFeature it is more efficient to use symbolForFeature()

Since
QGIS 2.12

Reimplemented in QgsRuleBasedRenderer, QgsInvertedPolygonRenderer, and QgsPointDistanceRenderer.

Definition at line 368 of file qgsrenderer.cpp.

◆ toSld()

virtual void QgsFeatureRenderer::toSld ( QDomDocument &  doc,
QDomElement &  element,
const QgsStringMap props = QgsStringMap() 
) const
inlinevirtual

used from subclasses to create SLD Rule elements following SLD v1.1 specs

Reimplemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, and QgsSingleSymbolRenderer.

Definition at line 297 of file qgsrenderer.h.

◆ type()

QString QgsFeatureRenderer::type ( ) const
inline

Definition at line 126 of file qgsrenderer.h.

◆ usedAttributes()

virtual QSet<QString> QgsFeatureRenderer::usedAttributes ( const QgsRenderContext context) const
pure virtual

Return a list of attributes required by this renderer.

Attributes not listed in here may not have been requested from the provider at rendering time.

Returns
A set of attributes

Implemented in QgsRuleBasedRenderer, QgsGraduatedSymbolRenderer, QgsCategorizedSymbolRenderer, QgsPointDistanceRenderer, QgsInvertedPolygonRenderer, QgsHeatmapRenderer, QgsPointDisplacementRenderer, Qgs25DRenderer, QgsNullSymbolRenderer, QgsPointClusterRenderer, and QgsSingleSymbolRenderer.

◆ usingSymbolLevels()

bool QgsFeatureRenderer::usingSymbolLevels ( ) const
inline

Definition at line 268 of file qgsrenderer.h.

◆ willRenderFeature()

bool QgsFeatureRenderer::willRenderFeature ( QgsFeature feat,
QgsRenderContext context 
)
virtual

Returns whether the renderer will render a feature or not.

Must be called between startRender() and stopRender() calls. Default implementation uses symbolForFeature().

Since
QGIS 2.12

Reimplemented in QgsRuleBasedRenderer, QgsInvertedPolygonRenderer, QgsPointDistanceRenderer, and QgsNullSymbolRenderer.

Definition at line 335 of file qgsrenderer.cpp.

◆ writeSld()

QDomElement QgsFeatureRenderer::writeSld ( QDomDocument &  doc,
const QString &  styleName,
const QgsStringMap props = QgsStringMap() 
) const
virtual

create the SLD UserStyle element following the SLD v1.1 specs with the given name

Since
QGIS 2.8

Definition at line 286 of file qgsrenderer.cpp.

Member Data Documentation

◆ mCurrentVertexMarkerSize

int QgsFeatureRenderer::mCurrentVertexMarkerSize
protected

The current size of editing marker.

Definition at line 499 of file qgsrenderer.h.

◆ mCurrentVertexMarkerType

int QgsFeatureRenderer::mCurrentVertexMarkerType
protected

The current type of editing marker.

Definition at line 497 of file qgsrenderer.h.

◆ mForceRaster

bool QgsFeatureRenderer::mForceRaster
protected

Definition at line 503 of file qgsrenderer.h.

◆ mOrderBy

QgsFeatureRequest::OrderBy QgsFeatureRenderer::mOrderBy
protected

Definition at line 517 of file qgsrenderer.h.

◆ mOrderByEnabled

bool QgsFeatureRenderer::mOrderByEnabled
protected

Definition at line 519 of file qgsrenderer.h.

◆ mPaintEffect

QgsPaintEffect* QgsFeatureRenderer::mPaintEffect = nullptr
protected

Definition at line 501 of file qgsrenderer.h.

◆ mType

QString QgsFeatureRenderer::mType
protected

Definition at line 492 of file qgsrenderer.h.

◆ mUsingSymbolLevels

bool QgsFeatureRenderer::mUsingSymbolLevels
protected

Definition at line 494 of file qgsrenderer.h.


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