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>(),
91 , expression( expression )
194 void setFilterExpression(
const QString &expression );
208 QString filterExpression()
const;
233 QList<QgsVectorLayerExporter::OutputField> outputFields()
const;
244 void setOutputFields(
const QList<QgsVectorLayerExporter::OutputField> &fields );
248 bool mSelectedOnly =
false;
256 QString mFilterExpression;
259 QList< QgsVectorLayerExporter::OutputField > mOutputFields;
279 const QString &providerKey,
281 QString *errorMessage
SIP_OUT =
nullptr,
282 const QMap<QString, QVariant> &providerOptions = QMap<QString, QVariant>(),
298 const QString &provider,
302 bool overwrite =
false,
303 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
321 QString errorMessage()
const;
351 bool createSpatialIndex();
355 QString mErrorMessage;
362 QMap<int, int> mOldToNewAttrIdx;
366 int mFeatureBufferMemoryUsage = 0;
368 bool mCreateSpatialIndex =
true;
400 const QString &providerKey,
402 const QMap<QString, QVariant> &options = QMap<QString, QVariant>(),
403 bool ownsLayer =
false );
416 const QString &providerKey,
418 const QMap<QString, QVariant> &providerOptions = QMap<QString, QVariant>(),
419 bool ownsLayer =
false );
429 const QString &providerKey,
431 const QMap<QString, QVariant> &options = QMap<QString, QVariant>() )
SIP_FACTORY;
433 void cancel()
override;
451 void finished(
bool result )
override;
455 QPointer< QgsVectorLayer > mLayer =
nullptr;
456 bool mOwnsLayer =
false;
459 QString mDestProviderKey;
461 QMap<QString, QVariant> mOptions;
463 std::unique_ptr< QgsFeedback > mOwnedFeedback;
466 QString mErrorMessage;
VectorExportResult
Vector layer export result codes.
@ Success
No errors were encountered.
QFlags< VectorDataProviderAttributeEditCapability > VectorDataProviderAttributeEditCapabilities
Attribute editing capabilities which may be supported by vector data providers.
WkbType
The WKB type describes the number of dimensions a geometry has.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
An interface for objects which accept features via addFeature(s) methods.
QFlags< SinkFlag > SinkFlags
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.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
A QgsRectangle with associated coordinate reference system.
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).
Encapsulates options for use with QgsVectorLayerExporter.
void setSelectedOnly(bool selected)
Sets whether the export should only include selected features.
bool selectedOnly() const
Returns whether the export will only include selected features.
A convenience class for exporting vector layers to a destination data provider.
QgsVectorLayerExporter & operator=(const QgsVectorLayerExporter &rh)=delete
int errorCount() const
Returns the number of error messages encountered during the export.
QgsVectorLayerExporter(const QgsVectorLayerExporter &rh)=delete
Represents a vector layer which manages a vector based data sets.
QList< QgsFeature > QgsFeatureList
const QgsCoordinateReferenceSystem & crs
Encapsulates output field definition.
QString expression
The expression for the exported field from the source fields.
OutputField(const QgsField &field, const QString &expression)
Constructor for OutputField, with the specified field definition and source expression.
QgsField field
Destination field definition.