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