Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveSecondarySelectable.cxx
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
13#include "TEveElement.h"
14
15#include "TGLSelectRecord.h"
16
17/** \class TEveSecondarySelectable
18\ingroup TEve
19Semi-abstract interface for classes supporting secondary-selection.
20
21Element class that inherits from this, should also implement the
22following virtual methods from TEveElement:
23~~~ {.cpp}
24 virtual void UnSelected();
25 virtual void UnHighlighted();
26~~~
27and clear corresponding selection-set from there.
28
29To support tooltips for sub-elements, implement:
30~~~ {.cpp}
31 virtual TString TEveElement::GetHighlightTooltip();
32~~~
33and return tooltip for the entry in the fHighlightedSet.
34There should always be a single entry there.
35See TEveDigitSet for an example.
36*/
37
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor.
42
44 fAlwaysSecSelect(kFALSE)
45{
46}
47
48////////////////////////////////////////////////////////////////////////////////
49/// Process secondary GL selection and populate selected set accordingly.
50
52{
53 if (rec.GetHighlight())
55 else
57}
58
59////////////////////////////////////////////////////////////////////////////////
60/// Process secondary GL selection and populate given set accordingly.
61
63 SelectionSet_t& sset)
64{
65 Int_t id = (rec.GetN() > 1) ? (Int_t) rec.GetItem(1) : -1;
66
67 if (sset.empty())
68 {
69 if (id >= 0)
70 {
71 sset.insert(id);
73 }
74 }
75 else
76 {
77 if (id >= 0)
78 {
79 if (rec.GetMultiple())
80 {
81 if (sset.find(id) == sset.end())
82 {
83 sset.insert(id);
85 }
86 else
87 {
88 sset.erase(id);
89 if (sset.empty())
91 else
93 }
94 }
95 else
96 {
97 if (sset.size() != 1 || sset.find(id) == sset.end())
98 {
99 sset.clear();
100 sset.insert(id);
102 }
103 }
104 }
105 else
106 {
107 if (!rec.GetMultiple())
108 {
109 sset.clear();
111 }
112 }
113 }
114
116 {
117 dynamic_cast<TEveElement*>(this)->StampColorSelection();
118 }
119}
const Bool_t kFALSE
Definition RtypesCore.h:92
#define ClassImp(name)
Definition Rtypes.h:364
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
Semi-abstract interface for classes supporting secondary-selection.
void ProcessGLSelectionInternal(TGLSelectRecord &rec, SelectionSet_t &sset)
Process secondary GL selection and populate given set accordingly.
void ProcessGLSelection(TGLSelectRecord &rec)
Process secondary GL selection and populate selected set accordingly.
UInt_t GetItem(Int_t i) const
Standard selection record including information about containing scene and details ob out selected ob...
Bool_t GetHighlight() const
Bool_t GetMultiple() const
ESecSelResult GetSecSelResult() const
void SetSecSelResult(ESecSelResult r)