Skip to content
Permalink
Browse files

[ogr] Fix combination of filterrect and filterfids ignores filterrect…

… check
  • Loading branch information
nyalldawson committed Jun 3, 2018
1 parent 4ddf58c commit 0af5fb9d02df8d1713984004512b3631f1c69c33
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/providers/ogr/qgsogrfeatureiterator.cpp
@@ -227,7 +227,8 @@ bool QgsOgrFeatureIterator::fetchFeatureWithId( QgsFeatureId id, QgsFeature &fea
return false;
}

readFeature( std::move( fet ), feature );
if ( !readFeature( std::move( fet ), feature ) )
return false;

feature.setValid( true );
geometryToDestinationCrs( feature, mTransform );
@@ -367,7 +368,7 @@ bool QgsOgrFeatureIterator::readFeature( gdal::ogr_feature_unique_ptr fet, QgsFe
feature.initAttributes( mSource->mFields.count() );
feature.setFields( mSource->mFields ); // allow name-based attribute lookups

bool useIntersect = !mRequest.filterRect().isNull() && mRequest.flags() & QgsFeatureRequest::ExactIntersect;
bool useIntersect = !mRequest.filterRect().isNull();
bool geometryTypeFilter = mSource->mOgrGeometryTypeFilter != wkbUnknown;
if ( mFetchGeometry || useIntersect || geometryTypeFilter )
{
@@ -393,7 +394,11 @@ bool QgsOgrFeatureIterator::readFeature( gdal::ogr_feature_unique_ptr fet, QgsFe
{
// OK
}
else if ( ( useIntersect && ( !feature.hasGeometry() || !feature.geometry().intersects( mFilterRect ) ) )
else if ( ( useIntersect && ( !feature.hasGeometry()
|| ( mRequest.flags() & QgsFeatureRequest::ExactIntersect && !feature.geometry().intersects( mFilterRect ) )
|| ( !( mRequest.flags() & QgsFeatureRequest::ExactIntersect ) && !feature.geometry().boundingBoxIntersects( mFilterRect ) )
)
)
|| ( geometryTypeFilter && ( !feature.hasGeometry() || QgsOgrProvider::ogrWkbSingleFlatten( ( OGRwkbGeometryType )feature.geometry().wkbType() ) != mSource->mOgrGeometryTypeFilter ) ) )
{
return false;

0 comments on commit 0af5fb9

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