Skip to content

Commit

Permalink
Huge speedup when labels are set to "boundary" obstacle mode
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
nyalldawson committed Dec 4, 2019
1 parent 4268504 commit b736bf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/pal/labelposition.cpp
Expand Up @@ -558,8 +558,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 b736bf9

Please sign in to comment.