mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
QgsVectorDataProvider is a QgsFeatureSink
This commit is contained in:
parent
363336394e
commit
7ae71ded57
@ -28,6 +28,7 @@ class QgsFeatureSink
|
||||
%Docstring
|
||||
Adds a single ``feature`` to the sink.
|
||||
\see addFeatures()
|
||||
:return: true in case of success and false in case of failure
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
@ -35,6 +36,7 @@ class QgsFeatureSink
|
||||
%Docstring
|
||||
Adds a list of ``features`` to the sink.
|
||||
\see addFeature()
|
||||
:return: true in case of success and false in case of failure
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
class QgsVectorDataProvider : QgsDataProvider
|
||||
class QgsVectorDataProvider : QgsDataProvider, QgsFeatureSink
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsvectordataprovider.h>
|
||||
@ -197,10 +197,7 @@ class QgsVectorDataProvider : QgsDataProvider
|
||||
*/
|
||||
virtual void enumValues( int index, QStringList& enumList /Out/ ) const;
|
||||
|
||||
/**
|
||||
* Adds a list of features
|
||||
* @return true in case of success and false in case of failure
|
||||
*/
|
||||
virtual bool addFeature( QgsFeature &feature /In,Out/ );
|
||||
virtual bool addFeatures( QList<QgsFeature> &flist /In,Out/ );
|
||||
|
||||
/**
|
||||
|
@ -38,12 +38,14 @@ class CORE_EXPORT QgsFeatureSink
|
||||
/**
|
||||
* Adds a single \a feature to the sink.
|
||||
* \see addFeatures()
|
||||
* \returns true in case of success and false in case of failure
|
||||
*/
|
||||
virtual bool addFeature( QgsFeature &feature ) = 0;
|
||||
|
||||
/**
|
||||
* Adds a list of \a features to the sink.
|
||||
* \see addFeature()
|
||||
* \returns true in case of success and false in case of failure
|
||||
*/
|
||||
virtual bool addFeatures( QgsFeatureList &features ) = 0;
|
||||
|
||||
|
@ -495,6 +495,11 @@ QVariant QgsVectorDataProvider::aggregate( QgsAggregateCalculator::Aggregate agg
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool QgsVectorDataProvider::addFeature( QgsFeature &feature )
|
||||
{
|
||||
return addFeatures( QgsFeatureList() << feature );
|
||||
}
|
||||
|
||||
void QgsVectorDataProvider::clearMinMaxCache()
|
||||
{
|
||||
mCacheMinMaxDirty = true;
|
||||
|
@ -30,6 +30,7 @@ class QTextCodec;
|
||||
#include "qgsaggregatecalculator.h"
|
||||
#include "qgsmaplayerdependency.h"
|
||||
#include "qgsrelation.h"
|
||||
#include "qgsfeaturesink.h"
|
||||
|
||||
typedef QList<int> QgsAttributeList;
|
||||
typedef QSet<int> QgsAttributeIds;
|
||||
@ -49,7 +50,7 @@ class QgsFeedback;
|
||||
*
|
||||
*
|
||||
*/
|
||||
class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
|
||||
class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeatureSink
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -247,11 +248,8 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
|
||||
*/
|
||||
virtual void enumValues( int index, QStringList &enumList ) const { Q_UNUSED( index ); enumList.clear(); }
|
||||
|
||||
/**
|
||||
* Adds a list of features
|
||||
* \returns true in case of success and false in case of failure
|
||||
*/
|
||||
virtual bool addFeatures( QgsFeatureList &flist );
|
||||
virtual bool addFeature( QgsFeature &feature ) override;
|
||||
virtual bool addFeatures( QgsFeatureList &flist ) override;
|
||||
|
||||
/**
|
||||
* Deletes one or more features from the provider. This requires the DeleteFeatures capability.
|
||||
|
Loading…
x
Reference in New Issue
Block a user