17#ifndef QGSPROFILEPOINT_H
18#define QGSPROFILEPOINT_H
43 : mDistance( distance )
44 , mElevation( elevation )
66 mElevation = elevation;
99 if ( isEmpty() && other.isEmpty() )
101 if ( isEmpty() && !other.isEmpty() )
103 if ( ! isEmpty() && other.isEmpty() )
108 equal &=
qgsDoubleNear( other.mElevation, mElevation, 1E-8 );
115 if ( isEmpty() && other.isEmpty() )
117 if ( isEmpty() && !other.isEmpty() )
119 if ( ! isEmpty() && other.isEmpty() )
124 equal &=
qgsDoubleNear( other.mElevation, mElevation, 1E-8 );
130 SIP_PYOBJECT __repr__();
132 const QString
str = sipCpp->isEmpty()
133 ? QStringLiteral(
"<QgsProfilePoint: EMPTY>" )
134 : QStringLiteral(
"<QgsProfilePoint: %1, %2>" ).arg( sipCpp->distance() ).arg( sipCpp->elevation() );
135 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
143 SIP_PYOBJECT __getitem__(
int );
147 sipRes = Py_BuildValue(
"d", sipCpp->distance() );
151 sipRes = Py_BuildValue(
"d", sipCpp->elevation() );
155 QString msg = QString(
"Bad index: %1" ).arg( a0 );
156 PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
164 double mDistance = 0;
165 double mElevation = 0;
166 bool mIsEmpty =
true;
Encapsulates a point on a distance-elevation profile.
double elevation() const SIP_HOLDGIL
Returns the elevation of the point.
QgsProfilePoint()=default
Constructor for an empty point.
bool isEmpty() const SIP_HOLDGIL
Returns true if the point is empty.
bool operator!=(const QgsProfilePoint &other) const SIP_HOLDGIL
void setElevation(double elevation) SIP_HOLDGIL
Sets the elevation of the point.
double distance() const SIP_HOLDGIL
Returns the distance of the point.
QgsProfilePoint(double distance, double elevation) SIP_HOLDGIL
Create a point at the specified distance and elevation coordinates.
bool operator==(const QgsProfilePoint &other) SIP_HOLDGIL
void setDistance(double distance) SIP_HOLDGIL
Sets the distance of the point.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)