Logo ROOT   6.08/07
Reference Guide
TGeoTubeEditor.cxx
Go to the documentation of this file.
1 // @(#):$Id$
2 // Author: M.Gheata
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TGeoTubeEditor //
15 // //
16 //////////////////////////////////////////////////////////////////////////
17 //Begin_Html
18 /*
19 <img src="gif/tube_pic.gif">
20 */
21 //End_Html
22 //Begin_Html
23 /*
24 <img src="gif/tube_ed.jpg">
25 */
26 //End_Html
27 
28 #include "TGeoTubeEditor.h"
29 #include "TGeoTabManager.h"
30 #include "TGeoTube.h"
31 #include "TGeoManager.h"
32 #include "TVirtualGeoPainter.h"
33 #include "TPad.h"
34 #include "TView.h"
35 #include "TGTab.h"
36 #include "TMath.h"
37 #include "TGComboBox.h"
38 #include "TGButton.h"
39 #include "TGTextEntry.h"
40 #include "TGNumberEntry.h"
41 #include "TGLabel.h"
42 #include "TGDoubleSlider.h"
43 
45 
49 };
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// Constructor for tube editor
53 
55  Int_t height, UInt_t options, Pixel_t back)
56  : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
57 {
58  fShape = 0;
59  fRmini = fRmaxi = fDzi = 0.0;
60  fNamei = "";
63 
64  // TextEntry for shape name
65  MakeTitle("Name");
66  fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTUBE_NAME);
68  fShapeName->SetToolTipText("Enter the box name");
69  fShapeName->Associate(this);
70  AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
71 
72  TGTextEntry *nef;
73  MakeTitle("Tube dimensions");
74  TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
75  // Number entry for rmin
77  f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
78  fERmin = new TGNumberEntry(f1, 0., 5, kTUBE_RMIN);
81  nef->SetToolTipText("Enter the inner radius");
82  fERmin->Associate(this);
84  f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
85  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
86 
87  // Number entry for Rmax
88  f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
89  f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
90  fERmax = new TGNumberEntry(f1, 0., 5, kTUBE_RMAX);
93  nef->SetToolTipText("Enter the outer radius");
94  fERmax->Associate(this);
96  f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
97  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
98 
99  // Number entry for dz
100  f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
101  f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
102  fEDz = new TGNumberEntry(f1, 0., 5, kTUBE_Z);
104  nef = (TGTextEntry*)fEDz->GetNumberEntry();
105  nef->SetToolTipText("Enter the tube half-lenth in Z");
106  fEDz->Associate(this);
107  fEDz->Resize(100,fEDz->GetDefaultHeight());
108  f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
109  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
110 
111 // compxyz->Resize(150,30);
112  AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
113 
114  // Delayed draw
116  fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
117  fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
118  AddFrame(fDFrame, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
119 
120  // Buttons
121  fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
122  fApply = new TGTextButton(fBFrame, "Apply");
123  fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
124  fApply->Associate(this);
125  fUndo = new TGTextButton(fBFrame, "Undo");
126  fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
127  fUndo->Associate(this);
128  AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
130 }
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// Destructor
134 
136 {
137  TGFrameElement *el;
138  TIter next(GetList());
139  while ((el = (TGFrameElement *)next())) {
140  if (el->fFrame->IsComposite())
142  }
143  Cleanup();
144 }
145 
146 ////////////////////////////////////////////////////////////////////////////////
147 /// Connect signals to slots.
148 
150 {
151  fApply->Connect("Clicked()", "TGeoTubeEditor", this, "DoApply()");
152  fUndo->Connect("Clicked()", "TGeoTubeEditor", this, "DoUndo()");
153  fShapeName->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoModified()");
154  fERmin->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmin()");
155  fERmax->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmax()");
156  fEDz->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoDz()");
157  fERmin->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmin()");
158  fERmax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmax()");
159  fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoDz()");
160  fInit = kFALSE;
161 }
162 
163 
164 ////////////////////////////////////////////////////////////////////////////////
165 /// Connect to the selected object.
166 
168 {
169  if (obj == 0 || (obj->IsA()!=TGeoTube::Class())) {
170  SetActive(kFALSE);
171  return;
172  }
173  fShape = (TGeoTube*)obj;
174  fRmini = fShape->GetRmin();
175  fRmaxi = fShape->GetRmax();
176  fDzi = fShape->GetDz();
177  fNamei = fShape->GetName();
181  fEDz->SetNumber(fDzi);
184 
186  SetActive();
187 }
188 
189 ////////////////////////////////////////////////////////////////////////////////
190 /// Check if shape drawing is delayed.
191 
193 {
194  return (fDelayed->GetState() == kButtonDown);
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// Perform name change.
199 
201 {
202  DoModified();
203 }
204 
205 ////////////////////////////////////////////////////////////////////////////////
206 /// Slot for applying modifications.
207 
209 {
210  const char *name = fShapeName->GetText();
211  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
212  Double_t rmin = fERmin->GetNumber();
213  Double_t rmax = fERmax->GetNumber();
214  Double_t dz = fEDz->GetNumber();
215  fShape->SetTubeDimensions(rmin, rmax, dz);
216  fShape->ComputeBBox();
217  fUndo->SetEnabled();
219  if (fPad) {
221  fShape->Draw();
222  fPad->GetView()->ShowAxis();
223  } else Update();
224  }
225 }
226 
227 ////////////////////////////////////////////////////////////////////////////////
228 /// Slot for signaling modifications.
229 
231 {
232  fApply->SetEnabled();
233 }
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 /// Slot for undoing last operation.
237 
239 {
242  fEDz->SetNumber(fDzi);
243  DoApply();
246 }
247 
248 ////////////////////////////////////////////////////////////////////////////////
249 /// Slot for rmin.
250 
252 {
253  Double_t rmin = fERmin->GetNumber();
254  Double_t rmax = fERmax->GetNumber();
255  if (rmax<rmin+1.e-10) {
256  rmin = rmax - 0.1;
257  fERmin->SetNumber(rmin);
258  }
259  DoModified();
260  if (!IsDelayed()) DoApply();
261 }
262 
263 ////////////////////////////////////////////////////////////////////////////////
264 /// Slot for rmax.
265 
267 {
268  Double_t rmin = fERmin->GetNumber();
269  Double_t rmax = fERmax->GetNumber();
270  if (rmax <= 0.) {
271  rmax = 0.1;
272  fERmax->SetNumber(rmax);
273  }
274  if (rmax<rmin+1.e-10) {
275  rmax = rmin + 0.1;
276  fERmax->SetNumber(rmax);
277  }
278  DoModified();
279  if (!IsDelayed()) DoApply();
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Slot for dz.
284 
286 {
287  Double_t dz = fEDz->GetNumber();
288  if (dz<=0) {
289  dz = 0.1;
290  fEDz->SetNumber(dz);
291  }
292  DoModified();
293  if (!IsDelayed()) DoApply();
294 }
295 
296 //////////////////////////////////////////////////////////////////////////
297 // //
298 // TGeoTubeSegEditor //
299 // //
300 //////////////////////////////////////////////////////////////////////////
301 //Begin_Html
302 /*
303 <img src="gif/tubs_pic.gif">
304 */
305 //End_Html
306 //Begin_Html
307 /*
308 <img src="gif/tubs_ed.jpg">
309 */
310 //End_Html
311 
313 
316 };
317 
318 ////////////////////////////////////////////////////////////////////////////////
319 /// Constructor for tube segment editor
320 
322  Int_t height, UInt_t options, Pixel_t back)
323  : TGeoTubeEditor(p, width, height, options | kVerticalFrame, back)
324 {
325  fLock = kFALSE;
326  MakeTitle("Phi range");
327  TGTextEntry *nef;
329  // Vertical slider
330  fSPhi = new TGDoubleVSlider(compxyz,100);
331  fSPhi->SetRange(0.,720.);
332  fSPhi->Resize(fSPhi->GetDefaultWidth(), 100);
333  compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
334  TGCompositeFrame *f1 = new TGCompositeFrame(compxyz, 135, 100, kVerticalFrame | kFixedHeight);
335  f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
336  fEPhi1 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI1);
339  nef = (TGTextEntry*)fEPhi1->GetNumberEntry();
340  nef->SetToolTipText("Enter the phi1 value");
341  fEPhi1->Associate(this);
342  f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
343 
344  fEPhi2 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI2);
347  nef = (TGTextEntry*)fEPhi2->GetNumberEntry();
348  nef->SetToolTipText("Enter the phi2 value");
349  fEPhi2->Associate(this);
350  f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
351  f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
352  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
353 
354 // compxyz->Resize(150,150);
355  AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
358 }
359 
360 ////////////////////////////////////////////////////////////////////////////////
361 /// Destructor
362 
364 {
365  TGFrameElement *el;
366  TIter next(GetList());
367  while ((el = (TGFrameElement *)next())) {
368  if (el->fFrame->IsComposite())
370  }
371  Cleanup();
372 }
373 
374 ////////////////////////////////////////////////////////////////////////////////
375 /// Connect signals to slots.
376 
378 {
380  Disconnect(fApply, "Clicked()",(TGeoTubeEditor*)this, "DoApply()");
381  Disconnect(fUndo, "Clicked()",(TGeoTubeEditor*)this, "DoUndo()");
382  fApply->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoApply()");
383  fUndo->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoUndo()");
384  fEPhi1->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi1()");
385  fEPhi2->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi2()");
386 // fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi1()");
387 // fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi2()");
388  fSPhi->Connect("PositionChanged()","TGeoTubeSegEditor", this, "DoPhi()");
389 }
390 
391 ////////////////////////////////////////////////////////////////////////////////
392 /// Connect to the selected object.
393 
395 {
396  if (obj == 0 || (obj->IsA()!=TGeoTubeSeg::Class())) {
397  SetActive(kFALSE);
398  return;
399  }
400  fShape = (TGeoTube*)obj;
401  fRmini = fShape->GetRmin();
402  fRmaxi = fShape->GetRmax();
403  fDzi = fShape->GetDz();
404  fNamei = fShape->GetName();
405  fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
406  fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
413  fEDz->SetNumber(fDzi);
416 
418  SetActive();
419 }
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 /// Slot for phi1.
423 
425 {
426  Double_t phi1 = fEPhi1->GetNumber();
427  Double_t phi2 = fEPhi2->GetNumber();
428  if (phi1 > 360-1.e-10) {
429  phi1 = 0.;
430  fEPhi1->SetNumber(phi1);
431  }
432  if (phi2<phi1+1.e-10) {
433  phi1 = phi2 - 0.1;
434  fEPhi1->SetNumber(phi1);
435  }
436  if (!fLock) {
437  DoModified();
438  fLock = kTRUE;
439  fSPhi->SetPosition(phi1,phi2);
440  } else fLock = kFALSE;
441  if (!IsDelayed()) DoApply();
442 }
443 
444 ////////////////////////////////////////////////////////////////////////////////
445 /// Slot for phi2.
446 
448 {
449  Double_t phi1 = fEPhi1->GetNumber();
450  Double_t phi2 = fEPhi2->GetNumber();
451  if (phi2-phi1 > 360.) {
452  phi2 -= 360.;
453  fEPhi2->SetNumber(phi2);
454  }
455  if (phi2<phi1+1.e-10) {
456  phi2 = phi1 + 0.1;
457  fEPhi2->SetNumber(phi2);
458  }
459  if (!fLock) {
460  DoModified();
461  fLock = kTRUE;
462  fSPhi->SetPosition(phi1,phi2);
463  } else fLock = kFALSE;
464  if (!IsDelayed()) DoApply();
465 }
466 
467 ////////////////////////////////////////////////////////////////////////////////
468 /// Slot for phi slider.
469 
471 {
472  if (!fLock) {
473  DoModified();
474  fLock = kTRUE;
476  fLock = kTRUE;
478  } else fLock = kFALSE;
479  if (!IsDelayed()) DoApply();
480 }
481 
482 ////////////////////////////////////////////////////////////////////////////////
483 /// Slot for applying modifications.
484 
486 {
488  const char *name = fShapeName->GetText();
489  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
490  Double_t rmin = fERmin->GetNumber();
491  Double_t rmax = fERmax->GetNumber();
492  if (rmin<0 || rmax<rmin) return;
493  Double_t dz = fEDz->GetNumber();
494  Double_t phi1 = fEPhi1->GetNumber();
495  Double_t phi2 = fEPhi2->GetNumber();
496  if ((phi2-phi1) > 360.001) {
497  phi1 = 0.;
498  phi2 = 360.;
499  fEPhi1->SetNumber(phi1);
500  fEPhi2->SetNumber(phi2);
501  fLock = kTRUE;
502  fSPhi->SetPosition(phi1,phi2);
503  fLock = kFALSE;
504  }
505  ((TGeoTubeSeg*)fShape)->SetTubsDimensions(rmin, rmax, dz, phi1, phi2);
506  fShape->ComputeBBox();
507  fUndo->SetEnabled();
508  if (fPad) {
510  fShape->Draw();
511  fPad->GetView()->ShowAxis();
512  } else Update();
513  }
514 }
515 
516 ////////////////////////////////////////////////////////////////////////////////
517 /// Slot for undoing last operation.
518 
520 {
523  fEDz->SetNumber(fDzi);
527  DoApply();
530 }
531 
532 //////////////////////////////////////////////////////////////////////////
533 // //
534 // TGeoCtubEditor //
535 // //
536 //////////////////////////////////////////////////////////////////////////
537 //Begin_Html
538 /*
539 <img src="gif/ctub_pic.gif">
540 */
541 //End_Html
542 //Begin_Html
543 /*
544 <img src="gif/ctub_ed.jpg">
545 */
546 //End_Html
547 
549 
552 };
553 
554 ////////////////////////////////////////////////////////////////////////////////
555 /// Constructor for cut tube editor
556 
558  Int_t height, UInt_t options, Pixel_t back)
559  : TGeoTubeSegEditor(p, width, height, options, back)
560 {
561  MakeTitle("Theta/phi low");
562  TGTextEntry *nef;
563  // Number entry for theta/phi of the lower normal
564  TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
566  f1->AddFrame(new TGLabel(f1, "TH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
567  fEThlo = new TGNumberEntry(f1, 0., 5, kCTUB_THLO);
569  nef = (TGTextEntry*)fEThlo->GetNumberEntry();
570  nef->SetToolTipText("Enter the theta angle of the lower plane normal");
571  fEThlo->Associate(this);
572  fEThlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThlo()");
573  nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
575  f1->AddFrame(fEThlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
576  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
577 
578  f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
579  f1->AddFrame(new TGLabel(f1, "PH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
580  fEPhlo = new TGNumberEntry(f1, 0., 5, kCTUB_PHLO);
582  nef = (TGTextEntry*)fEPhlo->GetNumberEntry();
583  nef->SetToolTipText("Enter the phi angle of the lower plane normal");
584  fEPhlo->Associate(this);
585  fEPhlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhlo()");
586  nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
588  f1->AddFrame(fEPhlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
589  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
590  AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
591 
592  // Number entry for theta/phi of the lower normal
593  MakeTitle("Theta/phi high");
594  compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
595  f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
596  f1->AddFrame(new TGLabel(f1, "TH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
597  fEThhi = new TGNumberEntry(f1, 0., 5, kCTUB_THHI);
599  nef = (TGTextEntry*)fEThhi->GetNumberEntry();
600  nef->SetToolTipText("Enter the theta angle of the upper plane normal");
601  fEThhi->Associate(this);
602  fEThhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThhi()");
603  nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
605  f1->AddFrame(fEThhi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
606  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
607 
608  f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
609  f1->AddFrame(new TGLabel(f1, "PH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
610  fEPhhi = new TGNumberEntry(f1, 0., 5, kCTUB_PHHI);
612  nef = (TGTextEntry*)fEPhhi->GetNumberEntry();
613  nef->SetToolTipText("Enter the phi angle of the upper plane normal");
614  fEPhhi->Associate(this);
615  fEPhhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhhi()");
616  nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
618  f1->AddFrame(fEPhhi, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
619  compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
620  AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
623 }
624 
625 ////////////////////////////////////////////////////////////////////////////////
626 /// Destructor
627 
629 {
630  TGFrameElement *el;
631  TIter next(GetList());
632  while ((el = (TGFrameElement *)next())) {
633  if (el->fFrame->IsComposite())
635  }
636  Cleanup();
637 }
638 
639 ////////////////////////////////////////////////////////////////////////////////
640 /// Connect to the selected object.
641 
643 {
644  if (obj == 0 || (obj->IsA()!=TGeoCtub::Class())) {
645  SetActive(kFALSE);
646  return;
647  }
648  fShape = (TGeoTube*)obj;
649  fRmini = fShape->GetRmin();
650  fRmaxi = fShape->GetRmax();
651  fDzi = fShape->GetDz();
652  fNamei = fShape->GetName();
653  fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
654  fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
655  const Double_t *nlo = ((TGeoCtub*)fShape)->GetNlow();
656  const Double_t *nhi = ((TGeoCtub*)fShape)->GetNhigh();
657  fThlo = TMath::RadToDeg() * TMath::ACos(nlo[2]);
658  fPhlo = TMath::RadToDeg() * TMath::ATan2(nlo[1], nlo[0]);
659  fThhi = TMath::RadToDeg() * TMath::ACos(nhi[2]);
660  fPhhi = TMath::RadToDeg() * TMath::ATan2(nhi[1], nhi[0]);
661 
668  fEDz->SetNumber(fDzi);
675 
677  SetActive();
678 }
679 
680 ////////////////////////////////////////////////////////////////////////////////
681 /// Slot for phi1.
682 
684 {
685  Double_t thlo = fEThlo->GetNumber();
686  if (thlo <= 90.) {thlo = 91.; fEThlo->SetNumber(thlo);}
687  if (thlo > 180.) {thlo = 180.; fEThlo->SetNumber(thlo);}
688  DoModified();
689  if (!IsDelayed()) DoApply();
690 }
691 
692 ////////////////////////////////////////////////////////////////////////////////
693 /// Slot for phi1.
694 
696 {
697  Double_t phlo = fEPhlo->GetNumber();
698  if (phlo >= 360.) {
699  phlo = 0.;
700  fEPhlo->SetNumber(phlo);
701  }
702  DoModified();
703  if (!IsDelayed()) DoApply();
704 }
705 
706 ////////////////////////////////////////////////////////////////////////////////
707 /// Slot for phi1.
708 
710 {
711  Double_t thhi = fEThhi->GetNumber();
712  if (thhi >= 90.) {thhi = 89.; fEThhi->SetNumber(thhi);}
713  DoModified();
714  if (!IsDelayed()) DoApply();
715 }
716 
717 ////////////////////////////////////////////////////////////////////////////////
718 /// Slot for phi1.
719 
721 {
722  Double_t phhi = fEPhhi->GetNumber();
723  if (phhi >= 360.) {
724  phhi = 0.;
725  fEPhhi->SetNumber(phhi);
726  }
727  DoModified();
728  if (!IsDelayed()) DoApply();
729 }
730 
731 ////////////////////////////////////////////////////////////////////////////////
732 /// Slot for applying modifications.
733 
735 {
737  const char *name = fShapeName->GetText();
738  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
739  Double_t rmin = fERmin->GetNumber();
740  Double_t rmax = fERmax->GetNumber();
741  if (rmin<0 || rmax<rmin) return;
742  Double_t dz = fEDz->GetNumber();
743  Double_t phi1 = fEPhi1->GetNumber();
744  Double_t phi2 = fEPhi2->GetNumber();
745  if ((phi2-phi1) > 360.001) {
746  phi1 = 0.;
747  phi2 = 360.;
748  fEPhi1->SetNumber(phi1);
749  fEPhi2->SetNumber(phi2);
750  fLock = kTRUE;
751  fSPhi->SetPosition(phi1,phi2);
752  fLock = kFALSE;
753  }
758  Double_t lx = TMath::Sin(thlo)*TMath::Cos(phlo);
759  Double_t ly = TMath::Sin(thlo)*TMath::Sin(phlo);
760  Double_t lz = TMath::Cos(thlo);
761  Double_t tx = TMath::Sin(thhi)*TMath::Cos(phhi);
762  Double_t ty = TMath::Sin(thhi)*TMath::Sin(phhi);
763  Double_t tz = TMath::Cos(thhi);
764  ((TGeoCtub*)fShape)->SetCtubDimensions(rmin, rmax, dz, phi1, phi2, lx,ly,lz,tx,ty,tz);
765  fShape->ComputeBBox();
766  fUndo->SetEnabled();
767  if (fPad) {
769  fShape->Draw();
770  fPad->GetView()->ShowAxis();
771  } else Update();
772  }
773 }
774 
775 ////////////////////////////////////////////////////////////////////////////////
776 /// Slot for undoing last operation.
777 
779 {
782  fEDz->SetNumber(fDzi);
790 
791  DoApply();
794 }
virtual Float_t GetMinPosition() const
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
Bool_t fIsShapeEditable
TGeoTubeEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for tube editor.
Cylindrical tube class.
Definition: TGeoTube.h:19
TGNumberEntry * fEPhi2
virtual ~TGeoCtubEditor()
Destructor.
virtual Float_t GetMaxPosition() const
virtual void ComputeBBox()
compute bounding box of the tube
Definition: TGeoTube.cxx:210
TGNumberEntry * fERmax
void DoPhi1()
Slot for phi1.
Bool_t IsDelayed() const
Check if shape drawing is delayed.
void DoPhi()
Slot for phi slider.
void DoThlo()
Slot for phi1.
TVirtualGeoPainter * GetPainter() const
Definition: TGeoManager.h:187
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void DoUndo()
Slot for undoing last operation.
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
Double_t DegToRad()
Definition: TMath.h:50
virtual void SetNumber(Double_t val)
Double_t RadToDeg()
Definition: TMath.h:49
virtual Bool_t IsPaintingShape() const =0
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TGTextEntry * fShapeName
virtual Bool_t IsComposite() const
Definition: TGFrame.h:275
virtual void SetRange(Float_t min, Float_t max)
const char * Class
Definition: TXMLSetup.cxx:64
void DoThhi()
Slot for phi1.
TGeoCtubEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for cut tube editor.
void DoPhi2()
Slot for phi2.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hirarchically all daughters of a composite frame.
virtual Double_t GetRmax() const
Definition: TGeoTube.h:69
virtual void DoApply()
Slot for applying modifications.
TGNumberEntry * fEThhi
TGeoTubeSegEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for tube segment editor.
ULong_t Pixel_t
Definition: GuiTypes.h:41
void DoModified()
Slot for signaling modifications.
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TGCompositeFrame(const TGCompositeFrame &)
TGTextButton * fUndo
virtual TList * GetList() const
Definition: TGFrame.h:385
Double_t ATan2(Double_t, Double_t)
Definition: TMath.h:454
ETGeoCtubSegWid
virtual EButtonState GetState() const
Definition: TGButton.h:116
ETGeoTubeSegWid
TGCompositeFrame * fDFrame
virtual TView * GetView() const =0
virtual void SetModel(TObject *obj)
Connect to the selected object.
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:250
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1137
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
virtual ~TGeoTubeSegEditor()
Destructor.
virtual void SetSize(const TGDimension &s)
Definition: TGFrame.h:315
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
unsigned int UInt_t
Definition: RtypesCore.h:42
TGeoTube * fShape
TGNumberEntry * fEPhlo
TGFrame * fFrame
Definition: TGLayout.h:125
virtual void ShowAxis()=0
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:253
Double_t ACos(Double_t)
Definition: TMath.h:445
virtual void DoApply()
Slot for applying modifications.
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
void SetNumAttr(EAttribute attr=kNEAAnyNumber)
TGCheckButton * fDelayed
Double_t Cos(Double_t)
Definition: TMath.h:424
TGDimension GetSize() const
Definition: TGFrame.h:293
const char * GetText() const
Definition: TGTextEntry.h:140
A tube segment cut with 2 planes.
Definition: TGeoTube.h:170
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:254
void DoRmax()
Slot for rmax.
ETGeoTubeWid
virtual ~TGeoTubeEditor()
Destructor.
#define ClassImp(name)
Definition: Rtypes.h:279
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:554
double Double_t
Definition: RtypesCore.h:55
void DoDz()
Slot for dz.
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:409
virtual Double_t GetNumber() const
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1295
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void DoApply()
Slot for applying modifications.
TGNumberEntry * fEPhi1
TGNumberEntry * fERmin
TGTextButton * fApply
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void SetModel(TObject *obj)
Connect to the selected object.
TGDoubleVSlider * fSPhi
Bool_t fInit
Definition: TGedFrame.h:55
TGNumberEntryField * GetNumberEntry() const
virtual Double_t GetRmin() const
Definition: TGeoTube.h:68
void DoPhlo()
Slot for phi1.
TGNumberEntry * fEDz
virtual void ConnectSignals2Slots()
Connect signals to slots.
Double_t Sin(Double_t)
Definition: TMath.h:421
TGCompositeFrame * fBFrame
TF1 * f1
Definition: legend1.C:11
void DoPhhi()
Slot for phi1.
virtual void SetPosition(Float_t min, Float_t max)
virtual void Update()
Override Update from TGedFrame as fGedEditor can be null.
virtual void SetModel(TObject *obj)
Connect to the selected object.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line...
void DoRmin()
Slot for rmin.
TVirtualPad * fPad
Definition: TGeoGedFrame.h:28
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoShape.cxx:723
const Bool_t kTRUE
Definition: Rtypes.h:91
TGNumberEntry * fEThlo
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void ConnectSignals2Slots()
Connect signals to slots.
void DoName()
Perform name change.
void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz)
Set tube dimensions.
Definition: TGeoTube.cxx:910
virtual Double_t GetDz() const
Definition: TGeoTube.h:70
char name[80]
Definition: TGX11.cxx:109
UInt_t GetDefaultHeight() const
virtual void DoUndo()
Slot for undoing last operation.
TGNumberEntry * fEPhhi
virtual void DoUndo()
Slot for undoing last operation.
A phi segment of a tube.
Definition: TGeoTube.h:90