18#ifndef QGSVECTORLAYEREXPORTER_H
19#define QGSVECTORLAYEREXPORTER_H
68 const QString &providerKey,
70 bool onlySelected =
false,
71 QString *errorMessage
SIP_OUT =
nullptr,
72 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
88 const QString &provider,
92 bool overwrite =
false,
93 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
94 QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags() );
113 QString errorMessage()
const;
127 Qgis::VectorDataProviderAttributeEditCapabilities attributeEditCapabilities()
const;
130 bool addFeature(
QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
143 bool createSpatialIndex();
147 QString mErrorMessage;
154 QMap<int, int> mOldToNewAttrIdx;
158 int mFeatureBufferMemoryUsage = 0;
160 bool mCreateSpatialIndex =
true;
192 const QString &providerKey,
194 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
195 bool ownsLayer =
false );
205 const QString &providerKey,
207 const QMap<QString, QVariant> &options = QMap<QString, QVariant>() )
SIP_FACTORY;
209 void cancel()
override;
227 void finished(
bool result )
override;
231 QPointer< QgsVectorLayer > mLayer =
nullptr;
232 bool mOwnsLayer =
false;
235 QString mDestProviderKey;
237 QMap<QString, QVariant> mOptions;
239 std::unique_ptr< QgsFeedback > mOwnedFeedback;
242 QString mErrorMessage;
VectorExportResult
Vector layer export result codes.
@ Success
No errors were encountered.
WkbType
The WKB type describes the number of dimensions a geometry has.
This class represents a coordinate reference system (CRS).
An interface for objects which accept features via addFeature(s) methods.
virtual bool flushBuffer()
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to...
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Container of fields for a vector layer.
Abstract base class for long running background tasks.
This is the base class for vector data providers.
QgsTask task which performs a QgsVectorLayerExporter layer export operation as a background task.
void exportComplete()
Emitted when exporting the layer is successfully completed.
void errorOccurred(Qgis::VectorExportResult error, const QString &errorMessage)
Emitted when an error occurs which prevented the layer being exported (or if the task is canceled).
A convenience class for exporting vector layers to a destination data provider.
QgsVectorLayerExporter & operator=(const QgsVectorLayerExporter &rh)=delete
QgsVectorLayerExporter cannot be copied.
int errorCount() const
Returns the number of error messages encountered during the export.
QgsVectorLayerExporter(const QgsVectorLayerExporter &rh)=delete
QgsVectorLayerExporter cannot be copied.
Represents a vector layer which manages a vector based data sets.
QList< QgsFeature > QgsFeatureList
const QgsCoordinateReferenceSystem & crs