Skip to content

Commit 84471f2

Browse files
lbartolettinyalldawson
authored andcommitted
New classes for circle and ellipse.
1 parent ccb4ac9 commit 84471f2

16 files changed

+1994
-14
lines changed

python/core/core.sip

+2
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,12 @@
368368

369369
%Include geometry/qgsabstractgeometry.sip
370370
%Include geometry/qgsbox3d.sip
371+
%Include geometry/qgscircle.sip
371372
%Include geometry/qgscircularstring.sip
372373
%Include geometry/qgscompoundcurve.sip
373374
%Include geometry/qgscurvepolygon.sip
374375
%Include geometry/qgscurve.sip
376+
%Include geometry/qgsellipse.sip
375377
%Include geometry/qgsgeometry.sip
376378
%Include geometry/qgsgeometrycollection.sip
377379
%Include geometry/qgsgeometryengine.sip

python/core/geometry/qgscircle.sip

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/geometry/qgscircle.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
15+
16+
class QgsCircle : QgsEllipse
17+
{
18+
%Docstring
19+
Circle geometry type.
20+
21+
A circle is defined by a center point with a radius and an azimuth.
22+
The azimuth is the north angle to the semi-major axis, in degrees. By default, the semi-major axis is oriented to the north (0 degrees).
23+
.. versionadded:: 3.0
24+
%End
25+
26+
%TypeHeaderCode
27+
#include "qgscircle.h"
28+
%End
29+
public:
30+
QgsCircle();
31+
32+
QgsCircle( const QgsPointV2 &center, double radius, double azimuth = 0 );
33+
%Docstring
34+
Constructs a circle by defining all the members.
35+
\param center The center of the circle.
36+
\param radius The radius of the circle.
37+
\param azimuth Angle in degrees started from the North to the first quadrant.
38+
%End
39+
40+
static QgsCircle from2Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2 );
41+
%Docstring
42+
Constructs a circle by 2 points on the circle.
43+
The center point can have z and m values which are the result from the midpoint operation between ``pt1`` and ``pt2``.
44+
The radius is calculated from the 2D distance between ``pt1`` and ``pt2``.
45+
The azimuth is the angle between ``pt1`` and ``pt2``.
46+
\param pt1 First point.
47+
\param pt2 Second point.
48+
:rtype: QgsCircle
49+
%End
50+
51+
static QgsCircle from3Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double epsilon = 1E-8 );
52+
%Docstring
53+
Constructs a circle by 3 points on the circle.
54+
Z and m values are dropped for the center point.
55+
The azimuth always takes the default value.
56+
If the points are colinear an empty circle is returned.
57+
\param pt1 First point.
58+
\param pt2 Second point.
59+
\param pt3 Third point.
60+
\param epsilon Value used to compare point.
61+
:rtype: QgsCircle
62+
%End
63+
64+
static QgsCircle fromCenterDiameter( const QgsPointV2 &center, double diameter, double azimuth = 0 );
65+
%Docstring
66+
Constructs a circle by a center point and a diameter.
67+
The center point keeps z and m values from ``center``.
68+
\param center Center point.
69+
\param diameter Diameter of the circle.
70+
\param azimuth Azimuth of the circle.
71+
:rtype: QgsCircle
72+
%End
73+
74+
75+
static QgsCircle fromCenterPoint( const QgsPointV2 &center, const QgsPointV2 &pt1 );
76+
%Docstring
77+
Constructs a circle by a center point and another point.
78+
The center point keeps z and m values from ``center``.
79+
Axes are calculated from the 2D distance between ``center`` and ``pt1``.
80+
The azimuth is the angle between ``center`` and ``pt1``.
81+
\param center Center point.
82+
\param pt1 A point on the circle.
83+
:rtype: QgsCircle
84+
%End
85+
86+
87+
static QgsCircle from3Tangents( const QgsPointV2 &pt1_tg1, const QgsPointV2 &pt2_tg1,
88+
const QgsPointV2 &pt1_tg2, const QgsPointV2 &pt2_tg2,
89+
const QgsPointV2 &pt1_tg3, const QgsPointV2 &pt2_tg3, double epsilon = 1E-8 );
90+
%Docstring
91+
Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle).
92+
Z and m values are dropped for the center point.
93+
The azimuth always takes the default value.
94+
\param pt1_tg1 First point of the first tangent.
95+
\param pt2_tg1 Second point of the first tangent.
96+
\param pt1_tg2 First point of the second tangent.
97+
\param pt2_tg2 Second point of the second tangent.
98+
\param pt1_tg3 First point of the third tangent.
99+
\param pt2_tg3 Second point of the third tangent.
100+
\param epsilon Value used to compare point.
101+
:rtype: QgsCircle
102+
%End
103+
104+
static QgsCircle fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 );
105+
%Docstring
106+
Constructs a circle by an extent (aka bounding box / QgsRectangle).
107+
The center point can have z and m values which are the result from the midpoint operation between ``pt1`` and ``pt2``.
108+
Axes are calculated from the 2D distance between ``pt1`` and ``pt2``.
109+
The azimuth always takes the default value.
110+
\param pt1 First corner.
111+
\param pt2 Second corner.
112+
:rtype: QgsCircle
113+
%End
114+
115+
virtual double area() const;
116+
117+
virtual double perimeter() const;
118+
119+
120+
121+
122+
virtual void setSemiMajorAxis( const double semiMajorAxis );
123+
%Docstring
124+
Inherited method. Use setRadius instead.
125+
\see radius()
126+
\see setRadius()
127+
%End
128+
129+
virtual void setSemiMinorAxis( const double semiMinorAxis );
130+
%Docstring
131+
Inherited method. Use setRadius instead.
132+
\see radius()
133+
\see setRadius()
134+
%End
135+
136+
double radius() const;
137+
%Docstring
138+
Returns the radius of the circle
139+
:rtype: float
140+
%End
141+
void setRadius( double radius );
142+
%Docstring
143+
Set the radius of the circle
144+
%End
145+
146+
QVector<QgsPointV2> northQuadrant() const /Factory/;
147+
%Docstring
148+
The four quadrants of the ellipse.
149+
They are oriented and started from North.
150+
:return: quadrants defined by four points.
151+
\see quadrant()
152+
:rtype: list of QgsPointV2
153+
%End
154+
155+
QgsCircularString *toCircularString( bool oriented = false ) const;
156+
%Docstring
157+
Returns a circular string from the circle.
158+
\param oriented If oriented is true the start point is from azimuth instead from north.
159+
:rtype: QgsCircularString
160+
%End
161+
162+
163+
virtual QgsRectangle boundingBox() const;
164+
165+
166+
virtual QString toString( int pointPrecision = 17, int radiusPrecision = 17, int azimuthPrecision = 2 ) const;
167+
168+
169+
};
170+
171+
/************************************************************************
172+
* This file has been generated automatically from *
173+
* *
174+
* src/core/geometry/qgscircle.h *
175+
* *
176+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
177+
************************************************************************/

0 commit comments

Comments
 (0)