QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
Public Member Functions | List of all members
QgsSymbolRenderContext Class Reference

#include <qgssymbol.h>

Public Member Functions

 QgsSymbolRenderContext (const QgsSymbolRenderContext &rh)=delete
 QgsSymbolRenderContext cannot be copied. More...
 
 QgsSymbolRenderContext (QgsRenderContext &c, QgsUnitTypes::RenderUnit u, qreal opacity=1.0, bool selected=false, QgsSymbol::RenderHints renderHints=QgsSymbol::RenderHints(), const QgsFeature *f=nullptr, const QgsFields &fields=QgsFields(), const QgsMapUnitScale &mapUnitScale=QgsMapUnitScale())
 Constructor for QgsSymbolRenderContext. More...
 
 ~QgsSymbolRenderContext ()
 
QgsExpressionContextScopeexpressionContextScope ()
 This scope is always available when a symbol of this type is being rendered. More...
 
const QgsFeaturefeature () const
 Returns the current feature being rendered. More...
 
QgsFields fields () const
 Fields of the layer. More...
 
int geometryPartCount () const
 Part count of current geometry. More...
 
int geometryPartNum () const
 Part number of current geometry. More...
 
Q_DECL_DEPRECATED QgsMapUnitScale mapUnitScale () const
 
qreal opacity () const
 Returns the opacity for the symbol. More...
 
QgsSymbolRenderContextoperator= (const QgsSymbolRenderContext &)
 
QgsWkbTypes::GeometryType originalGeometryType () const
 Returns the geometry type for the original feature geometry being rendered. More...
 
Q_DECL_DEPRECATED double outputLineWidth (double width) const
 
Q_DECL_DEPRECATED double outputPixelSize (double size) const
 
Q_DECL_DEPRECATED QgsUnitTypes::RenderUnit outputUnit () const
 Returns the output unit for the context. More...
 
const QgsLegendPatchShapepatchShape () const
 Returns the symbol patch shape, to use if rendering symbol preview icons. More...
 
QgsRenderContextrenderContext ()
 Returns a reference to the context's render context. More...
 
const QgsRenderContextrenderContext () const
 Returns a reference to the context's render context. More...
 
QgsSymbol::RenderHints renderHints () const
 Returns the rendering hint flags for the symbol. More...
 
bool selected () const
 Returns true if symbols should be rendered using the selected symbol coloring and style. More...
 
void setExpressionContextScope (QgsExpressionContextScope *contextScope)
 Set an expression scope for this symbol. More...
 
void setFeature (const QgsFeature *f)
 
void setGeometryPartCount (int count)
 Sets the part count of current geometry. More...
 
void setGeometryPartNum (int num)
 Sets the part number of current geometry. More...
 
Q_DECL_DEPRECATED void setMapUnitScale (const QgsMapUnitScale &scale)
 
void setOpacity (qreal opacity)
 Sets the opacity for the symbol. More...
 
void setOriginalGeometryType (QgsWkbTypes::GeometryType type)
 Sets the geometry type for the original feature geometry being rendered. More...
 
void setOriginalValueVariable (const QVariant &value)
 Sets the original value variable value for data defined symbology. More...
 
Q_DECL_DEPRECATED void setOutputUnit (QgsUnitTypes::RenderUnit u)
 Sets the output unit for the context. More...
 
void setPatchShape (const QgsLegendPatchShape &shape)
 Sets the symbol patch shape, to use if rendering symbol preview icons. More...
 
void setRenderHints (QgsSymbol::RenderHints hints)
 Sets rendering hint flags for the symbol. More...
 
void setSelected (bool selected)
 Sets whether symbols should be rendered using the selected symbol coloring and style. More...
 

Detailed Description

Definition at line 767 of file qgssymbol.h.

Constructor & Destructor Documentation

◆ QgsSymbolRenderContext() [1/2]

QgsSymbolRenderContext::QgsSymbolRenderContext ( QgsRenderContext c,
QgsUnitTypes::RenderUnit  u,
qreal  opacity = 1.0,
bool  selected = false,
QgsSymbol::RenderHints  renderHints = QgsSymbol::RenderHints(),
const QgsFeature f = nullptr,
const QgsFields fields = QgsFields(),
const QgsMapUnitScale mapUnitScale = QgsMapUnitScale() 
)

