Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FileOpenVolumeMesh.hh
1 /*===========================================================================*\
2 * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40  \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44  * $Revision: 13548 $ *
45  * $LastChangedBy: kremer $ *
46  * $Date: 2012-01-27 11:58:19 +0100 (Fr, 27 Jan 2012) $ *
47  * *
48  \*===========================================================================*/
49 
50 #ifndef FILEOPENVOLUMEMESH_HH
51 #define FILEOPENVOLUMEMESH_HH
52 
53 #include <QObject>
54 #include <QMenuBar>
55 
62 #include <OpenFlipper/BasePlugin/INIInterface.hh>
64 
67 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
69 #endif // ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
70 #ifndef FILEOPENVOLUMEMESHT_CC
71  #include <OpenVolumeMesh/FileManager/FileManager.hh>
72 #endif
73 
74 class FileOpenVolumeMeshPlugin: public QObject,
80  INIInterface {
81 Q_OBJECT
82 Q_INTERFACES(FileInterface)
83 Q_INTERFACES(LoadSaveInterface)
84 Q_INTERFACES(LoggingInterface)
85 Q_INTERFACES(BaseInterface)
86 Q_INTERFACES(ScriptInterface)
87 Q_INTERFACES(INIInterface)
88 #if QT_VERSION >= 0x050000
89  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-FileOVM")
90 #endif
91 public:
92  // Default constructor
94 
95 signals:
96  void openedFile(int _id);
97  void addEmptyObject(DataType _type, int& _id);
98  void load(QString _filename, DataType _type, int& _id);
99  void save(int _id, QString _filename);
100  void log(Logtype _type, QString _message);
101  void log(QString _message);
102 
103  void emptyObjectAdded(int _id);
104 
105  void updateView();
106  void updatedObject(int _id, const UpdateType& _type);
107 
108  void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
109 
110 private slots:
111 
112  void fileOpened(int /*_id*/) {}
113 
114  void loadIniFileLast(INIFile& _ini, int _id);
115  void saveIniFile(INIFile& _ini, int _id);
116 
117  void initializePlugin();
118 
119 public:
120 
122 
123  QString name() {
124  return (QString("FileOpenVolumeMesh"));
125  }
126 
127  QString description() {
128  return (QString(tr("Load/Save OpenVolumeMeshes")));
129  }
130 
132 
133  QString getSaveFilters();
134  QString getLoadFilters();
135 
136  QWidget* saveOptionsWidget(QString _currentFilter);
137  QWidget* loadOptionsWidget(QString _currentFilter);
138 
139 public slots:
140 
141  int loadObject(QString _filename);
142 
143  bool saveObject(int _id, QString _filename);
144 
145  QString version() {
146  return QString("1.0");
147  }
148 
149 private:
150 
151  template <typename MeshT>
152  void loadMesh(const char* _filename, MeshT& _mesh, bool _comp, bool _topCheck);
153 
154  template <typename MeshT>
155  void saveMesh(const char* _filename, MeshT& _mesh, bool _comp);
156 
157 private:
158 
159  QWidget* loadOptions_;
160  QWidget* saveOptions_;
161 
162  QComboBox* typeCheck_;
163 
164  QCheckBox* loadCompMode_;
165  QCheckBox* loadTopCheck_;
166  QCheckBox* saveCompMode_;
167 
168  OpenVolumeMesh::IO::FileManager fileManager_;
169 };
170 
171 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOPENVOLUMEMESHT_CC)
172 #include "FileOpenVolumeMeshT.cc"
173 #endif
174 
175 #endif //FILEOPENVOLUMEMESH_HH
Read/Write mesh data from/to files.
Definition: FileManager.hh:60
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which provide scriptable Functions.
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
QWidget * loadOptionsWidget(QString _currentFilter)
Interface for all Plugins which do logging to the logging window of the framework.
Update type class.
Definition: UpdateType.hh:70
Interface class from which all plugins have to be created.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Logtype
Log types for Message Window.
Interface class for file handling.
Predefined datatypes.
Definition: DataTypes.hh:96
QString name()
Return a name for the plugin.
Interface class for Plugins which have to store information in ini files.
Definition: INIInterface.hh:81
QWidget * saveOptionsWidget(QString _currentFilter)
QString description()
Return a description of what the plugin is doing.