|
1 |
| -/** \ingroup core |
2 |
| - * A class to represent a point. |
3 |
| - * Currently no Z axis / 2.5D support is implemented. |
4 |
| - */ |
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/qgspoint.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
5 | 15 | class QgsPoint
|
6 | 16 | {
|
| 17 | +%Docstring |
| 18 | + A class to represent a point. |
| 19 | + For Z and M support prefer QgsPointV2. |
| 20 | +%End |
7 | 21 |
|
8 | 22 | %TypeHeaderCode
|
9 |
| -#include <qgspoint.h> |
10 |
| -#include <QString> |
| 23 | +#include "qgspoint.h" |
11 | 24 | %End
|
12 |
| - |
13 | 25 | public:
|
14 |
| - /// Default constructor |
15 | 26 | QgsPoint();
|
16 | 27 |
|
17 |
| - /** Create a point from another point */ |
18 |
| - QgsPoint( const QgsPoint& p ); |
| 28 | + QgsPoint( const QgsPoint &p ); |
| 29 | +%Docstring |
| 30 | +Create a point from another point |
| 31 | +%End |
19 | 32 |
|
20 |
| - /** Create a point from x,y coordinates |
21 |
| - * @param x x coordinate |
22 |
| - * @param y y coordinate |
23 |
| - */ |
24 | 33 | QgsPoint( double x, double y );
|
| 34 | +%Docstring |
| 35 | + Create a point from x,y coordinates |
| 36 | + \param x x coordinate |
| 37 | + \param y y coordinate |
| 38 | +%End |
25 | 39 |
|
26 |
| - /** Create a point from a QPointF |
27 |
| - * @param point QPointF source |
28 |
| - * @note added in QGIS 2.7 |
29 |
| - */ |
30 | 40 | QgsPoint( QPointF point );
|
| 41 | +%Docstring |
| 42 | + Create a point from a QPointF |
| 43 | + \param point QPointF source |
| 44 | +.. versionadded:: 2.7 |
| 45 | +%End |
31 | 46 |
|
32 |
| - /** Create a point from a QPoint |
33 |
| - * @param point QPoint source |
34 |
| - * @note added in QGIS 2.7 |
35 |
| - */ |
36 | 47 | QgsPoint( QPoint point );
|
| 48 | +%Docstring |
| 49 | + Create a point from a QPoint |
| 50 | + \param point QPoint source |
| 51 | +.. versionadded:: 2.7 |
| 52 | +%End |
| 53 | + |
| 54 | + QgsPoint( const QgsPointV2 &point ); |
| 55 | +%Docstring |
| 56 | + Create a new point. |
| 57 | + Z and M values will be dropped. |
| 58 | + |
| 59 | +.. versionadded:: 3.0 |
| 60 | +%End |
37 | 61 |
|
38 | 62 | ~QgsPoint();
|
39 | 63 |
|
40 |
| - /** Sets the x value of the point |
41 |
| - * @param x x coordinate |
42 |
| - */ |
43 | 64 | void setX( double x );
|
| 65 | +%Docstring |
| 66 | + Sets the x value of the point |
| 67 | + \param x x coordinate |
| 68 | +%End |
44 | 69 |
|
45 |
| - /** Sets the y value of the point |
46 |
| - * @param y y coordinate |
47 |
| - */ |
48 | 70 | void setY( double y );
|
| 71 | +%Docstring |
| 72 | + Sets the y value of the point |
| 73 | + \param y y coordinate |
| 74 | +%End |
49 | 75 |
|
50 |
| - /** Sets the x and y value of the point */ |
51 | 76 | void set( double x, double y );
|
| 77 | +%Docstring |
| 78 | +Sets the x and y value of the point |
| 79 | +%End |
52 | 80 |
|
53 |
| - /** Get the x value of the point |
54 |
| - * @return x coordinate |
55 |
| - */ |
56 | 81 | double x() const;
|
| 82 | +%Docstring |
| 83 | + Get the x value of the point |
| 84 | + :return: x coordinate |
| 85 | + :rtype: float |
| 86 | +%End |
57 | 87 |
|
58 |
| - /** Get the y value of the point |
59 |
| - * @return y coordinate |
60 |
| - */ |
61 | 88 | double y() const;
|
| 89 | +%Docstring |
| 90 | + Get the y value of the point |
| 91 | + :return: y coordinate |
| 92 | + :rtype: float |
| 93 | +%End |
62 | 94 |
|
63 |
| - /** Converts a point to a QPointF |
64 |
| - * @returns QPointF with same x and y values |
65 |
| - * @note added in QGIS 2.7 |
66 |
| - */ |
67 | 95 | QPointF toQPointF() const;
|
| 96 | +%Docstring |
| 97 | + Converts a point to a QPointF |
| 98 | + :return: QPointF with same x and y values |
| 99 | +.. versionadded:: 2.7 |
| 100 | + :rtype: QPointF |
| 101 | +%End |
68 | 102 |
|
69 |
| - //! String representation of the point (x,y) |
70 | 103 | QString toString() const;
|
| 104 | +%Docstring |
| 105 | +String representation of the point (x,y) |
| 106 | + :rtype: str |
| 107 | +%End |
71 | 108 |
|
72 |
| - //! As above but with precision for string representation of a point |
73 | 109 | QString toString( int precision ) const;
|
| 110 | +%Docstring |
| 111 | +As above but with precision for string representation of a point |
| 112 | + :rtype: str |
| 113 | +%End |
74 | 114 |
|
75 |
| - /** Return a string representation as degrees minutes seconds. |
76 |
| - * Its up to the calling function to ensure that this point can |
77 |
| - * be meaningfully represented in this form. |
78 |
| - * @param precision number of decimal points to use for seconds |
79 |
| - * @param useSuffix set to true to include a direction suffix (e.g., 'N'), |
80 |
| - * set to false to use a "-" prefix for west and south coordinates |
81 |
| - * @param padded set to true to force minutes and seconds to use two decimals, |
82 |
| - * e.g., '05' instead of '5'. |
83 |
| - */ |
84 | 115 | QString toDegreesMinutesSeconds( int precision, const bool useSuffix = true, const bool padded = false ) const;
|
| 116 | +%Docstring |
| 117 | + Return a string representation as degrees minutes seconds. |
| 118 | + Its up to the calling function to ensure that this point can |
| 119 | + be meaningfully represented in this form. |
| 120 | + \param precision number of decimal points to use for seconds |
| 121 | + \param useSuffix set to true to include a direction suffix (e.g., 'N'), |
| 122 | + set to false to use a "-" prefix for west and south coordinates |
| 123 | + \param padded set to true to force minutes and seconds to use two decimals, |
| 124 | + e.g., '05' instead of '5'. |
| 125 | + :rtype: str |
| 126 | +%End |
85 | 127 |
|
86 |
| - /** Return a string representation as degrees minutes. |
87 |
| - * Its up to the calling function to ensure that this point can |
88 |
| - * be meaningfully represented in this form. |
89 |
| - * @param precision number of decimal points to use for minutes |
90 |
| - * @param useSuffix set to true to include a direction suffix (e.g., 'N'), |
91 |
| - * set to false to use a "-" prefix for west and south coordinates |
92 |
| - * @param padded set to true to force minutes to use two decimals, |
93 |
| - * e.g., '05' instead of '5'. |
94 |
| - */ |
95 | 128 | QString toDegreesMinutes( int precision, const bool useSuffix = true, const bool padded = false ) const;
|
| 129 | +%Docstring |
| 130 | + Return a string representation as degrees minutes. |
| 131 | + Its up to the calling function to ensure that this point can |
| 132 | + be meaningfully represented in this form. |
| 133 | + \param precision number of decimal points to use for minutes |
| 134 | + \param useSuffix set to true to include a direction suffix (e.g., 'N'), |
| 135 | + set to false to use a "-" prefix for west and south coordinates |
| 136 | + \param padded set to true to force minutes to use two decimals, |
| 137 | + e.g., '05' instead of '5'. |
| 138 | + :rtype: str |
| 139 | +%End |
96 | 140 |
|
97 | 141 |
|
98 |
| - /** Return the well known text representation for the point. |
99 |
| - * The wkt is created without an SRID. |
100 |
| - * @return Well known text in the form POINT(x y) |
101 |
| - */ |
102 | 142 | QString wellKnownText() const;
|
| 143 | +%Docstring |
| 144 | + Return the well known text representation for the point. |
| 145 | + The wkt is created without an SRID. |
| 146 | + :return: Well known text in the form POINT(x y) |
| 147 | + :rtype: str |
| 148 | +%End |
103 | 149 |
|
104 |
| - /** Returns the squared distance between this point a specified x, y coordinate. |
105 |
| - * @see distance() |
106 |
| - */ |
107 | 150 | double sqrDist( double x, double y ) const;
|
| 151 | +%Docstring |
| 152 | + Returns the squared distance between this point a specified x, y coordinate. |
| 153 | +.. seealso:: distance() |
| 154 | + :rtype: float |
| 155 | +%End |
| 156 | + |
| 157 | + double sqrDist( const QgsPoint &other ) const; |
| 158 | +%Docstring |
| 159 | + Returns the squared distance between this point another point. |
| 160 | +.. seealso:: distance() |
| 161 | + :rtype: float |
| 162 | +%End |
108 | 163 |
|
109 |
| - /** Returns the squared distance between this point another point. |
110 |
| - * @see distance() |
111 |
| - */ |
112 |
| - double sqrDist( const QgsPoint& other ) const; |
113 |
| - |
114 |
| - /** Returns the distance between this point and a specified x, y coordinate. |
115 |
| - * @param x x-coordniate |
116 |
| - * @param y y-coordinate |
117 |
| - * @see sqrDist() |
118 |
| - * @note added in QGIS 2.16 |
119 |
| - */ |
120 | 164 | double distance( double x, double y ) const;
|
| 165 | +%Docstring |
| 166 | + Returns the distance between this point and a specified x, y coordinate. |
| 167 | + \param x x-coordniate |
| 168 | + \param y y-coordinate |
| 169 | +.. seealso:: sqrDist() |
| 170 | +.. versionadded:: 2.16 |
| 171 | + :rtype: float |
| 172 | +%End |
| 173 | + |
| 174 | + double distance( const QgsPoint &other ) const; |
| 175 | +%Docstring |
| 176 | + Returns the distance between this point and another point. |
| 177 | + \param other other point |
| 178 | +.. seealso:: sqrDist() |
| 179 | +.. versionadded:: 2.16 |
| 180 | + :rtype: float |
| 181 | +%End |
| 182 | + |
| 183 | + double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint &minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; |
| 184 | +%Docstring |
| 185 | +Returns the minimum distance between this point and a segment |
| 186 | + :rtype: float |
| 187 | +%End |
| 188 | + |
| 189 | + double azimuth( const QgsPoint &other ) const; |
| 190 | +%Docstring |
| 191 | +Calculates azimuth between this point and other one (clockwise in degree, starting from north) |
| 192 | + :rtype: float |
| 193 | +%End |
121 | 194 |
|
122 |
| - /** Returns the distance between this point and another point. |
123 |
| - * @param other other point |
124 |
| - * @see sqrDist() |
125 |
| - * @note added in QGIS 2.16 |
126 |
| - */ |
127 |
| - double distance( const QgsPoint& other ) const; |
128 |
| - |
129 |
| - /** Returns the minimum distance between this point and a segment */ |
130 |
| - double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint& minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; |
131 |
| - |
132 |
| - /** Calculates azimuth between this point and other one (clockwise in degree, starting from north) */ |
133 |
| - double azimuth( const QgsPoint& other ) const; |
134 |
| - |
135 |
| - /** Returns a new point which corresponds to this point projected by a specified distance |
136 |
| - * in a specified bearing. |
137 |
| - * @param distance distance to project |
138 |
| - * @param bearing angle to project in, clockwise in degrees starting from north |
139 |
| - * @note added in QGIS 2.16 |
140 |
| - */ |
141 | 195 | QgsPoint project( double distance, double bearing ) const;
|
| 196 | +%Docstring |
| 197 | + Returns a new point which corresponds to this point projected by a specified distance |
| 198 | + in a specified bearing. |
| 199 | + \param distance distance to project |
| 200 | + \param bearing angle to project in, clockwise in degrees starting from north |
| 201 | +.. versionadded:: 2.16 |
| 202 | + :rtype: QgsPoint |
| 203 | +%End |
142 | 204 |
|
143 |
| - /** Compares this point with another point with a fuzzy tolerance |
144 |
| - * @param other point to compare with |
145 |
| - * @param epsilon maximum difference for coordinates between the points |
146 |
| - * @returns true if points are equal within specified tolerance |
147 |
| - * @note added in QGIS 2.9 |
148 |
| - */ |
149 | 205 | bool compare( const QgsPoint &other, double epsilon = 4 * DBL_EPSILON ) const;
|
| 206 | +%Docstring |
| 207 | + Compares this point with another point with a fuzzy tolerance |
| 208 | + \param other point to compare with |
| 209 | + \param epsilon maximum difference for coordinates between the points |
| 210 | + :return: true if points are equal within specified tolerance |
| 211 | +.. versionadded:: 2.9 |
| 212 | + :rtype: bool |
| 213 | +%End |
150 | 214 |
|
151 |
| - //! equality operator |
152 | 215 | bool operator==( const QgsPoint &other );
|
| 216 | +%Docstring |
| 217 | +equality operator |
| 218 | + :rtype: bool |
| 219 | +%End |
153 | 220 |
|
154 |
| - //! Inequality operator |
155 | 221 | bool operator!=( const QgsPoint &other ) const;
|
| 222 | +%Docstring |
| 223 | +Inequality operator |
| 224 | + :rtype: bool |
| 225 | +%End |
156 | 226 |
|
157 |
| - //! Multiply x and y by the given value |
158 | 227 | void multiply( double scalar );
|
| 228 | +%Docstring |
| 229 | +Multiply x and y by the given value |
| 230 | +%End |
| 231 | + |
| 232 | + int onSegment( const QgsPoint &a, const QgsPoint &b ) const; |
| 233 | +%Docstring |
| 234 | +3 if point is on open ray b. |
| 235 | + :rtype: int |
| 236 | +%End |
159 | 237 |
|
160 |
| - //! Test if this point is on the segment defined by points a, b |
161 |
| - //! @return 0 if this point is not on the open ray through a and b, |
162 |
| - //! 1 if point is on open ray a, 2 if point is within line segment, |
163 |
| - //! 3 if point is on open ray b. |
164 |
| - int onSegment( const QgsPoint& a, const QgsPoint& b ) const; |
165 | 238 |
|
166 |
| - //! Calculates the vector obtained by subtracting a point from this point |
167 |
| - QgsVector operator-( const QgsPoint& p ) const; |
| 239 | + QgsVector operator-( const QgsPoint &p ) const; |
| 240 | +%Docstring |
| 241 | +Calculates the vector obtained by subtracting a point from this point |
| 242 | + :rtype: QgsVector |
| 243 | +%End |
168 | 244 |
|
169 |
| - //! Adds a vector to this point in place |
170 | 245 | QgsPoint &operator+=( QgsVector v );
|
| 246 | +%Docstring |
| 247 | +Adds a vector to this point in place |
| 248 | + :rtype: QgsPoint |
| 249 | +%End |
171 | 250 |
|
172 |
| - //! Subtracts a vector from this point in place |
173 | 251 | QgsPoint &operator-=( QgsVector v );
|
| 252 | +%Docstring |
| 253 | +Subtracts a vector from this point in place |
| 254 | + :rtype: QgsPoint |
| 255 | +%End |
174 | 256 |
|
175 |
| - //! Adds a vector to this point |
176 | 257 | QgsPoint operator+( QgsVector v ) const;
|
| 258 | +%Docstring |
| 259 | +Adds a vector to this point |
| 260 | + :rtype: QgsPoint |
| 261 | +%End |
177 | 262 |
|
178 |
| - //! Subtracts a vector from this point |
179 | 263 | QgsPoint operator-( QgsVector v ) const;
|
| 264 | +%Docstring |
| 265 | +Subtracts a vector from this point |
| 266 | + :rtype: QgsPoint |
| 267 | +%End |
180 | 268 |
|
181 |
| - //! Multiplies the coordinates in this point by a scalar quantity |
182 | 269 | QgsPoint operator*( double scalar ) const;
|
| 270 | +%Docstring |
| 271 | +Multiplies the coordinates in this point by a scalar quantity |
| 272 | + :rtype: QgsPoint |
| 273 | +%End |
183 | 274 |
|
184 |
| - //! Divides the coordinates in this point by a scalar quantity |
185 | 275 | QgsPoint operator/( double scalar ) const;
|
| 276 | +%Docstring |
| 277 | +Divides the coordinates in this point by a scalar quantity |
| 278 | + :rtype: QgsPoint |
| 279 | +%End |
186 | 280 |
|
187 |
| - //! Multiplies the coordinates in this point by a scalar quantity in place |
188 | 281 | QgsPoint &operator*=( double scalar );
|
| 282 | +%Docstring |
| 283 | +Multiplies the coordinates in this point by a scalar quantity in place |
| 284 | + :rtype: QgsPoint |
| 285 | +%End |
189 | 286 |
|
190 |
| - //! Divides the coordinates in this point by a scalar quantity in place |
191 | 287 | QgsPoint &operator/=( double scalar );
|
| 288 | +%Docstring |
| 289 | +Divides the coordinates in this point by a scalar quantity in place |
| 290 | + :rtype: QgsPoint |
| 291 | +%End |
192 | 292 |
|
193 |
| - SIP_PYOBJECT __repr__(); |
| 293 | + private: |
| 294 | + SIP_PYOBJECT __repr__(); |
194 | 295 | %MethodCode
|
195 |
| - QString str = "(" + QString::number(sipCpp->x()) + "," + QString::number(sipCpp->y()) + ")"; |
| 296 | + QString str = "(" + QString::number( sipCpp->x() ) + "," + QString::number( sipCpp->y() ) + ")"; |
196 | 297 | //QString str("(%f,%f)").arg(sipCpp->x()).arg(sipCpp->y());
|
197 | 298 | sipRes = PyUnicode_FromString( str.toUtf8().data() );
|
198 | 299 | %End
|
199 | 300 |
|
200 |
| - int __len__(); |
| 301 | + int __len__(); |
| 302 | +%Docstring |
| 303 | + :rtype: int |
| 304 | +%End |
201 | 305 | %MethodCode
|
202 | 306 | sipRes = 2;
|
203 | 307 | %End
|
204 | 308 |
|
205 | 309 |
|
206 |
| - SIP_PYOBJECT __getitem__(int); |
| 310 | + SIP_PYOBJECT __getitem__( int ); |
207 | 311 | %MethodCode
|
208 |
| - if (a0 == 0) { |
209 |
| - sipRes = Py_BuildValue("d",sipCpp->x()); |
210 |
| - } else if (a0 == 1) { |
211 |
| - sipRes = Py_BuildValue("d",sipCpp->y()); |
212 |
| - } else { |
213 |
| - QString msg = QString("Bad index: %1").arg(a0); |
214 |
| - PyErr_SetString(PyExc_IndexError, msg.toAscii().constData()); |
| 312 | + if ( a0 == 0 ) |
| 313 | + { |
| 314 | + sipRes = Py_BuildValue( "d", sipCpp->x() ); |
| 315 | + } |
| 316 | + else if ( a0 == 1 ) |
| 317 | + { |
| 318 | + sipRes = Py_BuildValue( "d", sipCpp->y() ); |
| 319 | + } |
| 320 | + else |
| 321 | + { |
| 322 | + QString msg = QString( "Bad index: %1" ).arg( a0 ); |
| 323 | + PyErr_SetString( PyExc_IndexError, msg.toAscii().constData() ); |
215 | 324 | }
|
216 | 325 | %End
|
217 | 326 |
|
218 |
| - long __hash__() const; |
| 327 | + long __hash__() const; |
| 328 | +%Docstring |
| 329 | + :rtype: long |
| 330 | +%End |
219 | 331 | %MethodCode
|
220 |
| - sipRes = qHash( *sipCpp ); |
| 332 | + sipRes = qHash( *sipCpp ); |
221 | 333 | %End
|
222 | 334 | }; // class QgsPoint
|
| 335 | + |
| 336 | + |
| 337 | +/************************************************************************ |
| 338 | + * This file has been generated automatically from * |
| 339 | + * * |
| 340 | + * src/core/qgspoint.h * |
| 341 | + * * |
| 342 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 343 | + ************************************************************************/ |
0 commit comments