Developer Documentation

RemesherPlugin.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 #ifndef ADVANCEDREMESHERPLUGIN_HH
44 #define ADVANCEDREMESHERPLUGIN_HH
45
46 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
47 #include <OpenFlipper/BasePlugin/BackupInterface.hh>
48 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
49 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
50 #include <OpenFlipper/BasePlugin/RPCInterface.hh>
51 #include <OpenFlipper/BasePlugin/ProcessInterface.hh>
52 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
53 #include <OpenFlipper/common/Types.hh>
54 #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
55 #include <ObjectTypes/PolyMesh/PolyMesh.hh>
56
57 #include "RemesherToolbox.hh"
58 #include "ProgressEmitter.hh"
59
60
61
62 class RemesherPlugin : public QObject, BaseInterface, BackupInterface, ToolboxInterface, LoggingInterface, RPCInterface, ProcessInterface, ScriptInterface
63 {
64 Q_OBJECT
65 Q_INTERFACES(BaseInterface)
66 Q_INTERFACES(BackupInterface)
67 Q_INTERFACES(ToolboxInterface)
68 Q_INTERFACES(LoggingInterface)
69 Q_INTERFACES(RPCInterface)
70 Q_INTERFACES(ProcessInterface)
71 Q_INTERFACES(ScriptInterface)
72
73 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Remesher")
74
75 signals:
76
77 //BaseInterface
78 void updateView();
79 void updatedObject(int _id, const UpdateType& _type);
80
81 void setSlotDescription(QString _slotName, QString _slotDescription,
82 QStringList _parameters, QStringList _descriptions);
83
84 //LoggingInterface:
85 void log( Logtype _type, QString _message );
86 void log( QString _message );
87
88 // RPC Interface
89 void pluginExists( QString _pluginName , bool& _exists ) ;
90 void functionExists( QString _pluginName , QString _functionName , bool& _exists );
91
92 // ToolboxInterface
93 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
94
95 // ProcessInterface
96 void startJob( QString _jobId, QString _description, int _min, int _max, bool _blocking = false);
97 void setJobState(QString _jobId, int _value);
98 void setJobName(QString _jobId, QString _name);
99 void finishJob(QString _jobId);
100 void setJobDescription(QString _jobId, QString _description);
101
102 // BackupInterface
103 void createBackup(int _id , QString _name, UpdateType _type = UPDATE_ALL);
104
105 // ScriptInterface
106 void scriptInfo(QString _functionName);
107
108 private slots:
109
110 // BaseInterface
111 void initializePlugin();
112 void pluginsInitialized(); // BaseInterface
113
114 public :
115
116 RemesherPlugin();
117
118 ~RemesherPlugin();
119
120 QString name() { return (QString("Remesher")); };
121 QString description( ) { return (QString("Remeshing plugin with isotropic and adaptive remesher.")); };
122
123 //GUI
124 private :
125 RemesherToolBox* tool_;
126
127 ProgressEmitter* progress_;
128
129 QIcon* toolIcon_;
130
131 enum RemeshingOperation { REMESH_UNIFORM, REMESH_ADAPTIVE };
132
133 RemeshingOperation operation_;
134
135 private slots:
136
137 //---- Adaptive Remeshing ------------
138
139 void adaptiveRemeshingButtonClicked();
140
141 void adaptiveRemeshing();
142
143 //---- Adaptive Remeshing ------------
144
145 void uniformRemeshingButtonClicked();
146
147 void uniformRemeshing();
148
149 //------------------------------------
150
151 void threadFinished(QString _jobId);
152
153 //------------------------------------
154
156 void computeInitValues();
157
158 void slotAdaptiveRemeshing(int _objectId,
159 double _error,
160 double _min_edge_length,
161 double _max_edge_length,
162 unsigned int _iters,
163 bool _use_projection = true,
164 bool _vertex_selection = true);
165
166 void slotUniformRemeshing(int _objectId,
167 double _edge_length,
168 unsigned int _iters,
169 unsigned int _area_iters,
170 bool _use_projection = true,
171 bool _vertex_selection = true);
172
173
174 //scripting functions
175 public slots:
176
177 void adaptiveRemeshing(int _objectId,
178 double _error,
179 double _min_edge_length,
180 double _max_edge_length,
181 unsigned int _iters,
182 bool _use_projection = true);
183
184 void adaptiveRemeshingFaceSelection(int _objectId,
185 double _error,
186 double _min_edge_length,
187 double _max_edge_length,
188 unsigned int _iters,
189 bool _use_projection = true);
190
191 void uniformRemeshing(int _objectId,
192 double _edge_length,
193 unsigned int _iters,
194 unsigned int _area_iters,
195 bool _use_projection = true);
196
197 void uniformRemeshingFaceSelection(int _objectId,
198 double _edge_length,
199 unsigned int _iters,
200 unsigned int _area_iters,
201 bool _use_projection = true);
202
203 public slots:
204 QString version() { return QString("1.0"); };
205
206 void noguiSupported( ) {} ;
207 };
208
209 #endif //ADVANCEDREMESHERPLUGIN_HH
RemesherPlugin::noguiSupported
void noguiSupported()
Definition: RemesherPlugin.hh:206
ScriptInterface.hh
ToolboxInterface.hh
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
ProgressEmitter
Definition: ProgressEmitter.hh:46
ToolboxInterface
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Definition: ToolboxInterface.hh:68
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
RemesherPlugin::computeInitValues
void computeInitValues()
Compute mean edge length and set values.
Definition: RemesherPlugin.cc:158
LoggingInterface.hh
TriangleMesh.hh
RemesherPlugin::pluginsInitialized
void pluginsInitialized()
Initialize the plugin.
Definition: RemesherPlugin.cc:79
RPCInterface
Interface to call functions across plugins.
Definition: RPCInterface.hh:61
RemesherPlugin::initializePlugin
void initializePlugin()
init the Toolbox
Definition: RemesherPlugin.cc:114
UpdateType
Update type class.
Definition: UpdateType.hh:60
PolyMesh.hh
RemesherPlugin
Definition: RemesherPlugin.hh:62
RemesherToolBox
Definition: RemesherToolbox.hh:48
RemesherPlugin::name
QString name()
Return a name for the plugin.
Definition: RemesherPlugin.hh:120
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:58
RPCInterface.hh
Types.hh
ProcessInterface
Interface class for Thread handling.
Definition: ProcessInterface.hh:60
RemesherPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: RemesherPlugin.hh:121
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
BaseInterface.hh
ProcessInterface.hh
BackupInterface
Interface class for backup handling.
Definition: BackupInterface.hh:59
BackupInterface.hh