QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
A convenience class for writing vector files to disk. More...
#include <qgsvectorlayerimport.h>
Public Member Functions | |
QgsVectorLayerImport (const QString &uri, const QString &provider, const QgsFields &fields, QGis::WkbType geometryType, const QgsCoordinateReferenceSystem *crs, bool overwrite=false, const QMap< QString, QVariant > *options=nullptr, QProgressDialog *progress=nullptr) | |
Create a empty layer and add fields to it. More... | |
~QgsVectorLayerImport () | |
Close the new created layer. More... | |
bool | addFeature (QgsFeature &feature) |
Add feature to the new created layer. More... | |
int | errorCount () const |
QString | errorMessage () |
Retrieves error message. More... | |
ImportError | hasError () |
Checks whether there were any errors. More... | |
Static Public Member Functions | |
static ImportError | importLayer (QgsVectorLayer *layer, const QString &uri, const QString &providerKey, const QgsCoordinateReferenceSystem *destCRS, bool onlySelected=false, QString *errorMessage=nullptr, bool skipAttributeCreation=false, QMap< QString, QVariant > *options=nullptr, QProgressDialog *progress=nullptr) |
Write contents of vector layer to a different datasource. More... | |
Protected Member Functions | |
bool | createSpatialIndex () |
Create index. More... | |
bool | flushBuffer () |
Flush the buffer writing the features to the new layer. More... | |
Protected Attributes | |
int | mAttributeCount |
ImportError | mError |
Contains error value. More... | |
int | mErrorCount |
QString | mErrorMessage |
QgsFeatureList | mFeatureBuffer |
QMap< int, int > | mOldToNewAttrIdx |
Map attribute indexes to new field indexes. More... | |
QProgressDialog * | mProgress |
QgsVectorDataProvider * | mProvider |
A convenience class for writing vector files to disk.
There are two possibilities how to use this class:
Definition at line 33 of file qgsvectorlayerimport.h.
Definition at line 37 of file qgsvectorlayerimport.h.
QgsVectorLayerImport::QgsVectorLayerImport | ( | const QString & | uri, |
const QString & | provider, | ||
const QgsFields & | fields, | ||
QGis::WkbType | geometryType, | ||
const QgsCoordinateReferenceSystem * | crs, | ||
bool | overwrite = false , |
||
const QMap< QString, QVariant > * | options = nullptr , |
||
QProgressDialog * | progress = nullptr |
||
) |
Create a empty layer and add fields to it.
Definition at line 45 of file qgsvectorlayerimport.cpp.
QgsVectorLayerImport::~QgsVectorLayerImport | ( | ) |
Close the new created layer.
Definition at line 129 of file qgsvectorlayerimport.cpp.
bool QgsVectorLayerImport::addFeature | ( | QgsFeature & | feature | ) |
Add feature to the new created layer.
Definition at line 147 of file qgsvectorlayerimport.cpp.
|
protected |
Create index.
Definition at line 206 of file qgsvectorlayerimport.cpp.
|
inline |
Definition at line 83 of file qgsvectorlayerimport.h.
QString QgsVectorLayerImport::errorMessage | ( | ) |
Retrieves error message.
Definition at line 142 of file qgsvectorlayerimport.cpp.
|
protected |
Flush the buffer writing the features to the new layer.
Definition at line 179 of file qgsvectorlayerimport.cpp.
QgsVectorLayerImport::ImportError QgsVectorLayerImport::hasError | ( | ) |
Checks whether there were any errors.
Definition at line 137 of file qgsvectorlayerimport.cpp.
|
static |
Write contents of vector layer to a different datasource.
Definition at line 219 of file qgsvectorlayerimport.cpp.
|
protected |
Definition at line 108 of file qgsvectorlayerimport.h.
|
protected |
Contains error value.
Definition at line 99 of file qgsvectorlayerimport.h.
|
protected |
Definition at line 102 of file qgsvectorlayerimport.h.
|
protected |
Definition at line 100 of file qgsvectorlayerimport.h.
|
protected |
Definition at line 110 of file qgsvectorlayerimport.h.
|
protected |
Map attribute indexes to new field indexes.
Definition at line 107 of file qgsvectorlayerimport.h.
|
protected |
Definition at line 111 of file qgsvectorlayerimport.h.
|
protected |
Definition at line 104 of file qgsvectorlayerimport.h.