@@ -170,6 +170,7 @@ QgsCoordinateReferenceSystem& QgsCoordinateReferenceSystem::operator=( const Qgs
170
170
mDescription = srs.mDescription ;
171
171
mProjectionAcronym = srs.mProjectionAcronym ;
172
172
mEllipsoidAcronym = srs.mEllipsoidAcronym ;
173
+ mAxisInverted = srs.mAxisInverted ;
173
174
mGeoFlag = srs.mGeoFlag ;
174
175
mMapUnits = srs.mMapUnits ;
175
176
mSRID = srs.mSRID ;
@@ -267,6 +268,7 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString expression, Q
267
268
mSRID = QString::fromUtf8 (( char * )sqlite3_column_text ( myPreparedStatement, 5 ) ).toLong ();
268
269
mAuthId = QString::fromUtf8 (( char * )sqlite3_column_text ( myPreparedStatement, 6 ) );
269
270
mGeoFlag = QString::fromUtf8 (( char * )sqlite3_column_text ( myPreparedStatement, 7 ) ).toInt () != 0 ;
271
+ mAxisInverted = -1 ;
270
272
271
273
if ( mSrsId >= USER_CRS_START_ID && mAuthId .isEmpty () )
272
274
{
@@ -754,6 +756,22 @@ bool QgsCoordinateReferenceSystem::geographicFlag() const
754
756
return mGeoFlag ;
755
757
}
756
758
759
+ bool QgsCoordinateReferenceSystem::axisInverted () const
760
+ {
761
+ if ( mAxisInverted == -1 )
762
+ {
763
+ OGRAxisOrientation orientation;
764
+ const char *axis0 = OSRGetAxis ( mCRS , mGeoFlag ? " GEOGCS" : " PROJCS" , 0 , &orientation );
765
+ mAxisInverted = mGeoFlag
766
+ ? ( orientation == OAO_East || orientation == OAO_West || orientation == OAO_Other )
767
+ : ( orientation == OAO_North || orientation == OAO_South );
768
+ QgsDebugMsg ( QString ( " srid:%1 axis0:%2 orientation:%3 inverted:%4" ).arg ( mSRID ).arg ( axis0 ).arg ( OSRAxisEnumToName ( orientation ) ).arg ( mAxisInverted ) );
769
+ Q_UNUSED ( axis0 );
770
+ }
771
+
772
+ return mAxisInverted != 0 ;
773
+ }
774
+
757
775
QGis::UnitType QgsCoordinateReferenceSystem::mapUnits () const
758
776
{
759
777
return mMapUnits ;
0 commit comments