Skip to content

Commit

Permalink
IndexExtent fix
Browse files Browse the repository at this point in the history
Backport from cd1f316
  • Loading branch information
Hugo Mercier committed Jan 18, 2019
1 parent f99a911 commit c5512a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/qgssnappingutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ bool QgsSnappingUtils::isIndexPrepared( QgsVectorLayer *vl, const QgsRectangle &
if ( mStrategy == IndexAlwaysFull && loc->hasIndex() )
return true;

if ( mStrategy == IndexExtent && loc->hasIndex() && loc->extent()->intersects( areaOfInterest ) )
return true;

QgsRectangle aoi( areaOfInterest );
aoi.scale( 0.999 );
return ( mStrategy == IndexHybrid || mStrategy == IndexExtent ) && loc->hasIndex() && ( !loc->extent() || loc->extent()->contains( aoi ) ); // the index - even if it exists - is not suitable
return mStrategy == IndexHybrid && loc->hasIndex() && ( !loc->extent() || loc->extent()->contains( aoi ) ); // the index - even if it exists - is not suitable
}

static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPointXY &pt, const QgsPointLocator::MatchList &segments )
Expand Down

0 comments on commit c5512a4

Please sign in to comment.