Class: QgsFillSymbol

class qgis.core.QgsFillSymbol

Bases: QgsSymbol

A fill symbol type, for rendering Polygon and MultiPolygon geometries.

QgsFillSymbol(layers: Iterable[QgsSymbolLayer] = []) Constructor for QgsFillSymbol, with the specified list of initial symbol layers.

Ownership of the layers are transferred to the symbol.

Methods

clone

rtype

QgsFillSymbol

cloneLayers

Retrieve a cloned list of all layers that make up this symbol.

createSimple

Create a fill symbol with one symbol layer: SimpleFill with specified properties.

renderPolygon

Renders the symbol using the given render context.

renderUsingLayer

Renders a context using a particular symbol layer without passing in a geometry.

renderVertexMarker

Render editing vertex marker at specified point

setAngle

param angle

clone(self) QgsFillSymbol
Return type

QgsFillSymbol

cloneLayers(self) List[QgsSymbolLayer]

Retrieve a cloned list of all layers that make up this symbol. Ownership is transferred to the caller.

createSimple(properties: Dict[str, Any]) QgsFillSymbol

Create a fill symbol with one symbol layer: SimpleFill with specified properties. This is a convenience method for easier creation of fill symbols.

Parameters

properties (Dict[str) –

Return type

QgsFillSymbol

renderPolygon(self, points: QPolygonF, rings: Iterable[QPolygonF], f: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False)

Renders the symbol using the given render context.

The points list dictates the exterior ring for the polygon to render, and interior rings are optionally specified via the rings argument.

The f argument is used to pass the feature currently being rendered (when available).

If only a single symbol layer from the symbol should be rendered, it should be specified in the layer argument. A layer of -1 indicates that all symbol layers should be rendered.

If selected is True then the symbol will be drawn using the “selected feature” style and colors instead of the symbol’s normal style.

Parameters
  • points (QPolygonF) –

  • rings (Iterable[QPolygonF]) –

  • f (QgsFeature) –

  • context (QgsRenderContext) –

  • layer (int = -1) –

  • selected (bool = False) –

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

Renders a context using a particular symbol layer without passing in a geometry. This is used as fallback, if the symbol being rendered is not compatible with the specified layer. In such a case, this method can be called and will call the layer’s rendering method anyway but the geometry passed to the layer will be empty. This is required for layers that generate their own geometry from other information in the rendering context.

Since QGIS 3.22, the optional geometryType, points and rings arguments can specify the original geometry type, points and rings in which are being rendered by the parent symbol.

renderVertexMarker(self, pt: Union[QPointF, QPoint], context: QgsRenderContext, currentVertexMarkerType: Qgis.VertexMarkerType, currentVertexMarkerSize: float)

Render editing vertex marker at specified point

New in version 2.16.

setAngle(self, angle: float)
Parameters

angle (float) –