@@ -2936,51 +2936,57 @@ QStringList QgsWmsProvider::identifyAs( const QgsPoint& point, QString format )
2936
2936
++layers, ++styles )
2937
2937
{
2938
2938
// Is sublayer visible?
2939
- if ( activeSubLayerVisibility.find ( *layers ).value () )
2940
- {
2941
- // Is sublayer queryable?
2942
- if ( mQueryableForLayer .find ( *layers ).value () )
2943
- {
2944
- QgsDebugMsg ( " Layer '" + *layers + " ' is queryable." );
2945
-
2946
- QUrl requestUrl ( mGetFeatureInfoUrlBase );
2947
- setQueryItem ( requestUrl, " SERVICE" , " WMS" );
2948
- setQueryItem ( requestUrl, " VERSION" , mCapabilities .version );
2949
- setQueryItem ( requestUrl, " REQUEST" , " GetFeatureInfo" );
2950
- setQueryItem ( requestUrl, " BBOX" , bbox );
2951
- setQueryItem ( requestUrl, crsKey, imageCrs );
2952
- setQueryItem ( requestUrl, " WIDTH" , QString::number ( cachedViewWidth ) );
2953
- setQueryItem ( requestUrl, " HEIGHT" , QString::number ( cachedViewHeight ) );
2954
- setQueryItem ( requestUrl, " LAYERS" , *layers );
2955
- setQueryItem ( requestUrl, " STYLES" , *styles );
2956
- setQueryItem ( requestUrl, " FORMAT" , imageMimeType );
2957
- setQueryItem ( requestUrl, " QUERY_LAYERS" , *layers );
2958
- setQueryItem ( requestUrl, " INFO_FORMAT" , format );
2959
- setQueryItem ( requestUrl, " X" , QString::number ( point.x () ) );
2960
- setQueryItem ( requestUrl, " Y" , QString::number ( point.y () ) );
2961
-
2962
- if ( mFeatureCount > 0 )
2963
- {
2964
- setQueryItem ( requestUrl, " FEATURE_COUNT" , QString::number ( mFeatureCount ) );
2965
- }
2939
+ if ( !activeSubLayerVisibility.find ( *layers ).value () )
2940
+ continue ;
2966
2941
2967
- // X,Y in WMS 1.1.1; I,J in WMS 1.3.0
2968
- // requestUrl += QString( "&I=%1&J=%2" ).arg( point.x() ).arg( point.y() );
2942
+ // Is sublayer queryable?
2943
+ if ( !mQueryableForLayer .find ( *layers ).value () )
2944
+ continue ;
2969
2945
2970
- QgsDebugMsg ( QString ( " getfeatureinfo: %1" ).arg ( requestUrl.toString () ) );
2971
- QNetworkRequest request ( requestUrl );
2972
- setAuthorization ( request );
2973
- mIdentifyReply = QgsNetworkAccessManager::instance ()->get ( request );
2974
- connect ( mIdentifyReply , SIGNAL ( finished () ), this , SLOT ( identifyReplyFinished () ) );
2946
+ QgsDebugMsg ( " Layer '" + *layers + " ' is queryable." );
2975
2947
2976
- while ( mIdentifyReply )
2977
- {
2978
- QCoreApplication::processEvents ( QEventLoop::ExcludeUserInputEvents );
2979
- }
2948
+ QUrl requestUrl ( mGetFeatureInfoUrlBase );
2949
+ setQueryItem ( requestUrl, " SERVICE" , " WMS" );
2950
+ setQueryItem ( requestUrl, " VERSION" , mCapabilities .version );
2951
+ setQueryItem ( requestUrl, " REQUEST" , " GetFeatureInfo" );
2952
+ setQueryItem ( requestUrl, " BBOX" , bbox );
2953
+ setQueryItem ( requestUrl, crsKey, imageCrs );
2954
+ setQueryItem ( requestUrl, " WIDTH" , QString::number ( cachedViewWidth ) );
2955
+ setQueryItem ( requestUrl, " HEIGHT" , QString::number ( cachedViewHeight ) );
2956
+ setQueryItem ( requestUrl, " LAYERS" , *layers );
2957
+ setQueryItem ( requestUrl, " STYLES" , *styles );
2958
+ setQueryItem ( requestUrl, " FORMAT" , imageMimeType );
2959
+ setQueryItem ( requestUrl, " QUERY_LAYERS" , *layers );
2960
+ setQueryItem ( requestUrl, " INFO_FORMAT" , format );
2980
2961
2981
- results << mIdentifyResult ;
2982
- }
2962
+ if ( mCapabilities .version == " 1.3.0" || mCapabilities .version == " 1.3" )
2963
+ {
2964
+ setQueryItem ( requestUrl, " I" , QString::number ( point.x () ) );
2965
+ setQueryItem ( requestUrl, " J" , QString::number ( point.y () ) );
2966
+ }
2967
+ else
2968
+ {
2969
+ setQueryItem ( requestUrl, " X" , QString::number ( point.x () ) );
2970
+ setQueryItem ( requestUrl, " Y" , QString::number ( point.y () ) );
2971
+ }
2972
+
2973
+ if ( mFeatureCount > 0 )
2974
+ {
2975
+ setQueryItem ( requestUrl, " FEATURE_COUNT" , QString::number ( mFeatureCount ) );
2976
+ }
2977
+
2978
+ QgsDebugMsg ( QString ( " getfeatureinfo: %1" ).arg ( requestUrl.toString () ) );
2979
+ QNetworkRequest request ( requestUrl );
2980
+ setAuthorization ( request );
2981
+ mIdentifyReply = QgsNetworkAccessManager::instance ()->get ( request );
2982
+ connect ( mIdentifyReply , SIGNAL ( finished () ), this , SLOT ( identifyReplyFinished () ) );
2983
+
2984
+ while ( mIdentifyReply )
2985
+ {
2986
+ QCoreApplication::processEvents ( QEventLoop::ExcludeUserInputEvents );
2983
2987
}
2988
+
2989
+ results << mIdentifyResult ;
2984
2990
}
2985
2991
2986
2992
QgsDebugMsg ( " Exiting with: " + results.join ( " \n ------\n " ) );
0 commit comments