Skip to content

Commit

Permalink
[FEATURE][QGIS-Server] showFeatureCount in GetLegendGraphic
Browse files Browse the repository at this point in the history
Add non standard parameter 'ShowFeatureCount' to add feature count in the legend.
  • Loading branch information
rldhont committed Dec 10, 2015
1 parent ac5ff0c commit f27e6c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server/qgswmsserver.cpp
Expand Up @@ -782,6 +782,11 @@ QImage* QgsWMSServer::getLegendGraphics()
}
}
}

// Checks showFeatureCount parameter
bool showFeatureCount = false;
if ( mParameters.contains( "SHOWFEATURECOUNT" ) )
showFeatureCount = QVariant(mParameters[ "SHOWFEATURECOUNT" ]).toBool();

This comment has been minimized.


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

Expand Down

0 comments on commit f27e6c2

Please sign in to comment.