Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
ExportFileFunctions.h
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 EXPORT_FILE_FUNCTIONS_H
8 #define EXPORT_FILE_FUNCTIONS_H
9 
10 #include "ExportFileAbstractBase.h"
11 #include "ExportValuesXOrY.h"
12 #include <QStringList>
13 #include <QVector>
14 
15 class Document;
19 class MainWindowModel;
20 class QTextStream;
21 class Transformation;
22 
25 {
26  // For unit testing
27  friend class TestExport;
28 
29 public:
32 
35  void exportToFile (const DocumentModelExportFormat &modelExportOverride,
36  const Document &document,
37  const MainWindowModel &modelMainWindow,
38  const Transformation &transformation,
39  QTextStream &str) const;
40 
41 private:
42 
43  void exportAllPerLineXThetaValuesMerged (const DocumentModelExportFormat &modelExportOverride,
44  const Document &document,
45  const MainWindowModel &modelMainWindow,
46  const QStringList &curvesIncluded,
47  const ExportValuesXOrY &xThetaValues,
48  const QString &delimiter,
49  const Transformation &transformation,
50  bool isLogXTheta,
51  bool isLogYRadius,
52  QTextStream &str) const;
53  void exportOnePerLineXThetaValuesMerged (const DocumentModelExportFormat &modelExportOverride,
54  const Document &document,
55  const MainWindowModel &modelMainWindow,
56  const QStringList &curvesIncluded,
57  const ExportValuesXOrY &xThetaValues,
58  const QString &delimiter,
59  const Transformation &transformation,
60  bool isLogXTheta,
61  bool isLogYRadius,
62  QTextStream &str) const;
63 
67  void initializeYRadiusValues (const QStringList &curvesIncluded,
68  const ExportValuesXOrY &xThetaValuesMerged,
69  QVector<QVector<QString*> > &yRadiusValues) const;
70 
71  double linearlyInterpolate (const Points &points,
72  double xThetaValue,
73  const Transformation &transformation) const;
74  void loadYRadiusValues (const DocumentModelExportFormat &modelExport,
75  const Document &document,
76  const MainWindowModel &modelMainWindow,
77  const QStringList &curvesIncluded,
78  const Transformation &transformation,
79  bool isLogXTheta,
80  bool isLogYRadius,
81  const ExportValuesXOrY &xThetaValues,
82  QVector<QVector<QString*> > &yRadiusValues) const;
83  void loadYRadiusValuesForCurveInterpolatedSmooth (const DocumentModelCoords &modelCoords,
84  const DocumentModelGeneral &modelGeneral,
85  const MainWindowModel &modelMainWindow,
86  const Points &points,
87  const ExportValuesXOrY &xThetaValues,
88  const Transformation &transformation,
89  bool isLogXTheta,
90  bool isLogYRadius,
91  QVector<QString*> &yRadiusValues) const;
92  void loadYRadiusValuesForCurveInterpolatedStraight (const DocumentModelCoords &modelCoords,
93  const DocumentModelGeneral &modelGeneral,
94  const MainWindowModel &modelMainWindow,
95  const Points &points,
96  const ExportValuesXOrY &xThetaValues,
97  const Transformation &transformation,
98  QVector<QString*> &yRadiusValues) const;
99  void loadYRadiusValuesForCurveRaw (const DocumentModelCoords &modelCoords,
100  const DocumentModelGeneral &modelGeneral,
101  const MainWindowModel &modelMainWindow,
102  const Points &points,
103  const ExportValuesXOrY &xThetaValues,
104  const Transformation &transformation,
105  QVector<QString*> &yRadiusValues) const;
106 
108  void outputXThetaYRadiusValues (const DocumentModelExportFormat &modelExportOverride,
109  const DocumentModelCoords &modelCoords,
110  const DocumentModelGeneral &modelGeneral,
111  const MainWindowModel &modelMainWindow,
112  const QStringList &curvesIncluded,
113  const ExportValuesXOrY &xThetaValuesMerged,
114  const Transformation &transformation,
115  QVector<QVector<QString*> > &yRadiusValues,
116  const QString &delimiter,
117  QTextStream &str) const;
118  // Only include rows that have at least one y/radius entry. This check is required when outputing one curve per row
119  // since the union of all x/theta values is applied to each curve
120  bool rowHasAtLeastOneYRadiusEntry (const QVector<QVector<QString*> > &yRadiusValues,
121  int row) const;
122 };
123 
124 #endif // EXPORT_FILE_FUNCTIONS_H
Model for DlgSettingsGeneral and CmdSettingsGeneral.
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
ExportFileFunctions()
Single constructor.
Unit test of Export classes.
Definition: TestExport.h:7
Affine transformation between screen and graph coordinates, based on digitized axis points...
Model for DlgSettingsMainWindow.
Model for DlgSettingsCoords and CmdSettingsCoords.
Storage of one imported image and the data attached to that image.
Definition: Document.h:41
Strategy base class for exporting to a file. This class provides common methods.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.