3 #include "NLTProjectorEditor.h"
4 #include <Reve/NLTProjector.h>
6 #include <Reve/RGValuators.h>
9 #include <TGNumberEntry.h>
10 #include <TGColorSelect.h>
11 #include <TGComboBox.h>
17 //______________________________________________________________________
20 // GUI editor for class NLTProjector.
23 ClassImp(NLTProjectorEditor)
25 NLTProjectorEditor::NLTProjectorEditor(const TGWindow *p,
26 Int_t width, Int_t height,
27 UInt_t options, Pixel_t back) :
28 TGedFrame(p, width, height, options | kVerticalFrame, back),
48 MakeTitle("NLTProjection");
50 TGHorizontalFrame* f = new TGHorizontalFrame(this);
51 TGLabel* lab = new TGLabel(f, "Type");
52 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 31, 1, 2));
53 fType = new TGComboBox(f);
54 fType->AddEntry("CFishEye", NLTProjection::PT_CFishEye);
55 fType->AddEntry("RhoZ", NLTProjection::PT_RhoZ);
56 TGListBox* lb = fType->GetListBox();
57 lb->Resize(lb->GetWidth(), 2*18);
58 fType->Resize(80, 20);
59 fType->Connect("Selected(Int_t)", "Reve::NLTProjectorEditor",
60 this, "DoType(Int_t)");
61 f->AddFrame(fType, new TGLayoutHints(kLHintsTop, 1, 1, 2, 4));
66 fDistortion = new RGValuator(this, "Distortion:", 90, 0);
67 fDistortion->SetNELength(5);
68 fDistortion->SetLabelWidth(labelW);
70 fDistortion->SetLimits(0, 50, 101, TGNumberFormat::kNESRealTwo);
71 fDistortion->Connect("ValueSet(Double_t)", "Reve::NLTProjectorEditor",
72 this, "DoDistortion()");
73 AddFrame(fDistortion, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
76 fFixedRadius = new RGValuator(this, "FixedR:", 90, 0);
77 fFixedRadius->SetNELength(5);
78 fFixedRadius->SetLabelWidth(labelW);
79 fFixedRadius->Build();
80 fFixedRadius->SetLimits(0, 1000, 101, TGNumberFormat::kNESRealOne);
81 fFixedRadius->SetToolTip("Radius not scaled by distotion.");
82 fFixedRadius->Connect("ValueSet(Double_t)", "Reve::NLTProjectorEditor",
83 this, "DoFixedRadius()");
84 AddFrame(fFixedRadius, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
87 fCurrentDepth = new RGValuator(this, "CurrentZ:", 90, 0);
88 fCurrentDepth->SetNELength(5);
89 fCurrentDepth->SetLabelWidth(labelW);
90 fCurrentDepth->Build();
91 fCurrentDepth->SetLimits(-300, 300, 601, TGNumberFormat::kNESRealOne);
92 fCurrentDepth->SetToolTip("Z coordinate of incoming projected object.");
93 fCurrentDepth->Connect("ValueSet(Double_t)", "Reve::NLTProjectorEditor",
94 this, "DoCurrentDepth()");
95 AddFrame(fCurrentDepth, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
97 /**************************************************************************/
100 TGHorizontalFrame* hf1 = new TGHorizontalFrame(this);
102 TGCompositeFrame *labfr =
103 new TGHorizontalFrame(hf1, 60, 15, kFixedSize);
104 TGLabel* l = new TGLabel(labfr, "Color");
105 labfr->AddFrame(l, new TGLayoutHints(kLHintsLeft|kLHintsBottom));
106 hf1->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom));
109 fAxisColor = new TGColorSelect(hf1, 0, -1);
110 hf1->AddFrame(fAxisColor, new TGLayoutHints(kLHintsLeft, 2, 0, 1, 1));
112 ("ColorSelected(Pixel_t)",
113 "Reve::NLTProjectorEditor", this, "DoAxisColor(Pixel_t)");
118 TGHorizontalFrame* f = new TGHorizontalFrame(this);
119 TGLabel* lab = new TGLabel(f, "StepMode");
120 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 6, 1, 2));
121 fSIMode = new TGComboBox(f, "Position");
122 fSIMode->AddEntry("Value", 1);
123 fSIMode->AddEntry("Position", 0);
124 fSIMode->GetTextEntry()->SetToolTipText("Set tick-marks on equidistant values/screen position.");
125 TGListBox* lb = fSIMode->GetListBox();
126 lb->Resize(lb->GetWidth(), 2*18);
127 fSIMode->Resize(80, 20);
128 fSIMode->Connect("Selected(Int_t)", "Reve::NLTProjectorEditor",
129 this, "DoSplitInfoMode(Int_t)");
130 f->AddFrame(fSIMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
134 TGHorizontalFrame* f = new TGHorizontalFrame(this);
135 TGLabel* lab = new TGLabel(f, "SplitLevel");
136 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 8, 1, 2));
138 fSILevel = new TGNumberEntry(f, 0, 3, -1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
139 TGNumberFormat::kNELLimitMinMax, 0, 7);
140 fSILevel->GetNumberEntry()->SetToolTipText("Number of tick-marks TMath::Power(2, level).");
141 fSILevel->Connect("ValueSet(Long_t)", "Reve::NLTProjectorEditor", this, "DoSplitInfoLevel()");
142 f->AddFrame(fSILevel, new TGLayoutHints(kLHintsTop, 1, 1, 1, 2));
143 AddFrame(f, new TGLayoutHints(kLHintsTop, 0, 0, 0, 3) );
146 /**************************************************************************/
148 fCenterFrame = CreateEditorTabSubFrame("Center");
150 TGCompositeFrame *title1 = new TGCompositeFrame(fCenterFrame, 180, 10,
155 title1->AddFrame(new TGLabel(title1, "Distortion Center"),
156 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
157 title1->AddFrame(new TGHorizontal3DLine(title1),
158 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
159 fCenterFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
164 TGHorizontalFrame* hf1 = new TGHorizontalFrame(fCenterFrame);
166 fDrawOrigin = new TGCheckButton(hf1, "DrawOrigin");
167 hf1->AddFrame(fDrawOrigin, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
168 fDrawOrigin->Connect("Toggled(Bool_t)"," Reve::NLTProjectorEditor", this, "DoDrawOrigin()");
171 fDrawCenter = new TGCheckButton(hf1, "DrawCenter");
172 hf1->AddFrame(fDrawCenter, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
173 fDrawCenter->Connect("Toggled(Bool_t)"," Reve::NLTProjectorEditor", this, "DoDrawCenter()");
175 fCenterFrame->AddFrame(hf1, new TGLayoutHints(kLHintsTop, 0,0,0,0));
180 fCenterX = new RGValuator(fCenterFrame, "CenterX:", 90, 0);
181 fCenterX->SetNELength(nel);
182 fCenterX->SetLabelWidth(labelW);
184 fCenterX->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
185 fCenterX->SetToolTip("Origin of the projection.");
186 fCenterX->Connect("ValueSet(Double_t)", "Reve::NLTProjectorEditor",
188 fCenterFrame->AddFrame(fCenterX, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
190 fCenterY = new RGValuator(fCenterFrame, "CenterY:", 90, 0);
191 fCenterY->SetNELength(nel);
192 fCenterY->SetLabelWidth(labelW);
194 fCenterY->SetLimits(-5, 5, 501, TGNumberFormat::kNESRealThree);
195 fCenterY->SetToolTip("Origin of the projection.");
196 fCenterY->Connect("ValueSet(Double_t)", "Reve::NLTProjectorEditor",
198 fCenterFrame->AddFrame(fCenterY, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
200 fCenterZ = new RGValuator(fCenterFrame, "CenterZ:", 90, 0);
201 fCenterZ->SetNELength(nel);
202 fCenterZ->SetLabelWidth(labelW);
204 fCenterZ->SetLimits(-25, 25, 501, TGNumberFormat::kNESRealThree);
205 fCenterZ->SetToolTip("Origin of the projection.");
206 fCenterZ->Connect("ValueSet(Double_t)", "Reve::NLTProjectorEditor",
208 fCenterFrame->AddFrame(fCenterZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
211 //______________________________________________________________________________
212 void NLTProjectorEditor::SetModel(TObject* obj)
216 fM = dynamic_cast<NLTProjector*>(obj);
218 fAxisColor->SetColor(TColor::Number2Pixel(fM->GetAxisColor()), kFALSE);
219 fSIMode->Select(fM->GetSplitInfoMode(), kFALSE);
220 fSILevel->SetNumber(fM->GetSplitInfoLevel());
222 fType->Select(fM->GetProjection()->GetType(), kFALSE);
223 fDistortion->SetValue(1000.0f * fM->GetProjection()->GetDistortion());
224 fFixedRadius->SetValue(fM->GetProjection()->GetFixedRadius());
225 fCurrentDepth->SetValue(fM->GetCurrentDepth());
227 fDrawCenter->SetState(fM->GetDrawCenter() ? kButtonDown : kButtonUp);
228 fDrawOrigin->SetState(fM->GetDrawOrigin() ? kButtonDown : kButtonUp);
229 fCenterX->SetValue(fM->GetCenter().x);
230 fCenterY->SetValue(fM->GetCenter().y);
231 fCenterZ->SetValue(fM->GetCenter().z);
234 //______________________________________________________________________________
235 void NLTProjectorEditor::DoType(Int_t type)
237 // Slot for setting of projection type.
239 fM->SetProjection((NLTProjection::PType_e)type, 0.001f * fDistortion->GetValue());
240 fM->ProjectChildren();
244 //______________________________________________________________________________
245 void NLTProjectorEditor::DoDistortion()
247 // Slot for setting distortion.
249 fM->GetProjection()->SetDistortion(0.001f * fDistortion->GetValue());
251 fM->ProjectChildren();
255 //______________________________________________________________________________
256 void NLTProjectorEditor::DoFixedRadius()
258 // Slot for setting fixed radius.
260 fM->GetProjection()->SetFixedRadius(fFixedRadius->GetValue());
261 fM->ProjectChildren();
265 //______________________________________________________________________________
266 void NLTProjectorEditor::DoCurrentDepth()
268 // Slot for setting current depth.
270 fM->SetCurrentDepth(fCurrentDepth->GetValue());
271 fM->ProjectChildren();
275 //______________________________________________________________________________
276 void NLTProjectorEditor::DoCenter()
278 // Slot for setting center of distortion.
280 fM->SetCenter(fCenterX->GetValue(), fCenterY->GetValue(), fCenterZ->GetValue());
284 //______________________________________________________________________________
285 void NLTProjectorEditor::DoDrawOrigin()
287 // Slot for setting draw of origin.
289 fM->SetDrawOrigin(fDrawOrigin->IsOn());
293 //______________________________________________________________________________
294 void NLTProjectorEditor::DoDrawCenter()
296 // Slot for setting draw of center.
298 fM->SetDrawCenter(fDrawCenter->IsOn());
302 //______________________________________________________________________________
303 void NLTProjectorEditor::DoSplitInfoMode(Int_t type)
305 // Slot for setting split info mode.
307 fM->SetSplitInfoMode(type);
311 //______________________________________________________________________________
312 void NLTProjectorEditor::DoSplitInfoLevel()
314 // Slot for setting tick-mark density.
316 fM->SetSplitInfoLevel((Int_t)fSILevel->GetNumber());
320 //______________________________________________________________________________
321 void NLTProjectorEditor::DoAxisColor(Pixel_t pixel)
323 // Slot for setting axis color.
325 fM->SetAxisColor(Color_t(TColor::GetColor(pixel)));