Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -723,14 +723,7 @@ void QgsMapCanvas::rendererJobFinished() | |
|
||
p.end(); | ||
|
||
// This is an hack to pass QgsMapCanvasItem::setRect what it | ||
// expects (encoding of position and size of the item) | ||
const QgsMapToPixel& m2p = mSettings.mapToPixel(); | ||
QgsPoint topLeft = m2p.toMapPoint( 0, 0 ); | ||
double res = m2p.mapUnitsPerPixel(); | ||
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res ); | ||
|
||
mMap->setContent( img, rect ); | ||
mMap->setContent( img, imageRect( img ) ); | ||
} | ||
|
||
// now we are in a slot called from mJob - do not delete it immediately | ||
|
@@ -741,9 +734,21 @@ void QgsMapCanvas::rendererJobFinished() | |
emit mapCanvasRefreshed(); | ||
} | ||
|
||
QgsRectangle QgsMapCanvas::imageRect( const QImage& img ) | ||
{ | ||
// This is an hack to pass QgsMapCanvasItem::setRect what it | ||
// expects (encoding of position and size of the item) | ||
const QgsMapToPixel& m2p = mSettings.mapToPixel(); | ||
QgsPoint topLeft = m2p.toMapPoint( 0, 0 ); | ||
double res = m2p.mapUnitsPerPixel(); | ||
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res ); | ||
return rect; | ||
} | ||
|
||
void QgsMapCanvas::mapUpdateTimeout() | ||
{ | ||
mMap->setContent( mJob->renderedImage(), mJob->mapSettings().visibleExtent() ); | ||
const QImage& img = mJob->renderedImage(); | ||
mMap->setContent( img, imageRect( img ) ); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
strk
Contributor
|
||
} | ||
|
||
void QgsMapCanvas::stopRendering() | ||
|
Is
mJob->mapSettings().visibleExtent()
not ok?That would be more appropriate as it uses the extent at which the current image is rendered and not the extent of the mapcanvas (which may have changed since the job was scheduled).
Maybe specifying the QgsMapSettings object as parameter to the
imageRect
method so it can perform the rotation logic on that one instead?