]>
Commit | Line | Data |
---|---|---|
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 | ||
17 | using namespace Reve; | |
18 | ||
19 | //______________________________________________________________________ | |
20 | // GeoNodeRnrElEditor | |
21 | // | |
22 | ||
23 | ClassImp(GeoNodeRnrElEditor) | |
24 | ||
a8600b56 | 25 | GeoNodeRnrElEditor::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)); | |
5a5a1232 | 79 | fTransparency->Connect("ValueSet(Long_t)", |
80 | "Reve::GeoNodeRnrElEditor", this, "DoTransparency()"); | |
81 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
82 | } | |
5a5a1232 | 83 | } |
84 | ||
85 | /**************************************************************************/ | |
86 | ||
a8600b56 | 87 | void GeoNodeRnrElEditor::SetModel(TObject* obj) |
5a5a1232 | 88 | { |
a8600b56 | 89 | fNodeRE = dynamic_cast<GeoNodeRnrEl*>(obj); |
5a5a1232 | 90 | TGeoNode* node = fNodeRE->fNode; |
91 | TGeoVolume* vol = node->GetVolume(); | |
92 | ||
93 | fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp); | |
94 | fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp); | |
95 | fVizVolume->SetState(vol->IsVisible() ? kButtonDown : kButtonUp); | |
96 | fVizVolumeDaughters->SetState(vol->IsVisDaughters() ? kButtonDown : kButtonUp); | |
97 | ||
98 | fTransparency->SetNumber(vol->GetTransparency()); | |
5a5a1232 | 99 | } |
100 | ||
101 | /**************************************************************************/ | |
102 | ||
103 | void GeoNodeRnrElEditor::DoVizNode() | |
104 | { | |
105 | fNodeRE->fNode->SetVisibility(fVizNode->IsOn()); | |
7d42b6c2 | 106 | fNodeRE->UpdateItems(); |
5a5a1232 | 107 | } |
108 | ||
109 | void GeoNodeRnrElEditor::DoVizNodeDaughters() | |
110 | { | |
111 | fNodeRE->fNode->VisibleDaughters(fVizNodeDaughters->IsOn()); | |
112 | Update(); | |
113 | } | |
114 | ||
115 | void GeoNodeRnrElEditor::DoVizVolume() | |
116 | { | |
117 | fNodeRE->fNode->GetVolume()->SetVisibility(fVizVolume->IsOn()); | |
118 | Update(); | |
119 | } | |
120 | ||
121 | void GeoNodeRnrElEditor::DoVizVolumeDaughters() | |
122 | { | |
123 | fNodeRE->fNode->GetVolume()->VisibleDaughters(fVizVolumeDaughters->IsOn()); | |
124 | Update(); | |
125 | } | |
126 | ||
127 | /**************************************************************************/ | |
128 | ||
129 | void GeoNodeRnrElEditor::DoTransparency() | |
130 | { | |
131 | fNodeRE->fNode->GetVolume()->SetTransparency(char(fTransparency->GetNumber())); | |
132 | Update(); | |
133 | } | |
134 | ||
135 | ||
136 | /**************************************************************************/ | |
137 | /**************************************************************************/ | |
138 | ||
139 | //______________________________________________________________________ | |
140 | // GeoTopNodeRnrElEditor | |
141 | // | |
142 | ||
143 | ClassImp(GeoTopNodeRnrElEditor) | |
144 | ||
a8600b56 | 145 | GeoTopNodeRnrElEditor::GeoTopNodeRnrElEditor(const TGWindow *p, |
265ecb21 | 146 | Int_t width, Int_t height, |
5a5a1232 | 147 | UInt_t options, Pixel_t back) : |
a8600b56 | 148 | TGedFrame(p, width, height, options | kVerticalFrame, back), |
265ecb21 | 149 | |
150 | fTopNodeRE (0), | |
151 | fVisOption (0), | |
152 | fVisLevel (0) | |
5a5a1232 | 153 | { |
5a5a1232 | 154 | MakeTitle("GeoTopNode"); |
155 | ||
156 | { | |
157 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
158 | TGLabel *l = new TGLabel(f, "VisOption:"); | |
159 | f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1)); | |
160 | fVisOption = new TGNumberEntry(f, 0., 6, -1, | |
161 | TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, | |
162 | TGNumberFormat::kNELLimitMinMax, 0, 3); | |
163 | fVisOption->GetNumberEntry()->SetToolTipText("0 ~ all final nodes, 1 ~ pure leaves only, 2 ~ path (?)"); | |
164 | f->AddFrame(fVisOption, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
165 | fVisOption->Associate(f); | |
166 | fVisOption->Connect("ValueSet(Long_t)", | |
167 | "Reve::GeoTopNodeRnrElEditor", this, "DoVisOption()"); | |
168 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
169 | } | |
170 | ||
171 | { | |
172 | TGHorizontalFrame* f = new TGHorizontalFrame(this); | |
173 | TGLabel *l = new TGLabel(f, "VisLevel:"); | |
174 | f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1)); | |
175 | fVisLevel = new TGNumberEntry(f, 0., 6, -1, | |
176 | TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, | |
177 | TGNumberFormat::kNELLimitMinMax, 0, 128); | |
178 | fVisLevel->GetNumberEntry()->SetToolTipText(""); | |
179 | f->AddFrame(fVisLevel, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
180 | fVisLevel->Associate(f); | |
181 | fVisLevel->Connect("ValueSet(Long_t)", | |
182 | "Reve::GeoTopNodeRnrElEditor", this, "DoVisLevel()"); | |
183 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1)); | |
184 | } | |
5a5a1232 | 185 | } |
186 | ||
187 | /**************************************************************************/ | |
188 | ||
a8600b56 | 189 | void GeoTopNodeRnrElEditor::SetModel(TObject* obj) |
5a5a1232 | 190 | { |
a8600b56 | 191 | fTopNodeRE = dynamic_cast<GeoTopNodeRnrEl*>(obj); |
5a5a1232 | 192 | |
193 | fVisOption->SetNumber(fTopNodeRE->GetVisOption()); | |
194 | fVisLevel->SetNumber(fTopNodeRE->GetVisLevel()); | |
5a5a1232 | 195 | } |
196 | ||
197 | /**************************************************************************/ | |
198 | ||
199 | void GeoTopNodeRnrElEditor::DoVisOption() | |
200 | { | |
201 | fTopNodeRE->SetVisOption(Int_t(fVisOption->GetNumber())); | |
202 | } | |
203 | ||
204 | void GeoTopNodeRnrElEditor::DoVisLevel() | |
205 | { | |
206 | fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetNumber())); | |
207 | } |