QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
An interface for objects which accept features via addFeature(s) methods. More...
#include <qgsfeaturesink.h>
Public Types | |
enum | Flag { FastInsert = 1 << 1 , RollBackOnErrors = 1 << 2 } |
Flags controlling how features are added to a sink. More... | |
typedef QFlags< Flag > | Flags |
enum | SinkFlag { RegeneratePrimaryKey = 1 << 1 } |
Flags that can be set on a QgsFeatureSink. More... | |
typedef QFlags< SinkFlag > | SinkFlags |
Public Member Functions | |
virtual | ~QgsFeatureSink ()=default |
virtual bool | addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) |
Adds a single feature to the sink. | |
virtual bool | addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) |
Adds all features from the specified iterator to the sink. | |
virtual bool | addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0 |
Adds a list of features to the sink. | |
virtual void | finalize () |
Finalizes the sink, flushing any buffered features to the destination. | |
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. | |
virtual QString | lastError () const |
Returns the most recent error encountered by the sink, e.g. | |
An interface for objects which accept features via addFeature(s) methods.
Definition at line 32 of file qgsfeaturesink.h.
typedef QFlags< Flag > QgsFeatureSink::Flags |
Definition at line 79 of file qgsfeaturesink.h.
typedef QFlags< SinkFlag > QgsFeatureSink::SinkFlags |
Definition at line 56 of file qgsfeaturesink.h.
enum QgsFeatureSink::Flag |
Flags controlling how features are added to a sink.
Definition at line 59 of file qgsfeaturesink.h.
Flags that can be set on a QgsFeatureSink.
Not all sinks may implement all flags.
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.
|
Definition at line 41 of file qgsfeaturesink.h.
|
virtualdefault |
|
virtual |
Adds a single feature to the sink.
Feature addition behavior is controlled by the specified flags.
true
in case of success and false
in case of failure Reimplemented in QgsVectorLayer, QgsVectorDataProviderFeaturePool, QgsVectorLayerFeaturePool, QgsProcessingFeatureSink, QgsFeatureStore, QgsProxyFeatureSink, QgsRemappingProxyFeatureSink, QgsSpatialIndex, QgsVectorFileWriter, and QgsVectorLayerExporter.
Definition at line 25 of file qgsfeaturesink.cpp.
|
virtual |
Adds all features from the specified iterator to the sink.
Feature addition behavior is controlled by the specified flags.
true
if all features were added successfully, or false
if any feature could not be added Reimplemented in QgsProcessingFeatureSink, QgsProxyFeatureSink, and QgsRemappingProxyFeatureSink.
Definition at line 39 of file qgsfeaturesink.cpp.
|
pure virtual |
Adds a list of features to the sink.
Feature addition behavior is controlled by the specified flags.
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.
|
virtual |
Finalizes the sink, flushing any buffered features to the destination.
Reimplemented in QgsProcessingFeatureSink, and QgsProxyFeatureSink.
Definition at line 20 of file qgsfeaturesink.cpp.
|
inlinevirtual |
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination.
false
if any buffered features could not be added to the sink. Reimplemented in QgsProxyFeatureSink, and QgsVectorLayerExporter.
Definition at line 114 of file qgsfeaturesink.h.
|
inlinevirtual |
Returns the most recent error encountered by the sink, e.g.
when a call to addFeatures() returns false
.
Reimplemented in QgsProxyFeatureSink, QgsRemappingProxyFeatureSink, QgsVectorFileWriter, QgsVectorDataProvider, and QgsVectorLayerExporter.
Definition at line 121 of file qgsfeaturesink.h.