Skip to content
Permalink
Browse files

Add minimal smartness for QgsProcessingFeatureSource::hasFeatures

  • Loading branch information
m-kuhn committed Jun 22, 2018
1 parent 715edb1 commit 1b15e68f647126bd169144826b527655438ea40e
@@ -260,6 +260,9 @@ An optional ``request`` can be used to optimise the returned
iterator, eg by restricting the returned attributes or geometry.
%End

virtual QgsFeatureSource::FeatureAvailability hasFeatures() const;


virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const;

virtual QgsCoordinateReferenceSystem sourceCrs() const;
@@ -721,6 +721,14 @@ QgsFeatureIterator QgsProcessingFeatureSource::getFeatures( const QgsFeatureRequ
return mSource->getFeatures( req );
}

QgsFeatureSource::FeatureAvailability QgsProcessingFeatureSource::hasFeatures() const
{
if ( !mTransformErrorCallback && !mInvalidGeometryCallback && mInvalidGeometryCheck == QgsFeatureRequest::GeometryNoCheck )
return mSource->hasFeatures();
else
return QgsFeatureSource::FeaturesMaybeAvailable;
}

QgsFeatureIterator QgsProcessingFeatureSource::getFeatures( const QgsFeatureRequest &request ) const
{
QgsFeatureRequest req( request );
@@ -317,6 +317,8 @@ class CORE_EXPORT QgsProcessingFeatureSource : public QgsFeatureSource
*/
QgsFeatureIterator getFeatures( const QgsFeatureRequest &request, Flags flags ) const;

QgsFeatureSource::FeatureAvailability hasFeatures() const override;

QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const override;
QgsCoordinateReferenceSystem sourceCrs() const override;
QgsFields fields() const override;

0 comments on commit 1b15e68

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