QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
geometry
qgsellipse.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsellipse.h
3
--------------
4
begin : March 2017
5
copyright : (C) 2017 by Loïc Bartoletti
6
email : lituus at free dot fr
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSELLIPSE_H
19
#define QGSELLIPSE_H
20
21
#include "qgis_core.h"
22
#include "
qgslinestring.h
"
23
#include "
qgspoint.h
"
24
#include "
qgspolygon.h
"
25
#include "
qgsrectangle.h
"
26
27
#include <QString>
28
29
using namespace
Qt::StringLiterals;
30
40
class
CORE_EXPORT
QgsEllipse
41
{
42
public
:
43
// clang-format off
47
QgsEllipse
()
SIP_HOLDGIL
= default;
48
// clang-format on
49
50
virtual ~
QgsEllipse
() = default;
51
59
QgsEllipse
( const
QgsPoint
&
center
,
double
semiMajorAxis
,
double
semiMinorAxis
,
double
azimuth
= 90 )
SIP_HOLDGIL
;
60
72
static
QgsEllipse
fromFoci
( const
QgsPoint
&pt1, const
QgsPoint
&pt2, const
QgsPoint
&pt3 )
SIP_HOLDGIL
;
73
84
static
QgsEllipse
fromExtent
( const
QgsPoint
&pt1, const
QgsPoint
&pt2 )
SIP_HOLDGIL
;
85
96
static
QgsEllipse
fromCenterPoint
( const
QgsPoint
&ptc, const
QgsPoint
&pt1 )
SIP_HOLDGIL
;
97
109
static
QgsEllipse
fromCenter2Points
( const
QgsPoint
&ptc, const
QgsPoint
&pt1, const
QgsPoint
&pt2 )
SIP_HOLDGIL
;
110
111
virtual
bool
operator ==( const
QgsEllipse
&elp ) const;
112
virtual
bool
operator !=( const
QgsEllipse
&elp ) const;
113
115
virtual
bool
isEmpty
() const
SIP_HOLDGIL
;
116
122
QgsPoint
center
() const
SIP_HOLDGIL
{
return
mCenter
; }
123
128
double
semiMajorAxis
() const
SIP_HOLDGIL
{
return
mSemiMajorAxis
; }
129
134
double
semiMinorAxis
() const
SIP_HOLDGIL
{
return
mSemiMinorAxis
; }
135
140
double
azimuth
() const
SIP_HOLDGIL
{
return
mAzimuth
; }
141
149
QgsPoint
&
rcenter
()
SIP_SKIP
{
return
mCenter
; }
150
156
void
setCenter
(
const
QgsPoint
&
center
)
SIP_HOLDGIL
{
mCenter
=
center
; }
157
162
virtual
void
setSemiMajorAxis(
double
semiMajorAxis )
SIP_HOLDGIL
;
163
168
virtual
void
setSemiMinorAxis(
double
semiMinorAxis )
SIP_HOLDGIL
;
169
174
void
setAzimuth(
double
azimuth )
SIP_HOLDGIL
;
175
182
virtual
double
focusDistance() const
SIP_HOLDGIL
;
183
190
virtual QVector<
QgsPoint
> foci() const;
191
196
virtual
double
eccentricity() const
SIP_HOLDGIL
;
198
virtual
double
area() const
SIP_HOLDGIL
;
200
virtual
double
perimeter() const
SIP_HOLDGIL
;
201
207
virtual QVector<
QgsPoint
> quadrant() const;
208
213
virtual
QgsPointSequence
points(
unsigned
int
segments = 36 ) const;
214
219
virtual
QgsPolygon
*toPolygon(
unsigned
int
segments = 36 ) const
SIP_FACTORY
;
220
225
virtual
QgsLineString
*toLineString(
unsigned
int
segments = 36 ) const
SIP_FACTORY
;
226
//virtual QgsCurvePolygon toCurvePolygon() const;
227
231
virtual
QgsPolygon
*orientedBoundingBox() const
SIP_FACTORY
;
232
236
virtual
QgsRectangle
boundingBox() const;
237
242
virtual QString toString(
int
pointPrecision = 17,
int
axisPrecision = 17,
int
azimuthPrecision = 2 ) const;
243
244
#ifdef SIP_RUN
245
// clang-format off
246
SIP_PYOBJECT __repr__();
247
% MethodCode
248
QString str = u
"<QgsEllipse: %1>"
_s.arg( sipCpp->toString() );
249
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
250
% End
251
// clang-format on
252
#endif
253
254
protected
:
255
QgsPoint
mCenter
;
256
double
mSemiMajorAxis
= 0.0;
257
double
mSemiMinorAxis
= 0.0;
258
double
mAzimuth
= 90.0;
259
260
private
:
262
void
normalizeAxis();
263
264
void
pointsInternal(
unsigned
int
segments, QVector< double> &x, QVector< double> &y, QVector<double> &z, QVector< double> &m )
const
;
265
};
266
267
#endif
// QGSELLIPSE_H
QgsEllipse::mCenter
QgsPoint mCenter
Definition
qgsellipse.h:255
QgsEllipse::rcenter
QgsPoint & rcenter()
Returns a reference to the center point of this ellipse.
Definition
qgsellipse.h:149
QgsEllipse::center
QgsPoint center() const
Returns the center point.
Definition
qgsellipse.h:122
QgsEllipse::semiMajorAxis
double semiMajorAxis() const
Returns the semi-major axis.
Definition
qgsellipse.h:128
QgsEllipse::fromCenterPoint
static QgsEllipse fromCenterPoint(const QgsPoint &ptc, const QgsPoint &pt1)
Constructs an ellipse by a center point and a another point.
Definition
qgsellipse.cpp:81
QgsEllipse::setCenter
void setCenter(const QgsPoint ¢er)
Sets the center point.
Definition
qgsellipse.h:156
QgsEllipse::mAzimuth
double mAzimuth
Definition
qgsellipse.h:258
QgsEllipse::mSemiMajorAxis
double mSemiMajorAxis
Definition
qgsellipse.h:256
QgsEllipse::azimuth
double azimuth() const
Returns the azimuth.
Definition
qgsellipse.h:140
QgsEllipse::QgsEllipse
QgsEllipse()=default
Constructor for QgsEllipse.
QgsEllipse::fromExtent
static QgsEllipse fromExtent(const QgsPoint &pt1, const QgsPoint &pt2)
Constructs an ellipse by an extent (aka bounding box / QgsRectangle).
Definition
qgsellipse.cpp:69
QgsEllipse::isEmpty
virtual bool isEmpty() const
An ellipse is empty if axes are equal to 0.
Definition
qgsellipse.cpp:120
QgsEllipse::mSemiMinorAxis
double mSemiMinorAxis
Definition
qgsellipse.h:257
QgsEllipse::fromFoci
static QgsEllipse fromFoci(const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3)
Constructs an ellipse by foci (pt1 and pt2) and a point pt3.
Definition
qgsellipse.cpp:51
QgsEllipse::semiMinorAxis
double semiMinorAxis() const
Returns the semi-minor axis.
Definition
qgsellipse.h:134
QgsEllipse::fromCenter2Points
static QgsEllipse fromCenter2Points(const QgsPoint &ptc, const QgsPoint &pt1, const QgsPoint &pt2)
Constructs an ellipse by a central point and two other points.
Definition
qgsellipse.cpp:93
QgsLineString
Line string geometry type, with support for z-dimension and m-values.
Definition
qgslinestring.h:49
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition
qgspoint.h:53
QgsPolygon
Polygon geometry type.
Definition
qgspolygon.h:37
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:47
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_HOLDGIL
#define SIP_HOLDGIL
Definition
qgis_sip.h:183
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
QgsPointSequence
QVector< QgsPoint > QgsPointSequence
Definition
qgsabstractgeometry.h:57
qgslinestring.h
qgspoint.h
qgspolygon.h
qgsrectangle.h
Generated on
for QGIS API Documentation by
1.17.0