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