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 8948721 commit c7a3ea3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/qgswmsprojectparser.cpp
Original file line number Diff line number Diff line change
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 c7a3ea3

Please sign in to comment.