Skip to content

Commit 921321e

Browse files
author
mhugent
committedMay 4, 2009
Bugfix: consider multiple overlay objects for multitypes (or also possible no overlay objects if the feature is too small)
git-svn-id: http://svn.osgeo.org/qgis/trunk@10725 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 22d8698 commit 921321e

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed
 

‎src/plugins/diagram_overlay/qgsdiagramoverlay.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,29 @@ void QgsDiagramOverlay::drawOverlayObjects( QgsRenderContext& context ) const
135135
{
136136
if ( it.value() )
137137
{
138-
QgsPoint overlayPosition = it.value()->position();
138+
QList<QgsPoint> positionList = it.value()->positions();
139139
const QgsCoordinateTransform* ct = context.coordinateTransform();
140-
if ( ct )
141-
{
142-
overlayPosition = ct->transform( overlayPosition );
143-
}
144-
context.mapToPixel().transform( &overlayPosition );
145-
int shiftX = currentDiagramImage->width() / 2;
146-
int shiftY = currentDiagramImage->height() / 2;
147140

148-
if ( painter )
141+
QList<QgsPoint>::const_iterator positionIt = positionList.constBegin();
142+
for(; positionIt != positionList.constEnd(); ++positionIt)
149143
{
150-
painter->save();
151-
painter->scale( 1.0 / context.rasterScaleFactor(), 1.0 / context.rasterScaleFactor() );
152-
//painter->drawRect(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, it.value()->width(), it.value()->height());
153-
painter->drawImage(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, *currentDiagramImage );
154-
155-
painter->restore();
144+
QgsPoint overlayPosition = *positionIt;
145+
if ( ct )
146+
{
147+
overlayPosition = ct->transform(overlayPosition);
148+
}
149+
context.mapToPixel().transform( &overlayPosition );
150+
int shiftX = currentDiagramImage->width() / 2;
151+
int shiftY = currentDiagramImage->height() / 2;
152+
153+
if ( painter )
154+
{
155+
painter->save();
156+
painter->scale( 1.0 / context.rasterScaleFactor(), 1.0 / context.rasterScaleFactor() );
157+
//painter->drawRect(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, it.value()->width(), it.value()->height());
158+
painter->drawImage(( int )( overlayPosition.x() * context.rasterScaleFactor() ) - shiftX, ( int )( overlayPosition.y() * context.rasterScaleFactor() ) - shiftY, *currentDiagramImage );
159+
painter->restore();
160+
}
156161
}
157162
}
158163
}

0 commit comments

Comments
 (0)
Please sign in to comment.