/
qgsabstractgeometryv2.sip
123 lines (103 loc) · 4.57 KB
/
qgsabstractgeometryv2.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
struct QgsVertexId
{
%TypeHeaderCode
#include <qgsabstractgeometryv2.h>
%End
enum VertexType
{
SegmentVertex, //start / endpoint of a segment
CurveVertex
};
QgsVertexId();
QgsVertexId( int _part, int _ring, int _vertex, VertexType _type );
bool isValid() const;
int part;
int ring;
int vertex;
VertexType type;
};
class QgsAbstractGeometryV2
{
%TypeHeaderCode
#include <qgsabstractgeometryv2.h>
#include <qgslinestringv2.h>
%End
%ConvertToSubClassCode
if (dynamic_cast<QgsPointV2*>(sipCpp) != NULL)
sipClass = sipClass_QgsPointV2;
else if (dynamic_cast<QgsLineStringV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsLineStringV2;
else if (dynamic_cast<QgsCircularStringV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsCircularStringV2;
else if (dynamic_cast<QgsCompoundCurveV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsCompoundCurveV2;
else if (dynamic_cast<QgsPolygonV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsPolygonV2;
else if (dynamic_cast<QgsCurvePolygonV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsCurvePolygonV2;
else if (dynamic_cast<QgsMultiPointV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsMultiPointV2;
else if (dynamic_cast<QgsLineStringV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsLineStringV2;
else if (dynamic_cast<QgsMultiPolygonV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsMultiPolygonV2;
else if (dynamic_cast<QgsMultiSurfaceV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsMultiSurfaceV2;
else if (dynamic_cast<QgsMultiCurveV2*>(sipCpp) != NULL )
sipClass = sipClass_QgsMultiCurveV2;
else
sipClass = 0;
%End
public:
QgsAbstractGeometryV2();
virtual ~QgsAbstractGeometryV2();
QgsAbstractGeometryV2( const QgsAbstractGeometryV2& geom );
//virtual QgsAbstractGeometryV2& operator=( const QgsAbstractGeometryV2& geom );
virtual QgsAbstractGeometryV2* clone() const = 0;
virtual void clear() = 0;
QgsRectangle boundingBox() const;
//mm-sql interface
virtual int dimension() const = 0;
//virtual int coordDim() const { return mCoordDimension; }
virtual QString geometryType() const = 0;
QgsWKBTypes::Type wkbType() const;
QString wktTypeStr() const;
bool is3D() const;
bool isMeasure() const;
//import
virtual bool fromWkb( const unsigned char * wkb ) = 0;
virtual bool fromWkt( const QString& wkt ) = 0;
//export
virtual int wkbSize() const = 0;
virtual unsigned char* asWkb( int& binarySize ) const = 0;
virtual QString asWkt( int precision = 17 ) const = 0;
virtual QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const = 0;
virtual QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const = 0;
virtual QString asJSON( int precision = 17 ) const = 0;
virtual QgsRectangle calculateBoundingBox() const;
//render pipeline
virtual void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform ) = 0;
virtual void transform( const QTransform& t ) = 0;
//virtual void clip( const QgsRectangle& rect );
virtual void draw( QPainter& p ) const = 0;
/** Returns next vertex id and coordinates
@return false if at end*/
virtual bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const = 0;
virtual void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord /Out/ ) const = 0;
int nCoordinates() const;
QgsPointV2 vertexAt( const QgsVertexId& id ) const;
virtual double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const = 0;
//low-level editing
virtual bool insertVertex( const QgsVertexId& position, const QgsPointV2& vertex ) = 0;
virtual bool moveVertex( const QgsVertexId& position, const QgsPointV2& newPos ) = 0;
virtual bool deleteVertex( const QgsVertexId& position ) = 0;
/** Length for linear geometries,perimeter for area geometries*/
virtual double length() const;
virtual double area() const;
virtual bool hasCurvedSegments() const;
/** Returns a geometry without curves. Caller takes ownership*/
virtual QgsAbstractGeometryV2* segmentize() const /Factory/;
/** Returns approximate rotation angle for a vertex. Usually average angle between adjacent segments.
@return rotation in radians, clockwise from north*/
virtual double vertexAngle( const QgsVertexId& vertex ) const = 0;
};