Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 /*===========================================================================*\
43 * *
44  * $Revision$ *
45  * $LastChangedBy$ *
46  * $Date$ *
47  * *
48  \*===========================================================================*/
49 
50 #ifndef COMPONENTSPLUGIN_HH
51 #define COMPONENTSPLUGIN_HH
52 
53 #include <QObject>
54 
66 
68 {
69  Q_OBJECT
70  Q_INTERFACES( BaseInterface )
71  Q_INTERFACES( MouseInterface )
72  Q_INTERFACES( PickingInterface )
73  Q_INTERFACES( LoggingInterface )
74  Q_INTERFACES( BackupInterface )
75  Q_INTERFACES( LoadSaveInterface )
76  Q_INTERFACES( ToolbarInterface )
77  Q_INTERFACES( ScriptInterface )
78 
79 
80 #if QT_VERSION >= 0x050000
81  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Components")
82 #endif
83 
84  signals:
85  // BaseInterface
86  void updateView();
87  void updatedObject(int _identifier, const UpdateType& _type);
88  void setSlotDescription(QString _slotName, QString _slotDescription,
89  QStringList _parameters, QStringList _descriptions);
90 
91  // LoadSaveInterface
92  void addEmptyObject( DataType _type, int& _id);
93  void copyObject( int _oldId, int& _newId);
94 
95  // ToolBarInterface
96  void addToolbar(QToolBar* _toolbar);
97  void getToolBar( QString _name, QToolBar*& _toolbar);
98 
99  // PickingInterface
100  void addPickMode( const std::string& _mode);
101 
102  //ScriptInterface
103  void scriptInfo( QString _functionName );
104 
105  // LoggingInterface
106  void log( Logtype _type, QString _message );
107  void log( QString _message );
108 
109  // BackupInterface
110  void createBackup( int _objectid, QString _name, UpdateType _type);
111 
112  // LoadSaveInterface
113  void deleteObject( int _id );
114 
115  private slots:
116 
117  // BaseInterface
118  void initializePlugin();
119  void noguiSupported(){};
120  void pluginsInitialized();
121 
122  // PickingInterface
123  void slotPickModeChanged( const std::string& _mode);
124 
125  // MouseInterface:
126  void slotMouseEvent( QMouseEvent* _event );
127 
128  public:
130  ~ComponentsPlugin() { }
131 
132  void exit() {}
133 
134  QString name() { return (QString("Components")); };
135  QString description( ) { return (QString("Handle mesh components")); };
136 
137 
138 //===========================================================================
141 //===========================================================================
142 
143  private slots:
144 
147 
149 
151  void splitComponents(QMouseEvent* _event);
152 
153  void biggestComponent(QMouseEvent* _event);
154 
155  private :
156  //toolbar
157  QAction* splitAction_;
158  QAction* biggestAction_;
159 
162 //===========================================================================
165 //===========================================================================
166 
176  template< class MeshT >
177  void splitComponent( MeshT* _mesh, MeshT* _copy);
178 
185  template< class MeshT >
186  void selectBiggestComponent( MeshT* _mesh);
187 
195  template< class MeshT >
196  void deleteUnselectedFaces( MeshT* _mesh);
197 
200 //===========================================================================
203 //===========================================================================
204 
205  public slots:
206 
207 
214  IdList splitComponents( int _objectId );
215 
216 
223  void biggestComponent(int _objId);
224 
227  public slots:
228  QString version() { return QString("1.0"); };
229 
230  private:
232  void setDescriptions();
233 };
234 
235 #if defined(INCLUDE_TEMPLATES) && !defined(COMPONENTSPLUGIN_CC)
236 #define COMPONENTSPLUGIN_TEMPLATES
237 #include "ComponentsPluginT.cc"
238 #endif
239 //=============================================================================
240 #endif //CUTPLUGIN_HH
241 //=============================================================================
Interface class from which all plugins have to be created.
void splitComponents(QMouseEvent *_event)
Split Components of picked object.
void slotSplitComponentsButton()
Split into Components Button was hit.
Logtype
Log types for Message Window.
ComponentsPlugin()
Constructor.
Update type class.
Definition: UpdateType.hh:70
void pluginsInitialized()
Second initialization phase.
QAction * biggestAction_
Split into Components Button was hit.
Interface for all Plugins which do logging to the logging window of the framework.
void selectBiggestComponent(MeshT *_mesh)
Select the biggest component of the mesh.
void slotPickModeChanged(const std::string &_mode)
the pickMode changed
QAction * splitAction_
Split into Components Button was hit.
void setDescriptions()
set scripting slot descriptions
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition: DataTypes.hh:192
void initializePlugin()
Initialize the plugin.
QString description()
Return a description of what the plugin is doing.
void slotBiggestComponentButton()
Split into Components Button was hit.
Interface for all Plugins which provide scriptable Functions.
Add a toolbox to OpenFlipper.
void splitComponent(MeshT *_mesh, MeshT *_copy)
Split mesh into components.
Interface for all plugins which want to Load or Save files and create Objects.
void deleteUnselectedFaces(MeshT *_mesh)
Deletes all faces of a mesh that are not selected.
void slotMouseEvent(QMouseEvent *_event)
a mouse event occured
Allow access to picking functions.
Interface class for backup handling.
Interface class for receiving mouse events.
Predefined datatypes.
Definition: DataTypes.hh:96
QString name()
Return a name for the plugin.
void biggestComponent(QMouseEvent *_event)
Split into Components Button was hit.