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