Constructor for QgsSymbolRenderContext.

Parameters
c
u
opacityvalue between 0 (fully transparent) and 1 (fully opaque)
selectedset to true if symbol should be drawn in a "selected" state
renderHintsflags controlling rendering behavior
f
fields
mapUnitScale

Definition at line 1492 of file qgssymbol.cpp.

◆ ~QgsSymbolRenderContext()

QgsSymbolRenderContext::~QgsSymbolRenderContext ( )
default

◆ QgsSymbolRenderContext() [2/2]

QgsSymbolRenderContext::QgsSymbolRenderContext ( const QgsSymbolRenderContext rh)
delete

QgsSymbolRenderContext cannot be copied.

Member Function Documentation

◆ expressionContextScope()

QgsExpressionContextScope * QgsSymbolRenderContext::expressionContextScope ( )

This scope is always available when a symbol of this type is being rendered.

Returns
An expression scope for details about this symbol

Definition at line 1534 of file qgssymbol.cpp.

◆ feature()

const QgsFeature* QgsSymbolRenderContext::feature ( ) const
inline

Returns the current feature being rendered.

This may be nullptr.

Definition at line 875 of file qgssymbol.h.

◆ fields()

QgsFields QgsSymbolRenderContext::fields ( ) const
inline

Fields of the layer.

Currently only available in startRender() calls to allow symbols with data-defined properties prepare the expressions (other times fields() returns an empty QgsFields object).

Since
QGIS 2.4

Definition at line 900 of file qgssymbol.h.

◆ geometryPartCount()

int QgsSymbolRenderContext::geometryPartCount ( ) const
inline

Part count of current geometry.

Since
QGIS 2.16

Definition at line 906 of file qgssymbol.h.

◆ geometryPartNum()

int QgsSymbolRenderContext::geometryPartNum ( ) const
inline

Part number of current geometry.

Since
QGIS 2.16

Definition at line 918 of file qgssymbol.h.

◆ mapUnitScale()

Q_DECL_DEPRECATED QgsMapUnitScale QgsSymbolRenderContext::mapUnitScale ( ) const
inline
Deprecated:
Will be removed in QGIS 4.0

Definition at line 825 of file qgssymbol.h.

◆ opacity()

qreal QgsSymbolRenderContext::opacity ( ) const
inline

Returns the opacity for the symbol.

Returns
opacity value between 0 (fully transparent) and 1 (fully opaque)
See also
setOpacity()

Definition at line 837 of file qgssymbol.h.

◆ operator=()

QgsSymbolRenderContext & QgsSymbolRenderContext::operator= ( const QgsSymbolRenderContext )

Definition at line 1524 of file qgssymbol.cpp.

◆ originalGeometryType()

QgsWkbTypes::GeometryType QgsSymbolRenderContext::originalGeometryType ( ) const
inline

Returns the geometry type for the original feature geometry being rendered.

This can be useful if symbol layers alter their appearance based on geometry type - eg offsetting a simple line style will look different if the simple line is rendering a polygon feature (a closed buffer) vs a line feature (an unclosed offset line).

See also
originalGeometryType()
Since
QGIS 3.0

Definition at line 892 of file qgssymbol.h.

◆ outputLineWidth()

double QgsSymbolRenderContext::outputLineWidth ( double  width) const
Deprecated:
Use the size conversion methods in QgsRenderContext instead.

Definition at line 1513 of file qgssymbol.cpp.

◆ outputPixelSize()

double QgsSymbolRenderContext::outputPixelSize ( double  size) const
Deprecated:
Use the size conversion methods in QgsRenderContext instead.

Definition at line 1518 of file qgssymbol.cpp.

◆ outputUnit()

Q_DECL_DEPRECATED QgsUnitTypes::RenderUnit QgsSymbolRenderContext::outputUnit ( ) const
inline

Returns the output unit for the context.

Deprecated:
No longer used and will be removed in QGIS 4.0

Definition at line 814 of file qgssymbol.h.

◆ patchShape()

const QgsLegendPatchShape * QgsSymbolRenderContext::patchShape ( ) const

Returns the symbol patch shape, to use if rendering symbol preview icons.

See also
setPatchShape()
Since
QGIS 3.14

Definition at line 1544 of file qgssymbol.cpp.

