Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/** \class TGeoTubeEditor
13\ingroup Geometry_builder
14
15Editor for a TGeoTube.
16
17\image html geom_tube_pic.png
18
19\image html geom_tube_ed.png
20
21*/
22
23#include "TGeoTubeEditor.h"
24#include "TGeoTabManager.h"
25#include "TGeoTube.h"
26#include "TGeoManager.h"
27#include "TVirtualGeoPainter.h"
28#include "TVirtualPad.h"
29#include "TView.h"
30#include "TMath.h"
31#include "TGButton.h"
32#include "TGTextEntry.h"
33#include "TGNumberEntry.h"
34#include "TGLabel.h"
35#include "TGDoubleSlider.h"
36
38
42};
43
44////////////////////////////////////////////////////////////////////////////////
45/// Constructor for tube editor
46
48 Int_t height, UInt_t options, Pixel_t back)
49 : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
50{
51 fShape = 0;
52 fRmini = fRmaxi = fDzi = 0.0;
53 fNamei = "";
56
57 // TextEntry for shape name
58 MakeTitle("Name");
59 fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTUBE_NAME);
61 fShapeName->SetToolTipText("Enter the box name");
62 fShapeName->Associate(this);
64
65 TGTextEntry *nef;
66 MakeTitle("Tube dimensions");
67 TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
68 // Number entry for rmin
70 f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
71 fERmin = new TGNumberEntry(f1, 0., 5, kTUBE_RMIN);
74 nef->SetToolTipText("Enter the inner radius");
75 fERmin->Associate(this);
77 f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
78 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
79
80 // Number entry for Rmax
81 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
82 f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
83 fERmax = new TGNumberEntry(f1, 0., 5, kTUBE_RMAX);
86 nef->SetToolTipText("Enter the outer radius");
87 fERmax->Associate(this);
89 f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
90 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
91
92 // Number entry for dz
93 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
94 f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
95 fEDz = new TGNumberEntry(f1, 0., 5, kTUBE_Z);
98 nef->SetToolTipText("Enter the tube half-lenth in Z");
99 fEDz->Associate(this);
101 f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
102 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
103
104// compxyz->Resize(150,30);
105 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
106
107 // Delayed draw
109 fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
111 AddFrame(fDFrame, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
112
113 // Buttons
115 fApply = new TGTextButton(fBFrame, "Apply");
116 fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
117 fApply->Associate(this);
118 fUndo = new TGTextButton(fBFrame, "Undo");
119 fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
120 fUndo->Associate(this);
121 AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Destructor
127
129{
130 TGFrameElement *el;
131 TIter next(GetList());
132 while ((el = (TGFrameElement *)next())) {
133 if (el->fFrame->IsComposite())
135 }
136 Cleanup();
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// Connect signals to slots.
141
143{
144 fApply->Connect("Clicked()", "TGeoTubeEditor", this, "DoApply()");
145 fUndo->Connect("Clicked()", "TGeoTubeEditor", this, "DoUndo()");
146 fShapeName->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoModified()");
147 fERmin->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmin()");
148 fERmax->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmax()");
149 fEDz->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoDz()");
150 fERmin->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmin()");
151 fERmax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmax()");
152 fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoDz()");
153 fInit = kFALSE;
154}
155
156
157////////////////////////////////////////////////////////////////////////////////
158/// Connect to the selected object.
159
161{
162 if (obj == 0 || (obj->IsA()!=TGeoTube::Class())) {
164 return;
165 }
166 fShape = (TGeoTube*)obj;
167 fRmini = fShape->GetRmin();
168 fRmaxi = fShape->GetRmax();
169 fDzi = fShape->GetDz();
170 fNamei = fShape->GetName();
177
179 SetActive();
180}
181
182////////////////////////////////////////////////////////////////////////////////
183/// Check if shape drawing is delayed.
184
186{
187 return (fDelayed->GetState() == kButtonDown);
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Perform name change.
192
194{
195 DoModified();
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Slot for applying modifications.
200
202{
203 const char *name = fShapeName->GetText();
204 if (strcmp(name,fShape->GetName())) fShape->SetName(name);
205 Double_t rmin = fERmin->GetNumber();
206 Double_t rmax = fERmax->GetNumber();
207 Double_t dz = fEDz->GetNumber();
208 fShape->SetTubeDimensions(rmin, rmax, dz);
210 fUndo->SetEnabled();
212 if (fPad) {
214 fShape->Draw();
215 fPad->GetView()->ShowAxis();
216 } else Update();
217 }
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Slot for signaling modifications.
222
224{
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Slot for undoing last operation.
230
232{
236 DoApply();
239}
240
241////////////////////////////////////////////////////////////////////////////////
242/// Slot for rmin.
243
245{
246 Double_t rmin = fERmin->GetNumber();
247 Double_t rmax = fERmax->GetNumber();
248 if (rmax<rmin+1.e-10) {
249 rmin = rmax - 0.1;
250 fERmin->SetNumber(rmin);
251 }
252 DoModified();
253 if (!IsDelayed()) DoApply();
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Slot for rmax.
258
260{
261 Double_t rmin = fERmin->GetNumber();
262 Double_t rmax = fERmax->GetNumber();
263 if (rmax <= 0.) {
264 rmax = 0.1;
265 fERmax->SetNumber(rmax);
266 }
267 if (rmax<rmin+1.e-10) {
268 rmax = rmin + 0.1;
269 fERmax->SetNumber(rmax);
270 }
271 DoModified();
272 if (!IsDelayed()) DoApply();
273}
274
275////////////////////////////////////////////////////////////////////////////////
276/// Slot for dz.
277
279{
280 Double_t dz = fEDz->GetNumber();
281 if (dz<=0) {
282 dz = 0.1;
283 fEDz->SetNumber(dz);
284 }
285 DoModified();
286 if (!IsDelayed()) DoApply();
287}
288
289/** \class TGeoTubeSegEditor
290\ingroup Geometry_builder
291
292Editor for a TGeoTubeSeg.
293
294\image html geom_tubs_pic.png
295
296\image html geom_tubs_ed.png
297
298*/
299
301
305
306////////////////////////////////////////////////////////////////////////////////
307/// Constructor for tube segment editor
308
310 Int_t height, UInt_t options, Pixel_t back)
311 : TGeoTubeEditor(p, width, height, options | kVerticalFrame, back)
312{
313 fLock = kFALSE;
314 MakeTitle("Phi range");
315 TGTextEntry *nef;
317 // Vertical slider
318 fSPhi = new TGDoubleVSlider(compxyz,100);
319 fSPhi->SetRange(0.,720.);
321 compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
323 f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
324 fEPhi1 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI1);
328 nef->SetToolTipText("Enter the phi1 value");
329 fEPhi1->Associate(this);
330 f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
331
332 fEPhi2 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI2);
336 nef->SetToolTipText("Enter the phi2 value");
337 fEPhi2->Associate(this);
338 f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
339 f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
340 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
341
342// compxyz->Resize(150,150);
343 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
346}
347
348////////////////////////////////////////////////////////////////////////////////
349/// Destructor
350
352{
353 TGFrameElement *el;
354 TIter next(GetList());
355 while ((el = (TGFrameElement *)next())) {
356 if (el->fFrame->IsComposite())
358 }
359 Cleanup();
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Connect signals to slots.
364
366{
368 Disconnect(fApply, "Clicked()",(TGeoTubeEditor*)this, "DoApply()");
369 Disconnect(fUndo, "Clicked()",(TGeoTubeEditor*)this, "DoUndo()");
370 fApply->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoApply()");
371 fUndo->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoUndo()");
372 fEPhi1->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi1()");
373 fEPhi2->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi2()");
374// fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi1()");
375// fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi2()");
376 fSPhi->Connect("PositionChanged()","TGeoTubeSegEditor", this, "DoPhi()");
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// Connect to the selected object.
381
383{
384 if (obj == 0 || (obj->IsA()!=TGeoTubeSeg::Class())) {
386 return;
387 }
388 fShape = (TGeoTube*)obj;
389 fRmini = fShape->GetRmin();
390 fRmaxi = fShape->GetRmax();
391 fDzi = fShape->GetDz();
392 fNamei = fShape->GetName();
393 fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
394 fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
404
406 SetActive();
407}
408
409////////////////////////////////////////////////////////////////////////////////
410/// Slot for phi1.
411
413{
414 Double_t phi1 = fEPhi1->GetNumber();
415 Double_t phi2 = fEPhi2->GetNumber();
416 if (phi1 > 360-1.e-10) {
417 phi1 = 0.;
418 fEPhi1->SetNumber(phi1);
419 }
420 if (phi2<phi1+1.e-10) {
421 phi1 = phi2 - 0.1;
422 fEPhi1->SetNumber(phi1);
423 }
424 if (!fLock) {
425 DoModified();
426 fLock = kTRUE;
427 fSPhi->SetPosition(phi1,phi2);
428 } else fLock = kFALSE;
429 if (!IsDelayed()) DoApply();
430}
431
432////////////////////////////////////////////////////////////////////////////////
433/// Slot for phi2.
434
436{
437 Double_t phi1 = fEPhi1->GetNumber();
438 Double_t phi2 = fEPhi2->GetNumber();
439 if (phi2-phi1 > 360.) {
440 phi2 -= 360.;
441 fEPhi2->SetNumber(phi2);
442 }
443 if (phi2<phi1+1.e-10) {
444 phi2 = phi1 + 0.1;
445 fEPhi2->SetNumber(phi2);
446 }
447 if (!fLock) {
448 DoModified();
449 fLock = kTRUE;
450 fSPhi->SetPosition(phi1,phi2);
451 } else fLock = kFALSE;
452 if (!IsDelayed()) DoApply();
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Slot for phi slider.
457
459{
460 if (!fLock) {
461 DoModified();
462 fLock = kTRUE;
464 fLock = kTRUE;
466 } else fLock = kFALSE;
467 if (!IsDelayed()) DoApply();
468}
469
470////////////////////////////////////////////////////////////////////////////////
471/// Slot for applying modifications.
472
474{
476 const char *name = fShapeName->GetText();
477 if (strcmp(name,fShape->GetName())) fShape->SetName(name);
478 Double_t rmin = fERmin->GetNumber();
479 Double_t rmax = fERmax->GetNumber();
480 if (rmin<0 || rmax<rmin) return;
481 Double_t dz = fEDz->GetNumber();
482 Double_t phi1 = fEPhi1->GetNumber();
483 Double_t phi2 = fEPhi2->GetNumber();
484 if ((phi2-phi1) > 360.001) {
485 phi1 = 0.;
486 phi2 = 360.;
487 fEPhi1->SetNumber(phi1);
488 fEPhi2->SetNumber(phi2);
489 fLock = kTRUE;
490 fSPhi->SetPosition(phi1,phi2);
491 fLock = kFALSE;
492 }
493 ((TGeoTubeSeg*)fShape)->SetTubsDimensions(rmin, rmax, dz, phi1, phi2);
495 fUndo->SetEnabled();
496 if (fPad) {
498 fShape->Draw();
499 fPad->GetView()->ShowAxis();
500 } else Update();
501 }
502}
503
504////////////////////////////////////////////////////////////////////////////////
505/// Slot for undoing last operation.
506
508{
515 DoApply();
518}
519
520/** \class TGeoCtubEditor
521\ingroup Geometry_builder
522
523Editor for a TGeoCtub.
524
525\image html geom_ctub_pic.png
526
527\image html geom_ctub_ed.png
528
529*/
530
532
536
537////////////////////////////////////////////////////////////////////////////////
538/// Constructor for cut tube editor
539
541 Int_t height, UInt_t options, Pixel_t back)
542 : TGeoTubeSegEditor(p, width, height, options, back)
543{
544 MakeTitle("Theta/phi low");
545 TGTextEntry *nef;
546 // Number entry for theta/phi of the lower normal
547 TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
549 f1->AddFrame(new TGLabel(f1, "TH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
550 fEThlo = new TGNumberEntry(f1, 0., 5, kCTUB_THLO);
553 nef->SetToolTipText("Enter the theta angle of the lower plane normal");
554 fEThlo->Associate(this);
555 fEThlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThlo()");
556 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
558 f1->AddFrame(fEThlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
559 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
560
561 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
562 f1->AddFrame(new TGLabel(f1, "PH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
563 fEPhlo = new TGNumberEntry(f1, 0., 5, kCTUB_PHLO);
566 nef->SetToolTipText("Enter the phi angle of the lower plane normal");
567 fEPhlo->Associate(this);
568 fEPhlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhlo()");
569 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
571 f1->AddFrame(fEPhlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
572 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
573 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
574
575 // Number entry for theta/phi of the lower normal
576 MakeTitle("Theta/phi high");
577 compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
578 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
579 f1->AddFrame(new TGLabel(f1, "TH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
580 fEThhi = new TGNumberEntry(f1, 0., 5, kCTUB_THHI);
583 nef->SetToolTipText("Enter the theta angle of the upper plane normal");
584 fEThhi->Associate(this);
585 fEThhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThhi()");
586 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
588 f1->AddFrame(fEThhi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
589 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
590
591 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
592 f1->AddFrame(new TGLabel(f1, "PH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
593 fEPhhi = new TGNumberEntry(f1, 0., 5, kCTUB_PHHI);
596 nef->SetToolTipText("Enter the phi angle of the upper plane normal");
597 fEPhhi->Associate(this);
598 fEPhhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhhi()");
599 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
601 f1->AddFrame(fEPhhi, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
602 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
603 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
606}
607
608////////////////////////////////////////////////////////////////////////////////
609/// Destructor
610
612{
613 TGFrameElement *el;
614 TIter next(GetList());
615 while ((el = (TGFrameElement *)next())) {
616 if (el->fFrame->IsComposite())
618 }
619 Cleanup();
620}
621
622////////////////////////////////////////////////////////////////////////////////
623/// Connect to the selected object.
624
626{
627 if (obj == 0 || (obj->IsA()!=TGeoCtub::Class())) {
629 return;
630 }
631 fShape = (TGeoTube*)obj;
632 fRmini = fShape->GetRmin();
633 fRmaxi = fShape->GetRmax();
634 fDzi = fShape->GetDz();
635 fNamei = fShape->GetName();
636 fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
637 fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
638 const Double_t *nlo = ((TGeoCtub*)fShape)->GetNlow();
639 const Double_t *nhi = ((TGeoCtub*)fShape)->GetNhigh();
640 fThlo = TMath::RadToDeg() * TMath::ACos(nlo[2]);
641 fPhlo = TMath::RadToDeg() * TMath::ATan2(nlo[1], nlo[0]);
642 fThhi = TMath::RadToDeg() * TMath::ACos(nhi[2]);
643 fPhhi = TMath::RadToDeg() * TMath::ATan2(nhi[1], nhi[0]);
644
658
660 SetActive();
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// Slot for phi1.
665
667{
668 Double_t thlo = fEThlo->GetNumber();
669 if (thlo <= 90.) {thlo = 91.; fEThlo->SetNumber(thlo);}
670 if (thlo > 180.) {thlo = 180.; fEThlo->SetNumber(thlo);}
671 DoModified();
672 if (!IsDelayed()) DoApply();
673}
674
675////////////////////////////////////////////////////////////////////////////////
676/// Slot for phi1.
677
679{
680 Double_t phlo = fEPhlo->GetNumber();
681 if (phlo >= 360.) {
682 phlo = 0.;
683 fEPhlo->SetNumber(phlo);
684 }
685 DoModified();
686 if (!IsDelayed()) DoApply();
687}
688
689////////////////////////////////////////////////////////////////////////////////
690/// Slot for phi1.
691
693{
694 Double_t thhi = fEThhi->GetNumber();
695 if (thhi >= 90.) {thhi = 89.; fEThhi->SetNumber(thhi);}
696 DoModified();
697 if (!IsDelayed()) DoApply();
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Slot for phi1.
702
704{
705 Double_t phhi = fEPhhi->GetNumber();
706 if (phhi >= 360.) {
707 phhi = 0.;
708 fEPhhi->SetNumber(phhi);
709 }
710 DoModified();
711 if (!IsDelayed()) DoApply();
712}
713
714////////////////////////////////////////////////////////////////////////////////
715/// Slot for applying modifications.
716
718{
720 const char *name = fShapeName->GetText();
721 if (strcmp(name,fShape->GetName())) fShape->SetName(name);
722 Double_t rmin = fERmin->GetNumber();
723 Double_t rmax = fERmax->GetNumber();
724 if (rmin<0 || rmax<rmin) return;
725 Double_t dz = fEDz->GetNumber();
726 Double_t phi1 = fEPhi1->GetNumber();
727 Double_t phi2 = fEPhi2->GetNumber();
728 if ((phi2-phi1) > 360.001) {
729 phi1 = 0.;
730 phi2 = 360.;
731 fEPhi1->SetNumber(phi1);
732 fEPhi2->SetNumber(phi2);
733 fLock = kTRUE;
734 fSPhi->SetPosition(phi1,phi2);
735 fLock = kFALSE;
736 }
741 Double_t lx = TMath::Sin(thlo)*TMath::Cos(phlo);
742 Double_t ly = TMath::Sin(thlo)*TMath::Sin(phlo);
743 Double_t lz = TMath::Cos(thlo);
744 Double_t tx = TMath::Sin(thhi)*TMath::Cos(phhi);
745 Double_t ty = TMath::Sin(thhi)*TMath::Sin(phhi);
746 Double_t tz = TMath::Cos(thhi);
747 ((TGeoCtub*)fShape)->SetCtubDimensions(rmin, rmax, dz, phi1, phi2, lx,ly,lz,tx,ty,tz);
749 fUndo->SetEnabled();
750 if (fPad) {
752 fShape->Draw();
753 fPad->GetView()->ShowAxis();
754 } else Update();
755 }
756}
757
758////////////////////////////////////////////////////////////////////////////////
759/// Slot for undoing last operation.
760
762{
773
774 DoApply();
777}
@ kRaisedFrame
Definition GuiTypes.h:384
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
const Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
@ kButtonDown
Definition TGButton.h:54
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
ETGeoTubeSegWid
@ kTUBESEG_PHI1
@ kTUBESEG_PHI2
@ kTUBESEG_PHI
ETGeoTubeWid
@ kTUBE_RMAX
@ kTUBE_UNDO
@ kTUBE_NAME
@ kTUBE_APPLY
@ kTUBE_Z
@ kTUBE_RMIN
ETGeoCtubSegWid
@ kCTUB_THLO
@ kCTUB_PHHI
@ kCTUB_PHLO
@ kCTUB_THHI
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:459
Selects different options.
Definition TGButton.h:264
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual TList * GetList() const
Definition TGFrame.h:310
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:967
virtual Float_t GetMaxPosition() const
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
Dragging the slider will generate the event:
TGFrame * fFrame
Definition TGLayout.h:112
virtual void SetSize(const TGDimension &s)
Definition TGFrame.h:252
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
TGDimension GetSize() const
Definition TGFrame.h:230
virtual Bool_t IsComposite() const
Definition TGFrame.h:212
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:605
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
UInt_t GetDefaultHeight() const
TGNumberEntryField * GetNumberEntry() const
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
void SetNumAttr(EAttribute attr=kNEAAnyNumber)
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEAPositive
Positive number.
@ kNEANonNegative
Non-negative number.
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
const char * GetText() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
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.
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:95
Editor for a TGeoCtub.
TGNumberEntry * fEPhlo
TGNumberEntry * fEPhhi
virtual void SetModel(TObject *obj)
Connect to the selected object.
TGNumberEntry * fEThhi
TGNumberEntry * fEThlo
virtual void DoUndo()
Slot for undoing last operation.
void DoPhlo()
Slot for phi1.
virtual void DoApply()
Slot for applying modifications.
virtual ~TGeoCtubEditor()
Destructor.
void DoThhi()
Slot for phi1.
void DoPhhi()
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 DoThlo()
Slot for phi1.
The cut tubes constructor has the form:
Definition TGeoTube.h:172
Common base class for geombuilder editors.
virtual void Update()
Override Update from TGedFrame as fGedEditor can be null.
TVirtualPad * fPad
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TVirtualGeoPainter * GetPainter() const
virtual const char * GetName() const
Get the shape name.
virtual void Draw(Option_t *option="")
Draw this shape.
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hierarchically all daughters of a composite frame.
Editor for a TGeoTube.
virtual ~TGeoTubeEditor()
Destructor.
virtual void ConnectSignals2Slots()
Connect signals to slots.
void DoRmax()
Slot for rmax.
TGTextEntry * fShapeName
void DoRmin()
Slot for rmin.
TGCompositeFrame * fDFrame
Bool_t fIsShapeEditable
TGTextButton * fUndo
void DoModified()
Slot for signaling modifications.
TGTextButton * fApply
TGCompositeFrame * fBFrame
TGNumberEntry * fEDz
virtual void DoUndo()
Slot for undoing last operation.
TGNumberEntry * fERmax
void DoDz()
Slot for dz.
TGCheckButton * fDelayed
void DoName()
Perform name change.
virtual void SetModel(TObject *obj)
Connect to the selected object.
TGNumberEntry * fERmin
Bool_t IsDelayed() const
Check if shape drawing is delayed.
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.
TGeoTube * fShape
virtual void DoApply()
Slot for applying modifications.
Editor for a TGeoTubeSeg.
TGDoubleVSlider * fSPhi
virtual void DoUndo()
Slot for undoing last operation.
virtual ~TGeoTubeSegEditor()
Destructor.
virtual void DoApply()
Slot for applying modifications.
void DoPhi2()
Slot for phi2.
TGNumberEntry * fEPhi1
virtual void SetModel(TObject *obj)
Connect to the selected object.
virtual void ConnectSignals2Slots()
Connect signals to slots.
void DoPhi1()
Slot for phi1.
TGNumberEntry * fEPhi2
void DoPhi()
Slot for phi slider.
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.
A tube segment is a tube having a range in phi.
Definition TGeoTube.h:92
Cylindrical tube class.
Definition TGeoTube.h:18
virtual Double_t GetRmin() const
Definition TGeoTube.h:69
void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz)
Set tube dimensions.
Definition TGeoTube.cxx:929
virtual Double_t GetDz() const
Definition TGeoTube.h:71
virtual void ComputeBBox()
compute bounding box of the tube
Definition TGeoTube.cxx:231
virtual Double_t GetRmax() const
Definition TGeoTube.h:70
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
Mother of all ROOT objects.
Definition TObject.h:41
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:869
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
virtual void ShowAxis()=0
virtual Bool_t IsPaintingShape() const =0
virtual TView * GetView() const =0
TF1 * f1
Definition legend1.C:11
Double_t ACos(Double_t)
Definition TMath.h:619
Double_t ATan2(Double_t y, Double_t x)
Definition TMath.h:629
constexpr Double_t DegToRad()
Conversion from degree to radian:
Definition TMath.h:81
Double_t Cos(Double_t)
Definition TMath.h:593
Double_t Sin(Double_t)
Definition TMath.h:589
constexpr Double_t RadToDeg()
Conversion from radian to degree:
Definition TMath.h:73