18#ifndef QGSCOORDINATEREFERENCESYSTEM_PRIVATE_H 
   19#define QGSCOORDINATEREFERENCESYSTEM_PRIVATE_H 
   44class QgsCoordinateReferenceSystemPrivate : 
public QSharedData
 
   48    explicit QgsCoordinateReferenceSystemPrivate()
 
   52    QgsCoordinateReferenceSystemPrivate( 
const QgsCoordinateReferenceSystemPrivate &other )
 
   53      : QSharedData( other )
 
   54      , mSrsId( other.mSrsId )
 
   55      , mDescription( other.mDescription )
 
   56      , mProjectionAcronym( other.mProjectionAcronym )
 
   57      , mEllipsoidAcronym( other.mEllipsoidAcronym )
 
   58      , mIsGeographic( other.mIsGeographic )
 
   59      , mMapUnits( other.mMapUnits )
 
   60      , mSRID( other.mSRID )
 
   61      , mAuthId( other.mAuthId )
 
   62      , mIsValid( other.mIsValid )
 
   63      , mCoordinateEpoch( other.mCoordinateEpoch )
 
   65      , mProj4( other.mProj4 )
 
   66      , mWktPreferred( other.mWktPreferred )
 
   67      , mAxisInvertedDirty( other.mAxisInvertedDirty )
 
   68      , mAxisInverted( other.mAxisInverted )
 
   73    ~QgsCoordinateReferenceSystemPrivate()
 
   76      if ( !mProjObjects.empty() || mPj )
 
   90    QString mProjectionAcronym;
 
   93    QString mEllipsoidAcronym;
 
   96    bool mIsGeographic = 
false;
 
  108    bool mIsValid = 
false;
 
  111    double mCoordinateEpoch = std::numeric_limits< double >::quiet_NaN();
 
  120    void cleanPjObjects()
 
  128      PJ_CONTEXT *tmpContext = proj_context_create();
 
  129      for ( 
auto it = mProjObjects.begin(); it != mProjObjects.end(); ++it )
 
  131        proj_assign_context( it.value(), tmpContext );
 
  132        proj_destroy( it.value() );
 
  134      mProjObjects.clear();
 
  137        proj_assign_context( mPj.get(), tmpContext );
 
  140      proj_context_destroy( tmpContext );
 
  150      mPj = std::move( obj );
 
  157      return static_cast< bool >( mPj );
 
  160    mutable QString mProj4;
 
  162    mutable QString mWktPreferred;
 
  165    mutable bool mAxisInvertedDirty = 
false;
 
  168    mutable bool mAxisInverted = 
false;
 
  171    mutable QReadWriteLock mProjLock{};
 
  172    mutable QMap < PJ_CONTEXT *, PJ * > mProjObjects{};
 
  176    PJ *threadLocalProjObject()
 const 
  183      const QMap < PJ_CONTEXT *, PJ * >::const_iterator it = mProjObjects.constFind( context );
 
  185      if ( it != mProjObjects.constEnd() )
 
  193      PJ *res = proj_clone( context, mPj.get() );
 
  194      mProjObjects.insert( context, res );
 
  199    bool removeObjectsBelongingToCurrentThread( 
PJ_CONTEXT *pj_context )
 
  203      const QMap < PJ_CONTEXT *, PJ * >::iterator it = mProjObjects.find( pj_context );
 
  204      if ( it != mProjObjects.end() )
 
  206        proj_destroy( it.value() );
 
  207        mProjObjects.erase( it );
 
  210      if ( mPjParentContext == pj_context )
 
  213        mPjParentContext = 
nullptr;
 
  216      return mProjObjects.isEmpty();
 
  220    QgsCoordinateReferenceSystemPrivate &operator= ( 
const QgsCoordinateReferenceSystemPrivate & ) = 
delete;
 
static PJ_CONTEXT * get()
Returns a thread local instance of a proj context, safe for use in the current thread.
 
std::unique_ptr< PJ, ProjPJDeleter > proj_pj_unique_ptr
Scoped Proj PJ object.
 
The QgsReadWriteLocker class is a convenience class that simplifies locking and unlocking QReadWriteL...
 
DistanceUnit
Units of distance.
 
@ DistanceUnknownUnit
Unknown distance unit.
 
void * OGRSpatialReferenceH
 
struct projCtx_t PJ_CONTEXT