Developer Documentation
PropertyVisPlugin.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 //=============================================================================
51 //
52 // CLASS PropertyVisPlugin
53 //
54 //=============================================================================
55 
56 
57 #ifndef PROPERTYVISPLUGIN_HH
58 #define PROPERTYVISPLUGIN_HH
59 
60 
61 //== INCLUDES =================================================================
62 
63 #include <QObject>
64 #include <QMenuBar>
65 #include <QSpinBox>
66 #include <QFile>
67 #include <QTextStream>
68 #include <vector>
69 
79 
80 #include "PropertyVisToolbar.hh"
81 #include "ObjectListItemModel.hh"
82 
83 #include "PropertyModel.hh"
84 
85 //== CLASS DEFINITION =========================================================
86 
88 {
89  Q_OBJECT
90  Q_INTERFACES(BaseInterface)
91  Q_INTERFACES(LoadSaveInterface)
92  Q_INTERFACES(ToolboxInterface)
93  Q_INTERFACES(KeyInterface)
94  Q_INTERFACES(ScriptInterface)
95  Q_INTERFACES(MouseInterface)
96  Q_INTERFACES(PickingInterface)
97  Q_INTERFACES(LoggingInterface)
98 
99 #if QT_VERSION >= 0x050000
100  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-PropertyVis")
101 #endif
102 
103 signals:
104  void updateView();
105  void updatedObject(int, const UpdateType&);
106 
107  void log(Logtype, QString);
108  void log(QString);
109 
110  // ToolboxInterface
111  void addToolbox( QString _name , QWidget* _widget ,QIcon* _icon);
112 
113  //PickingInterface
114  void addHiddenPickMode( const std::string& _mode );
115 
116 public slots:
117  void slotVisualizeProperty( int _id, const QString& _propname );
118 
119 private slots:
120 
121  // BaseInterface
122  void slotObjectUpdated( int _identifier, const UpdateType& _type );
123  void slotAllCleared();
124 
125  // LoadSaveInterface
126  void objectDeleted( int _id );
127 
128  // initialization functions
129  void initializePlugin();
130  void pluginsInitialized();
131 
132  // toolbox slots
133  void slotMeshChanged(int _index = -1);
134  void slotVisualize();
135 
136  // MouseInterface
137  void slotMouseEvent( QMouseEvent* _event );
138 
139  //PickingInterface
140  void slotPickModeChanged( const std::string& _mode);
141 
142  void updateGUI();
143 
146 
148  void slotDuplicateProperty();
149 
151  void slotRemoveProperty();
152 
154  void slotLog(Logtype _type, QString _message){ emit log(_type, _message); }
155  void slotLog(QString _message){ emit log(_message); }
156 
157 public :
158 
160  ~PropertyVisPlugin() {}
161 
162 
163  QString name() { return (QString("Property Visualization")); }
164  QString description( ) { return (QString("Computes the PropertyVis of the the active Mesh")); }
165 
166 
167 private :
168  // Widget for Toolbox
169  PropertyVisToolbar* tool_;
170 
171 private:
172 
174  void setNewPropertyModel(int id);
175 
176 
177 private:
178  ObjectListItemModel objectListItemModel_;
179 
180  PropertyModel* propertyModel_;
181 };
182 
183 #if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYVISPLUGIN_CC)
184 #define PROPERTYVISPLUGIN_TEMPLATES
185 #include "PropertyVisPluginT.cc"
186 #endif
187 //=============================================================================
188 #endif // PROPERTYVISPLUGIN_HH defined
189 //=============================================================================
190 
void setNewPropertyModel(int id)
Exchanges the PropertyModel after the user selected a different object.
Interface class for receiving mouse events.
void propertySelectionChanged()
Called when user selects a property.
Logtype
Log types for Message Window.
Keyboard Event Interface.
Definition: KeyInterface.hh:76
Interface for all Plugins which provide scriptable Functions.
Interface class from which all plugins have to be created.
Update type class.
Definition: UpdateType.hh:70
void slotDuplicateProperty()
Duplicates the selected properties.
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Interface for all Plugins which do logging to the logging window of the framework.
QString name()
Return a name for the plugin.
void slotRemoveProperty()
Removes the selected properties.
void slotLog(Logtype _type, QString _message)
Receives log messages from PropertyModels and emits them.
Interface for all plugins which want to Load or Save files and create Objects.
QString description()
Return a description of what the plugin is doing.
Allow access to picking functions.