Developer Documentation

MeshComparePlugin.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
45
46
47 #ifndef MESHCOMPAREPLUGIN_HH
48 #define MESHCOMPAREPLUGIN_HH
49
50 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
51 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
52 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
53 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
54 #include <OpenFlipper/BasePlugin/BackupInterface.hh>
55 #include <OpenFlipper/BasePlugin/TextureInterface.hh>
56 #include <OpenFlipper/BasePlugin/RPCInterface.hh>
57 #include <OpenFlipper/BasePlugin/PythonInterface.hh>
58 #include <OpenFlipper/common/Types.hh>
59
60 #include <ACG/Scenegraph/PointNode.hh>
61
62 #include "MeshCompareToolbarWidget.hh"
63
64 #ifdef WITH_QWT
65 #include "QwtFunctionPlot.hh"
66 #endif
67
68 class MeshComparePlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface, ScriptInterface, BackupInterface, TextureInterface, RPCInterface, PythonInterface
69 {
70 Q_OBJECT
71 Q_INTERFACES(BaseInterface)
72 Q_INTERFACES(ToolboxInterface)
73 Q_INTERFACES(LoggingInterface)
74 Q_INTERFACES(ScriptInterface)
75 Q_INTERFACES(BackupInterface)
76 Q_INTERFACES(TextureInterface)
77 Q_INTERFACES(RPCInterface)
78 Q_INTERFACES(PythonInterface)
79
80 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-MeshCompare")
81
82 signals:
83 //BaseInterface
84 void updateView();
85 void updatedObject(int _id, const UpdateType& _type);
86 void setSlotDescription(QString _slotName, QString _slotDescription,
87 QStringList _parameters, QStringList _descriptions);
88
89 //LoggingInterface
90 void log(Logtype _type, QString _message);
91 void log(QString _message);
92
93 // ToolboxInterface
94 void addToolbox( QString _name , QWidget* _widget ,QIcon* _icon);
95
96 // BackupInterface
97 void createBackup( int _id , QString _name, UpdateType _type = UPDATE_ALL );
98
99 // RPC Interface
100 void pluginExists( QString _pluginName , bool& _exists );
101
102 public:
103
104 MeshComparePlugin();
105 ~MeshComparePlugin();
106
107 // BaseInterface
108 QString name() { return (QString("MeshCompare")); };
109 QString description( ) { return (QString("Compare two meshes")); };
110
111 private slots:
112
113 void initializePlugin();
114 void pluginsInitialized();
115
117 void compareButton();
118
120 void slotClear();
121
123 void slotObjectUpdated( int _identifier, const UpdateType& _type );
124
125 void noguiSupported( ) {} ;
126
127 // Scriptable functions
128 public slots:
129
130 QString version() { return QString("1.0"); };
131
143 void compare(int _sourceId,int _targetId,
144 bool _computeDist = true,
145 bool _computeNormal = true,
146 bool _computeGauss = true ,
147 bool _computeMean = true);
148
150 double lastMaximalDistance() { return maximalDistance_; };
151
153 double lastMaximalNormalDeviation() { return maxNormalDeviation_; };
154
156 double lastMaximalMeanCurvatureDeviation() { return maxMeanCurvatureDev_; };
157
159 double lastMaximalGaussCurvatureDeviation() { return maxGaussCurvatureDev_; };
160
161 private slots:
162
164 void slotClampBox(bool _checked);
165
166 private:
167
176 void visualizeData( const std::vector<double>& _data, double _maxValue, ACG::SceneGraph::PointNode* _pnode);
177
178 private:
180 MeshCompareToolbarWidget* tool_;
181
183 double maximalDistance_;
184
186 double maxNormalDeviation_;
187
189 double maxMeanCurvatureDev_;
190
192 double maxGaussCurvatureDev_;
193
194 #ifdef WITH_QWT
195 QwtFunctionPlot* plot_;
196 #endif
197
198 };
199
200 #endif //MESHCOMPAREPLUGIN_HH
ScriptInterface.hh
ToolboxInterface.hh
MeshComparePlugin::lastMaximalMeanCurvatureDeviation
double lastMaximalMeanCurvatureDeviation()
Get the maximal mean curvature deviation of the last comparison (-1, if no comparison performed so fa...
Definition: MeshComparePlugin.hh:156
PythonInterface
Interface class for exporting functions to python.
Definition: PythonInterface.hh:58
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
ToolboxInterface
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Definition: ToolboxInterface.hh:68
MeshComparePlugin
Definition: MeshComparePlugin.hh:68
MeshComparePlugin::maximalDistance_
double maximalDistance_
Last maximal computed distance.
Definition: MeshComparePlugin.hh:183
MeshComparePlugin::slotObjectUpdated
void slotObjectUpdated(int _identifier, const UpdateType &_type)
Called when an object gets updated.
Definition: MeshComparePlugin.cc:184
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
MeshComparePlugin::lastMaximalNormalDeviation
double lastMaximalNormalDeviation()
Get the maximal normal deviation of the last comparison in degree (-1, if no comparison performed so ...
Definition: MeshComparePlugin.hh:153
MeshComparePlugin::visualizeData
void visualizeData(const std::vector< double > &_data, double _maxValue, ACG::SceneGraph::PointNode *_pnode)
Visualize data.
Definition: MeshComparePlugin.cc:435
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
MeshComparePlugin::slotClampBox
void slotClampBox(bool _checked)
If the checkbox is changed to be checked, the values in the labels will be written into the spin boxe...
Definition: MeshComparePlugin.cc:212
LoggingInterface.hh
MeshComparePlugin::tool_
MeshCompareToolbarWidget * tool_
The toolbar widget of this plugin.
Definition: MeshComparePlugin.hh:180
MeshComparePlugin::maxMeanCurvatureDev_
double maxMeanCurvatureDev_
Last maximal mean curvature deviation.
Definition: MeshComparePlugin.hh:189
MeshComparePlugin::maxNormalDeviation_
double maxNormalDeviation_
Last maximal computed normal deviation in degree.
Definition: MeshComparePlugin.hh:186
MeshComparePlugin::compareButton
void compareButton()
Triggers comparison of the selected meshes.
Definition: MeshComparePlugin.cc:138
MeshComparePlugin::slotClear
void slotClear()
Clears the visualization.
Definition: MeshComparePlugin.cc:198
RPCInterface
Interface to call functions across plugins.
Definition: RPCInterface.hh:61
MeshCompareToolbarWidget
Definition: MeshCompareToolbarWidget.hh:49
MeshComparePlugin::maxGaussCurvatureDev_
double maxGaussCurvatureDev_
Last maximal gauss curvature deviation.
Definition: MeshComparePlugin.hh:192
UpdateType
Update type class.
Definition: UpdateType.hh:60
ACG::SceneGraph::PointNode
Definition: PointNode.hh:82
MeshComparePlugin::lastMaximalGaussCurvatureDeviation
double lastMaximalGaussCurvatureDeviation()
Get the maximal gauss curvature deviation of the last comparison (-1, if no comparison performed so f...
Definition: MeshComparePlugin.hh:159
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:58
MeshComparePlugin::name
QString name()
Return a name for the plugin.
Definition: MeshComparePlugin.hh:108
MeshComparePlugin::lastMaximalDistance
double lastMaximalDistance()
Get the maximal distance of the last comparison (-1, if no comparison performed so far) ...
Definition: MeshComparePlugin.hh:150
RPCInterface.hh
Types.hh
MeshComparePlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: MeshComparePlugin.hh:109
MeshComparePlugin::compare
void compare(int _sourceId, int _targetId, bool _computeDist=true, bool _computeNormal=true, bool _computeGauss=true, bool _computeMean=true)
Definition: MeshComparePlugin.cc:219
TextureInterface
Provide texture support for a plugin.
Definition: TextureInterface.hh:56
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
BaseInterface.hh
BackupInterface
Interface class for backup handling.
Definition: BackupInterface.hh:59
BackupInterface.hh
PythonInterface.hh