Skip to content
Permalink
Browse files

Move datum transform structs out to their own header, to avoid

need to include private header file
  • Loading branch information
nyalldawson committed Dec 18, 2017
1 parent 1c7e140 commit 25c3e135b07bbeafcc645e2a543bc2fe6d746048
@@ -30,6 +30,7 @@
%Include qgsdataitemproviderregistry.sip
%Include qgsdatasourceuri.sip
%Include qgsdatetimestatisticalsummary.sip
%Include qgsdatumtransform.sip
%Include qgsdbfilterproxymodel.sip
%Include qgsdefaultvalue.sip
%Include qgsdiagramrenderer.sip
@@ -254,36 +254,7 @@ otherwise points are transformed from destination to source CRS.
Returns true if the transform short circuits because the source and destination are equivalent.
%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

int destinationTransformId;
%Docstring
ID for the datum transform to use when projecting to the destination CRS.

.. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
%End

bool operator==( const QgsCoordinateTransform::TransformPair &other ) const;

bool operator!=( const QgsCoordinateTransform::TransformPair &other ) const;

};

static QList< QgsCoordinateTransform::TransformPair > datumTransformations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination );
static QList< QgsDatumTransform::TransformPair > datumTransformations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination );
%Docstring
Returns a list of datum transformations which are available for the given ``source`` and ``destination`` CRS.

@@ -313,61 +284,7 @@ Returns -1 if matching datum ID was not found.
.. versionadded:: 3.0
%End

struct TransformInfo
{
int datumTransformId;
%Docstring
Datum transform ID
%End

int epsgCode;
%Docstring
EPSG code for the transform, or 0 if not found in EPSG database
%End

QString sourceCrsAuthId;
%Docstring
Source CRS auth ID
%End

QString destinationCrsAuthId;
%Docstring
Destination CRS auth ID
%End

QString sourceCrsDescription;
%Docstring
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 );
static QgsDatumTransform::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
@@ -65,7 +65,7 @@ Clears all stored transform information from the context.



QMap< QPair< QString, QString>, QgsCoordinateTransform::TransformPair > sourceDestinationDatumTransforms() const;
QMap< QPair< QString, QString>, QgsDatumTransform::TransformPair > sourceDestinationDatumTransforms() const;
%Docstring
Returns the stored mapping for source to destination CRS pairs to associated datum transforms to use.
The map keys will be QgsCoordinateReferenceSystems.authid()s.
@@ -123,7 +123,7 @@ when transforming from the specified ``source`` CRS to ``destination`` CRS.
source and destination are reversible.
%End

QgsCoordinateTransform::TransformPair calculateDatumTransforms( const QgsCoordinateReferenceSystem &source,
QgsDatumTransform::TransformPair calculateDatumTransforms( const QgsCoordinateReferenceSystem &source,
const QgsCoordinateReferenceSystem &destination ) const;
%Docstring
Returns the pair of source and destination datum transforms to use
@@ -0,0 +1,114 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdatumtransform.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsDatumTransform
{
%Docstring
Contains methods and classes relating the datum transformations.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsdatumtransform.h"
%End
public:

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

int destinationTransformId;
%Docstring
ID for the datum transform to use when projecting to the destination CRS.

.. seealso:: :py:func:`QgsCoordinateTransform.datumTransformCrsInfo()`
%End

bool operator==( const QgsDatumTransform::TransformPair &other ) const;

bool operator!=( const QgsDatumTransform::TransformPair &other ) const;

};

struct TransformInfo
{
int datumTransformId;
%Docstring
Datum transform ID
%End

int epsgCode;
%Docstring
EPSG code for the transform, or 0 if not found in EPSG database
%End

QString sourceCrsAuthId;
%Docstring
Source CRS auth ID
%End

QString destinationCrsAuthId;
%Docstring
Destination CRS auth ID
%End

QString sourceCrsDescription;
%Docstring
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

};
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdatumtransform.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -85,7 +85,7 @@ QVariant QgsDatumTransformTableModel::data( const QModelIndex &index, int role )
QPair< QString, QString> crses = mTransformContext.sourceDestinationDatumTransforms().keys().at( index.row() );
sourceCrs = crses.first;
destinationCrs = crses.second;
const QgsCoordinateTransform::TransformPair transforms = mTransformContext.sourceDestinationDatumTransforms().value( crses );
const QgsDatumTransform::TransformPair transforms = mTransformContext.sourceDestinationDatumTransforms().value( crses );
sourceTransform = transforms.sourceTransformId;
destinationTransform = transforms.destinationTransformId;
#ifdef singlesourcedest
@@ -854,14 +854,14 @@ SET(QGIS_CORE_HDRS
qgscoordinateformatter.h
qgscoordinatetransform.h
qgscoordinatetransformcontext.h
qgscoordinatetransformcontext_p.h
qgscoordinateutils.h
qgsdartmeasurement.h
qgsdatadefinedsizelegend.h
qgsdataitemprovider.h
qgsdataitemproviderregistry.h
qgsdatasourceuri.h
qgsdatetimestatisticalsummary.h
qgsdatumtransform.h
qgsdbfilterproxymodel.h
qgsdefaultvalue.h
qgsdiagramrenderer.h
@@ -691,9 +691,9 @@ const char *finder( const char *name )



QList< QgsCoordinateTransform::TransformPair > QgsCoordinateTransform::datumTransformations( const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS )
QList< QgsDatumTransform::TransformPair > QgsCoordinateTransform::datumTransformations( const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS )
{
QList< QgsCoordinateTransform::TransformPair > transformations;
QList< QgsDatumTransform::TransformPair > transformations;

QString srcGeoId = srcCRS.geographicCrsAuthId();
QString destGeoId = destCRS.geographicCrsAuthId();
@@ -735,20 +735,20 @@ QList< QgsCoordinateTransform::TransformPair > QgsCoordinateTransform::datumTran
//add direct datum transformations
for ( int transform : qgis::as_const( directTransforms ) )
{
transformations.push_back( TransformPair( transform, -1 ) );
transformations.push_back( QgsDatumTransform::TransformPair( transform, -1 ) );
}

//add direct datum transformations
for ( int transform : qgis::as_const( directTransforms ) )
{
transformations.push_back( TransformPair( -1, transform ) );
transformations.push_back( QgsDatumTransform::TransformPair( -1, transform ) );
}

for ( int srcTransform : qgis::as_const( srcToWgs84 ) )
{
for ( int destTransform : qgis::as_const( destToWgs84 ) )
{
transformations.push_back( TransformPair( srcTransform, destTransform ) );
transformations.push_back( QgsDatumTransform::TransformPair( srcTransform, destTransform ) );
}
}

@@ -821,9 +821,9 @@ int QgsCoordinateTransform::projStringToDatumTransformId( const QString &string
return QgsCoordinateTransformPrivate::transformIdFromString( string );
}

QgsCoordinateTransform::TransformInfo QgsCoordinateTransform::datumTransformInfo( int datumTransform )
QgsDatumTransform::TransformInfo QgsCoordinateTransform::datumTransformInfo( int datumTransform )
{
TransformInfo info;
QgsDatumTransform::TransformInfo info;

sqlite3_database_unique_ptr database;
int openResult = database.open_v2( QgsApplication::srsDatabaseFilePath(), SQLITE_OPEN_READONLY, nullptr );

0 comments on commit 25c3e13

Please sign in to comment.
You can’t perform that action at this time.