Developer Documentation
Loading...
Searching...
No Matches
ComponentsPlugin.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#ifndef COMPONENTSPLUGIN_HH
43#define COMPONENTSPLUGIN_HH
44
45#include <QObject>
46
58
60{
61 Q_OBJECT
62 Q_INTERFACES( BaseInterface )
63 Q_INTERFACES( MouseInterface )
64 Q_INTERFACES( PickingInterface )
65 Q_INTERFACES( LoggingInterface )
66 Q_INTERFACES( BackupInterface )
67 Q_INTERFACES( LoadSaveInterface )
68 Q_INTERFACES( ToolbarInterface )
69 Q_INTERFACES( ScriptInterface )
70
71
72 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Components")
73
74 signals:
75 // BaseInterface
76 void updateView();
77 void updatedObject(int _identifier, const UpdateType& _type);
78 void setSlotDescription(QString _slotName, QString _slotDescription,
79 QStringList _parameters, QStringList _descriptions);
80
81 // LoadSaveInterface
82 void addEmptyObject( DataType _type, int& _id);
83 void copyObject( int _oldId, int& _newId);
84
85 // ToolBarInterface
86 void addToolbar(QToolBar* _toolbar);
87 void getToolBar( QString _name, QToolBar*& _toolbar);
88
89 // PickingInterface
90 void addPickMode( const std::string& _mode);
91
92 //ScriptInterface
93 void scriptInfo( QString _functionName );
94
95 // LoggingInterface
96 void log( Logtype _type, QString _message );
97 void log( QString _message );
98
99 // BackupInterface
100 void createBackup( int _objectid, QString _name, UpdateType _type);
101
102 // LoadSaveInterface
103 void deleteObject( int _id );
104
105 private slots:
106
107 // BaseInterface
108 void initializePlugin();
109 void noguiSupported(){};
110 void pluginsInitialized();
111
112 // PickingInterface
113 void slotPickModeChanged( const std::string& _mode);
114
115 // MouseInterface:
116 void slotMouseEvent( QMouseEvent* _event );
117
118 public:
121
122 void exit() {}
123
124 QString name() { return (QString("Components")); };
125 QString description( ) { return (QString("Handle mesh components")); };
126
127
128//===========================================================================
131//===========================================================================
132
133 private slots:
134
137
139
141 void splitComponents(QMouseEvent* _event);
142
143 void biggestComponent(QMouseEvent* _event);
144
145 private :
146 //toolbar
147 QAction* splitAction_;
149
152//===========================================================================
155//===========================================================================
156
166 template< class MeshT >
167 void splitComponent( MeshT* _mesh, MeshT* _copy);
168
175 template< class MeshT >
176 void selectBiggestComponent( MeshT* _mesh);
177
185 template< class MeshT >
186 void deleteUnselectedFaces( MeshT* _mesh);
187
190//===========================================================================
193//===========================================================================
194
195 public slots:
196
197
204 IdList splitComponents( int _objectId );
205
206
213 void biggestComponent(int _objId);
214
217 public slots:
218 QString version() { return QString("1.0"); };
219
220 private:
222 void setDescriptions();
223};
224
225#if defined(INCLUDE_TEMPLATES) && !defined(COMPONENTSPLUGIN_CC)
226#define COMPONENTSPLUGIN_TEMPLATES
227#include "ComponentsPluginT_impl.hh"
228#endif
229//=============================================================================
230#endif //CUTPLUGIN_HH
231//=============================================================================
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition DataTypes.hh:181
Logtype
Log types for Message Window.
Interface class for backup handling.
Interface class from which all plugins have to be created.
void biggestComponent(QMouseEvent *_event)
Split into Components Button was hit.
void initializePlugin()
Initialize the plugin.
void slotSplitComponentsButton()
Split into Components Button was hit.
void pluginsInitialized()
Second initialization phase.
QAction * biggestAction_
Split into Components Button was hit.
void slotPickModeChanged(const std::string &_mode)
the pickMode changed
void deleteUnselectedFaces(MeshT *_mesh)
Deletes all faces of a mesh that are not selected.
QAction * splitAction_
Split into Components Button was hit.
ComponentsPlugin()
Constructor.
void setDescriptions()
set scripting slot descriptions
void splitComponent(MeshT *_mesh, MeshT *_copy)
Split mesh into components.
void selectBiggestComponent(MeshT *_mesh)
Select the biggest component of the mesh.
void slotMouseEvent(QMouseEvent *_event)
a mouse event occured
void slotBiggestComponentButton()
Split into Components Button was hit.
QString name()
Return a name for the plugin.
QString description()
Return a description of what the plugin is doing.
void splitComponents(QMouseEvent *_event)
Split Components of picked object.
Predefined datatypes.
Definition DataTypes.hh:83
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.
Interface for all Plugins which provide scriptable Functions.
Add a toolbox to OpenFlipper.
Update type class.
Definition UpdateType.hh:59