Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Small optimisation to QgsVectorLayerFeatureIterator::checkGeometryVal…
…idity, avoid checking geometry presence if not filtering for invalid geometries
  • Loading branch information
nyalldawson committed May 9, 2023
1 parent ab1e839 commit 1b4a59f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/vector/qgsvectorlayerfeatureiterator.cpp
Expand Up @@ -952,16 +952,16 @@ bool QgsVectorLayerFeatureIterator::postProcessFeature( QgsFeature &feature )

bool QgsVectorLayerFeatureIterator::checkGeometryValidity( const QgsFeature &feature )
{
if ( !feature.hasGeometry() )
return true;

switch ( mRequest.invalidGeometryCheck() )
{
case QgsFeatureRequest::GeometryNoCheck:
return true;

case QgsFeatureRequest::GeometrySkipInvalid:
{
if ( !feature.hasGeometry() )
return true;

if ( !feature.geometry().isGeosValid() )
{
QgsMessageLog::logMessage( QObject::tr( "Geometry error: One or more input features have invalid geometry." ), QString(), Qgis::MessageLevel::Critical );
Expand All @@ -975,6 +975,9 @@ bool QgsVectorLayerFeatureIterator::checkGeometryValidity( const QgsFeature &fea
}

case QgsFeatureRequest::GeometryAbortOnInvalid:
if ( !feature.hasGeometry() )
return true;

if ( !feature.geometry().isGeosValid() )
{
QgsMessageLog::logMessage( QObject::tr( "Geometry error: One or more input features have invalid geometry." ), QString(), Qgis::MessageLevel::Critical );
Expand Down

0 comments on commit 1b4a59f

Please sign in to comment.