Skip to content
Permalink
Browse files
Sipify QgsVectorLayerImport
  • Loading branch information
nyalldawson committed May 6, 2017
1 parent 46ff652 commit 83baf9eae67340090de602469d2b66025293b828
Showing with 98 additions and 49 deletions.
  1. +0 −1 python/auto_sip.blacklist
  2. +92 −48 python/core/qgsvectorlayerimport.sip
  3. +6 −0 src/core/qgsvectorlayerimport.h
@@ -84,7 +84,6 @@ core/qgsvectorfilewritertask.sip
core/qgsvectorlayercache.sip
core/qgsvectorlayereditbuffer.sip
core/qgsvectorlayereditpassthrough.sip
core/qgsvectorlayerimport.sip
core/qgsvectorlayerjoinbuffer.sip
core/qgsvectorlayerjoininfo.sip
core/qgsvectorlayertools.sip
@@ -1,17 +1,27 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvectorlayerimport.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





/**
There are two possibilities how to use this class:
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves the whole vector layer
2. create an instance of the class and issue calls to addFeature(...)
*/
class QgsVectorLayerImport : QgsFeatureSink
{
%TypeHeaderCode
#include <qgsvectorlayerimport.h>
#include <qgsfield.h>
class QProgressDialog;
%Docstring
A convenience class for writing vector files to disk.
There are two possibilities how to use this class:
1. static call to QgsVectorFileWriter.writeAsShapefile(...) which saves the whole vector layer
2. create an instance of the class and issue calls to addFeature(...)
%End

%TypeHeaderCode
#include "qgsvectorlayerimport.h"
%End
public:

enum ImportError
@@ -28,77 +38,111 @@ class QProgressDialog;
ErrInvalidProvider,
ErrProviderUnsupportedFeature,
ErrConnectionFailed,
ErrUserCanceled, /*!< User canceled the import*/
ErrUserCanceled,
};

/**
* Writes the contents of vector layer to a different datasource.
* @param layer source layer
* @param uri URI for destination data source
* @param providerKey string key for destination data provider
* @param destCRS destination CRS, or an invalid (default constructed) CRS if
* not available
* @param onlySelected set to true to export only selected features
* @param errorMessage if non-null, will be set to any error messages
* @param skipAttributeCreation set to true to skip exporting feature attributes
* @param options optional provider dataset options
* @param progress optional progress dialog to show progress of export
* @returns NoError for a successful export, or encountered error
*/
static ImportError importLayer( QgsVectorLayer* layer,
const QString& uri,
const QString& providerKey,
const QgsCoordinateReferenceSystem& destCRS,
static ImportError importLayer( QgsVectorLayer *layer,
const QString &uri,
const QString &providerKey,
const QgsCoordinateReferenceSystem &destCRS,
bool onlySelected = false,
QString *errorMessage /Out/ = 0,
bool skipAttributeCreation = false,
QMap<QString, QVariant> *options = 0,
QProgressDialog *progress = 0
);
%Docstring
Writes the contents of vector layer to a different datasource.
\param layer source layer
\param uri URI for destination data source
\param providerKey string key for destination data provider
\param destCRS destination CRS, or an invalid (default constructed) CRS if
not available
\param onlySelected set to true to export only selected features
\param errorMessage if non-null, will be set to any error messages
\param skipAttributeCreation set to true to skip exporting feature attributes
\param options optional provider dataset options
\param progress optional progress dialog to show progress of export
:return: NoError for a successful export, or encountered error
:rtype: ImportError
%End

/** Constructor for QgsVectorLayerImport.
* @param uri URI for destination data source
* @param provider string key for destination data provider
* @param fields fields to include in created layer
* @param geometryType destination geometry type
* @param crs desired CRS, or an invalid (default constructed) CRS if
* not available
* @param overwrite set to true to overwrite any existing data source
* @param options optional provider dataset options
* @param progress optional progress dialog to show progress of export
*/
QgsVectorLayerImport( const QString &uri,
const QString &provider,
const QgsFields &fields,
QgsWkbTypes::Type geometryType,
const QgsCoordinateReferenceSystem& crs,
const QgsCoordinateReferenceSystem &crs,
bool overwrite = false,
const QMap<QString, QVariant> *options = 0,
QProgressDialog *progress = 0
);
%Docstring
Constructor for QgsVectorLayerImport.
\param uri URI for destination data source
\param provider string key for destination data provider
\param fields fields to include in created layer
\param geometryType destination geometry type
\param crs desired CRS, or an invalid (default constructed) CRS if
not available
\param overwrite set to true to overwrite any existing data source
\param options optional provider dataset options
\param progress optional progress dialog to show progress of export
%End


/** Checks whether there were any errors */
ImportError hasError();
%Docstring
Checks whether there were any errors
:rtype: ImportError
%End

/** Retrieves error message */
QString errorMessage();
%Docstring
Retrieves error message
:rtype: str
%End

int errorCount() const;
%Docstring
:rtype: int
%End

virtual bool addFeatures( QgsFeatureList &features );

virtual bool addFeature( QgsFeature &feature );

bool addFeatures( QgsFeatureList &features );
bool addFeature( QgsFeature &feature );

/** Close the new created layer */
~QgsVectorLayerImport();
%Docstring
Close the new created layer
%End

protected:
/** Flush the buffer writing the features to the new layer */
bool flushBuffer();
%Docstring
Flush the buffer writing the features to the new layer
:rtype: bool
%End

/** Create index */
bool createSpatialIndex();
%Docstring
Create index
:rtype: bool
%End

private:





private:
QgsVectorLayerImport( const QgsVectorLayerImport &rh );
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvectorlayerimport.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -143,6 +143,12 @@ class CORE_EXPORT QgsVectorLayerImport : public QgsFeatureSink
QgsFeatureList mFeatureBuffer;
QProgressDialog *mProgress = nullptr;

private:

#ifdef SIP_RUN
QgsVectorLayerImport( const QgsVectorLayerImport &rh );
#endif

};

#endif

0 comments on commit 83baf9e

Please sign in to comment.