Skip to content

Commit a9d8bd1

Browse files
committedJan 18, 2014
update sip some bindings
1 parent 3327cdc commit a9d8bd1

File tree

3 files changed

+61
-26
lines changed

3 files changed

+61
-26
lines changed
 

‎python/core/composer/qgscomposerattributetable.sip

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ class QgsComposerAttributeTable : QgsComposerTable
5555
/**Adapts mMaximumNumberOfFeatures depending on the rectangle height*/
5656
void setSceneRect( const QRectF& rectangle );
5757

58+
// @note not available in python bindings
5859
//void setSortAttributes( const QList<QPair<int, bool> > att );
60+
61+
// @note not available in python bindings
5962
//QList<QPair<int, bool> > sortAttributes() const;
63+
6064
protected:
6165
virtual QMap<int, QString> getHeaderLabels() const;
6266

‎python/core/qgsfield.sip

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,35 +121,43 @@ class QgsFields
121121
%End
122122
public:
123123

124-
enum FieldOrigin { OriginUnknown, OriginProvider, OriginJoin, OriginEdit };
125-
124+
enum FieldOrigin
125+
{
126+
OriginUnknown, //!< it has not been specified where the field comes from
127+
OriginProvider, //!< field comes from the underlying data provider of the vector layer (originIndex = index in provider's fields)
128+
OriginJoin, //!< field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index within the join)
129+
OriginEdit //!< field has been temporarily added in editing mode (originIndex = index in the list of added attributes)
130+
};
131+
132+
//! Remove all fields
126133
void clear();
127-
void append( const QgsField& field, FieldOrigin origin = OriginProvider, int originIndex = -1 );
134+
//! Append a field. The field must have unique name, otherwise it is rejected (returns false)
135+
bool append( const QgsField& field, FieldOrigin origin = OriginProvider, int originIndex = -1 );
136+
//! Remove a field with the given index
128137
void remove( int fieldIdx );
138+
//! Extend with fields from another QgsFields container
139+
void extend( const QgsFields& other );
129140

141+
//! Check whether the container is empty
130142
bool isEmpty() const;
143+
//! Return number of items
144+
int count() const;
131145
// __len__ annotation since sip 4.10.3
132146
//int count() const /__len__/;
133-
int count() const;
134147
int __len__() const;
135148
%MethodCode
136149
sipRes = sipCpp->count();
137150
%End
151+
//! Return number of items
138152
int size() const;
139-
//const QgsField& operator[](int i) const;
140-
//QgsField& operator[](int i);
141-
const QgsField& at(int i) const;
142-
QList<QgsField> toList() const;
143-
144-
const QgsField& field( int fieldIdx ) const;
145-
const QgsField& field( const QString& name ) const;
146-
FieldOrigin fieldOrigin( int fieldIdx ) const;
147-
int fieldOriginIndex( int fieldIdx ) const;
148-
149-
int indexFromName( const QString& name ) const;
150-
void extend( const QgsFields& other );
151-
152-
153+
//! Return if a field index is valid
154+
//! @param i Index of the field which needs to be checked
155+
//! @return True if the field exists
156+
bool exists( int i ) const;
157+
158+
//! Get field at particular index (must be in range 0..N-1)
159+
//inline const QgsField& operator[]( int i ) const;
160+
//! Get field at particular index (must be in range 0..N-1)
153161
QgsField& operator[](int i) /Factory/;
154162
%MethodCode
155163
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
@@ -159,6 +167,23 @@ class QgsFields
159167
sipRes = new QgsField(sipCpp->operator[](idx));
160168

161169
%End
170+
//! Get field at particular index (must be in range 0..N-1)
171+
const QgsField& at( int i ) const;
172+
//! Get field at particular index (must be in range 0..N-1)
173+
const QgsField& field( int fieldIdx ) const;
174+
//! Get field at particular index (must be in range 0..N-1)
175+
const QgsField& field( const QString& name ) const;
176+
177+
//! Get field's origin (value from an enumeration)
178+
FieldOrigin fieldOrigin( int fieldIdx ) const;
179+
//! Get field's origin index (its meaning is specific to each type of origin)
180+
int fieldOriginIndex( int fieldIdx ) const;
181+
182+
//! Look up field's index from name. Returns -1 on error
183+
int indexFromName( const QString& name ) const;
184+
185+
//! Utility function to return a list of QgsField instances
186+
QList<QgsField> toList() const;
162187

163188
/* SIP_PYOBJECT __getitem__(int key);
164189
%MethodCode

‎python/core/qgsgeometry.sip

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ class QgsGeometry
8484
*/
8585
size_t wkbSize() const;
8686

87+
/**Returns a geos geomtry. QgsGeometry keeps ownership, don't delete the returned object!
88+
@note this method was added in version 1.1
89+
@note not available in python bindings
90+
*/
91+
// const GEOSGeometry* asGeos() const;
92+
8793
/** Returns type of wkb (point / linestring / polygon etc.) */
8894
QGis::WkbType wkbType() const;
8995

@@ -217,7 +223,7 @@ class QgsGeometry
217223
/**Adds a new island polygon to a multipolygon feature
218224
@return 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring
219225
not disjoint with existing polygons of the feature*/
220-
int addPart( const QList<QgsPoint> &points );
226+
int addPart( const QList<QgsPoint> &points, QGis::GeometryType geomType = QGis::UnknownGeometry );
221227

222228
/**Translate this geometry by dx, dy
223229
@return 0 in case of success*/
@@ -261,31 +267,31 @@ class QgsGeometry
261267
/** Test for containment of a point (uses GEOS) */
262268
bool contains( const QgsPoint* p ) const;
263269

264-
/** Test for if geometry is contained in an other (uses GEOS)
270+
/** Test for if geometry is contained in another (uses GEOS)
265271
* @note added in 1.5 */
266272
bool contains( const QgsGeometry* geometry ) const;
267273

268-
/** Test for if geometry is disjoint of an other (uses GEOS)
274+
/** Test for if geometry is disjoint of another (uses GEOS)
269275
* @note added in 1.5 */
270276
bool disjoint( const QgsGeometry* geometry ) const;
271277

272-
/** Test for if geometry equals an other (uses GEOS)
278+
/** Test for if geometry equals another (uses GEOS)
273279
* @note added in 1.5 */
274280
bool equals( const QgsGeometry* geometry ) const;
275281

276-
/** Test for if geometry touch an other (uses GEOS)
282+
/** Test for if geometry touch another (uses GEOS)
277283
* @note added in 1.5 */
278284
bool touches( const QgsGeometry* geometry ) const;
279285

280-
/** Test for if geometry overlaps an other (uses GEOS)
286+
/** Test for if geometry overlaps another (uses GEOS)
281287
* @note added in 1.5 */
282288
bool overlaps( const QgsGeometry* geometry ) const;
283289

284-
/** Test for if geometry is within an other (uses GEOS)
290+
/** Test for if geometry is within another (uses GEOS)
285291
* @note added in 1.5 */
286292
bool within( const QgsGeometry* geometry ) const;
287293

288-
/** Test for if geometry crosses an other (uses GEOS)
294+
/** Test for if geometry crosses another (uses GEOS)
289295
* @note added in 1.5 */
290296
bool crosses( const QgsGeometry* geometry ) const;
291297

0 commit comments

Comments
 (0)
Please sign in to comment.