PropertyVisPlugin.hh 7.31 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1
2
3
/*===========================================================================*\
*                                                                            *
*                              OpenFlipper                                   *
Martin Schultz's avatar
Martin Schultz committed
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
37
38
 *           Copyright (c) 2001-2015, RWTH-Aachen University                 *
 *           Department of Computer Graphics and Multimedia                  *
 *                          All rights reserved.                             *
 *                            www.openflipper.org                            *
 *                                                                           *
 *---------------------------------------------------------------------------*
 * This file is part of OpenFlipper.                                         *
 *---------------------------------------------------------------------------*
 *                                                                           *
 * Redistribution and use in source and binary forms, with or without        *
 * modification, are permitted provided that the following conditions        *
 * are met:                                                                  *
 *                                                                           *
 * 1. Redistributions of source code must retain the above copyright notice, *
 *    this list of conditions and the following disclaimer.                  *
 *                                                                           *
 * 2. Redistributions in binary form must reproduce the above copyright      *
 *    notice, this list of conditions and the following disclaimer in the    *
 *    documentation and/or other materials provided with the distribution.   *
 *                                                                           *
 * 3. Neither the name of the copyright holder nor the names of its          *
 *    contributors may be used to endorse or promote products derived from   *
 *    this software without specific prior written permission.               *
 *                                                                           *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       *
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           *
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  *
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,       *
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR        *
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    *
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      *
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        *
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              *
Jan Möbius's avatar
Jan Möbius committed
39
40
41
42
43
44
45
46
47
48
49
*                                                                            *
\*===========================================================================*/

/*===========================================================================*\
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
\*===========================================================================*/

Jan Möbius's avatar
 
Jan Möbius committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//=============================================================================
//
//  CLASS PropertyVisPlugin
//
//=============================================================================


#ifndef PROPERTYVISPLUGIN_HH
#define PROPERTYVISPLUGIN_HH


//== INCLUDES =================================================================

#include <QObject>
#include <QMenuBar>
#include <QSpinBox>
#include <QFile>
#include <QTextStream>
#include <vector>

#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
72
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
Jan Möbius's avatar
 
Jan Möbius committed
73
74
75
76
77
78
79
80
81
82
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/KeyInterface.hh>
#include <OpenFlipper/BasePlugin/MouseInterface.hh>
#include <OpenFlipper/BasePlugin/PickingInterface.hh>
#include <OpenFlipper/BasePlugin/ScriptInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>

#include "PropertyVisToolbar.hh"
#include "ObjectListItemModel.hh"

83
#include "PropertyModel.hh"
Jan Möbius's avatar
 
Jan Möbius committed
84
85
86

//== CLASS DEFINITION =========================================================

87
class PropertyVisPlugin : public QObject, BaseInterface, LoadSaveInterface, ToolboxInterface, KeyInterface, ScriptInterface, MouseInterface, PickingInterface, LoggingInterface
Jan Möbius's avatar
 
Jan Möbius committed
88
89
90
{
  Q_OBJECT
  Q_INTERFACES(BaseInterface)
91
  Q_INTERFACES(LoadSaveInterface)
Jan Möbius's avatar
 
Jan Möbius committed
92
93
94
95
96
97
98
  Q_INTERFACES(ToolboxInterface)
  Q_INTERFACES(KeyInterface)
  Q_INTERFACES(ScriptInterface)
  Q_INTERFACES(MouseInterface)
  Q_INTERFACES(PickingInterface)
  Q_INTERFACES(LoggingInterface)

Matthias Möller's avatar
Matthias Möller committed
99
100
101
102
#if QT_VERSION >= 0x050000
  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-PropertyVis")
#endif

Jan Möbius's avatar
 
Jan Möbius committed
103
104
105
106
107
108
109
110
signals:
  void updateView();
  void updatedObject(int, const UpdateType&);

  void log(Logtype, QString);
  void log(QString);
  
  // ToolboxInterface
111
  void addToolbox( QString  _name  , QWidget* _widget ,QIcon* _icon);
Jan Möbius's avatar
 
Jan Möbius committed
112
113
114
115

  //PickingInterface
  void addHiddenPickMode( const std::string& _mode );
  
116
117
public slots:
  void slotVisualizeProperty( int _id, const QString& _propname );
Jan Möbius's avatar
 
Jan Möbius committed
118
119
120
121
122
123
124

private slots:

  // BaseInterface
  void slotObjectUpdated( int _identifier, const UpdateType& _type );
  void slotAllCleared();
  
125
126
127
  // LoadSaveInterface
  void objectDeleted( int _id );

Jan Möbius's avatar
 
Jan Möbius committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
  // initialization functions
  void initializePlugin();
  void pluginsInitialized();

  // toolbox slots
  void slotMeshChanged(int _index = -1);
  void slotVisualize();
  
  // MouseInterface
  void slotMouseEvent( QMouseEvent* _event );
  
  //PickingInterface
  void slotPickModeChanged( const std::string& _mode);
  
  void updateGUI();

144
  /// Called when user selects a property.
Jan Möbius's avatar
 
Jan Möbius committed
145
146
  void propertySelectionChanged();

147
  /// Duplicates the selected properties.
Jan Möbius's avatar
 
Jan Möbius committed
148
149
  void slotDuplicateProperty();

150
  /// Removes the selected properties.
Jan Möbius's avatar
 
Jan Möbius committed
151
152
  void slotRemoveProperty();

153
154
155
156
  /// Receives log messages from PropertyModels and emits them
  void slotLog(Logtype _type, QString _message){ emit log(_type, _message); }
  void slotLog(QString _message){ emit log(_message); }

Jan Möbius's avatar
 
Jan Möbius committed
157
158
159
public :

  PropertyVisPlugin();
160
  ~PropertyVisPlugin() {}
Jan Möbius's avatar
 
Jan Möbius committed
161
162


163
164
  QString name() { return (QString("Property Visualization")); }
  QString description( ) { return (QString("Computes the PropertyVis of the the active Mesh")); }
Jan Möbius's avatar
 
Jan Möbius committed
165
166
167
168
169
170
171
172


private :
  // Widget for Toolbox
  PropertyVisToolbar* tool_;

private:

173
174
  /// Exchanges the PropertyModel after the user selected a different object.
  void setNewPropertyModel(int id);
175

Jan Möbius's avatar
 
Jan Möbius committed
176
177

private:
Jan Möbius's avatar
Jan Möbius committed
178
  ObjectListItemModel objectListItemModel_;
179
180

  PropertyModel* propertyModel_;
Jan Möbius's avatar
 
Jan Möbius committed
181
182
183
184
185
186
187
188
189
190
};

#if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYVISPLUGIN_CC)
#define PROPERTYVISPLUGIN_TEMPLATES
#include "PropertyVisPluginT.cc"
#endif
//=============================================================================
#endif // PROPERTYVISPLUGIN_HH defined
//=============================================================================