Skip to content

Commit 13d1786

Browse files
committed
Sipify
1 parent b287219 commit 13d1786

5 files changed

+160
-63
lines changed

python/core/qgscoordinatetransform.sip

+143-46
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Default constructor, creates an invalid QgsCoordinateTransform.
5555

5656
The ``context`` argument specifies the context under which the transform
5757
will be applied, and is used for calculating necessary datum transforms
58-
to utilise.
58+
to utilize.
5959

6060
.. versionadded:: 3.0
6161
%End
@@ -68,9 +68,21 @@ Default constructor, creates an invalid QgsCoordinateTransform.
6868
to ``destination`` coordinate reference system, when used with the
6969
given ``project``.
7070

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,
7272
and it is used to retrieve the project's transform context only.
7373

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+
7486
.. versionadded:: 3.0
7587
%End
7688

@@ -226,91 +238,176 @@ Default constructor, creates an invalid QgsCoordinateTransform.
226238
:rtype: bool
227239
%End
228240

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
229255

230-
static QString datumTransformString( int datumTransform );
256+
int destinationTransformId;
231257
%Docstring
232-
:rtype: str
258+
ID for the datum transform to use when projecting to the destination CRS.
259+
.. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
233260
%End
234261

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;
236265
%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)*
239266
:rtype: bool
240267
%End
241268

242-
int sourceDatumTransform() const;
269+
};
270+
271+
static QList< QgsCoordinateTransform::TransformPair > datumTransformations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination );
243272
%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
246278

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
249286

