Skip to content

Commit 7b08608

Browse files
committedMar 30, 2017
sipify QgsVectorLayer, QgsFeature
1 parent 85894ed commit 7b08608

File tree

3 files changed

+573
-514
lines changed

3 files changed

+573
-514
lines changed
 

‎python/core/qgsfeature.sip

Lines changed: 241 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,121 @@
1+
/******************************************************************
2+
* This file has been generated automatically by sipify.pl *
3+
* Do not edit manually ! Edit header file and generate it again. *
4+
*****************************************************************/
5+
6+
7+
8+
9+
10+
11+
112

213
typedef qint64 QgsFeatureId;
14+
315
typedef QMap<int, QVariant> QgsAttributeMap;
16+
417
typedef QVector<QVariant> QgsAttributes;
518

6-
// QgsAttributes is implemented as a Python list of Python objects.
719
%MappedType QgsAttributes
820
{
921
%TypeHeaderCode
10-
#include <qgsfeature.h> // NO_SIPIFY
22+
#include <qgsfeature.h>
1123
%End
1224

1325
%ConvertFromTypeCode
14-
// Create the list.
15-
PyObject *l;
26+
// Create the list.
27+
PyObject *l;
1628

17-
if ( ( l = PyList_New(sipCpp->size() ) ) == NULL )
18-
return NULL;
29+
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
30+
return NULL;
1931

20-
// Set the list elements.
21-
for ( int i = 0; i < sipCpp->size(); ++i )
22-
{
23-
QVariant *v = new QVariant( sipCpp->at( i ) );
24-
PyObject *tobj;
25-
26-
if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant,Py_None ) ) == NULL )
27-
{
28-
Py_DECREF( l );
29-
delete v;
32+
// Set the list elements.
33+
for ( int i = 0; i < sipCpp->size(); ++i )
34+
{
35+
QVariant *v = new QVariant( sipCpp->at( i ) );
36+
PyObject *tobj;
3037

31-
return NULL;
32-
}
38+
if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
39+
{
40+
Py_DECREF( l );
41+
delete v;
3342

34-
PyList_SET_ITEM( l, i, tobj );
43+
return NULL;
3544
}
3645

37-
return l;
46+
PyList_SET_ITEM( l, i, tobj );
47+
}
48+
49+
return l;
3850
%End
3951

4052
%ConvertToTypeCode
41-
// Check the type if that is all that is required.
42-
if (sipIsErr == NULL)
43-
{
44-
if (!PyList_Check(sipPy))
45-
return 0;
53+
// Check the type if that is all that is required.
54+
if ( sipIsErr == NULL )
55+
{
56+
if ( !PyList_Check( sipPy ) )
57+
return 0;
4658

47-
for (SIP_SSIZE_T i = 0; i < PyList_GET_SIZE(sipPy); ++i)
48-
if (!sipCanConvertToType(PyList_GET_ITEM(sipPy, i), sipType_QVariant, SIP_NOT_NONE))
49-
return 0;
59+
for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
60+
if ( !sipCanConvertToType( PyList_GET_ITEM( sipPy, i ), sipType_QVariant, SIP_NOT_NONE ) )
61+
return 0;
5062

51-
return 1;
52-
}
63+
return 1;
64+
}
5365

54-
QgsAttributes *qv = new QgsAttributes;
66+
QgsAttributes *qv = new QgsAttributes;
5567

56-
for (SIP_SSIZE_T i = 0; i < PyList_GET_SIZE(sipPy); ++i)
68+
for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
69+
{
70+
int state;
71+
PyObject *obj = PyList_GET_ITEM( sipPy, i );
72+
QVariant *t;
73+
if ( obj == Py_None )
5774
{
58-
int state;
59-
PyObject *obj = PyList_GET_ITEM(sipPy, i);
60-
QVariant *t;
61-
if ( obj == Py_None )
62-
{
63-
t = new QVariant( QVariant::Int );
64-
}
65-
else
66-
{
67-
t = reinterpret_cast<QVariant *>(sipConvertToType(obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
75+
t = new QVariant( QVariant::Int );
76+
}
77+
else
78+
{
79+
t = reinterpret_cast<QVariant *>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );
6880

69-
if (*sipIsErr)
70-
{
71-
sipReleaseType(t, sipType_QVariant, state);
81+
if ( *sipIsErr )
82+
{
83+
sipReleaseType( t, sipType_QVariant, state );
7284

73-
delete qv;
74-
return 0;
75-
}
85+
delete qv;
86+
return 0;
7687
}
88+
}
7789

78-
qv->append(*t);
90+
qv->append( *t );
7991

80-
sipReleaseType(t, sipType_QVariant, state);
81-
}
92+
sipReleaseType( t, sipType_QVariant, state );
93+
}
8294

83-
*sipCppPtr = qv;
95+
*sipCppPtr = qv;
8496

85-
return sipGetState(sipTransferObj);
97+
return sipGetState( sipTransferObj );
8698
%End
8799
};
88100

89-
// key = feature id, value = changed attributes
90-
typedef QMap<qint64, QMap<int, QVariant> > QgsChangedAttributesMap;
91-
92-
// key = feature id, value = changed geometry
93-
typedef QMap<qint64, QgsGeometry> QgsGeometryMap;
94-
95-
// key = field index, value = field name
96-
typedef QMap<int, QString> QgsFieldNameMap;
97101

98-
typedef QList<QgsFeature> QgsFeatureList;
99102

