Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
21 class TEveSelection : public TEveElementList,
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 
43  Int_t fPickToSelect;
44  Bool_t fActive;
45  Bool_t fIsMaster;
46 
47  SelMap_t fImpliedSelected;
48 
49  Select_foo fSelElement;
50  ImplySelect_foo fIncImpSelElement;
51  ImplySelect_foo fDecImpSelElement;
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 
80  void RecheckImpliedSetForElement(TEveElement* el);
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 
96  TEveElement* MapPickedToSelected(TEveElement* el);
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