Skip to content

Commit 2e972b1

Browse files
committed
Render incremental rendering image at proper location
The old behavior was to render it at the currently visibleExtent based on the map canvas. The job may however have been scheduled for a different extent and therefore rendered at an improper location.
1 parent 0d8cb3c commit 2e972b1

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

python/core/qgsmaprendererjob.sip

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ class QgsMapRendererJob : QObject
8989
//! Find out how log it took to finish the job (in miliseconds)
9090
int renderingTime() const;
9191

92+
/**
93+
* Return map settings with which this job was started.
94+
* @return A QgsMapSettings instance with render settings
95+
* @note added in 2.8
96+
*/
97+
const QgsMapSettings& mapSettings() const;
98+
9299
signals:
93100

94101
//! emitted when asynchronous rendering is finished (or canceled).

src/core/qgsmaprendererjob.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ void QgsMapRendererJob::setCache( QgsMapRendererCache* cache )
5656
mCache = cache;
5757
}
5858

59+
const QgsMapSettings& QgsMapRendererJob::mapSettings() const
60+
{
61+
return mSettings;
62+
}
63+
5964

6065
bool QgsMapRendererJob::reprojectToLayerExtent( const QgsCoordinateTransform* ct, bool layerCrsGeographic, QgsRectangle& extent, QgsRectangle& r2 )
6166
{

src/core/qgsmaprendererjob.h

+7
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ class CORE_EXPORT QgsMapRendererJob : public QObject
126126
//! Find out how log it took to finish the job (in miliseconds)
127127
int renderingTime() const { return mRenderingTime; }
128128

129+
/**
130+
* Return map settings with which this job was started.
131+
* @return A QgsMapSettings instance with render settings
132+
* @note added in 2.8
133+
*/
134+
const QgsMapSettings& mapSettings() const;
135+
129136
signals:
130137

131138
//! emitted when asynchronous rendering is finished (or canceled).

src/gui/qgsmapcanvas.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -737,10 +737,9 @@ void QgsMapCanvas::rendererJobFinished()
737737

738738
void QgsMapCanvas::mapUpdateTimeout()
739739
{
740-
mMap->setContent( mJob->renderedImage(), mSettings.visibleExtent() );
740+
mMap->setContent( mJob->renderedImage(), mJob->mapSettings().visibleExtent() );
741741
}
742742

743-
744743
void QgsMapCanvas::stopRendering()
745744
{
746745
if ( mJob )

0 commit comments

Comments
 (0)