QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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
95 bool mHasVerticalComponent = false;
96
99
102
103 Q_DECL_DEPRECATED QString mSourceProjString;
104 Q_DECL_DEPRECATED QString mDestProjString;
105
106 Q_DECL_DEPRECATED int mSourceDatumTransform = -1;
107 Q_DECL_DEPRECATED int mDestinationDatumTransform = -1;
108 QString mProjCoordinateOperation;
109 bool mShouldReverseCoordinateOperation = false;
110 bool mAllowFallbackTransforms = true;
111
112 bool mSourceIsDynamic = false;
113 bool mDestIsDynamic = false;
114 double mSourceCoordinateEpoch = std::numeric_limits< double >::quiet_NaN();
115 double mDestCoordinateEpoch = std::numeric_limits< double >::quiet_NaN();
116 double mDefaultTime = std::numeric_limits< double >::quiet_NaN();
117
119 bool mIsReversed = false;
120
121 QReadWriteLock mProjLock;
122 QMap < uintptr_t, ProjData > mProjProjections;
123 QMap < uintptr_t, ProjData > mProjFallbackProjections;
124
132 static void setCustomMissingRequiredGridHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
133 const QgsCoordinateReferenceSystem &destinationCrs,
134 const QgsDatumTransform::GridDetails &grid )> &handler );
135
147 static void setCustomMissingPreferredGridHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
148 const QgsCoordinateReferenceSystem &destinationCrs,
149 const QgsDatumTransform::TransformDetails &preferredOperation,
150 const QgsDatumTransform::TransformDetails &availableOperation )> &handler );
151
159 static void setCustomCoordinateOperationCreationErrorHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
160 const QgsCoordinateReferenceSystem &destinationCrs,
161 const QString &error )> &handler );
162
170 static void setCustomMissingGridUsedByContextHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
171 const QgsCoordinateReferenceSystem &destinationCrs,
172 const QgsDatumTransform::TransformDetails &desiredOperation )> &handler );
173
180 static void setDynamicCrsToDynamicCrsWarningHandler( const std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
181 const QgsCoordinateReferenceSystem &destinationCrs )> &handler );
182
183 private:
184
185 void freeProj();
186
187 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
188 const QgsCoordinateReferenceSystem &destinationCrs,
189 const QgsDatumTransform::GridDetails &grid )> sMissingRequiredGridHandler;
190
191 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
192 const QgsCoordinateReferenceSystem &destinationCrs,
193 const QgsDatumTransform::TransformDetails &preferredOperation,
194 const QgsDatumTransform::TransformDetails &availableOperation )> sMissingPreferredGridHandler;
195
196 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
197 const QgsCoordinateReferenceSystem &destinationCrs,
198 const QString &error )> sCoordinateOperationCreationErrorHandler;
199
200 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
201 const QgsCoordinateReferenceSystem &destinationCrs,
202 const QgsDatumTransform::TransformDetails &desiredOperation )> sMissingGridUsedByContextHandler;
203
204 static std::function< void( const QgsCoordinateReferenceSystem &sourceCrs,
205 const QgsCoordinateReferenceSystem &destinationCrs )> sDynamicCrsToDynamicCrsWarningHandler;
206
207 QgsCoordinateTransformPrivate &operator= ( const QgsCoordinateTransformPrivate & ) = delete;
208};
209
211
212#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.