7 #include "CallbackPointOrdinal.h" 8 #include "EngaugeAssert.h" 13 #include "Transformation.h" 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;
33 projectPointOntoLine(m_posScreen.x(),
41 &projectedDistanceOutsideLine,
45 if (!m_haveMinimumDistanceToLine ||
46 (distanceToLine < m_minimumDistanceToLine) ||
47 (distanceToLine == m_minimumDistanceToLine && projectedDistanceOutsideLine < m_minimumProjectedDistanceOutsideLine)) {
50 if (projectedDistanceOutsideLine == 0) {
58 double distanceProjectionToStart = qSqrt ((xProjection - pointStart.
posScreen().x()) * (xProjection - pointStart.
posScreen().x()) +
59 (yProjection - pointStart.
posScreen().y()) * (yProjection - pointStart.
posScreen().y()));
60 double distanceProjectionToStop = qSqrt ((xProjection - pointStop.
posScreen().x()) * (xProjection - pointStop.
posScreen().x()) +
61 (yProjection - pointStop.
posScreen().y()) * (yProjection - pointStop.
posScreen().y()));
62 if (distanceProjectionToStart < distanceProjectionToStop) {
65 m_ordinal = pointStart.
ordinal() - 0.5;
70 m_ordinal = pointStop.
ordinal() + 0.5;
75 m_haveMinimumDistanceToLine =
true;
76 m_minimumDistanceToLine = distanceToLine;
77 m_minimumProjectedDistanceOutsideLine = projectedDistanceOutsideLine;
80 return CALLBACK_SEARCH_RETURN_CONTINUE;
CallbackSearchReturn callback(const Point &pointStart, const Point &pointStop)
Callback method.
CallbackPointOrdinal(const LineStyle &lineStyle, const Transformation &transformation, const QPointF &posScreen)
Single constructor.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
QPointF posScreen() const
Accessor for screen position.
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
Details for a specific Line.
double ordinal() const
Computed ordinal.