Skip to content

Commit

Permalink
Bugfix: consider multiple overlay objects for multitypes (or also pos…
Browse files Browse the repository at this point in the history
…sible no overlay objects if the feature is too small)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10725 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 4, 2009
1 parent 1a18dc3 commit 868f6be
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
Expand Up @@ -135,24 +135,29 @@ void QgsDiagramOverlay::drawOverlayObjects( QgsRenderContext& context ) const
{
if ( it.value() )
{
QgsPoint overlayPosition = it.value()->position();
QList<QgsPoint> positionList = it.value()->positions();
const QgsCoordinateTransform* ct = context.coordinateTransform();
if ( ct )
{
overlayPosition = ct->transform( overlayPosition );
}
context.mapToPixel().transform( &overlayPosition );
int shiftX = currentDiagramImage->width() / 2;
int shiftY = currentDiagramImage->height() / 2;

if ( painter )
QList<QgsPoint>::const_iterator positionIt = positionList.constBegin();
for(; positionIt != positionList.constEnd(); ++positionIt)
{
painter->save();
painter->scale( 1.0 / context.rasterScaleFactor(), 1.0 / context.rasterScaleFactor() );
//painter->drawRect(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, it.value()->width(), it.value()->height());
painter->drawImage(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, *currentDiagramImage );

painter->restore();
QgsPoint overlayPosition = *positionIt;
if ( ct )
{
overlayPosition = ct->transform(overlayPosition);
}
context.mapToPixel().transform( &overlayPosition );
int shiftX = currentDiagramImage->width() / 2;
int shiftY = currentDiagramImage->height() / 2;

if ( painter )
{
painter->save();
painter->scale( 1.0 / context.rasterScaleFactor(), 1.0 / context.rasterScaleFactor() );
//painter->drawRect(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, it.value()->width(), it.value()->height());
painter->drawImage(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, *currentDiagramImage );
painter->restore();
}
}
}
}
Expand Down

0 comments on commit 868f6be

Please sign in to comment.