100-
typedef QMap<int, QgsField> QgsFieldMap;
101-
102-
/** \ingroup core
103-
* The feature class encapsulates a single feature including its id,
104-
* geometry and a list of field/values attributes.
105-
* \note QgsFeature objects are implicitly shared.
106-
* @author Gary E.Sherman
107-
*/
108103
class QgsFeature
109104
{
110-
%TypeHeaderCode
111-
#include <qgsfeature.h>
112-
#if (SIP_VERSION >= 0x040900 && SIP_VERSION < 0x040c01)
113-
#define sipType_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant))
114-
#endif
115-
%End
116105
%Docstring
117-
/** \ingroup core
118106
The feature class encapsulates a single feature including its id,
119107
geometry and a list of field/values attributes.
120108
\note QgsFeature objects are implicitly shared.
121109
@author Gary E.Sherman
122-
/
110+
123111

112+
%End
113+
114+
%TypeHeaderCode
115+
#include "qgsfeature.h"
116+
#if (SIP_VERSION >= 0x040900 && SIP_VERSION < 0x040c01)
117+
#define sipType_QVariant ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QVariant))
118+
#endif
124119
%End
125120

126121

@@ -130,101 +125,101 @@ class QgsFeature
130125
%MethodCode
131126
QgsAttributes attributes = sipCpp->attributes();
132127
PyObject *attrs = sipConvertFromType( &attributes, sipType_QgsAttributes, Py_None );
133-
sipRes = PyObject_GetIter(attrs);
128+
sipRes = PyObject_GetIter( attrs );
134129
%End
135130

136-
SIP_PYOBJECT __getitem__(int key);
131+
SIP_PYOBJECT __getitem__( int key );
137132
%MethodCode
138-
QgsAttributes attrs = sipCpp->attributes();
139-
if (a0 < 0 || a0 >= attrs.count())
140-
{
141-
PyErr_SetString(PyExc_KeyError, QByteArray::number(a0));
142-
sipIsErr = 1;
143-
}
144-
else
145-
{
146-
QVariant *v = new QVariant( attrs.at(a0) );
147-
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
148-
}
133+
QgsAttributes attrs = sipCpp->attributes();
134+
if ( a0 < 0 || a0 >= attrs.count() )
135+
{
136+
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
137+
sipIsErr = 1;
138+
}
139+
else
140+
{
141+
QVariant *v = new QVariant( attrs.at( a0 ) );
142+
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
143+
}
149144
%End
150145

151-
SIP_PYOBJECT __getitem__(const QString &name);
146+
SIP_PYOBJECT __getitem__( const QString &name );
152147
%MethodCode
153-
int fieldIdx = sipCpp->fieldNameIndex(*a0);
154-
if (fieldIdx == -1)
155-
{
156-
PyErr_SetString(PyExc_KeyError, a0->toAscii());
157-
sipIsErr = 1;
158-
}
159-
else
160-
{
161-
QVariant *v = new QVariant( sipCpp->attribute(fieldIdx) );
162-
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
163-
}
148+
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
149+
if ( fieldIdx == -1 )
150+
{
151+
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
152+
sipIsErr = 1;
153+
}
154+
else
155+
{
156+
QVariant *v = new QVariant( sipCpp->attribute( fieldIdx ) );
157+
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
158+
}
164159
%End
165160

166-
void __setitem__(int key, QVariant value /GetWrapper/);
161+
void __setitem__( int key, QVariant value /GetWrapper/ );
167162
%MethodCode
168-
bool rv;
163+
bool rv;
169164

170-
if ( a1Wrapper == Py_None )
171-
{
172-
rv = sipCpp->setAttribute(a0, QVariant( QVariant::Int ) );
173-
}
174-
else
175-
{
176-
rv = sipCpp->setAttribute(a0, *a1);
177-
}
165+
if ( a1Wrapper == Py_None )
166+
{
167+
rv = sipCpp->setAttribute( a0, QVariant( QVariant::Int ) );
168+
}
169+
else
170+
{
171+
rv = sipCpp->setAttribute( a0, *a1 );
172+
}
178173

179-
if ( !rv )
180-
{
181-
PyErr_SetString(PyExc_KeyError, QByteArray::number(a0));
182-
sipIsErr = 1;
183-
}
174+
if ( !rv )
175+
{
176+
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
177+
sipIsErr = 1;
178+
}
184179
%End
185180

186-
void __setitem__(const QString &key, QVariant value /GetWrapper/);
181+
void __setitem__( const QString &key, QVariant value /GetWrapper/ );
187182
%MethodCode
188-
int fieldIdx = sipCpp->fieldNameIndex(*a0);
189-
if (fieldIdx == -1)
190-
{
191-
PyErr_SetString(PyExc_KeyError, a0->toAscii());
192-
sipIsErr = 1;
193-
}
194-
else
195-
{
196-
if ( a1Wrapper == Py_None )
183+
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
184+
if ( fieldIdx == -1 )
197185
{
198-
sipCpp->setAttribute(*a0, QVariant( QVariant::Int ) );
186+
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
187+
sipIsErr = 1;
199188
}
200189
else
201190
{
202-
sipCpp->setAttribute(fieldIdx, *a1);
191+
if ( a1Wrapper == Py_None )
192+
{
193+
sipCpp->setAttribute( *a0, QVariant( QVariant::Int ) );
194+
}
195+
else
196+
{
197+
sipCpp->setAttribute( fieldIdx, *a1 );
198+
}
203199
}
204-
}
205200
%End
206201

207-
void __delitem__(int key);
202+
void __delitem__( int key );
208203
%MethodCode
209-
if (a0 >= 0 && a0 < sipCpp->attributes().count())
210-
sipCpp->deleteAttribute(a0);
211-
else
212-
{
213-
PyErr_SetString(PyExc_KeyError, QByteArray::number(a0));
214-
sipIsErr = 1;
215-
}
204+
if ( a0 >= 0 && a0 < sipCpp->attributes().count() )
205+
sipCpp->deleteAttribute( a0 );
206+
else
207+
{
208+
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
209+
sipIsErr = 1;
210+
}
216211
%End
217212

218-
void __delitem__(const QString &name);
213+
void __delitem__( const QString &name );
219214
%MethodCode
220-
int fieldIdx = sipCpp->fieldNameIndex(*a0);
221-
if (fieldIdx == -1)
222-
{
223-
PyErr_SetString(PyExc_KeyError, a0->toAscii());
224-
sipIsErr = 1;
225-
}
226-
else
227-
sipCpp->deleteAttribute(fieldIdx);
215+
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
216+
if ( fieldIdx == -1 )
217+
{
218+
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
219+
sipIsErr = 1;
220+
}
221+
else
222+
sipCpp->deleteAttribute( fieldIdx );
228223
%End
229224

230225
QgsFeature( qint64 id = 0 );
@@ -233,7 +228,16 @@ class QgsFeature
233228

234229
QgsFeature( const QgsFeature &rhs );
235230

236-
~QgsFeature();
231+
// QgsFeature &operator=( const QgsFeature &rhs ); // SIP_SKIP
232+
233+
234+
// bool operator==( const QgsFeature &other ) const; // SIP_SKIP
235+
236+
237+
// bool operator!=( const QgsFeature &other ) const; // SIP_SKIP
238+
239+
240+
virtual ~QgsFeature();
237241

238242
QgsFeatureId id() const;
239243

@@ -243,39 +247,39 @@ class QgsFeature
243247

244248
void setAttributes( const QgsAttributes &attrs );
245249

246-
bool setAttribute( int field, const QVariant &attr /GetWrapper/);
250+
bool setAttribute( int field, const QVariant &attr /GetWrapper/ );
247251
%MethodCode
248-
bool rv;
252+
bool rv;
249253

250-
if ( a1Wrapper == Py_None )
251-
{
252-
rv = sipCpp->setAttribute(a0, QVariant( QVariant::Int ) );
253-
}
254-
else
255-
{
256-
rv = sipCpp->setAttribute(a0, *a1);
257-
}
254+
if ( a1Wrapper == Py_None )
255+
{
256+
rv = sipCpp->setAttribute( a0, QVariant( QVariant::Int ) );
257+
}
258+
else
259+
{
260+
rv = sipCpp->setAttribute( a0, *a1 );
261+
}
258262

259-
if ( !rv )
260-
{
261-
PyErr_SetString(PyExc_KeyError, QByteArray::number(a0));
262-
sipIsErr = 1;
263-
}
263+
if ( !rv )
264+
{
265+
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
266+
sipIsErr = 1;
267+
}
264268

265-
sipRes = rv;
269+
sipRes = rv;
266270
%End
267271

268272
void initAttributes( int fieldCount );
269273

270274
void deleteAttribute( int field );
271275
%MethodCode
272-
if ( a0 >= 0 && a0 < sipCpp->attributes().count() )
273-
sipCpp->deleteAttribute(a0);
274-
else
275-
{
276-
PyErr_SetString(PyExc_KeyError, QByteArray::number(a0));
277-
sipIsErr = 1;
278-
}
276+
if ( a0 >= 0 && a0 < sipCpp->attributes().count() )
277+
sipCpp->deleteAttribute( a0 );
278+
else
279+
{
280+
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
281+
sipIsErr = 1;
282+
}
279283
%End
280284

281285
bool isValid() const;
@@ -296,77 +300,97 @@ class QgsFeature
296300

297301
void setAttribute( const QString &name, const QVariant &value /GetWrapper/ );
298302
%MethodCode
299-
int fieldIdx = sipCpp->fieldNameIndex(*a0);
300-
if (fieldIdx == -1)
301-
{
302-
PyErr_SetString(PyExc_KeyError, a0->toAscii());
303-
sipIsErr = 1;
304-
}
305-
else
306-
{
307-
if ( a1Wrapper == Py_None )
303+
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
304+
if ( fieldIdx == -1 )
308305
{
309-
sipCpp->setAttribute(*a0, QVariant( QVariant::Int ) );
306+
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
307+
sipIsErr = 1;
310308
}
311309
else
312310
{
313-
sipCpp->setAttribute(fieldIdx, *a1);
311+
if ( a1Wrapper == Py_None )
312+
{
313+
sipCpp->setAttribute( *a0, QVariant( QVariant::Int ) );
314+
}
315+
else
316+
{
317+
sipCpp->setAttribute( fieldIdx, *a1 );
318+
}
314319
}
315-
}
316320
%End
317321

318322
bool deleteAttribute( const QString &name );
319323
%MethodCode
320-
int fieldIdx = sipCpp->fieldNameIndex(*a0);
321-
if (fieldIdx == -1)
322-
{
323-
PyErr_SetString(PyExc_KeyError, a0->toAscii());
324-
sipIsErr = 1;
325-
sipRes = false;
326-
}
327-
else
328-
{
329-
sipCpp->deleteAttribute( fieldIdx );
330-
sipRes = true;
331-
}
324+
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
325+
if ( fieldIdx == -1 )
326+
{
327+
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
328+
sipIsErr = 1;
329+
sipRes = false;
330+
}
331+
else
332+
{
333+
sipCpp->deleteAttribute( fieldIdx );
334+
sipRes = true;
335+
}
332336
%End
333337

334338
SIP_PYOBJECT attribute( const QString &name ) const;
335339
%MethodCode
336-
int fieldIdx = sipCpp->fieldNameIndex(*a0);
337-
if (fieldIdx == -1)
338-
{
339-
PyErr_SetString(PyExc_KeyError, a0->toAscii());
340-
sipIsErr = 1;
341-
}
342-
else
343-
{
344-
QVariant *v = new QVariant( sipCpp->attribute(fieldIdx) );
345-
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
346-
}
347-
%End
348-
349-
SIP_PYOBJECT attribute( int fieldIdx ) const;
350-
%MethodCode
351-
{
352-
if (a0 < 0 || a0 >= sipCpp->attributes().count())
340+
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
341+
if ( fieldIdx == -1 )
353342
{
354-
PyErr_SetString(PyExc_KeyError, QByteArray::number(a0));
343+
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
355344
sipIsErr = 1;
356345
}
357346
else
358347
{
359-
QVariant *v = new QVariant( sipCpp->attribute(a0) );
348+
QVariant *v = new QVariant( sipCpp->attribute( fieldIdx ) );
360349
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
361350
}
362-
}
351+
%End
352+
353+
SIP_PYOBJECT attribute( int fieldIdx ) const;
354+
%MethodCode
355+
{
356+
if ( a0 < 0 || a0 >= sipCpp->attributes().count() )
357+
{
358+
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
359+
sipIsErr = 1;
360+
}
361+
else
362+
{
363+
QVariant *v = new QVariant( sipCpp->attribute( a0 ) );
364+
sipRes = sipConvertFromNewType( v, sipType_QVariant, Py_None );
365+
}
366+
}
363367
%End
364368

365369
int fieldNameIndex( const QString &fieldName ) const;
366370

367-
//! Allows direct construction of QVariants from features.
368371
operator QVariant() const;
369372

370373
}; // class QgsFeature
371374

375+
// CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsFeature &feature ); // SIP_SKIP
376+
377+
// CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsFeature &feature ); // SIP_SKIP
378+
379+
380+
typedef QMap<qint64, QMap<int, QVariant> > QgsChangedAttributesMap;
381+
382+
typedef QMap<qint64, QgsGeometry> QgsGeometryMap;
383+
372384
typedef QSet<qint64> QgsFeatureIds;
385+
386+
typedef QMap<int, QString> QgsFieldNameMap;
387+
388+
389+
typedef QMap<int, QgsField> QgsFieldMap;
390+
391+
typedef QList<QgsFeature> QgsFeatureList;
392+
393+
// uint qHash( const QgsFeature &key, uint seed = 0 ); // SIP_SKIP
394+
395+
396+

‎python/core/qgsvectorlayer.sip

Lines changed: 328 additions & 293 deletions
Original file line numberDiff line numberDiff line change
@@ -1,290 +1,307 @@
1+
/******************************************************************
2+
* This file has been generated automatically by sipify.pl *
3+
* Do not edit manually ! Edit header file and generate it again. *
4+
*****************************************************************/
5+
6+
7+
8+
9+
10+
11+
112

213
typedef QList<int> QgsAttributeList;
314
typedef QSet<int> QgsAttributeIds;
15+
typedef QList<QgsPointV2> QgsPointSequence;
16+
417

518

6-
/** \ingroup core
7-
* Represents a vector layer which manages a vector based data sets.
8-
*
9-
* The QgsVectorLayer is instantiated by specifying the name of a data provider,
10-
* such as postgres or wfs, and url defining the specific data set to connect to.
11-
* The vector layer constructor in turn instantiates a QgsVectorDataProvider subclass
12-
* corresponding to the provider type, and passes it the url. The data provider
13-
* connects to the data source.
14-
*
15-
* The QgsVectorLayer provides a common interface to the different data types. It also
16-
* manages editing transactions.
17-
*
18-
* Sample usage of the QgsVectorLayer class:
19-
*
20-
* \code
21-
* QString uri = "point?crs=epsg:4326&field=id:integer";
22-
* QgsVectorLayer *scratchLayer = new QgsVectorLayer(uri, "Scratch point layer", "memory");
23-
* \endcode
24-
*
25-
* The main data providers supported by QGIS are listed below.
26-
*
27-
* \section providers Vector data providers
28-
*
29-
* \subsection memory Memory data providerType (memory)
30-
*
31-
* The memory data provider is used to construct in memory data, for example scratch
32-
* data or data generated from spatial operations such as contouring. There is no
33-
* inherent persistent storage of the data. The data source uri is constructed. The
34-
* url specifies the geometry type ("point", "linestring", "polygon",
35-
* "multipoint","multilinestring","multipolygon"), optionally followed by url parameters
36-
* as follows:
37-
*
38-
* - crs=definition
39-
* Defines the coordinate reference system to use for the layer.
40-
* definition is any string accepted by QgsCoordinateReferenceSystem::createFromString()
41-
*
42-
* - index=yes
43-
* Specifies that the layer will be constructed with a spatial index
44-
*
45-
* - field=name:type(length,precision)
46-
* Defines an attribute of the layer. Multiple field parameters can be added
47-
* to the data provider definition. type is one of "integer", "double", "string".
48-
*
49-
* An example url is "Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes"
50-
*
51-
* \subsection ogr OGR data provider (ogr)
52-
*
53-
* Accesses data using the OGR drivers (http://www.gdal.org/ogr/ogr_formats.html). The url
54-
* is the OGR connection string. A wide variety of data formats can be accessed using this
55-
* driver, including file based formats used by many GIS systems, database formats, and
56-
* web services. Some of these formats are also supported by custom data providers listed
57-
* below.
58-
*
59-
* \subsection spatialite Spatialite data provider (spatialite)
60-
*
61-
* Access data in a spatialite database. The url defines the connection parameters, table,
62-
* geometry column, and other attributes. The url can be constructed using the
63-
* QgsDataSourceUri class.
64-
*
65-
* \subsection postgres Postgresql data provider (postgres)
66-
*
67-
* Connects to a postgresql database. The url defines the connection parameters, table,
68-
* geometry column, and other attributes. The url can be constructed using the
69-
* QgsDataSourceUri class.
70-
*
71-
* \subsection mssql Microsoft SQL server data provider (mssql)
72-
*
73-
* Connects to a Microsoft SQL server database. The url defines the connection parameters, table,
74-
* geometry column, and other attributes. The url can be constructed using the
75-
* QgsDataSourceUri class.
76-
*
77-
* \subsection wfs WFS (web feature service) data provider (wfs)
78-
*
79-
* Used to access data provided by a web feature service.
80-
*
81-
* The url can be a HTTP url to a WFS server (legacy, e.g. http://foobar/wfs?TYPENAME=xxx&SRSNAME=yyy[&FILTER=zzz]), or,
82-
* starting with QGIS 2.16, a URI constructed using the QgsDataSourceUri class with the following parameters :
83-
* - url=string (mandatory): HTTP url to a WFS server endpoint. e.g http://foobar/wfs
84-
* - typename=string (mandatory): WFS typename
85-
* - srsname=string (recommended): SRS like 'EPSG:XXXX'
86-
* - username=string
87-
* - password=string
88-
* - authcfg=string
89-
* - version=auto/1.0.0/1.1.0/2.0.0
90-
* -sql=string: full SELECT SQL statement with optional WHERE, ORDER BY and possibly with JOIN if supported on server
91-
* - filter=string: QGIS expression or OGC/FES filter
92-
* - retrictToRequestBBOX=1: to download only features in the view extent (or more generally
93-
* in the bounding box of the feature iterator)
94-
* - maxNumFeatures=number
95-
* - IgnoreAxisOrientation=1: to ignore EPSG axis order for WFS 1.1 or 2.0
96-
* - InvertAxisOrientation=1: to invert axis order
97-
* - hideDownloadProgressDialog=1: to hide the download progress dialog
98-
*
99-
* The ‘FILTER’ query string parameter can be used to filter
100-
* the WFS feature type. The ‘FILTER’ key value can either be a QGIS expression
101-
* or an OGC XML filter. If the value is set to a QGIS expression the driver will
102-
* turn it into OGC XML filter before passing it to the WFS server. Beware the
103-
* QGIS expression filter only supports” =, !=, <, >, <=, >=, AND, OR, NOT, LIKE, IS NULL”
104-
* attribute operators, “BBOX, Disjoint, Intersects, Touches, Crosses, Contains, Overlaps, Within”
105-
* spatial binary operators and the QGIS local “geomFromWKT, geomFromGML”
106-
* geometry constructor functions.
107-
*
108-
* Also note:
109-
*
110-
* - You can use various functions available in the QGIS Expression list,
111-
* however the function must exist server side and have the same name and arguments to work.
112-
*
113-
* - Use the special $geometry parameter to provide the layer geometry column as input
114-
* into the spatial binary operators e.g intersects($geometry, geomFromWKT('POINT (5 6)'))
115-
*
116-
* \subsection delimitedtext Delimited text file data provider (delimitedtext)
117-
*
118-
* Accesses data in a delimited text file, for example CSV files generated by
119-
* spreadsheets. The contents of the file are split into columns based on specified
120-
* delimiter characters. Each record may be represented spatially either by an
121-
* X and Y coordinate column, or by a WKT (well known text) formatted columns.
122-
*
123-
* The url defines the filename, the formatting options (how the
124-
* text in the file is divided into data fields, and which fields contain the
125-
* X,Y coordinates or WKT text definition. The options are specified as url query
126-
* items.
127-
*
128-
* At its simplest the url can just be the filename, in which case it will be loaded
129-
* as a CSV formatted file.
130-
*
131-
* The url may include the following items:
132-
*
133-
* - encoding=UTF-8
134-
*
135-
* Defines the character encoding in the file. The default is UTF-8. To use
136-
* the default encoding for the operating system use "System".
137-
*
138-
* - type=(csv|regexp|whitespace|plain)
139-
*
140-
* Defines the algorithm used to split records into columns. Records are
141-
* defined by new lines, except for csv format files for which quoted fields
142-
* may span multiple records. The default type is csv.
143-
*
144-
* - "csv" splits the file based on three sets of characters:
145-
* delimiter characters, quote characters,
146-
* and escape characters. Delimiter characters mark the end
147-
* of a field. Quote characters enclose a field which can contain
148-
* delimiter characters, and newlines. Escape characters cause the
149-
* following character to be treated literally (including delimiter,
150-
* quote, and newline characters). Escape and quote characters must
151-
* be different from delimiter characters. Escape characters that are
152-
* also quote characters are treated specially - they can only
153-
* escape themselves within quotes. Elsewhere they are treated as
154-
* quote characters. The defaults for delimiter, quote, and escape
155-
* are ',', '"', '"'.
156-
* - "regexp" splits each record using a regular expression (see QRegExp
157-
* documentation for details).
158-
* - "whitespace" splits each record based on whitespace (on or more whitespace
159-
* characters. Leading whitespace in the record is ignored.
160-
* - "plain" is provided for backwards compatibility. It is equivalent to
161-
* CSV except that the default quote characters are single and double quotes,
162-
* and there is no escape characters.
163-
*
164-
* - delimiter=characters
165-
*
166-
* Defines the delimiter characters used for csv and plain type files, or the
167-
* regular expression for regexp type files. It is a literal string of characters
168-
* except that "\t" may be used to represent a tab character.
169-
*
170-
* - quote=characters
171-
*
172-
* Defines the characters that are used as quote characters for csv and plain type
173-
* files.
174-
*
175-
* - escape=characters
176-
*
177-
* Defines the characters used to escape delimiter, quote, and newline characters.
178-
*
179-
* - skipLines=n
180-
*
181-
* Defines the number of lines to ignore at the beginning of the file (default 0)
182-
*
183-
* - useHeader=(yes|no)
184-
*
185-
* Defines whether the first record in the file (after skipped lines) contains
186-
* column names (default yes)
187-
*
188-
* - trimFields=(yes|no)
189-
*
190-
* If yes then leading and trailing whitespace will be removed from fields
191-
*
192-
* - skipEmptyFields=(yes|no)
193-
*
194-
* If yes then empty fields will be discarded (equivalent to concatenating consecutive
195-
* delimiters)
196-
*
197-
* - maxFields=#
198-
*
199-
* Specifies the maximum number of fields to load for each record. Additional
200-
* fields will be discarded. Default is 0 - load all fields.
201-
*
202-
* - decimalPoint=c
203-
*
204-
* Defines a character that is used as a decimal point in the numeric columns
205-
* The default is '.'.
206-
*
207-
* - xField=column yField=column
208-
*
209-
* Defines the name of the columns holding the x and y coordinates for XY point geometries.
210-
* If the useHeader is no (ie there are no column names), then this is the column
211-
* number (with the first column as 1).
212-
*
213-
* - xyDms=(yes|no)
214-
*
215-
* If yes then the X and Y coordinates are interpreted as
216-
* degrees/minutes/seconds format (fairly permissively),
217-
* or degree/minutes format.
218-
*
219-
* - wktField=column
220-
*
221-
* Defines the name of the columns holding the WKT geometry definition for WKT geometries.
222-
* If the useHeader is no (ie there are no column names), then this is the column
223-
* number (with the first column as 1).
224-
*
225-
* - geomType=(point|line|polygon|none)
226-
*
227-
* Defines the geometry type for WKT type geometries. QGIS will only display one
228-
* type of geometry for the layer - any others will be ignored when the file is
229-
* loaded. By default the provider uses the type of the first geometry in the file.
230-
* Use geomType to override this type.
231-
*
232-
* geomType can also be set to none, in which case the layer is loaded without
233-
* geometries.
234-
*
235-
* - subset=expression
236-
*
237-
* Defines an expression that will identify a subset of records to display
238-
*
239-
* - crs=crsstring
240-
*
241-
* Defines the coordinate reference system used for the layer. This can be
242-
* any string accepted by QgsCoordinateReferenceSystem::createFromString()
243-
*
244-
* -subsetIndex=(yes|no)
245-
*
246-
* Determines whether the provider generates an index to improve the efficiency
247-
* of subsets. The default is yes
248-
*
249-
* -spatialIndex=(yes|no)
250-
*
251-
* Determines whether the provider generates a spatial index. The default is no.
252-
*
253-
* -watchFile=(yes|no)
254-
*
255-
* Defines whether the file will be monitored for changes. The default is
256-
* to monitor for changes.
257-
*
258-
* - quiet
259-
*
260-
* Errors encountered loading the file will not be reported in a user dialog if
261-
* quiet is included (They will still be shown in the output log).
262-
*
263-
* \subsection gpx GPX data provider (gpx)
264-
*
265-
* Provider reads tracks, routes, and waypoints from a GPX file. The url
266-
* defines the name of the file, and the type of data to retrieve from it
267-
* ("track", "route", or "waypoint").
268-
*
269-
* An example url is "/home/user/data/holiday.gpx?type=route"
270-
*
271-
* \subsection grass Grass data provider (grass)
272-
*
273-
* Provider to display vector data in a GRASS GIS layer.
274-
*
275-
* TODO QGIS3: Remove virtual from non-inherited methods (like isModified)
276-
*/
27719

27820

27921
class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
28022
{
23+
%Docstring
24+
Represents a vector layer which manages a vector based data sets.
25+
26+
The QgsVectorLayer is instantiated by specifying the name of a data provider,
27+
such as postgres or wfs, and url defining the specific data set to connect to.
28+
The vector layer constructor in turn instantiates a QgsVectorDataProvider subclass
29+
corresponding to the provider type, and passes it the url. The data provider
30+
connects to the data source.
31+
32+
The QgsVectorLayer provides a common interface to the different data types. It also
33+
manages editing transactions.
34+
35+
Sample usage of the QgsVectorLayer class:
36+
37+
\code
38+
QString uri = "point?crs=epsg:4326&field=id:integer";
39+
QgsVectorLayer *scratchLayer = new QgsVectorLayer(uri, "Scratch point layer", "memory");
40+
\endcode
41+
42+
The main data providers supported by QGIS are listed below.
43+
44+
\section providers Vector data providers
45+
46+
\subsection memory Memory data providerType (memory)
47+
48+
The memory data provider is used to construct in memory data, for example scratch
49+
data or data generated from spatial operations such as contouring. There is no
50+
inherent persistent storage of the data. The data source uri is constructed. The
51+
url specifies the geometry type ("point", "linestring", "polygon",
52+
"multipoint","multilinestring","multipolygon"), optionally followed by url parameters
53+
as follows:
54+
55+
- crs=definition
56+
Defines the coordinate reference system to use for the layer.
57+
definition is any string accepted by QgsCoordinateReferenceSystem::createFromString()
58+
59+
- index=yes
60+
Specifies that the layer will be constructed with a spatial index
61+
62+
- field=name:type(length,precision)
63+
Defines an attribute of the layer. Multiple field parameters can be added
64+
to the data provider definition. type is one of "integer", "double", "string".
65+
66+
An example url is "Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes"
67+
68+
\subsection ogr OGR data provider (ogr)
69+
70+
Accesses data using the OGR drivers (http://www.gdal.org/ogr/ogr_formats.html). The url
71+
is the OGR connection string. A wide variety of data formats can be accessed using this
72+
driver, including file based formats used by many GIS systems, database formats, and
73+
web services. Some of these formats are also supported by custom data providers listed
74+
below.
75+
76+
\subsection spatialite Spatialite data provider (spatialite)
77+
78+
Access data in a spatialite database. The url defines the connection parameters, table,
79+
geometry column, and other attributes. The url can be constructed using the
80+
QgsDataSourceUri class.
81+
82+
\subsection postgres Postgresql data provider (postgres)
83+
84+
Connects to a postgresql database. The url defines the connection parameters, table,
85+
geometry column, and other attributes. The url can be constructed using the
86+
QgsDataSourceUri class.
87+
88+
\subsection mssql Microsoft SQL server data provider (mssql)
89+
90+
Connects to a Microsoft SQL server database. The url defines the connection parameters, table,
91+
geometry column, and other attributes. The url can be constructed using the
92+
QgsDataSourceUri class.
93+
94+
\subsection wfs WFS (web feature service) data provider (wfs)
95+
96+
Used to access data provided by a web feature service.
97+
98+
The url can be a HTTP url to a WFS server (legacy, e.g. http://foobar/wfs?TYPENAME=xxx&SRSNAME=yyy[&FILTER=zzz]), or,
99+
starting with QGIS 2.16, a URI constructed using the QgsDataSourceUri class with the following parameters :
100+
- url=string (mandatory): HTTP url to a WFS server endpoint. e.g http://foobar/wfs
101+
- typename=string (mandatory): WFS typename
102+
- srsname=string (recommended): SRS like 'EPSG:XXXX'
103+
- username=string
104+
- password=string
105+
- authcfg=string
106+
- version=auto/1.0.0/1.1.0/2.0.0
107+
-sql=string: full SELECT SQL statement with optional WHERE, ORDER BY and possibly with JOIN if supported on server
108+
- filter=string: QGIS expression or OGC/FES filter
109+
- restrictToRequestBBOX=1: to download only features in the view extent (or more generally
110+
in the bounding box of the feature iterator)
111+
- maxNumFeatures=number
112+
- IgnoreAxisOrientation=1: to ignore EPSG axis order for WFS 1.1 or 2.0
113+
- InvertAxisOrientation=1: to invert axis order
114+
- hideDownloadProgressDialog=1: to hide the download progress dialog
115+
116+
The ‘FILTER’ query string parameter can be used to filter
117+
the WFS feature type. The ‘FILTER’ key value can either be a QGIS expression
118+
or an OGC XML filter. If the value is set to a QGIS expression the driver will
119+
turn it into OGC XML filter before passing it to the WFS server. Beware the
120+
QGIS expression filter only supports” =, !=, <, >, <=, >=, AND, OR, NOT, LIKE, IS NULL”
121+
attribute operators, “BBOX, Disjoint, Intersects, Touches, Crosses, Contains, Overlaps, Within”
122+
spatial binary operators and the QGIS local “geomFromWKT, geomFromGML”
123+
geometry constructor functions.
124+
125+
Also note:
126+
127+
- You can use various functions available in the QGIS Expression list,
128+
however the function must exist server side and have the same name and arguments to work.
129+
130+
- Use the special $geometry parameter to provide the layer geometry column as input
131+
into the spatial binary operators e.g intersects($geometry, geomFromWKT('POINT (5 6)'))
132+
133+
\subsection delimitedtext Delimited text file data provider (delimitedtext)
134+
135+
Accesses data in a delimited text file, for example CSV files generated by
136+
spreadsheets. The contents of the file are split into columns based on specified
137+
delimiter characters. Each record may be represented spatially either by an
138+
X and Y coordinate column, or by a WKT (well known text) formatted columns.
139+
140+
The url defines the filename, the formatting options (how the
141+
text in the file is divided into data fields, and which fields contain the
142+
X,Y coordinates or WKT text definition. The options are specified as url query
143+
items.
144+
145+
At its simplest the url can just be the filename, in which case it will be loaded
146+
as a CSV formatted file.
147+
148+
The url may include the following items:
149+
150+
- encoding=UTF-8
151+
152+
Defines the character encoding in the file. The default is UTF-8. To use
153+
the default encoding for the operating system use "System".
154+
155+
- type=(csv|regexp|whitespace|plain)
156+
157+
Defines the algorithm used to split records into columns. Records are
158+
defined by new lines, except for csv format files for which quoted fields
159+
may span multiple records. The default type is csv.
160+
161+
- "csv" splits the file based on three sets of characters:
162+
delimiter characters, quote characters,
163+
and escape characters. Delimiter characters mark the end
164+
of a field. Quote characters enclose a field which can contain
165+
delimiter characters, and newlines. Escape characters cause the
166+
following character to be treated literally (including delimiter,
167+
quote, and newline characters). Escape and quote characters must
168+
be different from delimiter characters. Escape characters that are
169+
also quote characters are treated specially - they can only
170+
escape themselves within quotes. Elsewhere they are treated as
171+
quote characters. The defaults for delimiter, quote, and escape
172+
are ',', '"', '"'.
173+
- "regexp" splits each record using a regular expression (see QRegExp
174+
documentation for details).
175+
- "whitespace" splits each record based on whitespace (on or more whitespace
176+
characters. Leading whitespace in the record is ignored.
177+
- "plain" is provided for backwards compatibility. It is equivalent to
178+
CSV except that the default quote characters are single and double quotes,
179+
and there is no escape characters.
180+
181+
- delimiter=characters
182+
183+
Defines the delimiter characters used for csv and plain type files, or the
184+
regular expression for regexp type files. It is a literal string of characters
185+
except that "\t" may be used to represent a tab character.
186+
187+
- quote=characters
188+
189+
Defines the characters that are used as quote characters for csv and plain type
190+
files.
191+
192+
- escape=characters
193+
194+
Defines the characters used to escape delimiter, quote, and newline characters.
195+
196+
- skipLines=n
197+
198+
Defines the number of lines to ignore at the beginning of the file (default 0)
199+
200+
- useHeader=(yes|no)
201+
202+
Defines whether the first record in the file (after skipped lines) contains
203+
column names (default yes)
204+
205+
- trimFields=(yes|no)
206+
207+
If yes then leading and trailing whitespace will be removed from fields
208+
209+
- skipEmptyFields=(yes|no)
210+
211+
If yes then empty fields will be discarded (equivalent to concatenating consecutive
212+
delimiters)
213+
214+
- maxFields=#
215+
216+
Specifies the maximum number of fields to load for each record. Additional
217+
fields will be discarded. Default is 0 - load all fields.
218+
219+
- decimalPoint=c
220+
221+
Defines a character that is used as a decimal point in the numeric columns
222+
The default is '.'.
223+
224+
- xField=column yField=column
225+
226+
Defines the name of the columns holding the x and y coordinates for XY point geometries.
227+
If the useHeader is no (ie there are no column names), then this is the column
228+
number (with the first column as 1).
229+
230+
- xyDms=(yes|no)
231+
232+
If yes then the X and Y coordinates are interpreted as
233+
degrees/minutes/seconds format (fairly permissively),
234+
or degree/minutes format.
235+
236+
- wktField=column
237+
238+
Defines the name of the columns holding the WKT geometry definition for WKT geometries.
239+
If the useHeader is no (ie there are no column names), then this is the column
240+
number (with the first column as 1).
241+
242+
- geomType=(point|line|polygon|none)
243+
244+
Defines the geometry type for WKT type geometries. QGIS will only display one
245+
type of geometry for the layer - any others will be ignored when the file is
246+
loaded. By default the provider uses the type of the first geometry in the file.
247+
Use geomType to override this type.
248+
249+
geomType can also be set to none, in which case the layer is loaded without
250+
geometries.
251+
252+
- subset=expression
253+
254+
Defines an expression that will identify a subset of records to display
255+
256+
- crs=crsstring
257+
258+
Defines the coordinate reference system used for the layer. This can be
259+
any string accepted by QgsCoordinateReferenceSystem::createFromString()
260+
261+
-subsetIndex=(yes|no)
262+
263+
Determines whether the provider generates an index to improve the efficiency
264+
of subsets. The default is yes
265+
266+
-spatialIndex=(yes|no)
267+
268+
Determines whether the provider generates a spatial index. The default is no.
269+
270+
-watchFile=(yes|no)
271+
272+
Defines whether the file will be monitored for changes. The default is
273+
to monitor for changes.
274+
275+
- quiet
276+
277+
Errors encountered loading the file will not be reported in a user dialog if
278+
quiet is included (They will still be shown in the output log).
279+
280+
\subsection gpx GPX data provider (gpx)
281+
282+
Provider reads tracks, routes, and waypoints from a GPX file. The url
283+
defines the name of the file, and the type of data to retrieve from it
284+
("track", "route", or "waypoint").
285+
286+
An example url is "/home/user/data/holiday.gpx?type=route"
287+
288+
\subsection grass Grass data provider (grass)
289+
290+
Provider to display vector data in a GRASS GIS layer.
291+
292+
TODO QGIS3: Remove virtual from non-inherited methods (like isModified)
293+
@see QgsVectorLayerUtils()
294+
295+
296+
%End
297+
281298
%TypeHeaderCode
282299
#include "qgsvectorlayer.h"
283300
%End
284301

302+
285303
public:
286304

287-
//! Result of an edit operation
288305
enum EditResult
289306
{
290307
Success,
@@ -294,7 +311,6 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
294311
InvalidLayer,
295312
};
296313

297-
//! Selection behavior
298314
enum SelectBehavior
299315
{
300316
SetSelection,
@@ -306,8 +322,12 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
306322
QgsVectorLayer( const QString &path = QString::null, const QString &baseName = QString::null,
307323
const QString &providerLib = "ogr", bool loadDefaultStyleFlag = true );
308324

325+
309326
virtual ~QgsVectorLayer();
310327

328+
// QgsVectorLayer( const QgsVectorLayer &rhs ) = delete;
329+
// QgsVectorLayer &operator=( QgsVectorLayer const &rhs ) = delete;
330+
311331
QString storageType() const;
312332

313333
QString capabilitiesString() const;
@@ -322,7 +342,8 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
322342

323343
QgsVectorDataProvider *dataProvider();
324344

325-
// const QgsVectorDataProvider *dataProvider() const;
345+
// const QgsVectorDataProvider *dataProvider() const; // SIP_SKIP
346+
326347

327348
void setProviderEncoding( const QString &encoding );
328349

@@ -387,7 +408,8 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
387408

388409
QgsFeatureRenderer *renderer();
389410

390-
// const QgsFeatureRenderer *renderer() const { return mRendererV2; }
411+
// const QgsFeatureRenderer *renderer() const { return mRenderer; } // SIP_SKIP
412+
391413

392414
void setRenderer( QgsFeatureRenderer *r /Transfer/ );
393415

@@ -420,15 +442,16 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
420442

421443
virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag /Out/ );
422444

423-
bool readSymbology( const QDomNode &node, QString &errorMessage );
445+
bool readSymbology( const QDomNode &layerNode, QString &errorMessage );
424446

425447
bool readStyle( const QDomNode &node, QString &errorMessage );
426448

427449
bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage ) const;
428450

429451
bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage ) const;
430452

431-
bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props ) const;
453+
bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsStringMap &props = QgsStringMap() ) const;
454+
432455
bool readSld( const QDomNode &node, QString &errorMessage );
433456

434457
long featureCount( const QString &legendKey ) const;
@@ -447,7 +470,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
447470

448471
QgsFeature getFeature( QgsFeatureId fid );
449472

450-
QgsFeatureIterator getFeatures( QgsFeatureIds fids );
473+
QgsFeatureIterator getFeatures( const QgsFeatureIds &fids );
451474

452475
QgsFeatureIterator getFeatures( const QgsRectangle &rectangle );
453476

@@ -473,7 +496,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
473496

474497
int addPart( const QList<QgsPoint> &ring );
475498

476-
int addPart( const QList<QgsPointV2> &ring ) /PyName=addPartV2/;
499+
int addPart( const QgsPointSequence &ring ) /PyName=addPartV2/;
477500

478501
int addPart( QgsCurve *ring /Transfer/ ) /PyName=addCurvedPart/;
479502

@@ -489,9 +512,11 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
489512

490513
int insertSegmentVerticesForSnap( const QList<QgsSnappingResult> &snapResults );
491514

492-
// const QgsAbstractVectorLayerLabeling *labeling() const { return mLabeling; }
515+
// const QgsAbstractVectorLayerLabeling *labeling() const { return mLabeling; } // SIP_SKIP
516+
517+
518+
// void setLabeling( QgsAbstractVectorLayerLabeling *labeling ); // SIP_SKIP
493519

494-
// void setLabeling( QgsAbstractVectorLayerLabeling *labeling );
495520

496521
virtual bool isEditable() const;
497522

@@ -546,19 +571,21 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
546571

547572
QString attributeDisplayName( int index ) const;
548573

549-
const QMap< QString, QString > &attributeAliases() const;
574+
QgsStringMap attributeAliases() const;
550575

551576
QSet<QString> excludeAttributesWms() const;
577+
552578
void setExcludeAttributesWms( const QSet<QString> &att );
553579

554580
QSet<QString> excludeAttributesWfs() const;
581+
555582
void setExcludeAttributesWfs( const QSet<QString> &att );
556583

557584
bool deleteAttribute( int attr );
558585

559586
bool deleteAttributes( QList<int> attrs );
560587

561-
bool addFeatures( QList<QgsFeature> features, bool makeSelected = true );
588+
bool addFeatures( QgsFeatureList features, bool makeSelected = true );
562589

563590
bool deleteFeature( QgsFeatureId fid );
564591

@@ -578,6 +605,9 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
578605

579606
QgsVectorLayerEditBuffer *editBuffer();
580607

608+
// const QgsVectorLayerEditBuffer *editBuffer() const { return mEditBuffer; } // SIP_SKIP
609+
610+
581611
void beginEditCommand( const QString &text );
582612

583613
void endEditCommand();
@@ -596,7 +626,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
596626
void updateFields();
597627

598628
QVariant defaultValue( int index, const QgsFeature &feature = QgsFeature(),
599-
QgsExpressionContext *context = nullptr ) const;
629+
QgsExpressionContext *context = 0 ) const;
600630

601631
void setDefaultValueExpression( int index, const QString &expression );
602632

@@ -613,13 +643,15 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
613643
QString constraintDescription( int index ) const;
614644

615645
void setConstraintExpression( int index, const QString &expression, const QString &description = QString() );
646+
616647
void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup &setup );
648+
617649
QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
618650

