Skip to content

Commit e6df492

Browse files
committed
Add missing docs, refine docs for QgsCoordinateTransform
1 parent adafeda commit e6df492

File tree

2 files changed

+195
-91
lines changed

2 files changed

+195
-91
lines changed

python/core/qgscoordinatetransform.sip

Lines changed: 104 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -98,78 +98,130 @@ class QgsCoordinateTransform
9898
*/
9999
QgsCoordinateReferenceSystem destinationCrs() const;
100100

101-
/** Transform the point from Source Coordinate System to Destination Coordinate System
102-
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
103-
* otherwise points are transformed from map canvas CS to layerCS.
104-
* @param point Point to transform
105-
* @param direction TransformDirection (defaults to ForwardTransform)
106-
* @return QgsPoint in Destination Coordinate System
107-
*/
108-
QgsPoint transform( const QgsPoint &point, TransformDirection direction = ForwardTransform ) const throw (QgsCsException);
109-
110-
/** Transform the point specified by x,y from Source Coordinate System to Destination Coordinate System
111-
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
112-
* otherwise points are transformed from map canvas CS to layerCS.
113-
* @param x x cordinate of point to transform
101+
/** Transform the point from the source CRS to the destination CRS.
102+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
103+
* otherwise points are transformed from destination to source CRS.
104+
* @param point point to transform
105+
* @param direction transform direction (defaults to ForwardTransform)
106+
* @return transformed point
107+
*/
108+
QgsPoint transform( const QgsPoint& point, TransformDirection direction = ForwardTransform ) const;
109+
110+
/** Transform the point specified by x,y from the source CRS to the destination CRS.
111+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
112+
* otherwise points are transformed from destination to source CRS.
113+
* @param x x coordinate of point to transform
114114
* @param y y coordinate of point to transform
115-
* @param direction TransformDirection (defaults to ForwardTransform)
116-
* @return QgsPoint in Destination Coordinate System
115+
* @param direction transform direction (defaults to ForwardTransform)
116+
* @return transformed point
117117
*/
118-
QgsPoint transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const throw (QgsCsException);
118+
QgsPoint transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const;
119119

