Engauge Digitizer  2
CallbackGatherXThetaValuesFunctions.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 "CallbackGatherXThetaValuesFunctions.h"
8 #include "DocumentModelExportFormat.h"
9 #include "ExportAlignLinear.h"
10 #include "ExportAlignLog.h"
11 #include "ExportLayoutFunctions.h"
12 #include "ExportPointsSelectionFunctions.h"
13 #include "Logger.h"
14 #include "Point.h"
15 
17  const QStringList &curvesIncluded,
18  const Transformation &transformation) :
19  m_transformation (transformation)
20 {
21  bool firstCurveForGatherXTheta = (modelExport.pointsSelectionFunctions() == EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_FIRST_CURVE);
22 
23  // Included just the first curve, or all curves depending on DocumentModelExportFormat
24  QStringList::const_iterator itr;
25  for (itr = curvesIncluded.begin(); itr != curvesIncluded.end(); itr++) {
26 
27  QString curveIncluded = *itr;
28  m_curveNamesIncluded [curveIncluded] = true;
29 
30  if (firstCurveForGatherXTheta) {
31 
32  // We only want points belonging to the first included curve so exit this loop
33  break;
34 
35  }
36  }
37 }
38 
39 CallbackSearchReturn CallbackGatherXThetaValuesFunctions::callback (const QString &curveName,
40  const Point &point)
41 {
42  LOG4CPP_DEBUG_S ((*mainCat)) << "CallbackGatherXThetaValuesFunctions::callback"
43  << " curveName=" << curveName.toLatin1().data()
44  << " point=" << point.identifier().toLatin1().data();
45 
46  if (m_curveNamesIncluded.contains (curveName)) {
47 
48  QPointF posGraph;
49  m_transformation.transformScreenToRawGraph (point.posScreen(),
50  posGraph);
51 
52  m_xThetaValues [posGraph.x ()] = true;
53  }
54 
55  return CALLBACK_SEARCH_RETURN_CONTINUE;
56 }
57 
59 {
60  LOG4CPP_INFO_S ((*mainCat)) << "CallbackGatherXThetaValuesFunctions::xThetaValuesRaw";
61 
62  return m_xThetaValues;
63 }
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:23
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:392
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
ValuesVectorXOrY xThetaValuesRaw() const
Resulting x/theta values for all included functions.
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:256
Affine transformation between screen and graph coordinates, based on digitized axis points...
CallbackGatherXThetaValuesFunctions(const DocumentModelExportFormat &modelExport, const QStringList &curveNamesIncluded, const Transformation &transformation)
Single constructor.
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
ExportPointsSelectionFunctions pointsSelectionFunctions() const
Get method for point selection for functions.