Skip to content

Commit ecef7d7

Browse files
committedNov 4, 2016
Fix empty legends in WMS GetPrint
1 parent e1d272d commit ecef7d7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎src/server/qgswmsconfigparser.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,21 @@ QgsComposition* QgsWMSConfigParser::createPrintComposition( const QString& compo
201201
continue;
202202
}
203203

204+
//The layer set has entries if the composer map has a locked layer set or
205+
//if the composer map layer set has been constrained in the WMS request.
206+
//If this is not the case, there is no need to modify the layers in the legend here
207+
QStringList layerSet = map->layerSet();
208+
if ( layerSet.size() < 1 )
209+
{
210+
continue;
211+
}
212+
204213
// get model and layer tree root of the legend
205214
QgsLegendModelV2* model = currentLegend->modelV2();
206215
QgsLayerTreeGroup* root = model->rootGroup();
207216

208-
209217
// get layerIds find in the layer tree root
210218
QStringList layerIds = root->findLayerIds();
211-
// get map layerIds
212-
QStringList layerSet = map->layerSet();
213219

214220
// get map scale
215221
double scale = map->scale();

0 commit comments

Comments
 (0)
Please sign in to comment.