Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sipify
  • Loading branch information
nyalldawson committed Dec 15, 2017
1 parent b287219 commit 13d1786
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 63 deletions.
189 changes: 143 additions & 46 deletions python/core/qgscoordinatetransform.sip
Expand Up @@ -55,7 +55,7 @@ Default constructor, creates an invalid QgsCoordinateTransform.


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


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


No reference to ``project`` is stored or utilised outside of the constructor, No reference to ``project`` is stored or utilized outside of the constructor,
and it is used to retrieve the project's transform context only. and it is used to retrieve the project's transform context only.


.. versionadded:: 3.0
%End

explicit QgsCoordinateTransform( const QgsCoordinateReferenceSystem &source,
const QgsCoordinateReferenceSystem &destination,
int sourceDatumTransformId,
int destinationDatumTransformId );
%Docstring
Constructs a QgsCoordinateTransform to transform from the ``source``
to ``destination`` coordinate reference system, with the specified
datum transforms.

.. versionadded:: 3.0 .. versionadded:: 3.0
%End %End


Expand Down Expand Up @@ -226,91 +238,176 @@ Default constructor, creates an invalid QgsCoordinateTransform.
:rtype: bool :rtype: bool
%End %End


struct TransformPair
{

TransformPair( int sourceTransformId = -1, int destinationTransformId = -1 );
%Docstring
Constructor for a TransformPair with the specified ``sourceTransformId``
and ``destinationTransformId`` transforms.
%End

int sourceTransformId;
%Docstring
ID for the datum transform to use when projecting from the source CRS.
.. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
%End


static QString datumTransformString( int datumTransform ); int destinationTransformId;
%Docstring %Docstring
:rtype: str ID for the datum transform to use when projecting to the destination CRS.
.. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
%End %End


static bool datumTransformCrsInfo( int datumTransform, int &epsgNr, QString &srcProjection, QString &dstProjection, QString &remarks, QString &scope, bool &preferred, bool &deprecated ); bool operator==( const QgsCoordinateTransform::TransformPair &other ) const;

bool operator!=( const QgsCoordinateTransform::TransformPair &other ) const;
%Docstring %Docstring
Gets name of source and dest geographical CRS (to show in a tooltip)
:return: epsgNr epsg code of the transformation (or 0 if not in epsg db)*
:rtype: bool :rtype: bool
%End %End


int sourceDatumTransform() const; };

static QList< QgsCoordinateTransform::TransformPair > datumTransformations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination );
%Docstring %Docstring
Returns the index of the datum transform to use when projecting from the source Returns a list of datum transformations which are available for the given ``source`` and ``destination`` CRS.
CRS. .. seealso:: :py:func:`datumTransformToProj()`
.. seealso:: :py:func:`datumTransformInfo()`
:rtype: list of QgsCoordinateTransform.TransformPair
%End


This is usually calculated automatically from the transform's QgsCoordinateTransformContext, static QString datumTransformToProj( int datumTransformId );
but can be manually overwritten by a call to setSourceDatumTransform(). %Docstring
Returns a proj string representing the specified ``datumTransformId`` datum transform ID.
.. seealso:: :py:func:`datumTransformations()`
.. seealso:: :py:func:`datumTransformInfo()`
:rtype: str
%End


.. seealso:: setSourceDatumTransform() struct TransformInfo
.. seealso:: destinationDatumTransform() {
:rtype: int int datumTransformId;
%Docstring
Datum transform ID
%End %End


void setSourceDatumTransform( int datum ); int epsgCode;
%Docstring %Docstring
Sets the index of the ``datum`` transform to use when projecting from the source EPSG code for the transform, or 0 if not found in EPSG database
CRS. %End


This is usually calculated automatically from the transform's QgsCoordinateTransformContext. QString sourceCrsAuthId;
Calling this method will overwrite any automatically calculated datum transform. %Docstring
Source CRS auth ID
%End


.. seealso:: sourceDatumTransform() QString destinationCrsAuthId;
.. seealso:: setDestinationDatumTransform() %Docstring
Destination CRS auth ID
%End %End


int destinationDatumTransform() const; QString sourceCrsDescription;
%Docstring %Docstring
Returns the index of the datum transform to use when projecting to the destination Source CRS description
%End

QString destinationCrsDescription;
%Docstring
Destination CRS description
%End

QString remarks;
%Docstring
Transform remarks
%End

QString scope;
%Docstring
Scope of transform
%End

bool preferred;
%Docstring
True if transform is the preferred transform to use for the source/destination CRS combination
%End

bool deprecated;
%Docstring
True if transform is deprecated
%End

};

