Class: QgsGeometryPaintDevice

class qgis.core.QgsGeometryPaintDevice

Bases: PyQt5.QtGui.QPaintDevice

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

Added in version 3.38.

QgsGeometryPaintDevice(usePathStroker: bool = False) Constructor for QgsGeometryPaintDevice.

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

Methods

geometry

Returns the rendered geometry.

metric

param metric:

paintEngine

rtype:

Optional[QPaintEngine]

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.

geometry(self) QgsAbstractGeometry

Returns the rendered geometry.

Return type:

QgsAbstractGeometry

metric(self, metric: QPaintDevice.PaintDeviceMetric) int
Parameters:

metric (QPaintDevice.PaintDeviceMetric)

Return type:

int

paintEngine(self) QPaintEngine | None
Return type:

Optional[QPaintEngine]

setSimplificationTolerance(self, tolerance: float)

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)

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)