Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix diagrams with data defined placement not showing for transformed
layers. Also fix move label tool not working for diagrams.
  • Loading branch information
nyalldawson committed Apr 9, 2015
1 parent 43f150d commit 60526f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/qgspallabeling.cpp
Expand Up @@ -3484,9 +3484,8 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&
if ( ddPos )
{
bool posXOk, posYOk;
//data defined diagram position is always centered
ddPosX = feat.attribute( ddColX ).toDouble( &posXOk ) - diagramWidth / 2.0;
ddPosY = feat.attribute( ddColY ).toDouble( &posYOk ) - diagramHeight / 2.0;
ddPosX = feat.attribute( ddColX ).toDouble( &posXOk );
ddPosY = feat.attribute( ddColY ).toDouble( &posYOk );
if ( !posXOk || !posYOk )
{
ddPos = false;
Expand All @@ -3499,6 +3498,9 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&
double z = 0;
ct->transformInPlace( ddPosX, ddPosY, z );
}
//data defined diagram position is always centered
ddPosX -= diagramWidth / 2.0;
ddPosY -= diagramHeight / 2.0;
}
}

Expand Down Expand Up @@ -4019,7 +4021,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
//for diagrams, remove the additional 'd' at the end of the layer id
QString layerId = layerName;
layerId.chop( 1 );
mResults->mLabelSearchTree->insertLabel( *it, QString( palGeometry->strId() ).toInt(), QString( "" ), layerId, QFont(), true, false );
mResults->mLabelSearchTree->insertLabel( *it, QString( palGeometry->strId() ).toInt(), layerId, QString( "" ), QFont(), true, false );
}
continue;
}
Expand Down

0 comments on commit 60526f4

Please sign in to comment.