Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Author$ *
46  * $Date$ *
47  * *
48 \*===========================================================================*/
49 
50 
51 #ifndef SELECTIONINTERFACE_HH
52 #define SELECTIONINTERFACE_HH
53 
54 #include <OpenFlipper/INIFile/INIFile.hh>
56 
57 
58 #if QT_VERSION >= 0x050000
59  #include <QtWidgets>
60 #else
61  #include <QtGui>
62 #endif
63 
64 
82 
83  public:
84 
85  typedef std::vector<DataType> TypeList;
86  typedef unsigned int PrimitiveType;
87 
89  virtual ~SelectionInterface() {};
90 
91  //===========================================================================
153  //===========================================================================
154 
155  signals:
156 
169  virtual void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {};
170 
181  virtual void registerType(QString _handleName, DataType _type) {};
182 
194  virtual void addPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType& _typeHandle) {};
195 
199  //===========================================================================
237  //===========================================================================
238 
239  signals:
240 
252  virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
253 
265  virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
266 
278  virtual void showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
279 
291  virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
292 
304  virtual void showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
305 
317  virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
318 
330  virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
331 
343  virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
344 
363  virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
364  PrimitiveType _associatedTypes, QString& _customIdentifier) {};
365 
385  virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
386  PrimitiveType _associatedTypes, QString& _customIdentifier,
387  DataType _objectTypeRestriction) {};
388 
393  //===========================================================================
400  //===========================================================================
401 
402 
410  virtual void getActiveDataTypes(TypeList& _types) {};
411 
418  virtual void getActivePrimitiveType(PrimitiveType& _type) {};
419 
426  virtual void targetObjectsOnly(bool& _targetsOnly) {};
427 
430  //===========================================================================
467  //===========================================================================
468 
469  private slots:
470 
479  virtual void slotLoadSelection(const INIFile& _file) {};
480 
489  virtual void slotSaveSelection(INIFile& _file) {};
490 
491  public slots:
492 
500  virtual void loadSelection(int _objId, const QString& _filename) {};
501 
504  //===========================================================================
546  //===========================================================================
547 
548  signals:
562  virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
563 
564 
565  private slots:
566 
576  virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {};
577 
580  //===========================================================================
643  //===========================================================================
644 
645  signals:
660  virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type = 0u) {};
661 
662  private slots:
663 
671  virtual void slotSelectionOperation(QString _operation) {};
672 
673 
676  //===========================================================================
715  //===========================================================================
716 
717  private slots:
718 
728  virtual void slotToggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
729 
741  virtual void slotLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
742 
754  virtual void slotVolumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
755 
768  virtual void slotSurfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
769 
782  virtual void slotSphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
783 
795  virtual void slotClosestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
796 
809  virtual void slotFloodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
810 
821  virtual void slotComponentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
822 
833  virtual void slotCustomSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
834 
835 
840  //===========================================================================
846  //===========================================================================
847 
848  signals:
849 
857  virtual void selectionOperation(QString _operation) {};
858 
859 
869  virtual void toggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
870 
880  virtual void lassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
881 
891  virtual void volumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
892 
902  virtual void surfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
903 
914  virtual void sphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
915 
925  virtual void closestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
926 
937  virtual void floodFillSelection(QMouseEvent* _event, double _maxAngle, PrimitiveType _currentType, bool _deselect) {};
938 
948  virtual void componentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
949 
960  virtual void customSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
961 
971  virtual void loadSelection(const INIFile& _file) {};
972 
982  virtual void saveSelection(INIFile& _file) {};
983 
991  virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
992 
993 
996  //===========================================================================
1002  //===========================================================================
1003 
1004  private slots:
1005 
1013  virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {};
1014 
1020  virtual void slotRegisterType(QString _handleName, DataType _type) {};
1021 
1031  virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType& _typeHandle) {};
1032 
1044  virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
1045  PrimitiveType _associatedTypes, QString& _customIdentifier) {};
1046 
1057  virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
1058  PrimitiveType _associatedTypes, QString& _customIdentifier,
1059  DataType _objectTypeRestriction) {};
1060 
1067  virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1068 
1075  virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1076 
1083  virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1084 
1091  virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1092 
1099  virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1100 
1107  virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1108 
1115  virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1116 
1123  virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1124 
1130  virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {};
1131 
1136  virtual void slotGetActiveDataTypes(TypeList& _types) {};
1137 
1142  virtual void slotGetActivePrimitiveType(PrimitiveType& _type) {};
1143 
1148  virtual void slotTargetObjectsOnly(bool& _targetsOnly) {};
1149 
1157  virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {};
1158 
1159 
1163 };
1164 
1204 Q_DECLARE_INTERFACE(SelectionInterface,"OpenFlipper.SelectionInterface/1.1")
1205 
1206 #endif // SELECTIONINTERFACE_HH
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 slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers)
virtual void slotComponentsSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a connected components selection.
virtual void slotSaveSelection(INIFile &_file)
Save selection for all objects in the scene.
virtual void closestBoundarySelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a closest boundary selection.
virtual void getActivePrimitiveType(PrimitiveType &_type)
Get the primitive type that is selected.
virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void selectionOperation(QString _operation)
Emitted by selection base plugin when a non-interactive selection operation is requested.
virtual void showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show sphere selection mode in a specified selection environment.
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType &_typeHandle)
Do not use. Implemented in SelectionBasePlugin.
virtual void slotSurfaceLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a surface lasso selection.
virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void saveSelection(INIFile &_file)
Save selections into ini-file.
virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Interface for all plugins which want to use selection functions.
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 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 showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show volume lasso selection mode in a specified selection environment.
virtual void slotFloodFillSelection(QMouseEvent *_event, double _maxAngle, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a flood fill selection.
virtual void targetObjectsOnly(bool &_targetsOnly)
Indicates whether selection should be performed on target objects only.
virtual void slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show toggle selection mode in a specified selection environment.
virtual void registerType(QString _handleName, DataType _type)
Register data type for a selection environment.
virtual void surfaceLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a surface lasso selection.
virtual void slotGetActivePrimitiveType(PrimitiveType &_type)
virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
virtual void slotGetActiveDataTypes(TypeList &_types)
virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type)
virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show flood fill selection mode in a specified selection environment.
virtual ~SelectionInterface()
Destructor.
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier)
Add a custom interactive selection mode.
virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotClosestBoundarySelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a closest boundary 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 addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type=0u)
Add non-interactive selection operations for a specific primitive type.
virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show connected components selection mode in a specified selection environment.
virtual void addPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType &_typeHandle)
Provide selection for primitives other than the standard ones.
virtual void componentsSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a connected components selection...
virtual void slotVolumeLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
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 slotRegisterType(QString _handleName, DataType _type)
Do not use. Implemented in SelectionBasePlugin.
virtual void slotSphereSelection(QMouseEvent *_event, double _radius, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a sphere selection.
virtual void loadSelection(int _objId, const QString &_filename)
Scripting slot for loading selections.
virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers=Qt::NoModifier)
Key shortcut event happened.
virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show lasso selection mode in a specified selection environment.
virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers=Qt::NoModifier)
Register key shortcut.
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 slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotToggleSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a toggle selection.
virtual void slotSelectionOperation(QString _operation)
A specific operation is requested.
virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show surface lasso selection mode in a specified selection environment.
virtual void slotTargetObjectsOnly(bool &_targetsOnly)
virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Predefined datatypes.
Definition: DataTypes.hh:96
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString &_handleName)
Do not use. Implemented in SelectionBasePlugin.
virtual void floodFillSelection(QMouseEvent *_event, double _maxAngle, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a flood fill selection.
virtual void lassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a lasso selection.
virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show closest boundary selection mode in a specified selection environment.
virtual void toggleSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a toggle selection.
virtual void slotCustomSelection(QMouseEvent *_event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect)
Called whenever the user performs a custom selection.
virtual void loadSelection(const INIFile &_file)
Load selections from ini-file.
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.