@@ -685,62 +685,66 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result )
685
685
QStringList::const_iterator layerIt;
686
686
for ( layerIt = queryLayerList.constBegin (); layerIt != queryLayerList.constEnd (); ++layerIt )
687
687
{
688
- // create maplayer from sld parser
688
+ // create maplayers from sld parser (several layers are possible in case of feature info on a group)
689
689
layerList = mConfigParser ->mapLayerFromStyle ( *layerIt, " " );
690
- currentLayer = layerList.at ( 0 );
691
- if ( !currentLayer || nonIdentifiableLayers. contains ( currentLayer-> id () ) )
690
+ QList<QgsMapLayer*>::iterator layerListIt = layerList.begin ( );
691
+ for (; layerListIt != layerList. end (); ++layerListIt )
692
692
{
693
- continue ;
694
- }
695
- if ( infoPointToLayerCoordinates ( i, j, infoPoint, mMapRenderer , currentLayer ) != 0 )
696
- {
697
- continue ;
698
- }
699
- QgsDebugMsg ( " Info point in layer crs: " + QString::number ( infoPoint.x () ) + " //" + QString::number ( infoPoint.y () ) );
700
-
701
- QDomElement layerElement = result.createElement ( " Layer" );
702
- layerElement.setAttribute ( " name" , currentLayer->name () );
703
- getFeatureInfoElement.appendChild ( layerElement );
704
-
705
- // switch depending on vector or raster
706
- QgsVectorLayer* vectorLayer = dynamic_cast <QgsVectorLayer*>( currentLayer );
707
- if ( vectorLayer )
708
- {
709
- // is there alias info for this vector layer?
710
- QMap< int , QString > layerAliasInfo;
711
- QMap< QString, QMap< int , QString > >::const_iterator aliasIt = aliasInfo.find ( currentLayer->id () );
712
- if ( aliasIt != aliasInfo.constEnd () )
713
- {
714
- layerAliasInfo = aliasIt.value ();
715
- }
693
+ currentLayer = *layerListIt;
694
+ if ( !currentLayer || nonIdentifiableLayers.contains ( currentLayer->id () ) )
695
+ {
696
+ continue ;
697
+ }
698
+ if ( infoPointToLayerCoordinates ( i, j, infoPoint, mMapRenderer , currentLayer ) != 0 )
699
+ {
700
+ continue ;
701
+ }
702
+ QgsDebugMsg ( " Info point in layer crs: " + QString::number ( infoPoint.x () ) + " //" + QString::number ( infoPoint.y () ) );
716
703
717
- // hidden attributes for this layer
718
- QSet<QString> layerHiddenAttributes;
719
- QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttributes.find ( currentLayer->id () );
720
- if ( hiddenIt != hiddenAttributes.constEnd () )
721
- {
722
- layerHiddenAttributes = hiddenIt.value ();
723
- }
704
+ QDomElement layerElement = result.createElement ( " Layer" );
705
+ layerElement.setAttribute ( " name" , currentLayer->name () );
706
+ getFeatureInfoElement.appendChild ( layerElement );
724
707
725
- if ( featureInfoFromVectorLayer ( vectorLayer, infoPoint, featureCount, result, layerElement, mMapRenderer , layerAliasInfo, layerHiddenAttributes ) != 0 )
726
- {
727
- return 9 ;
728
- }
729
- }
730
- else // raster layer
731
- {
732
- QgsRasterLayer* rasterLayer = dynamic_cast <QgsRasterLayer*>( currentLayer );
733
- if ( rasterLayer )
734
- {
735
- if ( featureInfoFromRasterLayer ( rasterLayer, infoPoint, result, layerElement ) != 0 )
708
+ // switch depending on vector or raster
709
+ QgsVectorLayer* vectorLayer = dynamic_cast <QgsVectorLayer*>( currentLayer );
710
+ if ( vectorLayer )
736
711
{
737
- return 10 ;
712
+ // is there alias info for this vector layer?
713
+ QMap< int , QString > layerAliasInfo;
714
+ QMap< QString, QMap< int , QString > >::const_iterator aliasIt = aliasInfo.find ( currentLayer->id () );
715
+ if ( aliasIt != aliasInfo.constEnd () )
716
+ {
717
+ layerAliasInfo = aliasIt.value ();
718
+ }
719
+
720
+ // hidden attributes for this layer
721
+ QSet<QString> layerHiddenAttributes;
722
+ QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttributes.find ( currentLayer->id () );
723
+ if ( hiddenIt != hiddenAttributes.constEnd () )
724
+ {
725
+ layerHiddenAttributes = hiddenIt.value ();
726
+ }
727
+
728
+ if ( featureInfoFromVectorLayer ( vectorLayer, infoPoint, featureCount, result, layerElement, mMapRenderer , layerAliasInfo, layerHiddenAttributes ) != 0 )
729
+ {
730
+ continue ;
731
+ }
732
+ }
733
+ else // raster layer
734
+ {
735
+ QgsRasterLayer* rasterLayer = dynamic_cast <QgsRasterLayer*>( currentLayer );
736
+ if ( rasterLayer )
737
+ {
738
+ if ( featureInfoFromRasterLayer ( rasterLayer, infoPoint, result, layerElement ) != 0 )
739
+ {
740
+ continue ;
741
+ }
742
+ }
743
+ else
744
+ {
745
+ continue ;
746
+ }
738
747
}
739
- }
740
- else
741
- {
742
- return 11 ;
743
- }
744
748
}
745
749
}
746
750
return 0 ;
0 commit comments