◆ renderContext() [1/2]

QgsRenderContext& QgsSymbolRenderContext::renderContext ( )
inline

Returns a reference to the context's render context.

Definition at line 794 of file qgssymbol.h.

◆ renderContext() [2/2]

const QgsRenderContext& QgsSymbolRenderContext::renderContext ( ) const
inline

Returns a reference to the context's render context.

Note
Not available in Python bindings.

Definition at line 800 of file qgssymbol.h.

◆ renderHints()

QgsSymbol::RenderHints QgsSymbolRenderContext::renderHints ( ) const
inline

Returns the rendering hint flags for the symbol.

See also
setRenderHints()

Definition at line 862 of file qgssymbol.h.

◆ selected()

bool QgsSymbolRenderContext::selected ( ) const
inline

Returns true if symbols should be rendered using the selected symbol coloring and style.

See also
setSelected()

Definition at line 850 of file qgssymbol.h.

◆ setExpressionContextScope()

void QgsSymbolRenderContext::setExpressionContextScope ( QgsExpressionContextScope contextScope)

Set an expression scope for this symbol.

Will take ownership.

Parameters
contextScopeAn expression scope for details about this symbol

Definition at line 1539 of file qgssymbol.cpp.

◆ setFeature()

void QgsSymbolRenderContext::setFeature ( const QgsFeature f)
inline

Definition at line 870 of file qgssymbol.h.

◆ setGeometryPartCount()

void QgsSymbolRenderContext::setGeometryPartCount ( int  count)
inline

Sets the part count of current geometry.

Since
QGIS 2.16

Definition at line 912 of file qgssymbol.h.

◆ setGeometryPartNum()

void QgsSymbolRenderContext::setGeometryPartNum ( int  num)
inline

Sets the part number of current geometry.

Since
QGIS 2.16

Definition at line 924 of file qgssymbol.h.

◆ setMapUnitScale()

Q_DECL_DEPRECATED void QgsSymbolRenderContext::setMapUnitScale ( const QgsMapUnitScale scale)
inline
Deprecated:
Will be removed in QGIS 4.0

Definition at line 830 of file qgssymbol.h.

◆ setOpacity()

void QgsSymbolRenderContext::setOpacity ( qreal  opacity)
inline

Sets the opacity for the symbol.

Parameters
opacityopacity value between 0 (fully transparent) and 1 (fully opaque)
See also
opacity()

Definition at line 844 of file qgssymbol.h.

◆ setOriginalGeometryType()

void QgsSymbolRenderContext::setOriginalGeometryType ( QgsWkbTypes::GeometryType  type)
inline

Sets the geometry type for the original feature geometry being rendered.

See also
originalGeometryType()
Since
QGIS 3.0

Definition at line 882 of file qgssymbol.h.

◆ setOriginalValueVariable()

void QgsSymbolRenderContext::setOriginalValueVariable ( const QVariant &  value)

Sets the original value variable value for data defined symbology.

Parameters
valuevalue for original value variable. This usually represents the symbol property value before any data defined overrides have been applied.
Since
QGIS 2.12

Definition at line 1508 of file qgssymbol.cpp.

◆ setOutputUnit()

Q_DECL_DEPRECATED void QgsSymbolRenderContext::setOutputUnit ( QgsUnitTypes::RenderUnit  u)
inline

Sets the output unit for the context.

Deprecated:
No longer used and will be removed in QGIS 4.0

Definition at line 820 of file qgssymbol.h.

◆ setPatchShape()

void QgsSymbolRenderContext::setPatchShape ( const QgsLegendPatchShape shape)

Sets the symbol patch shape, to use if rendering symbol preview icons.

See also
patchShape()
Since
QGIS 3.14

Definition at line 1549 of file qgssymbol.cpp.

◆ setRenderHints()

void QgsSymbolRenderContext::setRenderHints ( QgsSymbol::RenderHints  hints)
inline

Sets rendering hint flags for the symbol.

See also
renderHints()

Definition at line 868 of file qgssymbol.h.

◆ setSelected()

void QgsSymbolRenderContext::setSelected ( bool  selected)
inline

Sets whether symbols should be rendered using the selected symbol coloring and style.

See also
selected()

Definition at line 856 of file qgssymbol.h.


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