Logo ROOT   6.07/09
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TGeoTrapEditor //
15 // //
16 //////////////////////////////////////////////////////////////////////////
17 //Begin_Html
18 /*
19 <img src="gif/trap_pic.gif">
20 */
21 //End_Html
22 //Begin_Html
23 /*
24 <img src="gif/trap_ed.jpg">
25 */
26 //End_Html
27 
28 #include "TGeoTrapEditor.h"
29 #include "TGeoTabManager.h"
30 #include "TGeoArb8.h"
31 #include "TGeoManager.h"
32 #include "TVirtualGeoPainter.h"
33 #include "TPad.h"
34 #include "TView.h"
35 #include "TGTab.h"
36 #include "TGComboBox.h"
37 #include "TGButton.h"
38 #include "TGTextEntry.h"
39 #include "TGNumberEntry.h"
40 #include "TGLabel.h"
41 
43 
47 };
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// Constructor for para editor
51 
53  Int_t height, UInt_t options, Pixel_t back)
54  : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
55 {
56  fShape = 0;
57  fH1i = fBl1i = fTl1i = fDzi = fAlpha1i = fThetai = fPhii = fSci = 0.0;
58  fNamei = "";
61 
62  // TextEntry for shape name
63  MakeTitle("Name");
64  fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kTRAP_NAME);
66  fShapeName->SetToolTipText("Enter the parallelipiped name");
67  fShapeName->Associate(this);
68  AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
69 
70  TGTextEntry *nef;
71  MakeTitle("Dimensions");
72  // Number entry for H1
74  f1->AddFrame(new TGLabel(f1, "DY"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
75  fEH1 = new TGNumberEntry(f1, 0., 5, kTRAP_H1);
77  fEH1->Resize(100, fEH1->GetDefaultHeight());
78  nef = (TGTextEntry*)fEH1->GetNumberEntry();
79  nef->SetToolTipText("Enter the half length in y at low z");
80  fEH1->Associate(this);
81  f1->AddFrame(fEH1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
82  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
83 
84  // Number entry for Bl1
85  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
86  f1->AddFrame(new TGLabel(f1, "DX1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
87  fEBl1 = new TGNumberEntry(f1, 0., 5, kTRAP_BL1);
90  nef = (TGTextEntry*)fEBl1->GetNumberEntry();
91  nef->SetToolTipText("Enter the half length in x at low z and y low edge");
92  fEBl1->Associate(this);
93  f1->AddFrame(fEBl1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
94  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
95 
96  // Number entry for Tl1
97  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
98  f1->AddFrame(new TGLabel(f1, "DX2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
99  fETl1 = new TGNumberEntry(f1, 0., 5, kTRAP_TL1);
102  nef = (TGTextEntry*)fETl1->GetNumberEntry();
103  nef->SetToolTipText("Enter the half length in x at low z and y high edge");
104  fETl1->Associate(this);
105  f1->AddFrame(fETl1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
106  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
107 
108  // Number entry for scale factor
109  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
110  f1->AddFrame(new TGLabel(f1, "SC1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
111  fESc1 = new TGNumberEntry(f1, 0., 5, kTRAP_SC1);
114  nef = (TGTextEntry*)fESc1->GetNumberEntry();
115  nef->SetToolTipText("Enter the scale factor for lower Z face");
116  fESc1->Associate(this);
117  f1->AddFrame(fESc1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
118  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
119 
120  // Number entry for scale factor
121  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
122  f1->AddFrame(new TGLabel(f1, "SC2"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
123  fESc2 = new TGNumberEntry(f1, 0., 5, kTRAP_SC2);
126  nef = (TGTextEntry*)fESc2->GetNumberEntry();
127  nef->SetToolTipText("Enter the scale factor for upper Z face");
128  fESc2->Associate(this);
129  f1->AddFrame(fESc2, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
130  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
131 
132  // Number entry for dz
133  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
134  f1->AddFrame(new TGLabel(f1, "DZ"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
135  fEDz = new TGNumberEntry(f1, 0., 5, kTRAP_DZ);
137  fEDz->Resize(100, fEDz->GetDefaultHeight());
138  nef = (TGTextEntry*)fEDz->GetNumberEntry();
139  nef->SetToolTipText("Enter the half-lenth in Z");
140  fEDz->Associate(this);
141  f1->AddFrame(fEDz, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
142  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
143 
144  // Number entry for Alpha1
145  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
146  f1->AddFrame(new TGLabel(f1, "ALPHA"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
147  fEAlpha1 = new TGNumberEntry(f1, 0., 5, kTRAP_ALPHA1);
150  nef->SetToolTipText("Enter angle between centers of x edges an y axis at low z");
151  fEAlpha1->Associate(this);
152  f1->AddFrame(fEAlpha1, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
153  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
154 
155  // Number entry for Theta
156  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
157  f1->AddFrame(new TGLabel(f1, "Theta"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
158  fETheta = new TGNumberEntry(f1, 0., 5, kTRAP_THETA);
162  nef->SetToolTipText("Enter initial theta");
163  fETheta->Associate(this);
164  f1->AddFrame(fETheta, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
165  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
166 
167  // Number entry for Phi
168  f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
169  f1->AddFrame(new TGLabel(f1, "Phi"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
170  fEPhi = new TGNumberEntry(f1, 0., 5, kTRAP_PHI);
173  nef = (TGTextEntry*)fEPhi->GetNumberEntry();
174  nef->SetToolTipText("Enter initial phi");
175  fEPhi->Associate(this);
176  f1->AddFrame(fEPhi, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
177  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
178 
179  // Delayed draw
181  fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
182  fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
183  AddFrame(fDFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
184 
185  // Buttons
186  fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
187  fApply = new TGTextButton(fBFrame, "Apply");
188  fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
189  fApply->Associate(this);
190  fUndo = new TGTextButton(fBFrame, "Undo");
191  fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
192  fUndo->Associate(this);
193  AddFrame(fBFrame, new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// Destructor
199 
201 {
202  TGFrameElement *el;
203  TIter next(GetList());
204  while ((el = (TGFrameElement *)next())) {
205  if (el->fFrame->IsComposite())
207  }
208  Cleanup();
209 }
210 
211 ////////////////////////////////////////////////////////////////////////////////
212 /// Connect signals to slots.
213 
215 {
216  fApply->Connect("Clicked()", "TGeoTrapEditor", this, "DoApply()");
217  fUndo->Connect("Clicked()", "TGeoTrapEditor", this, "DoUndo()");
218  fShapeName->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
219  fEH1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoH1()");
220  fEBl1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoBl1()");
221  fETl1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoTl1()");
222  fEDz->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoDz()");
223  fESc1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoSc1()");
224  fESc2->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoSc2()");
225  fEAlpha1->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoAlpha1()");
226  fETheta->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoTheta()");
227  fEPhi->Connect("ValueSet(Long_t)", "TGeoTrapEditor", this, "DoPhi()");
228  fEH1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
229  fEBl1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
230  fETl1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
231  fEDz->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
232  fESc1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
233  fESc2->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
234  fEAlpha1->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
235  fETheta->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
236  fEPhi->GetNumberEntry()->Connect("TextChanged(const char *)", "TGeoTrapEditor", this, "DoModified()");
237  fInit = kFALSE;
238 }
239 
240 ////////////////////////////////////////////////////////////////////////////////
241 /// Connect to the selected object.
242 
244 {
245  if (obj == 0 || (obj->IsA()!=TGeoTrap::Class())) {
246  SetActive(kFALSE);
247  return;
248  }
249  fShape = (TGeoTrap*)obj;
250  fH1i = fShape->GetH1();
251  fBl1i = fShape->GetBl1();
252  fTl1i = fShape->GetTl1();
253  fDzi = fShape->GetDz();
254  Double_t h2i = fShape->GetH2();
255 // Double_t bl2i = fShape->GetBl2();
256 // Double_t tl2i = fShape->GetTl2();
257  fSci = h2i/fH1i;
259  fThetai = fShape->GetTheta();
260  fPhii = fShape->GetPhi();
261  const char *sname = fShape->GetName();
262  if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name");
263  else {
264  fShapeName->SetText(sname);
265  fNamei = sname;
266  }
267  fEH1->SetNumber(fH1i);
270  fEDz->SetNumber(fDzi);
271  fESc1->SetNumber(1.);
272  fESc2->SetNumber(fSci);
278 
280  SetActive();
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Check if shape drawing is delayed.
285 
287 {
288  return (fDelayed->GetState() == kButtonDown);
289 }
290 
291 ////////////////////////////////////////////////////////////////////////////////
292 /// Slot for name.
293 
295 {
296  DoModified();
297 }
298 
299 ////////////////////////////////////////////////////////////////////////////////
300 /// Slot for applying current settings.
301 
303 {
304  const char *name = fShapeName->GetText();
305  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
306  Double_t sc1 = fESc1->GetNumber();
307  Double_t sc2 = fESc2->GetNumber();
308  Double_t h1 = sc1*fEH1->GetNumber();
309  Double_t bl1 = sc1*fEBl1->GetNumber();
310  Double_t tl1 = sc1*fETl1->GetNumber();
311  Double_t h2 = sc2*fEH1->GetNumber();
312  Double_t bl2 = sc2*fEBl1->GetNumber();
313  Double_t tl2 = sc2*fETl1->GetNumber();
314  Double_t dz = fEDz->GetNumber();
315  Double_t alpha1 = fEAlpha1->GetNumber();
316  Double_t theta = fETheta->GetNumber();
317  Double_t phi = fEPhi->GetNumber();
318  Double_t param[11];
319  param[0] = dz;
320  param[1] = theta;
321  param[2] = phi;
322  param[3] = h1;
323  param[7] = h2;
324  param[4] = bl1;
325  param[8] = bl2;
326  param[5] = tl1;
327  param[9] = tl2;
328  param[6] = alpha1;
329  param[10] = alpha1;
330  fShape->SetDimensions(param);
331  fShape->ComputeBBox();
332  fUndo->SetEnabled();
334  if (fPad) {
336  TView *view = fPad->GetView();
337  if (!view) {
338  fShape->Draw();
339  fPad->GetView()->ShowAxis();
340  } else {
341  view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
342  fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
343  Update();
344  }
345  } else Update();
346  }
347 }
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 /// Slot for notifying modifications.
351 
353 {
354  fApply->SetEnabled();
355 }
356 
357 ////////////////////////////////////////////////////////////////////////////////
358 /// Slot for undoing last operation.
359 
361 {
362  fEH1->SetNumber(fH1i);
365  fESc1->SetNumber(1.);
366  fESc2->SetNumber(fSci);
367  fEDz->SetNumber(fDzi);
371  DoApply();
374 }
375 
376 ////////////////////////////////////////////////////////////////////////////////
377 /// Slot for H1.
378 
380 {
381  Double_t h1 = fEH1->GetNumber();
382  if (h1<=0) {
383  h1 = 0.1;
384  fEH1->SetNumber(h1);
385  }
386  DoModified();
387  if (!IsDelayed()) DoApply();
388 }
389 
390 ////////////////////////////////////////////////////////////////////////////////
391 /// Slot for Bl1.
392 
394 {
395  Double_t bl1 = fEBl1->GetNumber();
396  if (bl1<=0) {
397  bl1 = 0.1;
398  fEBl1->SetNumber(bl1);
399  }
400  DoModified();
401  if (!IsDelayed()) DoApply();
402 }
403 
404 ////////////////////////////////////////////////////////////////////////////////
405 /// Slot for Tl1.
406 
408 {
409  Double_t tl1 = fETl1->GetNumber();
410  if (tl1<=0) {
411  tl1 = 0.1;
412  fETl1->SetNumber(tl1);
413  }
414  DoModified();
415  if (!IsDelayed()) DoApply();
416 }
417 
418 ////////////////////////////////////////////////////////////////////////////////
419 /// Slot for Z.
420 
422 {
423  Double_t dz = fEDz->GetNumber();
424  if (dz<=0) {
425  dz = 0.1;
426  fEDz->SetNumber(dz);
427  }
428  DoModified();
429  if (!IsDelayed()) DoApply();
430 }
431 
432 ////////////////////////////////////////////////////////////////////////////////
433 /// Slot for H2.
434 
436 {
437  Double_t sc1 = fESc1->GetNumber();
438  if (sc1<=0) {
439  sc1 = 0.1;
440  fESc1->SetNumber(sc1);
441  }
442  DoModified();
443  if (!IsDelayed()) DoApply();
444 }
445 
446 ////////////////////////////////////////////////////////////////////////////////
447 /// Slot for H2.
448 
450 {
451  Double_t sc2 = fESc2->GetNumber();
452  if (sc2<=0) {
453  sc2 = 0.1;
454  fESc2->SetNumber(sc2);
455  }
456  DoModified();
457  if (!IsDelayed()) DoApply();
458 }
459 
460 ////////////////////////////////////////////////////////////////////////////////
461 /// Slot for alpha1.
462 
464 {
465  Double_t alpha1 = fEAlpha1->GetNumber();
466  if (TMath::Abs(alpha1)>=90) {
467  alpha1 = 89.9*TMath::Sign(1.,alpha1);
468  fEAlpha1->SetNumber(alpha1);
469  }
470  DoModified();
471  if (!IsDelayed()) DoApply();
472 }
473 
474 ////////////////////////////////////////////////////////////////////////////////
475 /// Slot for theta.
476 
478 {
479  Double_t theta = fETheta->GetNumber();
480  if (theta<0) {
481  theta = 0;
482  fETheta->SetNumber(theta);
483  }
484  if (theta>180) {
485  theta = 180;
486  fETheta->SetNumber(theta);
487  }
488  DoModified();
489  if (!IsDelayed()) DoApply();
490 }
491 
492 ////////////////////////////////////////////////////////////////////////////////
493 /// Slot for phi.
494 
496 {
497  Double_t phi = fEPhi->GetNumber();
498  if (phi<0 || phi>360) {
499  phi = 0;
500  fEPhi->SetNumber(phi);
501  }
502  DoModified();
503  if (!IsDelayed()) DoApply();
504 }
505 
507 
510 };
511 
512 //////////////////////////////////////////////////////////////////////////
513 // //
514 // TGeoGtraEditor //
515 // //
516 //////////////////////////////////////////////////////////////////////////
517 //Begin_Html
518 /*
519 <img src="gif/gtra_pic.gif">
520 */
521 //End_Html
522 //Begin_Html
523 /*
524 <img src="gif/gtra_ed.jpg">
525 */
526 //End_Html
527 
528 ////////////////////////////////////////////////////////////////////////////////
529 /// Constructor for gtra editor
530 
532  Int_t height, UInt_t options, Pixel_t back)
533  : TGeoTrapEditor(p, width, height, options, back)
534 {
535  fTwisti = 0;
536  TGTextEntry *nef;
537  // Number entry for Twist angle
539  f1->AddFrame(new TGLabel(f1, "TWIST"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
540  fETwist = new TGNumberEntry(f1, 0., 5, kGTRA_TWIST);
543  nef->SetToolTipText("Enter twist angle");
544  fETwist->Associate(this);
545  f1->AddFrame(fETwist, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
546  AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
549  fETwist->Connect("ValueSet(Long_t)", "TGeoGtraEditor", this, "DoTwist()");
550  nef->Connect("TextChanged(const char *)", "TGeoGtraEditor", this, "DoModified()");
551 }
552 ////////////////////////////////////////////////////////////////////////////////
553 /// Destructor
554 
556 {
557  TGFrameElement *el;
558  TIter next(GetList());
559  while ((el = (TGFrameElement *)next())) {
560  if (el->fFrame->IsComposite())
562  }
563  Cleanup();
564 }
565 
566 ////////////////////////////////////////////////////////////////////////////////
567 /// Connect to a given twisted trapezoid.
568 
570 {
571  if (obj == 0 || (obj->IsA()!=TGeoGtra::Class())) {
572  SetActive(kFALSE);
573  return;
574  }
575  fShape = (TGeoTrap*)obj;
576  fH1i = fShape->GetH1();
577  fBl1i = fShape->GetBl1();
578  fTl1i = fShape->GetTl1();
579  fDzi = fShape->GetDz();
580  Double_t h2i = fShape->GetH2();
581 // Double_t bl2i = fShape->GetBl2();
582 // Double_t tl2i = fShape->GetTl2();
583  fSci = h2i/fH1i;
585  fThetai = fShape->GetTheta();
586  fPhii = fShape->GetPhi();
587  fTwisti = ((TGeoGtra*)fShape)->GetTwistAngle();
588  const char *sname = fShape->GetName();
589  if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name");
590  else {
591  fShapeName->SetText(sname);
592  fNamei = sname;
593  }
594  fEH1->SetNumber(fH1i);
597  fEDz->SetNumber(fDzi);
598  fESc1->SetNumber(1.);
599  fESc2->SetNumber(fSci);
606 
608  SetActive();
609 }
610 
611 ////////////////////////////////////////////////////////////////////////////////
612 /// Slot for applying current settings.
613 
615 {
616  const char *name = fShapeName->GetText();
617  if (strcmp(name,fShape->GetName())) fShape->SetName(name);
618  Double_t sc1 = fESc1->GetNumber();
619  Double_t sc2 = fESc2->GetNumber();
620  Double_t h1 = sc1*fEH1->GetNumber();
621  Double_t bl1 = sc1*fEBl1->GetNumber();
622  Double_t tl1 = sc1*fETl1->GetNumber();
623  Double_t h2 = sc2*fEH1->GetNumber();
624  Double_t bl2 = sc2*fEBl1->GetNumber();
625  Double_t tl2 = sc2*fETl1->GetNumber();
626  Double_t dz = fEDz->GetNumber();
627  Double_t alpha1 = fEAlpha1->GetNumber();
628  Double_t theta = fETheta->GetNumber();
629  Double_t phi = fEPhi->GetNumber();
630  Double_t twist = fETwist->GetNumber();
631  Double_t param[12];
632  param[0] = dz;
633  param[1] = theta;
634  param[2] = phi;
635  param[3] = h1;
636  param[7] = h2;
637  param[4] = bl1;
638  param[8] = bl2;
639  param[5] = tl1;
640  param[9] = tl2;
641  param[6] = alpha1;
642  param[10] = alpha1;
643  param[11] = twist;
644  TGeoGtra *shape = (TGeoGtra*)fShape;
645  shape->SetDimensions(param);
646  shape->ComputeBBox();
647  fUndo->SetEnabled();
649  if (fPad) {
651  TView *view = fPad->GetView();
652  if (!view) {
653  fShape->Draw();
654  fPad->GetView()->ShowAxis();
655  } else {
656  view->SetRange(-fShape->GetDX(), -fShape->GetDY(), -fShape->GetDZ(),
657  fShape->GetDX(), fShape->GetDY(), fShape->GetDZ());
658  Update();
659  }
660  } else Update();
661  }
662 }
663 
664 ////////////////////////////////////////////////////////////////////////////////
665 /// Slot for undoing last operation.
666 
668 {
669  fEH1->SetNumber(fH1i);
672  fESc1->SetNumber(1.);
673  fESc2->SetNumber(fSci);
674  fEDz->SetNumber(fDzi);
679  DoApply();
682 }
683 
684 ////////////////////////////////////////////////////////////////////////////////
685 /// Change the twist angle.
686 
688 {
689  Double_t twist = fETwist->GetNumber();
690  if (twist<=-180 || twist>=180) {
691  twist = 0.;
692  fETwist->SetNumber(twist);
693  }
694  DoModified();
695  if (!IsDelayed()) DoApply();
696 }
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
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:155
virtual void SetModel(TObject *obj)
Connect to a given twisted trapezoid.
TGTextButton * fApply
TGNumberEntry * fEPhi
TGeoTrap * fShape
TGNumberEntry * fETwist
Bool_t IsDelayed() const
Check if shape drawing is delayed.
Gtra is a twisted trapezoid.
Definition: TGeoArb8.h:145
virtual Bool_t IsComposite() const
Definition: TGFrame.h:275
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:131
virtual void SetNumber(Double_t val)
See TView3D.
Definition: TView.h:29
virtual void SetRange(const Double_t *min, const Double_t *max)=0
virtual TList * GetList() const
Definition: TGFrame.h:385
Double_t fThetai
TGTextEntry * fShapeName
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGNumberEntry * fEBl1
const Bool_t kFALSE
Definition: Rtypes.h:92
void DoModified()
Slot for notifying modifications.
virtual Double_t GetDY() const
Definition: TGeoBBox.h:73
const char * Class
Definition: TXMLSetup.cxx:64
virtual void ConnectSignals2Slots()
Connect signals to slots.
Double_t GetBl1() const
Definition: TGeoArb8.h:129
virtual void DoUndo()
Slot for undoing last operation.
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:74
TGCompositeFrame * fDFrame
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
virtual void DoApply()
Slot for applying current settings.
Double_t GetH2() const
Definition: TGeoArb8.h:132
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hirarchically all daughters of a composite frame.
Double_t GetTl1() const
Definition: TGeoArb8.h:130
TGNumberEntryField * GetNumberEntry() const
virtual Bool_t IsPaintingShape() const =0
ULong_t Pixel_t
Definition: GuiTypes.h:41
virtual ~TGeoGtraEditor()
Destructor.
void DoName()
Slot for name.
void DoTheta()
Slot for theta.
const char * GetText() const
Definition: TGTextEntry.h:140
TVirtualGeoPainter * GetPainter() const
Definition: TGeoManager.h:187
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.
TRAP is a general trapezoid, i.e.
Definition: TGeoArb8.h:91
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:264
TH1F * h1
Definition: legend1.C:5
Double_t GetH1() const
Definition: TGeoArb8.h:128
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1137
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
void DoTl1()
Slot for Tl1.
virtual Double_t GetDX() const
Definition: TGeoBBox.h:72
TGNumberEntry * fETl1
TGCompositeFrame * fBFrame
virtual void SetSize(const TGDimension &s)
Definition: TGFrame.h:315
virtual EButtonState GetState() const
Definition: TGButton.h:116
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 fIsShapeEditable
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:188
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
void DoPhi()
Slot for phi.
unsigned int UInt_t
Definition: RtypesCore.h:42
TGFrame * fFrame
Definition: TGLayout.h:125
virtual void ShowAxis()=0
const std::string sname
Definition: testIO.cxx:45
ETGeoGtraWid
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:250
virtual void DoUndo()
Slot for undoing last operation.
void SetNumAttr(EAttribute attr=kNEAAnyNumber)
void DoAlpha1()
Slot for alpha1.
TGNumberEntry * fEDz
void DoSc2()
Slot for H2.
#define ClassImp(name)
Definition: Rtypes.h:279
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:554
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
TGDimension GetSize() const
Definition: TGFrame.h:293
ETGeoTrapWid
virtual TView * GetView() const =0
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
virtual ~TGeoTrapEditor()
Destructor.
Double_t GetTheta() const
Definition: TGeoArb8.h:126
Mother of all ROOT objects.
Definition: TObject.h:44
TGNumberEntry * fESc1
void DoDz()
Slot for Z.
Bool_t fInit
Definition: TGedFrame.h:55
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:254
Double_t GetAlpha1() const
Definition: TGeoArb8.h:131
TF1 * f1
Definition: legend1.C:11
virtual void Update()
Override Update from TGedFrame as fGedEditor can be null.
virtual Double_t GetNumber() const
TGNumberEntry * fEH1
UInt_t GetDefaultHeight() const
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.
Double_t GetPhi() const
Definition: TGeoArb8.h:127
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
Definition: TGeoArb8.cxx:2065
TVirtualPad * fPad
Definition: TGeoGedFrame.h:28
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoShape.cxx:723
const Bool_t kTRUE
Definition: Rtypes.h:91
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
Double_t GetDz() const
Definition: TGeoArb8.h:65
virtual void SetDimensions(Double_t *param)
Set all arb8 params in one step.
Definition: TGeoArb8.cxx:1793
TGCheckButton * fDelayed