Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Huge speedup when labels are set to "boundary" obstacle mode
Because GEOS prepared predicates are "stubbed out" for many relation types,
such as overlaps and touches, we can get a HUGE speedup by reworking
the obstacle boundary check to utilise an intersects and within check instead
(with the same results)

(cherry picked from commit b736bf9)
  • Loading branch information
nyalldawson authored and nirvn committed Dec 4, 2019
1 parent 413de47 commit 651ca30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/pal/labelposition.cpp
Expand Up @@ -551,8 +551,8 @@ bool LabelPosition::crossesBoundary( PointSet *polygon ) const
GEOSContextHandle_t geosctxt = QgsGeos::getGEOSHandler();
try
{
if ( GEOSPreparedOverlaps_r( geosctxt, polygon->preparedGeom(), mGeos ) == 1
|| GEOSPreparedTouches_r( geosctxt, polygon->preparedGeom(), mGeos ) == 1 )
if ( GEOSPreparedIntersects_r( geosctxt, polygon->preparedGeom(), mGeos ) == 1
&& GEOSPreparedContains_r( geosctxt, polygon->preparedGeom(), mGeos ) != 1 )
{
return true;
}
Expand Down

0 comments on commit 651ca30

Please sign in to comment.