Skip to content
Permalink
Browse files
Provide a base class version of QgsFeatureSink::addFeature
Means that subclasses are only required to implement addFeatures
  • Loading branch information
nyalldawson committed Apr 26, 2017
1 parent dd7be73 commit 3dfc4cf6fd5ed9406c2187aef14a59a949307ff5
@@ -24,7 +24,7 @@ class QgsFeatureSink

virtual ~QgsFeatureSink();

virtual bool addFeature( QgsFeature &feature ) = 0;
virtual bool addFeature( QgsFeature &feature );
%Docstring
Adds a single ``feature`` to the sink.
\see addFeatures()
@@ -197,7 +197,6 @@ class QgsVectorDataProvider : QgsDataProvider, QgsFeatureSink
*/
virtual void enumValues( int index, QStringList& enumList /Out/ ) const;

virtual bool addFeature( QgsFeature &feature /In,Out/ );
virtual bool addFeatures( QList<QgsFeature> &flist /In,Out/ );

/**
@@ -17,6 +17,17 @@

#include "qgsfeaturestore.h"

bool QgsFeatureSink::addFeature( QgsFeature &feature )
{
QgsFeatureList features;
features << feature;
bool result = addFeatures( features );

// need to update the passed feature reference to the updated copy from the features list
feature = features.at( 0 );
return result;
}

bool QgsFeatureSink::addFeatures( QgsFeatureIterator &iterator )
{
QgsFeature f;
@@ -41,7 +41,7 @@ class CORE_EXPORT QgsFeatureSink
* \see addFeatures()
* \returns true in case of success and false in case of failure
*/
virtual bool addFeature( QgsFeature &feature ) = 0;
virtual bool addFeature( QgsFeature &feature );

/**
* Adds a list of \a features to the sink.
@@ -495,11 +495,6 @@ QVariant QgsVectorDataProvider::aggregate( QgsAggregateCalculator::Aggregate agg
return QVariant();
}

bool QgsVectorDataProvider::addFeature( QgsFeature &feature )
{
return addFeatures( QgsFeatureList() << feature );
}

void QgsVectorDataProvider::clearMinMaxCache()
{
mCacheMinMaxDirty = true;
@@ -248,7 +248,6 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat
*/
virtual void enumValues( int index, QStringList &enumList ) const { Q_UNUSED( index ); enumList.clear(); }

virtual bool addFeature( QgsFeature &feature ) override;
virtual bool addFeatures( QgsFeatureList &flist ) override;

/**

0 comments on commit 3dfc4cf

Please sign in to comment.