mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
parent
67a7d1397f
commit
abf2398880
@ -145,7 +145,7 @@ bool QgsVectorLayerRenderer::render()
|
||||
.setFilterRect( requestExtent )
|
||||
.setSubsetOfAttributes( mAttrNames, mFields );
|
||||
|
||||
if ( !rendererFilter.isNull() )
|
||||
if ( !rendererFilter.isEmpty() )
|
||||
{
|
||||
featureRequest.setFilterExpression( rendererFilter );
|
||||
}
|
||||
|
@ -427,24 +427,33 @@ bool QgsRuleBasedRendererV2::Rule::startRender( QgsRenderContext& context, const
|
||||
}
|
||||
}
|
||||
|
||||
// subfilters (on the same level) are joined with OR and finally joined with AND with their parent (this) filter
|
||||
// subfilters (on the same level) are joined with OR
|
||||
// Finally they are joined with their parent (this) with AND
|
||||
QString sf;
|
||||
if ( subfilters.length() )
|
||||
// If there are subfilters present (and it's not a single empty one), group them and join them with OR
|
||||
if ( subfilters.length() > 1 || subfilters.value( 0 ).trimmed().length() > 0 )
|
||||
sf = subfilters.join( ") OR (" ).prepend( "(" ).append( ")" );
|
||||
|
||||
// Now join the subfilters with their parent (this) based on if
|
||||
// * The parent is an else rule
|
||||
// * The existence of parent filter and subfilters
|
||||
|
||||
if ( isElse() )
|
||||
{
|
||||
if ( !sf.length() )
|
||||
if ( !sf.trimmed().length() )
|
||||
filter = "TRUE";
|
||||
else
|
||||
filter = sf;
|
||||
}
|
||||
else if ( mFilterExp.length() && sf.length() )
|
||||
else if ( mFilterExp.trimmed().length() && sf.trimmed().length() )
|
||||
filter = QString( "(%1) AND (%2)" ).arg( mFilterExp ).arg( sf );
|
||||
else if ( mFilterExp.length() )
|
||||
else if ( mFilterExp.trimmed().length() )
|
||||
filter = mFilterExp;
|
||||
else
|
||||
filter = sf;
|
||||
|
||||
filter = filter.trimmed();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user