QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdatumtransform.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdatumtransform.h
3  ------------------------
4  begin : Dec 2017
5  copyright : (C) 2017 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 QGSDATUMTRANSFORM_H
18 #define QGSDATUMTRANSFORM_H
19 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 #include "qgsrectangle.h"
23 #include <QString>
24 #include <QList>
25 
27 
28 #if PROJ_VERSION_MAJOR>=6
29 #ifndef SIP_RUN
30 struct PJconsts;
31 typedef struct PJconsts PJ;
32 #endif
33 #endif
34 
44 class CORE_EXPORT QgsDatumTransform
45 {
46 
47  public:
48 
55  {
56 
61  TransformPair( int sourceTransformId = -1, int destinationTransformId = -1 )
62  : sourceTransformId( sourceTransformId )
63  , destinationTransformId( destinationTransformId )
64  {}
65 
70  int sourceTransformId = -1;
71 
76  int destinationTransformId = -1;
77 
79  {
80  return other.sourceTransformId == sourceTransformId && other.destinationTransformId == destinationTransformId;
81  }
82 
84  {
85  return other.sourceTransformId != sourceTransformId || other.destinationTransformId != destinationTransformId;
86  }
87 
88  };
89 
95  {
97  int datumTransformId = -1;
98 
100  int epsgCode = 0;
101 
104 
107 
110 
113 
115  QString remarks;
116 
118  QString scope;
119 
121  bool preferred = false;
122 
124  bool deprecated = false;
125 
126  };
127 
128 
133  struct GridDetails
134  {
136  QString shortName;
138  QString fullName;
140  QString packageName;
142  QString url;
144  bool directDownload = false;
146  bool openLicense = false;
148  bool isAvailable = false;
149  };
150 
158  {
160  QString scope;
161 
163  QString remarks;
164 
166  QString areaOfUse;
167 
169  QString authority;
170 
172  QString code;
173  };
174 
182  {
184  QString proj;
186  QString name;
188  double accuracy = 0;
189 
196  QString authority;
197 
204  QString code;
205 
212  QString scope;
213 
220  QString remarks;
221 
228  bool isAvailable = false;
229 
238  QString areaOfUse;
239 
245 
249  QList< QgsDatumTransform::GridDetails > grids;
250 
257  QList< QgsDatumTransform::SingleOperationDetails > operationDetails;
258  };
259 
279  static QList< QgsDatumTransform::TransformDetails > operations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, bool includeSuperseded = false );
280 
288  Q_DECL_DEPRECATED static QList< QgsDatumTransform::TransformPair > datumTransformations( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination ) SIP_DEPRECATED;
289 
298  Q_DECL_DEPRECATED static QString datumTransformToProj( int datumTransformId ) SIP_DEPRECATED;
299 
307  Q_DECL_DEPRECATED static int projStringToDatumTransformId( const QString &string ) SIP_DEPRECATED;
308 
318  Q_DECL_DEPRECATED static QgsDatumTransform::TransformInfo datumTransformInfo( int datumTransformId ) SIP_DEPRECATED;
319 
320 #ifndef SIP_RUN
321 #if PROJ_VERSION_MAJOR >= 6
322 
329  static QgsDatumTransform::TransformDetails transformDetailsFromPj( PJ *op );
330 #endif
331 #endif
332 
333  private:
334 
335  static void searchDatumTransform( const QString &sql, QList< int > &transforms );
336 
337 
338 };
339 
340 #endif // QGSDATUMTRANSFORM_H
QgsDatumTransform::SingleOperationDetails::scope
QString scope
Scope of operation, from EPSG registry database.
Definition: qgsdatumtransform.h:160
QgsDatumTransform::SingleOperationDetails::code
QString code
Authority code, e.g. "8447" (for EPSG:8447).
Definition: qgsdatumtransform.h:172
QgsDatumTransform::TransformInfo::destinationCrsDescription
QString destinationCrsDescription
Destination CRS description.
Definition: qgsdatumtransform.h:112
QgsDatumTransform::TransformPair::operator==
bool operator==(QgsDatumTransform::TransformPair other) const
Definition: qgsdatumtransform.h:78
QgsDatumTransform::SingleOperationDetails::remarks
QString remarks
Remarks for operation, from EPSG registry database.
Definition: qgsdatumtransform.h:163
QgsDatumTransform::SingleOperationDetails
Contains information about a single coordinate operation.
Definition: qgsdatumtransform.h:158
qgsrectangle.h
QgsDatumTransform::TransformPair
Contains datum transform information.
Definition: qgsdatumtransform.h:55
QgsDatumTransform::TransformDetails::areaOfUse
QString areaOfUse
Area of use string.
Definition: qgsdatumtransform.h:238
QgsDatumTransform::TransformDetails::operationDetails
QList< QgsDatumTransform::SingleOperationDetails > operationDetails
Contains information about the single operation steps used in the transform operation.
Definition: qgsdatumtransform.h:257
QgsDatumTransform::TransformDetails::scope
QString scope
Scope of operation, from EPSG registry database.
Definition: qgsdatumtransform.h:212
QgsDatumTransform::TransformInfo::sourceCrsAuthId
QString sourceCrsAuthId
Source CRS auth ID.
Definition: qgsdatumtransform.h:103
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsDatumTransform::GridDetails
Contains information about a projection transformation grid file.
Definition: qgsdatumtransform.h:134
QgsDatumTransform::TransformPair::sourceTransformId
int sourceTransformId
ID for the datum transform to use when projecting from the source CRS.
Definition: qgsdatumtransform.h:70
QgsDatumTransform::TransformPair::destinationTransformId
int destinationTransformId
ID for the datum transform to use when projecting to the destination CRS.
Definition: qgsdatumtransform.h:76
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsDatumTransform::TransformDetails::grids
QList< QgsDatumTransform::GridDetails > grids
Contains a list of transform grids used by the operation.
Definition: qgsdatumtransform.h:249
QgsDatumTransform::GridDetails::url
QString url
Url to download grid from.
Definition: qgsdatumtransform.h:142
QgsDatumTransform::TransformPair::TransformPair
TransformPair(int sourceTransformId=-1, int destinationTransformId=-1)
Constructor for a TransformPair with the specified sourceTransformId and destinationTransformId trans...
Definition: qgsdatumtransform.h:61
QgsDatumTransform
Contains methods and classes relating the datum transformations.
Definition: qgsdatumtransform.h:45
QgsDatumTransform::TransformDetails::authority
QString authority
Authority name, e.g.
Definition: qgsdatumtransform.h:196
QgsDatumTransform::TransformInfo::remarks
QString remarks
Transform remarks.
Definition: qgsdatumtransform.h:115
qgis_sip.h
QgsDatumTransform::GridDetails::fullName
QString fullName
Full name of transform grid.
Definition: qgsdatumtransform.h:138
QgsDatumTransform::TransformInfo::sourceCrsDescription
QString sourceCrsDescription
Source CRS description.
Definition: qgsdatumtransform.h:109
QgsDatumTransform::GridDetails::shortName
QString shortName
Short name of transform grid.
Definition: qgsdatumtransform.h:136
QgsDatumTransform::TransformDetails::remarks
QString remarks
Remarks for operation, from EPSG registry database.
Definition: qgsdatumtransform.h:220
QgsDatumTransform::TransformDetails
Contains information about a coordinate transformation operation.
Definition: qgsdatumtransform.h:182
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsDatumTransform::TransformInfo::destinationCrsAuthId
QString destinationCrsAuthId
Destination CRS auth ID.
Definition: qgsdatumtransform.h:106
QgsDatumTransform::TransformDetails::name
QString name
Display name of transform operation.
Definition: qgsdatumtransform.h:186
QgsDatumTransform::TransformDetails::bounds
QgsRectangle bounds
Valid bounds for the coordinate operation.
Definition: qgsdatumtransform.h:244
QgsDatumTransform::TransformInfo
Contains datum transform information.
Definition: qgsdatumtransform.h:95
QgsDatumTransform::GridDetails::packageName
QString packageName
Name of package the grid is included within.
Definition: qgsdatumtransform.h:140
QgsDatumTransform::SingleOperationDetails::authority
QString authority
Authority name, e.g. EPSG.
Definition: qgsdatumtransform.h:169
QgsDatumTransform::SingleOperationDetails::areaOfUse
QString areaOfUse
Area of use, from EPSG registry database.
Definition: qgsdatumtransform.h:166
QgsDatumTransform::TransformPair::operator!=
bool operator!=(QgsDatumTransform::TransformPair other) const
Definition: qgsdatumtransform.h:83
QgsDatumTransform::TransformDetails::proj
QString proj
Proj representation of transform operation.
Definition: qgsdatumtransform.h:184
QgsDatumTransform::TransformInfo::scope
QString scope
Scope of transform.
Definition: qgsdatumtransform.h:118
QgsDatumTransform::TransformDetails::code
QString code
Identification code, e.g.
Definition: qgsdatumtransform.h:204