Engauge Digitizer  2
OrdinalGenerator.cpp
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "CallbackPointOrdinal.h"
8 #include "Document.h"
9 #include "OrdinalGenerator.h"
10 #include "Transformation.h"
11 
12 OrdinalGenerator::OrdinalGenerator ()
13 {
14 }
15 
17 {
18  // Values that really only apply to curve points. These are set arbitrarily
19  QPointF posScreen (0, 0);
20  Transformation transformation;
21 
22  CallbackPointOrdinal ftor (document.modelCurveStyles().lineStyle(AXIS_CURVE_NAME),
23  transformation,
24  posScreen);
25 
26  Functor2wRet<const Point&, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
28  document.iterateThroughCurveSegments (AXIS_CURVE_NAME,
29  ftorWithCallback);
30 
31  return ftor.ordinal () + 1.0;
32 }
33 
35  const Transformation &transformation,
36  const QPointF &posScreen,
37  const QString &curveName)
38 {
39  CallbackPointOrdinal ftor (document.modelCurveStyles().lineStyle(curveName),
40  transformation,
41  posScreen);
42 
43  Functor2wRet<const Point&, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
45  document.iterateThroughCurveSegments (curveName,
46  ftorWithCallback);
47 
48  return ftor.ordinal () + 1.0;
49 }
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...
Affine transformation between screen and graph coordinates, based on digitized axis points...
const LineStyle lineStyle(const QString &curveName) const
Get method for copying one line style in one step.
Definition: CurveStyles.cpp:97
Storage of one imported image and the data attached to that image.
Definition: Document.h:41
double generateAxisPointOrdinal(const Document &document)
Select ordinal just for uniqueness, since there is never a curve drawn through the axis points...
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:457
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
Definition: Document.cpp:696
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.