class QgsCurvePolygon: public QgsSurface { %TypeHeaderCode #include %End public: QgsCurvePolygon(); QgsCurvePolygon( const QgsCurvePolygon& p ); //QgsCurvePolygon& operator=( const QgsCurvePolygon& p ); ~QgsCurvePolygon(); virtual QString geometryType() const; virtual int dimension() const; virtual QgsCurvePolygon* clone() const /Factory/; void clear(); virtual bool fromWkb( QgsConstWkbPtr& wkb ); virtual bool fromWkt( const QString& wkt ); QByteArray asWkb() 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; //surface interface virtual double area() const; virtual double perimeter() const; QgsPolygonV2* surfaceToPolygon() const /Factory/; virtual QgsAbstractGeometry* boundary() const /Factory/; //curve polygon interface int numInteriorRings() const; const QgsCurve* exteriorRing() const; const QgsCurve* interiorRing( int i ) const; /** Returns a new polygon geometry corresponding to a segmentized approximation * of the curve. * @param tolerance segmentation tolerance * @param toleranceType maximum segmentation angle or maximum difference between approximation and curve*/ virtual QgsPolygonV2* toPolygon( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const; /** Sets the exterior ring of the polygon. The CurvePolygon type will be updated to match the dimensionality * of the exterior ring. For instance, setting a 2D exterior ring on a 3D CurvePolygon will drop the z dimension * from the CurvePolygon and all interior rings. * @param ring new exterior ring. Ownership is transferred to the CurvePolygon. * @see setInteriorRings() * @see exteriorRing() */ virtual void setExteriorRing( QgsCurve* ring /Transfer/ ); /** Sets all interior rings (takes ownership)*/ void setInteriorRings( const QList& rings ); /** Adds an interior ring to the geometry (takes ownership)*/ virtual void addInteriorRing( QgsCurve* ring /Transfer/ ); /** * Removes an interior ring from the polygon. The first interior ring has index 0. * The corresponding ring is removed from the polygon and deleted. If a ring was successfully removed * the function will return true. It is not possible to remove the exterior ring using this method. * @see removeInteriorRings() */ bool removeInteriorRing( int ringIndex ); /** * Removes the interior rings from the polygon. If the minimumAllowedArea * parameter is specified then only rings smaller than this minimum * area will be removed. * @note added in QGIS 3.0 * @see removeInteriorRing() */ void removeInteriorRings( double minimumAllowedArea = -1 ); virtual void draw( QPainter& p ) const; void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ); void transform( const QTransform& t ); virtual bool insertVertex( QgsVertexId position, const QgsPointV2& vertex ); virtual bool moveVertex( QgsVertexId position, const QgsPointV2& newPos ); virtual bool deleteVertex( QgsVertexId position ); virtual QList< QList< QList< QgsPointV2 > > > coordinateSequence() const; virtual int nCoordinates() const; bool isEmpty() const; double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const; bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const; 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/; /** Returns approximate rotation angle for a vertex. Usually average angle between adjacent segments. * @param vertex the vertex id * @return rotation in radians, clockwise from north */ double vertexAngle( QgsVertexId vertex ) const; virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const; virtual int ringCount( int /*part*/ = 0 ) const; virtual int partCount() const; virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const; virtual bool addZValue( double zValue = 0 ); virtual bool addMValue( double mValue = 0 ); virtual bool dropZValue(); virtual bool dropMValue(); protected: virtual QgsRectangle calculateBoundingBox() const; };