Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Callback
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
7
#include "
CallbackGatherXThetasAbstractBase.h
"
8
#include "
DocumentModelExportFormat.h
"
9
#include "
EngaugeAssert.h
"
10
#include "
ExportAlignLinear.h
"
11
#include "
ExportAlignLog.h
"
12
#include "
ExportLayoutFunctions.h
"
13
#include "
ExportPointsSelectionFunctions.h
"
14
#include "
Logger.h
"
15
#include "
Point.h
"
16
17
CallbackGatherXThetasAbstractBase::CallbackGatherXThetasAbstractBase
(
bool
firstCurveOnly,
18
bool
extrapolateOutsideEndpoints,
19
const
QStringList &
curvesIncluded
,
20
const
Transformation
&
transformation
) :
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
41
CallbackGatherXThetasAbstractBase::~CallbackGatherXThetasAbstractBase
()
42
{
43
}
44
45
void
CallbackGatherXThetasAbstractBase::addGraphX
(
double
xGraph)
46
{
47
m_xThetaValues [xGraph] =
true
;
48
}
49
50
CurveLimits
CallbackGatherXThetasAbstractBase::curveLimitsMax
()
const
51
{
52
return
m_curveLimitsMax;
53
}
54
55
CurveLimits
CallbackGatherXThetasAbstractBase::curveLimitsMin
()
const
56
{
57
return
m_curveLimitsMin;
58
}
59
60
QStringList
CallbackGatherXThetasAbstractBase::curvesIncluded
()
const
61
{
62
return
m_curvesIncluded;
63
}
64
65
CurvesIncludedHash
CallbackGatherXThetasAbstractBase::curvesIncludedHash
()
const
66
{
67
return
m_curvesIncludedHash;
68
}
69
70
const
Transformation
&
CallbackGatherXThetasAbstractBase::transformation
()
const
71
{
72
return
m_transformation;
73
}
74
75
void
CallbackGatherXThetasAbstractBase::updateMinMax
(
const
QString &curveName,
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;
85
transformation
().
transformScreenToRawGraph
(point.
posScreen
(),
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
102
ValuesVectorXOrY
CallbackGatherXThetasAbstractBase::xThetaValuesRaw
()
const
103
{
104
qCInfo(ENGAUGE_LOG) <<
"CallbackGatherXThetasAbstractBase::xThetaValuesRaw"
;
105
106
return
m_xThetaValues;
107
}
CallbackGatherXThetasAbstractBase.h
CurveLimits
QHash< QString, double > CurveLimits
Definition
CurveLimits.h:14
CurvesIncludedHash
QHash< QString, bool > CurvesIncludedHash
Definition
CurvesIncludedHash.h:14
DocumentModelExportFormat.h
EngaugeAssert.h
ExportAlignLinear.h
ExportAlignLog.h
ExportLayoutFunctions.h
ExportPointsSelectionFunctions.h
Logger.h
Point.h
ValuesVectorXOrY
QMap< double, bool > ValuesVectorXOrY
Definition
ValuesVectorXOrY.h:14
CallbackGatherXThetasAbstractBase::transformation
const Transformation & transformation() const
Get method for transformation.
Definition
CallbackGatherXThetasAbstractBase.cpp:70
CallbackGatherXThetasAbstractBase::updateMinMax
void updateMinMax(const QString &curveName, const Point &point)
Update the tracked min and max values for each curve.
Definition
CallbackGatherXThetasAbstractBase.cpp:75
CallbackGatherXThetasAbstractBase::~CallbackGatherXThetasAbstractBase
virtual ~CallbackGatherXThetasAbstractBase()
Definition
CallbackGatherXThetasAbstractBase.cpp:41
CallbackGatherXThetasAbstractBase::curvesIncludedHash
CurvesIncludedHash curvesIncludedHash() const
Get method for included names as hash.
Definition
CallbackGatherXThetasAbstractBase.cpp:65
CallbackGatherXThetasAbstractBase::curveLimitsMax
CurveLimits curveLimitsMax() const
Endpoint maxima for each curve, if extrapolation has been disabled.
Definition
CallbackGatherXThetasAbstractBase.cpp:50
CallbackGatherXThetasAbstractBase::addGraphX
void addGraphX(double xGraph)
Save one graph x value.
Definition
CallbackGatherXThetasAbstractBase.cpp:45
CallbackGatherXThetasAbstractBase::xThetaValuesRaw
ValuesVectorXOrY xThetaValuesRaw() const
Resulting x/theta values for all included functions.
Definition
CallbackGatherXThetasAbstractBase.cpp:102
CallbackGatherXThetasAbstractBase::curvesIncluded
QStringList curvesIncluded() const
Get method for included names.
Definition
CallbackGatherXThetasAbstractBase.cpp:60
CallbackGatherXThetasAbstractBase::CallbackGatherXThetasAbstractBase
CallbackGatherXThetasAbstractBase(bool firstCurveOnly, bool extrapolateOutsideEndpoints, const QStringList &curvesIncluded, const Transformation &transformation)
Single constructor.
Definition
CallbackGatherXThetasAbstractBase.cpp:17
CallbackGatherXThetasAbstractBase::curveLimitsMin
CurveLimits curveLimitsMin() const
Endpoint minima for each curve, if extrapolation has been disabled.
Definition
CallbackGatherXThetasAbstractBase.cpp:55
Point
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition
Point.h:26
Point::posScreen
QPointF posScreen() const
Accessor for screen position.
Definition
Point.cpp:404
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition
Transformation.h:32
Transformation::transformScreenToRawGraph
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
Definition
Transformation.cpp:465
Generated on
for Engauge Digitizer by
1.17.0