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.
QgsProfilePoint()=default
Constructor for an empty point.
void setDistance(double distance)
Sets the distance of the point.
bool operator==(const QgsProfilePoint &other)
QgsProfilePoint(double distance, double elevation)
Create a point at the specified distance and elevation coordinates.
bool operator!=(const QgsProfilePoint &other) const
double elevation() const
Returns the elevation of the point.
double distance() const
Returns the distance of the point.
bool isEmpty() const
Returns true if the point is empty.
void setElevation(double elevation)
Sets the elevation of the point.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)