QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
|
Ellipse geometry type. More...
#include <qgsellipse.h>
Public Member Functions | |
QgsEllipse ()=default | |
Constructor for QgsEllipse. | |
QgsEllipse (const QgsPoint ¢er, double semiMajorAxis, double semiMinorAxis, double azimuth=90) | |
Constructs an ellipse by defining all the members. | |
virtual | ~QgsEllipse ()=default |
virtual double | area () const |
The area of the ellipse. | |
double | azimuth () const |
Returns the azimuth. | |
virtual QgsRectangle | boundingBox () const |
Returns the minimal bounding box for the ellipse. | |
QgsPoint | center () const |
Returns the center point. | |
virtual double | eccentricity () const |
The eccentricity of the ellipse. | |
virtual QVector< QgsPoint > | foci () const |
Two foci of the ellipse. | |
virtual double | focusDistance () const |
The distance between the center and each foci. | |
virtual bool | isEmpty () const |
An ellipse is empty if axes are equal to 0. | |
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. | |
virtual double | perimeter () const |
The circumference of the ellipse using first approximation of Ramanujan. | |
virtual QgsPointSequence | points (unsigned int segments=36) const |
Returns a list of points with segmentation from segments. | |
virtual QVector< QgsPoint > | quadrant () const |
The four quadrants of the ellipse. | |
QgsPoint & | rcenter () |
Returns a reference to the center point of this ellipse. | |
double | semiMajorAxis () const |
Returns the semi-major axis. | |
double | semiMinorAxis () const |
Returns the semi-minor axis. | |
void | setAzimuth (double azimuth) |
Sets the azimuth (orientation). | |
void | setCenter (const QgsPoint ¢er) |
Sets the center point. | |
virtual void | setSemiMajorAxis (double semiMajorAxis) |
Sets the semi-major axis. | |
virtual void | setSemiMinorAxis (double semiMinorAxis) |
Sets the semi-minor axis. | |
virtual QgsLineString * | toLineString (unsigned int segments=36) const |
Returns a segmented linestring. | |
virtual QgsPolygon * | toPolygon (unsigned int segments=36) const |
Returns a segmented polygon. | |
virtual QString | toString (int pointPrecision=17, int axisPrecision=17, int azimuthPrecision=2) const |
returns a string representation of the ellipse. | |
Static Public Member Functions | |
static QgsEllipse | fromCenter2Points (const QgsPoint &ptc, const QgsPoint &pt1, const QgsPoint &pt2) |
Constructs an ellipse by a central point and two other points. | |
static QgsEllipse | fromCenterPoint (const QgsPoint &ptc, const QgsPoint &pt1) |
Constructs an ellipse by a center point and a another point. | |
static QgsEllipse | fromExtent (const QgsPoint &pt1, const QgsPoint &pt2) |
Constructs an ellipse by an extent (aka bounding box / QgsRectangle). | |
static QgsEllipse | fromFoci (const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3) |
Constructs an ellipse by foci (pt1 and pt2) and a point pt3. | |
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 38 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 120 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 147 of file qgsellipse.h.
|
inline |
Returns the semi-major axis.
Definition at line 126 of file qgsellipse.h.
|
inline |
Returns the semi-minor axis.
Definition at line 132 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 254 of file qgsellipse.h.
|
protected |
Definition at line 251 of file qgsellipse.h.
|
protected |
Definition at line 252 of file qgsellipse.h.
|
protected |
Definition at line 253 of file qgsellipse.h.