Skip to content
Permalink
Browse files

Distance is much faster than finding the shared edge length

  • Loading branch information
github-actions authored and nyalldawson committed Nov 12, 2020
1 parent 90ea88c commit 9e55f5e991b61c63eb4d22b6c3c5860db624b059
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp
@@ -166,13 +166,15 @@ void QgsGeometryGapCheck::collectErrors( const QMap<QString, QgsFeaturePool *> &
// Get neighboring polygons
QMap<QString, QgsFeatureIds> neighboringIds;
const QgsGeometryCheckerUtils::LayerFeatures layerFeatures( featurePools, featureIds.keys(), gapAreaBBox, compatibleGeometryTypes(), mContext );
std::unique_ptr< QgsGeometryEngine > gapGeomEngine = QgsGeometryCheckerUtils::createGeomEngine( gapGeom, mContext->tolerance );
gapGeomEngine->prepareGeometry();
for ( const QgsGeometryCheckerUtils::LayerFeature &layerFeature : layerFeatures )
{
const QgsGeometry geom = layerFeature.geometry();
if ( QgsGeometryCheckerUtils::sharedEdgeLength( gapGeom, geom.constGet(), mContext->reducedTolerance ) > 0 )
if ( gapGeomEngine->distance( geom.constGet() ) < mContext->tolerance && QgsGeometryCheckerUtils::sharedEdgeLength( gapGeom, geom.constGet(), mContext->reducedTolerance ) > 0 )
{
neighboringIds[layerFeature.layer()->id()].insert( layerFeature.feature().id() );
gapAreaBBox.combineExtentWith( layerFeature.geometry().boundingBox() );
gapAreaBBox.combineExtentWith( geom.boundingBox() );
}
}

0 comments on commit 9e55f5e

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