Skip to content

Commit 927b053

Browse files
committed
Remove OGRSpatialReferenceH member from proj 6 builds
1 parent 10850bc commit 927b053

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/core/qgscoordinatereferencesystem.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <cpl_csv.h>
5252

5353

54+
5455
//! The length of the string "+lat_1="
5556
const int LAT_PREFIX_LEN = 7;
5657

@@ -1276,11 +1277,13 @@ void QgsCoordinateReferenceSystem::setMapUnits()
12761277
return;
12771278
}
12781279

1280+
#if PROJ_VERSION_MAJOR<6
12791281
#if GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,5,0)
12801282
// Of interest to us is that this call adds in a unit parameter if
12811283
// one doesn't already exist.
12821284
OSRFixup( d->mCRS );
12831285
#endif
1286+
#endif
12841287

12851288
#if PROJ_VERSION_MAJOR>=6
12861289
if ( !d->mPj )
@@ -2011,7 +2014,7 @@ bool QgsCoordinateReferenceSystem::loadIds( QHash<int, QString> &wkts )
20112014

20122015
int QgsCoordinateReferenceSystem::syncDatabase()
20132016
{
2014-
#if 0
2017+
#if 1
20152018
setlocale( LC_ALL, "C" );
20162019
QString dbFilePath = QgsApplication::srsDatabaseFilePath();
20172020
syncDatumTransform( dbFilePath );

src/core/qgscoordinatereferencesystem_p.h

+14-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
//
3131

3232
#include "qgscoordinatereferencesystem.h"
33-
#include <ogr_srs_api.h>
3433

3534
#if PROJ_VERSION_MAJOR>=6
3635
#include <proj.h>
3736
#include "qgsprojutils.h"
37+
#else
38+
#include <ogr_srs_api.h>
3839
#endif
3940

4041
#ifdef DEBUG
@@ -48,7 +49,9 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
4849
public:
4950

5051
explicit QgsCoordinateReferenceSystemPrivate()
52+
#if PROJ_VERSION_MAJOR<6
5153
: mCRS( OSRNewSpatialReference( nullptr ) )
54+
#endif
5255
{
5356
}
5457

@@ -63,13 +66,19 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
6366
, mSRID( other.mSRID )
6467
, mAuthId( other.mAuthId )
6568
, mIsValid( other.mIsValid )
69+
#if PROJ_VERSION_MAJOR<6
6670
, mCRS( nullptr )
71+
#endif
6772
, mValidationHint( other.mValidationHint )
6873
, mWkt( other.mWkt )
6974
, mProj4( other.mProj4 )
7075
, mAxisInvertedDirty( other.mAxisInvertedDirty )
7176
, mAxisInverted( other.mAxisInverted )
7277
{
78+
#if PROJ_VERSION_MAJOR>=6
79+
if ( mIsValid && mPj.get() )
80+
mPj.reset( proj_clone( QgsProjContext::get(), mPj.get() ) );
81+
#else
7382
if ( mIsValid )
7483
{
7584
mCRS = OSRClone( other.mCRS );
@@ -78,15 +87,14 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
7887
{
7988
mCRS = OSRNewSpatialReference( nullptr );
8089
}
81-
#if PROJ_VERSION_MAJOR>=6
82-
if ( mIsValid && mPj.get() )
83-
mPj.reset( proj_clone( QgsProjContext::get(), mPj.get() ) );
8490
#endif
8591
}
8692

8793
~QgsCoordinateReferenceSystemPrivate()
8894
{
95+
#if PROJ_VERSION_MAJOR<6
8996
OSRDestroySpatialReference( mCRS );
97+
#endif
9098
}
9199

92100
//! The internal sqlite3 srs.db primary key for this CRS
@@ -118,8 +126,9 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
118126

119127
#if PROJ_VERSION_MAJOR>=6
120128
QgsProjUtils::proj_pj_unique_ptr mPj;
121-
#endif
129+
#else
122130
OGRSpatialReferenceH mCRS;
131+
#endif
123132

124133
QString mValidationHint;
125134
mutable QString mWkt;

0 commit comments

Comments
 (0)