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

#include <qgsrendererv2.h>

Inheritance diagram for QgsFeatureRendererV2:
Inheritance graph
[legend]

Public Types

enum  Capabilities {
  SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3,
  ScaleDependent = 1 << 4
}
 

Public Member Functions

virtual ~QgsFeatureRendererV2 ()
 
virtual int capabilities ()
 returns bitwise OR-ed capabilities of the renderer More...
 
virtual void checkLegendSymbolItem (const QString &key, bool state=true)
 item in symbology was checked More...
 
virtual QgsFeatureRendererV2clone () const =0
 
virtual QString dump () const
 for debugging More...
 
virtual const QgsFeatureRendererV2embeddedRenderer () 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< QStringlegendKeysForFeature (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 (double scaleDenominator=-1, const QString &rule="")
 return a list of item text / symbol More...
 
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable More...
 
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const
 Return a list of symbology items for the legend. More...
 
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize)
 return a list of symbology items for the legend 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 Q_DECL_DEPRECATED QgsSymbolV2originalSymbolForFeature (QgsFeature &feature)
 Return symbol for feature. More...
 
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feature, QgsRenderContext &context)
 Return symbol for feature. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
virtual QgsSymbolV2List 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 Q_DECL_DEPRECATED QString rotationField () const
 return rotation field name (or empty string if not set or not supported by renderer) More...
 
virtual QDomElement save (QDomDocument &doc)
 store renderer info to XML element More...
 
virtual void setEmbeddedRenderer (QgsFeatureRendererV2 *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, QgsSymbolV2 *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...
 
virtual Q_DECL_DEPRECATED void setRotationField (const QString &fieldName)
 sets rotation field of renderer (if supported by 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)=0
 Needs to be called when a new render cycle is started. More...
 
virtual Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
 
virtual void stopRender (QgsRenderContext &context)=0
 Needs to be called when a render cycle has finished to clean up. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2symbolForFeature (QgsFeature &feature)
 To be overridden. More...
 
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature, QgsRenderContext &context)
 To be overridden. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbols ()
 For symbol levels. More...
 
virtual QgsSymbolV2List symbols (QgsRenderContext &context)
 Returns list of symbols used by the renderer. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 Returns list of symbols used for rendering the feature. More...
 
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns list of symbols used for rendering the feature. More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
QString type () const
 
virtual QList< QStringusedAttributes ()=0
 Returns a set of attributes required for this renderer. More...
 
bool usingSymbolLevels () const
 
virtual Q_DECL_DEPRECATED bool willRenderFeature (QgsFeature &feat)
 Returns whether the renderer will render a feature or not. More...
 
virtual bool willRenderFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns whether the renderer will render a feature or not. More...
 
virtual Q_DECL_DEPRECATED QDomElement writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const
 create the SLD UserStyle element following the SLD v1.1 specs More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName, const QgsStringMap &props) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 

Static Public Member Functions

static QgsFeatureRendererV2defaultRenderer (QGis::GeometryType geomType)
 return a new renderer - used by default in vector layers More...
 
static QgsFeatureRendererV2load (QDomElement &symbologyElem)
 create a renderer from XML element More...
 
