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;
124 bool addFeature(
QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
137 bool createSpatialIndex();
141 QString mErrorMessage;
148 QMap<int, int> mOldToNewAttrIdx;
152 int mFeatureBufferMemoryUsage = 0;
154 bool mCreateSpatialIndex =
true;
187 const QString &providerKey,
189 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
190 bool ownsLayer =
false );
200 const QString &providerKey,
202 const QMap<QString, QVariant> &options = QMap<QString, QVariant>() )
SIP_FACTORY;
204 void cancel()
override;
222 void finished(
bool result )
override;
226 QPointer< QgsVectorLayer > mLayer =
nullptr;
227 bool mOwnsLayer =
false;
230 QString mDestProviderKey;
232 QMap<QString, QVariant> mOptions;
234 std::unique_ptr< QgsFeedback > mOwnedFeedback;
237 QString mErrorMessage;
VectorExportResult
Vector layer export result codes.
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.
Type
The WKB type describes the number of dimensions a geometry has.
QList< QgsFeature > QgsFeatureList
const QgsCoordinateReferenceSystem & crs