Skip to content

Commit 1453196

Browse files
authored
Merge pull request #5719 from nyalldawson/translate_z
geometries: translate Z/M
2 parents 97f749e + b786ed0 commit 1453196

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+611
-193
lines changed

python/core/geometry/qgsabstractgeometry.sip

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,13 @@ class QgsAbstractGeometry
234234
transform.
235235
%End
236236

237-
virtual void transform( const QTransform &t ) = 0;
237+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0,
238+
double mTranslate = 0.0, double mScale = 1.0 ) = 0;
238239
%Docstring
239-
Transforms the geometry using a QTransform object
240-
\param t QTransform transformation
240+
Transforms the x and y components of the geometry using a QTransform object ``t``.
241+
242+
Optionally, the geometry's z values can be scaled via ``zScale`` and translated via ``zTranslate``.
243+
Similarly, m-values can be scaled via ``mScale`` and translated via ``mTranslate``.
241244
%End
242245

243246
virtual void draw( QPainter &p ) const = 0;

python/core/geometry/qgscircularstring.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class QgsCircularString: QgsCurve
8787

8888
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
8989
bool transformZ = false );
90-
virtual void transform( const QTransform &t );
90+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
9191

9292
virtual void addToPainterPath( QPainterPath &path ) const;
9393

python/core/geometry/qgscompoundcurve.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class QgsCompoundCurve: QgsCurve
112112

113113
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
114114
bool transformZ = false );
115-
virtual void transform( const QTransform &t );
115+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
116116

117117
virtual void addToPainterPath( QPainterPath &path ) const;
118118

python/core/geometry/qgscurvepolygon.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Adds an interior ring to the geometry (takes ownership)
131131

132132
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
133133
bool transformZ = false );
134-
virtual void transform( const QTransform &t );
134+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
135135

136136

137137
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );

python/core/geometry/qgsgeometry.sip

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ Returns true if WKB of the geometry is of WKBMulti* type
566566
:rtype: QgsGeometry
567567
%End
568568

569-
OperationResult translate( double dx, double dy );
569+
OperationResult translate( double dx, double dy, double dz = 0.0, double dm = 0.0 );
570570
%Docstring
571-
Translates this geometry by dx, dy
571+
Translates this geometry by dx, dy, dz and dm.
572572
:return: OperationResult a result code: success or reason of failure
573573
:rtype: OperationResult
574574
%End
@@ -580,9 +580,13 @@ Returns true if WKB of the geometry is of WKBMulti* type
580580
:rtype: OperationResult
581581
%End
582582

583-
OperationResult transform( const QTransform &ct );
583+
OperationResult transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
584584
%Docstring
585-
Transforms this geometry as described by QTransform ct
585+
Transforms the x and y components of the geometry using a QTransform object ``t``.
586+
587+
Optionally, the geometry's z values can be scaled via ``zScale`` and translated via ``zTranslate``.
588+
Similarly, m-values can be scaled via ``mScale`` and translated via ``mTranslate``.
589+
586590
:return: OperationResult a result code: success or reason of failure
587591
:rtype: OperationResult
588592
%End

python/core/geometry/qgsgeometrycollection.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Adds a geometry and takes ownership. Returns true in case of success.
8383

8484
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
8585
bool transformZ = false );
86-
virtual void transform( const QTransform &t );
86+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
8787

8888

8989
virtual void draw( QPainter &p ) const;

python/core/geometry/qgslinestring.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Closes the line string by appending the first point to the end of the line, if i
225225

226226
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
227227
bool transformZ = false );
228-
virtual void transform( const QTransform &t );
228+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
229229

230230

231231
virtual void addToPainterPath( QPainterPath &path ) const;

python/core/geometry/qgspoint.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class QgsPoint: QgsAbstractGeometry
359359

360360
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
361361
bool transformZ = false );
362-
virtual void transform( const QTransform &t );
362+
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
363363

364364
virtual QgsCoordinateSequence coordinateSequence() const;
365365

python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
from .TextToFloat import TextToFloat
144144
from .TinInterpolation import TinInterpolation
145145
from .TopoColors import TopoColor
146-
from .Translate import Translate
147146
from .TruncateTable import TruncateTable
148147
from .Union import Union
149148
from .UniqueValues import UniqueValues
@@ -268,7 +267,6 @@ def getAlgs(self):
268267
TextToFloat(),
269268
TinInterpolation(),
270269
TopoColor(),
271-
Translate(),
272270
TruncateTable(),
273271
Union(),
274272
UniqueValues(),

python/plugins/processing/algs/qgis/Translate.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)