619651
void uniqueValues( int index, QList<QVariant> &uniqueValues /Out/, int limit = -1 ) const;
620652

621653
QStringList uniqueStringsMatching( int index, const QString &substring, int limit = -1,
622-
QgsFeedback *feedback = nullptr ) const;
654+
QgsFeedback *feedback = 0 ) const;
623655

624656
QVariant minimumValue( int index ) const;
625657

@@ -628,8 +660,8 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
628660
QVariant aggregate( QgsAggregateCalculator::Aggregate aggregate,
629661
const QString &fieldOrExpression,
630662
const QgsAggregateCalculator::AggregateParameters &parameters = QgsAggregateCalculator::AggregateParameters(),
631-
QgsExpressionContext *context = nullptr,
632-
bool *ok = nullptr ) const;
663+
QgsExpressionContext *context = 0,
664+
bool *ok = 0 ) const;
633665

634666
QList< QVariant > getValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, QgsFeedback *feedback = 0 ) const;
635667

@@ -643,7 +675,8 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
643675

644676
QString metadata() const;
645677

646-
// inline QgsGeometryCache *cache();
678+
// inline QgsGeometryCache *cache() { return mCache; } // SIP_SKIP
679+
647680

648681
void setSimplifyMethod( const QgsVectorSimplifyMethod &simplifyMethod );
649682

