Skip to content

Commit

Permalink
Micro-optimisation: don't call geos for checking point geometry validity
Browse files Browse the repository at this point in the history
Since a single-point will always be valid
  • Loading branch information
nyalldawson committed Sep 24, 2018
1 parent 93f83a0 commit f380577
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -2365,6 +2365,12 @@ bool QgsGeometry::isGeosValid() const
return false;
}

// avoid calling geos for trivial point geometries
if ( QgsWkbTypes::flatType( d->geometry->wkbType() ) == QgsWkbTypes::Point )
{
return true;
}

QgsGeos geos( d->geometry.get() );
mLastError.clear();
return geos.isValid( &mLastError );
Expand Down

0 comments on commit f380577

Please sign in to comment.