Skip to content
Permalink
Browse files

[Server] GetLegendGraphics : Wait for feature counter finshed

  • Loading branch information
rldhont committed Sep 13, 2017
1 parent f88af6d commit f3165187f047740695f9aa0f6fd308e92374c795
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/server/services/wms/qgswmsrenderer.cpp
@@ -62,6 +62,7 @@
#include "qgsannotationmanager.h"
#include "qgsannotation.h"
#include "qgsvectorlayerlabeling.h"
#include "qgsvectorlayerfeaturecounter.h"
#include "qgspallabeling.h"
#include "qgslayerrestorer.h"
#include "qgsdxfexport.h"
@@ -2823,13 +2824,23 @@ namespace QgsWms

// build layer tree
rootGroup.clear();
QList<QgsVectorLayerFeatureCounter *> counters;
Q_FOREACH ( QgsMapLayer *ml, layers )
{
QgsLayerTreeLayer *lt = rootGroup.addLayer( ml );
lt->setCustomProperty( QStringLiteral( "showFeatureCount" ), showFeatureCount );

if ( !ml->title().isEmpty() )
lt->setName( ml->title() );

if ( ml->type() != QgsMapLayer::VectorLayer || !showFeatureCount )
continue;

QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( ml );
QgsVectorLayerFeatureCounter *counter = vl->countSymbolFeatures();
if ( !counter )
continue;
counters.append( counter );
}

// build legend model
@@ -2907,6 +2918,13 @@ namespace QgsWms
}
}

for ( QgsVectorLayerFeatureCounter *c : counters )
{
if ( !c )
continue;
c->waitForFinished();
}

return legendModel;
}

0 comments on commit f316518

Please sign in to comment.
You can’t perform that action at this time.