@@ -3457,6 +3457,33 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, const
3457
3457
return 0 ;
3458
3458
}
3459
3459
3460
+ // Rotate the geometry if needed, before clipping
3461
+ const QgsMapToPixel& m2p = context.mapToPixel ();
3462
+ if ( !qgsDoubleNear ( m2p.mapRotation (), 0 ) )
3463
+ {
3464
+ QgsPoint center = context.extent ().center ();
3465
+
3466
+ if ( ct )
3467
+ {
3468
+ try
3469
+ {
3470
+ center = ct->transform ( center );
3471
+ }
3472
+ catch ( QgsCsException &cse )
3473
+ {
3474
+ Q_UNUSED ( cse );
3475
+ QgsDebugMsgLevel ( QString ( " Ignoring feature due to transformation exception" ), 4 );
3476
+ return 0 ;
3477
+ }
3478
+ }
3479
+
3480
+ if ( geom->rotate ( m2p.mapRotation (), center ) )
3481
+ {
3482
+ QgsDebugMsg ( QString ( " Error rotating geometry" ).arg ( geom->exportToWkt () ) );
3483
+ return 0 ;
3484
+ }
3485
+ }
3486
+
3460
3487
if ( !geom->asGeos () )
3461
3488
return 0 ; // there is something really wrong with the geometry
3462
3489
@@ -3472,17 +3499,6 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, const
3472
3499
clonedGeometry.reset ( geom );
3473
3500
}
3474
3501
3475
- // Rotate the geometry if needed, before clipping
3476
- const QgsMapToPixel& m2p = context.mapToPixel ();
3477
- if ( !qgsDoubleNear ( m2p.mapRotation (), 0 ) )
3478
- {
3479
- if ( geom->rotate ( m2p.mapRotation (), context.extent ().center () ) )
3480
- {
3481
- QgsDebugMsg ( QString ( " Error rotating geometry" ).arg ( geom->exportToWkt () ) );
3482
- return 0 ;
3483
- }
3484
- }
3485
-
3486
3502
if ( clipGeometry && !clipGeometry->contains ( geom ) )
3487
3503
{
3488
3504
QgsGeometry* clipGeom = geom->intersection ( clipGeometry ); // creates new geometry
0 commit comments