2015-05-15 15:41:56 +02:00
|
|
|
class QgsGeometryCollectionV2: public QgsAbstractGeometryV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsgeometrycollectionv2.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
QgsGeometryCollectionV2();
|
|
|
|
QgsGeometryCollectionV2( const QgsGeometryCollectionV2& c );
|
|
|
|
//QgsGeometryCollectionV2& operator=( const QgsGeometryCollectionV2& c );
|
|
|
|
virtual ~QgsGeometryCollectionV2();
|
|
|
|
|
2015-09-09 17:45:31 +02:00
|
|
|
virtual QgsGeometryCollectionV2* clone() const;
|
|
|
|
|
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
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
//const QgsAbstractGeometryV2* 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
|
|
|
|
*/
|
2015-05-15 15:41:56 +02:00
|
|
|
QgsAbstractGeometryV2* geometryN( int n );
|
|
|
|
|
|
|
|
//methods inherited from QgsAbstractGeometry
|
|
|
|
virtual int dimension() const;
|
|
|
|
virtual QString geometryType() const;
|
|
|
|
virtual void clear();
|
|
|
|
|
2016-01-28 10:30:06 +01:00
|
|
|
/** Adds a geometry and takes ownership. Returns true in case of success.*/
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual bool addGeometry( QgsAbstractGeometryV2* g /Transfer/ );
|
2015-09-09 16:11:09 +10:00
|
|
|
|
|
|
|
/** 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.
|
2015-09-09 16:11:09 +10:00
|
|
|
* @param index position to insert geometry before
|
|
|
|
*/
|
|
|
|
virtual bool insertGeometry( QgsAbstractGeometryV2* 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 );
|
|
|
|
|
2016-01-28 10:30:06 +01:00
|
|
|
/** Transforms the geometry using a coordinate transform
|
|
|
|
* @param ct coordinate transform
|
|
|
|
* @param d transformation direction
|
|
|
|
*/
|
2015-08-17 17:14:05 +02:00
|
|
|
virtual void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform );
|
2015-05-15 15:41:56 +02:00
|
|
|
void transform( const QTransform& t );
|
2016-01-28 10:30:06 +01:00
|
|
|
|
2015-06-22 21:57:01 +10: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;
|
|
|
|
|
2016-01-31 18:09:13 +01:00
|
|
|
bool fromWkb( QgsConstWkbPtr wkb );
|
2016-01-28 10:30:06 +01:00
|
|
|
virtual bool fromWkt( const QString& wkt );
|
2015-05-15 15:41:56 +02:00
|
|
|
int wkbSize() const;
|
|
|
|
unsigned char* asWkb( int& binarySize ) const;
|
|
|
|
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 calculateBoundingBox() const;
|
|
|
|
|
|
|
|
virtual void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord /Out/ ) const;
|
|
|
|
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
|
2016-02-02 19:46:18 +11:00
|
|
|
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;
|
2015-10-17 15:40:36 +11:00
|
|
|
virtual double perimeter() const;
|
2015-05-29 17:59:52 +02:00
|
|
|
|
|
|
|
bool hasCurvedSegments() const;
|
2015-09-04 14:53:06 +02:00
|
|
|
|
2016-01-28 10:30:06 +01:00
|
|
|
/** Returns a geometry without curves. Caller takes ownership*/
|
|
|
|
QgsAbstractGeometryV2* segmentize() const;
|
|
|
|
|
2015-09-04 14:53:06 +02:00
|
|
|
/** Returns approximate rotation angle for a vertex. Usually average angle between adjacent segments.
|
2015-09-04 17:23:41 +02:00
|
|
|
@param vertex the vertex id
|
2015-09-04 14:53:06 +02:00
|
|
|
@return rotation in radians, clockwise from north*/
|
2016-02-02 19:46:18 +11:00
|
|
|
double vertexAngle( QgsVertexId vertex ) const;
|
2015-09-09 17:45:31 +02:00
|
|
|
|
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;
|
2015-09-09 17:45:31 +02:00
|
|
|
virtual int partCount() const;
|
2016-02-02 19:46:18 +11:00
|
|
|
virtual QgsPointV2 vertexAt( QgsVertexId id ) const;
|
2015-10-14 08:21:54 +11:00
|
|
|
|
|
|
|
virtual bool addZValue( double zValue = 0 );
|
|
|
|
virtual bool addMValue( double mValue = 0 );
|
2015-12-01 16:33:44 +11:00
|
|
|
virtual bool dropZValue();
|
|
|
|
virtual bool dropMValue();
|
2015-10-16 07:48:42 +11:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/** Returns whether child type names are omitted from Wkt representations of the collection
|
|
|
|
* @note added in QGIS 2.12
|
|
|
|
*/
|
|
|
|
virtual bool wktOmitChildType() const;
|
|
|
|
|
2016-01-04 22:51:18 +11:00
|
|
|
/** Reads a collection from a WKT string.
|
|
|
|
*/
|
|
|
|
bool fromCollectionWkt( const QString &wkt, const QList<QgsAbstractGeometryV2*>& subtypes, const QString& defaultChildWkbType = QString() );
|
|
|
|
|
2015-05-15 15:41:56 +02:00
|
|
|
};
|