18#ifndef QGSVECTORLAYEREXPORTER_H
19#define QGSVECTORLAYEREXPORTER_H
69 const QString &providerKey,
71 bool onlySelected =
false,
72 QString *errorMessage
SIP_OUT =
nullptr,
73 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
89 const QString &provider,
93 bool overwrite =
false,
94 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
95 QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags() );
114 QString errorMessage()
const;
128 Qgis::VectorDataProviderAttributeEditCapabilities attributeEditCapabilities()
const;
131 bool addFeature(
QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
144 bool createSpatialIndex();
148 QString mErrorMessage;
155 QMap<int, int> mOldToNewAttrIdx;
159 int mFeatureBufferMemoryUsage = 0;
161 bool mCreateSpatialIndex =
true;
194 const QString &providerKey,
196 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
197 bool ownsLayer =
false );
207 const QString &providerKey,
209 const QMap<QString, QVariant> &options = QMap<QString, QVariant>() )
SIP_FACTORY;
211 void cancel()
override;
229 void finished(
bool result )
override;
233 QPointer< QgsVectorLayer > mLayer =
nullptr;
234 bool mOwnsLayer =
false;
237 QString mDestProviderKey;
239 QMap<QString, QVariant> mOptions;
241 std::unique_ptr< QgsFeedback > mOwnedFeedback;
244 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