QGIS/python/core/geometry/qgsgeometrycollection.sip

120 lines
4.6 KiB
Plaintext
Raw Normal View History

2016-08-06 11:01:42 +02:00
class QgsGeometryCollection: public QgsAbstractGeometry
2015-05-15 15:41:56 +02:00
{
%TypeHeaderCode
#include <qgsgeometrycollection.h>
2015-05-15 15:41:56 +02:00
%End
public:
2016-08-06 11:01:42 +02:00
QgsGeometryCollection();
QgsGeometryCollection( const QgsGeometryCollection& c );
//QgsGeometryCollection& operator=( const QgsGeometryCollection& c );
virtual ~QgsGeometryCollection();
2015-05-15 15:41:56 +02:00
virtual QgsGeometryCollection* clone() const /Factory/;
2016-01-28 10:30:06 +01:00
/** Returns the number of geometries within the collection.
*/
2015-05-15 15:41:56 +02:00
int numGeometries() const;
2016-01-28 10:30:06 +01:00
/** Returns a const reference to a geometry from within the collection.
* @param n index of geometry to return
*/
2016-08-06 11:01:42 +02:00
//const QgsAbstractGeometry* geometryN( int n ) const;
2016-01-28 10:30:06 +01:00
/** Returns a geometry from within the collection.
* @param n index of geometry to return
*/
2016-08-06 11:01:42 +02:00
QgsAbstractGeometry* geometryN( int n );
2015-05-15 15:41:56 +02:00
2016-08-06 11:01:42 +02:00
//methods inherited from QgsAbstractGeometry
2015-05-15 15:41:56 +02:00
virtual int dimension() const;
virtual QString geometryType() const;
virtual void clear();
2016-08-06 11:01:42 +02:00
virtual QgsAbstractGeometry* boundary() const /Factory/;
2015-05-15 15:41:56 +02:00
2016-01-28 10:30:06 +01:00
/** Adds a geometry and takes ownership. Returns true in case of success.*/
2016-08-06 11:01:42 +02:00
virtual bool addGeometry( QgsAbstractGeometry* g /Transfer/ );
/** Inserts a geometry before a specified index and takes ownership. Returns true in case of success.
2015-09-09 17:46:36 +10:00
* @param g geometry to insert. Ownership is transferred to the collection.
* @param index position to insert geometry before
2016-02-14 03:50:23 +01:00
*/
2016-08-06 11:01:42 +02:00
virtual bool insertGeometry( QgsAbstractGeometry* g /Transfer/, int index );
2016-01-28 10:30:06 +01:00
/** Removes a geometry from the collection.
* @param nr index of geometry to remove
* @returns true if removal was successful.
*/
2015-05-15 15:41:56 +02:00
virtual bool removeGeometry( int nr );
void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
2015-05-15 15:41:56 +02:00
void transform( const QTransform& t );
2016-01-28 10:30:06 +01:00
//virtual void clip( const QgsRectangle& rect );
2016-01-28 10:30:06 +01:00
2015-05-15 15:41:56 +02:00
virtual void draw( QPainter& p ) const;
bool fromWkb( QgsConstWkbPtr& wkb );
2016-01-28 10:30:06 +01:00
virtual bool fromWkt( const QString& wkt );
QByteArray asWkb() const;
2015-05-15 15:41:56 +02:00
QString asWkt( int precision = 17 ) const;
QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const;
QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const;
QString asJSON( int precision = 17 ) const;
virtual QgsRectangle boundingBox() const;
2015-05-15 15:41:56 +02:00
virtual QList< QList< QList< QgsPointV2 > > > coordinateSequence() const;
virtual int nCoordinates() const;
2015-05-15 15:41:56 +02:00
virtual double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const;
bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const;
//low-level editing
virtual bool insertVertex( QgsVertexId position, const QgsPointV2& vertex );
virtual bool moveVertex( QgsVertexId position, const QgsPointV2& newPos );
virtual bool deleteVertex( QgsVertexId position );
2015-05-15 15:41:56 +02:00
virtual double length() const;
virtual double area() const;
virtual double perimeter() const;
2015-05-29 17:59:52 +02:00
bool hasCurvedSegments() const;
/** Returns a geometry without curves. Caller takes ownership
* @param tolerance segmentation tolerance
* @param toleranceType maximum segmentation angle or maximum difference between approximation and curve*/
QgsAbstractGeometry* segmentize( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/;
2016-01-28 10:30:06 +01:00
/** Returns approximate rotation angle for a vertex. Usually average angle between adjacent segments.
2016-02-14 03:50:23 +01:00
* @param vertex the vertex id
* @return rotation in radians, clockwise from north
*/
double vertexAngle( QgsVertexId vertex ) const;
2016-01-28 10:30:06 +01:00
virtual int vertexCount( int part = 0, int ring = 0 ) const;
virtual int ringCount( int part = 0 ) const;
virtual int partCount() const;
virtual QgsPointV2 vertexAt( QgsVertexId id ) const;
virtual bool addZValue( double zValue = 0 );
virtual bool addMValue( double mValue = 0 );
virtual bool dropZValue();
virtual bool dropMValue();
protected:
/** Returns whether child type names are omitted from Wkt representations of the collection
* @note added in QGIS 2.12
*/
virtual bool wktOmitChildType() const;
/** Reads a collection from a WKT string.
*/
2016-08-06 11:01:42 +02:00
bool fromCollectionWkt( const QString &wkt, const QList<QgsAbstractGeometry*>& subtypes, const QString& defaultChildWkbType = QString() );
virtual QgsRectangle calculateBoundingBox() const;
virtual void clearCache() const;
2015-05-15 15:41:56 +02:00
};