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
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor for tube editor
43
45 : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
46{
47 fShape = nullptr;
48 fRmini = fRmaxi = fDzi = 0.0;
49 fNamei = "";
52
53 // TextEntry for shape name
54 MakeTitle("Name");
55 fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTUBE_NAME);
57 fShapeName->SetToolTipText("Enter the box name");
58 fShapeName->Associate(this);
60
61 TGTextEntry *nef;
62 MakeTitle("Tube dimensions");
63 TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
64 // Number entry for rmin
66 f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
67 fERmin = new TGNumberEntry(f1, 0., 5, kTUBE_RMIN);
70 nef->SetToolTipText("Enter the inner radius");
71 fERmin->Associate(this);
73 f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
74 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
75
76 // Number entry for Rmax
77 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
78 f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
79 fERmax = new TGNumberEntry(f1, 0., 5, kTUBE_RMAX);
82 nef->SetToolTipText("Enter the outer radius");
83 fERmax->Associate(this);
85 f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
86 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
87
88 // Number entry for dz
89 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
90 f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
91 fEDz = new TGNumberEntry(f1, 0., 5, kTUBE_Z);
94 nef->SetToolTipText("Enter the tube half-lenth in Z");
95 fEDz->Associate(this);
97 f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
98 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
99
100 // compxyz->Resize(150,30);
101 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
102
103 // Delayed draw
105 fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
107 AddFrame(fDFrame, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
108
109 // Buttons
111 fApply = new TGTextButton(fBFrame, "Apply");
112 fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
113 fApply->Associate(this);
114 fUndo = new TGTextButton(fBFrame, "Undo");
115 fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
116 fUndo->Associate(this);
117 AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Destructor
123
125{
126 TGFrameElement *el;
127 TIter next(GetList());
128 while ((el = (TGFrameElement *)next())) {
129 if (el->fFrame->IsComposite())
131 }
132 Cleanup();
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Connect signals to slots.
137
139{
140 fApply->Connect("Clicked()", "TGeoTubeEditor", this, "DoApply()");
141 fUndo->Connect("Clicked()", "TGeoTubeEditor", this, "DoUndo()");
142 fShapeName->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoModified()");
143 fERmin->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmin()");
144 fERmax->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmax()");
145 fEDz->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoDz()");
146 fERmin->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmin()");
147 fERmax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmax()");
148 fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoDz()");
149 fInit = kFALSE;
150}
151
152////////////////////////////////////////////////////////////////////////////////
153/// Connect to the selected object.
154
156{
157 if (obj == nullptr || (obj->IsA() != TGeoTube::Class())) {
159 return;
160 }
161 fShape = (TGeoTube *)obj;
162 fRmini = fShape->GetRmin();
163 fRmaxi = fShape->GetRmax();
164 fDzi = fShape->GetDz();
165 fNamei = fShape->GetName();
172
173 if (fInit)
175 SetActive();
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Check if shape drawing is delayed.
180
182{
183 return (fDelayed->GetState() == kButtonDown);
184}
185
186////////////////////////////////////////////////////////////////////////////////
187/// Perform name change.
188
190{
191 DoModified();
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Slot for applying modifications.
196
198{
199 const char *name = fShapeName->GetText();
200 if (strcmp(name, fShape->GetName()))
202 Double_t rmin = fERmin->GetNumber();
203 Double_t rmax = fERmax->GetNumber();
204 Double_t dz = fEDz->GetNumber();
205 fShape->SetTubeDimensions(rmin, rmax, dz);
207 fUndo->SetEnabled();
209 if (fPad) {
211 fShape->Draw();
212 fPad->GetView()->ShowAxis();
213 } else
214 Update();
215 }
216}
217
218////////////////////////////////////////////////////////////////////////////////
219/// Slot for signaling modifications.
220
222{
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// Slot for undoing last operation.
228
230{
234 DoApply();
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Slot for rmin.
241
243{
244 Double_t rmin = fERmin->GetNumber();
245 Double_t rmax = fERmax->GetNumber();
246 if (rmax < rmin + 1.e-10) {
247 rmin = rmax - 0.1;
248 fERmin->SetNumber(rmin);
249 }
250 DoModified();
251 if (!IsDelayed())
252 DoApply();
253}
254
255////////////////////////////////////////////////////////////////////////////////
256/// Slot for rmax.
257
259{
260 Double_t rmin = fERmin->GetNumber();
261 Double_t rmax = fERmax->GetNumber();
262 if (rmax <= 0.) {
263 rmax = 0.1;
264 fERmax->SetNumber(rmax);
265 }
266 if (rmax < rmin + 1.e-10) {
267 rmax = rmin + 0.1;
268 fERmax->SetNumber(rmax);
269 }
270 DoModified();
271 if (!IsDelayed())
272 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())
287 DoApply();
288}
289
290/** \class TGeoTubeSegEditor
291\ingroup Geometry_builder
292
293Editor for a TGeoTubeSeg.
294
295\image html geom_tubs_pic.png
296
297\image html geom_tubs_ed.png
298
299*/
300
302
304
305////////////////////////////////////////////////////////////////////////////////
306/// Constructor for tube segment editor
307
309 : TGeoTubeEditor(p, width, height, options | kVerticalFrame, back)
310{
311 fLock = kFALSE;
312 MakeTitle("Phi range");
313 TGTextEntry *nef;
314 TGCompositeFrame *compxyz =
316 // Vertical slider
317 fSPhi = new TGDoubleVSlider(compxyz, 100);
318 fSPhi->SetRange(0., 720.);
320 compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
322 f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
323 fEPhi1 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI1);
327 nef->SetToolTipText("Enter the phi1 value");
328 fEPhi1->Associate(this);
329 f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
330
331 fEPhi2 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI2);
335 nef->SetToolTipText("Enter the phi2 value");
336 fEPhi2->Associate(this);
337 f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
338 f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
339 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
340
341 // compxyz->Resize(150,150);
342 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Destructor
349
351{
352 TGFrameElement *el;
353 TIter next(GetList());
354 while ((el = (TGFrameElement *)next())) {
355 if (el->fFrame->IsComposite())
357 }
358 Cleanup();
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Connect signals to slots.
363
365{
367 Disconnect(fApply, "Clicked()", (TGeoTubeEditor *)this, "DoApply()");
368 Disconnect(fUndo, "Clicked()", (TGeoTubeEditor *)this, "DoUndo()");
369 fApply->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoApply()");
370 fUndo->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoUndo()");
371 fEPhi1->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi1()");
372 fEPhi2->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi2()");
373 // fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi1()");
374 // fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi2()");
375 fSPhi->Connect("PositionChanged()", "TGeoTubeSegEditor", this, "DoPhi()");
376}
377
378////////////////////////////////////////////////////////////////////////////////
379/// Connect to the selected object.
380
382{
383 if (obj == nullptr || (obj->IsA() != TGeoTubeSeg::Class())) {
385 return;
386 }
387 fShape = (TGeoTube *)obj;
388 fRmini = fShape->GetRmin();
389 fRmaxi = fShape->GetRmax();
390 fDzi = fShape->GetDz();
391 fNamei = fShape->GetName();
392 fPmini = ((TGeoTubeSeg *)fShape)->GetPhi1();
393 fPmaxi = ((TGeoTubeSeg *)fShape)->GetPhi2();
403
404 if (fInit)
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
429 fLock = kFALSE;
430 if (!IsDelayed())
431 DoApply();
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Slot for phi2.
436
438{
439 Double_t phi1 = fEPhi1->GetNumber();
440 Double_t phi2 = fEPhi2->GetNumber();
441 if (phi2 - phi1 > 360.) {
442 phi2 -= 360.;
443 fEPhi2->SetNumber(phi2);
444 }
445 if (phi2 < phi1 + 1.e-10) {
446 phi2 = phi1 + 0.1;
447 fEPhi2->SetNumber(phi2);
448 }
449 if (!fLock) {
450 DoModified();
451 fLock = kTRUE;
452 fSPhi->SetPosition(phi1, phi2);
453 } else
454 fLock = kFALSE;
455 if (!IsDelayed())
456 DoApply();
457}
458
459////////////////////////////////////////////////////////////////////////////////
460/// Slot for phi slider.
461
463{
464 if (!fLock) {
465 DoModified();
466 fLock = kTRUE;
468 fLock = kTRUE;
470 } else
471 fLock = kFALSE;
472 if (!IsDelayed())
473 DoApply();
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Slot for applying modifications.
478
480{
482 const char *name = fShapeName->GetText();
483 if (strcmp(name, fShape->GetName()))
485 Double_t rmin = fERmin->GetNumber();
486 Double_t rmax = fERmax->GetNumber();
487 if (rmin < 0 || rmax < rmin)
488 return;
489 Double_t dz = fEDz->GetNumber();
490 Double_t phi1 = fEPhi1->GetNumber();
491 Double_t phi2 = fEPhi2->GetNumber();
492 if ((phi2 - phi1) > 360.001) {
493 phi1 = 0.;
494 phi2 = 360.;
495 fEPhi1->SetNumber(phi1);
496 fEPhi2->SetNumber(phi2);
497 fLock = kTRUE;
498 fSPhi->SetPosition(phi1, phi2);
499 fLock = kFALSE;
500 }
501 ((TGeoTubeSeg *)fShape)->SetTubsDimensions(rmin, rmax, dz, phi1, phi2);
503 fUndo->SetEnabled();
504 if (fPad) {
506 fShape->Draw();
507 fPad->GetView()->ShowAxis();
508 } else
509 Update();
510 }
511}
512
513////////////////////////////////////////////////////////////////////////////////
514/// Slot for undoing last operation.
515
517{
524 DoApply();
527}
528
529/** \class TGeoCtubEditor
530\ingroup Geometry_builder
531
532Editor for a TGeoCtub.
533
534\image html geom_ctub_pic.png
535
536\image html geom_ctub_ed.png
537
538*/
539
541
543
544////////////////////////////////////////////////////////////////////////////////
545/// Constructor for cut tube editor
546
548 : TGeoTubeSegEditor(p, width, height, options, back)
549{
550 MakeTitle("Theta/phi low");
551 TGTextEntry *nef;
552 // Number entry for theta/phi of the lower normal
553 TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
555 f1->AddFrame(new TGLabel(f1, "TH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
556 fEThlo = new TGNumberEntry(f1, 0., 5, kCTUB_THLO);
559 nef->SetToolTipText("Enter the theta angle of the lower plane normal");
560 fEThlo->Associate(this);
561 fEThlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThlo()");
562 nef->Connect("TextChanged(const char *)", "TGeoCtubEditor", this, "DoModified()");
564 f1->AddFrame(fEThlo, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
565 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
566
567 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
568 f1->AddFrame(new TGLabel(f1, "PH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
569 fEPhlo = new TGNumberEntry(f1, 0., 5, kCTUB_PHLO);
572 nef->SetToolTipText("Enter the phi angle of the lower plane normal");
573 fEPhlo->Associate(this);
574 fEPhlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhlo()");
575 nef->Connect("TextChanged(const char *)", "TGeoCtubEditor", this, "DoModified()");
577 f1->AddFrame(fEPhlo, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
578 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
579 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
580
581 // Number entry for theta/phi of the lower normal
582 MakeTitle("Theta/phi high");
583 compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
584 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
585 f1->AddFrame(new TGLabel(f1, "TH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
586 fEThhi = new TGNumberEntry(f1, 0., 5, kCTUB_THHI);
589 nef->SetToolTipText("Enter the theta angle of the upper plane normal");
590 fEThhi->Associate(this);
591 fEThhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThhi()");
592 nef->Connect("TextChanged(const char *)", "TGeoCtubEditor", this, "DoModified()");
594 f1->AddFrame(fEThhi, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
595 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
596
597 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
598 f1->AddFrame(new TGLabel(f1, "PH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
599 fEPhhi = new TGNumberEntry(f1, 0., 5, kCTUB_PHHI);
602 nef->SetToolTipText("Enter the phi angle of the upper plane normal");
603 fEPhhi->Associate(this);
604 fEPhhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhhi()");
605 nef->Connect("TextChanged(const char *)", "TGeoCtubEditor", this, "DoModified()");
607 f1->AddFrame(fEPhhi, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
608 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 4, 4));
609 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
612}
613
614////////////////////////////////////////////////////////////////////////////////
615/// Destructor
616
618{
619 TGFrameElement *el;
620 TIter next(GetList());
621 while ((el = (TGFrameElement *)next())) {
622 if (el->fFrame->IsComposite())
624 }
625 Cleanup();
626}
627
628////////////////////////////////////////////////////////////////////////////////
629/// Connect to the selected object.
630
632{
633 if (obj == nullptr || (obj->IsA() != TGeoCtub::Class())) {
635 return;
636 }
637 fShape = (TGeoTube *)obj;
638 fRmini = fShape->GetRmin();
639 fRmaxi = fShape->GetRmax();
640 fDzi = fShape->GetDz();
641 fNamei = fShape->GetName();
642 fPmini = ((TGeoTubeSeg *)fShape)->GetPhi1();
643 fPmaxi = ((TGeoTubeSeg *)fShape)->GetPhi2();
644 const Double_t *nlo = ((TGeoCtub *)fShape)->GetNlow();
645 const Double_t *nhi = ((TGeoCtub *)fShape)->GetNhigh();
646 fThlo = TMath::RadToDeg() * TMath::ACos(nlo[2]);
647 fPhlo = TMath::RadToDeg() * TMath::ATan2(nlo[1], nlo[0]);
648 fThhi = TMath::RadToDeg() * TMath::ACos(nhi[2]);
649 fPhhi = TMath::RadToDeg() * TMath::ATan2(nhi[1], nhi[0]);
650
664
665 if (fInit)
667 SetActive();
668}
669
670////////////////////////////////////////////////////////////////////////////////
671/// Slot for phi1.
672
674{
675 Double_t thlo = fEThlo->GetNumber();
676 if (thlo <= 90.) {
677 thlo = 91.;
678 fEThlo->SetNumber(thlo);
679 }
680 if (thlo > 180.) {
681 thlo = 180.;
682 fEThlo->SetNumber(thlo);
683 }
684 DoModified();
685 if (!IsDelayed())
686 DoApply();
687}
688
689////////////////////////////////////////////////////////////////////////////////
690/// Slot for phi1.
691
693{
694 Double_t phlo = fEPhlo->GetNumber();
695 if (phlo >= 360.) {
696 phlo = 0.;
697 fEPhlo->SetNumber(phlo);
698 }
699 DoModified();
700 if (!IsDelayed())
701 DoApply();
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// Slot for phi1.
706
708{
709 Double_t thhi = fEThhi->GetNumber();
710 if (thhi >= 90.) {
711 thhi = 89.;
712 fEThhi->SetNumber(thhi);
713 }
714 DoModified();
715 if (!IsDelayed())
716 DoApply();
717}
718
719////////////////////////////////////////////////////////////////////////////////
720/// Slot for phi1.
721
723{
724 Double_t phhi = fEPhhi->GetNumber();
725 if (phhi >= 360.) {
726 phhi = 0.;
727 fEPhhi->SetNumber(phhi);
728 }
729 DoModified();
730 if (!IsDelayed())
731 DoApply();
732}
733
734////////////////////////////////////////////////////////////////////////////////
735/// Slot for applying modifications.
736
738{
740 const char *name = fShapeName->GetText();
741 if (strcmp(name, fShape->GetName()))
743 Double_t rmin = fERmin->GetNumber();
744 Double_t rmax = fERmax->GetNumber();
745 if (rmin < 0 || rmax < rmin)
746 return;
747 Double_t dz = fEDz->GetNumber();
748 Double_t phi1 = fEPhi1->GetNumber();
749 Double_t phi2 = fEPhi2->GetNumber();
750 if ((phi2 - phi1) > 360.001) {
751 phi1 = 0.;
752 phi2 = 360.;
753 fEPhi1->SetNumber(phi1);
754 fEPhi2->SetNumber(phi2);
755 fLock = kTRUE;
756 fSPhi->SetPosition(phi1, phi2);
757 fLock = kFALSE;
758 }
763 Double_t lx = TMath::Sin(thlo) * TMath::Cos(phlo);
764 Double_t ly = TMath::Sin(thlo) * TMath::Sin(phlo);
765 Double_t lz = TMath::Cos(thlo);
766 Double_t tx = TMath::Sin(thhi) * TMath::Cos(phhi);
767 Double_t ty = TMath::Sin(thhi) * TMath::Sin(phhi);
768 Double_t tz = TMath::Cos(thhi);
769 ((TGeoCtub *)fShape)->SetCtubDimensions(rmin, rmax, dz, phi1, phi2, lx, ly, lz, tx, ty, tz);
771 fUndo->SetEnabled();
772 if (fPad) {
774 fShape->Draw();
775 fPad->GetView()->ShowAxis();
776 } else
777 Update();
778 }
779}
780
781////////////////////////////////////////////////////////////////////////////////
782/// Slot for undoing last operation.
783
785{
796
797 DoApply();
800}
@ 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
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
@ 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
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
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 void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TList * GetList() const
Definition TGFrame.h:310
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
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
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
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.
TGNumberEntryField * GetNumberEntry() const
Get the number entry field.
void Associate(const TGWindow *w) override
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)
UInt_t GetDefaultHeight() const override
@ 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.
void DoUndo() override
Slot for undoing last operation.
TGNumberEntry * fEPhlo
TGNumberEntry * fEPhhi
TGNumberEntry * fEThhi
TGNumberEntry * fEThlo
void DoPhlo()
Slot for phi1.
void DoThhi()
Slot for phi1.
~TGeoCtubEditor() override
Destructor.
TGeoCtubEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for cut tube editor.
void DoApply() override
Slot for applying modifications.
void SetModel(TObject *obj) override
Connect to the selected object.
void DoPhhi()
Slot for phi1.
void DoThlo()
Slot for phi1.
The cut tubes constructor has the form:
Definition TGeoTube.h:173
static TClass * Class()
Common base class for geombuilder editors.
void Update() override
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
void Draw(Option_t *option="") override
Draw this shape.
const char * GetName() const override
Get the shape name.
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 void ConnectSignals2Slots()
Connect signals to slots.
void DoRmax()
Slot for rmax.
void SetModel(TObject *obj) override
Connect to the selected object.
TGTextEntry * fShapeName
void DoRmin()
Slot for rmin.
TGCompositeFrame * fDFrame
~TGeoTubeEditor() override
Destructor.
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
TGeoTubeEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for tube editor.
void DoDz()
Slot for dz.
TGCheckButton * fDelayed
void DoName()
Perform name change.
TGNumberEntry * fERmin
Bool_t IsDelayed() const
Check if shape drawing is delayed.
TGeoTube * fShape
virtual void DoApply()
Slot for applying modifications.
Editor for a TGeoTubeSeg.
void DoApply() override
Slot for applying modifications.
TGeoTubeSegEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for tube segment editor.
TGDoubleVSlider * fSPhi
void DoPhi2()
Slot for phi2.
TGNumberEntry * fEPhi1
void ConnectSignals2Slots() override
Connect signals to slots.
~TGeoTubeSegEditor() override
Destructor.
void DoPhi1()
Slot for phi1.
TGNumberEntry * fEPhi2
void DoPhi()
Slot for phi slider.
void DoUndo() override
Slot for undoing last operation.
void SetModel(TObject *obj) override
Connect to the selected object.
A tube segment is a tube having a range in phi.
Definition TGeoTube.h:94
static TClass * Class()
Cylindrical tube class.
Definition TGeoTube.h:17
virtual Double_t GetRmin() const
Definition TGeoTube.h:72
static TClass * Class()
void SetTubeDimensions(Double_t rmin, Double_t rmax, Double_t dz)
Set tube dimensions.
Definition TGeoTube.cxx:960
virtual Double_t GetDz() const
Definition TGeoTube.h:74
void ComputeBBox() override
compute bounding box of the tube
Definition TGeoTube.cxx:224
virtual Double_t GetRmax() const
Definition TGeoTube.h:73
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
virtual TClass * IsA() const
Definition TObject.h:243
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=nullptr, void *receiver=nullptr, const char *slot=nullptr)
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)
Returns the principal value of the arc cosine of x, expressed in radians.
Definition TMath.h:632
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Definition TMath.h:646
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:79
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:594
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:588
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Definition TMath.h:72