Skip to content

Commit

Permalink
Merge pull request #604 from matthias-kuhn/wmsfix
Browse files Browse the repository at this point in the history
Fix bad WMS server performance
  • Loading branch information
mhugent committed May 23, 2013
2 parents ac9736b + 700d12f commit d50214b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/core/qgsmaplayerregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,16 @@ void QgsMapLayerRegistry::removeMapLayers( QStringList theLayerIds )
}
}

void QgsMapLayerRegistry::clearMapLayers()
{
mMapLayers.clear();
} // QgsMapLayerRegistry::clearMapLayers()

void QgsMapLayerRegistry::removeMapLayer( const QString& theLayerId )
{
removeMapLayers( QStringList( theLayerId ) );
}


void QgsMapLayerRegistry::removeAllMapLayers()
{
emit removeAll();
Expand Down
10 changes: 10 additions & 0 deletions src/core/qgsmaplayerregistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
*/
QgsMapLayer* addMapLayer( QgsMapLayer * theMapLayer, bool addToLegend = true );

/**
* @brief
* Clears the map layer registry silently. No signals are emitted,
* no layer is deleted. Whatever this is suitable for... The WMS
* server makes use of this.
*
* Not available in python
*/
void clearMapLayers();

/**
* @brief
* Remove a set of layers from the registry
Expand Down
4 changes: 2 additions & 2 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ QImage* QgsWMSServer::getLegendGraphics()
currentY += layerSpace;
}

QgsMapLayerRegistry::instance()->removeAllMapLayers();
QgsMapLayerRegistry::instance()->clearMapLayers();
delete theImage;
return paintImage;
}
Expand Down Expand Up @@ -649,7 +649,7 @@ QImage* QgsWMSServer::getMap()
clearFeatureSelections( selectedLayerIdList );

QgsDebugMsg( "clearing filters" );
QgsMapLayerRegistry::instance()->removeAllMapLayers();
QgsMapLayerRegistry::instance()->clearMapLayers();

#ifdef QGISDEBUG
theImage->save( QDir::tempPath() + QDir::separator() + "lastrender.png" );
Expand Down

0 comments on commit d50214b

Please sign in to comment.