Developer Documentation
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#ifndef FILEPLYPLUGIN_HH
45#define FILEPLYPLUGIN_HH
46
47#include <QObject>
48#include <QCheckBox>
49#include <QSpinBox>
50
51class QLabel ;
52class QComboBox;
53
63
66
69{
70 Q_OBJECT
71 Q_INTERFACES(FileInterface)
72 Q_INTERFACES(LoadSaveInterface)
73 Q_INTERFACES(LoggingInterface)
74 Q_INTERFACES(BaseInterface)
75 Q_INTERFACES(ScriptInterface)
76 Q_INTERFACES(PythonInterface)
77
78 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-PLY")
79
80 signals:
81 void openedFile( int _id );
82 void addEmptyObject( DataType _type, int& _id);
83 void load(QString _filename, DataType _type, int& _id);
84 void save(int _id , QString _filename );
85 void log(Logtype _type, QString _message);
86 void log(QString _message);
87 void updateView();
88 void updatedObject(int _identifier, const UpdateType& _type);
89
90 void deleteObject( int _id );
91
92 private slots:
93
94 void fileOpened( int /*_id*/ ){};
95
96 void noguiSupported( ) {} ;
97
98 void initializePlugin();
99
101 void handleTrimeshDialog();
102
104 void slotLoadDefault();
105
107 void slotSaveDefault();
108
109 public :
110
112
113 ~FilePLYPlugin() {};
114
115 QString name() { return (QString("FilePLY")); };
116 QString description( ) { return (QString(tr("Load/Save PLY-Files"))); };
117
119
120 QString getSaveFilters();
121 QString getLoadFilters();
122
123 QWidget* saveOptionsWidget(QString /*_currentFilter*/);
124 QWidget* loadOptionsWidget(QString /*_currentFilter*/);
125
126 public slots:
127
129 int loadObject(QString _filename);
130
132 int loadObject(QString _filename, DataType _type);
133
135 int loadPolyMeshObject(QString _filename, OpenMesh::IO::Options& _opt);
136
138 int loadTriMeshObject(QString _filename, OpenMesh::IO::Options& _opt);
139
140 bool saveObject(int _id, QString _filename);
141
142 QString version() { return QString("1.0"); };
143
144 private:
145
146 // Template functions
147
148 template <class MeshT>
149 void backupTextureCoordinates(MeshT& _mesh);
150
151 //Option Widgets
152 QWidget* loadOptions_;
153 QWidget* saveOptions_;
154
155 QCheckBox* saveBinary_;
156 QCheckBox* saveVertexNormal_;
157 QCheckBox* saveVertexColor_;
158 QCheckBox* saveVertexTexCoord_;
159 QCheckBox* saveFaceNormal_;
160 QCheckBox* saveFaceColor_;
161 QLabel* savePrecisionLabel_;
162 QSpinBox* savePrecision_;
163 QPushButton* saveDefaultButton_;
164
165 QComboBox* triMeshHandling_;
166 QCheckBox* loadVertexNormal_;
167 QCheckBox* loadVertexColor_;
168 QCheckBox* loadVertexTexCoord_;
169 QCheckBox* loadFaceNormal_;
170 QCheckBox* loadFaceColor_;
171 QPushButton* loadDefaultButton_;
172
173 int trimeshOptions_;
174};
175
176#if defined(INCLUDE_TEMPLATES) && !defined(FILEPLYPLUGIN_C)
177#define FILEPLYPLUGIN_TEMPLATES
178#include "FilePLYT_impl.hh"
179#endif
180
181#endif //FILEPLYPLUGIN_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.
QString getLoadFilters()
Definition: FilePLY.cc:85
QWidget * loadOptionsWidget(QString)
Definition: FilePLY.cc:636
QString getSaveFilters()
Definition: FilePLY.cc:91
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
Definition: FilePLY.cc:301
void backupTextureCoordinates(MeshT &_mesh)
creates a backup of the original per vertex/face texture coordinates
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Definition: FilePLY.cc:691
QString description()
Return a description of what the plugin is doing.
Definition: FilePLY.hh:116
int loadPolyMeshObject(QString _filename, OpenMesh::IO::Options &_opt)
Always loads mesh as polymesh.
Definition: FilePLY.cc:409
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
Definition: FilePLY.cc:168
void noguiSupported()
Definition: FilePLY.hh:96
FilePLYPlugin()
Constructor.
Definition: FilePLY.cc:56
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: FilePLY.cc:97
void initializePlugin()
Initialize Plugin.
Definition: FilePLY.cc:80
QString name()
Return a name for the plugin.
Definition: FilePLY.hh:115
QWidget * saveOptionsWidget(QString)
Definition: FilePLY.cc:579
int loadTriMeshObject(QString _filename, OpenMesh::IO::Options &_opt)
Loads a triangle mesh.
Definition: FilePLY.cc:324
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
Definition: FilePLY.cc:705
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