QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
Ellipse geometry type. More...
#include <qgsellipse.h>
Public Member Functions | |
QgsEllipse () SIP_HOLDGIL=default | |
Constructor for QgsEllipse. More... | |
QgsEllipse (const QgsPoint ¢er, double semiMajorAxis, double semiMinorAxis, double azimuth=90) SIP_HOLDGIL | |
Constructs an ellipse by defining all the members. More... | |
virtual | ~QgsEllipse ()=default |
virtual double | area () const SIP_HOLDGIL |
The area of the ellipse. More... | |
double | azimuth () const SIP_HOLDGIL |
Returns the azimuth. More... | |
virtual QgsRectangle | boundingBox () const |
Returns the minimal bounding box for the ellipse. More... | |
QgsPoint | center () const SIP_HOLDGIL |
Returns the center point. More... | |
virtual double | eccentricity () const SIP_HOLDGIL |
The eccentricity of the ellipse. More... | |
virtual QVector< QgsPoint > | foci () const |
Two foci of the ellipse. More... | |
virtual double | focusDistance () const SIP_HOLDGIL |
The distance between the center and each foci. More... | |
virtual bool | isEmpty () const SIP_HOLDGIL |
An ellipse is empty if axes are equal to 0. More... | |
virtual bool | operator!= (const QgsEllipse &elp) const |
virtual bool | operator== (const QgsEllipse &elp) const |
virtual QgsPolygon * | orientedBoundingBox () const |
Returns the oriented minimal bounding box for the ellipse. More... | |
virtual double | perimeter () const SIP_HOLDGIL |
The circumference of the ellipse using first approximation of Ramanujan. More... | |
virtual QgsPointSequence | points (unsigned int segments=36) const |
Returns a list of points with segmentation from segments. More... | |
virtual QVector< QgsPoint > | quadrant () const |
The four quadrants of the ellipse. More... | |
QgsPoint & | rcenter () |
Returns a reference to the center point of this ellipse. More... | |
double | semiMajorAxis () const SIP_HOLDGIL |
Returns the semi-major axis. More... | |
double | semiMinorAxis () const SIP_HOLDGIL |
Returns the semi-minor axis. More... | |
void | setAzimuth (double azimuth) SIP_HOLDGIL |
Sets the azimuth (orientation). More... | |
void | setCenter (const QgsPoint ¢er) SIP_HOLDGIL |
Sets the center point. More... | |
virtual void | setSemiMajorAxis (double semiMajorAxis) SIP_HOLDGIL |
Sets the semi-major axis. More... | |
virtual void | setSemiMinorAxis (double semiMinorAxis) SIP_HOLDGIL |
Sets the semi-minor axis. More... | |
virtual QgsLineString * | toLineString (unsigned int segments=36) const |
Returns a segmented linestring. More... | |
virtual QgsPolygon * | toPolygon (unsigned int segments=36) const |
Returns a segmented polygon. More... | |
virtual QString | toString (int pointPrecision=17, int axisPrecision=17, int azimuthPrecision=2) const |
returns a string representation of the ellipse. More... | |
Static Public Member Functions | |
static QgsEllipse | fromCenter2Points (const QgsPoint &ptc, const QgsPoint &pt1, const QgsPoint &pt2) SIP_HOLDGIL |
Constructs an ellipse by a central point and two other points. More... | |
static QgsEllipse | fromCenterPoint (const QgsPoint &ptc, const QgsPoint &pt1) SIP_HOLDGIL |
Constructs an ellipse by a center point and a another point. More... | |
static QgsEllipse | fromExtent (const QgsPoint &pt1, const QgsPoint &pt2) SIP_HOLDGIL |
Constructs an ellipse by an extent (aka bounding box / QgsRectangle). More... | |
static QgsEllipse | fromFoci (const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3) SIP_HOLDGIL |
Constructs an ellipse by foci (pt1 and pt2) and a point pt3. More... | |
Protected Attributes | |
double | mAzimuth = 90.0 |
QgsPoint | mCenter |
double | mSemiMajorAxis = 0.0 |
double | mSemiMinorAxis = 0.0 |
Ellipse geometry type.
An ellipse is defined by a center point with a semi-major axis, a semi-minor axis and an azimuth. The azimuth is the north angle to the first quadrant (always oriented on the semi-major axis), in degrees. By default, the semi-major axis is oriented to the east (90 degrees). The semi-minor axis is always smaller than the semi-major axis. If it is set larger, it will be swapped and the azimuth will increase by 90 degrees.
Definition at line 39 of file qgsellipse.h.
|
default |
Constructor for QgsEllipse.
|
virtualdefault |
QgsEllipse::QgsEllipse | ( | const QgsPoint & | center, |
double | semiMajorAxis, | ||
double | semiMinorAxis, | ||
double | azimuth = 90 |
||
) |
Constructs an ellipse by defining all the members.
center | The center of the ellipse. |
semiMajorAxis | Semi-major axis of the ellipse. |
semiMinorAxis | Semi-minor axis of the ellipse. |
azimuth | Angle in degrees started from the North to the first quadrant. |
Definition at line 38 of file qgsellipse.cpp.
|
virtual |
|
inline |
|
virtual |
Returns the minimal bounding box for the ellipse.
Reimplemented in QgsCircle.
Definition at line 254 of file qgsellipse.cpp.
|
inline |
Returns the center point.
Definition at line 121 of file qgsellipse.h.
|
virtual |
The eccentricity of the ellipse.
nan is returned if the ellipse is empty.
Definition at line 156 of file qgsellipse.cpp.
|
virtual |
Two foci of the ellipse.
The axes are oriented by the azimuth and are on the semi-major axis.
Definition at line 146 of file qgsellipse.cpp.
|
virtual |
The distance between the center and each foci.
Definition at line 141 of file qgsellipse.cpp.
|
static |
Constructs an ellipse by a central point and two other points.
The center point keeps m value from ptc. Z dimension is also supported and is retrieved from the first 3D point amongst ptc, pt1 and pt2. Axes are calculated from the 2D distance between ptc and pt1 and pt2. The azimuth is the angle between ptc and pt1.
ptc | Center point. |
pt1 | First point. |
pt2 | Second point. |
Definition at line 89 of file qgsellipse.cpp.
|
static |
Constructs an ellipse by a center point and a another point.
The center point keeps m value from ptc. Z dimension is also supported and is retrieved from the first 3D point amongst ptc and pt1. Axes are calculated from the 2D distance between ptc and pt1. The azimuth always takes the default value.
ptc | Center point. |
pt1 | First point. |
Definition at line 77 of file qgsellipse.cpp.
|
static |
Constructs an ellipse by an extent (aka bounding box / QgsRectangle).
The center point can have m value which is the result from the midpoint operation between pt1 and pt2. Z dimension is also supported and is retrieved from the first 3D point amongst pt1 and pt2. Axes are calculated from the 2D distance between pt1 and pt2. The azimuth always takes the default value.
pt1 | First corner. |
pt2 | Second corner. |
Definition at line 65 of file qgsellipse.cpp.
|
static |
Constructs an ellipse by foci (pt1 and pt2) and a point pt3.
The center point can have m value which is the result from the midpoint operation between pt1 and pt2. Z dimension is also supported and is retrieved from the first 3D point amongst pt1 and pt2. Axes are calculated from the 2D distance with the third point pt3. The azimuth is the angle between pt1 and pt2.
pt1 | First focus. |
pt2 | Second focus. |
pt3 | A point to calculate the axes. |
Definition at line 47 of file qgsellipse.cpp.
|
virtual |
An ellipse is empty if axes are equal to 0.
Definition at line 118 of file qgsellipse.cpp.
|
virtual |
Definition at line 113 of file qgsellipse.cpp.
|
virtual |
Definition at line 104 of file qgsellipse.cpp.
|
virtual |
Returns the oriented minimal bounding box for the ellipse.
Definition at line 292 of file qgsellipse.cpp.
|
virtual |
The circumference of the ellipse using first approximation of Ramanujan.
Reimplemented in QgsCircle.
Definition at line 170 of file qgsellipse.cpp.
|
virtual |
Returns a list of points with segmentation from segments.
segments | Number of segments used to segment geometry. |
Definition at line 188 of file qgsellipse.cpp.
|
virtual |
The four quadrants of the ellipse.
They are oriented and started always from semi-major axis.
Definition at line 177 of file qgsellipse.cpp.
|
inline |
Returns a reference to the center point of this ellipse.
Using a reference makes it possible to directly manipulate center in place.
Definition at line 148 of file qgsellipse.h.
|
inline |
Returns the semi-major axis.
Definition at line 127 of file qgsellipse.h.
|
inline |
Returns the semi-minor axis.
Definition at line 133 of file qgsellipse.h.
void QgsEllipse::setAzimuth | ( | double | azimuth | ) |
|
inline |
|
virtual |
Sets the semi-major axis.
Reimplemented in QgsCircle.
Definition at line 124 of file qgsellipse.cpp.
|
virtual |
Sets the semi-minor axis.
Reimplemented in QgsCircle.
Definition at line 129 of file qgsellipse.cpp.
|
virtual |
Returns a segmented linestring.
segments | Number of segments used to segment geometry. |
Definition at line 237 of file qgsellipse.cpp.
|
virtual |
Returns a segmented polygon.
segments | Number of segments used to segment geometry. |
Definition at line 224 of file qgsellipse.cpp.
|
virtual |
returns a string representation of the ellipse.
Members will be truncated to the specified precision.
Reimplemented in QgsCircle.
Definition at line 277 of file qgsellipse.cpp.
|
protected |
Definition at line 255 of file qgsellipse.h.
|
protected |
Definition at line 252 of file qgsellipse.h.
|
protected |
Definition at line 253 of file qgsellipse.h.
|
protected |
Definition at line 254 of file qgsellipse.h.