Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Callback
CallbackAxisPointsAbstract.h
Go to the documentation of this file.
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
#ifndef CALLBACK_AXIS_POINTS_ABSTRACT
8
#define CALLBACK_AXIS_POINTS_ABSTRACT
9
10
#include "
CallbackSearchReturn.h
"
11
#include "
DocumentAxesPointsRequired.h
"
12
#include "
DocumentModelCoords.h
"
13
#include <QList>
14
#include <QString>
15
#include <QTransform>
16
17
typedef
QList<QPointF>
CoordPairVector
;
18
typedef
QList<double>
CoordSingleVector
;
19
20
class
Point
;
21
35
class
CallbackAxisPointsAbstract
36
{
38
friend
class
TestGraphCoords
;
39
40
public
:
42
CallbackAxisPointsAbstract
(
const
DocumentModelCoords
&modelCoords,
43
DocumentAxesPointsRequired
documentAxesPointsRequired
);
44
46
CallbackAxisPointsAbstract
(
const
DocumentModelCoords
&modelCoords,
47
const
QString pointIdentifierOverride,
48
const
QPointF &posGraphOverride,
49
const
QPointF &posScreenOverride,
50
DocumentAxesPointsRequired
documentAxesPointsRequired
);
51
53
CallbackSearchReturn
callback
(
const
QString &curveName,
54
const
Point
&point);
55
58
QTransform
matrixGraph
()
const
;
59
62
QTransform
matrixScreen
()
const
;
63
65
double
xGraphRange
()
const
{
return
m_xGraphHigh - m_xGraphLow; }
66
68
double
yGraphRange
()
const
{
return
m_yGraphHigh - m_yGraphLow; }
69
70
protected
:
71
73
DocumentAxesPointsRequired
documentAxesPointsRequired
()
const
;
74
76
QString
errorMessage
()
const
{
return
m_errorMessage; }
77
80
bool
isError
()
const
{
return
m_isError; }
81
83
unsigned
int
numberAxisPoints
()
const
;
84
85
private
:
86
87
enum
LinearOrLog {
88
COORD_IS_LINEAR,
89
COORD_IS_LOG
90
};
91
93
bool
anyPointsRepeatPair (
const
CoordPairVector
&vector,
94
double
epsilon)
const
;
95
97
bool
anyPointsRepeatSingle (
const
CoordSingleVector
&vector,
98
double
epsilon)
const
;
99
CallbackSearchReturn
callbackRequire2AxisPoints (
const
QPointF &posScreen,
100
const
QPointF &posGraph);
101
CallbackSearchReturn
callbackRequire3AxisPoints (
const
QPointF &posScreen,
102
const
QPointF &posGraph);
103
CallbackSearchReturn
callbackRequire4AxisPoints (
bool
isXOnly,
104
const
QPointF &posScreen,
105
const
QPointF &posGraph);
106
void
computeTransforms3();
107
void
computeTransforms4();
108
void
loadTransforms2();
109
void
loadTransforms3();
110
void
loadTransforms4();
111
LinearOrLog logXGraph ()
const
;
112
LinearOrLog logYGraph ()
const
;
113
bool
threePointsAreCollinear (
const
QTransform &transform,
114
LinearOrLog logX,
115
LinearOrLog logY)
const
;
116
117
// Coordinates information that will be applied to the coordinates before they are used to compute the transformation
118
DocumentModelCoords m_modelCoords;
119
120
// For overriding one existing Point. Identifier is empty for no overriding
121
QString m_pointIdentifierOverride;
122
QPointF m_posScreenOverride;
123
QPointF m_posGraphOverride;
124
125
// Storage of (x,y) axes points for DOCUMENT_AXES_POINTS_REQUIRED_3
126
CoordPairVector
m_screenInputs;
127
CoordPairVector
m_graphOutputs;
128
129
// Storage of (x) and (y) axes points for DOCUMENT_AXES_POINTS_REQUIRED_4
130
CoordPairVector
m_screenInputsX;
// Accumulated screen coordinates for x axis points
131
CoordPairVector
m_screenInputsY;
// Accumulated screen coordinates for y axis points
132
CoordSingleVector
m_graphOutputsX;
// Accumulated x values for x axis points
133
CoordSingleVector
m_graphOutputsY;
// Accumulated y values for y axis points
134
135
// Transforms computed from DOCUMENT_AXES_POINTS_REQUIRED_3 or DOCUMENT_AXES_POINTS_REQUIRED_4 variables
136
QTransform m_screenInputsTransform;
137
QTransform m_graphOutputsTransform;
138
139
// Errors
140
bool
m_isError;
141
QString m_errorMessage;
142
143
// For computing the ranges of the graph coordinates
144
double
m_xGraphLow;
145
double
m_yGraphLow;
146
double
m_xGraphHigh;
147
double
m_yGraphHigh;
148
149
// Either 3 points (each having x AND y coordinates) or 4 points (each having x OR y coordinate) define the transform
150
DocumentAxesPointsRequired
m_documentAxesPointsRequired;
151
};
152
153
#endif
// CALLBACK_AXIS_POINTS_ABSTRACT
CoordPairVector
QList< QPointF > CoordPairVector
Definition
CallbackAxisPointsAbstract.h:17
CoordSingleVector
QList< double > CoordSingleVector
Definition
CallbackAxisPointsAbstract.h:18
CallbackSearchReturn.h
CallbackSearchReturn
CallbackSearchReturn
Return values for search callback methods.
Definition
CallbackSearchReturn.h:18
DocumentAxesPointsRequired.h
DocumentAxesPointsRequired
DocumentAxesPointsRequired
Definition
DocumentAxesPointsRequired.h:10
DocumentModelCoords.h
CallbackAxisPointsAbstract::documentAxesPointsRequired
DocumentAxesPointsRequired documentAxesPointsRequired() const
Number of axes points required for the transformation.
Definition
CallbackAxisPointsAbstract.cpp:319
CallbackAxisPointsAbstract::yGraphRange
double yGraphRange() const
Return the range of the y graph coordinate from low to high, after the transform is defined.
Definition
CallbackAxisPointsAbstract.h:68
CallbackAxisPointsAbstract::matrixGraph
QTransform matrixGraph() const
Returns graph coordinates matrix after transformIsDefined has already indicated success.
Definition
CallbackAxisPointsAbstract.cpp:493
CallbackAxisPointsAbstract::callback
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Definition
CallbackAxisPointsAbstract.cpp:83
CallbackAxisPointsAbstract::CallbackAxisPointsAbstract
CallbackAxisPointsAbstract(const DocumentModelCoords &modelCoords, DocumentAxesPointsRequired documentAxesPointsRequired)
Constructor for when all of the existing axis points are to be processed as is.
Definition
CallbackAxisPointsAbstract.cpp:24
CallbackAxisPointsAbstract::TestGraphCoords
friend class TestGraphCoords
For unit testing.
Definition
CallbackAxisPointsAbstract.h:38
CallbackAxisPointsAbstract::isError
bool isError() const
This value is checked after iterating to see if the axis data is correct.
Definition
CallbackAxisPointsAbstract.h:80
CallbackAxisPointsAbstract::numberAxisPoints
unsigned int numberAxisPoints() const
Number of axis points which is less than 3 if the axes curve is incomplete.
Definition
CallbackAxisPointsAbstract.cpp:503
CallbackAxisPointsAbstract::errorMessage
QString errorMessage() const
This value is checked after iterating to see what was wrong if the axis data was incorrect.
Definition
CallbackAxisPointsAbstract.h:76
CallbackAxisPointsAbstract::matrixScreen
QTransform matrixScreen() const
Returns screen coordinates matrix after transformIsDefined has already indicated success.
Definition
CallbackAxisPointsAbstract.cpp:498
CallbackAxisPointsAbstract::xGraphRange
double xGraphRange() const
Return the range of the x graph coordinate from low to high, after the transform is defined.
Definition
CallbackAxisPointsAbstract.h:65
DocumentModelCoords
Model for DlgSettingsCoords and CmdSettingsCoords.
Definition
DocumentModelCoords.h:21
Point
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition
Point.h:26
Generated on
for Engauge Digitizer by
1.17.0