MeshComparePlugin.hh 6.53 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*===========================================================================*\
*                                                                            *
*                              OpenFlipper                                   *
*      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen       *
*                           www.openflipper.org                              *
*                                                                            *
*--------------------------------------------------------------------------- *
*  This file is part of OpenFlipper.                                         *
*                                                                            *
*  OpenFlipper is free software: you can redistribute it and/or modify       *
*  it under the terms of the GNU Lesser General Public License as            *
*  published by the Free Software Foundation, either version 3 of            *
*  the License, or (at your option) any later version with the               *
*  following exceptions:                                                     *
*                                                                            *
*  If other files instantiate templates or use macros                        *
*  or inline functions from this file, or you compile this file and          *
*  link it with other files to produce an executable, this file does         *
*  not by itself cause the resulting executable to be covered by the         *
*  GNU Lesser General Public License. This exception does not however        *
*  invalidate any other reasons why the executable file might be             *
*  covered by the GNU Lesser General Public License.                         *
*                                                                            *
*  OpenFlipper is distributed in the hope that it will be useful,            *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of            *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
*  GNU Lesser General Public License for more details.                       *
*                                                                            *
*  You should have received a copy of the GNU LesserGeneral Public           *
*  License along with OpenFlipper. If not,                                   *
*  see <http://www.gnu.org/licenses/>.                                       *
*                                                                            *
\*===========================================================================*/

/*===========================================================================*\
*                                                                            *
Jan Möbius's avatar
Jan Möbius committed
37
38
39
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
*                                                                            *
\*===========================================================================*/




#ifndef MESHCOMPAREPLUGIN_HH
#define MESHCOMPAREPLUGIN_HH

#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ScriptInterface.hh>
#include <OpenFlipper/BasePlugin/BackupInterface.hh>
#include <OpenFlipper/BasePlugin/TextureInterface.hh>
55
#include <OpenFlipper/BasePlugin/RPCInterface.hh>
56
57
#include <OpenFlipper/common/Types.hh>

58
59
#include "MeshCompareToolbarWidget.hh"

60
class MeshComparePlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface, ScriptInterface, BackupInterface, TextureInterface, RPCInterface
61
62
63
64
65
66
67
68
{
  Q_OBJECT
  Q_INTERFACES(BaseInterface)
  Q_INTERFACES(ToolboxInterface)
  Q_INTERFACES(LoggingInterface)
  Q_INTERFACES(ScriptInterface)
  Q_INTERFACES(BackupInterface)
  Q_INTERFACES(TextureInterface)
69
  Q_INTERFACES(RPCInterface)
70
71
72
73
74
75
76
77
78
79
80
81
82

  signals:
    //BaseInterface
    void updateView();
    void updatedObject(int _id, const UpdateType& _type);
    void setSlotDescription(QString     _slotName,   QString     _slotDescription,
                            QStringList _parameters, QStringList _descriptions);

    //LoggingInterface
    void log(Logtype _type, QString _message);
    void log(QString _message);
    
    // ToolboxInterface
83
    void addToolbox( QString  _name  , QWidget* _widget ,QIcon* _icon);
84
85
86
87
    
    // BackupInterface
    void createBackup( int _id , QString _name, UpdateType _type = UPDATE_ALL );

88
89
90
    // RPC Interface
    void pluginExists( QString _pluginName , bool& _exists  );

91
92
93
94
95
96
97
98
99
100
101
  public:

    MeshComparePlugin();
    ~MeshComparePlugin();

    // BaseInterface
    QString name() { return (QString("Mesh Compare")); };
    QString description( ) { return (QString("Compare two meshes")); };

  private slots:

102
103
    void initializePlugin();
    void pluginsInitialized();
104

105
    /// Triggers comparison of the selected meshes
106
    void compareButton();
107

108
109
110
    /// Clears the visualization
    void slotClear();

111
112
113
    /// Called when an object gets updated
    void slotObjectUpdated( int _identifier, const UpdateType& _type );

114
115
    void noguiSupported( ) {} ;

116
117
  // Scriptable functions
  public slots:
118
119
120
       
    QString version() { return QString("1.0"); };

121
122
123
124
125
126
127
128
129
    /// Compares two meshes. Use the two getter functions to retrieve the maximal deviations
    void compare(int _sourceId,int _targetId);

    /// Get the maximal distance of the last comparison (-1, if no comparison performed so far)
    double lastMaximalDistance() { return maximalDistance_; };

    /// Get the maximal normal deviation of the last comparison in degree (-1, if no comparison performed so far)
    double lastMaximalNormalDeviation() { return maxNormalDeviation_; };

130
131
132
    /// Get the maximal mean curvature deviation of the last comparison (-1, if no comparison performed so far)
    double lastMaximalMeanCurvatureDeviation() { return maxMeanCurvatureDev_; };

133
134
    /// Get the maximal gauss curvature deviation of the last comparison (-1, if no comparison performed so far)
    double lastMaximalGaussCurvatureDeviation() { return maxGaussCurvatureDev_; };
135
136
137
138
139
140
141
142
143
144

  private:
    /// The toolbar widget of this plugin
    MeshCompareToolbarWidget* tool_;

    /// Last maximal computed distance
    double maximalDistance_;

    /// Last maximal computed normal deviation in degree
    double maxNormalDeviation_;
145
146
147

    /// Last maximal mean curvature deviation
    double maxMeanCurvatureDev_;
148
149
150

    /// Last maximal gauss curvature deviation
    double maxGaussCurvatureDev_;
151
152
153
};

#endif //MESHCOMPAREPLUGIN_HH