Skip to content

Commit

Permalink
Render incremental rendering image at proper location
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
m-kuhn committed Dec 11, 2014
1 parent 0d8cb3c commit 2e972b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions python/core/qgsmaprendererjob.sip
Expand Up @@ -89,6 +89,13 @@ class QgsMapRendererJob : QObject
//! Find out how log it took to finish the job (in miliseconds)
int renderingTime() const;

/**
* Return map settings with which this job was started.
* @return A QgsMapSettings instance with render settings
* @note added in 2.8
*/
const QgsMapSettings& mapSettings() const;

signals:

//! emitted when asynchronous rendering is finished (or canceled).
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsmaprendererjob.cpp
Expand Up @@ -56,6 +56,11 @@ void QgsMapRendererJob::setCache( QgsMapRendererCache* cache )
mCache = cache;
}

const QgsMapSettings& QgsMapRendererJob::mapSettings() const
{
return mSettings;
}


bool QgsMapRendererJob::reprojectToLayerExtent( const QgsCoordinateTransform* ct, bool layerCrsGeographic, QgsRectangle& extent, QgsRectangle& r2 )
{
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgsmaprendererjob.h
Expand Up @@ -126,6 +126,13 @@ class CORE_EXPORT QgsMapRendererJob : public QObject
//! Find out how log it took to finish the job (in miliseconds)
int renderingTime() const { return mRenderingTime; }

/**
* Return map settings with which this job was started.
* @return A QgsMapSettings instance with render settings
* @note added in 2.8
*/
const QgsMapSettings& mapSettings() const;

signals:

//! emitted when asynchronous rendering is finished (or canceled).
Expand Down
3 changes: 1 addition & 2 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -737,10 +737,9 @@ void QgsMapCanvas::rendererJobFinished()

void QgsMapCanvas::mapUpdateTimeout()
{
mMap->setContent( mJob->renderedImage(), mSettings.visibleExtent() );
mMap->setContent( mJob->renderedImage(), mJob->mapSettings().visibleExtent() );
}


void QgsMapCanvas::stopRendering()
{
if ( mJob )
Expand Down

0 comments on commit 2e972b1

Please sign in to comment.