120-
/** Transforms a QgsRectangle to the dest Coordinate system
121-
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
122-
* otherwise points are transformed from map canvas CS to layerCS.
123-
* It assumes that rect is a bounding box, and creates a bounding box
124-
* in the proejcted CS, so that all points in source rectangle is within
125-
* returned rectangle.
120+
/** Transforms a rectangle from the source CRS to the destination CRS.
121+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
122+
* otherwise points are transformed from destination to source CRS.
123+
* This method assumes that the rectangle is a bounding box, and creates a bounding box
124+
* in the projected CRS, such that all points from the source rectangle are within
125+
* the returned rectangle.
126126
* @param rectangle rectangle to transform
127-
* @param direction TransformDirection (defaults to ForwardTransform)
128-
* @param handle180Crossover set to true if destination crs is geographic and handling of extents crossing the 180 degree
129-
* longitude line is required
130-
* @return QgsRectangle in Destination Coordinate System
127+
* @param direction transform direction (defaults to ForwardTransform)
128+
* @param handle180Crossover set to true if destination CRS is geographic and handling of extents
129+
* crossing the 180 degree longitude line is required
130+
* @return rectangle in destination CRS
131+
*/
132+
QgsRectangle transformBoundingBox( const QgsRectangle& rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const;
133+
134+
/** Transforms an array of x, y and z double coordinates in place, from the source CRS to the destination CRS.
135+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
136+
* otherwise points are transformed from destination to source CRS.
137+
* @param x array of x coordinates of points to transform
138+
* @param y array of y coordinates of points to transform
139+
* @param z array of z coordinates of points to transform. The z coordinates of the points
140+
* must represent height relative to the vertical datum of the source CRS (generally ellipsoidal
141+
* heights) and must be expressed in its vertical units (generally meters)
142+
* @param direction transform direction (defaults to ForwardTransform)
131143
*/
132-
QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const throw (QgsCsException);
144+
void transformInPlace( double& x, double& y, double &z, TransformDirection direction = ForwardTransform ) const;
133145

134-
// Same as for the other transform() functions, but alters the x
135-
// and y variables in place. The second one works with good old-fashioned
136-
// C style arrays.
137-
void transformInPlace( double& x, double& y, double &z, TransformDirection direction = ForwardTransform ) const throw (QgsCsException);
146+
/** Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS.
147+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
148+
* otherwise points are transformed from destination to source CRS.
149+
* @param x array of x coordinates of points to transform
150+
* @param y array of y coordinates of points to transform
151+
* @param z array of z coordinates of points to transform. The z coordinates of the points
152+
* must represent height relative to the vertical datum of the source CRS (generally ellipsoidal
153+
* heights) and must be expressed in its vertical units (generally meters)
154+
* @param direction transform direction (defaults to ForwardTransform)
155+
* @note not available in python bindings
156+
*/
157+
//void transformInPlace( float& x, float& y, double &z, TransformDirection direction = ForwardTransform ) const;
138158

139-
// @note not available in python bindings
140-
// void transformInPlace( float& x, float& y, double &z, TransformDirection direction = ForwardTransform ) const;
141-
// @note not available in python bindings
159+
/** Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS.
160+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
161+
* otherwise points are transformed from destination to source CRS.
162+
* @param x array of x coordinates of points to transform
163+
* @param y array of y coordinates of points to transform
164+
* @param z array of z coordinates of points to transform. The z coordinates of the points
165+
* must represent height relative to the vertical datum of the source CRS (generally ellipsoidal
166+
* heights) and must be expressed in its vertical units (generally meters)
167+
* @param direction transform direction (defaults to ForwardTransform)
168+
* @note not available in python bindings
169+
*/
142170
// void transformInPlace( float& x, float& y, float& z, TransformDirection direction = ForwardTransform ) const;
143-
// @note not available in python bindings
144-
// void transformInPlace( QVector<float>& x, QVector<float>& y, QVector<float>& z,
171+
172+
/** Transforms a vector of x, y and z float coordinates in place, from the source CRS to the destination CRS.
173+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
174+
* otherwise points are transformed from destination to source CRS.
175+
* @param x vector of x coordinates of points to transform
176+
* @param y vector of y coordinates of points to transform
177+
* @param z vector of z coordinates of points to transform. The z coordinates of the points
178+
* must represent height relative to the vertical datum of the source CRS (generally ellipsoidal
179+
* heights) and must be expressed in its vertical units (generally meters)
180+
* @param direction transform direction (defaults to ForwardTransform)
181+
* @note not available in python bindings
182+
*/
183+
//void transformInPlace( QVector<float>& x, QVector<float>& y, QVector<float>& z,
145184
// TransformDirection direction = ForwardTransform ) const;
146185

147-
//! @note not available in python bindings
148-
// void transformInPlace( QVector<double>& x, QVector<double>& y, QVector<double>& z,
149-
// TransformDirection direction = ForwardTransform ) const;
186+
/** Transforms a vector of x, y and z double coordinates in place, from the source CRS to the destination CRS.
187+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
188+
* otherwise points are transformed from destination to source CRS.
189+
* @param x vector of x coordinates of points to transform
190+
* @param y vector of y coordinates of points to transform
191+
* @param z vector of z coordinates of points to transform. The z coordinates of the points
192+
* must represent height relative to the vertical datum of the source CRS (generally ellipsoidal
193+
* heights) and must be expressed in its vertical units (generally meters)
194+
* @param direction transform direction (defaults to ForwardTransform)
195+
* @note not available in python bindings
196+
*/
197+
//void transformInPlace( QVector<double>& x, QVector<double>& y, QVector<double>& z,
198+
// TransformDirection direction = ForwardTransform ) const;
150199

200+
/** Transforms a polygon to the destination coordinate system.
201+
* @param polygon polygon to transform (occurs in place)
202+
* @param direction transform direction (defaults to forward transformation)
203+
*/
151204
void transformPolygon( QPolygonF& polygon, TransformDirection direction = ForwardTransform ) const;
152205

153-
/** Transform a QgsRectangle to the dest Coordinate system
154-
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
155-
* otherwise points are transformed from map canvas CS to layerCS.
156-
* @param rectangle rect to transform
157-
* @param direction TransformDirection (defaults to ForwardTransform)
158-
* @return QgsRectangle in Destination Coordinate System
206+
/** Transforms a rectangle to the destination CRS.
207+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
208+
* otherwise points are transformed from destination to source CRS.
209+
* @param rectangle rectangle to transform
210+
* @param direction transform direction (defaults to ForwardTransform)
211+
* @return transformed rectangle
159212
*/
160-
QgsRectangle transform( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform ) const throw (QgsCsException);
213+
QgsRectangle transform( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform ) const;
161214

162-
/** Transform an array of coordinates to a different Coordinate System
163-
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
164-
* otherwise points are transformed from map canvas CS to layerCS.
215+
/** Transform an array of coordinates to the destination CRS.
216+
* If the direction is ForwardTransform then coordinates are transformed from source to destination,
217+
* otherwise points are transformed from destination to source CRS.
165218
* @param numPoint number of coordinates in arrays
166219
* @param x array of x coordinates to transform
167220
* @param y array of y coordinates to transform
168221
* @param z array of z coordinates to transform
169-
* @param direction TransformDirection (defaults to ForwardTransform)
170-
* @return QgsRectangle in Destination Coordinate System
222+
* @param direction transform direction (defaults to ForwardTransform)
171223
*/
172-
void transformCoords( int numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const throw (QgsCsException);
224+
void transformCoords( int numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const;
173225

174226
/** Returns true if the transform short circuits because the source and destination are equivalent.
175227
*/

0 commit comments

Comments
 (0)