Skip to content

Commit

Permalink
Merge pull request #8901 from mhugo/release-3_4
Browse files Browse the repository at this point in the history
IndexExtent fix
  • Loading branch information
Hugo Mercier authored Jan 18, 2019
2 parents 355820a + adb5998 commit 2797f3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/vertextool/qgsvertextool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ QgsGeometry QgsVertexTool::cachedGeometry( const QgsVectorLayer *layer, QgsFeatu
{
const bool layerWasNotInCache = !mCache.contains( layer );
// insert if it was not in cache
QHash<QgsFeatureId, QgsGeometry>& layerCache = mCache[layer];
QHash<QgsFeatureId, QgsGeometry> &layerCache = mCache[layer];
if ( layerWasNotInCache )
{
connect( layer, &QgsVectorLayer::geometryChanged, this, &QgsVertexTool::onCachedGeometryChanged );
Expand Down
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 2797f3a

Please sign in to comment.