Class: QgsGeometryGeneratorSymbolLayer

A symbol layer subclass which alters rendered feature shapes through the

Class Hierarchy

Inheritance diagram of qgis.core.QgsGeometryGeneratorSymbolLayer

Base classes

QgsSymbolLayer

Abstract base class for symbol layers.

Methods

geometryExpression

Gets the expression to generate this geometry.

render

Will render this symbol layer using the context.

setGeometryExpression

Set the expression to generate this geometry.

setSymbolType

Set the type of symbol which should be created.

setUnits

Sets the units for the geometry expression.

symbolType

Access the symbol type.

units

Returns the unit for the geometry expression.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsGeometryGeneratorSymbolLayer. See the FAQ for more details.

isCompatibleWithSymbol

Will always return True.

Static Methods

create

Creates the symbol layer

class qgis.core.QgsGeometryGeneratorSymbolLayer[source]

Bases: QgsSymbolLayer

static create(properties: Dict[str, Any]) QgsSymbolLayer | None[source]

Creates the symbol layer

Parameters:

properties (Dict[str, Any])

Return type:

Optional[QgsSymbolLayer]

geometryExpression(self) str[source]

Gets the expression to generate this geometry.

Return type:

str

virtual isCompatibleWithSymbol(self, symbol: QgsSymbol | None) bool[source]

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 (Optional[QgsSymbol])

Return type:

bool

render(self, context: QgsSymbolRenderContext, geometryType: Qgis.GeometryType = Qgis.GeometryType.Unknown, points: QPolygonF | None = None, rings: Iterable[QPolygonF] | None = [])[source]

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 (Qgis.GeometryType = Qgis.GeometryType.Unknown) – type of original geometry being rendered by the parent symbol (since QGIS 3.22)

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

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

setGeometryExpression(self, exp: str | None)[source]

Set the expression to generate this geometry.

Parameters:

exp (Optional[str])

setSymbolType(self, symbolType: Qgis.SymbolType)[source]

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: Qgis.RenderUnit)[source]

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

Added in version 3.22.

Parameters:

units (Qgis.RenderUnit)

symbolType(self) Qgis.SymbolType[source]

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) Qgis.RenderUnit[source]

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

Added in version 3.22.

Return type:

Qgis.RenderUnit