Skip to content

Commit d62d88e

Browse files
committedApr 6, 2013
apply #7521
1 parent 04119d8 commit d62d88e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
 

‎src/mapserver/qgswmsserver.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ QImage* QgsWMSServer::getLegendGraphics()
256256
{
257257
return 0;
258258
}
259+
if ( !mParameterMap.contains( "LAYER" ) && !mParameterMap.contains( "LAYERS" ) )
260+
{
261+
throw QgsMapServiceException( "LayerNotSpecified", "LAYER is mandatory for GetLegendGraphic operation" );
262+
}
263+
if ( !mParameterMap.contains( "FORMAT" ) )
264+
{
265+
throw QgsMapServiceException( "FormatNotSpecified", "FORMAT is mandatory for GetLegendGraphic operation" );
266+
}
259267

260268
QStringList layersList, stylesList;
261269

@@ -1134,9 +1142,11 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const
11341142

11351143
int QgsWMSServer::readLayersAndStyles( QStringList& layersList, QStringList& stylesList ) const
11361144
{
1137-
//get layer and style lists from the parameters
1138-
layersList = mParameterMap.value( "LAYERS" ).split( "," );
1139-
stylesList = mParameterMap.value( "STYLES" ).split( "," );
1145+
//get layer and style lists from the parameters trying LAYERS and LAYER as well as STYLE and STYLES for GetLegendGraphic compatibility
1146+
layersList = mParameterMap.value( "LAYER" ).split( "," );
1147+
layersList = layersList + mParameterMap.value( "LAYERS" ).split( "," );
1148+
stylesList = mParameterMap.value( "STYLE" ).split( "," );
1149+
stylesList = stylesList + mParameterMap.value( "STYLES" ).split( "," );
11401150

11411151
return 0;
11421152
}

0 commit comments

Comments
 (0)
Please sign in to comment.