2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28 #include "operation.h"
29 // #include "guimainwindow.h"
33 #include <QTextStream>
36 #include <vtkLongArray.h>
37 #include <vtkIntArray.h>
38 #include <vtkDoubleArray.h>
39 #include <vtkPointData.h>
40 #include <vtkCellData.h>
44 class IOOperation
: public Operation
47 private: // attributes
49 bool m_Valid
; ///< flag to determine if a valid file has been selected
50 QString m_FileName
; ///< file name to read -- normally set by inputReadFileName()
51 char m_FileName_cc
[1024]; ///< "const char *" copy version of file name to read -- only used by getCFileName()
52 QString m_FormatTxt
; ///< file format string (e.g. *.stl, *.vtu, ...)
53 QString m_ExtensionTxt
; ///< file extension for write operations
54 bool m_FileNameSet
; ///< has the file name been set already (batch operation)?
59 * Set the file format string for this Reader.
60 * @param format the file name extension (e.g. *.stl, *.vtu, ...)
62 void setFormat(QString format
);
65 * Set the file extension string for write operations.
66 * @param extension the file name extension (e.g. *.stl, *.vtu, ...)
68 void setExtension(QString format
);
71 * Get a standard C string representing the file name.
72 * @return the file name
74 const char* getCFileName();
78 * @return the file name (as QString)
80 QString
getFileName();
83 * Access to the valid flag (true if a valid file name has been selected)
84 * @return the valid flag
91 virtual ~IOOperation() {}
93 void readInputFileName(QString default_filename
, bool reset
= true); ///< Open a QFileDialog and make the user input a file name for opening or importing.
94 void readOutputFileName(QString default_filename
); ///< Open a QFileDialog and make the user input a file name for saving or exporting.
95 void readOutputDirectory(); ///< Open a QFileDialog and make the user input a directory name for exporting.
96 void readInputDirectory(QString title_txt
= "select input directory"); ///< Open a QFileDialog and make the user input a directory name for importing.
97 void setFileName(QString file_name
); ///< set the file name for batch operation