Engauge Digitizer  2
OrdinalGenerator.cpp
1 #include "CallbackPointOrdinal.h"
2 #include "Document.h"
3 #include "OrdinalGenerator.h"
4 #include "Transformation.h"
5 
6 OrdinalGenerator::OrdinalGenerator ()
7 {
8 }
9 
11 {
12  // Values that really only apply to curve points. These are set arbitrarily
13  QPointF posScreen (0, 0);
14  Transformation transformation;
15 
16  CallbackPointOrdinal ftor (document.modelCurveStyles().lineStyle(AXIS_CURVE_NAME),
17  transformation,
18  posScreen);
19 
20  Functor2wRet<const Point&, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
22  document.iterateThroughCurveSegments (AXIS_CURVE_NAME,
23  ftorWithCallback);
24 
25  return ftor.ordinal () + 1.0;
26 }
27 
29  const Transformation &transformation,
30  const QPointF &posScreen,
31  const QString &curveName)
32 {
33  CallbackPointOrdinal ftor (document.modelCurveStyles().lineStyle(curveName),
34  transformation,
35  posScreen);
36 
37  Functor2wRet<const Point&, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
39  document.iterateThroughCurveSegments (curveName,
40  ftorWithCallback);
41 
42  return ftor.ordinal () + 1.0;
43 }
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...
const LineStyle lineStyle(const QString &curveName) const
Get method for copying one line style in one step.
Definition: CurveStyles.cpp:90
Affine transformation between screen and graph coordinates, based on digitized axis points...
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
Definition: Document.cpp:452
Storage of one imported image and the data attached to that image.
Definition: Document.h:28
void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
Definition: Document.cpp:369
double generateAxisPointOrdinal(const Document &document)
Select ordinal just for uniqueness, since there is never a curve drawn through the axis points...
double generateCurvePointOrdinal(const Document &document, const Transformation &transformation, const QPointF &posScreen, const QString &curveName)
Select ordinal so new point curve passes smoothly through existing points.