Skip to content

Commit bd140a7

Browse files
committedMar 7, 2016
Merge pull request #2852 from ahuarte47/Labeling_CheckBoundingBoxes
[Improvement] Use BoundingBoxes in labeling
2 parents a89b510 + b07bbd0 commit bd140a7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
 

‎src/core/qgspallabeling.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3827,17 +3827,17 @@ bool QgsPalLabeling::geometryRequiresPreparation( const QgsGeometry* geometry, Q
38273827
if ( ct )
38283828
return true;
38293829

3830-
//requires fixing
3831-
if ( geometry->type() == QGis::Polygon && !geometry->isGeosValid() )
3832-
return true;
3833-
38343830
//requires rotation
38353831
const QgsMapToPixel& m2p = context.mapToPixel();
38363832
if ( !qgsDoubleNear( m2p.mapRotation(), 0 ) )
38373833
return true;
38383834

38393835
//requires clip
3840-
if ( clipGeometry && !clipGeometry->contains( geometry ) )
3836+
if ( clipGeometry && !clipGeometry->boundingBox().contains( geometry->boundingBox() ) )
3837+
return true;
3838+
3839+
//requires fixing
3840+
if ( geometry->type() == QGis::Polygon && !geometry->isGeosValid() )
38413841
return true;
38423842

38433843
return false;
@@ -3944,7 +3944,9 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, QgsRe
39443944
clonedGeometry.reset( geom );
39453945
}
39463946

3947-
if ( clipGeometry && !clipGeometry->contains( geom ) )
3947+
if ( clipGeometry &&
3948+
(( qgsDoubleNear( m2p.mapRotation(), 0 ) && !clipGeometry->boundingBox().contains( geom->boundingBox() ) )
3949+
|| ( !qgsDoubleNear( m2p.mapRotation(), 0 ) && !clipGeometry->contains( geom ) ) ) )
39483950
{
39493951
QgsGeometry* clipGeom = geom->intersection( clipGeometry ); // creates new geometry
39503952
if ( !clipGeom )

0 commit comments

Comments
 (0)