Logo ROOT   6.08/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));
55  fVizNode->Connect
56  ("Toggled(Bool_t)",
57  "TEveGeoNodeEditor", this, "DoVizNode()");
58 
59  fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
60  AddFrame(fVizNodeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
61  fVizNodeDaughters->Connect
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));
67  fVizVolume->Connect
68  ("Toggled(Bool_t)",
69  "TEveGeoNodeEditor", this, "DoVizVolume()");
70 
71  fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
72  AddFrame(fVizVolumeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
73  fVizVolumeDaughters->Connect
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);
155  fVisOption->SetShowSlider(kFALSE);
156  fVisOption->SetNELength(4);
157  fVisOption->Build();
158  fVisOption->SetLimits(0, 2, 10, TGNumberFormat::kNESInteger);
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);
165  fVisLevel->SetShowSlider(kFALSE);
166  fVisLevel->SetNELength(4);
167  fVisLevel->Build();
168  fVisLevel->SetLimits(0, 30, 31, TGNumberFormat::kNESInteger);
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);
175  fMaxVisNodes->SetShowSlider(kFALSE);
176  fMaxVisNodes->SetNELength(6);
177  fMaxVisNodes->Build();
178  fMaxVisNodes->SetLimits(100, 999999, 0, TGNumberFormat::kNESInteger);
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 
191  fVisOption ->SetValue(fTopNodeRE->GetVisOption());
192  fVisLevel ->SetValue(fTopNodeRE->GetVisLevel());
193  fMaxVisNodes->SetValue(fTopNodeRE->GetMaxVisNodes());
194  if (fTopNodeRE->GetVisLevel() > 0)
195  fMaxVisNodes->UnmapWindow();
196  else
197  fMaxVisNodes->MapWindow();
198 }
199 
200 ////////////////////////////////////////////////////////////////////////////////
201 /// Slot for VisOption.
202 
204 {
205  fTopNodeRE->SetVisOption(Int_t(fVisOption->GetValue()));
206  Update();
207 }
208 
209 ////////////////////////////////////////////////////////////////////////////////
210 /// Slot for VisLevel.
211 
213 {
214  fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetValue()));
215  Update();
216 }
217 
218 ////////////////////////////////////////////////////////////////////////////////
219 /// Slot for MaxVisNodes.
220 
222 {
223  fTopNodeRE->SetMaxVisNodes(Int_t(fMaxVisNodes->GetValue()));
224  Update();
225 }
virtual void SetModel(TObject *obj)
Set model object.
void DoMaxVisNodes()
Slot for MaxVisNodes.
TGCheckButton * fVizNodeDaughters
void DoVisLevel()
Slot for VisLevel.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:61
void DoVisOption()
Slot for VisOption.
int Int_t
Definition: RtypesCore.h:41
void VisibleDaughters(Bool_t vis=kTRUE)
set visibility for daughters
const Bool_t kFALSE
Definition: Rtypes.h:92
TGCheckButton * fVizNode
Wrapper for TGeoNode that allows it to be shown in GUI and controlled as a TEveElement.
Definition: TEveGeoNode.h:31
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:41
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:169
virtual Bool_t IsOn() const
Definition: TGButton.h:315
void DoVizNode()
Slot for VizNode.
A wrapper over a TGeoNode, possibly displaced with a global trasformation stored in TEveElement...
Definition: TEveGeoNode.h:92
unsigned int UInt_t
Definition: RtypesCore.h:42
TGCheckButton * fVizVolume
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
#define ClassImp(name)
Definition: Rtypes.h:279
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
std::string MakeTitle(std::string_view version, std::string_view histname, std::string_view title, std::string_view axis)
Definition: speedtest.cxx:115
TGeoNode * fNode
Definition: TEveGeoNode.h:40
Mother of all ROOT objects.
Definition: TObject.h:37
void DoVizNodeDaughters()
Slot for VizNodeDaughters.
Editor for TEveGeoNode class.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:51
Bool_t IsVisDaughters() const
Definition: TGeoAtt.h:91
void DoVizVolume()
Slot for VizVolume.
TGCheckButton * fVizVolumeDaughters
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
TEveGeoNode * fNodeRE
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Editor for TEveGeoTopNode class.
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:106
virtual void SetModel(TObject *obj)
Set model object.