17#ifndef QGSPROFILEPOINT_H
18#define QGSPROFILEPOINT_H
26using namespace Qt::StringLiterals;
98 if (
isEmpty() && other.isEmpty() )
100 if (
isEmpty() && !other.isEmpty() )
102 if ( !
isEmpty() && other.isEmpty() )
107 equal &=
qgsDoubleNear( other.mElevation, mElevation, 1E-8 );
114 if (
isEmpty() && other.isEmpty() )
116 if (
isEmpty() && !other.isEmpty() )
118 if ( !
isEmpty() && other.isEmpty() )
123 equal &=
qgsDoubleNear( other.mElevation, mElevation, 1E-8 );
130 SIP_PYOBJECT __repr__();
132 const QString str = sipCpp->isEmpty()
133 ? u
"<QgsProfilePoint: EMPTY>"_s
134 : u
"<QgsProfilePoint: %1, %2>"_s.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() );
163 double mDistance = 0;
164 double mElevation = 0;
165 bool mIsEmpty =
true;
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).