Skip to content
Permalink
Browse files

Distance is much faster than finding the shared edge length

Fixes a huge performance problem with gap checks
  • Loading branch information
m-kuhn committed Nov 11, 2020
1 parent 53380b8 commit d334f5aa7e53e31eabb6f209a648f74da0432dc5
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 )
{
neighboringIds[layerFeature.layer()->id()].insert( layerFeature.feature().id() );
gapAreaBBox.combineExtentWith( layerFeature.geometry().boundingBox() );
gapAreaBBox.combineExtentWith( geom.boundingBox() );
}
}

0 comments on commit d334f5a

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