static QgsFeatureRendererV2loadSld (const QDomNode &node, QGis::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

 QgsFeatureRendererV2 (const QString &type)
 
Q_DECL_DEPRECATED void copyPaintEffect (QgsFeatureRendererV2 *destRenderer) const
 Copies paint effect of this renderer to another renderer. More...
 
void copyRendererData (QgsFeatureRendererV2 *destRenderer) const
 Clones generic renderer data to another renderer. More...
 
void renderFeatureWithSymbol (QgsFeature &feature, QgsSymbolV2 *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...
 
void setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod)
 

Static Protected Member Functions

static QgsConstWkbPtr _getLineString (QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
 Creates a line string in screen coordinates from a wkb string in map coordinates. More...
 
static QgsConstWkbPtr _getPoint (QPointF &pt, QgsRenderContext &context, QgsConstWkbPtr &wkb)
 Creates a point in screen coordinates from a wkb string in map coordinates. More...
 
static QgsConstWkbPtr _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
 Creates a polygon in screen coordinates from a wkb string in map coordinates. More...
 
static void convertSymbolRotation (QgsSymbolV2 *symbol, const QString &field)
 
static void convertSymbolSizeScale (QgsSymbolV2 *symbol, QgsSymbolV2::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
 
QString mType
 
bool mUsingSymbolLevels
 

Detailed Description

Definition at line 84 of file qgsrendererv2.h.

Member Enumeration Documentation

◆ Capabilities

Enumerator
SymbolLevels 

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

RotationField 

rotate symbols by attribute value

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 202 of file qgsrendererv2.h.

Constructor & Destructor Documentation

◆ ~QgsFeatureRendererV2()

QgsFeatureRendererV2::~QgsFeatureRendererV2 ( )
virtual

Definition at line 106 of file qgsrendererv2.cpp.

◆ QgsFeatureRendererV2()

QgsFeatureRendererV2::QgsFeatureRendererV2 ( const QString type)
protected

Definition at line 93 of file qgsrendererv2.cpp.

Member Function Documentation

◆ _getLineString()

QgsConstWkbPtr QgsFeatureRendererV2::_getLineString ( QPolygonF pts,
QgsRenderContext context,
QgsConstWkbPtr wkb,
bool  clipToExtent = true 
)
staticprotected

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

Definition at line 50 of file qgsrendererv2.cpp.

◆ _getPoint()

QgsConstWkbPtr QgsFeatureRendererV2::_getPoint ( QPointF pt,
QgsRenderContext context,
QgsConstWkbPtr wkb 
)
staticprotected

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

Definition at line 45 of file qgsrendererv2.cpp.

◆ _getPolygon()

QgsConstWkbPtr QgsFeatureRendererV2::_getPolygon ( QPolygonF pts,
QList< QPolygonF > &  holes,
QgsRenderContext context,
QgsConstWkbPtr wkb,
bool  clipToExtent = true 
)
staticprotected

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

Definition at line 55 of file qgsrendererv2.cpp.

◆ capabilities()

virtual int QgsFeatureRendererV2::capabilities ( )
inlinevirtual

◆ checkLegendSymbolItem()

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

item in symbology was checked

Note
added in 2.5

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 380 of file qgsrendererv2.cpp.

◆ clone()

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

◆ convertSymbolRotation()

void QgsFeatureRendererV2::convertSymbolRotation ( QgsSymbolV2 symbol,
const QString field 
)
staticprotected
Note
this function is used to convert old rotations expresssions to symbol level DataDefined angle

Definition at line 549 of file qgsrendererv2.cpp.

◆ convertSymbolSizeScale()

void QgsFeatureRendererV2::convertSymbolSizeScale ( QgsSymbolV2 symbol,
QgsSymbolV2::ScaleMethod  method,
const QString field 
)
staticprotected
Note
this function is used to convert old sizeScale expresssions to symbol level DataDefined size

Definition at line 524 of file qgsrendererv2.cpp.

◆ copyPaintEffect()

void QgsFeatureRendererV2::copyPaintEffect ( QgsFeatureRendererV2 destRenderer) const
protected

Copies paint effect of this renderer to another renderer.

Parameters
destRendererdestination renderer for copied effect
Deprecated:
use copyRendererData instead

Definition at line 85 of file qgsrendererv2.cpp.

◆ copyRendererData()

void QgsFeatureRendererV2::copyRendererData ( QgsFeatureRendererV2 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 75 of file qgsrendererv2.cpp.

◆ defaultRenderer()

QgsFeatureRendererV2 * QgsFeatureRendererV2::defaultRenderer ( QGis::GeometryType  geomType)
static

return a new renderer - used by default in vector layers

Definition at line 111 of file qgsrendererv2.cpp.

◆ dump()

QString QgsFeatureRendererV2::dump ( ) const
virtual

◆ embeddedRenderer()

virtual const QgsFeatureRendererV2* QgsFeatureRendererV2::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()
Note
added in QGIS 2.16

Reimplemented in QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 449 of file qgsrendererv2.h.

◆ filter()

virtual QString QgsFeatureRendererV2::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 QgsRuleBasedRendererV2, and QgsCategorizedSymbolRendererV2.

Definition at line 169 of file qgsrendererv2.h.

◆ filterNeedsGeometry()

bool QgsFeatureRendererV2::filterNeedsGeometry ( ) const
virtual

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

Reimplemented in QgsRuleBasedRendererV2.

Definition at line 156 of file qgsrendererv2.cpp.

◆ forceRasterRender()

bool QgsFeatureRendererV2::forceRasterRender ( ) const
inline

Returns whether the renderer must render as a raster.

Note
added in QGIS 2.12
See also
setForceRasterRender

Definition at line 392 of file qgsrendererv2.h.

◆ legendClassificationAttribute()

virtual QString QgsFeatureRendererV2::legendClassificationAttribute ( ) const
inlinevirtual

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

Note
added in 2.6

Reimplemented in QgsGraduatedSymbolRendererV2, and QgsCategorizedSymbolRendererV2.

Definition at line 306 of file qgsrendererv2.h.

◆ legendKeysForFeature()

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

Return legend keys matching a specified feature.

Note
added in 2.14

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.

Definition at line 144 of file qgsrendererv2.cpp.

◆ legendSymbolItemChecked()

bool QgsFeatureRendererV2::legendSymbolItemChecked ( const QString key)
virtual

items of symbology items in legend is checked

Note
added in 2.5

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 374 of file qgsrendererv2.cpp.

◆ legendSymbolItems()

QgsLegendSymbolList QgsFeatureRendererV2::legendSymbolItems ( double  scaleDenominator = -1,
const QString rule = "" 
)
virtual

return a list of item text / symbol

Note
not available in python bindings

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.

Definition at line 392 of file qgsrendererv2.cpp.

◆ legendSymbolItemsCheckable()

bool QgsFeatureRendererV2::legendSymbolItemsCheckable ( ) const
virtual

items of symbology items in legend should be checkable

Note
added in 2.5

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 369 of file qgsrendererv2.cpp.

◆ legendSymbolItemsV2()

QgsLegendSymbolListV2 QgsFeatureRendererV2::legendSymbolItemsV2 ( ) const
virtual

Return a list of symbology items for the legend.

Better choice than legendSymbolItems(). Default fallback implementation just uses legendSymbolItems() implementation

Note
added in 2.6

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, and QgsSingleSymbolRendererV2.

Definition at line 399 of file qgsrendererv2.cpp.

◆ legendSymbologyItems()

QgsLegendSymbologyList QgsFeatureRendererV2::legendSymbologyItems ( QSize  iconSize)
virtual

◆ load()

QgsFeatureRendererV2 * QgsFeatureRendererV2::load ( QDomElement symbologyElem)
static

create a renderer from XML element

Definition at line 198 of file qgsrendererv2.cpp.

◆ loadSld()

QgsFeatureRendererV2 * QgsFeatureRendererV2::loadSld ( const QDomNode node,
QGis::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 252 of file qgsrendererv2.cpp.

◆ modifyRequestExtent()

virtual void QgsFeatureRendererV2::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
Note
added in QGIS 2.7

Reimplemented in QgsHeatmapRenderer.

Definition at line 372 of file qgsrendererv2.h.

◆ orderBy()

QgsFeatureRequest::OrderBy QgsFeatureRendererV2::orderBy ( ) const

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

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

Definition at line 504 of file qgsrendererv2.cpp.

◆ orderByEnabled()

bool QgsFeatureRendererV2::orderByEnabled ( ) const

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

Note
added in QGIS 2.14
See also
orderBy()
setOrderByEnabled()

Definition at line 514 of file qgsrendererv2.cpp.

◆ originalSymbolForFeature() [1/2]

QgsSymbolV2 * QgsFeatureRendererV2::originalSymbolForFeature ( QgsFeature feature)
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.

Note
added in 2.6
Deprecated:
use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead

Definition at line 132 of file qgsrendererv2.cpp.

◆ originalSymbolForFeature() [2/2]

QgsSymbolV2 * QgsFeatureRendererV2::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.

Note
added in 2.12
available in Python bindings as originalSymbolForFeature2

Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, QgsSingleSymbolRendererV2, and QgsNullSymbolRenderer.

Definition at line 139 of file qgsrendererv2.cpp.

◆ originalSymbolsForFeature() [1/2]

QgsSymbolV2List QgsFeatureRendererV2::originalSymbolsForFeature ( QgsFeature feat)
virtual

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

Note
added in 2.6
Deprecated:
use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead

Definition at line 475 of file qgsrendererv2.cpp.

◆ originalSymbolsForFeature() [2/2]

QgsSymbolV2List QgsFeatureRendererV2::originalSymbolsForFeature ( QgsFeature feat,
QgsRenderContext context 
)
virtual

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

Note
added in 2.12
available in Python bindings as originalSymbolsForFeature2

Reimplemented in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 485 of file qgsrendererv2.cpp.

◆ paintEffect()

QgsPaintEffect * QgsFeatureRendererV2::paintEffect ( ) const

Returns the current paint effect for the renderer.

Returns
paint effect
Note
added in QGIS 2.9
See also
setPaintEffect

Definition at line 493 of file qgsrendererv2.cpp.

◆ renderFeature()

bool QgsFeatureRendererV2::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).

Reimplemented in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, QgsHeatmapRenderer, and QgsNullSymbolRenderer.

Definition at line 161 of file qgsrendererv2.cpp.

◆ renderFeatureWithSymbol()

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

Definition at line 171 of file qgsrendererv2.cpp.

◆ renderVertexMarker()

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

render editing vertex marker at specified point

Definition at line 429 of file qgsrendererv2.cpp.

◆ renderVertexMarkerPolygon()

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

render editing vertex marker for a polygon

Definition at line 442 of file qgsrendererv2.cpp.

◆ renderVertexMarkerPolyline()

void QgsFeatureRendererV2::renderVertexMarkerPolyline ( QPolygonF pts,
QgsRenderContext context 
)
protected

render editing vertex marker for a polyline

Definition at line 436 of file qgsrendererv2.cpp.

◆ rotationField()

virtual Q_DECL_DEPRECATED QString QgsFeatureRendererV2::rotationField ( ) const
inlinevirtual

return rotation field name (or empty string if not set or not supported by renderer)

Deprecated:
use the symbol's methods instead

Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, and QgsSingleSymbolRendererV2.

Definition at line 313 of file qgsrendererv2.h.

◆ save()

QDomElement QgsFeatureRendererV2::save ( QDomDocument doc)
virtual

◆ setEmbeddedRenderer()

virtual void QgsFeatureRendererV2::setEmbeddedRenderer ( QgsFeatureRendererV2 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 behaviour.

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

Reimplemented in QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 442 of file qgsrendererv2.h.

◆ setForceRasterRender()

void QgsFeatureRendererV2::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
Note
added in QGIS 2.12

Definition at line 401 of file qgsrendererv2.h.

◆ setLegendSymbolItem()

void QgsFeatureRendererV2::setLegendSymbolItem ( const QString key,
QgsSymbolV2 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.
Note
added in QGIS 2.14

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.

Definition at line 386 of file qgsrendererv2.cpp.

◆ setOrderBy()

void QgsFeatureRendererV2::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
added in QGIS 2.14
See also
setOrderByEnabled()

Definition at line 509 of file qgsrendererv2.cpp.

◆ setOrderByEnabled()

void QgsFeatureRendererV2::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
Note
added in QGIS 2.14
See also
setOrderBy()
orderByEnabled()

Definition at line 519 of file qgsrendererv2.cpp.

◆ setPaintEffect()

void QgsFeatureRendererV2::setPaintEffect ( QgsPaintEffect effect)

Sets the current paint effect for the renderer.

Parameters
effectpaint effect. Ownership is transferred to the renderer.
Note
added in QGIS 2.9
See also
paintEffect

Definition at line 498 of file qgsrendererv2.cpp.

◆ setRotationField()

virtual Q_DECL_DEPRECATED void QgsFeatureRendererV2::setRotationField ( const QString fieldName)
inlinevirtual

sets rotation field of renderer (if supported by the renderer)

Deprecated:
use the symbol's methods instead

Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, and QgsSingleSymbolRendererV2.

Definition at line 317 of file qgsrendererv2.h.

◆ setScaleMethodToSymbol()

void QgsFeatureRendererV2::setScaleMethodToSymbol ( QgsSymbolV2 symbol,
int  scaleMethod 
)
protected

Definition at line 60 of file qgsrendererv2.cpp.

◆ setUsingSymbolLevels()

void QgsFeatureRendererV2::setUsingSymbolLevels ( bool  usingSymbolLevels)
inline

Definition at line 228 of file qgsrendererv2.h.

◆ setVertexMarkerAppearance()

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

set type and size of editing vertex markers for subsequent rendering

Definition at line 411 of file qgsrendererv2.cpp.

◆ startRender() [1/2]

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

Needs to be called when a new render cycle is started.

Parameters
contextAdditional information passed to the renderer about the job which will be rendered
fieldsThe fields available for rendering
Returns
Information passed back from the renderer that can e.g. be used to reduce the amount of requested features

Implemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsPointDisplacementRenderer, QgsInvertedPolygonRenderer, QgsHeatmapRenderer, QgsSingleSymbolRendererV2, QgsNullSymbolRenderer, and Qgs25DRenderer.

◆ startRender() [2/2]

void QgsFeatureRendererV2::startRender ( QgsRenderContext context,
const QgsVectorLayer vlayer 
)
virtual
Deprecated:
since 2.4 - not using QgsVectorLayer directly anymore

Definition at line 151 of file qgsrendererv2.cpp.

◆ stopRender()

virtual void QgsFeatureRendererV2::stopRender ( QgsRenderContext context)
pure virtual

◆ symbolForFeature() [1/2]

QgsSymbolV2 * QgsFeatureRendererV2::symbolForFeature ( QgsFeature feature)
virtual

To be overridden.

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

Parameters
featurefeature
Returns
returns pointer to symbol or 0 if symbol was not found
Deprecated:
use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead

Definition at line 116 of file qgsrendererv2.cpp.

◆ symbolForFeature() [2/2]

QgsSymbolV2 * QgsFeatureRendererV2::symbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
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
Note
added in QGIS 2.12
available in Python bindings as symbolForFeature2

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, Qgs25DRenderer, QgsHeatmapRenderer, QgsNullSymbolRenderer, and QgsSingleSymbolRendererV2.

Definition at line 123 of file qgsrendererv2.cpp.

◆ symbols() [1/2]

QgsSymbolV2List QgsFeatureRendererV2::symbols ( )
virtual

For symbol levels.

Deprecated:
use symbols( QgsRenderContext& context ) instead

Definition at line 181 of file qgsrendererv2.cpp.

◆ symbols() [2/2]

QgsSymbolV2List QgsFeatureRendererV2::symbols ( QgsRenderContext context)
virtual

Returns list of symbols used by the renderer.

Parameters
contextrender context
Note
added in QGIS 2.12
available in Python bindings as symbols2

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsSingleSymbolRendererV2, QgsPointDisplacementRenderer, QgsHeatmapRenderer, QgsNullSymbolRenderer, and Qgs25DRenderer.

Definition at line 187 of file qgsrendererv2.cpp.

◆ symbolsForFeature() [1/2]

QgsSymbolV2List QgsFeatureRendererV2::symbolsForFeature ( QgsFeature feat)
virtual

Returns list of symbols used for rendering the feature.

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

Deprecated:
use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead

Definition at line 457 of file qgsrendererv2.cpp.

◆ symbolsForFeature() [2/2]

QgsSymbolV2List QgsFeatureRendererV2::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()

Note
added in QGIS 2.12
available in Python bindings as symbolsForFeature2

Reimplemented in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 467 of file qgsrendererv2.cpp.

◆ toSld() [1/2]

virtual void QgsFeatureRendererV2::toSld ( QDomDocument doc,
QDomElement element 
) const
inlinevirtual

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

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.

Definition at line 262 of file qgsrendererv2.h.

◆ toSld() [2/2]

virtual void QgsFeatureRendererV2::toSld ( QDomDocument doc,
QDomElement element,
const QgsStringMap props 
) const
inlinevirtual

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

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.

Definition at line 267 of file qgsrendererv2.h.

◆ type()

QString QgsFeatureRendererV2::type ( ) const
inline

Definition at line 92 of file qgsrendererv2.h.

◆ usedAttributes()

virtual QList<QString> QgsFeatureRendererV2::usedAttributes ( )
pure virtual

◆ usingSymbolLevels()

bool QgsFeatureRendererV2::usingSymbolLevels ( ) const
inline

Definition at line 227 of file qgsrendererv2.h.

◆ willRenderFeature() [1/2]

bool QgsFeatureRendererV2::willRenderFeature ( QgsFeature feat)
virtual

Returns whether the renderer will render a feature or not.

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

Deprecated:
use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead

Definition at line 417 of file qgsrendererv2.cpp.

◆ willRenderFeature() [2/2]

bool QgsFeatureRendererV2::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().

Note
added in QGIS 2.12
available in Python bindings as willRenderFeature2

Reimplemented in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, QgsPointDisplacementRenderer, and QgsNullSymbolRenderer.

Definition at line 424 of file qgsrendererv2.cpp.

◆ writeSld() [1/3]

QDomElement QgsFeatureRendererV2::writeSld ( QDomDocument doc,
const QgsVectorLayer layer 
) const
virtual

create the SLD UserStyle element following the SLD v1.1 specs

Deprecated:
since 2.8 - use the other override with styleName

Definition at line 341 of file qgsrendererv2.cpp.

◆ writeSld() [2/3]

virtual QDomElement QgsFeatureRendererV2::writeSld ( QDomDocument doc,
const QString styleName 
) const
inlinevirtual

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

Note
added in 2.8

Definition at line 241 of file qgsrendererv2.h.

◆ writeSld() [3/3]

QDomElement QgsFeatureRendererV2::writeSld ( QDomDocument doc,
const QString styleName,
const QgsStringMap props 
) const
virtual

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

Note
added in 2.14

Definition at line 347 of file qgsrendererv2.cpp.

Member Data Documentation

◆ mCurrentVertexMarkerSize

int QgsFeatureRendererV2::mCurrentVertexMarkerSize
protected

The current size of editing marker.

Definition at line 511 of file qgsrendererv2.h.

◆ mCurrentVertexMarkerType

int QgsFeatureRendererV2::mCurrentVertexMarkerType
protected

The current type of editing marker.

Definition at line 509 of file qgsrendererv2.h.

◆ mForceRaster

bool QgsFeatureRendererV2::mForceRaster
protected

Definition at line 515 of file qgsrendererv2.h.

◆ mOrderBy

QgsFeatureRequest::OrderBy QgsFeatureRendererV2::mOrderBy
protected

Definition at line 526 of file qgsrendererv2.h.

◆ mOrderByEnabled

bool QgsFeatureRendererV2::mOrderByEnabled
protected

Definition at line 528 of file qgsrendererv2.h.

◆ mPaintEffect

QgsPaintEffect* QgsFeatureRendererV2::mPaintEffect
protected

Definition at line 513 of file qgsrendererv2.h.

◆ mType

QString QgsFeatureRendererV2::mType
protected

Definition at line 504 of file qgsrendererv2.h.

◆ mUsingSymbolLevels

bool QgsFeatureRendererV2::mUsingSymbolLevels
protected

Definition at line 506 of file qgsrendererv2.h.


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