Developer Documentation

HoleFillerPlugin.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 #pragma once
43
44 #include <QObject>
45 #include <QMenuBar>
46
47 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
48 #include <OpenFlipper/BasePlugin/MouseInterface.hh>
49 #include <OpenFlipper/BasePlugin/PickingInterface.hh>
50 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
51 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
52 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
53 #include <OpenFlipper/BasePlugin/BackupInterface.hh>
54 #include <OpenFlipper/common/Types.hh>
55 #include <ObjectTypes/PolyMesh/PolyMesh.hh>
56 #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
57
58 #include <vector>
59 #include <utility>
60
61 class HoleFillerToolbarWidget;
62
63 class HoleFillerPlugin : public QObject, BaseInterface, MouseInterface, PickingInterface, ToolboxInterface, LoggingInterface, ScriptInterface, BackupInterface
64 {
65 Q_OBJECT
66 Q_INTERFACES(BaseInterface)
67 Q_INTERFACES(MouseInterface)
68 Q_INTERFACES(PickingInterface)
69 Q_INTERFACES(ToolboxInterface)
70 Q_INTERFACES(LoggingInterface)
71 Q_INTERFACES(ScriptInterface)
72 Q_INTERFACES(BackupInterface)
73 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-HoleFilling")
74
75 signals:
76 // BaseInterface
77 void updateView();
78 void updatedObject(int _id, const UpdateType& _type);
79
80 void addPickMode( const std::string& _mode );
81
82 void log(Logtype _type, QString _message);
83 void log(QString _message);
84
85 void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
86
87 void scriptInfo( QString _functionName );
88
89 void setSlotDescription(QString _slotName , QString _slotDescription,
90 QStringList _parameters , QStringList _descriptions);
91
92 // ToolboxInterface
93 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
94
95
96 private slots:
97 void slotObjectUpdated( int _identifier, const UpdateType& _type );
98
99 void slotMouseWheelEvent(QWheelEvent * /*_event*/, const std::string & /*_mode*/){};
100
101 void slotMouseEvent( QMouseEvent* /*_event*/ ){};
102
103 // BaseInterface
104 void initializePlugin();
105 void pluginsInitialized() ;
106
107 void detectButton( );
108
109 public :
110
111 ~HoleFillerPlugin() {};
112
113 HoleFillerPlugin();
114
115 QString name() { return (QString("Hole Filler")); };
116 QString description( ) { return (QString("Fill Holes or connect meshes")); };
117
118 private slots:
119 void slotItemSelectionChanged();
120
121 void slotCellDoubleClicked(int _row , int _col);
122 void slotFillSelection();
123 private :
124
125 void update_menu();
126
128 void getSelectedHoles(std::vector<int>& _holeIds, std::vector<int>& _objIds);
129
131 HoleFillerToolbarWidget* tool_;
132
134 std::vector< std::pair< int , int> > holeMapping_;
135
136 //Scripting slots
137 public slots:
138
139 void fillAllHoles(int _objectID);
140
141 void fillHole(int _objectID, int _edgeHandle);
142
143 public slots:
144
145 QString version() { return QString("1.3"); };
146 };
147
HoleFillerPlugin::tool_
HoleFillerToolbarWidget * tool_
Widget for Toolbox.
Definition: HoleFillerPlugin.hh:131
HoleFillerPlugin::slotMouseEvent
void slotMouseEvent(QMouseEvent *)
Mouse Event from main application ( Picking Mode )
Definition: HoleFillerPlugin.hh:101
HoleFillerPlugin::slotObjectUpdated
void slotObjectUpdated(int _identifier, const UpdateType &_type)
check for holes if an object has changed
Definition: HoleFillerPlugin.cc:360
UpdateType
Update type class.
Definition: UpdateType.hh:60
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
TriangleMesh.hh
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
MouseInterface.hh
HoleFillerPlugin::fillAllHoles
void fillAllHoles(int _objectID)
fill all holes from a given object
Definition: HoleFillerPlugin.cc:525
HoleFillerPlugin::slotCellDoubleClicked
void slotCellDoubleClicked(int _row, int _col)
Slot for filling holes from double-clicked rows.
Definition: HoleFillerPlugin.cc:273
HoleFillerPlugin::holeMapping_
std::vector< std::pair< int, int > > holeMapping_
map from the index in the table to (object-id, hole-id)
Definition: HoleFillerPlugin.hh:134
HoleFillerPlugin::slotItemSelectionChanged
void slotItemSelectionChanged()
slot for displaying selected holes
Definition: HoleFillerPlugin.cc:175
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:58
HoleFillerPlugin::update_menu
void update_menu()
update the entries in the tableWidget
Definition: HoleFillerPlugin.cc:401
LoggingInterface.hh
PickingInterface.hh
HoleFillerPlugin::name
QString name()
Return a name for the plugin.
Definition: HoleFillerPlugin.hh:115
HoleFillerToolbarWidget
Definition: holefillerToolbar.hh:46
HoleFillerPlugin
Definition: HoleFillerPlugin.hh:63
HoleFillerPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: HoleFillerPlugin.hh:116
MouseInterface
Interface class for receiving mouse events.
Definition: MouseInterface.hh:61
HoleFillerPlugin::detectButton
void detectButton()
detect holes on all objects
Definition: HoleFillerPlugin.cc:323
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
HoleFillerPlugin::pluginsInitialized
void pluginsInitialized()
add PickModes after initialization
Definition: HoleFillerPlugin.cc:79
BaseInterface.hh
PickingInterface
Allow access to picking functions.
Definition: PickingInterface.hh:62
HoleFillerPlugin::slotFillSelection
void slotFillSelection()
Fill all selected holes.
Definition: HoleFillerPlugin.cc:109
HoleFillerPlugin::initializePlugin
void initializePlugin()
Initialize the toolbox widget.
Definition: HoleFillerPlugin.cc:60
HoleFillerPlugin::HoleFillerPlugin
HoleFillerPlugin()
Constructor.
Definition: HoleFillerPlugin.cc:53
HoleFillerPlugin::fillHole
void fillHole(int _objectID, int _edgeHandle)
fill a hole in given object where _edgeHandle is on the boundary
Definition: HoleFillerPlugin.cc:571
ToolboxInterface
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Definition: ToolboxInterface.hh:68
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
ToolboxInterface.hh
BackupInterface.hh
Types.hh
BackupInterface
Interface class for backup handling.
Definition: BackupInterface.hh:59
HoleFillerPlugin::getSelectedHoles
void getSelectedHoles(std::vector< int > &_holeIds, std::vector< int > &_objIds)
get a map from objectID to (selected) holeIDs
Definition: HoleFillerPlugin.cc:94
PolyMesh.hh
ScriptInterface.hh