Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IsotropicRemesherPlugin.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 ISOTROPICREMESHERPLUGIN_HH
51 #define ISOTROPICREMESHERPLUGIN_HH
52 
53 
64 
65 #include "IsotropicRemesherToolbox.hh"
66 #include "ProgressEmitter.hh"
67 
68 #if QT_VERSION >= 0x050000
69 #include <QtWidgets>
70 #else
71 #include <QtGui>
72 #endif
73 
74 
77 {
78 Q_OBJECT
79 Q_INTERFACES(BaseInterface)
80 Q_INTERFACES(ToolboxInterface)
81 Q_INTERFACES(LoggingInterface)
82 Q_INTERFACES(RPCInterface)
83 Q_INTERFACES(ProcessInterface)
84 Q_INTERFACES(ScriptInterface)
85 Q_INTERFACES(BackupInterface)
86 
87 #if QT_VERSION >= 0x050000
88  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-IsotropicRemesher")
89 #endif
90 
91 
92 signals:
93 
94  //BaseInterface
95  void updateView();
96  void updatedObject(int _id, const UpdateType& _type);
97 
98  void setSlotDescription(QString _slotName, QString _slotDescription,
99  QStringList _parameters, QStringList _descriptions);
100 
101  //LoggingInterface:
102  void log( Logtype _type, QString _message );
103  void log( QString _message );
104 
105  // RPC Interface
106  void pluginExists( QString _pluginName , bool& _exists ) ;
107  void functionExists( QString _pluginName , QString _functionName , bool& _exists );
108 
109  // ToolboxInterface
110  void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
111 
112  // ProcessInterface
113  void startJob( QString _jobId, QString _description, int _min, int _max, bool _blocking = false);
114  void setJobState(QString _jobId, int _value);
115  void setJobName(QString _jobId, QString _name);
116  void finishJob(QString _jobId);
117  void setJobDescription(QString _jobId, QString _description);
118 
119  // BackupInterface
120  void createBackup( int _id , QString _name, UpdateType /*_type*/ = UPDATE_ALL );
121 
122  // ScriptInterface
123  void scriptInfo(QString _functionName);
124 
125 private slots:
126 
127  // BaseInterface
128  void initializePlugin();
129  void pluginsInitialized(); // BaseInterface
130 
131 public :
134 
135  QString name() { return (QString("IsotropicRemesher")); };
136  QString description( ) { return (QString("an isotropic remesher")); };
137 
138 //GUI
139 private :
141  QIcon* toolIcon_;
142  double edgeLength_;
143 
144  OpenFlipperThread* thread_;
145 
146 private slots:
147  void slotRemesh();
148 
149  void slotRemeshButtonClicked();
150  void slotSetMinLength();
151  void slotSetMaxLength();
152  void slotSetMeanLength();
153 
154  void threadFinished(QString _jobId);
155 
156 //scripting functions
157 public slots:
158  void isotropicRemesh(int _objectID, double _targetEdgeLength );
159 
160 
161 public slots:
162  QString version() { return QString("1.0"); };
163  void noguiSupported( ) {} ;
164 };
165 
166 #endif //ISOTROPICREMESHERPLUGIN_HH
QString name()
Return a name for the plugin.
Interface class from which all plugins have to be created.
Logtype
Log types for Message Window.
Update type class.
Definition: UpdateType.hh:70
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void initializePlugin()
init the Toolbox
Interface for all Plugins which do logging to the logging window of the framework.
Interface to call functions across plugins.
Definition: RPCInterface.hh:71
Interface for all Plugins which provide scriptable Functions.
Thread handling class for OpenFlipper.
Interface class for Thread handling.
QString description()
Return a description of what the plugin is doing.
Interface class for backup handling.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
void pluginsInitialized()
Initialize the plugin.