Class: QgsGeometryGeneratorSymbolLayer

class qgis.core.QgsGeometryGeneratorSymbolLayer

Bases: QgsSymbolLayer

Methods

clone

rtype:

QgsSymbolLayer

color

rtype:

QColor

create

Creates the symbol layer

drawPreviewIcon

param context:

geometryExpression

Gets the expression to generate this geometry.

hasDataDefinedProperties

rtype:

bool

isCompatibleWithSymbol

Will always return True.

layerType

rtype:

str

mapUnitScale

rtype:

QgsMapUnitScale

outputUnit

rtype:

QgsUnitTypes.RenderUnit

properties

rtype:

Dict[str, Any]

render

Will render this symbol layer using the context.

setColor

param color:

setGeometryExpression

Set the expression to generate this geometry.

setOutputUnit

param unit:

setSubSymbol

param symbol:

setSymbolType

Set the type of symbol which should be created.

setUnits

Sets the units for the geometry expression.

startFeatureRender

param feature:

startRender

param context:

stopFeatureRender

param feature:

stopRender

param context:

subSymbol

rtype:

QgsSymbol

symbolType

Access the symbol type.

units

Returns the unit for the geometry expression.

usedAttributes

param context:

usesMapUnits

rtype:

bool

clone(self) QgsSymbolLayer
Return type:

QgsSymbolLayer

color(self) QColor
Return type:

QColor

create(properties: Dict[str, Any]) QgsSymbolLayer

Creates the symbol layer

Parameters:

properties (Dict[str) –

Return type:

QgsSymbolLayer

drawPreviewIcon(self, context: QgsSymbolRenderContext, size: QSize)
Parameters:
geometryExpression(self) str

Gets the expression to generate this geometry.

Return type:

str

hasDataDefinedProperties(self) bool
Return type:

bool

isCompatibleWithSymbol(self, symbol: QgsSymbol) bool

Will always return True. This is a hybrid layer, it constructs its own geometry so it does not care about the geometry of its parents.

Parameters:

symbol (QgsSymbol) –

Return type:

bool

layerType(self) str
Return type:

str

mapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

outputUnit(self) QgsUnitTypes.RenderUnit
Return type:

QgsUnitTypes.RenderUnit

properties(self) Dict[str, Any]
Return type:

Dict[str, Any]

render(self, context: QgsSymbolRenderContext, geometryType: QgsWkbTypes.GeometryType = QgsWkbTypes.GeometryType.UnknownGeometry, points: QPolygonF = None, rings: Iterable[QPolygonF] = [])

Will render this symbol layer using the context. In comparison to other symbols there is no geometry passed in, since the geometry will be created based on information from the context which contains a QgsRenderContext which in turn contains an expression context which is available to the evaluated expression.

Parameters:
  • context (QgsSymbolRenderContext) – The rendering context which will be used to render and to construct a geometry.

  • geometryType (QgsWkbTypes.GeometryType = QgsWkbTypes.GeometryType.UnknownGeometry) – type of original geometry being rendered by the parent symbol (since QGIS 3.22)

  • points (QPolygonF = None) – optional list of original points which are being rendered by the parent symbol (since QGIS 3.22)

  • rings (Iterable[QPolygonF] = []) – optional list of original rings which are being rendered by the parent symbol (since QGIS 3.22)

setColor(self, color: QColor | Qt.GlobalColor | QGradient)
Parameters:

color (Union[QColor) –

setGeometryExpression(self, exp: str)

Set the expression to generate this geometry.

Parameters:

exp (str) –

setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)
Parameters:

unit (QgsUnitTypes.RenderUnit) –

setSubSymbol(self, symbol: QgsSymbol) bool
Parameters:

symbol (QgsSymbol) –

Return type:

bool

setSymbolType(self, symbolType: Qgis.SymbolType)

Set the type of symbol which should be created. Should match with the return type of the expression.

Parameters:

symbolType (Qgis.SymbolType) – The symbol type which shall be used below this symbol.

setUnits(self, units: QgsUnitTypes.RenderUnit)

Sets the units for the geometry expression.

By default this is QgsUnitTypes.MapUnits, which means that the geometryExpression() will return geometries in the associated layer’s CRS.

See also

units()

New in version 3.22.

Parameters:

units (QgsUnitTypes.RenderUnit) –

startFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)
Parameters:
startRender(self, context: QgsSymbolRenderContext)
Parameters:

context (QgsSymbolRenderContext) –

stopFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)
Parameters:
stopRender(self, context: QgsSymbolRenderContext)
Parameters:

context (QgsSymbolRenderContext) –

subSymbol(self) QgsSymbol
Return type:

QgsSymbol

symbolType(self) Qgis.SymbolType

Access the symbol type. This defines the type of geometry that is created by this generator.

Return type:

Qgis.SymbolType

Returns:

Symbol type

units(self) QgsUnitTypes.RenderUnit

Returns the unit for the geometry expression.

By default this is QgsUnitTypes.MapUnits, which means that the geometryExpression() will return geometries in the associated layer’s CRS.

See also

setUnits()

New in version 3.22.

Return type:

QgsUnitTypes.RenderUnit

usedAttributes(self, context: QgsRenderContext) Set[str]
Parameters:

context (QgsRenderContext) –

Return type:

Set[str]

usesMapUnits(self) bool
Return type:

bool