@@ -668,6 +701,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
668701
void setEditFormConfig( const QgsEditFormConfig &editFormConfig );
669702

670703
public slots:
704+
671705
void select( QgsFeatureId featureId );
672706

673707
void select( const QgsFeatureIds &featureIds );
@@ -720,6 +754,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
720754

721755
void updatedFields();
722756

757+
723758
void attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value );
724759

725760
void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );
@@ -756,12 +791,12 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
756791
void editFormConfigChanged();
757792

758793
void readOnlyChanged();
759-
protected:
760-
void setExtent( const QgsRectangle &rect );
761-
762-
private: // Private methods
763794

764-
QgsVectorLayer( const QgsVectorLayer &rhs );
765795

796+
protected:
797+
void setExtent( const QgsRectangle &rect );
766798

799+
private: // Private methods
800+
QgsVectorLayer( const QgsVectorLayer &rhs );
767801
};
802+

‎scripts/sipify.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
my $HEADER_CODE = 0;
1717
my $PRIVATE_SECTION = 0;
1818

19-
my $comment;
19+
my $comment = '';
2020
my $nesting_index = 0;
2121
my $private_section_line = '';
2222

@@ -131,10 +131,10 @@
131131

132132
# Detect comment block
133133
if ($line =~ m/\s*\/\*\*/) {
134-
$comment = "";
134+
$comment = '';
135135
while(!eof $header) {
136136
$line = readline $header;
137-
$line =~ m/\s*\*?(.*)/;
137+
$line =~ m/\s*\*?(.*?)(\/)?$/;
138138
$comment .= "$1\n";
139139
if ( $line =~ m/\*\/$/ ) {
140140
last;
@@ -237,7 +237,7 @@
237237

238238
# deleted functions
239239
if ( $line =~ m/^(\s*)?(const )?(virtual |static )?((\w+(<.*?>)?\s+(\*|&)?)?(\w+|operator.)\(.*?(\(.*\))*.*\)( const)?)\s*= delete;$/ ) {
240-
$line = readline $header;
240+
$line =~ s/^/\/\//;
241241
}
242242

243243
$line =~ s/SIP_FACTORY/\/Factory\//;

0 commit comments

Comments
 (0)
Please sign in to comment.