50 #ifndef SELECTIONBASEPLUGIN_HH 51 #define SELECTIONBASEPLUGIN_HH 67 #include <OpenFlipper/BasePlugin/INIInterface.hh> 72 #include <ACG/Scenegraph/GlutPrimitiveNode.hh> 73 #include <ACG/Scenegraph/LineNode.hh> 78 #include "widgets/SelectionBaseToolbox.hh" 79 #include "widgets/SelectionTypeFrame.hh" 81 #include <OpenFlipper/INIFile/INIFile.hh> 83 #include "HelperClasses.hh" 101 #if QT_VERSION >= 0x050000 102 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-SelectionBase")
111 QString
name() {
return (QString(tr(
"SelectionBase"))); };
112 QString
description( ) {
return (QString(tr(
"Provides basic selection functions"))); };
120 void log(
Logtype _type, QString _message);
121 void log(QString _message);
124 void addToolbar(QToolBar* _toolbar);
127 void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
128 void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
129 void volumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
130 void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
131 void sphereSelection(QMouseEvent* _event,
double _radius, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
132 void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
133 void floodFillSelection(QMouseEvent* _event,
double _maxAngle, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
134 void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
135 void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier,
bool _deselect);
137 void selectionOperation(QString _operation);
138 void loadSelection(
const INIFile& _file);
139 void saveSelection(
INIFile& _file);
141 void keyShortcutEvent(
int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
144 void addPickMode(
const std::string& _mode);
145 void setPickModeMouseTracking(
const std::string& _mode,
bool _mouseTracking);
146 void setPickModeCursor(
const std::string& _mode, QCursor _cursor);
147 void setPickModeToolbar (
const std::string& _mode, QToolBar * _toolbar);
150 void registerKey(
int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse =
false);
153 void addToolbox(QString _name, QWidget* _widget, QIcon* _icon);
158 void initializePlugin();
159 void pluginsInitialized();
162 void slotMouseWheelEvent(QWheelEvent* _event,
const std::string& _mode);
163 void slotMouseEvent(QMouseEvent* _event);
166 void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
167 void slotRegisterType(QString _handleName,
DataType _type);
168 void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
169 void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
170 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
171 void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
172 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
175 void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u);
177 void slotShowToggleSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
178 void slotShowLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
179 void slotShowVolumeLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
180 void slotShowSurfaceLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
181 void slotShowSphereSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
182 void slotShowClosestBoundarySelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
183 void slotShowFloodFillSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
184 void slotShowComponentsSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
186 void slotGetActiveDataTypes(SelectionInterface::TypeList& _types);
187 void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
189 void slotTargetObjectsOnly(
bool& _targetsOnly);
190 void slotRegisterKeyShortcut(
int _key, Qt::KeyboardModifiers _modifiers);
193 void addedEmptyObject (
int _id);
194 void objectDeleted (
int _id);
197 void slotPickModeChanged (
const std::string& _pickmode);
200 void slotKeyEvent(QKeyEvent* _event);
201 void slotKeyReleaseEvent(QKeyEvent* _event);
205 void slotMouseToggleSelection(QMouseEvent* _event);
206 void slotMouseLassoSelection(QMouseEvent* _event);
207 void slotMouseVolumeLassoSelection(QMouseEvent* _event);
208 void slotMouseSurfaceLassoSelection(QMouseEvent* _event);
209 void slotMouseSphereSelection(QMouseEvent* _event);
210 void slotMouseBoundarySelection(QMouseEvent* _event);
211 void slotMouseFloodFillSelection(QMouseEvent* _event);
212 void slotMouseComponentsSelection(QMouseEvent* _event);
213 void slotMouseCustomSelection(QMouseEvent* _event);
215 void slotLoadSelectionButton();
216 void slotSaveSelectionButton();
218 void slotOperationRequested();
219 void slotShowAndHideOperations();
223 void slotSelectionEnvironmentRequested(
bool _checked);
225 void slotEnterSelectionMode(
bool _checked);
227 void updateActivePrimitiveTypes(
bool _checked);
230 QString version() {
return QString(
"1.0"); };
271 std::vector<DataType> types;
273 std::set<HandleAction*> defaultSelectionModes;
275 std::set<HandleAction*> customSelectionModes;
279 QHBoxLayout* primitivesBar;
281 QVBoxLayout* operationsBar;
283 std::map<QString,std::pair<FillingLayout*,QGroupBox*> > categories;
285 QActionGroup* primitiveActions;
287 unsigned int primitiveTypes;
290 std::multimap<PrimitiveType, QPushButton*> operations;
310 QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes,
311 QString& _customIdentifier,
bool _custom =
false,
DataType _objectTypeRestriction =
DATA_ALL);
320 void updateTabsOrder();
323 std::map<QString,SelectionEnvironment> selectionEnvironments_;
328 std::map<PrimitiveType,QAction*> primitiveTypeButtons_;
337 QActionGroup* primitivesBarGroup_;
338 QToolBar* pickModeToolBar_;
340 QActionGroup* selectionModesGroup_;
352 std::set<std::pair<int,Qt::KeyboardModifiers> > registeredKeys_;
357 QString currentPickMode_;
360 QString lastPickMode_;
363 QString currentSelectionMode_;
366 SelectionInterface::PrimitiveType currentPrimitiveType_;
369 unsigned int nextFreePrimitiveType_;
383 double sphere_radius_;
389 bool lassoSelection_;
392 std::vector<ACG::Vec3d> linePoints_;
400 #endif // SELECTIONBASEPLUGIN_HH Interface class for creating custom context menus.
Interface class for receiving mouse events.
bool typeExists(DataType _type, int _excludeId=-1)
Test if at least one object of type _type is in the scene graph.
Logtype
Log types for Message Window.
QString getUniqueHandleName(QString _name, int _num=0)
Get a unique handle name.
Keyboard Event Interface.
void updatePickModeToolBar()
Update the pickmode toolbar.
SelectionTypeFrameWidget * createNewTypeFrame(SelectionEnvironment &_env)
Create new type frame for tabs widget.
Interface for all Plugins which provide scriptable Functions.
Interface class for Plugins which have to store information in ini files.
Interface class from which all plugins have to be created.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
QString description()
Return a description of what the plugin is doing.
Interface for all Plugins which do logging to the logging window of the framework.
QMap< DataType, int > typeCounter_
Caches the number of available elements of a certain data type for the typeExists function...
void setSelectionMetaphor(QString _metaphor)
Enables setting the selection metaphor via scripting The default selection metaphors are: ...
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
Class for the handling of simple configuration files.
SelectionBasePlugin()
Default constructor.
Interface for all plugins which want to use selection functions.
void setSelectionPrimitiveType(QString _primitive)
Enables setting the selection primitive via scripting The default primitives for OpenMesh are: ...
void showSelectionMode(QString _mode, QString _icon, QString _desc, QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes, QString &_customIdentifier, bool _custom=false, DataType _objectTypeRestriction=DATA_ALL)
Interface for all plugins which want to Load or Save files and create Objects.
QString name()
Return a name for the plugin.
QString getUniqueIdentifierName(QString _name, int _num=0)
Get a unique pickmode name.
Add a toolbox to OpenFlipper.
Allow access to picking functions.