Skip to content
Permalink
Browse files

Fix extent to determine center point for angle calculation

  • Loading branch information
homann committed Aug 17, 2012
1 parent 3d380c6 commit a18e3965b0fda9008e75f201db9e5583bee818b5
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/app/qgsdecorationnortharrow.cpp
@@ -203,7 +203,15 @@ bool QgsDecorationNorthArrow::calculateNorthDirection()

bool goodDirn = false;

if ( mapCanvas->layerCount() > 0 )
// Get the shown extent...
QgsRectangle canvasExtent = mapCanvas->extent();
// ... and all layers extent, ...
QgsRectangle fullExtent = mapCanvas->fullExtent();
// ... and combine
QgsRectangle extent = canvasExtent.intersect( & fullExtent );

// If no layers are added or shown, we can't get any direction
if ( mapCanvas->layerCount() > 0 && ! extent.isEmpty() )
{
QgsCoordinateReferenceSystem outputCRS = mapCanvas->mapRenderer()->destinationCrs();

@@ -216,7 +224,6 @@ bool QgsDecorationNorthArrow::calculateNorthDirection()

QgsCoordinateTransform transform( outputCRS, ourCRS );

QgsRectangle extent = mapCanvas->extent();
QgsPoint p1( extent.center() );
// A point a bit above p1. XXX assumes that y increases up!!
// May need to involve the maptopixel transform if this proves

0 comments on commit a18e396

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