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 #ifndef FILEOPENVOLUMEMESHT_CC
68  #include <OpenVolumeMesh/FileManager/FileManager.hh>
69 #endif
70 
71 class FileOpenVolumeMeshPlugin: public QObject,
77  INIInterface {
78 Q_OBJECT
79 Q_INTERFACES(FileInterface)
80 Q_INTERFACES(LoadSaveInterface)
81 Q_INTERFACES(LoggingInterface)
82 Q_INTERFACES(BaseInterface)
83 Q_INTERFACES(ScriptInterface)
84 Q_INTERFACES(INIInterface)
85 #if QT_VERSION >= 0x050000
86  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-FileOVM")
87 #endif
88 public:
89  // Default constructor
91 
92 signals:
93  void openedFile(int _id);
94  void addEmptyObject(DataType _type, int& _id);
95  void load(QString _filename, DataType _type, int& _id);
96  void save(int _id, QString _filename);
97  void log(Logtype _type, QString _message);
98  void log(QString _message);
99 
100  void emptyObjectAdded(int _id);
101 
102  void updateView();
103  void updatedObject(int _id, const UpdateType& _type);
104 
105  void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
106 
107 private slots:
108 
109  void fileOpened(int /*_id*/) {}
110 
111  void loadIniFileLast(INIFile& _ini, int _id);
112  void saveIniFile(INIFile& _ini, int _id);
113 
114  void initializePlugin();
115 
116 public:
117 
119 
120  QString name() {
121  return (QString("FileOpenVolumeMesh"));
122  }
123 
124  QString description() {
125  return (QString(tr("Load/Save OpenVolumeMeshes")));
126  }
127 
129 
130  QString getSaveFilters();
131  QString getLoadFilters();
132 
133  QWidget* saveOptionsWidget(QString _currentFilter);
134  QWidget* loadOptionsWidget(QString _currentFilter);
135 
136 public slots:
137 
138  int loadObject(QString _filename);
139 
140  bool saveObject(int _id, QString _filename);
141 
142  QString version() {
143  return QString("1.0");
144  }
145 
146 private:
147 
148  template <typename MeshT>
149  void loadMesh(const char* _filename, MeshT& _mesh, bool _comp, bool _topCheck);
150 
151  template <typename MeshT>
152  void saveMesh(const char* _filename, MeshT& _mesh, bool _comp);
153 
154 private:
155 
156  QWidget* loadOptions_;
157  QWidget* saveOptions_;
158 
159  QComboBox* typeCheck_;
160 
161  QCheckBox* loadCompMode_;
162  QCheckBox* loadTopCheck_;
163  QCheckBox* saveCompMode_;
164 
165  OpenVolumeMesh::IO::FileManager fileManager_;
166 };
167 
168 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOPENVOLUMEMESHT_CC)
169 #include "FileOpenVolumeMeshT.cc"
170 #endif
171 
172 #endif //FILEOPENVOLUMEMESH_HH
Interface class from which all plugins have to be created.
Interface class for Plugins which have to store information in ini files.
Definition: INIInterface.hh:81
Logtype
Log types for Message Window.
Update type class.
Definition: UpdateType.hh:70
QWidget * loadOptionsWidget(QString _currentFilter)
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for file handling.
QString name()
Return a name for the plugin.
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Interface for all Plugins which provide scriptable Functions.
QString description()
Return a description of what the plugin is doing.
Interface for all plugins which want to Load or Save files and create Objects.
Read/Write mesh data from/to files.
Definition: FileManager.hh:60
QWidget * saveOptionsWidget(QString _currentFilter)
Predefined datatypes.
Definition: DataTypes.hh:96