2015-05-15 15:41:56 +02:00
|
|
|
class QgsCurvePolygonV2: public QgsSurfaceV2
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgscurvepolygonv2.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
QgsCurvePolygonV2();
|
|
|
|
QgsCurvePolygonV2( const QgsCurvePolygonV2& p );
|
|
|
|
//QgsCurvePolygonV2& operator=( const QgsCurvePolygonV2& p );
|
|
|
|
~QgsCurvePolygonV2();
|
|
|
|
|
|
|
|
virtual QString geometryType() const;
|
|
|
|
virtual int dimension() const;
|
2015-09-09 17:45:31 +02:00
|
|
|
virtual QgsCurvePolygonV2* clone() const;
|
2015-05-15 15:41:56 +02:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
|
|
virtual QgsRectangle calculateBoundingBox() const;
|
2016-01-31 18:09:13 +01:00
|
|
|
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;
|
2015-10-17 15:40:36 +11:00
|
|
|
virtual double perimeter() const;
|
2015-05-15 15:41:56 +02:00
|
|
|
QgsPolygonV2* surfaceToPolygon() const;
|
|
|
|
|
|
|
|
//curve polygon interface
|
|
|
|
int numInteriorRings() const;
|
2015-09-09 17:45:31 +02:00
|
|
|
QgsCurveV2* exteriorRing() const;
|
|
|
|
QgsCurveV2* interiorRing( int i ) const;
|
2015-05-15 15:41:56 +02:00
|
|
|
virtual QgsPolygonV2* toPolygon() const;
|
|
|
|
|
2015-12-15 22:36:41 +11: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
|
|
|
*/
|
2015-12-15 22:36:41 +11:00
|
|
|
virtual void setExteriorRing( QgsCurveV2* ring /Transfer/ );
|
|
|
|
|
2016-01-28 10:30:06 +01:00
|
|
|
/** Sets all interior rings (takes ownership)*/
|
2015-10-07 11:55:34 +11:00
|
|
|
void setInteriorRings( const QList<QgsCurveV2*>& rings );
|
2016-01-28 10:30:06 +01:00
|
|
|
/** Adds an interior ring to the geometry (takes ownership)*/
|
2015-12-11 18:37:52 +11:00
|
|
|
virtual void addInteriorRing( QgsCurveV2* 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;
|
2016-01-28 10:30:06 +01:00
|
|
|
/** Transforms the geometry using a coordinate transform
|
|
|
|
* @param ct coordinate transform
|
2016-02-14 03:50:23 +01:00
|
|
|
* @param d transformation direction
|
2016-01-28 10:30:06 +01:00
|
|
|
*/
|
2015-08-17 17:14:05 +02:00
|
|
|
void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform );
|
2015-05-15 15:41:56 +02:00
|
|
|
void transform( const QTransform& t );
|
|
|
|
|
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 void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord /Out/ ) const;
|
|
|
|
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;
|
|
|
|
QgsAbstractGeometryV2* segmentize() const /Factory/;
|
2015-09-04 14:53:06 +02: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
|
|
|
|
*/
|
2016-02-02 19:46:18 +11:00
|
|
|
double vertexAngle( QgsVertexId vertex ) const;
|
2015-09-09 17:45:31 +02:00
|
|
|
|
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;
|
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-05-15 15:41:56 +02:00
|
|
|
};
|