Skip to content

Commit 83baf9e

Browse files
committed
Sipify QgsVectorLayerImport
1 parent 46ff652 commit 83baf9e

File tree

3 files changed

+98
-49
lines changed

3 files changed

+98
-49
lines changed

python/auto_sip.blacklist

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ core/qgsvectorfilewritertask.sip
8484
core/qgsvectorlayercache.sip
8585
core/qgsvectorlayereditbuffer.sip
8686
core/qgsvectorlayereditpassthrough.sip
87-
core/qgsvectorlayerimport.sip
8887
core/qgsvectorlayerjoinbuffer.sip
8988
core/qgsvectorlayerjoininfo.sip
9089
core/qgsvectorlayertools.sip

python/core/qgsvectorlayerimport.sip

+92-48
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/qgsvectorlayerimport.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
112

2-
/**
3-
There are two possibilities how to use this class:
4-
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves the whole vector layer
5-
2. create an instance of the class and issue calls to addFeature(...)
6-
*/
713
class QgsVectorLayerImport : QgsFeatureSink
814
{
9-
%TypeHeaderCode
10-
#include <qgsvectorlayerimport.h>
11-
#include <qgsfield.h>
12-
class QProgressDialog;
15+
%Docstring
16+
A convenience class for writing vector files to disk.
17+
There are two possibilities how to use this class:
18+
1. static call to QgsVectorFileWriter.writeAsShapefile(...) which saves the whole vector layer
19+
2. create an instance of the class and issue calls to addFeature(...)
1320
%End
1421

22+
%TypeHeaderCode
23+
#include "qgsvectorlayerimport.h"
24+
%End
1525
public:
1626

1727
enum ImportError
@@ -28,77 +38,111 @@ class QProgressDialog;
2838
ErrInvalidProvider,
2939
ErrProviderUnsupportedFeature,
3040
ErrConnectionFailed,
31-
ErrUserCanceled, /*!< User canceled the import*/
41+
ErrUserCanceled,
3242
};
3343

34-
/**
35-
* Writes the contents of vector layer to a different datasource.
36-
* @param layer source layer
37-
* @param uri URI for destination data source
38-
* @param providerKey string key for destination data provider
39-
* @param destCRS destination CRS, or an invalid (default constructed) CRS if
40-
* not available
41-
* @param onlySelected set to true to export only selected features
42-
* @param errorMessage if non-null, will be set to any error messages
43-
* @param skipAttributeCreation set to true to skip exporting feature attributes
44-
* @param options optional provider dataset options
45-
* @param progress optional progress dialog to show progress of export
46-
* @returns NoError for a successful export, or encountered error
47-
*/
48-
static ImportError importLayer( QgsVectorLayer* layer,
49-
const QString& uri,
50-
const QString& providerKey,
51-
const QgsCoordinateReferenceSystem& destCRS,
44+
static ImportError importLayer( QgsVectorLayer *layer,
45+
const QString &uri,
46+
const QString &providerKey,
47+
const QgsCoordinateReferenceSystem &destCRS,
5248
bool onlySelected = false,
5349
QString *errorMessage /Out/ = 0,
5450
bool skipAttributeCreation = false,
5551
QMap<QString, QVariant> *options = 0,
5652
QProgressDialog *progress = 0
5753
);
54+
%Docstring
55+
Writes the contents of vector layer to a different datasource.
56+
\param layer source layer
57+
\param uri URI for destination data source
58+
\param providerKey string key for destination data provider
59+
\param destCRS destination CRS, or an invalid (default constructed) CRS if
60+
not available
61+
\param onlySelected set to true to export only selected features
62+
\param errorMessage if non-null, will be set to any error messages
63+
\param skipAttributeCreation set to true to skip exporting feature attributes
64+
\param options optional provider dataset options
65+
\param progress optional progress dialog to show progress of export
66+
:return: NoError for a successful export, or encountered error
67+
:rtype: ImportError
68+
%End
5869

59-
/** Constructor for QgsVectorLayerImport.
60-
* @param uri URI for destination data source
61-
* @param provider string key for destination data provider
62-
* @param fields fields to include in created layer
63-
* @param geometryType destination geometry type
64-
* @param crs desired CRS, or an invalid (default constructed) CRS if
65-
* not available
66-
* @param overwrite set to true to overwrite any existing data source
67-
* @param options optional provider dataset options
68-
* @param progress optional progress dialog to show progress of export
69-
*/
7070
QgsVectorLayerImport( const QString &uri,
7171
const QString &provider,
7272
const QgsFields &fields,
7373
QgsWkbTypes::Type geometryType,
74-
const QgsCoordinateReferenceSystem& crs,
74+
const QgsCoordinateReferenceSystem &crs,
7575
bool overwrite = false,
7676
const QMap<QString, QVariant> *options = 0,
7777
QProgressDialog *progress = 0
7878
);
79+
%Docstring
80+
Constructor for QgsVectorLayerImport.
81+
\param uri URI for destination data source
82+
\param provider string key for destination data provider
83+
\param fields fields to include in created layer
84+
\param geometryType destination geometry type
85+
\param crs desired CRS, or an invalid (default constructed) CRS if
86+
not available
87+
\param overwrite set to true to overwrite any existing data source
88+
\param options optional provider dataset options
89+
\param progress optional progress dialog to show progress of export
90+
%End
91+
7992

80-
/** Checks whether there were any errors */
8193
ImportError hasError();
94+
%Docstring
95+
Checks whether there were any errors
96+
:rtype: ImportError
97+
%End
8298

83-
/** Retrieves error message */
8499
QString errorMessage();
100+
%Docstring
101+
Retrieves error message
102+
:rtype: str
103+
%End
85104

86105
int errorCount() const;
106+
%Docstring
107+
:rtype: int
108+
%End
109+
110+
virtual bool addFeatures( QgsFeatureList &features );
111+
112+
virtual bool addFeature( QgsFeature &feature );
87113

88-
bool addFeatures( QgsFeatureList &features );
89-
bool addFeature( QgsFeature &feature );
90114

91-
/** Close the new created layer */
92115
~QgsVectorLayerImport();
116+
%Docstring
117+
Close the new created layer
118+
%End
93119

94120
protected:
95-
/** Flush the buffer writing the features to the new layer */
96121
bool flushBuffer();
122+
%Docstring
123+
Flush the buffer writing the features to the new layer
124+
:rtype: bool
125+
%End
97126

98-
/** Create index */
99127
bool createSpatialIndex();
128+
%Docstring
129+
Create index
130+
:rtype: bool
131+
%End
100132

101-
private:
102133

134+
135+
136+
137+
138+
private:
103139
QgsVectorLayerImport( const QgsVectorLayerImport &rh );
104140
};
141+
142+
/************************************************************************
143+
* This file has been generated automatically from *
144+
* *
145+
* src/core/qgsvectorlayerimport.h *
146+
* *
147+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
148+
************************************************************************/

src/core/qgsvectorlayerimport.h

+6
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ class CORE_EXPORT QgsVectorLayerImport : public QgsFeatureSink
143143
QgsFeatureList mFeatureBuffer;
144144
QProgressDialog *mProgress = nullptr;
145145

146+
private:
147+
148+
#ifdef SIP_RUN
149+
QgsVectorLayerImport( const QgsVectorLayerImport &rh );
150+
#endif
151+
146152
};
147153

148154
#endif

0 commit comments

Comments
 (0)