Skip to content
Permalink
Browse files

Merge pull request #5898 from nyalldawson/datum

Datum transform fixes, header reworking
  • Loading branch information
nyalldawson committed Dec 18, 2017
2 parents 7c01b7e + 198486f commit 753b3e0820634a88d4a70f113540f3ba6e913e48
@@ -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
@@ -12,7 +12,6 @@




class QgsCoordinateTransformContext
{
%Docstring
@@ -51,6 +50,8 @@ applies for destination CRS transforms set using addDestinationDatumTransform().
Constructor for QgsCoordinateTransformContext.
%End

~QgsCoordinateTransformContext();

QgsCoordinateTransformContext( const QgsCoordinateTransformContext &rhs );
%Docstring
Copy constructor
@@ -65,7 +66,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 +124,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
@@ -1090,9 +1090,7 @@ QgsMapSettings QgsLayoutItemMap::mapSettings( const QgsRectangle &extent, QSizeF
jobMapSettings.setFlag( QgsMapSettings::DrawEditingInfo, false );
jobMapSettings.setFlag( QgsMapSettings::DrawSelection, false );
jobMapSettings.setFlag( QgsMapSettings::UseAdvancedEffects, mLayout->context().flags() & QgsLayoutContext::FlagUseAdvancedEffects );

// todo datum nyall
//jobMapSettings.datumTransformStore().setDestinationCrs( renderCrs );
jobMapSettings.setTransformContext( mLayout->project()->transformContext() );

jobMapSettings.setLabelingEngineSettings( mLayout->project()->labelingEngineSettings() );

0 comments on commit 753b3e0

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