250-
.. seealso:: setSourceDatumTransform()
251-
.. seealso:: destinationDatumTransform()
252-
:rtype: int
287+
struct TransformInfo
288+
{
289+
int datumTransformId;
290+
%Docstring
291+
Datum transform ID
253292
%End
254293

255-
void setSourceDatumTransform( int datum );
294+
int epsgCode;
256295
%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
259298

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
262303

263-
.. seealso:: sourceDatumTransform()
264-
.. seealso:: setDestinationDatumTransform()
304+
QString destinationCrsAuthId;
305+
%Docstring
306+
Destination CRS auth ID
265307
%End
266308

267-
int destinationDatumTransform() const;
309+
QString sourceCrsDescription;
268310
%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
270354
CRS.
271355

272356
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().
274358

275-
.. seealso:: setDestinationDatumTransform()
276-
.. seealso:: sourceDatumTransform()
359+
.. seealso:: :py:func:`setSourceDatumTransformId()`
360+
.. seealso:: :py:func:`destinationDatumTransformId()`
361+
.. seealso:: :py:func:`datumTransformInfo()`
277362
:rtype: int
278363
%End
279364

280-
void setDestinationDatumTransform( int datum );
365+
void setSourceDatumTransformId( int datumId );
281366
%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
283368
CRS.
284369

285370
This is usually calculated automatically from the transform's QgsCoordinateTransformContext.
286371
Calling this method will overwrite any automatically calculated datum transform.
287372

288-
.. seealso:: destinationDatumTransform()
289-
.. seealso:: setSourceDatumTransform()
373+
.. seealso:: :py:func:`sourceDatumTransformId()`
374+
.. seealso:: :py:func:`setDestinationDatumTransformId()`
375+
.. seealso:: :py:func:`datumTransformInfo()`
290376
%End
291377

292-
void initialize();
378+
int destinationDatumTransformId() const;
293379
%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
295390
%End
296391

297-
bool readXml( const QDomNode &node );
392+
void setDestinationDatumTransformId( int datumId );
298393
%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()`
304403
%End
305404

306-
bool writeXml( QDomNode &node, QDomDocument &document ) const;
405+
static void invalidateCache();
307406
%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
314411
%End
315412

316413
};

python/core/qgscoordinatetransformcontext.sip

+8-8
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class QgsCoordinateTransformContext
7676
to use for a coordinate transform. Instead, always use calculateDatumTransforms()
7777
to determine this.
7878

79-
.. seealso:: addSourceDestinationDatumTransform()
79+
.. seealso:: :py:func:`addSourceDestinationDatumTransform()`
8080
:rtype: QMap< QPair< str, QString>, QgsCoordinateTransform.TransformPair >
8181
%End
8282

@@ -98,8 +98,8 @@ class QgsCoordinateTransformContext
9898
Transforms set using this method will override any specific source or destination
9999
transforms set by addSourceDatumTransform() or addDestinationDatumTransform().
100100

101-
.. seealso:: sourceDestinationDatumTransforms()
102-
.. seealso:: removeSourceDestinationDatumTransform()
101+
.. seealso:: :py:func:`sourceDestinationDatumTransforms()`
102+
.. seealso:: :py:func:`removeSourceDestinationDatumTransform()`
103103
:rtype: bool
104104
%End
105105

@@ -108,7 +108,7 @@ class QgsCoordinateTransformContext
108108
%Docstring
109109
Removes the source to destination datum transform pair for the specified ``sourceCrs`` and
110110
``destinationCrs``.
111-
.. seealso:: addSourceDestinationDatumTransform()
111+
.. seealso:: :py:func:`addSourceDestinationDatumTransform()`
112112
%End
113113

114114
bool hasTransform( const QgsCoordinateReferenceSystem &source,
@@ -140,26 +140,26 @@ class QgsCoordinateTransformContext
140140
void readXml( const QDomElement &element, const QgsReadWriteContext &context );
141141
%Docstring
142142
Reads the context's state from a DOM ``element``.
143-
.. seealso:: writeXml()
143+
.. seealso:: :py:func:`writeXml()`
144144
%End
145145

146146
void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
147147
%Docstring
148148
Writes the context's state to a DOM ``element``.
149-
.. seealso:: readXml()
149+
.. seealso:: :py:func:`readXml()`
150150
%End
151151

152152

153153
void readSettings();
154154
%Docstring
155155
Reads the context's state from application settings.
156-
.. seealso:: readSettings()
156+
.. seealso:: :py:func:`readSettings()`
157157
%End
158158

159159
void writeSettings();
160160
%Docstring
161161
Write the context's state to application settings.
162-
.. seealso:: writeSettings()
162+
.. seealso:: :py:func:`writeSettings()`
163163
%End
164164

165165

python/core/qgsmapsettings.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ Return the distance in geographical coordinates that equals to one pixel in the
311311
from a source to destination coordinate reference system.
312312

313313
.. versionadded:: 3.0
314-
.. seealso:: setTransformContext()
314+
.. seealso:: :py:func:`setTransformContext()`
315315
:rtype: QgsCoordinateTransformContext
316316
%End
317317

@@ -322,7 +322,7 @@ Return the distance in geographical coordinates that equals to one pixel in the
322322
from a source to destination coordinate reference system.
323323

324324
.. versionadded:: 3.0
325-
.. seealso:: transformContext()
325+
.. seealso:: :py:func:`transformContext()`
326326
%End
327327

328328
const QgsMapToPixel &mapToPixel() const;

python/core/qgsproject.sip

+5-5
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ Returns the QgsProject singleton instance
135135
from a source to destination coordinate reference system.
136136

137137
.. versionadded:: 3.0
138-
.. seealso:: setTransformContext()
139-
.. seealso:: transformContextChanged()
138+
.. seealso:: :py:func:`setTransformContext()`
139+
.. seealso:: :py:func:`transformContextChanged()`
140140
:rtype: QgsCoordinateTransformContext
141141
%End
142142

@@ -147,8 +147,8 @@ Returns the QgsProject singleton instance
147147
from a source to destination coordinate reference system.
148148

149149
.. versionadded:: 3.0
150-
.. seealso:: transformContext()
151-
.. seealso:: transformContextChanged()
150+
.. seealso:: :py:func:`transformContext()`
151+
.. seealso:: :py:func:`transformContextChanged()`
152152
%End
153153

154154
void clear();
@@ -942,7 +942,7 @@ emitted whenever the configuration for snapping has changed
942942
Emitted when the project transformContext() is changed.
943943

944944
.. versionadded:: 3.0
945-
.. seealso:: transformContext()
945+
.. seealso:: :py:func:`transformContext()`
946946
%End
947947

948948
void transactionGroupsChanged();

python/core/qgsrendercontext.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class QgsRenderContext
117117
from a source to destination coordinate reference system.
118118

119119
.. versionadded:: 3.0
120-
.. seealso:: setTransformContext()
120+
.. seealso:: :py:func:`setTransformContext()`
121121
:rtype: QgsCoordinateTransformContext
122122
%End
123123

@@ -128,7 +128,7 @@ class QgsRenderContext
128128
from a source to destination coordinate reference system.
129129

130130
.. versionadded:: 3.0
131-
.. seealso:: transformContext()
131+
.. seealso:: :py:func:`transformContext()`
132132
%End
133133

134134
const QgsRectangle &extent() const;

0 commit comments

Comments
 (0)