ATLAS Offline Software
AscObjSelectionManager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class AscObjSelectionManager //
9 // //
10 // Description: Manages selection of associated objects //
11 // //
12 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
13 // Initial version: April 2008 //
14 // //
16 
17 #ifndef ASCOBJSELECTIONMANAGER_H
18 #define ASCOBJSELECTIONMANAGER_H
19 
20 //Fixme: Make this class usable by prd system also. Maybe make common
21 //handle base class which tells simple/detailed nodes?
22 
24 #include <QObject>
25 #include <QList>
26 
28 class IVP13DSystem;
31 class SoSeparator;
32 class SoNode;
33 class SoPath;
34 
35 //Lifetime of this object should be from system refresh to system erase.
36 
37 class AscObjSelectionManager : public QObject, public VP1HelperClassBase {
38 
39  Q_OBJECT
40 
41 public:
42  //Will create selection nodes as appropriate under the event root.
44  void aboutTodelete();//Call this just before deletion (needed since signals should not be emitted from destructors).
45  virtual ~AscObjSelectionManager();
46  //Associated objects must all be attached under this separator:
47  SoSeparator * getAscObjAttachSep() const;
48 
50  //Fixme: add method for changing mode of operation (single, toggle, shift+click)
51 
52  enum MODE { SINGLE, TOGGLE, SHIFT };
53  static QString toString(MODE) ;
54  MODE mode() const;
55  void setMode(MODE);
56 
58 
59  void ensureDeselected(const QList<AssociatedObjectHandleBase*>&);
60  void ensureSelected(const QList<AssociatedObjectHandleBase*>&);//Call with length==1 if in single mode.
61  void deselectAll();
62 
63  QList<AssociatedObjectHandleBase*> currentSelection() const;
64 
65  SoSeparator* eventRoot();
66 
67 signals:
68  void currentSelectionChanged(const QList<AssociatedObjectHandleBase*>&);
69 
70 private:
71  //For system:
72  friend class VP1TrackSystem;
73 // void setEventData( SoCooperativeSelection * sel_click, SoCooperativeSelection * sel_highlight );
74 // void eraseEventData();
75  //The following returns true if the passed selection node belongs to
76  //this manager (if not, the system must handle the selection in
77  //another way).
79  void userClickedOnBgd();
80 
81 // bool handleUserDeselectedSingleNode(SoCooperativeSelection*, SoNode* , SoPath*);//SINGLE
82 // bool handleUserChangedSelection(SoCooperativeSelection*, QSet<SoNode*>, QSet<SoPath*>);//TOGGLE/SHIFT
83 private:
84  //For associated objects:
86  void registerAscObj(SoSeparator*simple,SoSeparator *detailed,AssociatedObjectHandleBase*);
87  void unregisterAscObj(SoSeparator*simple,SoSeparator *detailed);
88  //Fixme: When a handle changes pickable state to unpickable it
89  //must be removed from selection list if selected!
90 private Q_SLOTS:
91 // void ascObjDetailLevelAboutToChange();
93 private:
94  class Imp;
95  Imp * m_d;
96 };
97 
98 #endif
AscObjSelectionManager::registerAscObj
void registerAscObj(SoSeparator *simple, SoSeparator *detailed, AssociatedObjectHandleBase *)
Definition: AscObjSelectionManager.cxx:140
AssociatedObjectHandleBase
Definition: AssociatedObjectHandleBase.h:33
AscObjSelectionManager::deselectAll
void deselectAll()
Definition: AscObjSelectionManager.cxx:326
AscObjSelectionManager::handleUserSelectedSingleNode
bool handleUserSelectedSingleNode(SoCooperativeSelection *, SoNode *, SoPath *, AssociatedObjectHandleBase *&)
Definition: AscObjSelectionManager.cxx:233
AscObjSelectionManager::Imp
Definition: AscObjSelectionManager.cxx:28
AscObjSelectionManager::aboutTodelete
void aboutTodelete()
Definition: AscObjSelectionManager.cxx:97
AscObjSelectionManager::currentSelection
QList< AssociatedObjectHandleBase * > currentSelection() const
Definition: AscObjSelectionManager.cxx:408
AscObjSelectionManager::toString
static QString toString(MODE)
Definition: AscObjSelectionManager.cxx:110
AscObjSelectionManager::getAscObjAttachSep
SoSeparator * getAscObjAttachSep() const
Definition: AscObjSelectionManager.cxx:135
AscObjSelectionManager::TOGGLE
@ TOGGLE
Definition: AscObjSelectionManager.h:52
AscObjSelectionManager::SINGLE
@ SINGLE
Definition: AscObjSelectionManager.h:52
AscObjSelectionManager::mode
MODE mode() const
Definition: AscObjSelectionManager.cxx:119
AscObjSelectionManager::ensureSelected
void ensureSelected(const QList< AssociatedObjectHandleBase * > &)
Definition: AscObjSelectionManager.cxx:350
AscObjSelectionManager::m_d
Imp * m_d
Definition: AscObjSelectionManager.h:94
AscObjSelectionManager::~AscObjSelectionManager
virtual ~AscObjSelectionManager()
Definition: AscObjSelectionManager.cxx:103
AscObjSelectionManager::pretendUserClicked
void pretendUserClicked(AssociatedObjectHandleBase *)
Definition: AscObjSelectionManager.cxx:259
AscObjSelectionManager::ascObjDetailLevelChanged
void ascObjDetailLevelChanged()
Definition: AscObjSelectionManager.cxx:381
VP1TrackSystem
Definition: VP1TrackSystem.h:36
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
AscObjSelectionManager::MODE
MODE
Definition: AscObjSelectionManager.h:52
AscObjSelectionManager::userClickedOnBgd
void userClickedOnBgd()
Definition: AscObjSelectionManager.cxx:316
TrackSystemController
Definition: TrackSystemController.h:53
AscObjSelectionManager::unregisterAscObj
void unregisterAscObj(SoSeparator *simple, SoSeparator *detailed)
Definition: AscObjSelectionManager.cxx:164
AscObjSelectionManager
Definition: AscObjSelectionManager.h:37
VP1HelperClassBase.h
AscObjSelectionManager::setMode
void setMode(MODE)
Definition: AscObjSelectionManager.cxx:125
AscObjSelectionManager::SHIFT
@ SHIFT
Definition: AscObjSelectionManager.h:52
IVP13DSystem
Definition: IVP13DSystem.h:31
AscObjSelectionManager::AscObjSelectionManager
AscObjSelectionManager(SoSeparator *eventRoot, IVP13DSystem *, TrackSystemController *)
Definition: AscObjSelectionManager.cxx:89
AscObjSelectionManager::ensureDeselected
void ensureDeselected(const QList< AssociatedObjectHandleBase * > &)
Definition: AscObjSelectionManager.cxx:336
AscObjSelectionManager::currentSelectionChanged
void currentSelectionChanged(const QList< AssociatedObjectHandleBase * > &)
SoCooperativeSelection
Definition: SoCooperativeSelection.h:29
AscObjSelectionManager::eventRoot
SoSeparator * eventRoot()
Definition: AscObjSelectionManager.cxx:413