@@ -58,20 +58,21 @@ class QgsCoordinateTransform: public QObject
58
58
/* ! Default constructor. Make sure you use initialised() manually if you use this one! */
59
59
QgsCoordinateTransform () ;
60
60
61
- /* Constructs a QgsCoordinateTransform using QgsSpatialRefSys objects.
62
- * @param theSource SRS of the layer's coordinate system
63
- * @param theDest SRS of the map canvas coordinate system
61
+ /* * Constructs a QgsCoordinateTransform using QgsSpatialRefSys objects.
62
+ * @param theSource SRS, typically of the layer's coordinate system
63
+ * @param theDest SRS, typically of the map canvas coordinate system
64
64
*/
65
65
QgsCoordinateTransform (const QgsSpatialRefSys& theSource,
66
66
const QgsSpatialRefSys& theDest);
67
67
68
68
/* !
69
69
* Constructs a QgsCoordinateTransform using the Well Known Text representation
70
70
* of the layer and map canvas coordinate systems
71
- * @param theSourceWKT WKT of the layer's coordinate system
72
- * @param theSourceWKT WKT of the map canvas coordinate system
71
+ * @param theSourceWKT WKT, typically of the layer's coordinate system
72
+ * @param theDestWKT WKT, typically of the map canvas coordinate system
73
73
*/
74
74
QgsCoordinateTransform (QString theSourceWKT, QString theDestWKT );
75
+
75
76
/* !
76
77
* Constructs a QgsCoordinateTransform using a Spatial Reference Id
77
78
* of the layer and map canvas coordinate system as Wkt
@@ -82,34 +83,40 @@ class QgsCoordinateTransform: public QObject
82
83
QgsCoordinateTransform (long theSourceSrid,
83
84
QString theDestWKT,
84
85
QgsSpatialRefSys::SRS_TYPE theSourceSRSType = QgsSpatialRefSys::POSTGIS_SRID );
86
+
85
87
// ! destructor
86
88
~QgsCoordinateTransform ();
89
+
87
90
// ! Enum used to indicate the direction (forward or inverse) of the transform
88
91
enum TransformDirection{
89
- FORWARD,
90
- INVERSE
92
+ FORWARD, /* !< Transform from source to destination SRS. */
93
+ INVERSE /* !< Transform from destination to source SRS. */
91
94
};
92
95
93
96
/* !
94
97
* Set the source (layer) QgsSpatialRefSys
95
98
* @param theSRS QgsSpatialRefSys representation of the layer's coordinate system
96
99
*/
97
100
void setSourceSRS (const QgsSpatialRefSys& theSRS);
101
+
98
102
/* !
99
103
* Mutator for dest QgsSpatialRefSys
100
104
* @param theSRS of the destination coordinate system
101
105
*/
102
- void setDestSRS (const QgsSpatialRefSys& theSRS);
106
+ void setDestSRS (const QgsSpatialRefSys& theSRS);
107
+
103
108
/* !
104
109
* Get the QgsSpatialRefSys representation of the layer's coordinate system
105
110
* @return QgsSpatialRefSys of the layer's coordinate system
106
111
*/
107
112
QgsSpatialRefSys& sourceSRS () { return mSourceSRS ; }
113
+
108
114
/* !
109
115
* Get the QgsSpatialRefSys representation of the map canvas coordinate system
110
116
* @return QgsSpatialRefSys of the map canvas coordinate system
111
117
*/
112
118
QgsSpatialRefSys& destSRS () { return mDestSRS ; }
119
+
113
120
/* ! Transform the point from Source Coordinate System to Destination Coordinate System
114
121
* If the direction is FORWARD then coordinates are transformed from layer CS --> map canvas CS,
115
122
* otherwise points are transformed from map canvas CS to layerCS.
@@ -118,6 +125,7 @@ class QgsCoordinateTransform: public QObject
118
125
* @return QgsPoint in Destination Coordinate System
119
126
*/
120
127
QgsPoint transform (const QgsPoint p,TransformDirection direction=FORWARD);
128
+
121
129
/* ! Transform the point specified by x,y from Source Coordinate System to Destination Coordinate System
122
130
* If the direction is FORWARD then coordinates are transformed from layer CS --> map canvas CS,
123
131
* otherwise points are transformed from map canvas CS to layerCS.
@@ -166,15 +174,18 @@ class QgsCoordinateTransform: public QObject
166
174
* @return QgsRect in Destination Coordinate System
167
175
*/
168
176
void transformCoords ( const int &numPoint, double *x, double *y, double *z,TransformDirection direction=FORWARD);
177
+
169
178
/* !
170
179
* Flag to indicate whether the coordinate systems have been initialised
171
180
* @return true if initialised, otherwise false
172
181
*/
173
182
bool isInitialised () {return mInitialisedFlag ;};
183
+
174
184
/* ! See if the transform short circuits because src and dest are equivalent
175
185
* @return bool True if it short circuits
176
186
*/
177
187
bool isShortCircuited () {return mShortCircuit ;};
188
+
178
189
public slots:
179
190
/* ! Change the destination coordinate system by passing it a qgis srsid
180
191
* A QGIS srsid is a unique key value to an entry on the tbl_srs in the
@@ -186,6 +197,7 @@ class QgsCoordinateTransform: public QObject
186
197
* to check if short circuiting is needed or not etc.
187
198
* @param theSRSID - A long representing the srsid of the srs to be used */
188
199
void setDestSRSID (long theSRSID);
200
+
189
201
// !initialise is used to actually create the Transformer instance
190
202
void initialise ();
191
203
@@ -194,6 +206,7 @@ class QgsCoordinateTransform: public QObject
194
206
* @return bool True on success, False on failure
195
207
*/
196
208
bool readXML ( QDomNode & theNode );
209
+
197
210
/* ! Stores state to the given DOM node in the given document
198
211
* @param theNode The node in which state will be restored
199
212
* @param theDom The document in which state will be stored
@@ -212,22 +225,27 @@ class QgsCoordinateTransform: public QObject
212
225
* equal and not transformation needs to be done
213
226
*/
214
227
bool mShortCircuit ;
228
+
215
229
/* !
216
230
* flag to show whether the transform is properly initialised or not
217
231
*/
218
232
bool mInitialisedFlag ;
233
+
219
234
/* !
220
235
* QgsSpatialRefSys of the source (layer) coordinate system
221
236
*/
222
237
QgsSpatialRefSys mSourceSRS ;
238
+
223
239
/* !
224
240
* QgsSpatialRefSys of the destination (map canvas) coordinate system
225
241
*/
226
242
QgsSpatialRefSys mDestSRS ;
243
+
227
244
/* !
228
245
* Proj4 data structure of the source projection (layer coordinate system)
229
246
*/
230
247
projPJ mSourceProjection ;
248
+
231
249
/* !
232
250
* Proj4 data structure of the destination projection (map canvas coordinate system)
233
251
*/
0 commit comments