17 #ifndef QGSCOORDINATETRANSFORM_H
18 #define QGSCOORDINATETRANSFORM_H
20 #include <QExplicitlySharedDataPointer>
22 #include "qgsconfig.h"
23 #include "qgis_core.h"
28 class QgsCoordinateTransformPrivate;
125 int sourceDatumTransformId,
126 int destinationDatumTransformId );
145 bool isValid()
const;
214 QgsPointXY transform(
double x,
double y, TransformDirection direction = ForwardTransform )
const;
253 void transformInPlace(
double &x,
double &y,
double &z, TransformDirection direction = ForwardTransform ) const
SIP_THROW(
QgsCsException );
267 void transformInPlace(
float &x,
float &y,
double &z, TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
281 void transformInPlace(
float &x,
float &y,
float &z, TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
295 void transformInPlace( QVector<
float> &x, QVector<
float> &y, QVector<
float> &z,
296 TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
310 void transformInPlace( QVector<
double> &x, QVector<
double> &y, QVector<
double> &z,
311 TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
318 void transformPolygon( QPolygonF &polygon, TransformDirection direction = ForwardTransform ) const
SIP_THROW(
QgsCsException );
340 void transformCoords(
int numPoint,
double *x,
double *y,
double *z, TransformDirection direction = ForwardTransform ) const
SIP_THROW(
QgsCsException );
345 bool isShortCircuited() const;
363 QString coordinateOperation() const;
378 QgsDatumTransform::TransformDetails instantiatedCoordinateOperationDetails() const;
393 void setCoordinateOperation( const QString &operation ) const;
409 void setAllowFallbackTransforms(
bool allowed );
422 bool allowFallbackTransforms() const;
455 void setBallparkTransformsAreAppropriate(
bool appropriate );
471 void disableFallbackOperationHandler(
bool disabled );
481 bool fallbackOperationOccurred() const;
496 Q_DECL_DEPRECATED
int sourceDatumTransformId() const
SIP_DEPRECATED;
511 Q_DECL_DEPRECATED
void setSourceDatumTransformId(
int datumId )
SIP_DEPRECATED;
526 Q_DECL_DEPRECATED
int destinationDatumTransformId() const
SIP_DEPRECATED;
541 Q_DECL_DEPRECATED
void setDestinationDatumTransformId(
int datumId )
SIP_DEPRECATED;
555 static void invalidateCache(
bool disableCache =
false );
565 static void invalidateCache(
bool disableCache
SIP_PYARGREMOVE =
false );
577 double scaleFactor(
const QgsRectangle &referenceExtent )
const;
580 SIP_PYOBJECT __repr__();
582 QString str = QStringLiteral(
"<QgsCoordinateTransform: %1 to %2>" ).arg( sipCpp->sourceCrs().isValid() ? sipCpp->sourceCrs().authid() : QStringLiteral(
"NULL" ),
583 sipCpp->destinationCrs().isValid() ? sipCpp->destinationCrs().authid() : QStringLiteral(
"NULL" ) );
584 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
641 const QString &error )> &handler );
668 const QString &desiredOperation )> &handler );
673 #if PROJ_VERSION_MAJOR>=6
678 static void removeFromCacheObjectsBelongingToCurrentThread(
void *pj_context );
683 mutable QExplicitlySharedDataPointer<QgsCoordinateTransformPrivate> d;
689 bool mHasContext =
false;
692 mutable QString mLastError;
693 bool mBallparkTransformsAreAppropriate =
false;
694 bool mDisableFallbackHandler =
false;
695 mutable bool mFallbackOperationOccurred =
false;
697 #if PROJ_VERSION_MAJOR>=6
700 const QString &coordinateOperationProj,
bool allowFallback );
704 int srcDatumTransform,
705 int destDatumTransform );
710 static QReadWriteLock sCacheLock;
712 static bool sDisableCache;
717 const QString &desiredOperation )> sFallbackOperationOccurredHandler;
725 QString mySummary( QStringLiteral(
"\n%%%%%%%%%%%%%%%%%%%%%%%%\nCoordinate Transform def begins:" ) );
726 mySummary += QLatin1String(
"\n\tInitialized? : " );
742 mySummary +=
"\n\tShort Circuit? : ";
752 mySummary +=
"\n\tSource Spatial Ref Sys : ";
759 mySummary +=
"Undefined";
762 mySummary +=
"\n\tDest Spatial Ref Sys : ";
765 mySummary << r.destCRS();
769 mySummary +=
"Undefined";
773 mySummary += QLatin1String(
"\nCoordinate Transform def ends \n%%%%%%%%%%%%%%%%%%%%%%%%\n" );
774 return os << mySummary.toLocal8Bit().data() << std::endl;
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
A class to represent a 2D point.
Used to create and store a proj context object, correctly freeing the context upon destruction.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
A rectangle specified with double values.
const QgsCoordinateReferenceSystem & crs