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