Logo ROOT   6.14/05
Reference Guide
TEveSelection.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TEveSelection
13 #define ROOT_TEveSelection
14 
15 #include "TEveElement.h"
16 
17 #include "TQObject.h"
18 
19 #include <map>
20 
22  public TQObject
23 {
24 public:
25  enum EPickToSelect // How to convert picking events to top selected element:
26  {
27  kPS_Ignore, // ignore picking
28  kPS_Element, // select element (default for selection)
29  kPS_Projectable, // select projectable
30  kPS_Compound, // select compound
31  kPS_PableCompound, // select projectable and compound
32  kPS_Master // select master element (top-level compound)
33  };
34 
35 private:
36  TEveSelection(const TEveSelection&); // Not implemented
37  TEveSelection& operator=(const TEveSelection&); // Not implemented
38 
39 protected:
40  typedef std::map<TEveElement*, Set_t> SelMap_t;
41  typedef std::map<TEveElement*, Set_t>::iterator SelMap_i;
42 
46 
47  SelMap_t fImpliedSelected;
48 
52 
53  void DoElementSelect (SelMap_i entry);
54  void DoElementUnselect(SelMap_i entry);
55 
56  void RecheckImpliedSet(SelMap_i smi);
57 
58 public:
59  TEveSelection(const char* n="TEveSelection", const char* t="");
60  virtual ~TEveSelection() {}
61 
62  void SetHighlightMode();
63 
64  Int_t GetPickToSelect() const { return fPickToSelect; }
65  void SetPickToSelect(Int_t ps) { fPickToSelect = ps; }
66 
67  Bool_t GetIsMaster() const { return fIsMaster; }
68  void SetIsMaster(Bool_t m) { fIsMaster = m; }
69 
70  virtual Bool_t AcceptElement(TEveElement* el);
71 
72  virtual void AddElement(TEveElement* el);
73  virtual void RemoveElement(TEveElement* el);
74  virtual void RemoveElementLocal(TEveElement* el);
75  virtual void RemoveElements();
76  virtual void RemoveElementsLocal();
77 
78  virtual void RemoveImpliedSelected(TEveElement* el);
79 
81 
82  void SelectionAdded(TEveElement* el); // *SIGNAL*
83  void SelectionRemoved(TEveElement* el); // *SIGNAL*
84  void SelectionCleared(); // *SIGNAL*
85  void SelectionRepeated(TEveElement* el); // *SIGNAL*
86 
87  // ----------------------------------------------------------------
88  // Interface to make selection active/non-active.
89 
90  virtual void ActivateSelection();
91  virtual void DeactivateSelection();
92 
93  // ----------------------------------------------------------------
94  // User input processing.
95 
97 
98  virtual void UserPickedElement(TEveElement* el, Bool_t multi=kFALSE);
99  virtual void UserRePickedElement(TEveElement* el);
100  virtual void UserUnPickedElement(TEveElement* el);
101 
102  // ----------------------------------------------------------------
103 
104  ClassDef(TEveSelection, 0); // Container for selected and highlighted elements.
105 };
106 
107 #endif
TEveSelection & operator=(const TEveSelection &)
SelMap_t fImpliedSelected
Definition: TEveSelection.h:47
auto * m
Definition: textangle.C:8
virtual void UserUnPickedElement(TEveElement *el)
Called when secondary selection becomes empty.
virtual ~TEveSelection()
Definition: TEveSelection.h:60
virtual void UserPickedElement(TEveElement *el, Bool_t multi=kFALSE)
Called when user picks/clicks on an element.
std::map< TEveElement *, Set_t >::iterator SelMap_i
Definition: TEveSelection.h:41
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:49
static constexpr double ps
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t GetPickToSelect() const
Definition: TEveSelection.h:64
virtual Bool_t AcceptElement(TEveElement *el)
Pre-addition check.
void RecheckImpliedSet(SelMap_i smi)
Recalculate implied-selected state for given selection entry.
void SetIsMaster(Bool_t m)
Definition: TEveSelection.h:68
void SetPickToSelect(Int_t ps)
Definition: TEveSelection.h:65
A list of TEveElements.
Definition: TEveElement.h:459
virtual void AddElement(TEveElement *el)
Add an element into selection, virtual from TEveElement.
#define ClassDef(name, id)
Definition: Rtypes.h:320
Bool_t GetIsMaster() const
Definition: TEveSelection.h:67
void DoElementUnselect(SelMap_i entry)
Deselect element indicated by the entry and clear its implied-selected set.
void SelectionCleared()
Emit SelectionCleared signal.
ImplySelect_foo fIncImpSelElement
Definition: TEveSelection.h:50
virtual void RemoveElement(TEveElement *el)
Add an element into selection, virtual from TEveElement.
virtual void ActivateSelection()
Activate this selection.
virtual void UserRePickedElement(TEveElement *el)
Called when secondary selection becomes empty.
void(TEveElement::* ImplySelect_foo)()
Definition: TEveElement.h:337
virtual void DeactivateSelection()
Deactivate this selection.
void SelectionRepeated(TEveElement *el)
Called when secondary selection changed internally.
void SetHighlightMode()
Set to &#39;highlight&#39; mode.
Make sure there is a SINGLE running TEveSelection for each selection type (select/highlight).
Definition: TEveSelection.h:21
virtual void RemoveElementLocal(TEveElement *el)
Virtual from TEveElement.
TEveElement * MapPickedToSelected(TEveElement *el)
Given element el that was picked or clicked by the user, find the parent/ancestor element that should...
std::map< TEveElement *, Set_t > SelMap_t
Definition: TEveSelection.h:40
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual void RemoveImpliedSelected(TEveElement *el)
Remove element from all implied-selected sets.
Bool_t fIsMaster
Definition: TEveSelection.h:45
void SelectionAdded(TEveElement *el)
Emit SelectionAdded signal.
Int_t fPickToSelect
Definition: TEveSelection.h:43
virtual void RemoveElementsLocal()
Virtual from TEveElement.
void SelectionRemoved(TEveElement *el)
Emit SelectionRemoved signal.
virtual void RemoveElements()
Add an element into selection, virtual from TEveElement.
void DoElementSelect(SelMap_i entry)
Select element indicated by the entry and fill its implied-selected set.
void RecheckImpliedSetForElement(TEveElement *el)
If given element is selected or implied-selected with this selection and recheck implied-set for give...
void(TEveElement::* Select_foo)(Bool_t)
Definition: TEveElement.h:336
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
Select_foo fSelElement
Definition: TEveSelection.h:49
const Int_t n
Definition: legend1.C:16
ImplySelect_foo fDecImpSelElement
Definition: TEveSelection.h:51
TEveSelection(const TEveSelection &)