Skip to content

Commit e03b563

Browse files
committed
Rotate geometry before calculating bounding box in atlas. Fixes #11954
1 parent e957224 commit e03b563

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/composer/qgsatlascomposition.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,13 @@ bool QgsAtlasComposition::prepareForFeature( const int featureI, const bool upda
436436
void QgsAtlasComposition::computeExtent( QgsComposerMap *map )
437437
{
438438
// QgsGeometry::boundingBox is expressed in the geometry"s native CRS
439-
// We have to transform the grometry to the destination CRS and ask for the bounding box
439+
// We have to transform the geometry to the destination CRS and ask for the bounding box
440440
// Note: we cannot directly take the transformation of the bounding box, since transformations are not linear
441-
mTransformedFeatureBounds = currentGeometry( map->crs() ).boundingBox();
441+
QgsGeometry g(currentGeometry( map->crs() ));
442+
// Rotating the geometry, so the bounding box is correct wrt map rotation
443+
if ( map->mapRotation() != 0.0 )
444+
g.rotate(map->mapRotation(), g.centroid().asPoint());
445+
mTransformedFeatureBounds = g.boundingBox();
442446
}
443447

444448
void QgsAtlasComposition::prepareMap( QgsComposerMap *map )

0 commit comments

Comments
 (0)