QGIS API Documentation
3.10.0-A Coruña (6c816b4204)
|
Contains information about the context in which a coordinate transform is executed. More...
#include <qgscoordinatetransformcontext.h>
Public Member Functions | |
QgsCoordinateTransformContext () | |
Constructor for QgsCoordinateTransformContext. More... | |
QgsCoordinateTransformContext (const QgsCoordinateTransformContext &rhs) | |
Copy constructor. More... | |
~QgsCoordinateTransformContext () | |
bool | addCoordinateOperation (const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QString &coordinateOperationProjString) |
Adds a new coordinateOperationProjString to use when projecting coordinates from the specified sourceCrs to the specified destinationCrs. More... | |
Q_DECL_DEPRECATED bool | addSourceDestinationDatumTransform (const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, int sourceTransformId, int destinationTransformId) |
Adds a new sourceTransform and destinationTransform to use when projecting coordinates from the specified sourceCrs to the specified destinationCrs. More... | |
QString | calculateCoordinateOperation (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination) const |
Returns the Proj coordinate operation string to use when transforming from the specified source CRS to destination CRS. More... | |
Q_DECL_DEPRECATED QgsDatumTransform::TransformPair | calculateDatumTransforms (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination) const |
Returns the pair of source and destination datum transforms to use for a transform from the specified source CRS to destination CRS. More... | |
void | clear () |
Clears all stored transform information from the context. More... | |
QMap< QPair< QString, QString >, QString > | coordinateOperations () const |
Returns the stored mapping for source to destination CRS pairs to associated coordinate operation to use (as a proj string). More... | |
bool | hasTransform (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination) const |
Returns true if the context has a valid coordinate operation to use when transforming from the specified source CRS to destination CRS. More... | |
QgsCoordinateTransformContext & | operator= (const QgsCoordinateTransformContext &rhs) |
Assignment operator. More... | |
bool | operator== (const QgsCoordinateTransformContext &rhs) const |
void | readSettings () |
Reads the context's state from application settings. More... | |
bool | readXml (const QDomElement &element, const QgsReadWriteContext &context, QStringList &missingTransforms) |
Reads the context's state from a DOM element. More... | |
void | removeCoordinateOperation (const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs) |
Removes the coordinate operation for the specified sourceCrs and destinationCrs. More... | |
Q_DECL_DEPRECATED void | removeSourceDestinationDatumTransform (const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs) |
Removes the source to destination datum transform pair for the specified sourceCrs and destinationCrs. More... | |
Q_DECL_DEPRECATED QMap< QPair< QString, QString >, QgsDatumTransform::TransformPair > | sourceDestinationDatumTransforms () const |
Returns the stored mapping for source to destination CRS pairs to associated datum transforms to use. More... | |
void | writeSettings () |
Write the context's state to application settings. More... | |
void | writeXml (QDomElement &element, const QgsReadWriteContext &context) const |
Writes the context's state to a DOM element. More... | |
Contains information about the context in which a coordinate transform is executed.
The context stores various information regarding which coordinate operations should be used when transforming points from a source to destination coordinate reference system.
Definition at line 57 of file qgscoordinatetransformcontext.h.
QgsCoordinateTransformContext::QgsCoordinateTransformContext | ( | ) |
Constructor for QgsCoordinateTransformContext.
Definition at line 25 of file qgscoordinatetransformcontext.cpp.
|
default |
QgsCoordinateTransformContext::QgsCoordinateTransformContext | ( | const QgsCoordinateTransformContext & | rhs | ) |
Copy constructor.
Definition at line 31 of file qgscoordinatetransformcontext.cpp.
bool QgsCoordinateTransformContext::addCoordinateOperation | ( | const QgsCoordinateReferenceSystem & | sourceCrs, |
const QgsCoordinateReferenceSystem & | destinationCrs, | ||
const QString & | coordinateOperationProjString | ||
) |
Adds a new coordinateOperationProjString to use when projecting coordinates from the specified sourceCrs to the specified destinationCrs.
coordinateOperationProjString should be set to a valid Proj coordinate operation string. If coordinateOperationProjString is empty, then the default Proj operation will be used when transforming between the coordinate reference systems.
Returns true
if the new coordinate operation was added successfully.
Definition at line 106 of file qgscoordinatetransformcontext.cpp.
bool QgsCoordinateTransformContext::addSourceDestinationDatumTransform | ( | const QgsCoordinateReferenceSystem & | sourceCrs, |
const QgsCoordinateReferenceSystem & | destinationCrs, | ||
int | sourceTransformId, | ||
int | destinationTransformId | ||
) |
Adds a new sourceTransform and destinationTransform to use when projecting coordinates from the specified sourceCrs to the specified destinationCrs.
If either sourceTransformId or destinationTransformId is -1, then no datum transform is required for transformations for that source or destination.
Returns true
if the new transform pair was added successfully.
Definition at line 89 of file qgscoordinatetransformcontext.cpp.
QString QgsCoordinateTransformContext::calculateCoordinateOperation | ( | const QgsCoordinateReferenceSystem & | source, |
const QgsCoordinateReferenceSystem & | destination | ||
) | const |
Returns the Proj coordinate operation string to use when transforming from the specified source CRS to destination CRS.
Returns an empty string if no specific coordinate operation is set for the source to destination pair, in which case the default Proj coordinate operation should be used.
Definition at line 170 of file qgscoordinatetransformcontext.cpp.
QgsDatumTransform::TransformPair QgsCoordinateTransformContext::calculateDatumTransforms | ( | const QgsCoordinateReferenceSystem & | source, |
const QgsCoordinateReferenceSystem & | destination | ||
) | const |
Returns the pair of source and destination datum transforms to use for a transform from the specified source CRS to destination CRS.
Returns an ID of -1 if a datum transform should not be used for the source or destination.
Definition at line 146 of file qgscoordinatetransformcontext.cpp.
void QgsCoordinateTransformContext::clear | ( | ) |
Clears all stored transform information from the context.
Definition at line 54 of file qgscoordinatetransformcontext.cpp.
QMap< QPair< QString, QString >, QString > QgsCoordinateTransformContext::coordinateOperations | ( | ) | const |
Returns the stored mapping for source to destination CRS pairs to associated coordinate operation to use (as a proj string).
The map keys will be QgsCoordinateReferenceSystems::authid()s.
Definition at line 76 of file qgscoordinatetransformcontext.cpp.
bool QgsCoordinateTransformContext::hasTransform | ( | const QgsCoordinateReferenceSystem & | source, |
const QgsCoordinateReferenceSystem & | destination | ||
) | const |
Returns true
if the context has a valid coordinate operation to use when transforming from the specified source CRS to destination CRS.
Definition at line 132 of file qgscoordinatetransformcontext.cpp.
QgsCoordinateTransformContext & QgsCoordinateTransformContext::operator= | ( | const QgsCoordinateTransformContext & | rhs | ) |
Assignment operator.
Definition at line 35 of file qgscoordinatetransformcontext.cpp.
bool QgsCoordinateTransformContext::operator== | ( | const QgsCoordinateTransformContext & | rhs | ) | const |
Definition at line 41 of file qgscoordinatetransformcontext.cpp.
void QgsCoordinateTransformContext::readSettings | ( | ) |
Reads the context's state from application settings.
Definition at line 294 of file qgscoordinatetransformcontext.cpp.
bool QgsCoordinateTransformContext::readXml | ( | const QDomElement & | element, |
const QgsReadWriteContext & | context, | ||
QStringList & | missingTransforms | ||
) |
Reads the context's state from a DOM element.
Returns false
if transforms stored in the XML are not available. In this case missingTransforms will be filled with missing datum transform strings.
Definition at line 192 of file qgscoordinatetransformcontext.cpp.
void QgsCoordinateTransformContext::removeCoordinateOperation | ( | const QgsCoordinateReferenceSystem & | sourceCrs, |
const QgsCoordinateReferenceSystem & | destinationCrs | ||
) |
Removes the coordinate operation for the specified sourceCrs and destinationCrs.
Definition at line 127 of file qgscoordinatetransformcontext.cpp.
void QgsCoordinateTransformContext::removeSourceDestinationDatumTransform | ( | const QgsCoordinateReferenceSystem & | sourceCrs, |
const QgsCoordinateReferenceSystem & | destinationCrs | ||
) |
Removes the source to destination datum transform pair for the specified sourceCrs and destinationCrs.
Definition at line 122 of file qgscoordinatetransformcontext.cpp.
QMap< QPair< QString, QString >, QgsDatumTransform::TransformPair > QgsCoordinateTransformContext::sourceDestinationDatumTransforms | ( | ) | const |
Returns the stored mapping for source to destination CRS pairs to associated datum transforms to use.
The map keys will be QgsCoordinateReferenceSystems::authid()s.
If either the source transform ID or destination transform ID is -1, then no datum transform is required for transformations for that source or destination.
Definition at line 63 of file qgscoordinatetransformcontext.cpp.
void QgsCoordinateTransformContext::writeSettings | ( | ) |
Write the context's state to application settings.
Definition at line 376 of file qgscoordinatetransformcontext.cpp.
void QgsCoordinateTransformContext::writeXml | ( | QDomElement & | element, |
const QgsReadWriteContext & | context | ||
) | const |
Writes the context's state to a DOM element.
Definition at line 267 of file qgscoordinatetransformcontext.cpp.