Skip to content
Permalink
Browse files

update sip some bindings

  • Loading branch information
jef-n committed Jan 18, 2014
1 parent 3327cdc commit a9d8bd1e5b09e800da6606bdccb46c9ebd2e1aef
Showing with 61 additions and 26 deletions.
  1. +4 −0 python/core/composer/qgscomposerattributetable.sip
  2. +43 −18 python/core/qgsfield.sip
  3. +14 −8 python/core/qgsgeometry.sip
@@ -55,8 +55,12 @@ class QgsComposerAttributeTable : QgsComposerTable
/**Adapts mMaximumNumberOfFeatures depending on the rectangle height*/
void setSceneRect( const QRectF& rectangle );

// @note not available in python bindings
//void setSortAttributes( const QList<QPair<int, bool> > att );

// @note not available in python bindings
//QList<QPair<int, bool> > sortAttributes() const;

protected:
virtual QMap<int, QString> getHeaderLabels() const;

@@ -121,35 +121,43 @@ class QgsFields
%End
public:

enum FieldOrigin { OriginUnknown, OriginProvider, OriginJoin, OriginEdit };

enum FieldOrigin
{
OriginUnknown, //!< it has not been specified where the field comes from
OriginProvider, //!< field comes from the underlying data provider of the vector layer (originIndex = index in provider's fields)
OriginJoin, //!< field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index within the join)
OriginEdit //!< field has been temporarily added in editing mode (originIndex = index in the list of added attributes)
};

//! Remove all fields
void clear();
void append( const QgsField& field, FieldOrigin origin = OriginProvider, int originIndex = -1 );
//! Append a field. The field must have unique name, otherwise it is rejected (returns false)
bool append( const QgsField& field, FieldOrigin origin = OriginProvider, int originIndex = -1 );
//! Remove a field with the given index
void remove( int fieldIdx );
//! Extend with fields from another QgsFields container
void extend( const QgsFields& other );

//! Check whether the container is empty
bool isEmpty() const;
//! Return number of items
int count() const;
// __len__ annotation since sip 4.10.3
//int count() const /__len__/;
int count() const;
int __len__() const;
%MethodCode
sipRes = sipCpp->count();
%End
//! Return number of items
int size() const;
//const QgsField& operator[](int i) const;
//QgsField& operator[](int i);
const QgsField& at(int i) const;
QList<QgsField> toList() const;

const QgsField& field( int fieldIdx ) const;
const QgsField& field( const QString& name ) const;
FieldOrigin fieldOrigin( int fieldIdx ) const;
int fieldOriginIndex( int fieldIdx ) const;

int indexFromName( const QString& name ) const;
void extend( const QgsFields& other );


//! Return if a field index is valid
//! @param i Index of the field which needs to be checked
//! @return True if the field exists
bool exists( int i ) const;

//! Get field at particular index (must be in range 0..N-1)
//inline const QgsField& operator[]( int i ) const;
//! Get field at particular index (must be in range 0..N-1)
QgsField& operator[](int i) /Factory/;
%MethodCode
SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
@@ -159,6 +167,23 @@ class QgsFields
sipRes = new QgsField(sipCpp->operator[](idx));

%End
//! Get field at particular index (must be in range 0..N-1)
const QgsField& at( int i ) const;
//! Get field at particular index (must be in range 0..N-1)
const QgsField& field( int fieldIdx ) const;
//! Get field at particular index (must be in range 0..N-1)
const QgsField& field( const QString& name ) const;

//! Get field's origin (value from an enumeration)
FieldOrigin fieldOrigin( int fieldIdx ) const;
//! Get field's origin index (its meaning is specific to each type of origin)
int fieldOriginIndex( int fieldIdx ) const;

//! Look up field's index from name. Returns -1 on error
int indexFromName( const QString& name ) const;

//! Utility function to return a list of QgsField instances
QList<QgsField> toList() const;

/* SIP_PYOBJECT __getitem__(int key);
%MethodCode
@@ -84,6 +84,12 @@ class QgsGeometry
*/
size_t wkbSize() const;

/**Returns a geos geomtry. QgsGeometry keeps ownership, don't delete the returned object!
@note this method was added in version 1.1
@note not available in python bindings
*/
// const GEOSGeometry* asGeos() const;

/** Returns type of wkb (point / linestring / polygon etc.) */
QGis::WkbType wkbType() const;

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

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

/** Test for if geometry is contained in an other (uses GEOS)
/** Test for if geometry is contained in another (uses GEOS)
* @note added in 1.5 */
bool contains( const QgsGeometry* geometry ) const;

/** Test for if geometry is disjoint of an other (uses GEOS)
/** Test for if geometry is disjoint of another (uses GEOS)
* @note added in 1.5 */
bool disjoint( const QgsGeometry* geometry ) const;

/** Test for if geometry equals an other (uses GEOS)
/** Test for if geometry equals another (uses GEOS)
* @note added in 1.5 */
bool equals( const QgsGeometry* geometry ) const;

/** Test for if geometry touch an other (uses GEOS)
/** Test for if geometry touch another (uses GEOS)
* @note added in 1.5 */
bool touches( const QgsGeometry* geometry ) const;

/** Test for if geometry overlaps an other (uses GEOS)
/** Test for if geometry overlaps another (uses GEOS)
* @note added in 1.5 */
bool overlaps( const QgsGeometry* geometry ) const;

/** Test for if geometry is within an other (uses GEOS)
/** Test for if geometry is within another (uses GEOS)
* @note added in 1.5 */
bool within( const QgsGeometry* geometry ) const;

/** Test for if geometry crosses an other (uses GEOS)
/** Test for if geometry crosses another (uses GEOS)
* @note added in 1.5 */
bool crosses( const QgsGeometry* geometry ) const;

0 comments on commit a9d8bd1

Please sign in to comment.
You can’t perform that action at this time.