Class: QgsGeometryGeneratorSymbolLayer¶
- class qgis.core.QgsGeometryGeneratorSymbolLayer¶
Bases:
QgsSymbolLayer
Methods
- rtype
QgsSymbolLayer
- rtype
QColor
Creates the symbol layer
- param context
Gets the expression to generate this geometry.
- rtype
bool
Will always return
True
.- rtype
str
- rtype
QgsMapUnitScale
- rtype
QgsUnitTypes.RenderUnit
- rtype
Dict[str, Any]
Will render this symbol layer using the context.
- param color
Set the expression to generate this geometry.
- param unit
- param symbol
Set the type of symbol which should be created.
Sets the
units
for the geometry expression.- param feature
- param context
- param feature
- param context
- rtype
QgsSymbol
Access the symbol type.
Returns the unit for the geometry expression.
- param context
- rtype
bool
- clone(self) QgsSymbolLayer ¶
- Return type
- color(self) QColor ¶
- Return type
QColor
- create(properties: Dict[str, Any]) QgsSymbolLayer ¶
Creates the symbol layer
- Parameters
properties (Dict[str) –
- Return type
- drawPreviewIcon(self, context: QgsSymbolRenderContext, size: QSize)¶
- Parameters
context (QgsSymbolRenderContext) –
size (QSize) –
- 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
- outputUnit(self) QgsUnitTypes.RenderUnit ¶
- Return type
- 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: Union[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) –
- 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 thegeometryExpression()
will return geometries in the associated layer’s CRS.See also
New in version 3.22.
- Parameters
units (QgsUnitTypes.RenderUnit) –
- startFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)¶
- Parameters
feature (QgsFeature) –
context (QgsRenderContext) –
- startRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- stopFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)¶
- Parameters
feature (QgsFeature) –
context (QgsRenderContext) –
- stopRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- symbolType(self) Qgis.SymbolType ¶
Access the symbol type. This defines the type of geometry that is created by this generator.
- Return type
- Returns
Symbol type
- units(self) QgsUnitTypes.RenderUnit ¶
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
New in version 3.22.
- Return type
- usedAttributes(self, context: QgsRenderContext) Set[str] ¶
- Parameters
context (QgsRenderContext) –
- Return type
Set[str]
- usesMapUnits(self) bool ¶
- Return type
bool