Logo ROOT   6.12/07
Reference Guide
TEveGeoNodeEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 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 "TEveGeoNodeEditor.h"
13 #include "TEveGValuators.h"
14 
15 #include "TEveGeoNode.h"
16 #include "TGeoNode.h"
17 
18 #include "TVirtualPad.h"
19 #include "TColor.h"
20 
21 #include "TGLabel.h"
22 #include "TGButton.h"
23 #include "TGNumberEntry.h"
24 #include "TGColorSelect.h"
25 #include "TGDoubleSlider.h"
26 
27 /** \class TEveGeoNodeEditor
28 \ingroup TEve
29 Editor for TEveGeoNode class.
30 */
31 
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Constructor.
36 
38  Int_t width, Int_t height,
39  UInt_t options, Pixel_t back) :
40  TGedFrame(p,width, height, options | kVerticalFrame, back),
41 
42  fNodeRE (0),
43 
44  fVizNode(0),
45  fVizNodeDaughters(0),
46  fVizVolume(0),
47  fVizVolumeDaughters(0)
48 {
49  MakeTitle("GeoNode");
50 
51  // --- Visibility control
52 
53  fVizNode = new TGCheckButton(this, "VizNode");
54  AddFrame(fVizNode, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
56  ("Toggled(Bool_t)",
57  "TEveGeoNodeEditor", this, "DoVizNode()");
58 
59  fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
62  ("Toggled(Bool_t)",
63  "TEveGeoNodeEditor", this, "DoVizNodeDaughters()");
64 
65  fVizVolume = new TGCheckButton(this, "VizVolume");
66  AddFrame(fVizVolume, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
68  ("Toggled(Bool_t)",
69  "TEveGeoNodeEditor", this, "DoVizVolume()");
70 
71  fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
74  ("Toggled(Bool_t)",
75  "TEveGeoNodeEditor", this, "DoVizVolumeDaughters()");
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Set model object.
80 
82 {
83  fNodeRE = dynamic_cast<TEveGeoNode*>(obj);
84  TGeoNode* node = fNodeRE->fNode;
85  TGeoVolume* vol = node->GetVolume();
86 
87  fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp);
88  fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp);
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Slot for VizNode.
95 
97 {
99  Update();
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// Slot for VizNodeDaughters.
104 
106 {
108  Update();
109 }
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Slot for VizVolume.
113 
115 {
117  Update();
118 }
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 /// Slot for VizVolumeDaughters.
122 
124 {
126  Update();
127 }
128 
129 /** \class TEveGeoTopNodeEditor
130 \ingroup TEve
131 Editor for TEveGeoTopNode class.
132 */
133 
135 
136 ////////////////////////////////////////////////////////////////////////////////
137 /// Constructor.
138 
140  Int_t width, Int_t height,
141  UInt_t options, Pixel_t back) :
142  TGedFrame(p, width, height, options | kVerticalFrame, back),
143 
144  fTopNodeRE (0),
145  fVisOption (0),
146  fVisLevel (0),
147  fMaxVisNodes (0)
148 {
149  MakeTitle("GeoTopNode");
150 
151  Int_t labelW = 64;
152 
153  fVisOption = new TEveGValuator(this, "VisOption:", 90, 0);
154  fVisOption->SetLabelWidth(labelW);
157  fVisOption->Build();
159  fVisOption->SetToolTip("Visualization option passed to TGeoPainter.");
160  fVisOption->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisOption()");
161  AddFrame(fVisOption, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
162 
163  fVisLevel = new TEveGValuator(this, "VisLevel:", 90, 0);
164  fVisLevel->SetLabelWidth(labelW);
167  fVisLevel->Build();
169  fVisLevel->SetToolTip("Level (depth) to which the geometry is traversed.\nWhen zero, maximum number of nodes to draw can be specified.");
170  fVisLevel->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisLevel()");
171  AddFrame(fVisLevel, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
172 
173  fMaxVisNodes = new TEveGValuator(this, "MaxNodes:", 90, 0);
174  fMaxVisNodes->SetLabelWidth(labelW);
177  fMaxVisNodes->Build();
179  fMaxVisNodes->SetToolTip("Maximum number of nodes to draw.");
180  fMaxVisNodes->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoMaxVisNodes()");
181  AddFrame(fMaxVisNodes, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
182 }
183 
184 ////////////////////////////////////////////////////////////////////////////////
185 /// Set model object.
186 
188 {
189  fTopNodeRE = dynamic_cast<TEveGeoTopNode*>(obj);
190 
194  if (fTopNodeRE->GetVisLevel() > 0)
196  else
198 }
199 
200 ////////////////////////////////////////////////////////////////////////////////
201 /// Slot for VisOption.
202 
204 {
206  Update();
207 }
208 
209 ////////////////////////////////////////////////////////////////////////////////
210 /// Slot for VisLevel.
211 
213 {
215  Update();
216 }
217 
218 ////////////////////////////////////////////////////////////////////////////////
219 /// Slot for MaxVisNodes.
220 
222 {
224  Update();
225 }
virtual void SetModel(TObject *obj)
Set model object.
void DoMaxVisNodes()
Slot for MaxVisNodes.
TGCheckButton * fVizNodeDaughters
Int_t GetMaxVisNodes() const
Definition: TEveGeoNode.h:116
void DoVisLevel()
Slot for VisLevel.
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
TEveGeoTopNode * fTopNodeRE
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
void DoVisOption()
Slot for VisOption.
Int_t GetVisOption() const
Definition: TEveGeoNode.h:112
int Int_t
Definition: RtypesCore.h:41
void VisibleDaughters(Bool_t vis=kTRUE)
set visibility for daughters
TGCheckButton * fVizNode
Wrapper for TGeoNode that allows it to be shown in GUI and controlled as a TEveElement.
Definition: TEveGeoNode.h:31
void SetToolTip(const char *tip)
Set the tooltip of the number-entry.
void DoVizVolumeDaughters()
Slot for VizVolumeDaughters.
Composite GUI element for single value selection (supports label, number-entry and slider)...
ULong_t Pixel_t
Definition: GuiTypes.h:39
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
virtual Bool_t IsVisible() const
Definition: TGeoVolume.h:156
virtual Bool_t IsOn() const
Definition: TGButton.h:311
TEveGeoNodeEditor(const TEveGeoNodeEditor &)
void DoVizNode()
Slot for VizNode.
TEveGValuator * fVisOption
A wrapper over a TGeoNode, possibly displaced with a global trasformation stored in TEveElement...
Definition: TEveGeoNode.h:92
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
TEveGeoTopNodeEditor(const TEveGeoTopNodeEditor &)
void SetShowSlider(Bool_t s=kTRUE)
void SetNELength(Int_t l)
TEveGValuator * fMaxVisNodes
unsigned int UInt_t
Definition: RtypesCore.h:42
Int_t GetVisLevel() const
Definition: TEveGeoNode.h:114
TGCheckButton * fVizVolume
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
const Bool_t kFALSE
Definition: RtypesCore.h:88
void SetVisLevel(Int_t vl)
Definition: TEveGeoNode.h:115
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void SetVisibility(Bool_t vis=kTRUE)
set visibility of this volume
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element&#39;s children, i.e.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
TGeoNode * fNode
Definition: TEveGeoNode.h:40
void SetVisOption(Int_t vo)
Definition: TEveGeoNode.h:113
void SetMaxVisNodes(Int_t mvn)
Definition: TEveGeoNode.h:117
Mother of all ROOT objects.
Definition: TObject.h:37
void DoVizNodeDaughters()
Slot for VizNodeDaughters.
Editor for TEveGeoNode class.
virtual void UnmapWindow()
Definition: TGFrame.h:253
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:39
Bool_t IsVisDaughters() const
Definition: TGeoAtt.h:89
void DoVizVolume()
Slot for VizVolume.
virtual void MapWindow()
Definition: TGFrame.h:251
void SetLabelWidth(Int_t w)
TGCheckButton * fVizVolumeDaughters
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
void SetLimits(Int_t min, Int_t max)
Set limits of the represented value for integer values.
TEveGeoNode * fNodeRE
TEveGValuator * fVisLevel
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Editor for TEveGeoTopNode class.
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:94
Float_t GetValue() const
virtual void SetModel(TObject *obj)
Set model object.