@@ -3325,6 +3325,11 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QStringList& attrNames,
3325
3325
3326
3326
// rect for clipping
3327
3327
lyr.extentGeom = QgsGeometry::fromRect ( mMapSettings ->visibleExtent () );
3328
+ if ( !qgsDoubleNear ( mMapSettings ->rotation (), 0.0 ) )
3329
+ {
3330
+ // PAL features are prerotated, so extent also needs to be unrotated
3331
+ lyr.extentGeom ->rotate ( -mMapSettings ->rotation (), mMapSettings ->visibleExtent ().center () );
3332
+ }
3328
3333
3329
3334
lyr.mFeatsSendingToPal = 0 ;
3330
3335
@@ -3562,6 +3567,11 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&
3562
3567
// convert geom to geos
3563
3568
const QgsGeometry* geom = feat.constGeometry ();
3564
3569
QScopedPointer<QgsGeometry> extentGeom ( QgsGeometry::fromRect ( mMapSettings ->visibleExtent () ) );
3570
+ if ( !qgsDoubleNear ( mMapSettings ->rotation (), 0.0 ) )
3571
+ {
3572
+ // PAL features are prerotated, so extent also needs to be unrotated
3573
+ extentGeom->rotate ( -mMapSettings ->rotation (), mMapSettings ->visibleExtent ().center () );
3574
+ }
3565
3575
3566
3576
const GEOSGeometry* geos_geom = 0 ;
3567
3577
QScopedPointer<QgsGeometry> preparedGeom;
@@ -4036,7 +4046,16 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
4036
4046
{
4037
4047
Q_ASSERT ( mMapSettings != NULL );
4038
4048
QPainter* painter = context.painter ();
4039
- QgsRectangle extent = context.extent ();
4049
+
4050
+ QgsGeometry* extentGeom ( QgsGeometry::fromRect ( mMapSettings ->visibleExtent () ) );
4051
+ if ( !qgsDoubleNear ( mMapSettings ->rotation (), 0.0 ) )
4052
+ {
4053
+ // PAL features are prerotated, so extent also needs to be unrotated
4054
+ extentGeom->rotate ( -mMapSettings ->rotation (), mMapSettings ->visibleExtent ().center () );
4055
+ }
4056
+
4057
+ QgsRectangle extent = extentGeom->boundingBox ();
4058
+ delete extentGeom;
4040
4059
4041
4060
mPal ->registerCancellationCallback ( &_palIsCancelled, &context );
4042
4061
@@ -4048,8 +4067,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
4048
4067
4049
4068
// do the labeling itself
4050
4069
double scale = mMapSettings ->scale (); // scale denominator
4051
- QgsRectangle r = extent;
4052
- double bbox[] = { r.xMinimum (), r.yMinimum (), r.xMaximum (), r.yMaximum () };
4070
+ double bbox[] = { extent.xMinimum (), extent.yMinimum (), extent.xMaximum (), extent.yMaximum () };
4053
4071
4054
4072
std::list<LabelPosition*>* labels;
4055
4073
pal::Problem* problem;
0 commit comments