00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveGeoNodeEditor.h"
00013 #include "TEveGValuators.h"
00014
00015 #include "TEveGeoNode.h"
00016 #include "TGeoNode.h"
00017
00018 #include "TVirtualPad.h"
00019 #include "TColor.h"
00020
00021 #include "TGLabel.h"
00022 #include "TGButton.h"
00023 #include "TGNumberEntry.h"
00024 #include "TGColorSelect.h"
00025 #include "TGDoubleSlider.h"
00026
00027
00028
00029
00030
00031
00032 ClassImp(TEveGeoNodeEditor)
00033
00034
00035 TEveGeoNodeEditor::TEveGeoNodeEditor(const TGWindow *p,
00036 Int_t width, Int_t height,
00037 UInt_t options, Pixel_t back) :
00038 TGedFrame(p,width, height, options | kVerticalFrame, back),
00039
00040 fNodeRE (0),
00041
00042 fVizNode(0),
00043 fVizNodeDaughters(0),
00044 fVizVolume(0),
00045 fVizVolumeDaughters(0)
00046 {
00047
00048
00049 MakeTitle("GeoNode");
00050
00051
00052
00053 fVizNode = new TGCheckButton(this, "VizNode");
00054 AddFrame(fVizNode, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
00055 fVizNode->Connect
00056 ("Toggled(Bool_t)",
00057 "TEveGeoNodeEditor", this, "DoVizNode()");
00058
00059 fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
00060 AddFrame(fVizNodeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
00061 fVizNodeDaughters->Connect
00062 ("Toggled(Bool_t)",
00063 "TEveGeoNodeEditor", this, "DoVizNodeDaughters()");
00064
00065 fVizVolume = new TGCheckButton(this, "VizVolume");
00066 AddFrame(fVizVolume, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
00067 fVizVolume->Connect
00068 ("Toggled(Bool_t)",
00069 "TEveGeoNodeEditor", this, "DoVizVolume()");
00070
00071 fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
00072 AddFrame(fVizVolumeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
00073 fVizVolumeDaughters->Connect
00074 ("Toggled(Bool_t)",
00075 "TEveGeoNodeEditor", this, "DoVizVolumeDaughters()");
00076 }
00077
00078
00079
00080
00081 void TEveGeoNodeEditor::SetModel(TObject* obj)
00082 {
00083
00084
00085 fNodeRE = dynamic_cast<TEveGeoNode*>(obj);
00086 TGeoNode* node = fNodeRE->fNode;
00087 TGeoVolume* vol = node->GetVolume();
00088
00089 fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp);
00090 fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp);
00091 fVizVolume->SetState(vol->IsVisible() ? kButtonDown : kButtonUp);
00092 fVizVolumeDaughters->SetState(vol->IsVisDaughters() ? kButtonDown : kButtonUp);
00093 }
00094
00095
00096
00097
00098 void TEveGeoNodeEditor::DoVizNode()
00099 {
00100
00101
00102 fNodeRE->SetRnrSelf(fVizNode->IsOn());
00103 Update();
00104 }
00105
00106
00107 void TEveGeoNodeEditor::DoVizNodeDaughters()
00108 {
00109
00110
00111 fNodeRE->SetRnrChildren(fVizNodeDaughters->IsOn());
00112 Update();
00113 }
00114
00115
00116 void TEveGeoNodeEditor::DoVizVolume()
00117 {
00118
00119
00120 fNodeRE->fNode->GetVolume()->SetVisibility(fVizVolume->IsOn());
00121 Update();
00122 }
00123
00124
00125 void TEveGeoNodeEditor::DoVizVolumeDaughters()
00126 {
00127
00128
00129 fNodeRE->fNode->GetVolume()->VisibleDaughters(fVizVolumeDaughters->IsOn());
00130 Update();
00131 }
00132
00133
00134
00135
00136
00137
00138
00139 ClassImp(TEveGeoTopNodeEditor)
00140
00141
00142 TEveGeoTopNodeEditor::TEveGeoTopNodeEditor(const TGWindow *p,
00143 Int_t width, Int_t height,
00144 UInt_t options, Pixel_t back) :
00145 TGedFrame(p, width, height, options | kVerticalFrame, back),
00146
00147 fTopNodeRE (0),
00148 fVisOption (0),
00149 fVisLevel (0),
00150 fMaxVisNodes (0)
00151 {
00152
00153
00154 MakeTitle("GeoTopNode");
00155
00156 Int_t labelW = 64;
00157
00158 fVisOption = new TEveGValuator(this, "VisOption:", 90, 0);
00159 fVisOption->SetLabelWidth(labelW);
00160 fVisOption->SetShowSlider(kFALSE);
00161 fVisOption->SetNELength(4);
00162 fVisOption->Build();
00163 fVisOption->SetLimits(0, 2, 10, TGNumberFormat::kNESInteger);
00164 fVisOption->SetToolTip("Visualization option passed to TGeoPainter.");
00165 fVisOption->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisOption()");
00166 AddFrame(fVisOption, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00167
00168 fVisLevel = new TEveGValuator(this, "VisLevel:", 90, 0);
00169 fVisLevel->SetLabelWidth(labelW);
00170 fVisLevel->SetShowSlider(kFALSE);
00171 fVisLevel->SetNELength(4);
00172 fVisLevel->Build();
00173 fVisLevel->SetLimits(0, 10, 10, TGNumberFormat::kNESInteger);
00174 fVisLevel->SetToolTip("Level (depth) to which the geometry is traversed.\nWhen zero, maximum number of nodes to draw can be specified.");
00175 fVisLevel->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisLevel()");
00176 AddFrame(fVisLevel, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00177
00178 fMaxVisNodes = new TEveGValuator(this, "MaxNodes:", 90, 0);
00179 fMaxVisNodes->SetLabelWidth(labelW);
00180 fMaxVisNodes->SetShowSlider(kFALSE);
00181 fMaxVisNodes->SetNELength(6);
00182 fMaxVisNodes->Build();
00183 fMaxVisNodes->SetLimits(100, 999999, 0, TGNumberFormat::kNESInteger);
00184 fMaxVisNodes->SetToolTip("Maximum number of nodes to draw.");
00185 fMaxVisNodes->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoMaxVisNodes()");
00186 AddFrame(fMaxVisNodes, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00187 }
00188
00189
00190
00191
00192 void TEveGeoTopNodeEditor::SetModel(TObject* obj)
00193 {
00194
00195
00196 fTopNodeRE = dynamic_cast<TEveGeoTopNode*>(obj);
00197
00198 fVisOption ->SetValue(fTopNodeRE->GetVisOption());
00199 fVisLevel ->SetValue(fTopNodeRE->GetVisLevel());
00200 fMaxVisNodes->SetValue(fTopNodeRE->GetMaxVisNodes());
00201 if (fTopNodeRE->GetVisLevel() > 0)
00202 fMaxVisNodes->UnmapWindow();
00203 else
00204 fMaxVisNodes->MapWindow();
00205 }
00206
00207
00208
00209
00210 void TEveGeoTopNodeEditor::DoVisOption()
00211 {
00212
00213
00214 fTopNodeRE->SetVisOption(Int_t(fVisOption->GetValue()));
00215 Update();
00216 }
00217
00218
00219 void TEveGeoTopNodeEditor::DoVisLevel()
00220 {
00221
00222
00223 fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetValue()));
00224 Update();
00225 }
00226
00227
00228 void TEveGeoTopNodeEditor::DoMaxVisNodes()
00229 {
00230
00231
00232 fTopNodeRE->SetMaxVisNodes(Int_t(fMaxVisNodes->GetValue()));
00233 Update();
00234 }