Skip to content
Permalink
Browse files

[SERVER][BUGFIX] Use cache if styleName is EMPTY_STYLE_NAME

The QGIS Server layer cache is used to store layer with default style, but in
 QgsWMSProjectParser::mapLayerFromStyle layers are not cached if the style is
 not empty.

In WMS, default and empty style is the same and the variable EMPTY_STYLE_NAME
 is here for this.

The fix uses EMPTY_STYLE_NAME to use the cache.
  • Loading branch information
rldhont committed Sep 15, 2015
1 parent 8948721 commit c7a3ea3271929a27f233a301ad131cbe53744ac6
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/server/qgswmsprojectparser.cpp
@@ -118,7 +118,7 @@ QList<QgsMapLayer*> QgsWMSProjectParser::mapLayerFromStyle( const QString& lName
}

// can't use layer cache if we are going to apply a non-default style
if ( !styleName.isEmpty() )
if ( !styleName.isEmpty() && styleName != EMPTY_STYLE_NAME )
useCache = false;

//does lName refer to a leaf layer
@@ -127,7 +127,7 @@ QList<QgsMapLayer*> QgsWMSProjectParser::mapLayerFromStyle( const QString& lName
if ( layerElemIt != projectLayerElements.constEnd() )
{
QgsMapLayer* ml = mProjectParser->createLayerFromElement( layerElemIt.value(), useCache );
if ( !styleName.isEmpty() )
if ( !styleName.isEmpty() && styleName != EMPTY_STYLE_NAME )
{
// try to apply the specified style
if ( !ml->styleManager()->setCurrentStyle( styleName != EMPTY_STYLE_NAME ? styleName : QString() ) )

0 comments on commit c7a3ea3

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