forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEveGeoNodeEditor.cxx
225 lines (180 loc) · 7.17 KB
/
TEveGeoNodeEditor.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include "TEveGeoNodeEditor.h"
#include "TEveGValuators.h"
#include "TEveGeoNode.h"
#include "TGeoNode.h"
#include "TVirtualPad.h"
#include "TColor.h"
#include "TGLabel.h"
#include "TGButton.h"
#include "TGNumberEntry.h"
#include "TGColorSelect.h"
#include "TGDoubleSlider.h"
/** \class TEveGeoNodeEditor
\ingroup TEve
Editor for TEveGeoNode class.
*/
ClassImp(TEveGeoNodeEditor)
////////////////////////////////////////////////////////////////////////////////
/// Constructor.
TEveGeoNodeEditor::TEveGeoNodeEditor(const TGWindow *p,
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p,width, height, options | kVerticalFrame, back),
fNodeRE (0),
fVizNode(0),
fVizNodeDaughters(0),
fVizVolume(0),
fVizVolumeDaughters(0)
{
MakeTitle("GeoNode");
// --- Visibility control
fVizNode = new TGCheckButton(this, "VizNode");
AddFrame(fVizNode, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
fVizNode->Connect
("Toggled(Bool_t)",
"TEveGeoNodeEditor", this, "DoVizNode()");
fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
AddFrame(fVizNodeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
fVizNodeDaughters->Connect
("Toggled(Bool_t)",
"TEveGeoNodeEditor", this, "DoVizNodeDaughters()");
fVizVolume = new TGCheckButton(this, "VizVolume");
AddFrame(fVizVolume, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
fVizVolume->Connect
("Toggled(Bool_t)",
"TEveGeoNodeEditor", this, "DoVizVolume()");
fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
AddFrame(fVizVolumeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
fVizVolumeDaughters->Connect
("Toggled(Bool_t)",
"TEveGeoNodeEditor", this, "DoVizVolumeDaughters()");
}
////////////////////////////////////////////////////////////////////////////////
/// Set model object.
void TEveGeoNodeEditor::SetModel(TObject* obj)
{
fNodeRE = dynamic_cast<TEveGeoNode*>(obj);
TGeoNode* node = fNodeRE->fNode;
TGeoVolume* vol = node->GetVolume();
fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp);
fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp);
fVizVolume->SetState(vol->IsVisible() ? kButtonDown : kButtonUp);
fVizVolumeDaughters->SetState(vol->IsVisDaughters() ? kButtonDown : kButtonUp);
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for VizNode.
void TEveGeoNodeEditor::DoVizNode()
{
fNodeRE->SetRnrSelf(fVizNode->IsOn());
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for VizNodeDaughters.
void TEveGeoNodeEditor::DoVizNodeDaughters()
{
fNodeRE->SetRnrChildren(fVizNodeDaughters->IsOn());
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for VizVolume.
void TEveGeoNodeEditor::DoVizVolume()
{
fNodeRE->fNode->GetVolume()->SetVisibility(fVizVolume->IsOn());
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for VizVolumeDaughters.
void TEveGeoNodeEditor::DoVizVolumeDaughters()
{
fNodeRE->fNode->GetVolume()->VisibleDaughters(fVizVolumeDaughters->IsOn());
Update();
}
/** \class TEveGeoTopNodeEditor
\ingroup TEve
Editor for TEveGeoTopNode class.
*/
ClassImp(TEveGeoTopNodeEditor)
////////////////////////////////////////////////////////////////////////////////
/// Constructor.
TEveGeoTopNodeEditor::TEveGeoTopNodeEditor(const TGWindow *p,
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fTopNodeRE (0),
fVisOption (0),
fVisLevel (0),
fMaxVisNodes (0)
{
MakeTitle("GeoTopNode");
Int_t labelW = 64;
fVisOption = new TEveGValuator(this, "VisOption:", 90, 0);
fVisOption->SetLabelWidth(labelW);
fVisOption->SetShowSlider(kFALSE);
fVisOption->SetNELength(4);
fVisOption->Build();
fVisOption->SetLimits(0, 2, 10, TGNumberFormat::kNESInteger);
fVisOption->SetToolTip("Visualization option passed to TGeoPainter.");
fVisOption->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisOption()");
AddFrame(fVisOption, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fVisLevel = new TEveGValuator(this, "VisLevel:", 90, 0);
fVisLevel->SetLabelWidth(labelW);
fVisLevel->SetShowSlider(kFALSE);
fVisLevel->SetNELength(4);
fVisLevel->Build();
fVisLevel->SetLimits(0, 30, 31, TGNumberFormat::kNESInteger);
fVisLevel->SetToolTip("Level (depth) to which the geometry is traversed.\nWhen zero, maximum number of nodes to draw can be specified.");
fVisLevel->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisLevel()");
AddFrame(fVisLevel, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
fMaxVisNodes = new TEveGValuator(this, "MaxNodes:", 90, 0);
fMaxVisNodes->SetLabelWidth(labelW);
fMaxVisNodes->SetShowSlider(kFALSE);
fMaxVisNodes->SetNELength(6);
fMaxVisNodes->Build();
fMaxVisNodes->SetLimits(100, 999999, 0, TGNumberFormat::kNESInteger);
fMaxVisNodes->SetToolTip("Maximum number of nodes to draw.");
fMaxVisNodes->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoMaxVisNodes()");
AddFrame(fMaxVisNodes, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}
////////////////////////////////////////////////////////////////////////////////
/// Set model object.
void TEveGeoTopNodeEditor::SetModel(TObject* obj)
{
fTopNodeRE = dynamic_cast<TEveGeoTopNode*>(obj);
fVisOption ->SetValue(fTopNodeRE->GetVisOption());
fVisLevel ->SetValue(fTopNodeRE->GetVisLevel());
fMaxVisNodes->SetValue(fTopNodeRE->GetMaxVisNodes());
if (fTopNodeRE->GetVisLevel() > 0)
fMaxVisNodes->UnmapWindow();
else
fMaxVisNodes->MapWindow();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for VisOption.
void TEveGeoTopNodeEditor::DoVisOption()
{
fTopNodeRE->SetVisOption(Int_t(fVisOption->GetValue()));
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for VisLevel.
void TEveGeoTopNodeEditor::DoVisLevel()
{
fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetValue()));
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for MaxVisNodes.
void TEveGeoTopNodeEditor::DoMaxVisNodes()
{
fTopNodeRE->SetMaxVisNodes(Int_t(fMaxVisNodes->GetValue()));
Update();
}