Merge pull request #1901 from m-kuhn/fixrendering

Fix rendering position in incremental rendering
This commit is contained in:
Matthias Kuhn 2015-02-16 12:49:29 +01:00
commit 96732bb91c
2 changed files with 6 additions and 6 deletions

View File

@ -726,7 +726,7 @@ void QgsMapCanvas::rendererJobFinished()
p.end(); p.end();
mMap->setContent( img, imageRect( img ) ); mMap->setContent( img, imageRect( img, mJob->mapSettings() ) );
} }
// now we are in a slot called from mJob - do not delete it immediately // now we are in a slot called from mJob - do not delete it immediately
@ -737,11 +737,11 @@ void QgsMapCanvas::rendererJobFinished()
emit mapCanvasRefreshed(); emit mapCanvasRefreshed();
} }
QgsRectangle QgsMapCanvas::imageRect( const QImage& img ) QgsRectangle QgsMapCanvas::imageRect( const QImage& img, const QgsMapSettings& mapSettings )
{ {
// This is an hack to pass QgsMapCanvasItem::setRect what it // This is a hack to pass QgsMapCanvasItem::setRect what it
// expects (encoding of position and size of the item) // expects (encoding of position and size of the item)
const QgsMapToPixel& m2p = mSettings.mapToPixel(); const QgsMapToPixel& m2p = mapSettings.mapToPixel();
QgsPoint topLeft = m2p.toMapPoint( 0, 0 ); QgsPoint topLeft = m2p.toMapPoint( 0, 0 );
double res = m2p.mapUnitsPerPixel(); double res = m2p.mapUnitsPerPixel();
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res ); QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res );
@ -751,7 +751,7 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage& img )
void QgsMapCanvas::mapUpdateTimeout() void QgsMapCanvas::mapUpdateTimeout()
{ {
const QImage& img = mJob->renderedImage(); const QImage& img = mJob->renderedImage();
mMap->setContent( img, imageRect( img ) ); mMap->setContent( img, imageRect( img, mJob->mapSettings() ) );
} }
void QgsMapCanvas::stopRendering() void QgsMapCanvas::stopRendering()

View File

@ -674,7 +674,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
QgsPreviewEffect* mPreviewEffect; QgsPreviewEffect* mPreviewEffect;
QgsRectangle imageRect( const QImage& img ); QgsRectangle imageRect(const QImage& img , const QgsMapSettings& mapSettings );
QgsSnappingUtils* mSnappingUtils; QgsSnappingUtils* mSnappingUtils;