Skip to content
Permalink
Browse files

Fix map view synchronization with different CRS

  • Loading branch information
nyalldawson committed Mar 13, 2017
1 parent 560e9c2 commit 419e53b8ef72a6f8a22dad343f607c76d229449e
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/app/qgsmapcanvasdockwidget.cpp
@@ -14,6 +14,7 @@
***************************************************************************/
#include "qgsmapcanvasdockwidget.h"
#include "qgsmapcanvas.h"
#include "qgscsexception.h"
#include "qgsprojectionselectiondialog.h"
#include "qgsscalecombobox.h"
#include "qgsstatusbarmagnifierwidget.h"
@@ -194,7 +195,18 @@ void QgsMapCanvasDockWidget::mapExtentChanged()
syncView( false );

QgsMapCanvas *destCanvas = sourceCanvas == mMapCanvas ? mMainCanvas : mMapCanvas;
destCanvas->setExtent( sourceCanvas->extent() );

// reproject extent
QgsCoordinateTransform ct( sourceCanvas->mapSettings().destinationCrs(),
destCanvas->mapSettings().destinationCrs() );
try
{
destCanvas->setExtent( ct.transformBoundingBox( sourceCanvas->extent() ) );
}
catch ( QgsCsException & )
{
destCanvas->setExtent( sourceCanvas->extent() );
}
destCanvas->refresh();

syncView( true );

0 comments on commit 419e53b

Please sign in to comment.
You can’t perform that action at this time.