Logo ROOT   6.14/05
Reference Guide
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
16 Description of TEveCompound
17 */
18 
20 
21 ////////////////////////////////////////////////////////////////////////////////
22 /// Constructor.
23 
24 TEveCompound::TEveCompound(const char* n, const char* t, Bool_t doColor, Bool_t doTransparency) :
25  TEveElementList (n, t, doColor, doTransparency),
26  fCompoundOpen (0)
27 {
28 }
29 
30 ////////////////////////////////////////////////////////////////////////////////
31 /// SetMainColor for the compound.
32 /// The color is also propagated to children with compound set to this
33 /// whose current color is the same as the old color.
34 ///
35 /// The following CompoundSelectionColorBits have further influence:
36 /// - kCSCBApplyMainColorToAllChildren - apply color to all children;
37 /// - kCSCBApplyMainColorToMatchingChildren - apply color to children who have
38 /// matching old color.
39 
41 {
42  Color_t old_color = GetMainColor();
43 
45 
48 
49  for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
50  {
51  if (color_all || (color_matching && (*i)->GetMainColor() == old_color) ||
52  ((*i)->GetCompound() == this && (*i)->GetMainColor() == old_color))
53  {
54  (*i)->SetMainColor(color);
55  }
56  }
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// SetMainTransparency for the compound.
61 /// The transparency is also propagated to children with compound set to this
62 /// whose current transparency is the same as the old transparency.
63 ///
64 /// The following CompoundSelectionColorBits have further influence:
65 /// - kCSCBApplyMainTransparencyToAllChildren - apply transparency to all children;
66 /// - kCSCBApplyMainTransparencyToMatchingChildren - apply transparency to children who have
67 /// matching transparency.
68 
70 {
71  Char_t old_t = GetMainTransparency();
72 
74 
77 
78  for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
79  {
80  if (chg_all || (chg_matching && (*i)->GetMainTransparency() == old_t) ||
81  ((*i)->GetCompound() == this && (*i)->GetMainTransparency() == old_t))
82  {
83  (*i)->SetMainTransparency(t);
84  }
85  }
86 }
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Call base-class implementation.
90 /// If compound is open and compound of the new element is not set,
91 /// the el's compound is set to this.
92 /// You might also want to call RecheckImpliedSelections().
93 
95 {
97  if (IsCompoundOpen() && el->GetCompound() == 0)
98  el->SetCompound(this);
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Decompoundofy el, call base-class version.
103 
105 {
106  if (el->GetCompound() == this)
107  el->SetCompound(0);
108 
110 }
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 /// Decompoundofy children, call base-class version.
114 
116 {
117  for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
118  {
119  if ((*i)->GetCompound() == this)
120  (*i)->SetCompound(0);
121  }
122 
124 }
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 /// Recurse on all children that are in this compound and
128 /// call the base-class version.
129 /// If SelectionColorBit kSCBImplySelectAllChildren is set, then all
130 /// children are added to the set.
131 ///
132 /// Note that projected replicas of the compound will be added to
133 /// the set in base-class function that handles projectable.
134 
136 {
138 
139  for (List_i i = fChildren.begin(); i != fChildren.end(); ++i)
140  {
141  if (select_all || (*i)->GetCompound() == this)
142  {
143  if (impSelSet.insert(*i).second)
144  (*i)->FillImpliedSelectedSet(impSelSet);
145  }
146  }
147 
149 }
150 
151 ////////////////////////////////////////////////////////////////////////////////
152 /// Virtual from TEveProjectable, returns TEveCompoundProjected class.
153 
155 {
157 }
158 
159 
160 /** \class TEveCompoundProjected
161 \ingroup TEve
162 Description of TEveCompoundProjected
163 */
164 
166 
167 ////////////////////////////////////////////////////////////////////////////////
168 /// Constructor.
169 
171  TEveCompound (),
172  TEveProjected ()
173 {
174 }
175 
176 ////////////////////////////////////////////////////////////////////////////////
177 /// Revert back to the behaviour of TEveElement as color
178 /// is propagated:
179 /// 1. from projectable -> projected
180 /// 2. from compound -> compound elements
181 /// and we do not need to do this twice for projected-compound-elements.
182 
184 {
186 }
Abstract base class for classes that hold results of a non-linear projection transformation.
virtual void SetMainColor(Color_t color)
Revert back to the behaviour of TEveElement as color is propagated:
virtual Char_t GetMainTransparency() const
Definition: TEveElement.h:279
std::set< TEveElement * > Set_t
Definition: TEveElement.h:73
List_t fChildren
Definition: TEveElement.h:79
virtual void AddElement(TEveElement *el)
Call base-class implementation.
virtual void RemoveElementLocal(TEveElement *el)
Perform additional local removal of el.
List_t::iterator List_i
Definition: TEveElement.h:70
virtual void RemoveElementLocal(TEveElement *el)
Decompoundofy el, call base-class version.
bool Bool_t
Definition: RtypesCore.h:59
virtual void RemoveElementsLocal()
Perform additional local removal of all elements.
A list of TEveElements.
Definition: TEveElement.h:459
Bool_t TestCSCBits(UChar_t f) const
Definition: TEveElement.h:364
Description of TEveCompound.
Definition: TEveCompound.h:23
void Class()
Definition: Class.C:29
Description of TEveCompoundProjected.
Definition: TEveCompound.h:60
TEveCompoundProjected()
Constructor.
virtual TClass * ProjectedClass(const TEveProjection *p) const
Virtual from TEveProjectable, returns TEveCompoundProjected class.
void SetCompound(TEveCompound *c)
Definition: TEveElement.h:147
Base-class for non-linear projections.
short Color_t
Definition: RtypesCore.h:79
Bool_t IsCompoundOpen() const
Definition: TEveCompound.h:39
virtual void SetMainColor(Color_t color)
SetMainColor for the compound.
virtual Color_t GetMainColor() const
Definition: TEveElement.h:270
virtual void RemoveElementsLocal()
Decompoundofy children, call base-class version.
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Populate set impSelSet with derived / dependant elements.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
#define ClassImp(name)
Definition: Rtypes.h:359
char Char_t
Definition: RtypesCore.h:29
TEveCompound(const TEveCompound &)
virtual void SetMainTransparency(Char_t t)
SetMainTransparency for the compound.
TEveCompound * GetCompound()
Definition: TEveElement.h:146
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
const Int_t n
Definition: legend1.C:16
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Recurse on all children that are in this compound and call the base-class version.