30
30
//
31
31
32
32
#include " qgscoordinatereferencesystem.h"
33
- #include < ogr_srs_api.h>
34
33
35
34
#if PROJ_VERSION_MAJOR>=6
36
35
#include < proj.h>
37
36
#include " qgsprojutils.h"
37
+ #else
38
+ #include < ogr_srs_api.h>
38
39
#endif
39
40
40
41
#ifdef DEBUG
@@ -48,7 +49,9 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
48
49
public:
49
50
50
51
explicit QgsCoordinateReferenceSystemPrivate ()
52
+ #if PROJ_VERSION_MAJOR<6
51
53
: mCRS ( OSRNewSpatialReference( nullptr ) )
54
+ #endif
52
55
{
53
56
}
54
57
@@ -63,13 +66,19 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
63
66
, mSRID ( other.mSRID )
64
67
, mAuthId ( other.mAuthId )
65
68
, mIsValid ( other.mIsValid )
69
+ #if PROJ_VERSION_MAJOR<6
66
70
, mCRS ( nullptr )
71
+ #endif
67
72
, mValidationHint ( other.mValidationHint )
68
73
, mWkt ( other.mWkt )
69
74
, mProj4 ( other.mProj4 )
70
75
, mAxisInvertedDirty ( other.mAxisInvertedDirty )
71
76
, mAxisInverted ( other.mAxisInverted )
72
77
{
78
+ #if PROJ_VERSION_MAJOR>=6
79
+ if ( mIsValid && mPj .get () )
80
+ mPj .reset ( proj_clone ( QgsProjContext::get (), mPj .get () ) );
81
+ #else
73
82
if ( mIsValid )
74
83
{
75
84
mCRS = OSRClone ( other.mCRS );
@@ -78,15 +87,14 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
78
87
{
79
88
mCRS = OSRNewSpatialReference ( nullptr );
80
89
}
81
- #if PROJ_VERSION_MAJOR>=6
82
- if ( mIsValid && mPj .get () )
83
- mPj .reset ( proj_clone ( QgsProjContext::get (), mPj .get () ) );
84
90
#endif
85
91
}
86
92
87
93
~QgsCoordinateReferenceSystemPrivate ()
88
94
{
95
+ #if PROJ_VERSION_MAJOR<6
89
96
OSRDestroySpatialReference ( mCRS );
97
+ #endif
90
98
}
91
99
92
100
// ! The internal sqlite3 srs.db primary key for this CRS
@@ -118,8 +126,9 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
118
126
119
127
#if PROJ_VERSION_MAJOR>=6
120
128
QgsProjUtils::proj_pj_unique_ptr mPj ;
121
- #endif
129
+ #else
122
130
OGRSpatialReferenceH mCRS ;
131
+ #endif
123
132
124
133
QString mValidationHint ;
125
134
mutable QString mWkt ;
0 commit comments