File: qgspointxy.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (312 lines) | stat: -rw-r--r-- 8,054 bytes parent folder | download | duplicates (6)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgspointxy.h                                                *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/







class QgsPointXY
{
%Docstring(signature="appended")
A class to represent a 2D point.

A :py:class:`QgsPointXY` represents a strictly 2-dimensional position,
with only X and Y coordinates. This is a very lightweight class,
designed to minimize the memory requirements of storing millions of
points.

In many scenarios it is preferable to use a :py:class:`QgsPoint` instead
which also supports optional Z and M values. :py:class:`QgsPointXY`
should only be used for situations where a point can only EVER be two
dimensional.

Some valid use cases for :py:class:`QgsPointXY` include:

- A mouse cursor location
- A coordinate on a purely 2-dimensional rendered map, e.g. a
  :py:class:`QgsMapCanvas`
- A coordinate in a raster, vector tile, or other purely 2-dimensional
  layer

Use cases for which :py:class:`QgsPointXY` is NOT a valid choice
include:

- Storage of coordinates for a geometry. Since :py:class:`QgsPointXY` is
  strictly 2-dimensional it should never be used to store coordinates
  for vector geometries, as this will involve a loss of any z or m
  values present in the geometry.

.. seealso:: :py:class:`QgsPoint`
%End

%TypeHeaderCode
#include "qgspointxy.h"
%End
  public:
    static const QMetaObject staticMetaObject;

  public:

    QgsPointXY();

    QgsPointXY( const QgsPointXY &p ) /HoldGIL/;

    QgsPointXY( double x, double y ) /HoldGIL/;
%Docstring
Create a point from x,y coordinates

:param x: x coordinate
:param y: y coordinate
%End

    QgsPointXY( QPointF point ) /HoldGIL/;
%Docstring
Create a point from a QPointF

:param point: QPointF source
%End

    QgsPointXY( QPoint point ) /HoldGIL/;
%Docstring
Create a point from a QPoint

:param point: QPoint source
%End

    QgsPointXY( const QgsPoint &point ) /HoldGIL/;
%Docstring
Create a new point. Z and M values will be dropped.
%End

    ~QgsPointXY();

    void setX( double x ) /HoldGIL/;
%Docstring
Sets the x value of the point

:param x: x coordinate
%End

    void setY( double y ) /HoldGIL/;
%Docstring
Sets the y value of the point

:param y: y coordinate
%End

    void set( double x, double y ) /HoldGIL/;
%Docstring
Sets the x and y value of the point
%End

    double x() const /HoldGIL/;
%Docstring
Gets the x value of the point

:return: x coordinate
%End

    double y() const /HoldGIL/;
%Docstring
Gets the y value of the point

:return: y coordinate
%End

    QPointF toQPointF() const;
%Docstring
Converts a point to a QPointF

:return: QPointF with same x and y values
%End

    QString toString( int precision = -1 ) const;
%Docstring
Returns a string representation of the point (x, y) with a preset
``precision``. If ``precision`` is -1, then a default precision will be
used.
%End

    QString asWkt() const;
%Docstring
Returns the well known text representation for the point (e.g. "POINT(x
y)"). The wkt is created without an SRID.
%End

    double sqrDist( double x, double y ) const /HoldGIL/;
%Docstring
Returns the squared distance between this point a specified x, y
coordinate.

.. seealso:: :py:func:`distance`
%End

    double sqrDist( const QgsPointXY &other ) const /HoldGIL/;
%Docstring
Returns the squared distance between this point another point.

.. seealso:: :py:func:`distance`
%End

    double distance( double x, double y ) const /HoldGIL/;
%Docstring
Returns the distance between this point and a specified x, y coordinate.

:param x: x-coordniate
:param y: y-coordinate

.. seealso:: :py:func:`sqrDist`
%End

    double distance( const QgsPointXY &other ) const /HoldGIL/;
%Docstring
Returns the distance between this point and another point.

:param other: other point

.. seealso:: :py:func:`sqrDist`
%End

    double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPointXY &minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const /HoldGIL/;
%Docstring
Returns the minimum distance between this point and a segment
%End

    double azimuth( const QgsPointXY &other ) const /HoldGIL/;
%Docstring
Calculates azimuth between this point and other one (clockwise in
degree, starting from north)
%End

    QgsPointXY project( double distance, double bearing ) const /HoldGIL/;
%Docstring
Returns a new point which corresponds to this point projected by a
specified distance in a specified bearing.

:param distance: distance to project
:param bearing: angle to project in, clockwise in degrees starting from
                north
%End

    bool isEmpty() const /HoldGIL/;
%Docstring
Returns ``True`` if the geometry is empty. Unlike :py:class:`QgsPoint`,
this class is also used to retrieve graphical coordinates like QPointF.
It therefore has the default coordinates (0.0). A QgsPointXY is
considered empty, when the coordinates have not been explicitly filled
in.

.. versionadded:: 3.10
%End

    bool compare( const QgsPointXY &other, double epsilon = 4 * DBL_EPSILON ) const /HoldGIL/;
%Docstring
Compares this point with another point with a fuzzy tolerance

:param other: point to compare with
:param epsilon: maximum difference for coordinates between the points

:return: ``True`` if points are equal within specified tolerance

.. seealso:: :py:func:`distanceCompare`
%End

    bool distanceCompare( const QgsPointXY &other, double epsilon = 4 * DBL_EPSILON ) const /HoldGIL/;
%Docstring
Compares this point with another point with a fuzzy tolerance using
distance comparison

:param other: point to compare with
:param epsilon: maximum difference for coordinates between the points

:return: ``True`` if points are equal within specified tolerance

.. seealso:: :py:func:`compare`

.. versionadded:: 3.36
%End

    bool operator==( const QgsPointXY &other ) const /HoldGIL/;

    bool operator!=( const QgsPointXY &other ) const /HoldGIL/;

    void multiply( double scalar ) /HoldGIL/;
%Docstring
Multiply x and y by the given value
%End


    QgsVector operator-( const QgsPointXY &p ) const;

    QgsPointXY &operator+=( QgsVector v );

    QgsPointXY &operator-=( QgsVector v );

    QgsPointXY operator+( QgsVector v ) const;

    QgsPointXY operator-( QgsVector v ) const;

    QgsPointXY operator*( double scalar ) const;

    QgsPointXY operator/( double scalar ) const;

    QgsPointXY &operator*=( double scalar );

    QgsPointXY &operator/=( double scalar );

    operator QVariant() const;

    SIP_PYOBJECT __repr__();
%MethodCode
    QString str = QStringLiteral( "<QgsPointXY: %1>" ).arg( sipCpp->asWkt() );
    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

    Py_ssize_t __len__();
%MethodCode
    sipRes = 2;
%End


    SIP_PYOBJECT __getitem__( int );
%MethodCode
    if ( a0 == 0 )
    {
      sipRes = Py_BuildValue( "d", sipCpp->x() );
    }
    else if ( a0 == 1 )
    {
      sipRes = Py_BuildValue( "d", sipCpp->y() );
    }
    else
    {
      QString msg = QString( "Bad index: %1" ).arg( a0 );
      PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
    }
%End

    Py_hash_t __hash__() const;
%MethodCode
    sipRes = qHash( *sipCpp );
%End

}; // class QgsPointXY





/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgspointxy.h                                                *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/