Skip to content

Commit f27e6c2

Browse files
committed
[FEATURE][QGIS-Server] showFeatureCount in GetLegendGraphic
Add non standard parameter 'ShowFeatureCount' to add feature count in the legend.
1 parent ac5ff0c commit f27e6c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/server/qgswmsserver.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,11 @@ QImage* QgsWMSServer::getLegendGraphics()
782782
}
783783
}
784784
}
785+
786+
// Checks showFeatureCount parameter
787+
bool showFeatureCount = false;
788+
if ( mParameters.contains( "SHOWFEATURECOUNT" ) )
789+
showFeatureCount = QVariant(mParameters[ "SHOWFEATURECOUNT" ]).toBool();
785790

786791
// Create the layer tree root
787792
QgsLayerTreeGroup rootGroup;
@@ -799,6 +804,9 @@ QImage* QgsWMSServer::getLegendGraphics()
799804
// set layer name with layer's title to have it in legend
800805
if ( !ml->title().isEmpty() )
801806
layer->setLayerName( ml->title() );
807+
// set show feature count
808+
if ( showFeatureCount )
809+
layer->setCustomProperty( "showFeatureCount", showFeatureCount );
802810
}
803811
QgsLayerTreeModel legendModel( &rootGroup );
804812

0 commit comments

Comments
 (0)