QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgscoordinatereferencesystem_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscoordinatereferencesystem_p.h
3 
4  --------------------------------
5  begin : 2016
6  copyright : (C) 2016 by Nyall Dawson
7  email : nyall dot dawson at gmail dot com
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #ifndef QGSCOORDINATEREFERENCESYSTEM_PRIVATE_H
19 #define QGSCOORDINATEREFERENCESYSTEM_PRIVATE_H
20 
22 
23 //
24 // W A R N I N G
25 // -------------
26 //
27 // This file is not part of the QGIS API. It exists purely as an
28 // implementation detail. This header file may change from version to
29 // version without notice, or even be removed.
30 //
31 
33 
34 #if PROJ_VERSION_MAJOR>=6
35 #include <proj.h>
36 #include "qgsprojutils.h"
37 #else
38 #include <ogr_srs_api.h>
39 #endif
40 
41 #ifdef DEBUG
42 typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
43 #else
44 typedef void *OGRSpatialReferenceH;
45 #endif
46 
47 class QgsCoordinateReferenceSystemPrivate : public QSharedData
48 {
49  public:
50 
51  explicit QgsCoordinateReferenceSystemPrivate()
52 #if PROJ_VERSION_MAJOR<6
53  : mCRS( OSRNewSpatialReference( nullptr ) )
54 #endif
55  {
56  }
57 
58  QgsCoordinateReferenceSystemPrivate( const QgsCoordinateReferenceSystemPrivate &other )
59  : QSharedData( other )
60  , mSrsId( other.mSrsId )
61  , mDescription( other.mDescription )
62  , mProjectionAcronym( other.mProjectionAcronym )
63  , mEllipsoidAcronym( other.mEllipsoidAcronym )
64  , mIsGeographic( other.mIsGeographic )
65  , mMapUnits( other.mMapUnits )
66  , mSRID( other.mSRID )
67  , mAuthId( other.mAuthId )
68  , mIsValid( other.mIsValid )
69 #if PROJ_VERSION_MAJOR<6
70  , mCRS( nullptr )
71 #endif
72  , mValidationHint( other.mValidationHint )
73  , mWkt( other.mWkt )
74  , mProj4( other.mProj4 )
75  , mAxisInvertedDirty( other.mAxisInvertedDirty )
76  , mAxisInverted( other.mAxisInverted )
77  {
78 #if PROJ_VERSION_MAJOR>=6
79  if ( mIsValid && other.mPj )
80  mPj.reset( proj_clone( QgsProjContext::get(), other.mPj.get() ) );
81 #else
82  if ( mIsValid )
83  {
84  mCRS = OSRClone( other.mCRS );
85  }
86  else
87  {
88  mCRS = OSRNewSpatialReference( nullptr );
89  }
90 #endif
91  }
92 
93  ~QgsCoordinateReferenceSystemPrivate()
94  {
95 #if PROJ_VERSION_MAJOR<6
96  OSRDestroySpatialReference( mCRS );
97 #endif
98  }
99 
101  long mSrsId = 0;
102 
104  QString mDescription;
105 
107  QString mProjectionAcronym;
108 
110  QString mEllipsoidAcronym;
111 
113  bool mIsGeographic = false;
114 
117 
119  long mSRID = 0;
120 
122  QString mAuthId;
123 
125  bool mIsValid = false;
126 
127 #if PROJ_VERSION_MAJOR>=6
128  QgsProjUtils::proj_pj_unique_ptr mPj;
129 #else
131 #endif
132 
133  QString mValidationHint;
134  mutable QString mWkt;
135  mutable QString mProj4;
136 
138  mutable bool mAxisInvertedDirty = false;
139 
141  mutable bool mAxisInverted = false;
142 
143 };
144 
146 
147 #endif //QGSCOORDINATEREFERENCESYSTEM_PRIVATE_H
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:66
Unknown distance unit.
Definition: qgsunittypes.h:77
static PJ_CONTEXT * get()
Returns a thread local instance of a proj context, safe for use in the current thread.
void * OGRSpatialReferenceH