Developer Documentation
Loading...
Searching...
No Matches
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
95signals:
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 #if QT_VERSION_MAJOR < 6
109 // Script Interface
110 void getScriptingEngine( QScriptEngine*& _engine ) override;
111 #endif
112
113private slots:
114
115 // BaseInterface
116 void slotObjectUpdated( int _identifier, const UpdateType& _type ) override;
117 void slotObjectPropertiesChanged( int _identifier) override;
118 void slotAllCleared() override;
119
120 // LoadSaveInterface
121 void objectDeleted( int _id ) override;
122
123 // initialization functions
124 void initializePlugin() override;
125 void pluginsInitialized() override;
126
127 // toolbox slots
128 void slotMeshChanged(int _index = -1);
129 void slotVisualize();
130
131 // MouseInterface
132 void slotMouseEvent( QMouseEvent* _event ) override;
133
134 //PickingInterface
135 void slotPickModeChanged( const std::string& _mode) override;
136
137 void updateGUI();
138
141
144
146 void slotRemoveProperty();
147
149 void slotLog(Logtype _type, QString _message){ emit log(_type, _message); }
150 void slotLog(QString _message){ emit log(_message); }
151
152
153public slots:
157 void slotVisualizeProperty( int _id, const QString& _propname );
158
162 void slotClear( int _id, const QString& _propname );
163
164 #if QT_VERSION_MAJOR < 6
165 QScriptValue getPropertyVisualizer( int _id, const QString& _propname );
166 #endif
167
168
169public :
172
173
174 QString name() override { return (QString("Property Visualization")); }
175 QString description( ) override { return (QString("Computes the PropertyVis of the the active Mesh")); }
176
177
178private :
179 // Widget for Toolbox
180 PropertyVisToolbar* tool_;
181
182 QIcon* toolIcon_;
183
184private:
185
187 void setNewPropertyModel(int id);
188
189
190private:
191 ObjectListItemModel objectListItemModel_;
192
193 PropertyModel* propertyModel_;
194};
195
196#if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYVISPLUGIN_CC)
197#define PROPERTYVISPLUGIN_TEMPLATES
198#include "PropertyVisPluginT_impl.hh"
199#endif
200//=============================================================================
201#endif // PROPERTYVISPLUGIN_HH defined
202//=============================================================================
203
Logtype
Log types for Message Window.
Interface class from which all plugins have to be created.
Keyboard Event Interface.
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for receiving mouse events.
Allow access to picking functions.
void propertySelectionChanged()
Called when user selects a property.
void slotClear(int _id, const QString &_propname)
void setNewPropertyModel(int id)
Exchanges the PropertyModel after the user selected a different object.
QString name() override
Return a name for the plugin.
QString description() override
Return a description of what the plugin is doing.
void slotDuplicateProperty()
Duplicates the selected properties.
void slotRemoveProperty()
Removes the selected properties.
void slotLog(Logtype _type, QString _message)
Receives log messages from PropertyModels and emits them.
void slotVisualizeProperty(int _id, const QString &_propname)
Interface for all Plugins which provide scriptable Functions.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
Update type class.
Definition UpdateType.hh:59