]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/RGeoNodeEditors.cxx
Record changes.
[u/mrichter/AliRoot.git] / EVE / Reve / RGeoNodeEditors.cxx
CommitLineData
5a5a1232 1// $Header$
2
3#include "RGeoNodeEditors.h"
4
5#include <Reve/GeoNode.h>
6#include <TGeoNode.h>
7
8#include <TVirtualPad.h>
9#include <TColor.h>
10
11#include <TGLabel.h>
12#include <TGButton.h>
13#include <TGNumberEntry.h>
14#include <TGColorSelect.h>
15#include <TGDoubleSlider.h>
16
17using namespace Reve;
18
19//______________________________________________________________________
20// GeoNodeRnrElEditor
21//
22
23ClassImp(GeoNodeRnrElEditor)
24
a8600b56 25GeoNodeRnrElEditor::GeoNodeRnrElEditor(const TGWindow *p,
265ecb21 26 Int_t width, Int_t height,
27 UInt_t options, Pixel_t back) :
a8600b56 28 TGedFrame(p,width, height, options | kVerticalFrame, back),
265ecb21 29
30 fNodeRE (0),
31
32 fVizNode(0),
33 fVizNodeDaughters(0),
34 fVizVolume(0),
35 fVizVolumeDaughters(0),
36
37 fTransparency(0)
5a5a1232 38{
5a5a1232 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 "Reve::GeoNodeRnrElEditor", this, "DoVizNode()");
48
49 fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
50 AddFrame(fVizNodeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
51 fVizNodeDaughters->Connect
52 ("Toggled(Bool_t)",
53 "Reve::GeoNodeRnrElEditor", this, "DoVizNodeDaughters()");
54
55 fVizVolume = new TGCheckButton(this, "VizVolume");
56 AddFrame(fVizVolume, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
57 fVizVolume->Connect
58 ("Toggled(Bool_t)",
59 "Reve::GeoNodeRnrElEditor", this, "DoVizVolume()");
60
61 fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
62 AddFrame(fVizVolumeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
63 fVizVolumeDaughters->Connect
64 ("Toggled(Bool_t)",
65 "Reve::GeoNodeRnrElEditor", this, "DoVizVolumeDaughters()");
66
67
68 // --- Color props
69
70 {
71 TGHorizontalFrame* f = new TGHorizontalFrame(this);
72 TGLabel *l = new TGLabel(f, "Transparency:");
73 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
74 fTransparency = new TGNumberEntry(f, 0., 6, -1,
75 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
76 TGNumberFormat::kNELLimitMinMax, 0, 100);
77 fTransparency->GetNumberEntry()->SetToolTipText("0 is opaque, 100 fully transparent.");
78 f->AddFrame(fTransparency, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
79 fTransparency->Associate(f);
80 fTransparency->Connect("ValueSet(Long_t)",
81 "Reve::GeoNodeRnrElEditor", this, "DoTransparency()");
82 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
83 }
5a5a1232 84}
85
86/**************************************************************************/
87
a8600b56 88void GeoNodeRnrElEditor::SetModel(TObject* obj)
5a5a1232 89{
a8600b56 90 fNodeRE = dynamic_cast<GeoNodeRnrEl*>(obj);
5a5a1232 91 TGeoNode* node = fNodeRE->fNode;
92 TGeoVolume* vol = node->GetVolume();
93
94 fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp);
95 fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp);
96 fVizVolume->SetState(vol->IsVisible() ? kButtonDown : kButtonUp);
97 fVizVolumeDaughters->SetState(vol->IsVisDaughters() ? kButtonDown : kButtonUp);
98
99 fTransparency->SetNumber(vol->GetTransparency());
5a5a1232 100}
101
102/**************************************************************************/
103
104void GeoNodeRnrElEditor::DoVizNode()
105{
106 fNodeRE->fNode->SetVisibility(fVizNode->IsOn());
7d42b6c2 107 fNodeRE->UpdateItems();
5a5a1232 108}
109
110void GeoNodeRnrElEditor::DoVizNodeDaughters()
111{
112 fNodeRE->fNode->VisibleDaughters(fVizNodeDaughters->IsOn());
113 Update();
114}
115
116void GeoNodeRnrElEditor::DoVizVolume()
117{
118 fNodeRE->fNode->GetVolume()->SetVisibility(fVizVolume->IsOn());
119 Update();
120}
121
122void GeoNodeRnrElEditor::DoVizVolumeDaughters()
123{
124 fNodeRE->fNode->GetVolume()->VisibleDaughters(fVizVolumeDaughters->IsOn());
125 Update();
126}
127
128/**************************************************************************/
129
130void GeoNodeRnrElEditor::DoTransparency()
131{
132 fNodeRE->fNode->GetVolume()->SetTransparency(char(fTransparency->GetNumber()));
133 Update();
134}
135
136
137/**************************************************************************/
138/**************************************************************************/
139
140//______________________________________________________________________
141// GeoTopNodeRnrElEditor
142//
143
144ClassImp(GeoTopNodeRnrElEditor)
145
a8600b56 146GeoTopNodeRnrElEditor::GeoTopNodeRnrElEditor(const TGWindow *p,
265ecb21 147 Int_t width, Int_t height,
5a5a1232 148 UInt_t options, Pixel_t back) :
a8600b56 149 TGedFrame(p, width, height, options | kVerticalFrame, back),
265ecb21 150
151 fTopNodeRE (0),
152 fVisOption (0),
153 fVisLevel (0)
5a5a1232 154{
5a5a1232 155 MakeTitle("GeoTopNode");
156
157 {
158 TGHorizontalFrame* f = new TGHorizontalFrame(this);
159 TGLabel *l = new TGLabel(f, "VisOption:");
160 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
161 fVisOption = new TGNumberEntry(f, 0., 6, -1,
162 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
163 TGNumberFormat::kNELLimitMinMax, 0, 3);
164 fVisOption->GetNumberEntry()->SetToolTipText("0 ~ all final nodes, 1 ~ pure leaves only, 2 ~ path (?)");
165 f->AddFrame(fVisOption, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
166 fVisOption->Associate(f);
167 fVisOption->Connect("ValueSet(Long_t)",
168 "Reve::GeoTopNodeRnrElEditor", this, "DoVisOption()");
169 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
170 }
171
172 {
173 TGHorizontalFrame* f = new TGHorizontalFrame(this);
174 TGLabel *l = new TGLabel(f, "VisLevel:");
175 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
176 fVisLevel = new TGNumberEntry(f, 0., 6, -1,
177 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
178 TGNumberFormat::kNELLimitMinMax, 0, 128);
179 fVisLevel->GetNumberEntry()->SetToolTipText("");
180 f->AddFrame(fVisLevel, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
181 fVisLevel->Associate(f);
182 fVisLevel->Connect("ValueSet(Long_t)",
183 "Reve::GeoTopNodeRnrElEditor", this, "DoVisLevel()");
184 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
185 }
5a5a1232 186}
187
188/**************************************************************************/
189
a8600b56 190void GeoTopNodeRnrElEditor::SetModel(TObject* obj)
5a5a1232 191{
a8600b56 192 fTopNodeRE = dynamic_cast<GeoTopNodeRnrEl*>(obj);
5a5a1232 193
194 fVisOption->SetNumber(fTopNodeRE->GetVisOption());
195 fVisLevel->SetNumber(fTopNodeRE->GetVisLevel());
5a5a1232 196}
197
198/**************************************************************************/
199
200void GeoTopNodeRnrElEditor::DoVisOption()
201{
202 fTopNodeRE->SetVisOption(Int_t(fVisOption->GetNumber()));
203}
204
205void GeoTopNodeRnrElEditor::DoVisLevel()
206{
207 fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetNumber()));
208}