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