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
64 #include <OpenFlipper/common/Types.hh>
65 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
66 #include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
67 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
68 #include <OpenFlipper/BasePlugin/KeyInterface.hh>
69 #include <OpenFlipper/BasePlugin/MouseInterface.hh>
70 #include <OpenFlipper/BasePlugin/PickingInterface.hh>
71 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
72 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
73
74 #include "Toolbars/PropertyVisToolbar.hh"
75 #include "Models/ObjectListItemModel.hh"
76
77 #include "Models/PropertyModel.hh"
78
79 //== CLASS DEFINITION =========================================================
80
81 class PropertyVisPlugin : public QObject, BaseInterface, LoadSaveInterface, ToolboxInterface, KeyInterface, ScriptInterface, MouseInterface, PickingInterface, LoggingInterface
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
138 void propertySelectionChanged();
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:
152 void slotVisualizeProperty( int _id, const QString& _propname );
153 QScriptValue getPropertyVisualizer( int _id, const QString& _propname );
154
155
156 public :
157 PropertyVisPlugin();
158 ~PropertyVisPlugin() {}
159
160
161 QString name() override { return (QString("Property Visualization")); }
162 QString description( ) override { return (QString("Computes the PropertyVis of the the active Mesh")); }
163
164
165 private :
166 // Widget for Toolbox
167 PropertyVisToolbar* tool_;
168
169 private:
170
172 void setNewPropertyModel(int id);
173
174
175 private:
176 ObjectListItemModel objectListItemModel_;
177
178 PropertyModel* propertyModel_;
179 };
180
181 #if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYVISPLUGIN_CC)
182 #define PROPERTYVISPLUGIN_TEMPLATES
183 #include "PropertyVisPluginT_impl.hh"
184 #endif
185 //=============================================================================
186 #endif // PROPERTYVISPLUGIN_HH defined
187 //=============================================================================
188
PropertyVisPlugin
Definition: PropertyVisPlugin.hh:81
ScriptInterface.hh
ToolboxInterface.hh
LoadSaveInterface.hh
MouseInterface
Interface class for receiving mouse events.
Definition: MouseInterface.hh:61
ToolboxInterface
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Definition: ToolboxInterface.hh:68
PropertyVisToolbar
Definition: PropertyVisToolbar.hh:47
PropertyVisPlugin::propertySelectionChanged
void propertySelectionChanged()
Called when user selects a property.
Definition: PropertyVisPlugin.cc:242
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
MouseInterface.hh
PickingInterface.hh
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
LoggingInterface.hh
PropertyVisPlugin::name
QString name() override
Return a name for the plugin.
Definition: PropertyVisPlugin.hh:161
PropertyVisPlugin::setNewPropertyModel
void setNewPropertyModel(int id)
Exchanges the PropertyModel after the user selected a different object.
Definition: PropertyVisPlugin.cc:262
ObjectListItemModel
Definition: ObjectListItemModel.hh:50
PropertyVisPlugin::slotLog
void slotLog(Logtype _type, QString _message)
Receives log messages from PropertyModels and emits them.
Definition: PropertyVisPlugin.hh:147
UpdateType
Update type class.
Definition: UpdateType.hh:60
PropertyVisPlugin::slotRemoveProperty
void slotRemoveProperty()
Removes the selected properties.
Definition: PropertyVisPlugin.cc:372
KeyInterface
Keyboard Event Interface.
Definition: KeyInterface.hh:59
PropertyVisPlugin::slotDuplicateProperty
void slotDuplicateProperty()
Duplicates the selected properties.
Definition: PropertyVisPlugin.cc:343
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:58
Types.hh
PropertyModel
Definition: PropertyModel.hh:52
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
BaseInterface.hh
PickingInterface
Allow access to picking functions.
Definition: PickingInterface.hh:62
LoadSaveInterface
Interface for all plugins which want to Load or Save files and create Objects.
Definition: LoadSaveInterface.hh:59
KeyInterface.hh
PropertyVisPlugin::description
QString description() override
Return a description of what the plugin is doing.
Definition: PropertyVisPlugin.hh:162