23 m_modelExport (modelExport),
24 m_modelMainWindow (modelMainWindow),
25 m_xThetaValuesRaw (xThetaValuesRaw),
26 m_transformation (transformation)
30bool ExportXThetaValuesMergedFunctions::breakForPointOverrun (
unsigned int curveSize,
31 bool &isOverrun)
const
40void ExportXThetaValuesMergedFunctions::firstSimplestNumberLinear (
double &xThetaFirstSimplestNumber,
42 double &xThetaMax)
const
47 xThetaMin = m_xThetaValuesRaw.firstKey();
48 xThetaMax = m_xThetaValuesRaw.lastKey();
51 ExportAlignLinear alignLinear (xThetaMin,
54 xThetaFirstSimplestNumber = alignLinear.firstSimplestNumber ();
57void ExportXThetaValuesMergedFunctions::firstSimplestNumberLog (
double &xThetaFirstSimplestNumber,
59 double &xThetaMax)
const
64 xThetaMin = m_xThetaValuesRaw.firstKey();
65 xThetaMax = m_xThetaValuesRaw.lastKey();
68 ExportAlignLog alignLog (xThetaMin,
71 xThetaFirstSimplestNumber = alignLog.firstSimplestNumber();
74ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLinear(
bool &isOverrun)
const
78 if (m_xThetaValuesRaw.count () > 0) {
80 double xThetaFirstSimplestNumber, xThetaMin, xThetaMax;
81 firstSimplestNumberLinear (xThetaFirstSimplestNumber,
88 return periodicLinearGraph(xThetaFirstSimplestNumber,
93 return periodicLinearScreen(xThetaMin,
104ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLinearGraph(
double xThetaFirstSimplestNumber,
107 bool &isOverrun)
const
113 double xTheta = xThetaFirstSimplestNumber;
114 while (xTheta > xThetaMin) {
115 xTheta -= m_modelExport.pointsIntervalFunctions();
117 if (xTheta < xThetaMin) {
118 values [xThetaMin] =
true;
121 xTheta += m_modelExport.pointsIntervalFunctions();
122 while (xTheta <= xThetaMax) {
124 values [xTheta] =
true;
125 xTheta += m_modelExport.pointsIntervalFunctions();
127 if (breakForPointOverrun (values.count(),
133 if (xTheta > xThetaMax) {
134 values [xThetaMax] =
true;
137 return values.keys();
140ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLinearScreen (
double xThetaMin,
142 bool &isOverrun)
const
148 const double ARBITRARY_Y = 1.0;
151 QPointF posScreenFirst, posScreenLast;
152 m_transformation.transformRawGraphToScreen(QPointF (xThetaMin,
155 m_transformation.transformRawGraphToScreen(QPointF (xThetaMax,
158 double deltaScreenX = posScreenLast.x() - posScreenFirst.x();
162 double interval = m_modelExport.pointsIntervalFunctions();
163 if ((interval > 0) &&
164 (interval < deltaScreenX)) {
165 s = interval / deltaScreenX;
170 double xNext = xThetaMin + s * (xThetaMax - xThetaMin);
171 double delta = xNext - xThetaMin;
175 double xTheta = xThetaMin;
176 while (xTheta <= xThetaMax) {
178 values [xTheta] =
true;
181 if (breakForPointOverrun (values.count(),
187 return values.keys();
190ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLog(
bool &isOverrun)
const
194 double xThetaFirstSimplestNumber, xThetaMin, xThetaMax;
195 firstSimplestNumberLog (xThetaFirstSimplestNumber,
202 return periodicLogGraph(xThetaFirstSimplestNumber,
207 return periodicLogScreen(xThetaMin,
213ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLogGraph (
double xThetaFirstSimplestNumber,
216 bool &isOverrun)
const
222 double xTheta = xThetaFirstSimplestNumber;
223 if (m_modelExport.pointsIntervalFunctions() > 1) {
224 while (xTheta > xThetaMin) {
225 xTheta /= m_modelExport.pointsIntervalFunctions();
228 if (xTheta < xThetaMin) {
229 values [xThetaMin] =
true;
232 if (m_modelExport.pointsIntervalFunctions() > 1) {
233 xTheta *= m_modelExport.pointsIntervalFunctions();
234 while (xTheta <= xThetaMax) {
236 values [xTheta] =
true;
237 xTheta *= m_modelExport.pointsIntervalFunctions();
239 if (breakForPointOverrun (values.count(),
246 if (xTheta > xThetaMax) {
247 values [xThetaMax] =
true;
250 return values.keys();
253ExportValuesXOrY ExportXThetaValuesMergedFunctions::periodicLogScreen (
double xThetaMin,
255 bool &isOverrun)
const
259 const double ARBITRARY_Y = 0.0;
262 QPointF posScreenFirst, posScreenLast;
263 m_transformation.transformRawGraphToScreen(QPointF (xThetaMin,
266 m_transformation.transformRawGraphToScreen(QPointF (xThetaMax,
269 double deltaScreenX = posScreenLast.x() - posScreenFirst.x();
270 double deltaScreenY = posScreenLast.y() - posScreenFirst.y();
271 double deltaScreen = qSqrt (deltaScreenX * deltaScreenX + deltaScreenY * deltaScreenY);
275 double interval = m_modelExport.pointsIntervalFunctions();
276 if ((interval > 0) &&
277 (interval < deltaScreen)) {
278 s = interval / deltaScreen;
283 double xNext = qExp (qLn (xThetaMin) + s * (qLn (xThetaMax) - qLn (xThetaMin)));
284 double scale = xNext / xThetaMin;
288 double xTheta = xThetaMin;
289 while (xTheta <= xThetaMax) {
291 values [xTheta] =
true;
294 if (breakForPointOverrun (values.count(),
300 return values.keys();
312 if (qAbs (m_modelExport.pointsIntervalFunctions()) <= 0) {
318 bool isLinear = (m_transformation.modelCoords().coordScaleXTheta() ==
COORD_SCALE_LINEAR);
321 values = periodicLinear (isOverrun);
323 values = periodicLog (isOverrun);
339 return m_xThetaValuesRaw.keys();
@ EXPORT_POINTS_INTERVAL_UNITS_GRAPH
@ EXPORT_POINTS_SELECTION_FUNCTIONS_INTERPOLATE_PERIODIC
QList< double > ExportValuesXOrY
log4cpp::Category * mainCat
QMap< double, bool > ValuesVectorXOrY
ExportXThetaValuesMergedFunctions(const DocumentModelExportFormat &modelExport, const MainWindowModel &modelMainWindow, const ValuesVectorXOrY &xThetaValuesRaw, const Transformation &transformation)
Single constructor.
ExportValuesXOrY xThetaValues(bool &isOverrun) const
Resulting x/theta values for all included functions.
Model for DlgSettingsMainWindow.
int maximumExportedPointsPerCurve() const
Get method for maximum number of exported points per curve.
#define LOG4CPP_INFO_S(logger)