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  //===========================================================================
453  //===========================================================================
454 
455  private slots:
456 
465  virtual void slotLoadSelection(const INIFile& _file) {};
466 
475  virtual void slotSaveSelection(INIFile& _file) {};
476 
477  public slots:
478 
486  virtual void loadSelection(int _objId, const QString& _filename) {};
487 
490  //===========================================================================
532  //===========================================================================
533 
534  signals:
548  virtual void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
549 
550 
551  private slots:
552 
562  virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {};
563 
566  //===========================================================================
629  //===========================================================================
630 
631  signals:
646  virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type = 0u) {};
647 
658  virtual void addSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type = 0u) {};
659 
660  private slots:
661 
669  virtual void slotSelectionOperation(QString _operation) {};
670 
671 
674  //===========================================================================
713  //===========================================================================
714 
715  private slots:
716 
726  virtual void slotToggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
727 
739  virtual void slotLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
740 
752  virtual void slotVolumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
753 
766  virtual void slotSurfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
767 
780  virtual void slotSphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
781 
793  virtual void slotClosestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
794 
806  virtual void slotFloodFillSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
807 
818  virtual void slotComponentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
819 
830  virtual void slotCustomSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
831 
832 
837  //===========================================================================
843  //===========================================================================
844 
845  signals:
846 
854  virtual void selectionOperation(QString _operation) {};
855 
856 
866  virtual void toggleSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
867 
877  virtual void lassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
878 
888  virtual void volumeLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
889 
899  virtual void surfaceLassoSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
900 
911  virtual void sphereSelection(QMouseEvent* _event, double _radius, PrimitiveType _currentType, bool _deselect) {};
912 
922  virtual void closestBoundarySelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
923 
933  virtual void floodFillSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
934 
944  virtual void componentsSelection(QMouseEvent* _event, PrimitiveType _currentType, bool _deselect) {};
945 
956  virtual void customSelection(QMouseEvent* _event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect) {};
957 
967  virtual void loadSelection(const INIFile& _file) {};
968 
978  virtual void saveSelection(INIFile& _file) {};
979 
987  virtual void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier) {};
988 
989 
992  //===========================================================================
998  //===========================================================================
999 
1000  private slots:
1001 
1009  virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName) {};
1010 
1016  virtual void slotRegisterType(QString _handleName, DataType _type) {};
1017 
1027  virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType& _typeHandle) {};
1028 
1040  virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
1041  PrimitiveType _associatedTypes, QString& _customIdentifier) {};
1042 
1053  virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
1054  PrimitiveType _associatedTypes, QString& _customIdentifier,
1055  DataType _objectTypeRestriction) {};
1056 
1063  virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1064 
1071  virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1072 
1079  virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1080 
1087  virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1088 
1095  virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1096 
1103  virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1104 
1111  virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1112 
1119  virtual void slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes) {};
1120 
1126  virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers) {};
1127 
1132  virtual void slotGetActiveDataTypes(TypeList& _types) {};
1133 
1138  virtual void slotGetActivePrimitiveType(PrimitiveType& _type) {};
1139 
1144  virtual void slotTargetObjectsOnly(bool& _targetsOnly) {};
1145 
1153  virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type) {};
1154 
1162  virtual void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, PrimitiveType _type = 0u) {};
1163 
1164 
1168 };
1169 
1209 Q_DECLARE_INTERFACE(SelectionInterface,"OpenFlipper.SelectionInterface/1.1")
1210 
virtual void showLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show lasso selection mode in a specified selection environment.
virtual void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier)
Add a custom interactive selection mode.
virtual void getActivePrimitiveType(PrimitiveType &_type)
Get the primitive type that is selected.
virtual void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type=0u)
Add non-interactive selection operations for a specific primitive type.
virtual void slotLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a lasso selection.
virtual void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void loadSelection(const INIFile &_file)
Load selections from ini-file.
virtual void slotSelectionOperation(QString _operation)
A specific operation is requested.
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 loadSelection(int _objId, const QString &_filename)
Scripting slot for loading selections.
virtual void showComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show connected components selection mode in a specified selection environment.
virtual void slotShowFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotShowSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void toggleSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a toggle selection.
virtual void selectionOperation(QString _operation)
Emitted by selection base plugin when a non-interactive selection operation is requested.
virtual void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon, PrimitiveType _associatedTypes, QString &_customIdentifier)
Do not use. Implemented in SelectionBasePlugin.
virtual void slotClosestBoundarySelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a closest boundary selection.
virtual void slotTargetObjectsOnly(bool &_targetsOnly)
virtual void slotRegisterType(QString _handleName, DataType _type)
Do not use. Implemented in SelectionBasePlugin.
virtual void slotFloodFillSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a flood fill 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 showVolumeLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show volume lasso 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 targetObjectsOnly(bool &_targetsOnly)
Indicates whether selection should be performed on target objects only.
virtual void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType &_typeHandle)
Do not use. Implemented in SelectionBasePlugin.
virtual void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotCustomSelection(QMouseEvent *_event, PrimitiveType _currentType, QString _customIdentifier, bool _deselect)
Called whenever the user performs a custom selection.
virtual void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
virtual void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers)
virtual void surfaceLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a surface lasso selection.
virtual void slotToggleSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a toggle selection.
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 slotComponentsSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotGetActiveDataTypes(TypeList &_types)
virtual void floodFillSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a flood fill selection.
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 registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers=Qt::NoModifier)
Register key shortcut.
virtual void registerType(QString _handleName, DataType _type)
Register data type for a selection environment.
virtual void slotShowToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Interface for all plugins which want to use selection functions.
Predefined datatypes.
Definition: DataTypes.hh:83
virtual void showClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show closest boundary selection mode in a specified selection environment.
virtual void slotVolumeLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
virtual void lassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a lasso selection.
virtual void slotGetActivePrimitiveType(PrimitiveType &_type)
virtual void showSurfaceLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show surface lasso selection mode in a specified selection environment.
virtual void slotShowLassoSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void showFloodFillSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show flood fill selection mode in a specified selection environment.
virtual ~SelectionInterface()
Destructor.
virtual void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
virtual void slotComponentsSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a connected components selection.
virtual void getActiveDataTypes(TypeList &_types)
Get the data types that the currently active selection environment supports.
virtual void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString &_handleName)
Do not use. Implemented in SelectionBasePlugin.
virtual void showToggleSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show toggle selection mode in a specified selection environment.
virtual void slotAddSelectionParameters(QString _handleName, QWidget *_widget, QString _category, PrimitiveType _type=0u)
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 slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
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 showSphereSelectionMode(QString _handleName, bool _show, PrimitiveType _associatedTypes)
Show sphere selection mode in a specified selection environment.
virtual void saveSelection(INIFile &_file)
Save selections into ini-file.
virtual void slotSurfaceLassoSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a surface lasso 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 componentsSelection(QMouseEvent *_event, PrimitiveType _currentType, bool _deselect)
Emitted by selection base plugin whenever the user performs a connected components selection...
Class for the handling of simple configuration files.
Definition: INIFile.hh:99
virtual void addPrimitiveType(QString _handleName, QString _name, QString _icon, PrimitiveType &_typeHandle)
Provide selection for primitives other than the standard ones.
virtual void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, PrimitiveType _type)