@@ -55,7 +55,7 @@ Default constructor, creates an invalid QgsCoordinateTransform.
55
55
56
56
The ``context`` argument specifies the context under which the transform
57
57
will be applied, and is used for calculating necessary datum transforms
58
- to utilise .
58
+ to utilize .
59
59
60
60
.. versionadded:: 3.0
61
61
%End
@@ -68,9 +68,21 @@ Default constructor, creates an invalid QgsCoordinateTransform.
68
68
to ``destination`` coordinate reference system, when used with the
69
69
given ``project``.
70
70
71
- No reference to ``project`` is stored or utilised outside of the constructor,
71
+ No reference to ``project`` is stored or utilized outside of the constructor,
72
72
and it is used to retrieve the project's transform context only.
73
73
74
+ .. versionadded:: 3.0
75
+ %End
76
+
77
+ explicit QgsCoordinateTransform( const QgsCoordinateReferenceSystem &source,
78
+ const QgsCoordinateReferenceSystem &destination,
79
+ int sourceDatumTransformId,
80
+ int destinationDatumTransformId );
81
+ %Docstring
82
+ Constructs a QgsCoordinateTransform to transform from the ``source``
83
+ to ``destination`` coordinate reference system, with the specified
84
+ datum transforms.
85
+
74
86
.. versionadded:: 3.0
75
87
%End
76
88
@@ -226,91 +238,176 @@ Default constructor, creates an invalid QgsCoordinateTransform.
226
238
:rtype: bool
227
239
%End
228
240
241
+ struct TransformPair
242
+ {
243
+
244
+ TransformPair( int sourceTransformId = -1, int destinationTransformId = -1 );
245
+ %Docstring
246
+ Constructor for a TransformPair with the specified ``sourceTransformId``
247
+ and ``destinationTransformId`` transforms.
248
+ %End
249
+
250
+ int sourceTransformId;
251
+ %Docstring
252
+ ID for the datum transform to use when projecting from the source CRS.
253
+ .. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
254
+ %End
229
255
230
- static QString datumTransformString( int datumTransform ) ;
256
+ int destinationTransformId ;
231
257
%Docstring
232
- :rtype: str
258
+ ID for the datum transform to use when projecting to the destination CRS.
259
+ .. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
233
260
%End
234
261
235
- static bool datumTransformCrsInfo( int datumTransform, int &epsgNr, QString &srcProjection, QString &dstProjection, QString &remarks, QString &scope, bool &preferred, bool &deprecated );
262
+ bool operator==( const QgsCoordinateTransform::TransformPair &other ) const;
263
+
264
+ bool operator!=( const QgsCoordinateTransform::TransformPair &other ) const;
236
265
%Docstring
237
- Gets name of source and dest geographical CRS (to show in a tooltip)
238
- :return: epsgNr epsg code of the transformation (or 0 if not in epsg db)*
239
266
:rtype: bool
240
267
%End
241
268
242
- int sourceDatumTransform() const;
269
+ };
270
+
271
+ static QList< QgsCoordinateTransform::TransformPair > datumTransformations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination );
243
272
%Docstring
244
- Returns the index of the datum transform to use when projecting from the source
245
- CRS.
273
+ Returns a list of datum transformations which are available for the given ``source`` and ``destination`` CRS.
274
+ .. seealso:: :py:func:`datumTransformToProj()`
275
+ .. seealso:: :py:func:`datumTransformInfo()`
276
+ :rtype: list of QgsCoordinateTransform.TransformPair
277
+ %End
246
278
247
- This is usually calculated automatically from the transform's QgsCoordinateTransformContext,
248
- but can be manually overwritten by a call to setSourceDatumTransform().
279
+ static QString datumTransformToProj( int datumTransformId );
280
+ %Docstring
281
+ Returns a proj string representing the specified ``datumTransformId`` datum transform ID.
282
+ .. seealso:: :py:func:`datumTransformations()`
283
+ .. seealso:: :py:func:`datumTransformInfo()`
284
+ :rtype: str
285
+ %End
249
286
250
- .. seealso:: setSourceDatumTransform()
251
- .. seealso:: destinationDatumTransform()
252
- :rtype: int
287
+ struct TransformInfo
288
+ {
289
+ int datumTransformId;
290
+ %Docstring
291
+ Datum transform ID
253
292
%End
254
293
255
- void setSourceDatumTransform( int datum ) ;
294
+ int epsgCode ;
256
295
%Docstring
257
- Sets the index of the ``datum`` transform to use when projecting from the source
258
- CRS.
296
+ EPSG code for the transform, or 0 if not found in EPSG database
297
+ %End
259
298
260
- This is usually calculated automatically from the transform's QgsCoordinateTransformContext.
261
- Calling this method will overwrite any automatically calculated datum transform.
299
+ QString sourceCrsAuthId;
300
+ %Docstring
301
+ Source CRS auth ID
302
+ %End
262
303
263
- .. seealso:: sourceDatumTransform()
264
- .. seealso:: setDestinationDatumTransform()
304
+ QString destinationCrsAuthId;
305
+ %Docstring
306
+ Destination CRS auth ID
265
307
%End
266
308
267
- int destinationDatumTransform() const ;
309
+ QString sourceCrsDescription ;
268
310
%Docstring
269
- Returns the index of the datum transform to use when projecting to the destination
311
+ Source CRS description
312
+ %End
313
+
314
+ QString destinationCrsDescription;
315
+ %Docstring
316
+ Destination CRS description
317
+ %End
318
+
319
+ QString remarks;
320
+ %Docstring
321
+ Transform remarks
322
+ %End
323
+
324
+ QString scope;
325
+ %Docstring
326
+ Scope of transform
327
+ %End
328
+
329
+ bool preferred;
330
+ %Docstring
331
+ True if transform is the preferred transform to use for the source/destination CRS combination
332
+ %End
333
+
334
+ bool deprecated;
335
+ %Docstring
336
+ True if transform is deprecated
337
+ %End
338
+
339
+ };
340
+
341
+ static QgsCoordinateTransform::TransformInfo datumTransformInfo( int datumTransformId );
342
+ %Docstring
343
+ Returns detailed information about the specified ``datumTransformId``.
344
+ If ``datumTransformId`` was not a valid transform ID, a TransformInfo with TransformInfo.datumTransformId of
345
+ -1 will be returned.
346
+ .. seealso:: :py:func:`datumTransformations()`
347
+ .. seealso:: :py:func:`datumTransformToProj()`
348
+ :rtype: QgsCoordinateTransform.TransformInfo
349
+ %End
350
+
351
+ int sourceDatumTransformId() const;
352
+ %Docstring
353
+ Returns the ID of the datum transform to use when projecting from the source
270
354
CRS.
271
355
272
356
This is usually calculated automatically from the transform's QgsCoordinateTransformContext,
273
- but can be manually overwritten by a call to setDestinationDatumTransform ().
357
+ but can be manually overwritten by a call to setSourceDatumTransformId ().
274
358
275
- .. seealso:: setDestinationDatumTransform()
276
- .. seealso:: sourceDatumTransform()
359
+ .. seealso:: :py:func:`setSourceDatumTransformId()`
360
+ .. seealso:: :py:func:`destinationDatumTransformId()`
361
+ .. seealso:: :py:func:`datumTransformInfo()`
277
362
:rtype: int
278
363
%End
279
364
280
- void setDestinationDatumTransform ( int datum );
365
+ void setSourceDatumTransformId ( int datumId );
281
366
%Docstring
282
- Sets the index of the `` datum`` transform to use when projecting to the destination
367
+ Sets the ``datumId`` ID of the datum transform to use when projecting from the source
283
368
CRS.
284
369
285
370
This is usually calculated automatically from the transform's QgsCoordinateTransformContext.
286
371
Calling this method will overwrite any automatically calculated datum transform.
287
372
288
- .. seealso:: destinationDatumTransform()
289
- .. seealso:: setSourceDatumTransform()
373
+ .. seealso:: :py:func:`sourceDatumTransformId()`
374
+ .. seealso:: :py:func:`setDestinationDatumTransformId()`
375
+ .. seealso:: :py:func:`datumTransformInfo()`
290
376
%End
291
377
292
- void initialize() ;
378
+ int destinationDatumTransformId() const ;
293
379
%Docstring
294
- initialize is used to actually create the Transformer instance
380
+ Returns the ID of the datum transform to use when projecting to the destination
381
+ CRS.
382
+
383
+ This is usually calculated automatically from the transform's QgsCoordinateTransformContext,
384
+ but can be manually overwritten by a call to setDestinationDatumTransformId().
385
+
386
+ .. seealso:: :py:func:`setDestinationDatumTransformId()`
387
+ .. seealso:: :py:func:`sourceDatumTransformId()`
388
+ .. seealso:: :py:func:`datumTransformInfo()`
389
+ :rtype: int
295
390
%End
296
391
297
- bool readXml( const QDomNode &node );
392
+ void setDestinationDatumTransformId( int datumId );
298
393
%Docstring
299
- Restores state from the given Dom node.
300
- \param node The node from which state will be restored
301
- :return: bool True on success, False on failure
302
- .. seealso:: :py:func:`writeXml()`
303
- :rtype: bool
394
+ Sets the ``datumId`` ID of the datum transform to use when projecting to the destination
395
+ CRS.
396
+
397
+ This is usually calculated automatically from the transform's QgsCoordinateTransformContext.
398
+ Calling this method will overwrite any automatically calculated datum transform.
399
+
400
+ .. seealso:: :py:func:`destinationDatumTransformId()`
401
+ .. seealso:: :py:func:`setSourceDatumTransformId()`
402
+ .. seealso:: :py:func:`datumTransformInfo()`
304
403
%End
305
404
306
- bool writeXml( QDomNode &node, QDomDocument &document ) const ;
405
+ static void invalidateCache() ;
307
406
%Docstring
308
- Stores state to the given Dom node in the given document
309
- \param node The node in which state will be restored
310
- \param document The document in which state will be stored
311
- :return: bool True on success, False on failure
312
- .. seealso:: :py:func:`readXml()`
313
- :rtype: bool
407
+ Clears the internal cache used to initialize QgsCoordinateTransform objects.
408
+ This should be called whenever the srs database has
409
+ been modified in order to ensure that outdated CRS transforms are not created.
410
+ .. versionadded:: 3.0
314
411
%End
315
412
316
413
};
0 commit comments