static QgsCoordinateTransform::TransformInfo datumTransformInfo( int datumTransformId );
%Docstring
Returns detailed information about the specified ``datumTransformId``.
If ``datumTransformId`` was not a valid transform ID, a TransformInfo with TransformInfo.datumTransformId of
-1 will be returned.
.. seealso:: :py:func:`datumTransformations()`
.. seealso:: :py:func:`datumTransformToProj()`
:rtype: QgsCoordinateTransform.TransformInfo
%End

int sourceDatumTransformId() const;
%Docstring
Returns the ID of the datum transform to use when projecting from the source
CRS. CRS.


This is usually calculated automatically from the transform's QgsCoordinateTransformContext, This is usually calculated automatically from the transform's QgsCoordinateTransformContext,
but can be manually overwritten by a call to setDestinationDatumTransform(). but can be manually overwritten by a call to setSourceDatumTransformId().


.. seealso:: setDestinationDatumTransform() .. seealso:: :py:func:`setSourceDatumTransformId()`
.. seealso:: sourceDatumTransform() .. seealso:: :py:func:`destinationDatumTransformId()`
.. seealso:: :py:func:`datumTransformInfo()`
:rtype: int :rtype: int
%End %End


void setDestinationDatumTransform( int datum ); void setSourceDatumTransformId( int datumId );
%Docstring %Docstring
Sets the index of the ``datum`` transform to use when projecting to the destination Sets the ``datumId`` ID of the datum transform to use when projecting from the source
CRS. CRS.


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


.. seealso:: destinationDatumTransform() .. seealso:: :py:func:`sourceDatumTransformId()`
.. seealso:: setSourceDatumTransform() .. seealso:: :py:func:`setDestinationDatumTransformId()`
.. seealso:: :py:func:`datumTransformInfo()`
%End %End


void initialize(); int destinationDatumTransformId() const;
%Docstring %Docstring
initialize is used to actually create the Transformer instance Returns the ID of the datum transform to use when projecting to the destination
CRS.

This is usually calculated automatically from the transform's QgsCoordinateTransformContext,
but can be manually overwritten by a call to setDestinationDatumTransformId().

.. seealso:: :py:func:`setDestinationDatumTransformId()`
.. seealso:: :py:func:`sourceDatumTransformId()`
.. seealso:: :py:func:`datumTransformInfo()`
:rtype: int
%End %End


bool readXml( const QDomNode &node ); void setDestinationDatumTransformId( int datumId );
%Docstring %Docstring
Restores state from the given Dom node. Sets the ``datumId`` ID of the datum transform to use when projecting to the destination
\param node The node from which state will be restored CRS.
:return: bool True on success, False on failure
.. seealso:: :py:func:`writeXml()` This is usually calculated automatically from the transform's QgsCoordinateTransformContext.
:rtype: bool Calling this method will overwrite any automatically calculated datum transform.

.. seealso:: :py:func:`destinationDatumTransformId()`
.. seealso:: :py:func:`setSourceDatumTransformId()`
.. seealso:: :py:func:`datumTransformInfo()`
%End %End


