-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start on QgsCoordinateTransformContext
Stores settings related to the correct datum transforms to use when performing a coordinate transform.
- Loading branch information
1 parent
905a147
commit 8a0bd08
Showing
8 changed files
with
592 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgscoordinatetransformcontext.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsCoordinateTransformContext | ||
{ | ||
%Docstring | ||
Contains information about the context in which a coordinate transform is executed. | ||
|
||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgscoordinatetransformcontext.h" | ||
%End | ||
public: | ||
|
||
QgsCoordinateTransformContext(); | ||
%Docstring | ||
Constructor for QgsCoordinateTransformContext. | ||
%End | ||
|
||
void clear(); | ||
%Docstring | ||
Clears all stored transform information from the context. | ||
%End | ||
|
||
QMap<QString, int> sourceDatumTransforms() const; | ||
%Docstring | ||
Returns the stored mapping for source CRS to associated datum transform to use. | ||
The map keys will be QgsCoordinateReferenceSystems.authid()s. | ||
|
||
\warning This method should not be used to calculate the corresponding datum transforms | ||
to use for a coordinate transform. Instead, always use calculateDatumTransforms() | ||
to determine this. | ||
|
||
.. seealso:: addSourceDatumTransform() | ||
.. seealso:: destinationDatumTransforms() | ||
:rtype: QMap<str, int> | ||
%End | ||
|
||
bool addSourceDatumTransform( const QgsCoordinateReferenceSystem &crs, int transform ); | ||
%Docstring | ||
Adds a new ``transform`` to use when projecting coordinates from the specified source | ||
``crs``. | ||
|
||
Returns true if the new transform was added successfully. | ||
|
||
\warning Transforms set using this method may be overridden by specific source/destination | ||
transforms set by addSourceDestinationDatumTransform(). | ||
|
||
.. seealso:: sourceDatumTransforms() | ||
.. seealso:: addDestinationDatumTransform() | ||
:rtype: bool | ||
%End | ||
|
||
QMap< QString, int > destinationDatumTransforms() const; | ||
%Docstring | ||
Returns the stored mapping for destination CRS to associated datum transform to use. | ||
The map keys will be QgsCoordinateReferenceSystems.authid()s. | ||
|
||
\warning This method should not be used to calculate the corresponding datum transforms | ||
to use for a coordinate transform. Instead, always use calculateDatumTransforms() | ||
to determine this. | ||
|
||
.. seealso:: addDestinationDatumTransform() | ||
.. seealso:: sourceDatumTransforms() | ||
:rtype: QMap< str, int > | ||
%End | ||
|
||
bool addDestinationDatumTransform( const QgsCoordinateReferenceSystem &crs, int transform ); | ||
%Docstring | ||
Adds a new ``transform`` to use when projecting coordinates to the specified destination | ||
``crs``. | ||
|
||
Returns true if the new transform was added successfully. | ||
|
||
\warning Transforms set using this method may be overridden by specific source/destination | ||
transforms set by addSourceDestinationDatumTransform(). | ||
|
||
.. seealso:: destinationDatumTransforms() | ||
.. seealso:: addSourceDatumTransform() | ||
:rtype: bool | ||
%End | ||
|
||
QMap< QPair< QString, QString>, QPair< int, int > > 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. | ||
|
||
\warning This method should not be used to calculate the corresponding datum transforms | ||
to use for a coordinate transform. Instead, always use calculateDatumTransforms() | ||
to determine this. | ||
|
||
.. seealso:: addSourceDestinationDatumTransform() | ||
:rtype: QMap< QPair< str, QString>, QPair< int, int > > | ||
%End | ||
|
||
bool addSourceDestinationDatumTransform( const QgsCoordinateReferenceSystem &sourceCrs, | ||
const QgsCoordinateReferenceSystem &destinationCrs, | ||
int sourceTransform, | ||
int destinationTransform ); | ||
%Docstring | ||
Adds a new ``sourceTransform`` and ``destinationTransform`` to use when projecting coordinates | ||
from the the specified ``sourceCrs`` to the specified ``destinationCrs``. | ||
|
||
Returns true if the new transform pair was added successfully. | ||
|
||
.. note:: | ||
|
||
Transforms set using this method will override any specific source or destination | ||
transforms set by addSourceDatumTransform() or addDestinationDatumTransform(). | ||
|
||
.. seealso:: sourceDestinationDatumTransforms() | ||
:rtype: bool | ||
%End | ||
|
||
QPair< int, int > calculateDatumTransforms( const QgsCoordinateReferenceSystem &source, | ||
const QgsCoordinateReferenceSystem &destination ) const; | ||
%Docstring | ||
Returns the pair of source and destination datum transforms to use | ||
for a transform from the specified ``source`` CRS to ``destination`` CRS. | ||
|
||
Returns -1 if a datum transform should not be used for the source or | ||
destination. | ||
:rtype: QPair< int, int > | ||
%End | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgscoordinatetransformcontext.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*************************************************************************** | ||
qgscoordinatetransformcontext.cpp | ||
--------------------------------- | ||
begin : November 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgscoordinatetransformcontext.h" | ||
|
||
void QgsCoordinateTransformContext::clear() | ||
{ | ||
mSourceDestDatumTransforms.clear(); | ||
mSourceDatumTransforms.clear(); | ||
mDestDatumTransforms.clear(); | ||
} | ||
|
||
QMap<QString, int> QgsCoordinateTransformContext::sourceDatumTransforms() const | ||
{ | ||
return mSourceDatumTransforms; | ||
} | ||
|
||
bool QgsCoordinateTransformContext::addSourceDatumTransform( const QgsCoordinateReferenceSystem &crs, int transform ) | ||
{ | ||
if ( !crs.isValid() ) | ||
return false; | ||
|
||
mSourceDatumTransforms.insert( crs.authid(), transform ); | ||
return true; | ||
} | ||
|
||
QMap<QString, int> QgsCoordinateTransformContext::destinationDatumTransforms() const | ||
{ | ||
return mDestDatumTransforms; | ||
} | ||
|
||
bool QgsCoordinateTransformContext::addDestinationDatumTransform( const QgsCoordinateReferenceSystem &crs, int transform ) | ||
{ | ||
if ( !crs.isValid() ) | ||
return false; | ||
|
||
mDestDatumTransforms.insert( crs.authid(), transform ); | ||
return true; | ||
} | ||
|
||
QMap<QPair<QString, QString>, QPair<int, int> > QgsCoordinateTransformContext::sourceDestinationDatumTransforms() const | ||
{ | ||
return mSourceDestDatumTransforms; | ||
} | ||
|
||
bool QgsCoordinateTransformContext::addSourceDestinationDatumTransform( const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, int sourceTransform, int destinationTransform ) | ||
{ | ||
if ( !sourceCrs.isValid() || !destinationCrs.isValid() ) | ||
return false; | ||
|
||
mSourceDestDatumTransforms.insert( qMakePair( sourceCrs.authid(), destinationCrs.authid() ), qMakePair( sourceTransform, destinationTransform ) ); | ||
return true; | ||
} | ||
|
||
QPair<int, int> QgsCoordinateTransformContext::calculateDatumTransforms( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination ) const | ||
{ | ||
|
||
} |
Oops, something went wrong.