Skip to content

Commit

Permalink
[SERVER][BUGFIX] Use cache if styleName is EMPTY_STYLE_NAME
Browse files Browse the repository at this point in the history
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 ae906b5 commit a42b760
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/qgswmsprojectparser.cpp
Expand Up @@ -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
Expand All @@ -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() ) )
Expand Down

0 comments on commit a42b760

Please sign in to comment.