bool writeXml( QDomNode &node, QDomDocument &document ) const; static void invalidateCache();
%Docstring %Docstring
Stores state to the given Dom node in the given document Clears the internal cache used to initialize QgsCoordinateTransform objects.
\param node The node in which state will be restored This should be called whenever the srs database has
\param document The document in which state will be stored been modified in order to ensure that outdated CRS transforms are not created.
:return: bool True on success, False on failure .. versionadded:: 3.0
.. seealso:: :py:func:`readXml()`
:rtype: bool
%End %End


}; };
Expand Down
16 changes: 8 additions & 8 deletions python/core/qgscoordinatetransformcontext.sip
Expand Up @@ -76,7 +76,7 @@ class QgsCoordinateTransformContext
to use for a coordinate transform. Instead, always use calculateDatumTransforms() to use for a coordinate transform. Instead, always use calculateDatumTransforms()
to determine this. to determine this.


.. seealso:: addSourceDestinationDatumTransform() .. seealso:: :py:func:`addSourceDestinationDatumTransform()`
:rtype: QMap< QPair< str, QString>, QgsCoordinateTransform.TransformPair > :rtype: QMap< QPair< str, QString>, QgsCoordinateTransform.TransformPair >
%End %End


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


.. seealso:: sourceDestinationDatumTransforms() .. seealso:: :py:func:`sourceDestinationDatumTransforms()`
.. seealso:: removeSourceDestinationDatumTransform() .. seealso:: :py:func:`removeSourceDestinationDatumTransform()`
:rtype: bool :rtype: bool
%End %End


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


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


void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const; void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
%Docstring %Docstring
Writes the context's state to a DOM ``element``. Writes the context's state to a DOM ``element``.
.. seealso:: readXml() .. seealso:: :py:func:`readXml()`
%End %End




void readSettings(); void readSettings();
%Docstring %Docstring
Reads the context's state from application settings. Reads the context's state from application settings.
.. seealso:: readSettings() .. seealso:: :py:func:`readSettings()`
%End %End


void writeSettings(); void writeSettings();
%Docstring %Docstring
Write the context's state to application settings. Write the context's state to application settings.
.. seealso:: writeSettings() .. seealso:: :py:func:`writeSettings()`
%End %End




Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsmapsettings.sip
Expand Up @@ -311,7 +311,7 @@ Return the distance in geographical coordinates that equals to one pixel in the
from a source to destination coordinate reference system. from a source to destination coordinate reference system.


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: setTransformContext() .. seealso:: :py:func:`setTransformContext()`
:rtype: QgsCoordinateTransformContext :rtype: QgsCoordinateTransformContext
%End %End


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


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: transformContext() .. seealso:: :py:func:`transformContext()`
%End %End


const QgsMapToPixel &mapToPixel() const; const QgsMapToPixel &mapToPixel() const;
Expand Down
10 changes: 5 additions & 5 deletions python/core/qgsproject.sip
Expand Up @@ -135,8 +135,8 @@ Returns the QgsProject singleton instance
from a source to destination coordinate reference system. from a source to destination coordinate reference system.


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: setTransformContext() .. seealso:: :py:func:`setTransformContext()`
.. seealso:: transformContextChanged() .. seealso:: :py:func:`transformContextChanged()`
:rtype: QgsCoordinateTransformContext :rtype: QgsCoordinateTransformContext
%End %End


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


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: transformContext() .. seealso:: :py:func:`transformContext()`
.. seealso:: transformContextChanged() .. seealso:: :py:func:`transformContextChanged()`
%End %End


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


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: transformContext() .. seealso:: :py:func:`transformContext()`
%End %End


void transactionGroupsChanged(); void transactionGroupsChanged();
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsrendercontext.sip
Expand Up @@ -117,7 +117,7 @@ class QgsRenderContext
from a source to destination coordinate reference system. from a source to destination coordinate reference system.


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: setTransformContext() .. seealso:: :py:func:`setTransformContext()`
:rtype: QgsCoordinateTransformContext :rtype: QgsCoordinateTransformContext
%End %End


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


.. versionadded:: 3.0 .. versionadded:: 3.0
.. seealso:: transformContext() .. seealso:: :py:func:`transformContext()`
%End %End


const QgsRectangle &extent() const; const QgsRectangle &extent() const;
Expand Down

0 comments on commit 13d1786

Please sign in to comment.