Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #4402
  • Loading branch information
jef-n committed Dec 24, 2011
1 parent 893f305 commit b6f250d
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -761,7 +761,7 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
}

// labeling - register feature
if ( mRendererV2->symbolForFeature( fet ) != NULL )
if ( mRendererV2->symbolForFeature( fet ) != NULL && rendererContext.labelingEngine() )
{
if ( labeling )
{
Expand Down Expand Up @@ -847,7 +847,7 @@ void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bo
mCachedGeometries[fet.id()] = *fet.geometry();
}

if ( sym )
if ( sym && rendererContext.labelingEngine() )
{
if ( labeling )
{
Expand Down Expand Up @@ -1094,7 +1094,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
//double scale = rendererContext.scaleFactor() / markerScaleFactor;
drawFeature( rendererContext, fet, &marker );

if ( mRenderer->willRenderFeature( &fet ) )
if ( mRenderer->willRenderFeature( &fet ) && rendererContext.labelingEngine() )
{
if ( labeling )
{
Expand Down Expand Up @@ -5289,47 +5289,47 @@ void QgsVectorLayer::updateAttributeMapIndex( QgsAttributeMap& map, int oldIndex

void QgsVectorLayer::prepareLabelingAndDiagrams( QgsRenderContext& rendererContext, QgsAttributeList& attributes, bool& labeling )
{
if ( rendererContext.labelingEngine() )
if ( !rendererContext.labelingEngine() )
return;

QSet<int> attrIndex;
if ( rendererContext.labelingEngine()->prepareLayer( this, attrIndex, rendererContext ) )
{
QSet<int> attrIndex;
if ( rendererContext.labelingEngine()->prepareLayer( this, attrIndex, rendererContext ) )
QSet<int>::const_iterator attIt = attrIndex.constBegin();
for ( ; attIt != attrIndex.constEnd(); ++attIt )
{
QSet<int>::const_iterator attIt = attrIndex.constBegin();
for ( ; attIt != attrIndex.constEnd(); ++attIt )
if ( !attributes.contains( *attIt ) )
{
if ( !attributes.contains( *attIt ) )
{
attributes << *attIt;
}
attributes << *attIt;
}
labeling = true;
}
labeling = true;
}

//register diagram layers
if ( mDiagramRenderer && mDiagramLayerSettings )
//register diagram layers
if ( mDiagramRenderer && mDiagramLayerSettings )
{
mDiagramLayerSettings->renderer = mDiagramRenderer;
rendererContext.labelingEngine()->addDiagramLayer( this, mDiagramLayerSettings );
//add attributes needed by the diagram renderer
QList<int> att = mDiagramRenderer->diagramAttributes();
QList<int>::const_iterator attIt = att.constBegin();
for ( ; attIt != att.constEnd(); ++attIt )
{
mDiagramLayerSettings->renderer = mDiagramRenderer;
rendererContext.labelingEngine()->addDiagramLayer( this, mDiagramLayerSettings );
//add attributes needed by the diagram renderer
QList<int> att = mDiagramRenderer->diagramAttributes();
QList<int>::const_iterator attIt = att.constBegin();
for ( ; attIt != att.constEnd(); ++attIt )
{
if ( !attributes.contains( *attIt ) )
{
attributes << *attIt;
}
}
//and the ones needed for data defined diagram positions
if ( mDiagramLayerSettings->xPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings->xPosColumn ) )
{
attributes << mDiagramLayerSettings->xPosColumn;
}
if ( mDiagramLayerSettings->yPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings->yPosColumn ) )
if ( !attributes.contains( *attIt ) )
{
attributes << mDiagramLayerSettings->yPosColumn;
attributes << *attIt;
}
}
//and the ones needed for data defined diagram positions
if ( mDiagramLayerSettings->xPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings->xPosColumn ) )
{
attributes << mDiagramLayerSettings->xPosColumn;
}
if ( mDiagramLayerSettings->yPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings->yPosColumn ) )
{
attributes << mDiagramLayerSettings->yPosColumn;
}
}
}

Expand Down

0 comments on commit b6f250d

Please sign in to comment.