QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgscoordinatetransform_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscoordinatetransform_p.h
3 --------------------------
4 begin : July 2016
5 copyright : (C) 2016 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSCOORDINATETRANSFORMPRIVATE_H
18#define QGSCOORDINATETRANSFORMPRIVATE_H
19
20#define SIP_NO_FILE
21#include "qgsconfig.h"
22
24
25//
26// W A R N I N G
27// -------------
28//
29// This file is not part of the QGIS API. It exists purely as an
30// implementation detail. This header file may change from version to
31// version without notice, or even be removed.
32//
33
34#include <QSharedData>
35
36struct PJconsts;
37typedef struct PJconsts PJ;
38typedef PJ *ProjData;
39
42
43class QgsCoordinateTransformPrivate : public QSharedData
44{
45
46 public:
47
48 explicit QgsCoordinateTransformPrivate();
49
50 QgsCoordinateTransformPrivate( const QgsCoordinateReferenceSystem &source,
51 const QgsCoordinateReferenceSystem &destination,
52 const QgsCoordinateTransformContext &context );
53
54 QgsCoordinateTransformPrivate( const QgsCoordinateReferenceSystem &source,
55 const QgsCoordinateReferenceSystem &destination,
56 int sourceDatumTransform,
57 int destDatumTransform );
58
59 QgsCoordinateTransformPrivate( const QgsCoordinateTransformPrivate &other );
60
61 ~QgsCoordinateTransformPrivate();
62
63 bool checkValidity();
64
65 void invalidate();
66
67 bool initialize();
68
69 void calculateTransforms( const QgsCoordinateTransformContext &context );
70
71 ProjData threadLocalProjData();
72
73 int mAvailableOpCount = -1;
74 ProjData threadLocalFallbackProjData();
75
76 // Only meant to be called by QgsCoordinateTransform::removeFromCacheObjectsBelongingToCurrentThread()
77 bool removeObjectsBelongingToCurrentThread( void *pj_context );
78
83 bool mIsValid = false;
84
89 bool mShortCircuit = false;
90
92 bool mGeographicToWebMercator = false;
93
96
99
100 Q_DECL_DEPRECATED QString mSourceProjString;
101 Q_DECL_DEPRECATED QString mDestProjString;
102
103 Q_DECL_DEPRECATED int mSourceDatumTransform = -1;
104 Q_DECL_DEPRECATED int mDestinationDatumTransform = -1;
105 QString mProjCoordinateOperation;
106 bool mShouldReverseCoordinateOperation = false;
107 bool mAllowFallbackTransforms = true;
108
109 bool mSourceIsDynamic = false;
110 bool mDestIsDynamic = false;
111 double mSourceCoordinateEpoch = std::numeric_limits< double >::quiet_NaN();
112 double mDestCoordinateEpoch = std::numeric_limits< double >::quiet_NaN();
113 double mDefaultTime = std::numeric_limits< double >::quiet_NaN();
114
116 bool mIsReversed = false;
117
118 QReadWriteLock mProjLock;
119 QMap < uintptr_t, ProjData > mProjProjections;
120 QMap < uintptr_t, ProjData > mProjFallbackProjections;
121
129 static void setCustomMissingRequiredGridHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
130 const QgsCoordinateReferenceSystem &destinationCrs,
131 const QgsDatumTransform::GridDetails &grid )> &handler );
132
144 static void setCustomMissingPreferredGridHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
145 const QgsCoordinateReferenceSystem &destinationCrs,
146 const QgsDatumTransform::TransformDetails &preferredOperation,
147 const QgsDatumTransform::TransformDetails &availableOperation )> &handler );
148
156 static void setCustomCoordinateOperationCreationErrorHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
157 const QgsCoordinateReferenceSystem &destinationCrs,
158 const QString &error )> &handler );
159
167 static void setCustomMissingGridUsedByContextHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
168 const QgsCoordinateReferenceSystem &destinationCrs,
169 const QgsDatumTransform::TransformDetails &desiredOperation )> &handler );
170
177 static void setDynamicCrsToDynamicCrsWarningHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
178 const QgsCoordinateReferenceSystem &destinationCrs )> &handler );
179
180 private:
181
182 void freeProj();
183
184 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
185 const QgsCoordinateReferenceSystem &destinationCrs,
186 const QgsDatumTransform::GridDetails &grid )> sMissingRequiredGridHandler;
187
188 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
189 const QgsCoordinateReferenceSystem &destinationCrs,
190 const QgsDatumTransform::TransformDetails &preferredOperation,
191 const QgsDatumTransform::TransformDetails &availableOperation )> sMissingPreferredGridHandler;
192
193 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
194 const QgsCoordinateReferenceSystem &destinationCrs,
195 const QString &error )> sCoordinateOperationCreationErrorHandler;
196
197 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
198 const QgsCoordinateReferenceSystem &destinationCrs,
199 const QgsDatumTransform::TransformDetails &desiredOperation )> sMissingGridUsedByContextHandler;
200
201 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
202 const QgsCoordinateReferenceSystem &destinationCrs )> sDynamicCrsToDynamicCrsWarningHandler;
203
204 QgsCoordinateTransformPrivate &operator= ( const QgsCoordinateTransformPrivate & ) = delete;
205};
206
208
209#endif // QGSCOORDINATETRANSFORMPRIVATE_H
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
struct PJconsts PJ
Contains information about a projection transformation grid file.
Contains information about a coordinate transformation operation.