QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsSymbolRenderContext Class Reference

#include <qgssymbolrendercontext.h>

Public Member Functions

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

Detailed Description

Definition at line 33 of file qgssymbolrendercontext.h.

Constructor & Destructor Documentation

◆ QgsSymbolRenderContext() [1/2]

QgsSymbolRenderContext::QgsSymbolRenderContext ( QgsRenderContext c,
Qgis::RenderUnit  u,
qreal  opacity = 1.0,
bool  selected = false,
Qgis::SymbolRenderHints  renderHints = Qgis::SymbolRenderHints(),
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 20 of file qgssymbolrendercontext.cpp.

◆ ~QgsSymbolRenderContext()

QgsSymbolRenderContext::~QgsSymbolRenderContext ( )
default

◆ QgsSymbolRenderContext() [2/2]

QgsSymbolRenderContext::QgsSymbolRenderContext ( const QgsSymbolRenderContext rh)
delete

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 68 of file qgssymbolrendercontext.cpp.

◆ feature()

const QgsFeature * QgsSymbolRenderContext::feature ( ) const
inline

Returns the current feature being rendered.

This may be nullptr.

Definition at line 155 of file qgssymbolrendercontext.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).

Definition at line 177 of file qgssymbolrendercontext.h.

◆ forceVectorRendering()

bool QgsSymbolRenderContext::forceVectorRendering ( ) const

Returns true if symbol must be rendered using vector methods, and optimisations like pre-rendered images must be disabled.

Since
QGIS 3.40

Definition at line 41 of file qgssymbolrendercontext.cpp.

◆ geometryPartCount()

int QgsSymbolRenderContext::geometryPartCount ( ) const
inline

Part count of current geometry.

Definition at line 182 of file qgssymbolrendercontext.h.

◆ geometryPartNum()

int QgsSymbolRenderContext::geometryPartNum ( ) const
inline

Part number of current geometry.

Definition at line 192 of file qgssymbolrendercontext.h.

◆ mapUnitScale()

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

Definition at line 89 of file qgssymbolrendercontext.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 101 of file qgssymbolrendercontext.h.

◆ operator=()

QgsSymbolRenderContext & QgsSymbolRenderContext::operator= ( const QgsSymbolRenderContext )

Definition at line 58 of file qgssymbolrendercontext.cpp.

◆ originalGeometryType()

Qgis::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()

Definition at line 170 of file qgssymbolrendercontext.h.

◆ outputLineWidth()

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

Definition at line 47 of file qgssymbolrendercontext.cpp.

◆ outputPixelSize()

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

Definition at line 52 of file qgssymbolrendercontext.cpp.

◆ outputUnit()

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

Returns the output unit for the context.

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

Definition at line 78 of file qgssymbolrendercontext.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 78 of file qgssymbolrendercontext.cpp.

◆ renderContext() [1/2]

QgsRenderContext & QgsSymbolRenderContext::renderContext ( )
inline

Returns a reference to the context's render context.

Definition at line 59 of file qgssymbolrendercontext.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 65 of file qgssymbolrendercontext.h.

◆ renderHints()

Qgis::SymbolRenderHints QgsSymbolRenderContext::renderHints ( ) const
inline

Returns the rendering hint flags for the symbol.

See also
setRenderHints()

Definition at line 126 of file qgssymbolrendercontext.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 114 of file qgssymbolrendercontext.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 73 of file qgssymbolrendercontext.cpp.

◆ setFeature()

void QgsSymbolRenderContext::setFeature ( const QgsFeature f)
inline

Definition at line 150 of file qgssymbolrendercontext.h.

◆ setGeometryPartCount()

void QgsSymbolRenderContext::setGeometryPartCount ( int  count)
inline

Sets the part count of current geometry.

Definition at line 187 of file qgssymbolrendercontext.h.

◆ setGeometryPartNum()

void QgsSymbolRenderContext::setGeometryPartNum ( int  num)
inline

Sets the part number of current geometry.

Definition at line 197 of file qgssymbolrendercontext.h.

◆ setMapUnitScale()

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

Definition at line 94 of file qgssymbolrendercontext.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 108 of file qgssymbolrendercontext.h.

◆ setOriginalGeometryType()

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

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

See also
originalGeometryType()

Definition at line 161 of file qgssymbolrendercontext.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.

Definition at line 36 of file qgssymbolrendercontext.cpp.

◆ setOutputUnit()

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

Sets the output unit for the context.

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

Definition at line 84 of file qgssymbolrendercontext.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 83 of file qgssymbolrendercontext.cpp.

◆ setRenderHint()

void QgsSymbolRenderContext::setRenderHint ( Qgis::SymbolRenderHint  hint,
bool  enabled = true 
)
inline

Sets a rendering hint flag for the symbol.

See also
renderHints()
Since
QGIS 3.40

Definition at line 148 of file qgssymbolrendercontext.h.

◆ setRenderHints()

void QgsSymbolRenderContext::setRenderHints ( Qgis::SymbolRenderHints  hints)
inline

Sets rendering hint flags for the symbol.

See also
renderHints()

Definition at line 140 of file qgssymbolrendercontext.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 120 of file qgssymbolrendercontext.h.


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