Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
CallbackPointOrdinal.h
1 #ifndef CALLBACK_POINT_ORDINAL_H
2 #define CALLBACK_POINT_ORDINAL_H
3 
4 #include "CallbackSearchReturn.h"
5 #include "LineStyle.h"
6 #include <QPointF>
7 #include <QString>
8 #include "Transformation.h"
9 
10 class Point;
11 
14 {
15 public:
17  CallbackPointOrdinal(const LineStyle &lineStyle,
18  const Transformation &transformation,
19  const QPointF &posScreen);
20 
22  CallbackSearchReturn callback (const Point &pointStart,
23  const Point &pointStop);
24 
26  double ordinal () const;
27 
28 private:
30 
31  const LineStyle m_lineStyle;
32  const Transformation m_transformation;
33  const QPointF m_posScreen;
34 
35  // Find the line segment using one or two steps:
36  // 1) If the closest point to m_posScreen is between the endpoints of a line segment, then finding the minimum point-to-line distance
37  // is sufficient to determine the closest line segment. There is no ambiguity, since only one line segment will have the
38  // minimum point-to-line distance
39  // 2) If case 1 does not apply, then there are two cases:
40  // 2a) The point is just past one terminating line segment. There is no ambiguity, since only one line segment will have the
41  // minimum point-to-line distance
42  // 2b) The point is near a vertex between two line segments. There is ambiguity with the two line segments which is resolved
43  // by comparing the minimum projected-distance-outside-line (minimum value wins)
44  bool m_haveMinimumDistanceToLine;
45  double m_minimumDistanceToLine;
46  double m_minimumProjectedDistanceOutsideLine;
47  double m_ordinal; // Valid when m_haveMinimumDistanceToLine is true
48 };
49 
50 #endif // CALLBACK_POINT_ORDINAL_H
double ordinal() const
Computed ordinal.
CallbackSearchReturn callback(const Point &pointStart, const Point &pointStop)
Callback method.
Callback for computing the ordinal for a specified point, as a function of the LineStyle and curve ge...
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:17
CallbackSearchReturn
Return values for search callback methods.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Details for a specific Line.
Definition: LineStyle.h:13