Class: QgsGeometryGeneratorSymbolLayer¶
A symbol layer subclass which alters rendered feature shapes through the
Class Hierarchy¶
Base classes¶
Abstract base class for symbol layers. |
Methods
Gets the expression to generate this geometry. |
|
Will render this symbol layer using the context. |
|
Set the expression to generate this geometry. |
|
Set the type of symbol which should be created. |
|
Sets the units for the geometry expression. |
|
Access the symbol type. |
|
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.
Will always return |
Static Methods
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 thegeometryExpression()
will return geometries in the associated layer’s CRS.See also
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:
- Returns:
Symbol type
- units(self) Qgis.RenderUnit [source]¶
Returns the unit for the geometry expression.
By default this is
QgsUnitTypes
.MapUnits, which means that thegeometryExpression()
will return geometries in the associated layer’s CRS.See also
Added in version 3.22.
- Return type: