7 #include "ExportXThetaValuesMergedFunctions.h" 8 #include "ExportAlignLinear.h" 9 #include "ExportAlignLog.h" 10 #include "ExportLayoutFunctions.h" 11 #include "ExportPointsSelectionFunctions.h" 15 #include "Transformation.h" 20 const ValuesVectorXOrY &xThetaValuesRaw,
22 m_modelExport (modelExport),
23 m_xThetaValuesRaw (xThetaValuesRaw),
24 m_transformation (transformation)
28 void ExportXThetaValuesMergedFunctions::firstSimplestNumberLinear (
double &xThetaFirstSimplestNumber,
30 double &xThetaMax)
const 32 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::firstSimplestNumberLinear";
35 xThetaMin = m_xThetaValuesRaw.firstKey();
36 xThetaMax = m_xThetaValuesRaw.lastKey();
45 void ExportXThetaValuesMergedFunctions::firstSimplestNumberLog (
double &xThetaFirstSimplestNumber,
47 double &xThetaMax)
const 49 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::firstSimplestNumberLog";
52 xThetaMin = m_xThetaValuesRaw.firstKey();
53 xThetaMax = m_xThetaValuesRaw.lastKey();
62 ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLinear()
const 64 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::periodicLinear";
66 if (m_xThetaValuesRaw.count () > 0) {
68 double xThetaFirstSimplestNumber, xThetaMin, xThetaMax;
69 firstSimplestNumberLinear (xThetaFirstSimplestNumber,
76 return periodicLinearGraph(xThetaFirstSimplestNumber,
80 return periodicLinearScreen(xThetaMin,
85 ExportValuesXOrY emptyList;
90 ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLinearGraph(
double xThetaFirstSimplestNumber,
92 double xThetaMax)
const 94 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::periodicLinearGraph";
97 ValuesVectorXOrY values;
98 double xTheta = xThetaFirstSimplestNumber;
99 while (xTheta > xThetaMin) {
102 if (xTheta < xThetaMin) {
103 values [xThetaMin] =
true;
107 while (xTheta <= xThetaMax) {
108 values [xTheta] =
true;
112 if (xTheta > xThetaMax) {
113 values [xThetaMax] =
true;
116 return values.keys();
119 ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLinearScreen (
double xThetaMin,
120 double xThetaMax)
const 122 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::periodicLinearScreen";
124 const double ARBITRARY_Y = 0.0;
127 QPointF posScreenFirst, posScreenLast;
134 double deltaScreenX = posScreenLast.x() - posScreenFirst.x();
135 double deltaScreenY = posScreenLast.y() - posScreenFirst.y();
136 double deltaScreen = qSqrt (deltaScreenX * deltaScreenX + deltaScreenY * deltaScreenY);
141 if ((interval > 0) &&
142 (interval < deltaScreen)) {
143 s = interval / deltaScreen;
148 double xNext = xThetaMin + s * (xThetaMax - xThetaMin);
149 double delta = xNext - xThetaMin;
151 ValuesVectorXOrY values;
153 double xTheta = xThetaMin;
154 while (xTheta <= xThetaMax) {
156 values [xTheta] =
true;
161 return values.keys();
164 ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLog()
const 166 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::periodicLog";
168 double xThetaFirstSimplestNumber, xThetaMin, xThetaMax;
169 firstSimplestNumberLog (xThetaFirstSimplestNumber,
176 return periodicLogGraph(xThetaFirstSimplestNumber,
180 return periodicLogScreen(xThetaMin,
185 ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLogGraph (
double xThetaFirstSimplestNumber,
187 double xThetaMax)
const 189 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::periodicLogGraph";
192 ValuesVectorXOrY values;
193 double xTheta = xThetaFirstSimplestNumber;
194 while (xTheta > xThetaMin) {
197 if (xTheta < xThetaMin) {
198 values [xThetaMin] =
true;
202 while (xTheta <= xThetaMax) {
203 values [xTheta] =
true;
207 if (xTheta > xThetaMax) {
208 values [xThetaMax] =
true;
211 return values.keys();
214 ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLogScreen (
double xThetaMin,
215 double xThetaMax)
const 217 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::periodicLogScreen";
219 const double ARBITRARY_Y = 0.0;
222 QPointF posScreenFirst, posScreenLast;
229 double deltaScreenX = posScreenLast.x() - posScreenFirst.x();
230 double deltaScreenY = posScreenLast.y() - posScreenFirst.y();
231 double deltaScreen = qSqrt (deltaScreenX * deltaScreenX + deltaScreenY * deltaScreenY);
236 if ((interval > 0) &&
237 (interval < deltaScreen)) {
238 s = interval / deltaScreen;
243 double xNext = qExp (qLn (xThetaMin) + s * (qLn (xThetaMax) - qLn (xThetaMin)));
244 double scale = xNext / xThetaMin;
246 ValuesVectorXOrY values;
248 double xTheta = xThetaMin;
249 while (xTheta <= xThetaMax) {
251 values [xTheta] =
true;
256 return values.keys();
261 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportXThetaValuesMergedFunctions::xThetaValues";
268 ExportValuesXOrY empty;
275 return periodicLinear ();
277 return periodicLog ();
283 return m_xThetaValuesRaw.keys();
ExportValuesXOrY xThetaValues() const
Resulting x/theta values for all included functions.
ExportXThetaValuesMergedFunctions(const DocumentModelExportFormat &modelExport, const ValuesVectorXOrY &xThetaValuesRaw, const Transformation &transformation)
Single constructor.
Pick first simplest x value between specified min and max, for linear scaling.
Pick first simplest x value between specified min and max, for log scaling.
double firstSimplestNumber() const
Result.
CoordScale coordScaleXTheta() const
Get method for linear/log scale on x/theta.
double firstSimplestNumber() const
Result.