Skip to content
Permalink
Browse files

Merge pull request #8852 from mhugo/fix_index_extent

IndexExtent fix
  • Loading branch information
Hugo Mercier
Hugo Mercier committed Jan 18, 2019
2 parents eb256e9 + 6342968 commit cd1f3162c6ba39de8d2f1191d786b90399e8f1ce
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/core/qgssnappingutils.cpp
@@ -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 )
@@ -370,7 +373,7 @@ void QgsSnappingUtils::prepareIndex( const QList<LayerAndAreaOfInterest> &layers

if ( mStrategy == IndexExtent )
{
QgsRectangle rect( mMapSettings.extent() );
QgsRectangle rect( mMapSettings.visibleExtent() );
loc->setExtent( &rect );
loc->init();
}

0 comments on commit cd1f316

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