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 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-SelectionBase")
109 QString
name() {
return (QString(tr(
"SelectionBase"))); };
110 QString
description( ) {
return (QString(tr(
"Provides basic selection functions"))); };
118 void log(
Logtype _type, QString _message);
119 void log(QString _message);
122 void addToolbar(QToolBar* _toolbar);
125 void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
126 void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
127 void volumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
128 void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
129 void sphereSelection(QMouseEvent* _event,
double _radius, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
130 void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
131 void floodFillSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
132 void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType,
bool _deselect);
133 void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier,
bool _deselect);
135 void selectionOperation(QString _operation);
136 void loadSelection(
const INIFile& _file);
137 void saveSelection(
INIFile& _file);
139 void keyShortcutEvent(
int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
142 void addPickMode(
const std::string& _mode);
143 void setPickModeMouseTracking(
const std::string& _mode,
bool _mouseTracking);
144 void setPickModeCursor(
const std::string& _mode, QCursor _cursor);
145 void setPickModeToolbar (
const std::string& _mode, QToolBar * _toolbar);
148 void registerKey(
int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse =
false);
151 void addToolbox(QString _name, QWidget* _widget, QIcon* _icon);
156 void initializePlugin();
157 void pluginsInitialized();
160 void slotMouseWheelEvent(QWheelEvent* _event,
const std::string& _mode);
161 void slotMouseEvent(QMouseEvent* _event);
164 void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
165 void slotRegisterType(QString _handleName,
DataType _type);
166 void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
167 void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
168 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
169 void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
170 SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
173 void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type = 0u);
174 void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type = 0u);
176 void slotShowToggleSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
177 void slotShowLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
178 void slotShowVolumeLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
179 void slotShowSurfaceLassoSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
180 void slotShowSphereSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
181 void slotShowClosestBoundarySelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
182 void slotShowFloodFillSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
183 void slotShowComponentsSelectionMode(QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes);
185 void slotGetActiveDataTypes(SelectionInterface::TypeList& _types);
186 void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
188 void slotTargetObjectsOnly(
bool& _targetsOnly);
189 void slotRegisterKeyShortcut(
int _key, Qt::KeyboardModifiers _modifiers);
192 void addedEmptyObject (
int _id);
193 void objectDeleted (
int _id);
196 void slotPickModeChanged (
const std::string& _pickmode);
199 void slotKeyEvent(QKeyEvent* _event);
200 void slotKeyReleaseEvent(QKeyEvent* _event);
203 void loadIniFileOptionsLast(
INIFile& _ini);
208 void slotMouseToggleSelection(QMouseEvent* _event);
209 void slotMouseLassoSelection(QMouseEvent* _event);
210 void slotMouseVolumeLassoSelection(QMouseEvent* _event);
211 void slotMouseSurfaceLassoSelection(QMouseEvent* _event);
212 void slotMouseSphereSelection(QMouseEvent* _event);
213 void slotMouseBoundarySelection(QMouseEvent* _event);
214 void slotMouseFloodFillSelection(QMouseEvent* _event);
215 void slotMouseComponentsSelection(QMouseEvent* _event);
216 void slotMouseCustomSelection(QMouseEvent* _event);
218 void slotLoadSelectionButton();
219 void slotSaveSelectionButton();
221 void slotOperationRequested();
222 void slotShowAndHideOperations();
223 void slotShowAndHideParameters();
227 void slotSelectionEnvironmentRequested(
bool _checked);
229 void slotEnterSelectionMode(
bool _checked);
231 void updateActivePrimitiveTypes(
bool _checked);
234 QString version() {
return QString(
"1.0"); };
275 std::vector<DataType> types;
277 std::set<HandleAction*> defaultSelectionModes;
279 std::set<HandleAction*> customSelectionModes;
283 QHBoxLayout* primitivesBar;
285 QVBoxLayout* operationsBar;
287 std::map<QString,std::pair<FillingLayout*,QGroupBox*> > categories;
289 QActionGroup* primitiveActions;
291 unsigned int primitiveTypes;
294 std::multimap<PrimitiveType, QPushButton*> operations;
297 std::multimap<PrimitiveType, QWidget*> parameters;
320 QString _handleName,
bool _show, SelectionInterface::PrimitiveType _associatedTypes,
321 QString& _customIdentifier,
bool _custom =
false,
DataType _objectTypeRestriction =
DATA_ALL);
325 SelectionInterface::PrimitiveType& _associatedTypes);
337 void updateTabsOrder();
340 std::map<QString,SelectionEnvironment> selectionEnvironments_;
345 std::map<PrimitiveType,QAction*> primitiveTypeButtons_;
354 QActionGroup* primitivesBarGroup_;
355 QToolBar* pickModeToolBar_;
357 QActionGroup* selectionModesGroup_;
369 std::set<std::pair<int,Qt::KeyboardModifiers> > registeredKeys_;
374 QString currentPickMode_;
377 QString lastPickMode_;
380 QString currentSelectionMode_;
383 SelectionInterface::PrimitiveType currentPrimitiveType_;
386 unsigned int nextFreePrimitiveType_;
400 double sphere_radius_;
406 bool lassoSelection_;
409 std::vector<ACG::Vec3d> linePoints_;
417 #endif // SELECTIONBASEPLUGIN_HH
Interface class for Plugins which have to store information in ini files.
Interface class for creating custom context menus.
SelectionBasePlugin()
Default constructor.
Logtype
Log types for Message Window.
QMap< DataType, int > typeCounter_
Caches the number of available elements of a certain data type for the typeExists function...
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which provide scriptable Functions.
bool getSelectionEnvironment(SelectionEnvironment *&env, const QString &_handleName)
Get a selectionEnvironment by a given name.
QString description()
Return a description of what the plugin is doing.
QString getUniqueHandleName(QString _name, int _num=0)
Get a unique handle name.
void updatePickModeToolBar()
Update the pickmode toolbar.
Interface class for receiving mouse events.
Interface for all Plugins which do logging to the logging window of the framework.
QString getUniqueIdentifierName(QString _name, int _num=0)
Get a unique pickmode name.
void setSelectionPrimitiveType(QString _primitive)
Enables setting the selection primitive via scripting The default primitives for OpenMesh are: ...
Allow access to picking functions.
bool findObjectType(BaseObjectData *&obj, bool &found, SelectionEnvironment *&env, int _id)
helper function to find a baseObjectData and selection environment given a specific id ...
void setSelectionMetaphor(QString _metaphor)
Enables setting the selection metaphor via scripting The default selection metaphors are: ...
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
void selectionModeShowSwitch(bool _show, SelectionEnvironment *&env, HandleAction *toggleSelectionAction_, SelectionInterface::PrimitiveType &_associatedTypes)
helper function for showSelectionMode
Interface class from which all plugins have to be created.
Add a toolbox to OpenFlipper.
Keyboard Event Interface.
Interface for all plugins which want to use selection functions.
bool typeExists(DataType _type, int _excludeId=-1)
Test if at least one object of type _type is in the scene graph.
SelectionTypeFrameWidget * createNewTypeFrame(SelectionEnvironment &_env)
Create new type frame for tabs widget.
void showSelectionMode(QString _mode, QString _icon, QString _desc, QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes, QString &_customIdentifier, bool _custom=false, DataType _objectTypeRestriction=DATA_ALL)
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
QString name()
Return a name for the plugin.
Class for the handling of simple configuration files.