Skip to content

Commit

Permalink
Fix proj4 build
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 31, 2019
1 parent c82d3b6 commit ba764b0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/core/qgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
if ( !d->checkValidity() )
return;

Q_NOWARN_DEPRECATED_PUSH
#if PROJ_VERSION_MAJOR>=6
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mProjCoordinateOperation ) )
#else
Expand All @@ -72,6 +73,7 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
d->initialize();
addToCache();
}
Q_NOWARN_DEPRECATED_POP
}

QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, const QgsProject *project )
Expand All @@ -86,6 +88,7 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
if ( !d->checkValidity() )
return;

Q_NOWARN_DEPRECATED_PUSH
#if PROJ_VERSION_MAJOR>=6
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mProjCoordinateOperation ) )
#else
Expand All @@ -95,6 +98,7 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
d->initialize();
addToCache();
}
Q_NOWARN_DEPRECATED_POP
}

QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, int sourceDatumTransform, int destinationDatumTransform )
Expand All @@ -107,6 +111,7 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
if ( !d->checkValidity() )
return;

Q_NOWARN_DEPRECATED_PUSH
#if PROJ_VERSION_MAJOR>=6
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mProjCoordinateOperation ) )
#else
Expand All @@ -116,6 +121,7 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
d->initialize();
addToCache();
}
Q_NOWARN_DEPRECATED_POP
}

QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateTransform &o )
Expand Down Expand Up @@ -147,6 +153,7 @@ void QgsCoordinateTransform::setSourceCrs( const QgsCoordinateReferenceSystem &c
return;

d->calculateTransforms( mContext );
Q_NOWARN_DEPRECATED_PUSH
#if PROJ_VERSION_MAJOR>=6
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mProjCoordinateOperation ) )
#else
Expand All @@ -156,6 +163,7 @@ void QgsCoordinateTransform::setSourceCrs( const QgsCoordinateReferenceSystem &c
d->initialize();
addToCache();
}
Q_NOWARN_DEPRECATED_POP
}
void QgsCoordinateTransform::setDestinationCrs( const QgsCoordinateReferenceSystem &crs )
{
Expand All @@ -165,6 +173,7 @@ void QgsCoordinateTransform::setDestinationCrs( const QgsCoordinateReferenceSyst
return;

d->calculateTransforms( mContext );
Q_NOWARN_DEPRECATED_PUSH
#if PROJ_VERSION_MAJOR>=6
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mProjCoordinateOperation ) )
#else
Expand All @@ -174,6 +183,7 @@ void QgsCoordinateTransform::setDestinationCrs( const QgsCoordinateReferenceSyst
d->initialize();
addToCache();
}
Q_NOWARN_DEPRECATED_POP
}

void QgsCoordinateTransform::setContext( const QgsCoordinateTransformContext &context )
Expand All @@ -187,6 +197,7 @@ void QgsCoordinateTransform::setContext( const QgsCoordinateTransformContext &co
return;

d->calculateTransforms( mContext );
Q_NOWARN_DEPRECATED_PUSH
#if PROJ_VERSION_MAJOR>=6
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mProjCoordinateOperation ) )
#else
Expand All @@ -196,6 +207,7 @@ void QgsCoordinateTransform::setContext( const QgsCoordinateTransformContext &co
d->initialize();
addToCache();
}
Q_NOWARN_DEPRECATED_POP
}

QgsCoordinateTransformContext QgsCoordinateTransform::context() const
Expand Down Expand Up @@ -861,6 +873,7 @@ bool QgsCoordinateTransform::setFromCache( const QgsCoordinateReferenceSystem &s
const QList< QgsCoordinateTransform > values = sTransforms.values( qMakePair( src.authid(), dest.authid() ) );
for ( auto valIt = values.constBegin(); valIt != values.constEnd(); ++valIt )
{
Q_NOWARN_DEPRECATED_PUSH
if ( ( *valIt ).sourceDatumTransformId() == srcDatumTransform &&
( *valIt ).destinationDatumTransformId() == destDatumTransform )
{
Expand All @@ -879,6 +892,7 @@ bool QgsCoordinateTransform::setFromCache( const QgsCoordinateReferenceSystem &s

return true;
}
Q_NOWARN_DEPRECATED_POP
}
sCacheLock.unlock();
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgscoordinatetransform_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@ ProjData QgsCoordinateTransformPrivate::threadLocalProjData()
#endif
#else
#ifdef USE_THREAD_LOCAL
Q_NOWARN_DEPRECATED_PUSH
QPair<projPJ, projPJ> res = qMakePair( pj_init_plus_ctx( mProjContext.get(), mSourceProjString.toUtf8() ),
pj_init_plus_ctx( mProjContext.get(), mDestProjString.toUtf8() ) );
Q_NOWARN_DEPRECATED_POP
mProjProjections.insert( reinterpret_cast< uintptr_t>( mProjContext.get() ), res );
#else
QPair<projPJ, projPJ> res = qMakePair( pj_init_plus_ctx( pContext, mSourceProjString.toUtf8() ),
Expand Down
5 changes: 2 additions & 3 deletions src/core/qgscoordinatetransformcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ QMap<QPair<QString, QString>, QString> QgsCoordinateTransformContext::coordinate
d->mLock.unlock();
return res;
#else
return QMap<QPair<QString, QString>, QgsDatumTransform::TransformDetails>();
return QMap<QPair<QString, QString>, QString>();
#endif
}

Expand Down Expand Up @@ -114,8 +114,7 @@ bool QgsCoordinateTransformContext::addCoordinateOperation( const QgsCoordinateR
d->mLock.unlock();
return true;
#else
Q_UNUSED( sourceTransform )
Q_UNUSED( destinationTransform )
Q_UNUSED( coordinateOperationProjString )
return false;
#endif
}
Expand Down

0 comments on commit ba764b0

Please sign in to comment.