Developer Documentation
SelectionInterface.hh
Go to the documentation of this file.
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 <OpenFlipper/INIFile/INIFile.hh>
46 
47 
48 #include <QWidget>
49 
50 
68 
69  public:
70 
71  typedef std::vector<DataType> TypeList;
72  typedef unsigned int PrimitiveType;
73 
75  virtual ~SelectionInterface() {};
76 
77  //===========================================================================
139  //===========================================================================
140 
141  signals:
142 
155  virtual void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {};
156 
167  virtual void registerType(QString _handleName, DataType _type) {};
168 
180  virtual void addPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType& _typeHandle) {};
181 
185  //===========================================================================
223  //===========================================================================
224 
225  signals:
226 
238  virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
239 
251  virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
252 
264  virtual void showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
265 
277  virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
278 
290  virtual void showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
291 
303  virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
304 
316  virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
317 
329  virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
330 
349  virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
350  PrimitiveType _associatedTypes, QString& _customIdentifier) {};
351 
371  virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
372  PrimitiveType _associatedTypes, QString& _customIdentifier,
373  DataType _objectTypeRestriction) {};
374 
379  //===========================================================================
386  //===========================================================================
387 
388 
396  virtual void getActiveDataTypes(TypeList& _types) {};
397 
404  virtual void getActivePrimitiveType(PrimitiveType& _type) {};
405 
412  virtual void targetObjectsOnly(bool& _targetsOnly) {};
413 
416  //===========================================================================
452  //===========================================================================
453 
454  private slots:
455 
464  virtual void slotLoadSelection(const INIFile& _file) {};
465 
474  virtual void slotSaveSelection(INIFile& _file) {};
475 
476  public slots:
477 
485  virtual void loadSelection(int _objId, const QString& _filename) {};
486 
489  //===========================================================================
531  //===========================================================================
532 
533  signals:
547  virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
548 
549 
550  private slots:
551 
561  virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {};
562 
565  //===========================================================================
626  //===========================================================================
627 
628  signals:
643  virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type = 0u) {};
644 
655  virtual void addSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type = 0u) {};
656 
657  private slots:
658 
666  virtual void slotSelectionOperation(QString _operation) {};
667 
668 
671  //===========================================================================
710  //===========================================================================
711 
712  private slots:
713 
723  virtual void slotToggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
724 
736  virtual void slotLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
737 
749  virtual void slotVolumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
750 
763  virtual void slotSurfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
764 
777  virtual void slotSphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
778 
790  virtual void slotClosestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
791 
803  virtual void slotFloodFillSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
804 
815  virtual void slotComponentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
816 
827  virtual void slotCustomSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
828 
829 
834  //===========================================================================
840  //===========================================================================
841 
842  signals:
843 
851  virtual void selectionOperation(QString _operation) {};
852 
853 
863  virtual void toggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
864 
874  virtual void lassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
875 
885  virtual void volumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
886 
896  virtual void surfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
897 
908  virtual void sphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
909 
919  virtual void closestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
920 
930  virtual void floodFillSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
931 
941  virtual void componentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
942 
953  virtual void customSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
954 
964  virtual void loadSelection(const INIFile& _file) {};
965 
975  virtual void saveSelection(INIFile& _file) {};
976 
984  virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
985 
986 
989  //===========================================================================
995  //===========================================================================
996 
997  private slots:
998 
1006  virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {};
1007 
1013  virtual void slotRegisterType(QString _handleName, DataType _type) {};
1014 
1024  virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType& _typeHandle) {};
1025 
1037  virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
1038  PrimitiveType _associatedTypes, QString& _customIdentifier) {};
1039 
1050  virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
1051  PrimitiveType _associatedTypes, QString& _customIdentifier,
1052  DataType _objectTypeRestriction) {};
1053 
1060  virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1061 
1068  virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1069 
1076  virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1077 
1084  virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1085 
1092  virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1093 
1100  virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1101 
1108  virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1109 
1116  virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1117 
1123  virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {};
1124 
1129  virtual void slotGetActiveDataTypes(TypeList& _types) {};
1130 
1135  virtual void slotGetActivePrimitiveType(PrimitiveType& _type) {};
1136 
1141  virtual void slotTargetObjectsOnly(bool& _targetsOnly) {};
1142 
1150  virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {};
1151 
1159  virtual void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type = 0u) {};
1160 
1161 
1165 };
1166 
1206 Q_DECLARE_INTERFACE(SelectionInterface,"OpenFlipper.SelectionInterface/1.1")
1207 
virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show surface lasso selection mode in a specified selection environment.
virtual void slotLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a lasso selection.
virtual void getActiveDataTypes(TypeList &_types)
Get the data types that the currently active selection environment supports.
virtual void slotCustomSelection(QMouseEvent *_event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect)
Called whenever the user performs a custom selection.
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier, DataType _objectTypeRestriction)
Add a custom interactive selection mode.
virtual void slotVolumeLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
virtual void slotSaveSelection(INIFile &_file)
Save selection for all objects in the scene.
virtual void slotGetActivePrimitiveType(PrimitiveType &_type)
virtual void showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show volume lasso selection mode in a specified selection environment.
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier)
Do not use. Implemented in SelectionBasePlugin.
virtual void sphereSelection(QMouseEvent *_event, double _radius, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a sphere selection.
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier, DataType _objectTypeRestriction)
Do not use. Implemented in SelectionBasePlugin.
virtual void surfaceLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a surface lasso selection.
virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual ~SelectionInterface()
Destructor.
virtual void getActivePrimitiveType(PrimitiveType &_type)
Get the primitive type that is selected.
virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show closest boundary selection mode in a specified selection environment.
virtual void lassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a lasso selection.
virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
virtual void slotFloodFillSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a flood fill selection.
virtual void addPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType &_typeHandle)
Provide selection for primitives other than the standard ones.
Predefined datatypes.
Definition: DataTypes.hh:83
virtual void slotTargetObjectsOnly(bool &_targetsOnly)
virtual void slotRegisterType(QString _handleName, DataType _type)
Do not use. Implemented in SelectionBasePlugin.
virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type)
virtual void toggleSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a toggle selection.
virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show toggle selection mode in a specified selection environment.
virtual void customSelection(QMouseEvent *_event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect)
Emitted by selection base plugin whenever the user performs a custom selection.
virtual void volumeLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a volume lasso selection.
virtual void selectionOperation(QString _operation)
Emitted by selection base plugin when a non-interactive selection operation is requested.
virtual void slotToggleSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a toggle selection.
virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show lasso selection mode in a specified selection environment.
virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers)
virtual void slotClosestBoundarySelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a closest boundary selection.
virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type=0u)
Add non-interactive selection operations for a specific primitive type.
virtual void targetObjectsOnly(bool &_targetsOnly)
Indicates whether selection should be performed on target objects only.
virtual void floodFillSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a flood fill selection.
virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType &_typeHandle)
Do not use. Implemented in SelectionBasePlugin.
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier)
Add a custom interactive selection mode.
Interface for all plugins which want to use selection functions.
virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotSelectionOperation(QString _operation)
A specific operation is requested.
virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void registerType(QString _handleName, DataType _type)
Register data type for a selection environment.
virtual void componentsSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a connected components selection...
virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show flood fill selection mode in a specified selection environment.
virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers=Qt::NoModifier)
Key shortcut event happened.
virtual void addSelectionParameters(QString _handleName, QWidget *_widget, QString _category, PrimitiveType _type=0u)
Add interactive selection parameters for a specific primitive type.
virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Class for the handling of simple configuration files.
Definition: INIFile.hh:99
virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show connected components selection mode in a specified selection environment.
virtual void slotSphereSelection(QMouseEvent *_event, double _radius, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a sphere selection.
virtual void slotComponentsSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a connected components selection.
virtual void saveSelection(INIFile &_file)
Save selections into ini-file.
virtual void loadSelection(const INIFile &_file)
Load selections from ini-file.
virtual void slotSurfaceLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a surface lasso selection.
virtual void closestBoundarySelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a closest boundary selection.
virtual void slotGetActiveDataTypes(TypeList &_types)
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString &_handleName)
Do not use. Implemented in SelectionBasePlugin.
virtual void showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show sphere selection mode in a specified selection environment.
virtual void loadSelection(int _objId, const QString &_filename)
Scripting slot for loading selections.
virtual void slotAddSelectionParameters(QString _handleName, QWidget *_widget, QString _category, PrimitiveType _type=0u)
virtual void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString &_handleName)
Add a selection environment in order to provide selection functions for specific data type(s) ...
virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers=Qt::NoModifier)
Register key shortcut.