17 #ifndef QGSCOORDINATETRANSFORM_H
18 #define QGSCOORDINATETRANSFORM_H
20 #include <QExplicitlySharedDataPointer>
22 #include "qgsconfig.h"
23 #include "qgis_core.h"
28 class QgsCoordinateTransformPrivate;
137 int sourceDatumTransformId,
157 bool isValid()
const;
226 QgsPointXY transform(
double x,
double y, TransformDirection direction = ForwardTransform )
const;
265 void transformInPlace(
double &x,
double &y,
double &z, TransformDirection direction = ForwardTransform ) const
SIP_THROW(
QgsCsException );
279 void transformInPlace(
float &x,
float &y,
double &z, TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
293 void transformInPlace(
float &x,
float &y,
float &z, TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
307 void transformInPlace( QVector<
float> &x, QVector<
float> &y, QVector<
float> &z,
308 TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
322 void transformInPlace( QVector<
double> &x, QVector<
double> &y, QVector<
double> &z,
323 TransformDirection direction = ForwardTransform ) const
SIP_SKIP;
330 void transformPolygon( QPolygonF &polygon, TransformDirection direction = ForwardTransform ) const
SIP_THROW(
QgsCsException );
352 void transformCoords(
int numPoint,
double *x,
double *y,
double *z, TransformDirection direction = ForwardTransform ) const
SIP_THROW(
QgsCsException );
357 bool isShortCircuited() const;
375 QString coordinateOperation() const;
390 QgsDatumTransform::TransformDetails instantiatedCoordinateOperationDetails() const;
405 void setCoordinateOperation( const QString &operation ) const;
421 void setAllowFallbackTransforms(
bool allowed );
434 bool allowFallbackTransforms() const;
467 void setBallparkTransformsAreAppropriate(
bool appropriate );
483 void disableFallbackOperationHandler(
bool disabled );
493 bool fallbackOperationOccurred() const;
508 Q_DECL_DEPRECATED
int sourceDatumTransformId() const
SIP_DEPRECATED;
523 Q_DECL_DEPRECATED
void setSourceDatumTransformId(
int datumId )
SIP_DEPRECATED;
538 Q_DECL_DEPRECATED
int destinationDatumTransformId() const
SIP_DEPRECATED;
553 Q_DECL_DEPRECATED
void setDestinationDatumTransformId(
int datumId )
SIP_DEPRECATED;
567 static void invalidateCache(
bool disableCache =
false );
577 static void invalidateCache(
bool disableCache
SIP_PYARGREMOVE =
false );
589 double scaleFactor(
const QgsRectangle &referenceExtent )
const;
592 SIP_PYOBJECT __repr__();
594 QString
str = QStringLiteral(
"<QgsCoordinateTransform: %1 to %2>" ).arg( sipCpp->sourceCrs().isValid() ? sipCpp->sourceCrs().authid() : QStringLiteral(
"NULL" ),
595 sipCpp->destinationCrs().isValid() ? sipCpp->destinationCrs().authid() : QStringLiteral(
"NULL" ) );
596 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
653 const QString &error )> &handler );
680 const QString &desiredOperation )> &handler );
699 static void removeFromCacheObjectsBelongingToCurrentThread(
void *pj_context );
702 mutable QExplicitlySharedDataPointer<QgsCoordinateTransformPrivate> d;
708 bool mHasContext =
false;
711 mutable QString mLastError;
712 bool mBallparkTransformsAreAppropriate =
false;
713 bool mDisableFallbackHandler =
false;
714 mutable bool mFallbackOperationOccurred =
false;
718 const QString &coordinateOperationProj,
bool allowFallback );
723 static QReadWriteLock sCacheLock;
733 static bool sDisableCache;
738 const QString &desiredOperation )> sFallbackOperationOccurredHandler;
746 QString mySummary( QStringLiteral(
"\n%%%%%%%%%%%%%%%%%%%%%%%%\nCoordinate Transform def begins:" ) );
747 mySummary += QLatin1String(
"\n\tInitialized? : " );
763 mySummary +=
"\n\tShort Circuit? : ";
773 mySummary +=
"\n\tSource Spatial Ref Sys : ";
780 mySummary +=
"Undefined";
783 mySummary +=
"\n\tDest Spatial Ref Sys : ";
786 mySummary << r.destCRS();
790 mySummary +=
"Undefined";
794 mySummary += QLatin1String(
"\nCoordinate Transform def ends \n%%%%%%%%%%%%%%%%%%%%%%%%\n" );
795 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