QGIS/python/core/geometry/qgscurvepolygon.sip

100 lines
4.3 KiB
Plaintext
Raw Normal View History

2016-08-06 11:01:42 +02:00
class QgsCurvePolygon: public QgsSurface
2015-05-15 15:41:56 +02:00
{
%TypeHeaderCode
#include <qgscurvepolygon.h>
2015-05-15 15:41:56 +02:00
%End
public:
2016-08-06 11:01:42 +02:00
QgsCurvePolygon();
QgsCurvePolygon( const QgsCurvePolygon& p );
//QgsCurvePolygon& operator=( const QgsCurvePolygon& p );
~QgsCurvePolygon();
2015-05-15 15:41:56 +02:00
virtual QString geometryType() const;
virtual int dimension() const;
2016-08-06 11:01:42 +02:00
virtual QgsCurvePolygon* clone() const;
2015-05-15 15:41:56 +02:00
void clear();
virtual bool fromWkb( QgsConstWkbPtr wkb );
2015-05-15 15:41:56 +02:00
virtual bool fromWkt( const QString& wkt );
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;
//surface interface
virtual double area() const;
virtual double perimeter() const;
2015-05-15 15:41:56 +02:00
QgsPolygonV2* surfaceToPolygon() const;
2016-08-06 11:01:42 +02:00
virtual QgsAbstractGeometry* boundary() const /Factory/;
2015-05-15 15:41:56 +02:00
//curve polygon interface
int numInteriorRings() const;
2016-08-06 11:01:42 +02:00
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;
2015-05-15 15:41:56 +02:00
/** 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()
2016-02-14 03:50:23 +01:00
*/
2016-08-06 11:01:42 +02:00
virtual void setExteriorRing( QgsCurve* ring /Transfer/ );
2016-01-28 10:30:06 +01:00
/** Sets all interior rings (takes ownership)*/
2016-08-06 11:01:42 +02:00
void setInteriorRings( const QList<QgsCurve*>& rings );
2016-01-28 10:30:06 +01:00
/** Adds an interior ring to the geometry (takes ownership)*/
2016-08-06 11:01:42 +02:00
virtual void addInteriorRing( QgsCurve* ring /Transfer/ );
2015-07-29 11:52:14 +02:00
/** Removes ring. Exterior ring is 0, first interior ring 1, ...*/
2015-05-15 15:41:56 +02:00
bool removeInteriorRing( int nr );
virtual void draw( QPainter& p ) const;
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 );
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 QList< QList< QList< QgsPointV2 > > > coordinateSequence() const;
2015-05-15 15:41:56 +02:00
double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const;
bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) 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*/
2016-08-06 11:01:42 +02:00
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.
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-02-14 03:50:23 +01:00
virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const;
2016-01-28 10:30:06 +01:00
virtual int ringCount( int /*part*/ = 0 ) const;
virtual int partCount() const;
2016-03-14 17:17:12 +01:00
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;
2015-05-15 15:41:56 +02:00
};