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
isTrue
, rendered paths will be converted using a stroke respecting the QPainter pen configuration.Methods
Returns the rendered geometry.
- param metric:
- rtype:
Optional[QPaintEngine]
Sets a simplification tolerance (in painter units) to use for on-the-fly simplification of geometries while rendering.
Sets the number of
segments
to use when drawing stroked paths with a rounded pen.- geometry(self) QgsAbstractGeometry ¶
Returns the rendered geometry.
- Return type:
- 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)