QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
QgsEllipse Class Reference

Ellipse geometry type. More...

#include <qgsellipse.h>

Inheritance diagram for QgsEllipse:
Inheritance graph
[legend]

Public Member Functions

 QgsEllipse ()=default
 Constructor for QgsEllipse.
 
 QgsEllipse (const QgsPoint &center, 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< QgsPointfoci () 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 QgsPolygonorientedBoundingBox () 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< QgsPointquadrant () const
 The four quadrants of the ellipse.
 
QgsPointrcenter ()
 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 &center)
 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 QgsLineStringtoLineString (unsigned int segments=36) const
 Returns a segmented linestring.
 
virtual QgsPolygontoPolygon (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QgsEllipse() [1/2]

QgsEllipse::QgsEllipse ( )
default

Constructor for QgsEllipse.

◆ ~QgsEllipse()

virtual QgsEllipse::~QgsEllipse ( )
virtualdefault

◆ QgsEllipse() [2/2]

QgsEllipse::QgsEllipse ( const QgsPoint center,
double  semiMajorAxis,
double  semiMinorAxis,
double  azimuth = 90 
)

Constructs an ellipse by defining all the members.

Parameters
centerThe center of the ellipse.
semiMajorAxisSemi-major axis of the ellipse.
semiMinorAxisSemi-minor axis of the ellipse.
azimuthAngle in degrees started from the North to the first quadrant.

Definition at line 38 of file qgsellipse.cpp.

Member Function Documentation

◆ area()

double QgsEllipse::area ( ) const
virtual

The area of the ellipse.

Reimplemented in QgsCircle.

Definition at line 165 of file qgsellipse.cpp.

◆ azimuth()

double QgsEllipse::azimuth ( ) const
inline

Returns the azimuth.

See also
setAzimuth()

Definition at line 138 of file qgsellipse.h.

◆ boundingBox()

QgsRectangle QgsEllipse::boundingBox ( ) const
virtual

Returns the minimal bounding box for the ellipse.

Reimplemented in QgsCircle.

Definition at line 254 of file qgsellipse.cpp.

◆ center()

QgsPoint QgsEllipse::center ( ) const
inline

Returns the center point.

See also
setCenter()
rcenter()

Definition at line 120 of file qgsellipse.h.

◆ eccentricity()

double QgsEllipse::eccentricity ( ) const
virtual

The eccentricity of the ellipse.

nan is returned if the ellipse is empty.

Definition at line 156 of file qgsellipse.cpp.

◆ foci()

QVector< QgsPoint > QgsEllipse::foci ( ) const
virtual

Two foci of the ellipse.

The axes are oriented by the azimuth and are on the semi-major axis.

See also
fromFoci()
focusDistance()
Returns
the two foci.

Definition at line 146 of file qgsellipse.cpp.

◆ focusDistance()

double QgsEllipse::focusDistance ( ) const
virtual

The distance between the center and each foci.

See also
fromFoci()
foci()
Returns
The distance between the center and each foci.

Definition at line 141 of file qgsellipse.cpp.

◆ fromCenter2Points()

QgsEllipse QgsEllipse::fromCenter2Points ( const QgsPoint ptc,
const QgsPoint pt1,
const QgsPoint pt2 
)
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.

Parameters
ptcCenter point.
pt1First point.
pt2Second point.

Definition at line 89 of file qgsellipse.cpp.

◆ fromCenterPoint()

QgsEllipse QgsEllipse::fromCenterPoint ( const QgsPoint ptc,
const QgsPoint pt1 
)
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.

Parameters
ptcCenter point.
pt1First point.

Definition at line 77 of file qgsellipse.cpp.

◆ fromExtent()

QgsEllipse QgsEllipse::fromExtent ( const QgsPoint pt1,
const QgsPoint pt2 
)
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.

Parameters
pt1First corner.
pt2Second corner.

Definition at line 65 of file qgsellipse.cpp.

◆ fromFoci()

QgsEllipse QgsEllipse::fromFoci ( const QgsPoint pt1,
const QgsPoint pt2,
const QgsPoint pt3 
)
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.

Parameters
pt1First focus.
pt2Second focus.
pt3A point to calculate the axes.

Definition at line 47 of file qgsellipse.cpp.

◆ isEmpty()

bool QgsEllipse::isEmpty ( ) const
virtual

An ellipse is empty if axes are equal to 0.

Definition at line 118 of file qgsellipse.cpp.

◆ operator!=()

bool QgsEllipse::operator!= ( const QgsEllipse elp) const
virtual

Definition at line 113 of file qgsellipse.cpp.

◆ operator==()

bool QgsEllipse::operator== ( const QgsEllipse elp) const
virtual

Definition at line 104 of file qgsellipse.cpp.

◆ orientedBoundingBox()

QgsPolygon * QgsEllipse::orientedBoundingBox ( ) const
virtual

Returns the oriented minimal bounding box for the ellipse.

Definition at line 292 of file qgsellipse.cpp.

◆ perimeter()

double QgsEllipse::perimeter ( ) const
virtual

The circumference of the ellipse using first approximation of Ramanujan.

Reimplemented in QgsCircle.

Definition at line 170 of file qgsellipse.cpp.

◆ points()

QgsPointSequence QgsEllipse::points ( unsigned int  segments = 36) const
virtual

Returns a list of points with segmentation from segments.

Parameters
segmentsNumber of segments used to segment geometry.

Definition at line 188 of file qgsellipse.cpp.

◆ quadrant()

QVector< QgsPoint > QgsEllipse::quadrant ( ) const
virtual

The four quadrants of the ellipse.

They are oriented and started always from semi-major axis.

Returns
quadrants defined by four points.

Definition at line 177 of file qgsellipse.cpp.

◆ rcenter()

QgsPoint & QgsEllipse::rcenter ( )
inline

Returns a reference to the center point of this ellipse.

Using a reference makes it possible to directly manipulate center in place.

See also
center()
setCenter()
Note
not available in Python bindings

Definition at line 147 of file qgsellipse.h.

◆ semiMajorAxis()

double QgsEllipse::semiMajorAxis ( ) const
inline

Returns the semi-major axis.

See also
setSemiMajorAxis()

Definition at line 126 of file qgsellipse.h.

◆ semiMinorAxis()

double QgsEllipse::semiMinorAxis ( ) const
inline

Returns the semi-minor axis.

See also
setSemiMinorAxis()

Definition at line 132 of file qgsellipse.h.

◆ setAzimuth()

void QgsEllipse::setAzimuth ( double  azimuth)

Sets the azimuth (orientation).

See also
azimuth()

Definition at line 135 of file qgsellipse.cpp.

◆ setCenter()

void QgsEllipse::setCenter ( const QgsPoint center)
inline

Sets the center point.

See also
center()
rcenter()

Definition at line 154 of file qgsellipse.h.

◆ setSemiMajorAxis()

void QgsEllipse::setSemiMajorAxis ( double  semiMajorAxis)
virtual

Sets the semi-major axis.

See also
semiMajorAxis()

Reimplemented in QgsCircle.

Definition at line 124 of file qgsellipse.cpp.

◆ setSemiMinorAxis()

void QgsEllipse::setSemiMinorAxis ( double  semiMinorAxis)
virtual

Sets the semi-minor axis.

See also
semiMinorAxis()

Reimplemented in QgsCircle.

Definition at line 129 of file qgsellipse.cpp.

◆ toLineString()

QgsLineString * QgsEllipse::toLineString ( unsigned int  segments = 36) const
virtual

Returns a segmented linestring.

Parameters
segmentsNumber of segments used to segment geometry.

Definition at line 237 of file qgsellipse.cpp.

◆ toPolygon()

QgsPolygon * QgsEllipse::toPolygon ( unsigned int  segments = 36) const
virtual

Returns a segmented polygon.

Parameters
segmentsNumber of segments used to segment geometry.

Definition at line 224 of file qgsellipse.cpp.

◆ toString()

QString QgsEllipse::toString ( int  pointPrecision = 17,
int  axisPrecision = 17,
int  azimuthPrecision = 2 
) const
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.

Member Data Documentation

◆ mAzimuth

double QgsEllipse::mAzimuth = 90.0
protected

Definition at line 254 of file qgsellipse.h.

◆ mCenter

QgsPoint QgsEllipse::mCenter
protected

Definition at line 251 of file qgsellipse.h.

◆ mSemiMajorAxis

double QgsEllipse::mSemiMajorAxis = 0.0
protected

Definition at line 252 of file qgsellipse.h.

◆ mSemiMinorAxis

double QgsEllipse::mSemiMinorAxis = 0.0
protected

Definition at line 253 of file qgsellipse.h.


The documentation for this class was generated from the following files: