Class: QgsGeometryPaintDevice

A paint device which converts everything renderer to a QgsGeometry representation of the rendered shapes.

Added in version 3.38.

Class Hierarchy

Inheritance diagram of qgis.core.QgsGeometryPaintDevice

Base classes

QPaintDevice

Methods

geometry

Returns the rendered geometry.

setSimplificationTolerance

Sets a simplification tolerance (in painter units) to use for on-the-fly simplification of geometries while rendering.

setStrokedPathSegments

Sets the number of segments to use when drawing stroked paths with a rounded pen.

Static Methods

painterPathToGeometry

Converts a painter path to a QgsGeometry.

class qgis.core.QgsGeometryPaintDevice[source]

Bases: QPaintDevice

__init__(usePathStroker: bool = False)

Constructor for QgsGeometryPaintDevice.

If usePathStroker is True, rendered paths will be converted using a stroke respecting the QPainter pen configuration.

Parameters:

usePathStroker (bool = False)

geometry(self) QgsAbstractGeometry

Returns the rendered geometry.

Return type:

QgsAbstractGeometry

static painterPathToGeometry(path: QPainterPath) QgsGeometry[source]

Converts a painter path to a QgsGeometry.

Added in version 3.38.1.

Parameters:

path (QPainterPath)

Return type:

QgsGeometry

setSimplificationTolerance(self, tolerance: float)[source]

Sets a simplification tolerance (in painter units) to use for on-the-fly simplification of geometries while rendering.

This will result in simpler, generalised paths.

Set tolerance to 0 to disable simplification. (No simplification is the default behavior).

Parameters:

tolerance (float)

setStrokedPathSegments(self, segments: int)[source]

Sets the number of segments to use when drawing stroked paths with a rounded pen.

The default is 8 segments, a smaller number will result in simpler paths.

Parameters:

segments (int)