An interface for objects which accept features via addFeature(s) methods.
More...
#include <qgsfeaturesink.h>
|
virtual | ~QgsFeatureSink ()=default |
|
virtual bool | addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) |
| Adds a single feature to the sink. More...
|
|
virtual bool | addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) |
| Adds all features from the specified iterator to the sink. More...
|
|
virtual bool | addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0 |
| Adds a list of features to the sink. More...
|
|
virtual bool | flushBuffer () |
| Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. More...
|
|
virtual QString | lastError () const |
| Returns the most recent error encountered by the sink, e.g. More...
|
|
An interface for objects which accept features via addFeature(s) methods.
- Since
- QGIS 3.0
Definition at line 33 of file qgsfeaturesink.h.
◆ Flag
Flags controlling how features are added to a sink.
Enumerator |
---|
FastInsert | Use faster inserts, at the cost of updating the passed features to reflect changes made at the provider.
This includes skipping the update of the passed feature IDs to match the resulting feature IDs for the feature within the data provider. Individual sink subclasses may or may not choose to respect this flag, depending on whether or not skipping this update represents a significant speed boost for the operation.
|
RollBackOnErrors | Roll back the whole transaction if a single add feature operation fails.
Individual sink subclasses may choose to ignore this flag and always roll back while other providers will respect the flag and accept partial additions if this flag is not set.
|
Definition at line 60 of file qgsfeaturesink.h.
◆ SinkFlag
Flags that can be set on a QgsFeatureSink.
Not all sinks may implement all flags.
- Since
- QGIS 3.4
Enumerator |
---|
RegeneratePrimaryKey | This flag indicates, that a primary key field cannot be guaranteed to be unique and the sink should ignore it if somehow possible.
This should for example be set for a geopackage file if the field "fid" has a risk to contain duplicate entries. In this case sinks like QgsVectorFileWriter or QgsVectorLayerExporter will prefer to regenerate the fid instead of trying to reuse the fids provided in addFeature calls.
- Since
- QGIS 3.4
|
Definition at line 42 of file qgsfeaturesink.h.
◆ ~QgsFeatureSink()
virtual QgsFeatureSink::~QgsFeatureSink |
( |
| ) |
|
|
virtualdefault |
◆ addFeature()
bool QgsFeatureSink::addFeature |
( |
QgsFeature & |
feature, |
|
|
QgsFeatureSink::Flags |
flags = QgsFeatureSink::Flags() |
|
) |
| |
|
virtual |
◆ addFeatures() [1/2]
bool QgsFeatureSink::addFeatures |
( |
QgsFeatureIterator & |
iterator, |
|
|
QgsFeatureSink::Flags |
flags = QgsFeatureSink::Flags() |
|
) |
| |
|
virtual |
◆ addFeatures() [2/2]
virtual bool QgsFeatureSink::addFeatures |
( |
QgsFeatureList & |
features, |
|
|
QgsFeatureSink::Flags |
flags = QgsFeatureSink::Flags() |
|
) |
| |
|
pure virtual |
Adds a list of features to the sink.
Feature addition behavior is controlled by the specified flags.
- See also
- addFeature()
- Returns
true
in case of success and false
in case of failure
Implemented in QgsVectorLayer, QgsVectorDataProviderFeaturePool, QgsVectorLayerFeaturePool, QgsProcessingFeatureSink, QgsFeatureStore, QgsProxyFeatureSink, QgsRemappingProxyFeatureSink, QgsSpatialIndex, QgsVectorFileWriter, QgsVectorLayerExporter, QgsVectorLayerJoinBuffer, and QgsVectorDataProvider.
◆ flushBuffer()
virtual bool QgsFeatureSink::flushBuffer |
( |
| ) |
|
|
inlinevirtual |
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.
- Returns
false
if any buffered features could not be added to the sink.
Reimplemented in QgsVectorLayerExporter.
Definition at line 108 of file qgsfeaturesink.h.
◆ lastError()
virtual QString QgsFeatureSink::lastError |
( |
| ) |
const |
|
inlinevirtual |
The documentation for this class was generated from the following files: