Class: QgsAbstractGeometryTransformer¶
- class qgis.core.QgsAbstractGeometryTransformer¶
Bases:
sip.wrapper
An abstract base class for classes which transform geometries by transforming input points to output points.
Added in version 3.18:
Methods
Transforms the point defined by the coordinates (
x
,y
,z
) and the specifiedm
value.- transformPoint(self, x: float, y: float, z: float, m: float) Tuple[bool, float, float, float, float] ¶
Transforms the point defined by the coordinates (
x
,y
,z
) and the specifiedm
value.- Parameters:
x (float) – point x coordinate
y (float) – point y coordinate
z (float) – point z coordinate, or NaN if the input point is 2D only
m (float) – point m value, or NaN if not available
- Return type:
Tuple[bool, float, float, float, float]
- Returns:
True
if point was transformed (or no transformation was required), orFalse
if point could not be transformed successfully.
Example¶
A transformer which multiples the x coordinate by 3 and adds 10 to the y coordinate:
class MyTransformer(:py:class:`.QgsAbstractGeometryTransformer`): def transformPoint(self, x, y, z, m): # returns a tuple of True to indicate success, then the modified x/y/z/m values return True, x*3, y+10, z, m