Skip to content
Permalink
Browse files
Densify canvas extent geometry before reprojecting for views
Makes displaying canvas extent in extra map views nice and smooth
if canvas CRSes differ.
  • Loading branch information
nyalldawson committed Mar 25, 2017
1 parent 5360b79 commit 249c6fcb20fabf1469241cb82f8c8f52e13286fc
Showing with 13 additions and 8 deletions.
  1. +13 −8 src/app/qgsmapcanvasdockwidget.cpp
@@ -428,15 +428,20 @@ void QgsMapCanvasDockWidget::updateExtentRect()
// close polygon
mainCanvasPoly << mainCanvasPoly.at( 0 );
QgsGeometry g = QgsGeometry::fromQPolygonF( mainCanvasPoly );
// reproject extent
QgsCoordinateTransform ct( mMainCanvas->mapSettings().destinationCrs(),
mMapCanvas->mapSettings().destinationCrs() );
try
{
g.transform( ct );
}
catch ( QgsCsException & )
if ( mMainCanvas->mapSettings().destinationCrs() !=
mMapCanvas->mapSettings().destinationCrs() )
{
// reproject extent
QgsCoordinateTransform ct( mMainCanvas->mapSettings().destinationCrs(),
mMapCanvas->mapSettings().destinationCrs() );
g = g.densifyByCount( 5 );
try
{
g.transform( ct );
}
catch ( QgsCsException & )
{
}
}
mExtentRubberBand->setToGeometry( g, nullptr );
}

0 comments on commit 249c6fc

Please sign in to comment.