Developer Documentation

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