Engauge Digitizer  2
ExportToFile.cpp
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 #include "Document.h"
8 #include "ExportFileFunctions.h"
9 #include "ExportFileRelations.h"
10 #include "ExportToFile.h"
11 #include "Logger.h"
12 #include "MainWindowModel.h"
13 #include <QTextStream>
14 #include "Transformation.h"
15 
16 const QString CSV_FILENAME_EXTENSION ("csv");
17 const QString TSV_FILENAME_EXTENSION ("tsv");
18 
20 {
21 }
22 
24  const Document &document,
25  const MainWindowModel &modelMainWindow,
26  const Transformation &transformation,
27  QTextStream &str) const
28 {
29  LOG4CPP_INFO_S ((*mainCat)) << "ExportToFile::exportToFile";
30 
31  unsigned int numWritesSoFar = 0;
32 
33  ExportFileFunctions exportFunctions;
34  exportFunctions.exportToFile (modelExport,
35  document,
36  modelMainWindow,
37  transformation,
38  str,
39  numWritesSoFar);
40 
41  ExportFileRelations exportRelations;
42  exportRelations.exportToFile (modelExport,
43  document,
44  modelMainWindow,
45  transformation,
46  str,
47  numWritesSoFar);
48 }
49 
51 {
52  return CSV_FILENAME_EXTENSION;
53 }
54 
56 {
57  return TSV_FILENAME_EXTENSION;
58 }
59 
60 QString ExportToFile::filterCsv () const
61 {
62  return QString ("Text CSV (*.%1)")
63  .arg (CSV_FILENAME_EXTENSION);
64 }
65 
66 QString ExportToFile::filterTsv () const
67 {
68  return QString ("Text TSV (*.%1)")
69  .arg (TSV_FILENAME_EXTENSION);
70 }
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
QString filterCsv() const
QFileDialog filter for CSV files.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
Model for DlgSettingsMainWindow.
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str, unsigned int &numWritesSoFar) const
Export Document points according to the settings.
Storage of one imported image and the data attached to that image.
Definition: Document.h:41
QString fileExtensionTsv() const
File extension for tsv export files.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
QString fileExtensionCsv() const
File extension for csv export files.
QString filterTsv() const
QFileDialog filter for TSV files.
ExportToFile()
Single constructor.
void exportToFile(const DocumentModelExportFormat &modelExportOverride, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str, unsigned int &numWritesSoFar) const
Export Document points according to the settings.