Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FilePLY.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$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50 #ifndef FILEPLYPLUGIN_HH
51 #define FILEPLYPLUGIN_HH
52
53 #include <QObject>
54 #include <QCheckBox>
55 #include <QSpinBox>
56
57 class QLabel ;
58 class QComboBox;
59
60 #include <OpenFlipper/common/Types.hh>
61 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
62 #include <OpenFlipper/BasePlugin/FileInterface.hh>
63 #include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
64 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
65 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
66 #include <OpenFlipper/BasePlugin/TypeInterface.hh>
67 #include <OpenFlipper/BasePlugin/RPCInterface.hh>
68
69 #include <ObjectTypes/PolyMesh/PolyMesh.hh>
70 #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
71
72 class FilePLYPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInterface,
73 LoggingInterface, ScriptInterface
74 {
75 Q_OBJECT
76 Q_INTERFACES(FileInterface)
77 Q_INTERFACES(LoadSaveInterface)
78 Q_INTERFACES(LoggingInterface)
79 Q_INTERFACES(BaseInterface)
80 Q_INTERFACES(ScriptInterface)
81
82 #if QT_VERSION >= 0x050000
83 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-PLY")
84 #endif
85
86 signals:
87 void openedFile( int _id );
88 void addEmptyObject( DataType _type, int& _id);
89 void load(QString _filename, DataType _type, int& _id);
90 void save(int _id , QString _filename );
91 void log(Logtype _type, QString _message);
92 void log(QString _message);
93 void updateView();
94 void updatedObject(int _identifier, const UpdateType& _type);
95
96 void deleteObject( int _id );
97
98 private slots:
99
100 void fileOpened( int /*_id*/ ){};
101
102 void noguiSupported( ) {} ;
103
104 void initializePlugin();
105
107 void handleTrimeshDialog();
108
110 void slotLoadDefault();
111
113 void slotSaveDefault();
114
115 public :
116
117 FilePLYPlugin();
118
119 ~FilePLYPlugin() {};
120
121 QString name() { return (QString("FilePLY")); };
122 QString description( ) { return (QString(tr("Load/Save PLY-Files"))); };
123
124 DataType supportedType();
125
126 QString getSaveFilters();
127 QString getLoadFilters();
128
129 QWidget* saveOptionsWidget(QString /*_currentFilter*/);
130 QWidget* loadOptionsWidget(QString /*_currentFilter*/);
131
132 public slots:
133
135 int loadObject(QString _filename);
136
138 int loadObject(QString _filename, DataType _type);
139
141 int loadPolyMeshObject(QString _filename, OpenMesh::IO::Options& _opt);
142
144 int loadTriMeshObject(QString _filename, OpenMesh::IO::Options& _opt);
145
146 bool saveObject(int _id, QString _filename);
147
148 QString version() { return QString("1.0"); };
149
150 private:
151
152 // Template functions
153
154 template <class MeshT>
155 void backupTextureCoordinates(MeshT& _mesh);
156
157 //Option Widgets
158 QWidget* loadOptions_;
159 QWidget* saveOptions_;
160
161 QCheckBox* saveBinary_;
162 QCheckBox* saveVertexNormal_;
163 QCheckBox* saveVertexColor_;
164 QCheckBox* saveVertexTexCoord_;
165 QCheckBox* saveFaceNormal_;
166 QCheckBox* saveFaceColor_;
167 QLabel* savePrecisionLabel_;
168 QSpinBox* savePrecision_;
169 QPushButton* saveDefaultButton_;
170
171 QComboBox* triMeshHandling_;
172 QCheckBox* loadVertexNormal_;
173 QCheckBox* loadVertexColor_;
174 QCheckBox* loadVertexTexCoord_;
175 QCheckBox* loadFaceNormal_;
176 QCheckBox* loadFaceColor_;
177 QPushButton* loadDefaultButton_;
178
179 int trimeshOptions_;
180 };
181
182 #if defined(INCLUDE_TEMPLATES) && !defined(FILEPLYPLUGIN_C)
183 #define FILEPLYPLUGIN_TEMPLATES
184 #include "FilePLYT.cc"
185 #endif
186
187 #endif //FILEPLYPLUGIN_HH
FilePLYPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: FilePLY.hh:122
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:76
FilePLYPlugin::getLoadFilters
QString getLoadFilters()
Definition: FilePLY.cc:95
TypeInterface.hh
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:103
FilePLYPlugin::loadObject
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
Definition: FilePLY.cc:178
TriangleMesh.hh
UpdateType
Update type class.
Definition: UpdateType.hh:70
FileInterface.hh
FilePLYPlugin::noguiSupported
void noguiSupported()
Definition: FilePLY.hh:102
LoggingInterface.hh
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:123
FileInterface
Interface class for file handling.
Definition: FileInterface.hh:72
OpenMesh::IO::Options
Set options for reader/writer modules.
Definition: Options.hh:95
FilePLYPlugin::handleTrimeshDialog
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
Definition: FilePLY.cc:308
LoadSaveInterface.hh
FilePLYPlugin::slotLoadDefault
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Definition: FilePLY.cc:669
FilePLYPlugin
Definition: FilePLY.hh:72
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:67
FilePLYPlugin::initializePlugin
void initializePlugin()
Initialize Plugin.
Definition: FilePLY.cc:90
FilePLYPlugin::supportedType
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: FilePLY.cc:107
RPCInterface.hh
LoadSaveInterface
Interface for all plugins which want to Load or Save files and create Objects.
Definition: LoadSaveInterface.hh:68
FilePLYPlugin::slotSaveDefault
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
Definition: FilePLY.cc:683
PolyMesh.hh
FilePLYPlugin::loadTriMeshObject
int loadTriMeshObject(QString _filename, OpenMesh::IO::Options &_opt)
Loads a triangle mesh.
Definition: FilePLY.cc:331
FilePLYPlugin::getSaveFilters
QString getSaveFilters()
Definition: FilePLY.cc:101
FilePLYPlugin::loadPolyMeshObject
int loadPolyMeshObject(QString _filename, OpenMesh::IO::Options &_opt)
Always loads mesh as polymesh.
Definition: FilePLY.cc:402
FilePLYPlugin::FilePLYPlugin
FilePLYPlugin()
Constructor.
Definition: FilePLY.cc:66
ScriptInterface.hh
BaseInterface.hh
DataType
Predefined datatypes.
Definition: DataTypes.hh:96
FilePLYPlugin::loadOptionsWidget
QWidget * loadOptionsWidget(QString)
Definition: FilePLY.cc:614
Types.hh
FilePLYPlugin::backupTextureCoordinates
void backupTextureCoordinates(MeshT &_mesh)
creates a backup of the original per vertex/face texture coordinates
Definition: FilePLYT.cc:62
FilePLYPlugin::saveOptionsWidget
QWidget * saveOptionsWidget(QString)
Definition: FilePLY.cc:557
FilePLYPlugin::name
QString name()
Return a name for the plugin.
Definition: FilePLY.hh:121