@@ -639,20 +639,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
639
639
mCacheReply = 0 ;
640
640
}
641
641
642
- // according to the WMS spec for 1.3, some CRS have inverted axis
643
- bool changeXY = false ;
644
- if ( !mIgnoreAxisOrientation && ( mCapabilities .version == " 1.3.0" || mCapabilities .version == " 1.3" ) )
645
- {
646
- // create CRS from string
647
- QgsCoordinateReferenceSystem theSrs;
648
- if ( theSrs.createFromOgcWmsCrs ( mImageCrs ) && theSrs.axisInverted () )
649
- {
650
- changeXY = true ;
651
- }
652
- }
653
-
654
- if ( mInvertAxisOrientation )
655
- changeXY = !changeXY;
642
+ bool changeXY = shouldInvertAxisOrientation ( mImageCrs );
656
643
657
644
// compose the URL query string for the WMS server.
658
645
QString crsKey = " SRS" ; // SRS in 1.1.1 and CRS in 1.3.0
@@ -2493,6 +2480,13 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
2493
2480
else if ( e1 .hasAttribute ( " SRS" ) )
2494
2481
bbox.crs = e1 .attribute ( " SRS" );
2495
2482
2483
+ if ( shouldInvertAxisOrientation ( bbox.crs ) )
2484
+ {
2485
+ QgsRectangle invAxisBbox ( bbox.box .yMinimum (), bbox.box .xMinimum (),
2486
+ bbox.box .yMaximum (), bbox.box .xMaximum () );
2487
+ bbox.box = invAxisBbox;
2488
+ }
2489
+
2496
2490
layerProperty.boundingBox .push_back ( bbox );
2497
2491
}
2498
2492
else
@@ -4240,19 +4234,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs
4240
4234
4241
4235
// Collect which layers to query on
4242
4236
// according to the WMS spec for 1.3, the order of x - and y - coordinates is inverted for geographical CRS
4243
- bool changeXY = false ;
4244
- if ( !mIgnoreAxisOrientation && ( mCapabilities .version == " 1.3.0" || mCapabilities .version == " 1.3" ) )
4245
- {
4246
- // create CRS from string
4247
- QgsCoordinateReferenceSystem theSrs;
4248
- if ( theSrs.createFromOgcWmsCrs ( mImageCrs ) && theSrs.axisInverted () )
4249
- {
4250
- changeXY = true ;
4251
- }
4252
- }
4253
-
4254
- if ( mInvertAxisOrientation )
4255
- changeXY = !changeXY;
4237
+ bool changeXY = shouldInvertAxisOrientation ( mImageCrs );
4256
4238
4257
4239
// compose the URL query string for the WMS server.
4258
4240
QString crsKey = " SRS" ; // SRS in 1.1.1 and CRS in 1.3.0
@@ -4962,6 +4944,28 @@ void QgsWmsProvider::getLegendGraphicReplyProgress( qint64 bytesReceived, qint64
4962
4944
emit statusChanged ( msg );
4963
4945
}
4964
4946
4947
+ bool QgsWmsProvider::shouldInvertAxisOrientation ( const QString& ogcCrs )
4948
+ {
4949
+ // according to the WMS spec for 1.3, some CRS have inverted axis
4950
+ bool changeXY = false ;
4951
+ if ( !mIgnoreAxisOrientation && ( mCapabilities .version == " 1.3.0" || mCapabilities .version == " 1.3" ) )
4952
+ {
4953
+ // create CRS from string
4954
+ QgsCoordinateReferenceSystem theSrs;
4955
+ if ( theSrs.createFromOgcWmsCrs ( ogcCrs ) && theSrs.axisInverted () )
4956
+ {
4957
+ changeXY = true ;
4958
+ }
4959
+ }
4960
+
4961
+ if ( mInvertAxisOrientation )
4962
+ changeXY = !changeXY;
4963
+
4964
+ return changeXY;
4965
+ }
4966
+
4967
+
4968
+
4965
4969
/* *
4966
4970
* Class factory to return a pointer to a newly created
4967
4971
* QgsWmsProvider object
0 commit comments