Skip to content
Permalink
Browse files

fix phantom labels for (actually not) rendered feature (refs #13631)

  • Loading branch information
jef-n committed Oct 23, 2015
1 parent f7ce8b9 commit d6f66ee4888a700a160aa7c30f70ee0b6dceb0b6
Showing with 28 additions and 21 deletions.
  1. +21 −19 src/core/qgsvectorlayerrenderer.cpp
  2. +7 −2 src/core/symbology-ng/qgsrulebasedrendererv2.cpp
@@ -152,7 +152,7 @@ bool QgsVectorLayerRenderer::render()
.setFilterRect( requestExtent )
.setSubsetOfAttributes( mAttrNames, mFields );

if ( !rendererFilter.isEmpty() )
if ( !rendererFilter.isEmpty() && rendererFilter != "TRUE" )
{
featureRequest.setFilterExpression( rendererFilter );
featureRequest.setExpressionContext( mContext.expressionContext() );
@@ -303,28 +303,30 @@ void QgsVectorLayerRenderer::drawRendererV2( QgsFeatureIterator& fit )
bool rendered = mRendererV2->renderFeature( fet, mContext, -1, sel, drawMarker );

// labeling - register feature
Q_UNUSED( rendered );
if ( rendered && mContext.labelingEngine() )
if ( rendered )
{
if ( mLabeling )
if ( mContext.labelingEngine() )
{
mContext.labelingEngine()->registerFeature( mLayerID, fet, mContext );
}
if ( mDiagrams )
{
mContext.labelingEngine()->registerDiagramFeature( mLayerID, fet, mContext );
}
}
// new labeling engine
if ( rendered && mContext.labelingEngineV2() )
{
if ( mLabelProvider )
{
mLabelProvider->registerFeature( fet, mContext );
if ( mLabeling )
{
mContext.labelingEngine()->registerFeature( mLayerID, fet, mContext );
}
if ( mDiagrams )
{
mContext.labelingEngine()->registerDiagramFeature( mLayerID, fet, mContext );
}
}
if ( mDiagramProvider )
// new labeling engine
if ( mContext.labelingEngineV2() )
{
mDiagramProvider->registerFeature( fet, mContext );
if ( mLabelProvider )
{
mLabelProvider->registerFeature( fet, mContext );
}
if ( mDiagramProvider )
{
mDiagramProvider->registerFeature( fet, mContext );
}
}
}
}
@@ -435,7 +435,12 @@ bool QgsRuleBasedRendererV2::Rule::startRender( QgsRenderContext& context, const
QString sf;
// 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( ")" );
{
if ( subfilters.contains( "TRUE" ) )
sf = "TRUE";
else
sf = subfilters.join( ") OR (" ).prepend( "(" ).append( ")" );
}

// Now join the subfilters with their parent (this) based on if
// * The parent is an else rule
@@ -521,8 +526,8 @@ QgsRuleBasedRendererV2::Rule::RenderResult QgsRuleBasedRendererV2::Rule::renderF
{
//QgsDebugMsg(QString("add job at level %1").arg(normZLevel));
renderQueue[normZLevel].jobs.append( new RenderJob( featToRender, mSymbol ) );
rendered = true;
}
rendered = true;
}

bool willrendersomething = false;

0 comments on commit d6f66ee

Please sign in to comment.
You can’t perform that action at this time.