Logo ROOT  
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/** \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 "TPad.h"
29#include "TView.h"
30#include "TGTab.h"
31#include "TMath.h"
32#include "TGComboBox.h"
33#include "TGButton.h"
34#include "TGTextEntry.h"
35#include "TGNumberEntry.h"
36#include "TGLabel.h"
37#include "TGDoubleSlider.h"
38
40
44};
45
46////////////////////////////////////////////////////////////////////////////////
47/// Constructor for tube editor
48
50 Int_t height, UInt_t options, Pixel_t back)
51 : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
52{
53 fShape = 0;
54 fRmini = fRmaxi = fDzi = 0.0;
55 fNamei = "";
58
59 // TextEntry for shape name
60 MakeTitle("Name");
61 fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTUBE_NAME);
63 fShapeName->SetToolTipText("Enter the box name");
64 fShapeName->Associate(this);
66
67 TGTextEntry *nef;
68 MakeTitle("Tube dimensions");
69 TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
70 // Number entry for rmin
72 f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
73 fERmin = new TGNumberEntry(f1, 0., 5, kTUBE_RMIN);
76 nef->SetToolTipText("Enter the inner radius");
77 fERmin->Associate(this);
79 f1->AddFrame(fERmin, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
80 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
81
82 // Number entry for Rmax
83 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
84 f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
85 fERmax = new TGNumberEntry(f1, 0., 5, kTUBE_RMAX);
88 nef->SetToolTipText("Enter the outer radius");
89 fERmax->Associate(this);
91 f1->AddFrame(fERmax, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
92 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
93
94 // Number entry for dz
95 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
96 f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
97 fEDz = new TGNumberEntry(f1, 0., 5, kTUBE_Z);
100 nef->SetToolTipText("Enter the tube half-lenth in Z");
101 fEDz->Associate(this);
103 f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
104 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
105
106// compxyz->Resize(150,30);
107 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
108
109 // Delayed draw
111 fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
113 AddFrame(fDFrame, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
114
115 // Buttons
117 fApply = new TGTextButton(fBFrame, "Apply");
118 fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
119 fApply->Associate(this);
120 fUndo = new TGTextButton(fBFrame, "Undo");
121 fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
122 fUndo->Associate(this);
123 AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Destructor
129
131{
132 TGFrameElement *el;
133 TIter next(GetList());
134 while ((el = (TGFrameElement *)next())) {
135 if (el->fFrame->IsComposite())
137 }
138 Cleanup();
139}
140
141////////////////////////////////////////////////////////////////////////////////
142/// Connect signals to slots.
143
145{
146 fApply->Connect("Clicked()", "TGeoTubeEditor", this, "DoApply()");
147 fUndo->Connect("Clicked()", "TGeoTubeEditor", this, "DoUndo()");
148 fShapeName->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoModified()");
149 fERmin->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmin()");
150 fERmax->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoRmax()");
151 fEDz->Connect("ValueSet(Long_t)", "TGeoTubeEditor", this, "DoDz()");
152 fERmin->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmin()");
153 fERmax->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoRmax()");
154 fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTubeEditor", this, "DoDz()");
155 fInit = kFALSE;
156}
157
158
159////////////////////////////////////////////////////////////////////////////////
160/// Connect to the selected object.
161
163{
164 if (obj == 0 || (obj->IsA()!=TGeoTube::Class())) {
166 return;
167 }
168 fShape = (TGeoTube*)obj;
169 fRmini = fShape->GetRmin();
170 fRmaxi = fShape->GetRmax();
171 fDzi = fShape->GetDz();
172 fNamei = fShape->GetName();
179
181 SetActive();
182}
183
184////////////////////////////////////////////////////////////////////////////////
185/// Check if shape drawing is delayed.
186
188{
189 return (fDelayed->GetState() == kButtonDown);
190}
191
192////////////////////////////////////////////////////////////////////////////////
193/// Perform name change.
194
196{
197 DoModified();
198}
199
200////////////////////////////////////////////////////////////////////////////////
201/// Slot for applying modifications.
202
204{
205 const char *name = fShapeName->GetText();
206 if (strcmp(name,fShape->GetName())) fShape->SetName(name);
207 Double_t rmin = fERmin->GetNumber();
208 Double_t rmax = fERmax->GetNumber();
209 Double_t dz = fEDz->GetNumber();
210 fShape->SetTubeDimensions(rmin, rmax, dz);
212 fUndo->SetEnabled();
214 if (fPad) {
216 fShape->Draw();
217 fPad->GetView()->ShowAxis();
218 } else Update();
219 }
220}
221
222////////////////////////////////////////////////////////////////////////////////
223/// Slot for signaling modifications.
224
226{
228}
229
230////////////////////////////////////////////////////////////////////////////////
231/// Slot for undoing last operation.
232
234{
238 DoApply();
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// Slot for rmin.
245
247{
248 Double_t rmin = fERmin->GetNumber();
249 Double_t rmax = fERmax->GetNumber();
250 if (rmax<rmin+1.e-10) {
251 rmin = rmax - 0.1;
252 fERmin->SetNumber(rmin);
253 }
254 DoModified();
255 if (!IsDelayed()) DoApply();
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// Slot for rmax.
260
262{
263 Double_t rmin = fERmin->GetNumber();
264 Double_t rmax = fERmax->GetNumber();
265 if (rmax <= 0.) {
266 rmax = 0.1;
267 fERmax->SetNumber(rmax);
268 }
269 if (rmax<rmin+1.e-10) {
270 rmax = rmin + 0.1;
271 fERmax->SetNumber(rmax);
272 }
273 DoModified();
274 if (!IsDelayed()) DoApply();
275}
276
277////////////////////////////////////////////////////////////////////////////////
278/// Slot for dz.
279
281{
282 Double_t dz = fEDz->GetNumber();
283 if (dz<=0) {
284 dz = 0.1;
285 fEDz->SetNumber(dz);
286 }
287 DoModified();
288 if (!IsDelayed()) DoApply();
289}
290
291/** \class TGeoTubeSegEditor
292\ingroup Geometry_builder
293
294Editor for a TGeoTubeSeg.
295
296\image html geom_tubs_pic.png
297
298\image html geom_tubs_ed.png
299
300*/
301
303
307
308////////////////////////////////////////////////////////////////////////////////
309/// Constructor for tube segment editor
310
312 Int_t height, UInt_t options, Pixel_t back)
313 : TGeoTubeEditor(p, width, height, options | kVerticalFrame, back)
314{
315 fLock = kFALSE;
316 MakeTitle("Phi range");
317 TGTextEntry *nef;
319 // Vertical slider
320 fSPhi = new TGDoubleVSlider(compxyz,100);
321 fSPhi->SetRange(0.,720.);
323 compxyz->AddFrame(fSPhi, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
325 f1->AddFrame(new TGLabel(f1, "Phi min."), new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 6, 0));
326 fEPhi1 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI1);
330 nef->SetToolTipText("Enter the phi1 value");
331 fEPhi1->Associate(this);
332 f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 2, 2, 2));
333
334 fEPhi2 = new TGNumberEntry(f1, 0., 5, kTUBESEG_PHI2);
338 nef->SetToolTipText("Enter the phi2 value");
339 fEPhi2->Associate(this);
340 f1->AddFrame(fEPhi2, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 2, 2));
341 f1->AddFrame(new TGLabel(f1, "Phi max."), new TGLayoutHints(kLHintsBottom, 0, 0, 6, 2));
342 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
343
344// compxyz->Resize(150,150);
345 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
348}
349
350////////////////////////////////////////////////////////////////////////////////
351/// Destructor
352
354{
355 TGFrameElement *el;
356 TIter next(GetList());
357 while ((el = (TGFrameElement *)next())) {
358 if (el->fFrame->IsComposite())
360 }
361 Cleanup();
362}
363
364////////////////////////////////////////////////////////////////////////////////
365/// Connect signals to slots.
366
368{
370 Disconnect(fApply, "Clicked()",(TGeoTubeEditor*)this, "DoApply()");
371 Disconnect(fUndo, "Clicked()",(TGeoTubeEditor*)this, "DoUndo()");
372 fApply->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoApply()");
373 fUndo->Connect("Clicked()", "TGeoTubeSegEditor", this, "DoUndo()");
374 fEPhi1->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi1()");
375 fEPhi2->Connect("ValueSet(Long_t)", "TGeoTubeSegEditor", this, "DoPhi2()");
376// fEPhi1->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi1()");
377// fEPhi2->GetNumberEntry()->Connect("TextChanged(const char *)","TGeoTubeSegEditor", this, "DoPhi2()");
378 fSPhi->Connect("PositionChanged()","TGeoTubeSegEditor", this, "DoPhi()");
379}
380
381////////////////////////////////////////////////////////////////////////////////
382/// Connect to the selected object.
383
385{
386 if (obj == 0 || (obj->IsA()!=TGeoTubeSeg::Class())) {
388 return;
389 }
390 fShape = (TGeoTube*)obj;
391 fRmini = fShape->GetRmin();
392 fRmaxi = fShape->GetRmax();
393 fDzi = fShape->GetDz();
394 fNamei = fShape->GetName();
395 fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
396 fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
406
408 SetActive();
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Slot for phi1.
413
415{
416 Double_t phi1 = fEPhi1->GetNumber();
417 Double_t phi2 = fEPhi2->GetNumber();
418 if (phi1 > 360-1.e-10) {
419 phi1 = 0.;
420 fEPhi1->SetNumber(phi1);
421 }
422 if (phi2<phi1+1.e-10) {
423 phi1 = phi2 - 0.1;
424 fEPhi1->SetNumber(phi1);
425 }
426 if (!fLock) {
427 DoModified();
428 fLock = kTRUE;
429 fSPhi->SetPosition(phi1,phi2);
430 } else fLock = kFALSE;
431 if (!IsDelayed()) 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 fLock = kFALSE;
454 if (!IsDelayed()) DoApply();
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// Slot for phi slider.
459
461{
462 if (!fLock) {
463 DoModified();
464 fLock = kTRUE;
466 fLock = kTRUE;
468 } else fLock = kFALSE;
469 if (!IsDelayed()) DoApply();
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Slot for applying modifications.
474
476{
478 const char *name = fShapeName->GetText();
479 if (strcmp(name,fShape->GetName())) fShape->SetName(name);
480 Double_t rmin = fERmin->GetNumber();
481 Double_t rmax = fERmax->GetNumber();
482 if (rmin<0 || rmax<rmin) return;
483 Double_t dz = fEDz->GetNumber();
484 Double_t phi1 = fEPhi1->GetNumber();
485 Double_t phi2 = fEPhi2->GetNumber();
486 if ((phi2-phi1) > 360.001) {
487 phi1 = 0.;
488 phi2 = 360.;
489 fEPhi1->SetNumber(phi1);
490 fEPhi2->SetNumber(phi2);
491 fLock = kTRUE;
492 fSPhi->SetPosition(phi1,phi2);
493 fLock = kFALSE;
494 }
495 ((TGeoTubeSeg*)fShape)->SetTubsDimensions(rmin, rmax, dz, phi1, phi2);
497 fUndo->SetEnabled();
498 if (fPad) {
500 fShape->Draw();
501 fPad->GetView()->ShowAxis();
502 } else Update();
503 }
504}
505
506////////////////////////////////////////////////////////////////////////////////
507/// Slot for undoing last operation.
508
510{
517 DoApply();
520}
521
522/** \class TGeoCtubEditor
523\ingroup Geometry_builder
524
525Editor for a TGeoCtub.
526
527\image html geom_ctub_pic.png
528
529\image html geom_ctub_ed.png
530
531*/
532
534
538
539////////////////////////////////////////////////////////////////////////////////
540/// Constructor for cut tube editor
541
543 Int_t height, UInt_t options, Pixel_t back)
544 : TGeoTubeSegEditor(p, width, height, options, back)
545{
546 MakeTitle("Theta/phi low");
547 TGTextEntry *nef;
548 // Number entry for theta/phi of the lower normal
549 TGCompositeFrame *compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
551 f1->AddFrame(new TGLabel(f1, "TH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
552 fEThlo = new TGNumberEntry(f1, 0., 5, kCTUB_THLO);
555 nef->SetToolTipText("Enter the theta angle of the lower plane normal");
556 fEThlo->Associate(this);
557 fEThlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThlo()");
558 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
560 f1->AddFrame(fEThlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
561 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
562
563 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
564 f1->AddFrame(new TGLabel(f1, "PH_LO"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
565 fEPhlo = new TGNumberEntry(f1, 0., 5, kCTUB_PHLO);
568 nef->SetToolTipText("Enter the phi angle of the lower plane normal");
569 fEPhlo->Associate(this);
570 fEPhlo->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhlo()");
571 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
573 f1->AddFrame(fEPhlo, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
574 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
575 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
576
577 // Number entry for theta/phi of the lower normal
578 MakeTitle("Theta/phi high");
579 compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame);
580 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
581 f1->AddFrame(new TGLabel(f1, "TH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
582 fEThhi = new TGNumberEntry(f1, 0., 5, kCTUB_THHI);
585 nef->SetToolTipText("Enter the theta angle of the upper plane normal");
586 fEThhi->Associate(this);
587 fEThhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoThhi()");
588 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
590 f1->AddFrame(fEThhi, new TGLayoutHints(kLHintsRight , 2, 2, 2, 2));
591 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
592
593 f1 = new TGCompositeFrame(compxyz, 155, 30, kHorizontalFrame | kFixedWidth);
594 f1->AddFrame(new TGLabel(f1, "PH_HI"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
595 fEPhhi = new TGNumberEntry(f1, 0., 5, kCTUB_PHHI);
598 nef->SetToolTipText("Enter the phi angle of the upper plane normal");
599 fEPhhi->Associate(this);
600 fEPhhi->Connect("ValueSet(Long_t)", "TGeoCtubEditor", this, "DoPhhi()");
601 nef->Connect("TextChanged(const char *)","TGeoCtubEditor", this, "DoModified()");
603 f1->AddFrame(fEPhhi, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
604 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX , 2, 2, 4, 4));
605 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
608}
609
610////////////////////////////////////////////////////////////////////////////////
611/// Destructor
612
614{
615 TGFrameElement *el;
616 TIter next(GetList());
617 while ((el = (TGFrameElement *)next())) {
618 if (el->fFrame->IsComposite())
620 }
621 Cleanup();
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// Connect to the selected object.
626
628{
629 if (obj == 0 || (obj->IsA()!=TGeoCtub::Class())) {
631 return;
632 }
633 fShape = (TGeoTube*)obj;
634 fRmini = fShape->GetRmin();
635 fRmaxi = fShape->GetRmax();
636 fDzi = fShape->GetDz();
637 fNamei = fShape->GetName();
638 fPmini = ((TGeoTubeSeg*)fShape)->GetPhi1();
639 fPmaxi = ((TGeoTubeSeg*)fShape)->GetPhi2();
640 const Double_t *nlo = ((TGeoCtub*)fShape)->GetNlow();
641 const Double_t *nhi = ((TGeoCtub*)fShape)->GetNhigh();
642 fThlo = TMath::RadToDeg() * TMath::ACos(nlo[2]);
643 fPhlo = TMath::RadToDeg() * TMath::ATan2(nlo[1], nlo[0]);
644 fThhi = TMath::RadToDeg() * TMath::ACos(nhi[2]);
645 fPhhi = TMath::RadToDeg() * TMath::ATan2(nhi[1], nhi[0]);
646
660
662 SetActive();
663}
664
665////////////////////////////////////////////////////////////////////////////////
666/// Slot for phi1.
667
669{
670 Double_t thlo = fEThlo->GetNumber();
671 if (thlo <= 90.) {thlo = 91.; fEThlo->SetNumber(thlo);}
672 if (thlo > 180.) {thlo = 180.; fEThlo->SetNumber(thlo);}
673 DoModified();
674 if (!IsDelayed()) DoApply();
675}
676
677////////////////////////////////////////////////////////////////////////////////
678/// Slot for phi1.
679
681{
682 Double_t phlo = fEPhlo->GetNumber();
683 if (phlo >= 360.) {
684 phlo = 0.;
685 fEPhlo->SetNumber(phlo);
686 }
687 DoModified();
688 if (!IsDelayed()) DoApply();
689}
690
691////////////////////////////////////////////////////////////////////////////////
692/// Slot for phi1.
693
695{
696 Double_t thhi = fEThhi->GetNumber();
697 if (thhi >= 90.) {thhi = 89.; fEThhi->SetNumber(thhi);}
698 DoModified();
699 if (!IsDelayed()) DoApply();
700}
701
702////////////////////////////////////////////////////////////////////////////////
703/// Slot for phi1.
704
706{
707 Double_t phhi = fEPhhi->GetNumber();
708 if (phhi >= 360.) {
709 phhi = 0.;
710 fEPhhi->SetNumber(phhi);
711 }
712 DoModified();
713 if (!IsDelayed()) DoApply();
714}
715
716////////////////////////////////////////////////////////////////////////////////
717/// Slot for applying modifications.
718
720{
722 const char *name = fShapeName->GetText();
723 if (strcmp(name,fShape->GetName())) fShape->SetName(name);
724 Double_t rmin = fERmin->GetNumber();
725 Double_t rmax = fERmax->GetNumber();
726 if (rmin<0 || rmax<rmin) return;
727 Double_t dz = fEDz->GetNumber();
728 Double_t phi1 = fEPhi1->GetNumber();
729 Double_t phi2 = fEPhi2->GetNumber();
730 if ((phi2-phi1) > 360.001) {
731 phi1 = 0.;
732 phi2 = 360.;
733 fEPhi1->SetNumber(phi1);
734 fEPhi2->SetNumber(phi2);
735 fLock = kTRUE;
736 fSPhi->SetPosition(phi1,phi2);
737 fLock = kFALSE;
738 }
743 Double_t lx = TMath::Sin(thlo)*TMath::Cos(phlo);
744 Double_t ly = TMath::Sin(thlo)*TMath::Sin(phlo);
745 Double_t lz = TMath::Cos(thlo);
746 Double_t tx = TMath::Sin(thhi)*TMath::Cos(phhi);
747 Double_t ty = TMath::Sin(thhi)*TMath::Sin(phhi);
748 Double_t tz = TMath::Cos(thhi);
749 ((TGeoCtub*)fShape)->SetCtubDimensions(rmin, rmax, dz, phi1, phi2, lx,ly,lz,tx,ty,tz);
751 fUndo->SetEnabled();
752 if (fPad) {
754 fShape->Draw();
755 fPad->GetView()->ShowAxis();
756 } else Update();
757 }
758}
759
760////////////////////////////////////////////////////////////////////////////////
761/// Slot for undoing last operation.
762
764{
775
776 DoApply();
779}
void Class()
Definition: Class.C:29
ULong_t Pixel_t
Definition: GuiTypes.h:39
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kButtonDown
Definition: TGButton.h:54
@ kRaisedFrame
Definition: TGFrame.h:62
@ kSunkenFrame
Definition: TGFrame.h:61
@ kVerticalFrame
Definition: TGFrame.h:59
@ kFixedWidth
Definition: TGFrame.h:65
@ kHorizontalFrame
Definition: TGFrame.h:60
@ kFixedHeight
Definition: TGFrame.h:67
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
char name[80]
Definition: TGX11.cxx:109
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:601
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:409
virtual TList * GetList() const
Definition: TGFrame.h:369
TGCompositeFrame(const TGCompositeFrame &)
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 Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
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)
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void SetSize(const TGDimension &s)
Definition: TGFrame.h:299
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:237
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
TGDimension GetSize() const
Definition: TGFrame.h:277
virtual Bool_t IsComposite() const
Definition: TGFrame.h:259
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void SetNumber(Double_t val)
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
const char * GetText() const
Definition: TGTextEntry.h:134
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:84
Bool_t fInit
Definition: TGedFrame.h:53
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
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.
A tube segment cut with 2 planes.
Definition: TGeoTube.h:169
Common base class for geombuilder editors.
Definition: TGeoGedFrame.h:13
virtual void Update()
Override Update from TGedFrame as fGedEditor can be null.
TVirtualPad * fPad
Definition: TGeoGedFrame.h:18
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TVirtualGeoPainter * GetPainter() const
Definition: TGeoManager.h:212
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoShape.cxx:721
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 phi segment of a tube.
Definition: TGeoTube.h:89
Cylindrical tube class.
Definition: TGeoTube.h:18
virtual Double_t GetRmin() const
Definition: TGeoTube.h:66
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:68
virtual void ComputeBBox()
compute bounding box of the tube
Definition: TGeoTube.cxx:210
virtual Double_t GetRmax() const
Definition: TGeoTube.h:67
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Mother of all ROOT objects.
Definition: TObject.h:37
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:867
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:1025
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:658
Double_t ATan2(Double_t y, Double_t x)
Definition: TMath.h:669
constexpr Double_t DegToRad()
Conversion from degree to radian:
Definition: TMath.h:82
Double_t Cos(Double_t)
Definition: TMath.h:631
Double_t Sin(Double_t)
Definition: TMath.h:627
constexpr Double_t RadToDeg()
Conversion from radian to degree:
Definition: TMath.h:74