Skip to content

Commit

Permalink
Fixes #13999: feature count on rule based renderer is valid for ELSE …
Browse files Browse the repository at this point in the history
…statement
  • Loading branch information
pblottiere committed Mar 27, 2018
1 parent 0b5c2ae commit 58b3e20
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/core/symbology/qgsrulebasedrenderer.cpp
Expand Up @@ -553,7 +553,9 @@ bool QgsRuleBasedRenderer::Rule::willRenderFeature( QgsFeature &feat, QgsRenderC
lst.removeOne( rule );

if ( lst.empty() )
{
return true;
}
}
else if ( !rule->isElse( ) && rule->willRenderFeature( feat, context ) )
{
Expand Down Expand Up @@ -587,7 +589,26 @@ QSet<QString> QgsRuleBasedRenderer::Rule::legendKeysForFeature( QgsFeature &feat

Q_FOREACH ( Rule *rule, mActiveChildren )
{
lst.unite( rule->legendKeysForFeature( feat, context ) );
bool validKey = false;
if ( rule->isElse() )
{
RuleList lst = rulesForFeature( feat, context, false );
lst.removeOne( rule );

if ( lst.empty() )
{
validKey = true;
}
}
else if ( !rule->isElse( ) && rule->willRenderFeature( feat, context ) )
{
validKey = true;
}

if ( validKey )
{
lst.unite( rule->legendKeysForFeature( feat, context ) );
}
}
return lst;
}
Expand Down

0 comments on commit 58b3e20

Please sign in to comment.