Skip to content
Permalink
Browse files

Merge pull request #39961 from m-kuhn/geometry_validation_gap_perform…

…ance

Distance is much faster than finding the shared edge length
  • Loading branch information
m-kuhn committed Nov 11, 2020
2 parents f360838 + 0ad8ff6 commit 1bfbc7671ccebeca423205ee8183ea123b3176d8
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 1bfbc76

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