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
38
39////////////////////////////////////////////////////////////////////////////////
40/// Constructor.
41
46
47////////////////////////////////////////////////////////////////////////////////
48/// Process secondary GL selection and populate selected set accordingly.
49
57
58////////////////////////////////////////////////////////////////////////////////
59/// Process secondary GL selection and populate given set accordingly.
60
63{
64 Int_t id = (rec.GetN() > 1) ? (Int_t) rec.GetItem(1) : -1;
65
66 if (sset.empty())
67 {
68 if (id >= 0)
69 {
70 sset.insert(id);
71 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
72 }
73 }
74 else
75 {
76 if (id >= 0)
77 {
78 if (rec.GetMultiple())
79 {
80 if (sset.find(id) == sset.end())
81 {
82 sset.insert(id);
84 }
85 else
86 {
87 sset.erase(id);
88 if (sset.empty())
89 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
90 else
92 }
93 }
94 else
95 {
96 if (sset.size() != 1 || sset.find(id) == sset.end())
97 {
98 sset.clear();
99 sset.insert(id);
101 }
102 }
103 }
104 else
105 {
106 if (!rec.GetMultiple())
107 {
108 sset.clear();
109 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
110 }
111 }
112 }
113
114 if (rec.GetSecSelResult() != TGLSelectRecord::kNone)
115 {
116 dynamic_cast<TEveElement*>(this)->StampColorSelection();
117 }
118}
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
const_iterator end() const
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
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.
Standard selection record including information about containing scene and details ob out selected ob...