Skip to content
Permalink
Browse files

Bugfix: consider multiple overlay objects for multitypes (or also pos…

…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
mhugent committed May 4, 2009
1 parent 1a18dc3 commit 868f6be23c53786d4f9aa982958402194c68514f
Showing with 20 additions and 15 deletions.
  1. +20 −15 src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
@@ -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();
}
}
}
}

0 comments on commit 868f6be

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