Skip to content
Permalink
Browse files

Micro-optimisation: don't call geos for checking point geometry validity

Since a single-point will always be valid
  • Loading branch information
nyalldawson committed Sep 24, 2018
1 parent 93f83a0 commit f380577a6c11f0f077becc46f523ed75ea6720bd
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/geometry/qgsgeometry.cpp
@@ -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 );

0 comments on commit f380577

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