Skip to content

Commit c7a3ea3

Browse files
committed
[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.
1 parent 8948721 commit c7a3ea3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/server/qgswmsprojectparser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ QList<QgsMapLayer*> QgsWMSProjectParser::mapLayerFromStyle( const QString& lName
118118
}
119119

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

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

0 commit comments

Comments
 (0)