Logo ROOT   6.12/07
Reference Guide
TGeoTrapEditor.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 TGeoTrapEditor
13 \ingroup Geometry_builder
14 
15 Editor for a TGeoTrap.
16 
17 \image html geom_trap_pic.png
18 
19 \image html geom_trap_ed.png
20 
21 */
22 
23 #include "TGeoTrapEditor.h"
24 #include "TGeoTabManager.h"
25 #include "TGeoArb8.h"
26 #include "TGeoManager.h"
27 #include "TVirtualGeoPainter.h"
28 #include "TPad.h"
29 #include "TView.h"
30 #include "TGTab.h"
31 #include "TGComboBox.h"
32 #include "TGButton.h"
33 #include "TGTextEntry.h"
34 #include "TGNumberEntry.h"
35 #include "TGLabel.h"
36 
38 
42 };
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Constructor for para 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  fH1i = fBl1i = fTl1i = fDzi = fAlpha1i = fThetai = fPhii = fSci = 0.0;
53  fNamei = "";
56 
57  // TextEntry for shape name
58  MakeTitle("Name");
59  fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRAP_NAME);
61  fShapeName->SetToolTipText("Enter the parallelepiped name");
62  fShapeName->Associate(this);
63  AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
64 
65  TGTextEntry *nef;
66  MakeTitle("Dimensions");
67  // Number entry for H1
69  f1->AddFrame(new TGLabel(f1, "DY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
70  fEH1 = new TGNumberEntry(f1, 0., 5, kTRAP_H1);
72  fEH1->Resize(100, fEH1->GetDefaultHeight());
73  nef = (TGTextEntry*)fEH1->GetNumberEntry();
74  nef->SetToolTipText("Enter the half length in y at low z");
75  fEH1->Associate(this);
76  f1->AddFrame(fEH1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
77  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
78 
79  // Number entry for Bl1
80  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
81  f1->AddFrame(new TGLabel(f1, "DX1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
82  fEBl1 = new TGNumberEntry(f1, 0., 5, kTRAP_BL1);
85  nef = (TGTextEntry*)fEBl1->GetNumberEntry();
86  nef->SetToolTipText("Enter the half length in x at low z and y low edge");
87  fEBl1->Associate(this);
88  f1->AddFrame(fEBl1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
89  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
90 
91  // Number entry for Tl1
92  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
93  f1->AddFrame(new TGLabel(f1, "DX2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
94  fETl1 = new TGNumberEntry(f1, 0., 5, kTRAP_TL1);
97  nef = (TGTextEntry*)fETl1->GetNumberEntry();
98  nef->SetToolTipText("Enter the half length in x at low z and y high edge");
99  fETl1->Associate(this);
100  f1->AddFrame(fETl1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
101  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
102 
103  // Number entry for scale factor
104  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
105  f1->AddFrame(new TGLabel(f1, "SC1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
106  fESc1 = new TGNumberEntry(f1, 0., 5, kTRAP_SC1);
109  nef = (TGTextEntry*)fESc1->GetNumberEntry();
110  nef->SetToolTipText("Enter the scale factor for lower Z face");
111  fESc1->Associate(this);
112  f1->AddFrame(fESc1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
113  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
114 
115  // Number entry for scale factor
116  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
117  f1->AddFrame(new TGLabel(f1, "SC2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
118  fESc2 = new TGNumberEntry(f1, 0., 5, kTRAP_SC2);
121  nef = (TGTextEntry*)fESc2->GetNumberEntry();
122  nef->SetToolTipText("Enter the scale factor for upper Z face");
123  fESc2->Associate(this);
124  f1->AddFrame(fESc2, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
125  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
126 
127  // Number entry for dz
128  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
129  f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
130  fEDz = new TGNumberEntry(f1, 0., 5, kTRAP_DZ);
132  fEDz->Resize(100, fEDz->GetDefaultHeight());
133  nef = (TGTextEntry*)fEDz->GetNumberEntry();
134  nef->SetToolTipText("Enter the half-length in Z");
135  fEDz->Associate(this);
136  f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
137  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
138 
139  // Number entry for Alpha1
140  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
141  f1->AddFrame(new TGLabel(f1, "ALPHA"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
142  fEAlpha1 = new TGNumberEntry(f1, 0., 5, kTRAP_ALPHA1);
145  nef->SetToolTipText("Enter angle between centers of x edges an y axis at low z");
146  fEAlpha1->Associate(this);
147  f1->AddFrame(fEAlpha1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
148  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
149 
150  // Number entry for Theta
151  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
152  f1->AddFrame(new TGLabel(f1, "Theta"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
153  fETheta = new TGNumberEntry(f1, 0., 5, kTRAP_THETA);
157  nef->SetToolTipText("Enter initial theta");
158  fETheta->Associate(this);
159  f1->AddFrame(fETheta, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
160  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
161 
162  // Number entry for Phi
163  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
164  f1->AddFrame(new TGLabel(f1, "Phi"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
165  fEPhi = new TGNumberEntry(f1, 0., 5, kTRAP_PHI);
168  nef = (TGTextEntry*)fEPhi->GetNumberEntry();
169  nef->SetToolTipText("Enter initial phi");
170  fEPhi->Associate(this);
171  f1->AddFrame(fEPhi, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
172  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
173 
174  // Delayed draw
176  fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
177  fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
178  AddFrame(fDFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
179 
180  // Buttons
181  fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
182  fApply = new TGTextButton(fBFrame, "Apply");
183  fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
184  fApply->Associate(this);
185  fUndo = new TGTextButton(fBFrame, "Undo");
186  fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
187  fUndo->Associate(this);
188  AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
190 }
191 
192 ////////////////////////////////////////////////////////////////////////////////
193 /// Destructor
194 
196 {
197  TGFrameElement *el;
198  TIter next(GetList());
199  while ((el = (TGFrameElement *)next())) {
200  if (el->fFrame->IsComposite())
202  }
203  Cleanup();
204 }
205 
206 ////////////////////////////////////////////////////////////////////////////////
207 /// Connect signals to slots.
208 
210 {
211  fApply->Connect("Clicked()", "TGeoTrapEditor", this, "DoApply()");
212  fUndo->Connect("Clicked()", "TGeoTrapEditor", this, "DoUndo()");
213  fShapeName->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
214  fEH1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoH1()");
215  fEBl1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoBl1()");
216  fETl1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoTl1()");
217  fEDz->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoDz()");
218  fESc1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoSc1()");
219  fESc2->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoSc2()");
220  fEAlpha1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoAlpha1()");
221  fETheta->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoTheta()");
222  fEPhi->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoPhi()");
223  fEH1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
224  fEBl1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
225  fETl1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
226  fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
227  fESc1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
228  fESc2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
229  fEAlpha1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
230  fETheta->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
231  fEPhi->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
232  fInit = kFALSE;
233 }
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 /// Connect to the selected object.
237 
239 {
240  if (obj == 0 || (obj->IsA()!=TGeoTrap::Class())) {
241  SetActive(kFALSE);
242  return;
243  }
244  fShape = (TGeoTrap*)obj;
245  fH1i = fShape->GetH1();
246  fBl1i = fShape->GetBl1();
247  fTl1i = fShape->GetTl1();
248  fDzi = fShape->GetDz();
249  Double_t h2i = fShape->GetH2();
250 // Double_t bl2i = fShape->GetBl2();
251 // Double_t tl2i = fShape->GetTl2();
252  fSci = h2i/fH1i;
254  fThetai = fShape->GetTheta();
255  fPhii = fShape->GetPhi();
256  const char *sname = fShape->GetName();
257  if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name");
258  else {
259  fShapeName->SetText(sname);
260  fNamei = sname;
261  }
262  fEH1->SetNumber(fH1i);
265  fEDz->SetNumber(fDzi);
266  fESc1->SetNumber(1.);
267  fESc2->SetNumber(fSci);
273 
275  SetActive();
276 }
277 
278 ////////////////////////////////////////////////////////////////////////////////
279 /// Check if shape drawing is delayed.
280 
282 {
283  return (fDelayed->GetState() == kButtonDown);
284 }
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// Slot for name.
288 
290 {
291  DoModified();
292 }
293 
294 ////////////////////////////////////////////////////////////////////////////////
295 /// Slot for applying current settings.
296 
298 {
299  const char *name = fShapeName->GetText();
300  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
301  Double_t sc1 = fESc1->GetNumber();
302  Double_t sc2 = fESc2->GetNumber();
303  Double_t h1 = sc1*fEH1->GetNumber();
304  Double_t bl1 = sc1*fEBl1->GetNumber();
305  Double_t tl1 = sc1*fETl1->GetNumber();
306  Double_t h2 = sc2*fEH1->GetNumber();
307  Double_t bl2 = sc2*fEBl1->GetNumber();
308  Double_t tl2 = sc2*fETl1->GetNumber();
309  Double_t dz = fEDz->GetNumber();
310  Double_t alpha1 = fEAlpha1->GetNumber();
311  Double_t theta = fETheta->GetNumber();
312  Double_t phi = fEPhi->GetNumber();
313  Double_t param[11];
314  param[0] = dz;
315  param[1] = theta;
316  param[2] = phi;
317  param[3] = h1;
318  param[7] = h2;
319  param[4] = bl1;
320  param[8] = bl2;
321  param[5] = tl1;
322  param[9] = tl2;
323  param[6] = alpha1;
324  param[10] = alpha1;
325  fShape->SetDimensions(param);
326  fShape->ComputeBBox();
327  fUndo->SetEnabled();
329  if (fPad) {
331  TView *view = fPad->GetView();
332  if (!view) {
333  fShape->Draw();
334  fPad->GetView()->ShowAxis();
335  } else {
336  view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
337  fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
338  Update();
339  }
340  } else Update();
341  }
342 }
343 
344 ////////////////////////////////////////////////////////////////////////////////
345 /// Slot for notifying modifications.
346 
348 {
349  fApply->SetEnabled();
350 }
351 
352 ////////////////////////////////////////////////////////////////////////////////
353 /// Slot for undoing last operation.
354 
356 {
357  fEH1->SetNumber(fH1i);
360  fESc1->SetNumber(1.);
361  fESc2->SetNumber(fSci);
362  fEDz->SetNumber(fDzi);
366  DoApply();
369 }
370 
371 ////////////////////////////////////////////////////////////////////////////////
372 /// Slot for H1.
373 
375 {
376  Double_t h1 = fEH1->GetNumber();
377  if (h1<=0) {
378  h1 = 0.1;
379  fEH1->SetNumber(h1);
380  }
381  DoModified();
382  if (!IsDelayed()) DoApply();
383 }
384 
385 ////////////////////////////////////////////////////////////////////////////////
386 /// Slot for Bl1.
387 
389 {
390  Double_t bl1 = fEBl1->GetNumber();
391  if (bl1<=0) {
392  bl1 = 0.1;
393  fEBl1->SetNumber(bl1);
394  }
395  DoModified();
396  if (!IsDelayed()) DoApply();
397 }
398 
399 ////////////////////////////////////////////////////////////////////////////////
400 /// Slot for Tl1.
401 
403 {
404  Double_t tl1 = fETl1->GetNumber();
405  if (tl1<=0) {
406  tl1 = 0.1;
407  fETl1->SetNumber(tl1);
408  }
409  DoModified();
410  if (!IsDelayed()) DoApply();
411 }
412 
413 ////////////////////////////////////////////////////////////////////////////////
414 /// Slot for Z.
415 
417 {
418  Double_t dz = fEDz->GetNumber();
419  if (dz<=0) {
420  dz = 0.1;
421  fEDz->SetNumber(dz);
422  }
423  DoModified();
424  if (!IsDelayed()) DoApply();
425 }
426 
427 ////////////////////////////////////////////////////////////////////////////////
428 /// Slot for H2.
429 
431 {
432  Double_t sc1 = fESc1->GetNumber();
433  if (sc1<=0) {
434  sc1 = 0.1;
435  fESc1->SetNumber(sc1);
436  }
437  DoModified();
438  if (!IsDelayed()) DoApply();
439 }
440 
441 ////////////////////////////////////////////////////////////////////////////////
442 /// Slot for H2.
443 
445 {
446  Double_t sc2 = fESc2->GetNumber();
447  if (sc2<=0) {
448  sc2 = 0.1;
449  fESc2->SetNumber(sc2);
450  }
451  DoModified();
452  if (!IsDelayed()) DoApply();
453 }
454 
455 ////////////////////////////////////////////////////////////////////////////////
456 /// Slot for alpha1.
457 
459 {
460  Double_t alpha1 = fEAlpha1->GetNumber();
461  if (TMath::Abs(alpha1)>=90) {
462  alpha1 = 89.9*TMath::Sign(1.,alpha1);
463  fEAlpha1->SetNumber(alpha1);
464  }
465  DoModified();
466  if (!IsDelayed()) DoApply();
467 }
468 
469 ////////////////////////////////////////////////////////////////////////////////
470 /// Slot for theta.
471 
473 {
474  Double_t theta = fETheta->GetNumber();
475  if (theta<0) {
476  theta = 0;
477  fETheta->SetNumber(theta);
478  }
479  if (theta>180) {
480  theta = 180;
481  fETheta->SetNumber(theta);
482  }
483  DoModified();
484  if (!IsDelayed()) DoApply();
485 }
486 
487 ////////////////////////////////////////////////////////////////////////////////
488 /// Slot for phi.
489 
491 {
492  Double_t phi = fEPhi->GetNumber();
493  if (phi<0 || phi>360) {
494  phi = 0;
495  fEPhi->SetNumber(phi);
496  }
497  DoModified();
498  if (!IsDelayed()) DoApply();
499 }
500 
502 
505 };
506 
507 /** \class TGeoGtraEditor
508 \ingroup Geometry_builder
509 
510 Editor for a TGeoGtra.
511 
512 \image html geom_gtra_pic.png
513 
514 \image html geom_gtra_ed.png
515 
516 */
517 
518 ////////////////////////////////////////////////////////////////////////////////
519 /// Constructor for gtra editor
520 
522  Int_t height, UInt_t options, Pixel_t back)
523  : TGeoTrapEditor(p, width, height, options, back)
524 {
525  fTwisti = 0;
526  TGTextEntry *nef;
527  // Number entry for Twist angle
529  f1->AddFrame(new TGLabel(f1, "TWIST"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
530  fETwist = new TGNumberEntry(f1, 0., 5, kGTRA_TWIST);
533  nef->SetToolTipText("Enter twist angle");
534  fETwist->Associate(this);
535  f1->AddFrame(fETwist, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
536  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
539  fETwist->Connect("ValueSet(Long_t)", "TGeoGtraEditor", this, "DoTwist()");
540  nef->Connect("TextChanged(const char *)", "TGeoGtraEditor", this, "DoModified()");
541 }
542 ////////////////////////////////////////////////////////////////////////////////
543 /// Destructor
544 
546 {
547  TGFrameElement *el;
548  TIter next(GetList());
549  while ((el = (TGFrameElement *)next())) {
550  if (el->fFrame->IsComposite())
552  }
553  Cleanup();
554 }
555 
556 ////////////////////////////////////////////////////////////////////////////////
557 /// Connect to a given twisted trapezoid.
558 
560 {
561  if (obj == 0 || (obj->IsA()!=TGeoGtra::Class())) {
562  SetActive(kFALSE);
563  return;
564  }
565  fShape = (TGeoTrap*)obj;
566  fH1i = fShape->GetH1();
567  fBl1i = fShape->GetBl1();
568  fTl1i = fShape->GetTl1();
569  fDzi = fShape->GetDz();
570  Double_t h2i = fShape->GetH2();
571 // Double_t bl2i = fShape->GetBl2();
572 // Double_t tl2i = fShape->GetTl2();
573  fSci = h2i/fH1i;
575  fThetai = fShape->GetTheta();
576  fPhii = fShape->GetPhi();
577  fTwisti = ((TGeoGtra*)fShape)->GetTwistAngle();
578  const char *sname = fShape->GetName();
579  if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name");
580  else {
581  fShapeName->SetText(sname);
582  fNamei = sname;
583  }
584  fEH1->SetNumber(fH1i);
587  fEDz->SetNumber(fDzi);
588  fESc1->SetNumber(1.);
589  fESc2->SetNumber(fSci);
596 
598  SetActive();
599 }
600 
601 ////////////////////////////////////////////////////////////////////////////////
602 /// Slot for applying current settings.
603 
605 {
606  const char *name = fShapeName->GetText();
607  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
608  Double_t sc1 = fESc1->GetNumber();
609  Double_t sc2 = fESc2->GetNumber();
610  Double_t h1 = sc1*fEH1->GetNumber();
611  Double_t bl1 = sc1*fEBl1->GetNumber();
612  Double_t tl1 = sc1*fETl1->GetNumber();
613  Double_t h2 = sc2*fEH1->GetNumber();
614  Double_t bl2 = sc2*fEBl1->GetNumber();
615  Double_t tl2 = sc2*fETl1->GetNumber();
616  Double_t dz = fEDz->GetNumber();
617  Double_t alpha1 = fEAlpha1->GetNumber();
618  Double_t theta = fETheta->GetNumber();
619  Double_t phi = fEPhi->GetNumber();
620  Double_t twist = fETwist->GetNumber();
621  Double_t param[12];
622  param[0] = dz;
623  param[1] = theta;
624  param[2] = phi;
625  param[3] = h1;
626  param[7] = h2;
627  param[4] = bl1;
628  param[8] = bl2;
629  param[5] = tl1;
630  param[9] = tl2;
631  param[6] = alpha1;
632  param[10] = alpha1;
633  param[11] = twist;
634  TGeoGtra *shape = (TGeoGtra*)fShape;
635  shape->SetDimensions(param);
636  shape->ComputeBBox();
637  fUndo->SetEnabled();
639  if (fPad) {
641  TView *view = fPad->GetView();
642  if (!view) {
643  fShape->Draw();
644  fPad->GetView()->ShowAxis();
645  } else {
646  view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
647  fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
648  Update();
649  }
650  } else Update();
651  }
652 }
653 
654 ////////////////////////////////////////////////////////////////////////////////
655 /// Slot for undoing last operation.
656 
658 {
659  fEH1->SetNumber(fH1i);
662  fESc1->SetNumber(1.);
663  fESc2->SetNumber(fSci);
664  fEDz->SetNumber(fDzi);
669  DoApply();
672 }
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 /// Change the twist angle.
676 
678 {
679  Double_t twist = fETwist->GetNumber();
680  if (twist<=-180 || twist>=180) {
681  twist = 0.;
682  fETwist->SetNumber(twist);
683  }
684  DoModified();
685  if (!IsDelayed()) DoApply();
686 }
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
Double_t GetTheta() const
Definition: TGeoArb8.h:124
virtual void DoApply()
Slot for applying current settings.
TGTextButton * fUndo
TGNumberEntry * fETheta
virtual void SetModel(TObject *obj)
Connect to the selected object.
Double_t fAlpha1i
void DoTwist()
Change the twist angle.
T1 Sign(T1 a, T2 b)
Definition: TMathBase.h:153
virtual void SetModel(TObject *obj)
Connect to a given twisted trapezoid.
TGTextButton * fApply
TGNumberEntry * fEPhi
TGeoTrap * fShape
virtual Double_t GetDX() const
Definition: TGeoBBox.h:70
TGNumberEntry * fETwist
Gtra is a twisted trapezoid.
Definition: TGeoArb8.h:143
TVirtualGeoPainter * GetPainter() const
Definition: TGeoManager.h:190
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Double_t GetPhi() const
Definition: TGeoArb8.h:125
virtual void SetNumber(Double_t val)
See TView3D.
Definition: TView.h:25
virtual void SetRange(const Double_t *min, const Double_t *max)=0
virtual Bool_t IsPaintingShape() const =0
Double_t fThetai
TGTextEntry * fShapeName
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGNumberEntry * fEBl1
virtual Bool_t IsComposite() const
Definition: TGFrame.h:259
void DoModified()
Slot for notifying modifications.
virtual void ConnectSignals2Slots()
Connect signals to slots.
virtual void DoUndo()
Slot for undoing last operation.
TGCompositeFrame * fDFrame
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
virtual void DoApply()
Slot for applying current settings.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hierarchically all daughters of a composite frame.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
ULong_t Pixel_t
Definition: GuiTypes.h:39
virtual ~TGeoGtraEditor()
Destructor.
void Class()
Definition: Class.C:29
void DoName()
Slot for name.
void DoTheta()
Slot for theta.
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TGCompositeFrame(const TGCompositeFrame &)
TGNumberEntry * fESc2
void DoSc1()
Slot for H2.
virtual TList * GetList() const
Definition: TGFrame.h:369
TRAP is a general trapezoid, i.e.
Definition: TGeoArb8.h:89
TGeoTrapEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for para editor.
virtual void ComputeBBox()
Computes bounding box for an Arb8 shape.
Definition: TGeoArb8.cxx:265
TH1F * h1
Definition: legend1.C:5
virtual EButtonState GetState() const
Definition: TGButton.h:112
Double_t GetH2() const
Definition: TGeoArb8.h:130
virtual TView * GetView() const =0
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
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
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
void DoTl1()
Slot for Tl1.
TGNumberEntry * fETl1
TGCompositeFrame * fBFrame
virtual void SetSize(const TGDimension &s)
Definition: TGFrame.h:299
Double_t fTwisti
TGeoGtraEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for gtra editor.
Bool_t IsDelayed() const
Check if shape drawing is delayed.
Bool_t fIsShapeEditable
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
void DoPhi()
Slot for phi.
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t GetBl1() const
Definition: TGeoArb8.h:127
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void ShowAxis()=0
Editor for a TGeoGtra.
ETGeoGtraWid
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
virtual Double_t GetDY() const
Definition: TGeoBBox.h:71
virtual void DoUndo()
Slot for undoing last operation.
void SetNumAttr(EAttribute attr=kNEAAnyNumber)
const Bool_t kFALSE
Definition: RtypesCore.h:88
TGDimension GetSize() const
Definition: TGFrame.h:277
void DoAlpha1()
Slot for alpha1.
const char * GetText() const
Definition: TGTextEntry.h:134
TGNumberEntry * fEDz
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
void DoSc2()
Slot for H2.
#define ClassImp(name)
Definition: Rtypes.h:359
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:559
Editor for a TGeoTrap.
double Double_t
Definition: RtypesCore.h:55
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:409
virtual Double_t GetNumber() const
ETGeoTrapWid
TGNumberEntry * fEAlpha1
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
Double_t GetH1() const
Definition: TGeoArb8.h:126
virtual ~TGeoTrapEditor()
Destructor.
Mother of all ROOT objects.
Definition: TObject.h:37
TGNumberEntry * fESc1
void DoDz()
Slot for Z.
Bool_t fInit
Definition: TGedFrame.h:53
TGNumberEntryField * GetNumberEntry() const
Double_t GetDz() const
Definition: TGeoArb8.h:63
Double_t GetTl1() const
Definition: TGeoArb8.h:128
TF1 * f1
Definition: legend1.C:11
Double_t GetAlpha1() const
Definition: TGeoArb8.h:129
virtual void Update()
Override Update from TGedFrame as fGedEditor can be null.
TGNumberEntry * fEH1
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 DoH1()
Slot for H1.
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
Definition: TGeoArb8.cxx:2066
TVirtualPad * fPad
Definition: TGeoGedFrame.h:18
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:721
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
void DoBl1()
Slot for Bl1.
char name[80]
Definition: TGX11.cxx:109
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
Definition: TGeoArb8.cxx:1794
UInt_t GetDefaultHeight() const
Common base class for geombuilder editors.
Definition: TGeoGedFrame.h:13
TGCheckButton * fDelayed
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:72