Developer Documentation
Loading...
Searching...
No Matches
FileOM.hh
1/*===========================================================================*\
2* *
3* OpenFlipper *
4 * Copyright (c) 2001-2025, 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#ifndef FILEOMPLUGIN_HH
45#define FILEOMPLUGIN_HH
46
47#include <QObject>
48class QCheckBox;
49class QComboBox;
50
60
63
66{
67 Q_OBJECT
68 Q_INTERFACES(FileInterface)
69 Q_INTERFACES(LoadSaveInterface)
70 Q_INTERFACES(LoggingInterface)
71 Q_INTERFACES(BaseInterface)
72 Q_INTERFACES(ScriptInterface)
73 Q_INTERFACES(PythonInterface)
74
75 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-FileOM")
76
77 signals:
78 void openedFile( int _id );
79 void addEmptyObject( DataType _type, int& _id);
80 void load(QString _filename, DataType _type, int& _id);
81 void save(int _id , QString _filename );
82 void log(Logtype _type, QString _message);
83 void log(QString _message);
84 void updateView();
85 void updatedObject(int _identifier, const UpdateType& _type);
86
87 void deleteObject( int _id );
88
89 private slots:
90
91 void fileOpened( int /*_id*/ ){};
92
93 void noguiSupported( ) {} ;
94
95 void initializePlugin();
96
99
101 void slotLoadDefault();
102
104 void slotSaveDefault();
105
106 public :
107
108 FileOMPlugin();
109
110 ~FileOMPlugin() {};
111
112 QString name() { return (QString("FileOM")); };
113 QString description( ) { return (QString(tr("Load/Save OM-Files"))); };
114
116
117 QString getSaveFilters();
118 QString getLoadFilters();
119
120 QWidget* saveOptionsWidget(QString /*_currentFilter*/);
121 QWidget* loadOptionsWidget(QString /*_currentFilter*/);
122
123 OpenMesh::IO::Options getDefaultOptions();
124
125 public slots:
126
128 int loadObject(QString _filename);
129
131 int loadPolyMeshObject(QString _filename);
132
134 int loadTriMeshObject(QString _filename);
135
136 bool saveObject(int _id, QString _filename);
137
138 QString version() { return QString("1.0"); };
139
140 private :
141
143 template <class MeshT>
144 void backupTextureCoordinates(MeshT& _mesh);
145
146 private :
147
148 //Option Widgets
149 QWidget* loadOptions_;
150 QWidget* saveOptions_;
151
152 QCheckBox* saveBinary_;
153
154 QCheckBox* saveVertexNormal_;
155 QCheckBox* saveVertexTexCoord_;
156 QCheckBox* saveVertexColor_;
157 QCheckBox* saveFaceColor_;
158 QCheckBox* saveFaceNormal_;
159 QCheckBox* saveFaceTexCoord_;
160 QCheckBox* saveCustomProperties_;
161 QCheckBox* saveStatus_;
162 QPushButton* saveDefaultButton_;
163
164 QComboBox* triMeshHandling_;
165 QCheckBox* loadVertexNormal_;
166 QCheckBox* loadVertexTexCoord_;
167 QCheckBox* loadVertexColor_;
168 QCheckBox* loadFaceColor_;
169 QCheckBox* loadFaceNormal_;
170 QCheckBox* loadFaceTexCoord_;
171 QCheckBox* loadCustomProperties_;
172 QCheckBox* loadStatus_;
173 QPushButton* loadDefaultButton_;
174 int trimeshOptions_;
175};
176
177#endif //FILEOMPLUGIN_HH
Logtype
Log types for Message Window.
Interface class from which all plugins have to be created.
Predefined datatypes.
Definition DataTypes.hh:83
Interface class for file handling.
QWidget * saveOptionsWidget(QString)
Definition FileOM.cc:596
FileOMPlugin()
Constructor.
Definition FileOM.cc:62
int loadPolyMeshObject(QString _filename)
Always loads mesh as polymesh.
Definition FileOM.cc:347
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
Definition FileOM.cc:763
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
Definition FileOM.cc:116
int loadTriMeshObject(QString _filename)
Loads a triangle mesh.
Definition FileOM.cc:266
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
Definition FileOM.cc:243
QString name()
Return a name for the plugin.
Definition FileOM.hh:112
QString description()
Return a description of what the plugin is doing.
Definition FileOM.hh:113
void backupTextureCoordinates(MeshT &_mesh)
creates a backup of the original per vertex/face texture coordinates
Definition FileOM.cc:441
QString getSaveFilters()
Definition FileOM.cc:103
QString getLoadFilters()
Definition FileOM.cc:97
void initializePlugin()
Initialize Plugin.
Definition FileOM.cc:92
void noguiSupported()
Definition FileOM.hh:93
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Definition FileOM.cc:746
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition FileOM.cc:109
QWidget * loadOptionsWidget(QString)
Definition FileOM.cc:655
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which do logging to the logging window of the framework.
Set options for reader/writer modules.
Definition Options.hh:92
Interface class for exporting functions to python.
Interface for all Plugins which provide scriptable Functions.
Update type class.
Definition UpdateType.hh:59