Engauge Digitizer 2
Loading...
Searching...
No Matches
CallbackGatherXThetasAbstractBase.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2019 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
9#include "EngaugeAssert.h"
10#include "ExportAlignLinear.h"
11#include "ExportAlignLog.h"
14#include "Logger.h"
15#include "Point.h"
16
18 bool extrapolateOutsideEndpoints,
19 const QStringList &curvesIncluded,
21 m_extrapolateOutsideEndpoints (extrapolateOutsideEndpoints),
22 m_curvesIncluded (curvesIncluded),
23 m_transformation (transformation)
24{
25 // Include just the first curve, or all curves depending on DocumentModelExportFormat
26 QStringList::const_iterator itr;
27 for (itr = curvesIncluded.begin(); itr != curvesIncluded.end(); itr++) {
28
29 QString curveIncluded = *itr;
30 m_curvesIncludedHash [curveIncluded] = true;
31
32 if (firstCurveOnly) {
33
34 // We only want points belonging to the first included curve so exit this loop
35 break;
36
37 }
38 }
39}
40
44
46{
47 m_xThetaValues [xGraph] = true;
48}
49
51{
52 return m_curveLimitsMax;
53}
54
56{
57 return m_curveLimitsMin;
58}
59
61{
62 return m_curvesIncluded;
63}
64
66{
67 return m_curvesIncludedHash;
68}
69
71{
72 return m_transformation;
73}
74
76 const Point &point)
77{
78 // Skip unless the endpoints are to be collected. We update the min/max values
79 // even if the curve is not curvesIncludedHash since endpoints are sometimes
80 // required for curves other than the first when collecting just xTheta values from
81 // the first curve
82 if (!m_extrapolateOutsideEndpoints) {
83
84 QPointF posGraph;
86 posGraph);
87
88 if (!m_curveLimitsMin.contains (curveName) ||
89 posGraph.x() < m_curveLimitsMin [curveName]) {
90
91 m_curveLimitsMin [curveName] = posGraph.x ();
92 }
93
94 if (!m_curveLimitsMax.contains (curveName) ||
95 posGraph.x() > m_curveLimitsMax [curveName]) {
96
97 m_curveLimitsMax [curveName] = posGraph.x ();
98 }
99 }
100}
101
103{
104 LOG4CPP_INFO_S ((*mainCat)) << "CallbackGatherXThetasAbstractBase::xThetaValuesRaw";
105
106 return m_xThetaValues;
107}
QHash< QString, double > CurveLimits
Definition CurveLimits.h:14
QHash< QString, bool > CurvesIncludedHash
log4cpp::Category * mainCat
Definition Logger.cpp:14
QMap< double, bool > ValuesVectorXOrY
const Transformation & transformation() const
Get method for transformation.
void updateMinMax(const QString &curveName, const Point &point)
Update the tracked min and max values for each curve.
CurvesIncludedHash curvesIncludedHash() const
Get method for included names as hash.
CurveLimits curveLimitsMax() const
Endpoint maxima for each curve, if extrapolation has been disabled.
void addGraphX(double xGraph)
Save one graph x value.
ValuesVectorXOrY xThetaValuesRaw() const
Resulting x/theta values for all included functions.
QStringList curvesIncluded() const
Get method for included names.
CallbackGatherXThetasAbstractBase(bool firstCurveOnly, bool extrapolateOutsideEndpoints, const QStringList &curvesIncluded, const Transformation &transformation)
Single constructor.
CurveLimits curveLimitsMin() const
Endpoint minima for each curve, if extrapolation has been disabled.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition Point.h:26
QPointF posScreen() const
Accessor for screen position.
Definition Point.cpp:404
Affine transformation between screen and graph coordinates, based on digitized axis points.
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18