Skip to content

Commit

Permalink
Avoid second transform of extent (in QgsMapRender) on change of dest CRS
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Jun 11, 2014
1 parent 97665d7 commit 0f5d743
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsmaprenderer.sip
Expand Up @@ -221,7 +221,7 @@ class QgsMapRenderer : QObject
bool hasCrsTransformEnabled() const;

//! sets destination coordinate reference system
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool refreshCoordinateTransformInfo = true );
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool refreshCoordinateTransformInfo = true, bool transformExtent = true );

//! returns CRS of destination coordinate reference system
const QgsCoordinateReferenceSystem& destinationCrs() const;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaprenderer.cpp
Expand Up @@ -657,7 +657,7 @@ bool QgsMapRenderer::hasCrsTransformEnabled() const
return mProjectionsEnabled;
}

void QgsMapRenderer::setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool refreshCoordinateTransformInfo )
void QgsMapRenderer::setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool refreshCoordinateTransformInfo, bool transformExtent )
{
QgsDebugMsg( "* Setting destCRS : = " + crs.toProj4() );
QgsDebugMsg( "* DestCRS.srsid() = " + QString::number( crs.srsid() ) );
Expand All @@ -668,7 +668,7 @@ void QgsMapRenderer::setDestinationCrs( const QgsCoordinateReferenceSystem& crs,
mLayerCoordinateTransformInfo.clear();
}
QgsRectangle rect;
if ( !mExtent.isEmpty() )
if ( transformExtent && !mExtent.isEmpty() )
{
QgsCoordinateTransform transform( *mDestCRS, crs );
rect = transform.transformBoundingBox( mExtent );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderer.h
Expand Up @@ -258,7 +258,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
bool hasCrsTransformEnabled() const;

//! sets destination coordinate reference system
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool refreshCoordinateTransformInfo = true );
void setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool refreshCoordinateTransformInfo = true, bool transformExtent = true );

//! returns CRS of destination coordinate reference system
const QgsCoordinateReferenceSystem& destinationCrs() const;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -152,7 +152,7 @@ void QgsMapCanvasRendererSync::onCrsTransformR2C()

void QgsMapCanvasRendererSync::onDestCrsC2R()
{
mRenderer->setDestinationCrs( mCanvas->mapSettings().destinationCrs() );
mRenderer->setDestinationCrs( mCanvas->mapSettings().destinationCrs(), true, false );
}

void QgsMapCanvasRendererSync::onDestCrsR2C()
Expand Down

0 comments on commit 0f5d743

Please sign in to comment.