Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix bad WMS server performance
  • Loading branch information
m-kuhn committed May 22, 2013
1 parent 75896d9 commit 700d12f
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
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
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
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 700d12f

Please sign in to comment.