Skip to content
Permalink
Browse files

Merge pull request #2852 from ahuarte47/Labeling_CheckBoundingBoxes

[Improvement] Use BoundingBoxes in labeling
  • Loading branch information
nyalldawson committed Mar 7, 2016
2 parents a89b510 + b07bbd0 commit bd140a75bb739d89e2c65cb86bc42cf314585f9c
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/core/qgspallabeling.cpp
@@ -3827,17 +3827,17 @@ bool QgsPalLabeling::geometryRequiresPreparation( const QgsGeometry* geometry, Q
if ( ct )
return true;

//requires fixing
if ( geometry->type() == QGis::Polygon && !geometry->isGeosValid() )
return true;

//requires rotation
const QgsMapToPixel& m2p = context.mapToPixel();
if ( !qgsDoubleNear( m2p.mapRotation(), 0 ) )
return true;

//requires clip
if ( clipGeometry && !clipGeometry->contains( geometry ) )
if ( clipGeometry && !clipGeometry->boundingBox().contains( geometry->boundingBox() ) )
return true;

//requires fixing
if ( geometry->type() == QGis::Polygon && !geometry->isGeosValid() )
return true;

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

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

0 comments on commit bd140a7

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