Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEveCompound.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
12#include "TEveCompound.h"
13
14/** \class TEveCompound
15\ingroup TEve
16Description of TEveCompound
17*/
18
19
20////////////////////////////////////////////////////////////////////////////////
21/// Constructor.
22
23TEveCompound::TEveCompound(const char* n, const char* t, Bool_t doColor, Bool_t doTransparency) :
24 TEveElementList (n, t, doColor, doTransparency),
26{
27}
28
29////////////////////////////////////////////////////////////////////////////////
30/// SetMainColor for the compound.
31/// The color is also propagated to children with compound set to this
32/// whose current color is the same as the old color.
33///
34/// The following CompoundSelectionColorBits have further influence:
35/// - kCSCBApplyMainColorToAllChildren - apply color to all children;
36/// - kCSCBApplyMainColorToMatchingChildren - apply color to children who have
37/// matching old color.
38
40{
41 Color_t old_color = GetMainColor();
42
44
47
48 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
49 {
50 if (color_all || (color_matching && (*i)->GetMainColor() == old_color) ||
51 ((*i)->GetCompound() == this && (*i)->GetMainColor() == old_color))
52 {
53 (*i)->SetMainColor(color);
54 }
55 }
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// SetMainTransparency for the compound.
60/// The transparency is also propagated to children with compound set to this
61/// whose current transparency is the same as the old transparency.
62///
63/// The following CompoundSelectionColorBits have further influence:
64/// - kCSCBApplyMainTransparencyToAllChildren - apply transparency to all children;
65/// - kCSCBApplyMainTransparencyToMatchingChildren - apply transparency to children who have
66/// matching transparency.
67
69{
71
73
76
77 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
78 {
79 if (chg_all || (chg_matching && (*i)->GetMainTransparency() == old_t) ||
80 ((*i)->GetCompound() == this && (*i)->GetMainTransparency() == old_t))
81 {
82 (*i)->SetMainTransparency(t);
83 }
84 }
85}
86
87////////////////////////////////////////////////////////////////////////////////
88/// Call base-class implementation.
89/// If compound is open and compound of the new element is not set,
90/// the el's compound is set to this.
91/// You might also want to call RecheckImpliedSelections().
92
94{
96 if (IsCompoundOpen() && el->GetCompound() == nullptr)
97 el->SetCompound(this);
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Decompoundofy el, call base-class version.
102
104{
105 if (el->GetCompound() == this)
106 el->SetCompound(nullptr);
107
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Decompoundofy children, call base-class version.
113
115{
116 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
117 {
118 if ((*i)->GetCompound() == this)
119 (*i)->SetCompound(nullptr);
120 }
121
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Recurse on all children that are in this compound and
127/// call the base-class version.
128/// If SelectionColorBit kSCBImplySelectAllChildren is set, then all
129/// children are added to the set.
130///
131/// Note that projected replicas of the compound will be added to
132/// the set in base-class function that handles projectable.
133
135{
137
138 for (List_i i = fChildren.begin(); i != fChildren.end(); ++i)
139 {
140 if (select_all || (*i)->GetCompound() == this)
141 {
142 if (impSelSet.insert(*i).second)
143 (*i)->FillImpliedSelectedSet(impSelSet);
144 }
145 }
146
148}
149
150////////////////////////////////////////////////////////////////////////////////
151/// Virtual from TEveProjectable, returns TEveCompoundProjected class.
152
157
158
159/** \class TEveCompoundProjected
160\ingroup TEve
161Description of TEveCompoundProjected
162*/
163
164
165////////////////////////////////////////////////////////////////////////////////
166/// Constructor.
167
173
174////////////////////////////////////////////////////////////////////////////////
175/// Revert back to the behaviour of TEveElement as color
176/// is propagated:
177/// 1. from projectable -> projected
178/// 2. from compound -> compound elements
179/// and we do not need to do this twice for projected-compound-elements.
180
char Char_t
Character 1 byte (char).
Definition RtypesCore.h:51
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
short Color_t
Color number (short).
Definition RtypesCore.h:99
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
void SetMainColor(Color_t color) override
Revert back to the behaviour of TEveElement as color is propagated:
TEveCompoundProjected()
Constructor.
static TClass * Class()
void FillImpliedSelectedSet(Set_t &impSelSet) override
Recurse on all children that are in this compound and call the base-class version.
Bool_t IsCompoundOpen() const
void SetMainTransparency(Char_t t) override
SetMainTransparency for the compound.
Short_t fCompoundOpen
void AddElement(TEveElement *el) override
Call base-class implementation.
TClass * ProjectedClass(const TEveProjection *p) const override
Virtual from TEveProjectable, returns TEveCompoundProjected class.
void SetMainColor(Color_t color) override
SetMainColor for the compound.
void RemoveElementLocal(TEveElement *el) override
Decompoundofy el, call base-class version.
void RemoveElementsLocal() override
Decompoundofy children, call base-class version.
TEveCompound(const TEveCompound &)
TEveElementList(const char *n="TEveElementList", const char *t="", Bool_t doColor=kFALSE, Bool_t doTransparency=kFALSE)
Constructor.
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Populate set impSelSet with derived / dependant elements.
Bool_t TestCSCBits(UChar_t f) const
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
List_t fChildren
Definition TEveElement.h:81
virtual void SetMainColor(Color_t color)
Set main color of the element.
@ kCSCBApplyMainTransparencyToAllChildren
@ kCSCBApplyMainColorToAllChildren
@ kCSCBImplySelectAllChildren
@ kCSCBApplyMainColorToMatchingChildren
@ kCSCBApplyMainTransparencyToMatchingChildren
TEveCompound * GetCompound()
std::set< TEveElement * > Set_t
Definition TEveElement.h:75
void SetCompound(TEveCompound *c)
virtual Color_t GetMainColor() const
TEveElement()
Default constructor.
virtual void RemoveElementLocal(TEveElement *el)
Perform additional local removal of el.
virtual Char_t GetMainTransparency() const
List_t::iterator List_i
Definition TEveElement.h:72
virtual void RemoveElementsLocal()
Perform additional local removal of all elements.
TEveProjected(const TEveProjected &)
Base-class for non-linear projections.
const Int_t n
Definition legend1.C:16