Logo ROOT   6.14/05
Reference Guide
TCreatePrimitives.cxx
Go to the documentation of this file.
1 // @(#)root/gpad:$Id: TCreatePrimitives.cxx,v 1.0
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 /** \class TCreatePrimitives
12 \ingroup gpad
13 
14 Creates new primitives.
15 
16 The functions in this static class are called by TPad::ExecuteEvent
17 to create new primitives in gPad from the TPad toolbar.
18 */
19 
20 #include "TCanvas.h"
21 #include "TStyle.h"
22 #include "TGraph.h"
23 #include "TMarker.h"
24 #include "TGroupButton.h"
25 #include "TVirtualPad.h"
26 #include "TCreatePrimitives.h"
27 #include "TROOT.h"
28 #include "TSystem.h"
29 #include "TMath.h"
30 #include "KeySymbols.h"
31 #include "TCutG.h"
32 
33 #include <iostream>
34 
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// TCreatePrimitives default constructor.
52 
54 {
55 }
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// TCreatePrimitives destructor.
59 
61 {
62 }
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 /// Create a new arc/ellipse in this gPad.
66 ///
67 /// - Click left button to indicate arrow starting position.
68 /// - Release left button to terminate the arrow.
69 
71 {
72  static Double_t x0, y0, x1, y1;
73  Double_t xc,yc,r1,r2,xold,yold;
74 
75  switch (event) {
76 
77  case kButton1Down:
78  x0 = gPad->AbsPixeltoX(px);
79  y0 = gPad->AbsPixeltoY(py);
80  xold = gPad->AbsPixeltoX(px);
81  yold = gPad->AbsPixeltoY(py);
82  break;
83 
84  case kButton1Motion:
85  xold = gPad->AbsPixeltoX(px);
86  yold = gPad->AbsPixeltoY(py);
87 
88  if (gPad->GetLogx()) xold = TMath::Power(10,xold);
89  if (gPad->GetLogy()) yold = TMath::Power(10,yold);
90 
91  xc = 0.5*(x0+xold);
92  yc = 0.5*(y0+yold);
93  if (mode == kArc) {
94  r1 = 0.5*TMath::Abs(xold-x0);
95  if (fgArc) {
96  fgArc->SetR1(r1);
97  fgArc->SetR2(r1);
98  fgArc->SetX1(xc);
99  fgArc->SetY1(yc);
100  } else {
101  fgArc = new TArc(xc, yc, r1);
102  fgArc->Draw();
103  }
104  gPad->Modified(kTRUE);
105  gPad->Update();
106  }
107  if (mode == kEllipse) {
108  r1 = 0.5*TMath::Abs(xold-x0);
109  r2 = 0.5*TMath::Abs(yold-y0);
110  if (fgEllipse) {
111  fgEllipse->SetR1(r1);
112  fgEllipse->SetR2(r2);
113  fgEllipse->SetX1(xc);
114  fgEllipse->SetY1(yc);
115  } else {
116  fgEllipse = new TEllipse(xc, yc, r1, r2);
117  fgEllipse->Draw();
118  }
119  gPad->Modified(kTRUE);
120  gPad->Update();
121  }
122  break;
123 
124  case kButton1Up:
125  x1 = gPad->AbsPixeltoX(px);
126  y1 = gPad->AbsPixeltoY(py);
127  if (gPad->GetLogx()) {
128  x0 = TMath::Power(10,x0);
129  x1 = TMath::Power(10,x1);
130  }
131  if (gPad->GetLogy()) {
132  y0 = TMath::Power(10,y0);
133  y1 = TMath::Power(10,y1);
134  }
135  xc = 0.5*(x0+x1);
136  yc = 0.5*(y0+y1);
137 
138  if (mode == kArc) {
139  gPad->GetCanvas()->Selected(gPad, fgArc, kButton1Down);
140  fgArc = 0;
141  }
142  if (mode == kEllipse) {
143  gPad->GetCanvas()->Selected(gPad, fgEllipse, kButton1Down);
144  fgEllipse = 0;
145  }
146 
147  gROOT->SetEditorMode();
148  break;
149  }
150 }
151 
152 ////////////////////////////////////////////////////////////////////////////////
153 /// Create a new line/arrow in this gPad.
154 ///
155 /// - Click left button to indicate arrow starting position.
156 /// - Release left button to terminate the arrow.
157 
158 void TCreatePrimitives::Line(Int_t event, Int_t px, Int_t py, Int_t mode)
159 {
160  static Double_t x0, y0, x1, y1;
161 
162  static Int_t pxold, pyold;
163  static Int_t px0, py0;
164  Double_t radius, phimin,phimax;
165 
166  switch (event) {
167 
168  case kButton1Down:
169  x0 = gPad->AbsPixeltoX(px);
170  y0 = gPad->AbsPixeltoY(py);
171  px0 = px; py0 = py;
172  pxold = px; pyold = py;
173  if (gPad->GetLogx()) x0 = TMath::Power(10,x0);
174  if (gPad->GetLogy()) y0 = TMath::Power(10,y0);
175  break;
176 
177  case kButton1Motion:
178  pxold = px;
179  pyold = py;
180 
181  x1 = gPad->AbsPixeltoX(pxold);
182  y1 = gPad->AbsPixeltoY(pyold);
183  if (gPad->GetLogx()) x1 = TMath::Power(10,x1);
184  if (gPad->GetLogy()) y1 = TMath::Power(10,y1);
185 
186  if (mode == kLine) {
187  if (fgLine){
188  fgLine->SetX2(x1);
189  fgLine->SetY2(y1);
190  } else {
191  fgLine = new TLine(x0,y0,x1,y1);
192  fgLine->Draw();
193  }
194  gPad->Modified(kTRUE);
195  gPad->Update();
196  }
197 
198  if (mode == kArrow) {
199  if (fgArrow){
200  fgArrow->SetX2(x1);
201  fgArrow->SetY2(y1);
202  } else {
203  fgArrow = new TArrow(x0,y0,x1,y1
206  fgArrow->Draw();
207  }
208  gPad->Modified(kTRUE);
209  gPad->Update();
210  }
211 
212  if (mode == kCurlyLine) {
213  if (fgCLine) fgCLine->SetEndPoint(x1, y1);
214  else {
215  fgCLine = new TCurlyLine(x0,y0,x1,y1
218  fgCLine->Draw();
219  }
220  gPad->Modified(kTRUE);
221  gPad->Update();
222  }
223 
224  if (mode == kCurlyArc) {
225  //calculate radius in pixels and convert to users x
226  radius = gPad->PixeltoX((Int_t)(TMath::Sqrt((Double_t)((px-px0)*(px-px0) + (py-py0)*(py-py0)))))
227  - gPad->PixeltoX(0);
228  if (fgCArc) {
229  fgCArc->SetStartPoint(x1, y1);
230  fgCArc->SetRadius(radius);
231  } else {
232  phimin = 0;
233  phimax = 360;
234  fgCArc = new TCurlyArc(x0,y0,radius,phimin,phimax
237  fgCArc->Draw();
238  }
239  gPad->Modified(kTRUE);
240  gPad->Update();
241  }
242  break;
243 
244  case kButton1Up:
245  if (mode == kLine) {
246  gPad->GetCanvas()->Selected(gPad, fgLine, kButton1Down);
247  fgLine = 0;
248  }
249  if (mode == kArrow) {
250  gPad->GetCanvas()->Selected(gPad, fgArrow, kButton1Down);
251  fgArrow = 0;
252  }
253  if (mode == kCurlyLine) {
254  gPad->GetCanvas()->Selected(gPad, fgCLine, kButton1Down);
255  fgCLine = 0;
256  }
257  if (mode == kCurlyArc) {
258  gPad->GetCanvas()->Selected(gPad, fgCArc, kButton1Down);
259  fgCArc = 0;
260  }
261  gROOT->SetEditorMode();
262  break;
263  }
264 }
265 
266 ////////////////////////////////////////////////////////////////////////////////
267 /// Create a new pad in gPad.
268 ///
269 /// - Click left button to indicate one corner of the pad.
270 /// - Click left button to indicate the opposite corner.
271 ///
272 /// The new pad is inserted in the pad where the first point is selected.
273 
275 {
276  static Int_t px1old, py1old, px2old, py2old;
277  static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
278  static TPad *padsav;
279  Double_t xlow, ylow, xup, yup;
280  TPad * newpad;
281 
282  Int_t n = 0;
283  TObject *obj;
284  TIter next(gPad->GetListOfPrimitives());
285 
286  while ((obj = next())) {
287  if (obj->InheritsFrom(TPad::Class())) {
288  n++;
289  }
290  }
291 
292  switch (event) {
293 
294  case kButton1Down:
295  padsav = (TPad*)gPad;
296  gPad->cd();
297  px1 = gPad->XtoAbsPixel(gPad->GetX1());
298  py1 = gPad->YtoAbsPixel(gPad->GetY1());
299  px2 = gPad->XtoAbsPixel(gPad->GetX2());
300  py2 = gPad->YtoAbsPixel(gPad->GetY2());
301  px1old = px; py1old = py;
302  break;
303 
304  case kButton1Motion:
305  px2old = px;
306  px2old = TMath::Max(px2old, px1);
307  px2old = TMath::Min(px2old, px2);
308  py2old = py;
309  py2old = TMath::Max(py2old, py2);
310  py2old = TMath::Min(py2old, py1);
311  pxl = TMath::Min(px1old, px2old);
312  pxt = TMath::Max(px1old, px2old);
313  pyl = TMath::Max(py1old, py2old);
314  pyt = TMath::Min(py1old, py2old);
315 
316  if (fgPadBBox) {
317  fgPadBBox->SetX1(gPad->AbsPixeltoX(pxl));
318  fgPadBBox->SetY1(gPad->AbsPixeltoY(pyl));
319  fgPadBBox->SetX2(gPad->AbsPixeltoX(pxt));
320  fgPadBBox->SetY2(gPad->AbsPixeltoY(pyt));
321  } else {
322  fgPadBBox = new TBox(pxl, pyl, pxt, pyt);
323  fgPadBBox->Draw("l");
324  }
325  gPad->Modified(kTRUE);
326  gPad->Update();
327  break;
328 
329  case kButton1Up:
330  fgPadBBox->Delete();
331  fgPadBBox = 0;
332  xlow = (Double_t(pxl) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
333  ylow = (Double_t(py1) - Double_t(pyl))/(Double_t(py1) - Double_t(py2));
334  xup = (Double_t(pxt) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
335  yup = (Double_t(py1) - Double_t(pyt))/(Double_t(py1) - Double_t(py2));
336 
337  gROOT->SetEditorMode();
338  if (xup <= xlow || yup <= ylow) return;
339  newpad = new TPad(Form("%s_%d",gPad->GetName(),n+1),"newpad",xlow, ylow, xup, yup);
340  if (newpad->IsZombie()) break;
341  newpad->SetFillColor(gStyle->GetPadColor());
342  newpad->Draw();
343  TCanvas *canvas = gPad->GetCanvas();
344  if (canvas) canvas->Selected((TPad*)gPad, newpad, kButton1Down);
345  padsav->cd();
346  break;
347  }
348 }
349 
350 ////////////////////////////////////////////////////////////////////////////////
351 /// Create a new pavetext in gPad.
352 ///
353 /// - Click left button to indicate one corner of the pavelabel.
354 /// - Release left button at the opposite corner.
355 
356 void TCreatePrimitives::Pave(Int_t event, Int_t px, Int_t py, Int_t mode)
357 {
358  static Double_t x0, y0;
359  Double_t xp0,xp1,yp0,yp1,xold,yold;
360 
361  if (mode == kPaveLabel)
362  ((TPad *)gPad)->EventPave();
363 
364  switch (event) {
365 
366  case kKeyPress:
367  if (mode == kPaveLabel) {
368  if ((py == kKey_Return) || (py == kKey_Enter)) {
370  Int_t l = s.Length();
371  s.Remove(l-1);
372  fgPaveLabel->SetLabel(s.Data());
374  gPad->Modified(kTRUE);
375  gROOT->SetEditorMode();
376  gPad->Update();
377  fgPaveLabel = 0;
378  } else if (py == kKey_Backspace) {
380  Int_t l = s.Length();
381  if (l>1) {
382  s.Replace(l-2, 2, "<");
383  fgPaveLabel->SetLabel(s.Data());
384  gPad->Modified(kTRUE);
385  gPad->Update();
386  }
387  } else if (isprint(py)) {
389  Int_t l = s.Length();
390  s.Insert(l-1,(char)py);
391  fgPaveLabel->SetLabel(s.Data());
392  gPad->Modified(kTRUE);
393  gPad->Update();
394  }
395  }
396  break;
397 
398  case kButton1Down:
399  x0 = gPad->AbsPixeltoX(px);
400  y0 = gPad->AbsPixeltoY(py);
401  break;
402 
403  case kButton1Motion:
404  xold = gPad->AbsPixeltoX(px);
405  yold = gPad->AbsPixeltoY(py);
406 
407  xp0 = gPad->PadtoX(x0);
408  xp1 = gPad->PadtoX(xold);
409  yp0 = gPad->PadtoY(y0);
410  yp1 = gPad->PadtoY(yold);
411 
412  if (mode == kPave) {
413  if (fgPave) {
414  if (xold < x0) {
415  fgPave->SetX1(xold);
416  fgPave->SetX2(x0);
417  } else {
418  fgPave->SetX1(x0);
419  fgPave->SetX2(xold);
420  }
421  if (yold < y0) {
422  fgPave->SetY1(yold);
423  fgPave->SetY2(y0);
424  } else {
425  fgPave->SetY1(y0);
426  fgPave->SetY2(yold);
427  }
428  } else {
429  fgPave = new TPave(xp0,yp0,xp1,yp1);
430  fgPave->Draw();
431  }
432  gPad->Modified(kTRUE);
433  gPad->Update();
434  }
435 
436  if (mode == kPaveText ) {
437  if (fgPaveText){
438  if (xold < x0) {
439  fgPaveText->SetX1(xold);
440  fgPaveText->SetX2(x0);
441  } else {
442  fgPaveText->SetX1(x0);
443  fgPaveText->SetX2(xold);
444  }
445  if (yold < y0) {
446  fgPaveText->SetY1(yold);
447  fgPaveText->SetY2(y0);
448  } else {
449  fgPaveText->SetY1(y0);
450  fgPaveText->SetY2(yold);
451  }
452  } else {
453  fgPaveText = new TPaveText(xp0,yp0,xp1,yp1);
454  fgPaveText->Draw();
455  }
456  gPad->Modified(kTRUE);
457  gPad->Update();
458  }
459 
460  if (mode == kPavesText) {
461  if (fgPavesText){
462  if (xold < x0) {
463  fgPavesText->SetX1(xold);
464  fgPavesText->SetX2(x0);
465  } else {
466  fgPavesText->SetX1(x0);
467  fgPavesText->SetX2(xold);
468  }
469  if (yold < y0) {
470  fgPavesText->SetY1(yold);
471  fgPavesText->SetY2(y0);
472  } else {
473  fgPavesText->SetY1(y0);
474  fgPavesText->SetY2(yold);
475  }
476  } else {
477  fgPavesText = new TPavesText(xp0,yp0,xp1,yp1);
478  fgPavesText->Draw();
479  }
480  gPad->Modified(kTRUE);
481  gPad->Update();
482  }
483 
484  if (mode == kPaveLabel) {
485  if (fgPaveLabel){
486  if (xold < x0) {
487  fgPaveLabel->SetX1(xold);
488  fgPaveLabel->SetX2(x0);
489  } else {
490  fgPaveLabel->SetX1(x0);
491  fgPaveLabel->SetX2(xold);
492  }
493  if (yold < y0) {
494  fgPaveLabel->SetY1(yold);
495  fgPaveLabel->SetY2(y0);
496  } else {
497  fgPaveLabel->SetY1(y0);
498  fgPaveLabel->SetY2(yold);
499  }
500  } else {
501  fgPaveLabel = new TPaveLabel(xp0,yp0,xp1,yp1,">");
502  fgPaveLabel->Draw();
503  }
504  gPad->Modified(kTRUE);
505  gPad->Update();
506  }
507 
508  if (mode == kDiamond) {
509  if (fgDiamond){
510  if (xold < x0) {
511  fgDiamond->SetX1(xold);
512  fgDiamond->SetX2(x0);
513  } else {
514  fgDiamond->SetX1(x0);
515  fgDiamond->SetX2(xold);
516  }
517  if (yold < y0) {
518  fgDiamond->SetY1(yold);
519  fgDiamond->SetY2(y0);
520  } else {
521  fgDiamond->SetY1(y0);
522  fgDiamond->SetY2(yold);
523  }
524  } else {
525  fgDiamond = new TDiamond(x0,y0,xold,yold);
526  fgDiamond->Draw();
527  }
528  gPad->Modified(kTRUE);
529  gPad->Update();
530  }
531  break;
532 
533  case kButton1Up:
534  gPad->GetCanvas()->Selected(gPad, fgPave, kButton1Down);
535  if (mode == kPave) {
536  gPad->GetCanvas()->Selected(gPad, fgPave, kButton1Down);
537  fgPave = 0;
538  }
539  if (mode == kPaveText ) {
540  gPad->GetCanvas()->Selected(gPad, fgPaveText, kButton1Down);
541  fgPaveText = 0;
542  }
543  if (mode == kPavesText) {
544  gPad->GetCanvas()->Selected(gPad, fgPavesText, kButton1Down);
545  fgPavesText = 0;
546  }
547  if (mode == kDiamond) {
548  gPad->GetCanvas()->Selected(gPad, fgDiamond, kButton1Down);
549  fgDiamond = 0;
550  }
551  if (mode == kPaveLabel) {
552  gPad->GetCanvas()->Selected(gPad, fgPaveLabel, kButton1Down);
553  ((TPad *)gPad)->StartEditing();
555  if (mode == kPaveLabel) {
556  gPad->Modified(kTRUE);
557  gPad->Update();
558  break;
559  }
560  }
561  gROOT->SetEditorMode();
562  break;
563  }
564 }
565 
566 ////////////////////////////////////////////////////////////////////////////////
567 /// Create a new PolyLine in gPad.
568 ///
569 /// - Click left button to indicate a new point.
570 /// - Click left button at same place or double click to close the polyline.
571 
573 {
574  static Int_t pxnew, pynew, pxold, pyold, dp;
575  Double_t xnew, ynew, xold, yold;
576  static Int_t npoints = 0;
577 
578  switch (event) {
579 
580  case kButton1Down:
581  pxnew = px;
582  pynew = py;
583  npoints++;
584  if (fgPolyLine) {
585  fgPolyLine->Set(fgPolyLine->GetN() +1);
586  fgPolyLine->SetPoint(npoints, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
587  gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
588  // stop collecting new points if new point is close to previous point
589  if (npoints > 1) {
590  xnew = gPad->PadtoX(gPad->AbsPixeltoX(pxnew));
591  ynew = gPad->PadtoY(gPad->AbsPixeltoY(pynew));
592  fgPolyLine->GetPoint(fgPolyLine->GetN()-3, xold, yold);
593  pxold = gPad->XtoAbsPixel(xold);
594  pyold = gPad->YtoAbsPixel(yold);
595  dp = TMath::Abs(pxnew-pxold) +TMath::Abs(pynew-pyold);
596  if (dp < 7) {
597  if (mode == kPolyLine) {
598  fgPolyLine->Set(npoints-1);
599  } else {
600  fgPolyLine->GetPoint(0, xnew, ynew);
601  fgPolyLine->SetPoint(npoints, xnew, ynew);
602  }
603  gPad->GetCanvas()->Selected(gPad, fgPolyLine, kButton1Down);
604  fgPolyLine = 0;
605  npoints = 0;
606  gPad->Modified();
607  gPad->Update();
608  gROOT->SetEditorMode();
609  }
610  }
611  }
612  break;
613 
614  case kButton1Double:
615  if (fgPolyLine) {
616  if (mode == kPolyLine) {
617  fgPolyLine->Set(npoints);
618  } else {
619  fgPolyLine->GetPoint(0, xnew, ynew);
620  fgPolyLine->SetPoint(npoints, xnew, ynew);
621  }
622  gPad->GetCanvas()->Selected(gPad, fgPolyLine, kButton1Down);
623  fgPolyLine = 0;
624  npoints = 0;
625  gPad->Modified();
626  gPad->Update();
627  gROOT->SetEditorMode();
628  }
629  break;
630 
631  case kMouseMotion:
632  pxnew = px;
633  pynew = py;
634  if (fgPolyLine) {
635  fgPolyLine->SetPoint(npoints, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
636  gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
637  gPad->Modified();
638  gPad->Update();
639  } else {
640  if (mode == kPolyLine) {
641  fgPolyLine = new TGraph(1);
643  } else { // TCutG case
644  fgPolyLine = (TGraph*) new TCutG("CUTG",1);
645  }
646  fgPolyLine->SetPoint(0, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
647  gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
648  fgPolyLine->Draw("L");
649  }
650  break;
651  }
652 }
653 
654 ////////////////////////////////////////////////////////////////////////////////
655 /// Create a new TLatex at the cursor position in gPad.
656 ///
657 /// - Click left button to indicate the text position.
658 
659 void TCreatePrimitives::Text(Int_t event, Int_t px, Int_t py, Int_t mode)
660 {
661  static Double_t x, y;
662 
663  switch (event) {
664 
665  case kKeyPress:
666  if ((py == kKey_Return) || (py == kKey_Enter)) {
667  TString s(fgText->GetTitle());
668  Int_t l = s.Length();
669  s.Remove(l-1);
670  fgText->SetText(x,y,s.Data());
672  gPad->Modified(kTRUE);
673  gROOT->SetEditorMode();
674  gPad->Update();
675  gPad->GetCanvas()->Selected(gPad, fgText, kButton1Down);
676  fgText = 0;
677  } else if (py == kKey_Backspace) {
678  TString s(fgText->GetTitle());
679  Int_t l = s.Length();
680  if (l>1) {
681  s.Replace(l-2, 2, "<");
682  fgText->SetText(x,y,s.Data());
683  gPad->Modified(kTRUE);
684  gPad->Update();
685  }
686  } else if (isprint(py)) {
687  TString s(fgText->GetTitle());
688  Int_t l = s.Length();
689  s.Insert(l-1,(char)py);
690  fgText->SetText(x,y,s.Data());
691  gPad->Modified(kTRUE);
692  gPad->Update();
693  }
694  break;
695 
696  case kButton1Down:
697  if (fgText) {
698  TString s(fgText->GetTitle());
699  Int_t l = s.Length();
700  s.Remove(l-1);
701  fgText->SetText(x,y,s.Data());
702  }
703 
704  x = gPad->AbsPixeltoX(px);
705  y = gPad->AbsPixeltoY(py);
706  if (gPad->GetLogx()) x = TMath::Power(10,x);
707  if (gPad->GetLogy()) y = TMath::Power(10,y);
708 
709  if (mode == kMarker) {
710  TMarker *marker;
711  marker = new TMarker(x,y,gStyle->GetMarkerStyle());
712  gPad->GetCanvas()->Selected(gPad, marker, kButton1Down);
713  marker->Draw();
714  gROOT->SetEditorMode();
715  break;
716  }
717 
718  ((TPad *)gPad)->StartEditing();
720 
721  fgText = new TLatex(x,y,"<");
722  fgText->Draw();
723  gPad->Modified(kTRUE);
724  gPad->Update();
725  break;
726  }
727 }
virtual void SetY2(Double_t y2)
Definition: TLine.h:67
virtual void Draw(Option_t *option="")
Draw this diamond with its current attributes.
Definition: TDiamond.cxx:93
static TPave * fgPave
static Double_t GetDefaultWaveLength()
Get default wave length.
Definition: TCurlyLine.cxx:440
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition: TCanvas.cxx:1534
static TGraph * fgPolyLine
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:424
static void PolyLine(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new PolyLine in gPad.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
Definition: TPaveText.cxx:233
static Double_t GetDefaultAmplitude()
Get default wave amplitude.
Definition: TCurlyArc.cxx:501
Create a Box.
Definition: TBox.h:24
Definition: Buttons.h:33
R__EXTERN TStyle * gStyle
Definition: TStyle.h:406
virtual void Draw(Option_t *option="")
Draw this marker with its current attributes.
Definition: TMarker.cxx:143
virtual ~TCreatePrimitives()
TCreatePrimitives destructor.
#define gROOT
Definition: TROOT.h:410
static Double_t GetDefaultWaveLength()
Get default wave length.
Definition: TCurlyArc.cxx:493
Basic string class.
Definition: TString.h:131
Manages Markers.
Definition: TMarker.h:23
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:168
int Int_t
Definition: RtypesCore.h:41
static TLatex * fgText
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
virtual void SetX1(Double_t x1)
Definition: TBox.h:63
virtual void SetX2(Double_t x2)
Definition: TBox.h:64
virtual void SetR1(Double_t r1)
Definition: TEllipse.h:65
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:745
virtual void Draw(Option_t *option="")
Draw this pavestext with its current attributes.
Definition: TPavesText.cxx:79
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition: TMath.h:734
static void Text(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new TLatex at the cursor position in gPad.
A TBox with a bordersize and a shadow option.
Definition: TPave.h:19
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition: TAttMarker.h:32
static TDiamond * fgDiamond
static TArc * fgArc
virtual void SetY2(Double_t y2)
Set the Y2 value.
Definition: TPave.cxx:676
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:594
Graphical cut class.
Definition: TCutG.h:20
Double_t x[n]
Definition: legend1.C:17
virtual void SetText(Double_t x, Double_t y, const char *text)
Definition: TText.h:72
static Float_t GetDefaultArrowSize()
Get default arrow size.
Definition: TArrow.cxx:422
void Class()
Definition: Class.C:29
virtual void SetStartPoint(Double_t x1, Double_t y1)
Set start point.
Definition: TCurlyLine.cxx:396
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition: TArrow.cxx:121
static TBox * fgPadBBox
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition: TCurlyLine.h:21
To draw Mathematical Formula.
Definition: TLatex.h:18
static TCurlyLine * fgCLine
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1281
virtual void SetRadius(Double_t radius)
Set Curly Arc radius.
Definition: TCurlyArc.cxx:442
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition: TObject.h:134
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
Definition: TEllipse.cxx:166
static TEllipse * fgEllipse
virtual void SetLabel(const char *label)
Definition: TPaveLabel.h:41
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:20
static Double_t GetDefaultAmplitude()
Get default amplitude.
Definition: TCurlyLine.cxx:448
Create an Arc.
Definition: TArc.h:28
virtual void SetX2(Double_t x2)
Definition: TLine.h:65
virtual void SetEndPoint(Double_t x2, Double_t y2)
Set end point.
Definition: TCurlyLine.cxx:406
virtual void Delete(Option_t *option="")
Delete this object.
Definition: TObject.cxx:169
virtual void SetY1(Double_t y1)
Definition: TEllipse.h:69
static TPaveText * fgPaveText
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Definition: TPolyLine.cxx:232
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
Definition: TGraph.cxx:1580
Definition: Buttons.h:33
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
Definition: Buttons.h:33
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
Draw a Diamond.
Definition: TDiamond.h:21
virtual void SetX1(Double_t x1)
Definition: TEllipse.h:68
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void SetX1(Double_t x1)
Set the X1 value.
Definition: TPave.cxx:637
The most important graphics class in the ROOT system.
Definition: TPad.h:29
static TArrow * fgArrow
char * Form(const char *fmt,...)
virtual void SetR2(Double_t r2)
Definition: TEllipse.h:66
A simple line.
Definition: TLine.h:23
Int_t GetN() const
Definition: TGraph.h:122
static TPavesText * fgPavesText
virtual void SetY2(Double_t y2)
Definition: TBox.h:66
virtual void Draw(Option_t *option="")
Draw this pave with its current attributes.
Definition: TPave.cxx:216
The Canvas class.
Definition: TCanvas.h:31
virtual void SetY1(Double_t y1)
Set the Y1 value.
Definition: TPave.cxx:663
static const double x1[5]
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
double Double_t
Definition: RtypesCore.h:55
Definition: Buttons.h:31
static void Pad(Int_t event, Int_t px, Int_t py, Int_t)
Create a new pad in gPad.
Double_t y[n]
Definition: legend1.C:17
static TPaveLabel * fgPaveLabel
static constexpr double s
const char * GetTitle() const
Returns title of object.
Definition: TPaveLabel.h:36
Draw Ellipses.
Definition: TEllipse.h:24
virtual void SetX2(Double_t x2)
Set the X2 value.
Definition: TPave.cxx:650
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
Definition: TBox.cxx:180
Mother of all ROOT objects.
Definition: TObject.h:37
static Option_t * GetDefaultOption()
Get default option.
Definition: TArrow.cxx:432
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2184
auto * l
Definition: textangle.C:4
static TCurlyArc * fgCArc
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:200
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
#define gPad
Definition: TVirtualPad.h:285
void ResetBit(UInt_t f)
Definition: TObject.h:171
static void Line(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new line/arrow in this gPad.
Double_t Sqrt(Double_t x)
Definition: TMath.h:690
Draw all kinds of Arrows.
Definition: TArrow.h:29
virtual void Set(Int_t n)
Set number of points in the graph Existing coordinates are preserved New coordinates above fNpoints a...
Definition: TGraph.cxx:2133
static TLine * fgLine
A PaveText (see TPaveText) with several stacked paves.
Definition: TPavesText.h:18
static void Pave(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new pavetext in gPad.
virtual void SetY1(Double_t y1)
Definition: TBox.h:65
const Bool_t kTRUE
Definition: RtypesCore.h:87
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition: TCurlyArc.h:20
TCreatePrimitives()
TCreatePrimitives default constructor.
const Int_t n
Definition: legend1.C:16
clip to the frame boundary
Definition: TGraph.h:70
static void Ellipse(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new arc/ellipse in this gPad.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
Color_t GetPadColor() const
Definition: TStyle.h:195