17#ifndef QGSPROFILEPOINT_H
18#define QGSPROFILEPOINT_H
26using namespace Qt::StringLiterals;
103 if (
isEmpty() && other.isEmpty() )
105 if (
isEmpty() && !other.isEmpty() )
107 if ( !
isEmpty() && other.isEmpty() )
112 equal &=
qgsDoubleNear( other.mElevation, mElevation, 1E-8 );
119 if (
isEmpty() && other.isEmpty() )
121 if (
isEmpty() && !other.isEmpty() )
123 if ( !
isEmpty() && other.isEmpty() )
128 equal &=
qgsDoubleNear( other.mElevation, mElevation, 1E-8 );
134 SIP_PYOBJECT __repr__();
136 const QString str = sipCpp->isEmpty()
137 ? u
"<QgsProfilePoint: EMPTY>"_s
138 : u
"<QgsProfilePoint: %1, %2>"_s.arg( sipCpp->distance() ).arg( sipCpp->elevation() );
139 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
147 SIP_PYOBJECT __getitem__(
int );
151 sipRes = Py_BuildValue(
"d", sipCpp->distance() );
155 sipRes = Py_BuildValue(
"d", sipCpp->elevation() );
159 QString msg = QString(
"Bad index: %1" ).arg( a0 );
160 PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
168 double mDistance = 0;
169 double mElevation = 0;
170 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).