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
20
21////////////////////////////////////////////////////////////////////////////////
22/// Constructor.
23
24TEveCompound::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{
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{
156 return TEveCompoundProjected::Class();
157}
158
159
160/** \class TEveCompoundProjected
161\ingroup TEve
162Description of TEveCompoundProjected
163*/
164
166
167////////////////////////////////////////////////////////////////////////////////
168/// Constructor.
169
171 TEveCompound (),
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}
char Char_t
Definition RtypesCore.h:37
short Color_t
Definition RtypesCore.h:92
#define ClassImp(name)
Definition Rtypes.h:364
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
Description of TEveCompoundProjected.
TEveCompoundProjected()
Constructor.
virtual void SetMainColor(Color_t color)
Revert back to the behaviour of TEveElement as color is propagated:
Description of TEveCompound.
virtual void RemoveElementLocal(TEveElement *el)
Decompoundofy el, call base-class version.
virtual void RemoveElementsLocal()
Decompoundofy children, call base-class version.
Bool_t IsCompoundOpen() const
virtual TClass * ProjectedClass(const TEveProjection *p) const
Virtual from TEveProjectable, returns TEveCompoundProjected class.
virtual void SetMainTransparency(Char_t t)
SetMainTransparency for the compound.
virtual void FillImpliedSelectedSet(Set_t &impSelSet)
Recurse on all children that are in this compound and call the base-class version.
virtual void SetMainColor(Color_t color)
SetMainColor for the compound.
TEveCompound(const TEveCompound &)
virtual void AddElement(TEveElement *el)
Call base-class implementation.
A list of TEveElements.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
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
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.
Abstract base class for classes that hold results of a non-linear projection transformation.
Base-class for non-linear projections.
const Int_t n
Definition legend1.C:16