Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[geometry fixer] PR review
  • Loading branch information
olivierdalang committed Oct 16, 2020
1 parent c97e324 commit e79f9a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -389,7 +389,7 @@ bool QgsGeometryGapCheck::mergeWithNeighbor( const QMap<QString, QgsFeaturePool
while ( neighbourIterator.hasNext() )
{
QgsPoint neighbourPt = neighbourIterator.next();
double dist = pt.distance( neighbourPt );
double dist = pt.distanceSquared( neighbourPt );
if ( nearestDist == -1 || dist < nearestDist )
{
nearestDist = dist;
Expand Down
Expand Up @@ -154,7 +154,6 @@ void QgsGeometryOverlapCheck::fixError( const QMap<QString, QgsFeaturePool *> &f
else if ( method == Subtract )
{
std::unique_ptr< QgsGeometryEngine > geomEngineDiffA = QgsGeometryCheckerUtils::createGeomEngine( geometryA.constGet(), 0 );
geomEngineDiffA->prepareGeometry();
std::unique_ptr< QgsAbstractGeometry > diff1( geomEngineDiffA->difference( interPart, &errMsg ) );
if ( !diff1 || diff1->isEmpty() )
{
Expand All @@ -165,7 +164,6 @@ void QgsGeometryOverlapCheck::fixError( const QMap<QString, QgsFeaturePool *> &f
QgsGeometryCheckerUtils::filter1DTypes( diff1.get() );
}
std::unique_ptr< QgsGeometryEngine > geomEngineDiffB = QgsGeometryCheckerUtils::createGeomEngine( geometryB.constGet(), 0 );
geomEngineDiffB->prepareGeometry();
std::unique_ptr< QgsAbstractGeometry > diff2( geomEngineDiffB->difference( interPart, &errMsg ) );
if ( !diff2 || diff2->isEmpty() )
{
Expand Down
6 changes: 4 additions & 2 deletions tests/src/geometry_checker/testqgsgeometrychecks.cpp
Expand Up @@ -1245,9 +1245,11 @@ void TestQgsGeometryChecks::testOverlapCheckToleranceBug()
double areaOld = f.geometry().area();
QgsPoint pointOld_1 = f.geometry().vertexAt( 1 );
QgsPoint pointOld_2 = f.geometry().vertexAt( 2 );

// Just making sure we've got the right feature/point
QCOMPARE( areaOld, 10442.710061549426 );
QCOMPARE( pointOld_1, QgsPoint( 2537221.53079314017668366, 1152360.02460834058001637 ) );
QCOMPARE( pointOld_2, QgsPoint( 2537366.84566075634211302, 1152360.28978145681321621 ) );
QGSCOMPARENEARPOINT( pointOld_1, QgsPoint( 2537221.53079314017668366, 1152360.02460834058001637 ), 0.00001 );
QGSCOMPARENEARPOINT( pointOld_2, QgsPoint( 2537366.84566075634211302, 1152360.28978145681321621 ), 0.00001 );

QgsGeometryCheck::Changes changes;
QMap<QString, int> mergeAttrs;
Expand Down

0 comments on commit e79f9a9

Please sign in to comment.