17 const QPointF &posScreen) :
18 m_lineStyle (lineStyle),
19 m_transformation (transformation),
20 m_posScreen (posScreen),
21 m_haveMinimumDistanceToLine (false),
22 m_minimumDistanceToLine (0.0),
23 m_minimumProjectedDistanceOutsideLine (0.0),
29 const Point &pointStop)
31 double xProjection, yProjection, projectedDistanceOutsideLine, distanceToLine;
41 &projectedDistanceOutsideLine,
45 bool distancesAreEqual = (qAbs (distanceToLine - m_minimumDistanceToLine) <= 0);
46 if (!m_haveMinimumDistanceToLine ||
47 (distanceToLine < m_minimumDistanceToLine) ||
48 (distancesAreEqual && projectedDistanceOutsideLine < m_minimumProjectedDistanceOutsideLine)) {
51 if (qAbs (projectedDistanceOutsideLine) <= 0) {
59 double distanceProjectionToStart = qSqrt ((xProjection - pointStart.
posScreen().x()) * (xProjection - pointStart.
posScreen().x()) +
60 (yProjection - pointStart.
posScreen().y()) * (yProjection - pointStart.
posScreen().y()));
61 double distanceProjectionToStop = qSqrt ((xProjection - pointStop.
posScreen().x()) * (xProjection - pointStop.
posScreen().x()) +
62 (yProjection - pointStop.
posScreen().y()) * (yProjection - pointStop.
posScreen().y()));
63 if (distanceProjectionToStart < distanceProjectionToStop) {
66 m_ordinal = pointStart.
ordinal() - 0.5;
71 m_ordinal = pointStop.
ordinal() + 0.5;
76 m_haveMinimumDistanceToLine =
true;
77 m_minimumDistanceToLine = distanceToLine;
78 m_minimumProjectedDistanceOutsideLine = projectedDistanceOutsideLine;
double ordinal() const
Computed ordinal.
CallbackSearchReturn callback(const Point &pointStart, const Point &pointStop)
Callback method.
CallbackPointOrdinal(const LineStyle &lineStyle, const Transformation &transformation, const QPointF &posScreen)
Single constructor.
void projectPointOntoLine(double xToProject, double yToProject, double xStart, double yStart, double xStop, double yStop, double *xProjection, double *yProjection, double *projectedDistanceOutsideLine, double *distanceToLine)
Find the projection of a point onto a line segment such that the line through the point and its proje...
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
QPointF posScreen() const
Accessor for screen position.
CallbackSearchReturn
Return values for search callback methods.
Continue normal execution of the search.
Details for a specific Line.
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.