Remove OGRSpatialReferenceH member from proj 6 builds

This commit is contained in:
Nyall Dawson 2019-04-08 13:19:25 +10:00
parent 10850bc689
commit 927b05339e
2 changed files with 18 additions and 6 deletions

View File

@ -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 );

View File

@ -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;