Skip to content
Permalink
Browse files

Remove OGRSpatialReferenceH member from proj 6 builds

  • Loading branch information
nyalldawson committed Apr 8, 2019
1 parent 10850bc commit 927b05339e9ee88e6498c273ee6ae5cb7f349598
Showing with 18 additions and 6 deletions.
  1. +4 −1 src/core/qgscoordinatereferencesystem.cpp
  2. +14 −5 src/core/qgscoordinatereferencesystem_p.h
@@ -51,6 +51,7 @@
#include <cpl_csv.h>



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

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

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

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

int QgsCoordinateReferenceSystem::syncDatabase()
{
#if 0
#if 1
setlocale( LC_ALL, "C" );
QString dbFilePath = QgsApplication::srsDatabaseFilePath();
syncDatumTransform( dbFilePath );
@@ -30,11 +30,12 @@
//

#include "qgscoordinatereferencesystem.h"
#include <ogr_srs_api.h>

#if PROJ_VERSION_MAJOR>=6
#include <proj.h>
#include "qgsprojutils.h"
#else
#include <ogr_srs_api.h>
#endif

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

explicit QgsCoordinateReferenceSystemPrivate()
#if PROJ_VERSION_MAJOR<6
: mCRS( OSRNewSpatialReference( nullptr ) )
#endif
{
}

@@ -63,13 +66,19 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
, mSRID( other.mSRID )
, mAuthId( other.mAuthId )
, mIsValid( other.mIsValid )
#if PROJ_VERSION_MAJOR<6
, mCRS( nullptr )
#endif
, mValidationHint( other.mValidationHint )
, mWkt( other.mWkt )
, mProj4( other.mProj4 )
, mAxisInvertedDirty( other.mAxisInvertedDirty )
, mAxisInverted( other.mAxisInverted )
{
#if PROJ_VERSION_MAJOR>=6
if ( mIsValid && mPj.get() )
mPj.reset( proj_clone( QgsProjContext::get(), mPj.get() ) );
#else
if ( mIsValid )
{
mCRS = OSRClone( other.mCRS );
@@ -78,15 +87,14 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
{
mCRS = OSRNewSpatialReference( nullptr );
}
#if PROJ_VERSION_MAJOR>=6
if ( mIsValid && mPj.get() )
mPj.reset( proj_clone( QgsProjContext::get(), mPj.get() ) );
#endif
}

~QgsCoordinateReferenceSystemPrivate()
{
#if PROJ_VERSION_MAJOR<6
OSRDestroySpatialReference( mCRS );
#endif
}

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

#if PROJ_VERSION_MAJOR>=6
QgsProjUtils::proj_pj_unique_ptr mPj;
#endif
#else
OGRSpatialReferenceH mCRS;
#endif

QString mValidationHint;
mutable QString mWkt;

0 comments on commit 927b053

Please sign in to comment.
You can’t perform that action at this time.