|
| 1 | +/** \ingroup core |
| 2 | + * \class QgsPointV2 |
| 3 | + * \brief Point geometry type, with support for z-dimension and m-values. |
| 4 | + * \note added in QGIS 2.10 |
| 5 | + */ |
| 6 | + |
1 | 7 | class QgsPointV2: public QgsAbstractGeometryV2
|
2 | 8 | {
|
3 | 9 | %TypeHeaderCode
|
4 | 10 | #include <qgspointv2.h>
|
5 | 11 | %End
|
6 | 12 |
|
7 |
| - public: |
8 |
| - QgsPointV2( double x = 0.0, double y = 0.0 ); |
9 |
| - QgsPointV2( const QgsPoint& p ); |
10 |
| - QgsPointV2( QgsWKBTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 ); |
11 |
| - |
12 |
| - bool operator==( const QgsPointV2& pt ) const; |
13 |
| - bool operator!=( const QgsPointV2& pt ) const; |
14 |
| - |
15 |
| - virtual QgsPointV2* clone() const; |
16 |
| - void clear(); |
17 |
| - |
18 |
| - double x() const; |
19 |
| - double y() const; |
20 |
| - double z() const; |
21 |
| - double m() const; |
22 |
| - |
23 |
| - void setX( double x ); |
24 |
| - void setY( double y ); |
25 |
| - void setZ( double z ); |
26 |
| - void setM( double m ); |
27 |
| - |
28 |
| - virtual QString geometryType() const; |
29 |
| - |
30 |
| - //implementation of inherited methods |
31 |
| - virtual int dimension() const; |
32 |
| - |
33 |
| - |
34 |
| - virtual bool fromWkb( const unsigned char* wkb ); |
35 |
| - virtual bool fromWkt( const QString& wkt ); |
36 |
| - |
37 |
| - int wkbSize() const; |
38 |
| - unsigned char* asWkb( int& binarySize ) const; |
39 |
| - QString asWkt( int precision = 17 ) const; |
40 |
| - QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const; |
41 |
| - QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const; |
42 |
| - QString asJSON( int precision = 17 ) const; |
43 |
| - |
44 |
| - virtual QgsRectangle calculateBoundingBox() const; |
45 |
| - |
46 |
| - void draw( QPainter& p ) const; |
47 |
| - void transform( const QgsCoordinateTransform& ct ); |
48 |
| - void transform( const QTransform& t ); |
49 |
| - |
50 |
| - virtual void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord /Out/ ) const; |
51 |
| - |
52 |
| - //low-level editing |
53 |
| - virtual bool insertVertex( const QgsVertexId& position, const QgsPointV2& vertex ); |
54 |
| - virtual bool moveVertex( const QgsVertexId& position, const QgsPointV2& newPos ); |
55 |
| - virtual bool deleteVertex( const QgsVertexId& position ); |
56 |
| - |
57 |
| - double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const; |
58 |
| - bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const; |
59 |
| - |
60 |
| - /** Angle undefined. Always returns 0.0 |
61 |
| - @param vertex the vertex id |
62 |
| - @return 0.0*/ |
63 |
| - double vertexAngle( const QgsVertexId& vertex ) const; |
64 |
| - |
65 |
| - virtual int vertexCount(int part = 0, int ring = 0) const; |
66 |
| - virtual int ringCount(int part = 0) const; |
67 |
| - virtual int partCount() const; |
68 |
| - virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const; |
69 |
| - |
70 |
| - virtual bool addZValue( double zValue = 0 ); |
71 |
| - virtual bool addMValue( double mValue = 0 ); |
| 13 | + public: |
| 14 | + |
| 15 | + /** Construct a 2 dimensional point with an initial x and y coordinate. |
| 16 | + * @param x x-coordinate of point |
| 17 | + * @param y y-coordinate of point |
| 18 | + */ |
| 19 | + QgsPointV2( double x = 0.0, double y = 0.0 ); |
| 20 | + |
| 21 | + /** Construct a QgsPointV2 from a QgsPoint object |
| 22 | + */ |
| 23 | + QgsPointV2( const QgsPoint& p ); |
| 24 | + |
| 25 | + /** Construct a point with a specified type (eg PointZ, PointM) and initial x, y, z, and m values. |
| 26 | + * @param type point type |
| 27 | + * @param x x-coordinate of point |
| 28 | + * @param y y-coordinate of point |
| 29 | + * @param z z-coordinate of point, for PointZ or PointZM types |
| 30 | + * @param m m-value of point, for PointM or PointZM types |
| 31 | + */ |
| 32 | + QgsPointV2( QgsWKBTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 ); |
| 33 | + |
| 34 | + bool operator==( const QgsPointV2& pt ) const; |
| 35 | + bool operator!=( const QgsPointV2& pt ) const; |
| 36 | + |
| 37 | + /** Returns the point's x-coordinate. |
| 38 | + * @see setX() |
| 39 | + * @see rx() |
| 40 | + */ |
| 41 | + double x() const; |
| 42 | + |
| 43 | + /** Returns the point's y-coordinate. |
| 44 | + * @see setY() |
| 45 | + * @see ry() |
| 46 | + */ |
| 47 | + double y() const; |
| 48 | + |
| 49 | + /** Returns the point's z-coordinate. |
| 50 | + * @see setZ() |
| 51 | + * @see rz() |
| 52 | + */ |
| 53 | + double z() const; |
| 54 | + |
| 55 | + /** Returns the point's m value. |
| 56 | + * @see setM() |
| 57 | + * @see rm() |
| 58 | + */ |
| 59 | + double m() const; |
| 60 | + |
| 61 | + /** Returns a reference to the x-coordinate of this point. |
| 62 | + * Using a reference makes it possible to directly manipulate x in place. |
| 63 | + * @see x() |
| 64 | + * @see setX() |
| 65 | + * @note not available in Python bindings |
| 66 | + */ |
| 67 | + //double &rx(); |
| 68 | + |
| 69 | + /** Returns a reference to the y-coordinate of this point. |
| 70 | + * Using a reference makes it possible to directly manipulate y in place. |
| 71 | + * @see y() |
| 72 | + * @see setY() |
| 73 | + * @note not available in Python bindings |
| 74 | + */ |
| 75 | + //double &ry(); |
| 76 | + |
| 77 | + /** Returns a reference to the z-coordinate of this point. |
| 78 | + * Using a reference makes it possible to directly manipulate z in place. |
| 79 | + * @see z() |
| 80 | + * @see setZ() |
| 81 | + * @note not available in Python bindings |
| 82 | + */ |
| 83 | + //double &rz(); |
| 84 | + |
| 85 | + /** Returns a reference to the m value of this point. |
| 86 | + * Using a reference makes it possible to directly manipulate m in place. |
| 87 | + * @see m() |
| 88 | + * @see setM() |
| 89 | + * @note not available in Python bindings |
| 90 | + */ |
| 91 | + //double &rm() |
| 92 | + |
| 93 | + /** Sets the point's x-coordinate. |
| 94 | + * @see x() |
| 95 | + * @see rx() |
| 96 | + */ |
| 97 | + void setX( double x ); |
| 98 | + |
| 99 | + /** Sets the point's y-coordinate. |
| 100 | + * @see y() |
| 101 | + * @see ry() |
| 102 | + */ |
| 103 | + void setY( double y ); |
| 104 | + |
| 105 | + /** Sets the point's z-coordinate. |
| 106 | + * @see z() |
| 107 | + * @see rz() |
| 108 | + */ |
| 109 | + void setZ( double z ); |
| 110 | + |
| 111 | + /** Sets the point's m-value. |
| 112 | + * @see m() |
| 113 | + * @see rm() |
| 114 | + */ |
| 115 | + void setM( double m ); |
| 116 | + |
| 117 | + //implementation of inherited methods |
| 118 | + virtual QString geometryType() const; |
| 119 | + virtual int dimension() const; |
| 120 | + virtual QgsPointV2* clone() const; |
| 121 | + void clear(); |
| 122 | + virtual bool fromWkb( const unsigned char* wkb ); |
| 123 | + virtual bool fromWkt( const QString& wkt ); |
| 124 | + int wkbSize() const; |
| 125 | + unsigned char* asWkb( int& binarySize ) const; |
| 126 | + QString asWkt( int precision = 17 ) const; |
| 127 | + QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const; |
| 128 | + QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const; |
| 129 | + QString asJSON( int precision = 17 ) const; |
| 130 | + virtual QgsRectangle calculateBoundingBox() const; |
| 131 | + void draw( QPainter& p ) const; |
| 132 | + void transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform ); |
| 133 | + void transform( const QTransform& t ); |
| 134 | + virtual void coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord /Out/ ) const; |
| 135 | + |
| 136 | + //low-level editing |
| 137 | + virtual bool insertVertex( const QgsVertexId& position, const QgsPointV2& vertex ); |
| 138 | + virtual bool moveVertex( const QgsVertexId& position, const QgsPointV2& newPos ); |
| 139 | + virtual bool deleteVertex( const QgsVertexId& position ); |
| 140 | + |
| 141 | + double closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const; |
| 142 | + bool nextVertex( QgsVertexId& id, QgsPointV2& vertex ) const; |
| 143 | + |
| 144 | + /** Angle undefined. Always returns 0.0 |
| 145 | + @param vertex the vertex id |
| 146 | + @return 0.0*/ |
| 147 | + double vertexAngle( const QgsVertexId& vertex ) const; |
| 148 | + |
| 149 | + virtual int vertexCount(int part = 0, int ring = 0) const; |
| 150 | + virtual int ringCount(int part = 0) const; |
| 151 | + virtual int partCount() const; |
| 152 | + virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const; |
| 153 | + |
| 154 | + virtual bool addZValue( double zValue = 0 ); |
| 155 | + virtual bool addMValue( double mValue = 0 ); |
72 | 156 | };
|
0 commit comments