Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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/** \class TEveGeoNodeEditor
19\ingroup TEve
20Editor for TEveGeoNode class.
21*/
22
23
24////////////////////////////////////////////////////////////////////////////////
25/// Constructor.
26
28 Int_t width, Int_t height,
29 UInt_t options, Pixel_t back) :
30 TGedFrame(p,width, height, options | kVerticalFrame, back),
31
32 fNodeRE (nullptr),
33
34 fVizNode(nullptr),
35 fVizNodeDaughters(nullptr),
36 fVizVolume(nullptr),
37 fVizVolumeDaughters(nullptr)
38{
39 MakeTitle("GeoNode");
40
41 // --- Visibility control
42
43 fVizNode = new TGCheckButton(this, "VizNode");
44 AddFrame(fVizNode, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
45 fVizNode->Connect
46 ("Toggled(Bool_t)",
47 "TEveGeoNodeEditor", this, "DoVizNode()");
48
49 fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
51 fVizNodeDaughters->Connect
52 ("Toggled(Bool_t)",
53 "TEveGeoNodeEditor", this, "DoVizNodeDaughters()");
54
55 fVizVolume = new TGCheckButton(this, "VizVolume");
57 fVizVolume->Connect
58 ("Toggled(Bool_t)",
59 "TEveGeoNodeEditor", this, "DoVizVolume()");
60
61 fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
63 fVizVolumeDaughters->Connect
64 ("Toggled(Bool_t)",
65 "TEveGeoNodeEditor", this, "DoVizVolumeDaughters()");
66}
67
68////////////////////////////////////////////////////////////////////////////////
69/// Set model object.
70
72{
73 fNodeRE = dynamic_cast<TEveGeoNode*>(obj);
74 TGeoNode* node = fNodeRE->fNode;
75 TGeoVolume* vol = node->GetVolume();
76
77 fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp);
78 fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp);
79 fVizVolume->SetState(vol->IsVisible() ? kButtonDown : kButtonUp);
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// Slot for VizNode.
85
87{
88 fNodeRE->SetRnrSelf(fVizNode->IsOn());
89 Update();
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Slot for VizNodeDaughters.
94
96{
97 fNodeRE->SetRnrChildren(fVizNodeDaughters->IsOn());
98 Update();
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Slot for VizVolume.
103
105{
106 fNodeRE->fNode->GetVolume()->SetVisibility(fVizVolume->IsOn());
107 Update();
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// Slot for VizVolumeDaughters.
112
114{
115 fNodeRE->fNode->GetVolume()->VisibleDaughters(fVizVolumeDaughters->IsOn());
116 Update();
117}
118
119/** \class TEveGeoTopNodeEditor
120\ingroup TEve
121Editor for TEveGeoTopNode class.
122*/
123
124
125////////////////////////////////////////////////////////////////////////////////
126/// Constructor.
127
129 Int_t width, Int_t height,
130 UInt_t options, Pixel_t back) :
131 TGedFrame(p, width, height, options | kVerticalFrame, back),
132
133 fTopNodeRE (nullptr),
134 fVisOption (nullptr),
135 fVisLevel (nullptr),
136 fMaxVisNodes (nullptr)
137{
138 MakeTitle("GeoTopNode");
139
140 Int_t labelW = 64;
141
142 fVisOption = new TEveGValuator(this, "VisOption:", 90, 0);
143 fVisOption->SetLabelWidth(labelW);
144 fVisOption->SetShowSlider(kFALSE);
145 fVisOption->SetNELength(4);
146 fVisOption->Build();
147 fVisOption->SetLimits(0, 2, 10, TGNumberFormat::kNESInteger);
148 fVisOption->SetToolTip("Visualization option passed to TGeoPainter.");
149 fVisOption->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisOption()");
150 AddFrame(fVisOption, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
151
152 fVisLevel = new TEveGValuator(this, "VisLevel:", 90, 0);
153 fVisLevel->SetLabelWidth(labelW);
154 fVisLevel->SetShowSlider(kFALSE);
155 fVisLevel->SetNELength(4);
156 fVisLevel->Build();
157 fVisLevel->SetLimits(0, 30, 31, TGNumberFormat::kNESInteger);
158 fVisLevel->SetToolTip("Level (depth) to which the geometry is traversed.\nWhen zero, maximum number of nodes to draw can be specified.");
159 fVisLevel->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisLevel()");
160 AddFrame(fVisLevel, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
161
162 fMaxVisNodes = new TEveGValuator(this, "MaxNodes:", 90, 0);
163 fMaxVisNodes->SetLabelWidth(labelW);
164 fMaxVisNodes->SetShowSlider(kFALSE);
165 fMaxVisNodes->SetNELength(6);
166 fMaxVisNodes->Build();
167 fMaxVisNodes->SetLimits(100, 999999, 0, TGNumberFormat::kNESInteger);
168 fMaxVisNodes->SetToolTip("Maximum number of nodes to draw.");
169 fMaxVisNodes->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoMaxVisNodes()");
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Set model object.
175
177{
178 fTopNodeRE = dynamic_cast<TEveGeoTopNode*>(obj);
179
180 fVisOption ->SetValue(fTopNodeRE->GetVisOption());
181 fVisLevel ->SetValue(fTopNodeRE->GetVisLevel());
182 fMaxVisNodes->SetValue(fTopNodeRE->GetMaxVisNodes());
183 if (fTopNodeRE->GetVisLevel() > 0)
184 fMaxVisNodes->UnmapWindow();
185 else
186 fMaxVisNodes->MapWindow();
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Slot for VisOption.
191
193{
194 fTopNodeRE->SetVisOption(Int_t(fVisOption->GetValue()));
195 Update();
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Slot for VisLevel.
200
202{
203 fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetValue()));
204 Update();
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Slot for MaxVisNodes.
209
211{
212 fTopNodeRE->SetMaxVisNodes(Int_t(fMaxVisNodes->GetValue()));
213 Update();
214}
@ kVerticalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsTop
Definition TGLayout.h:27
Composite GUI element for single value selection (supports label, number-entry and slider).
void DoVizNodeDaughters()
Slot for VizNodeDaughters.
TGCheckButton * fVizNode
void SetModel(TObject *obj) override
Set model object.
void DoVizVolume()
Slot for VizVolume.
TGCheckButton * fVizVolumeDaughters
TEveGeoNodeEditor(const TEveGeoNodeEditor &)
void DoVizNode()
Slot for VizNode.
TGCheckButton * fVizVolume
TEveGeoNode * fNodeRE
void DoVizVolumeDaughters()
Slot for VizVolumeDaughters.
TGCheckButton * fVizNodeDaughters
Wrapper for TGeoNode that allows it to be shown in GUI and controlled as a TEveElement.
Definition TEveGeoNode.h:30
TEveGValuator * fMaxVisNodes
TEveGeoTopNode * fTopNodeRE
void DoVisLevel()
Slot for VisLevel.
TEveGValuator * fVisLevel
void DoVisOption()
Slot for VisOption.
TEveGeoTopNodeEditor(const TEveGeoTopNodeEditor &)
void SetModel(TObject *obj) override
Set model object.
void DoMaxVisNodes()
Slot for MaxVisNodes.
TEveGValuator * fVisOption
A wrapper over a TGeoNode, possibly displaced with a global trasformation stored in TEveElement.
Definition TEveGeoNode.h:90
Selects different options.
Definition TGButton.h:264
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
@ kNESInteger
Style of number entry field.
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedFrame(const TGedFrame &)=delete
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Bool_t IsVisDaughters() const
Definition TGeoAtt.h:84
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
TGeoVolume * GetVolume() const
Definition TGeoNode.h:100
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
virtual Bool_t IsVisible() const
Definition TGeoVolume.h:156
Mother of all ROOT objects.
Definition TObject.h:42