Logo ROOT  
Reference Guide
TLine.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Rene Brun 12/12/94
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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#include <stdlib.h>
13
14#include "Riostream.h"
15#include "TROOT.h"
16#include "TLine.h"
17#include "TVirtualPad.h"
18#include "TClass.h"
19#include "TVirtualX.h"
20#include "TMath.h"
21#include "TPoint.h"
22
24
25/** \class TLine
26\ingroup BasicGraphics
27
28A simple line.
29*/
30
31
32////////////////////////////////////////////////////////////////////////////////
33/// Line normal constructor.
34
36 :TObject(), TAttLine()
37{
38 fX1=x1; fY1=y1; fX2=x2; fY2=y2;
39}
40
41
42////////////////////////////////////////////////////////////////////////////////
43/// Line copy constructor.
44
46{
47 line.TLine::Copy(*this);
48}
49
50////////////////////////////////////////////////////////////////////////////////
51/// Assignment operator
52
54{
55 src.TLine::Copy(*this);
56 return *this;
57}
58
59////////////////////////////////////////////////////////////////////////////////
60/// Copy this line to line.
61
62void TLine::Copy(TObject &obj) const
63{
64 TObject::Copy(obj);
65 TAttLine::Copy(((TLine&)obj));
66 ((TLine&)obj).fX1 = fX1;
67 ((TLine&)obj).fY1 = fY1;
68 ((TLine&)obj).fX2 = fX2;
69 ((TLine&)obj).fY2 = fY2;
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// Compute distance from point px,py to a line.
74
76{
77 if (!TestBit(kLineNDC)) return DistancetoLine(px,py,gPad->XtoPad(fX1),gPad->YtoPad(fY1),gPad->XtoPad(fX2),gPad->YtoPad(fY2));
78 Double_t x1 = gPad->GetX1() + fX1*(gPad->GetX2()-gPad->GetX1());
79 Double_t y1 = gPad->GetY1() + fY1*(gPad->GetY2()-gPad->GetY1());
80 Double_t x2 = gPad->GetX1() + fX2*(gPad->GetX2()-gPad->GetX1());
81 Double_t y2 = gPad->GetY1() + fY2*(gPad->GetY2()-gPad->GetY1());
82 return DistancetoLine(px,py,x1,y1,x2,y2);
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Draw this line with new coordinates.
87
89{
90 TLine *newline = new TLine(x1, y1, x2, y2);
91 TAttLine::Copy(*newline);
92 newline->SetBit(kCanDelete);
93 newline->AppendPad();
94 return newline;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Draw this line with new coordinates in NDC.
99
101{
102 TLine *newline = DrawLine(x1, y1, x2, y2);
103 newline->SetBit(kLineNDC);
104 return newline;
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Execute action corresponding to one event.
109/// This member function is called when a line is clicked with the locator
110///
111/// If Left button clicked on one of the line end points, this point
112/// follows the cursor until button is released.
113///
114/// if Middle button clicked, the line is moved parallel to itself
115/// until the button is released.
116
118{
119 if (!gPad) return;
120
121 Int_t kMaxDiff = 20;
122 static Int_t d1,d2,px1,px2,py1,py2;
123 static Int_t pxold, pyold, px1old, py1old, px2old, py2old;
124 static Double_t oldX1, oldY1, oldX2, oldY2;
125 static Bool_t p1, p2, pL, ndcsav;
126 Double_t dpx,dpy,xp1,yp1;
127 Int_t dx, dy;
128
129 Bool_t opaque = gPad->OpaqueMoving();
130
131 if (!gPad->IsEditable()) return;
132
133 switch (event) {
134
135 case kArrowKeyPress:
136 case kButton1Down:
137 oldX1 = GetX1();
138 oldY1 = GetY1();
139 oldX2 = GetX2();
140 oldY2 = GetY2();
141 ndcsav = TestBit(kLineNDC);
142 if (!opaque) {
143 gVirtualX->SetLineColor(-1);
144 TAttLine::Modify(); //Change line attributes only if necessary
145 }
146
147 // No break !!!
148
149 case kMouseMotion:
150
151 if (TestBit(kLineNDC)) {
152 px1 = gPad->UtoPixel(GetX1());
153 py1 = gPad->VtoPixel(GetY1());
154 px2 = gPad->UtoPixel(GetX2());
155 py2 = gPad->VtoPixel(GetY2());
156 } else {
157 px1 = gPad->XtoAbsPixel(gPad->XtoPad(GetX1()));
158 py1 = gPad->YtoAbsPixel(gPad->YtoPad(GetY1()));
159 px2 = gPad->XtoAbsPixel(gPad->XtoPad(GetX2()));
160 py2 = gPad->YtoAbsPixel(gPad->YtoPad(GetY2()));
161 }
162 p1 = p2 = pL = kFALSE;
163
164 d1 = abs(px1 - px) + abs(py1-py); //simply take sum of pixels differences
165 if (d1 < kMaxDiff) { //*-*================>OK take point number 1
166 px1old = px1; py1old = py1;
167 p1 = kTRUE;
168 gPad->SetCursor(kPointer);
169 return;
170 }
171 d2 = abs(px2 - px) + abs(py2-py); //simply take sum of pixels differences
172 if (d2 < kMaxDiff) { //*-*================>OK take point number 2
173 px2old = px2; py2old = py2;
174 p2 = kTRUE;
175 gPad->SetCursor(kPointer);
176 return;
177 }
178
179 pL = kTRUE;
180 pxold = px; pyold = py;
181 gPad->SetCursor(kMove);
182
183 break;
184
185 case kArrowKeyRelease:
186 case kButton1Motion:
187
188 if (p1) {
189 if (!opaque) {
190 gVirtualX->DrawLine(px1old, py1old, px2, py2);
191 gVirtualX->DrawLine(px, py, px2, py2);
192 } else {
193 if (ndcsav) {
194 SetNDC(kFALSE);
195 SetX2(gPad->GetX1() + oldX2*(gPad->GetX2()-gPad->GetX1()));
196 SetY2(gPad->GetY1() + oldY2*(gPad->GetY2()-gPad->GetY1()));
197 }
198 SetX1(gPad->AbsPixeltoX(px));
199 SetY1(gPad->AbsPixeltoY(py));
200 }
201 px1old = px;
202 py1old = py;
203 }
204 if (p2) {
205 if (!opaque) {
206 gVirtualX->DrawLine(px1, py1, px2old, py2old);
207 gVirtualX->DrawLine(px1, py1, px, py);
208 } else {
209 if (ndcsav) {
210 SetNDC(kFALSE);
211 SetX1(gPad->GetX1() + oldX1*(gPad->GetX2()-gPad->GetX1()));
212 SetY1(gPad->GetY1() + oldY1*(gPad->GetY2()-gPad->GetY1()));
213 }
214 SetX2(gPad->AbsPixeltoX(px));
215 SetY2(gPad->AbsPixeltoY(py));
216 }
217 px2old = px;
218 py2old = py;
219 }
220 if (pL) {
221 if (!opaque) gVirtualX->DrawLine(px1, py1, px2, py2);
222 dx = px-pxold; dy = py-pyold;
223 px1 += dx; py1 += dy; px2 += dx; py2 += dy;
224 if (!opaque) gVirtualX->DrawLine(px1, py1, px2, py2);
225 pxold = px;
226 pyold = py;
227 if (opaque) {
228 if (ndcsav) SetNDC(kFALSE);
229 SetX1(gPad->AbsPixeltoX(px1));
230 SetY1(gPad->AbsPixeltoY(py1));
231 SetX2(gPad->AbsPixeltoX(px2));
232 SetY2(gPad->AbsPixeltoY(py2));
233 }
234 }
235 if (opaque) {
236 if (p1) {
237 //check in which corner the BBox is edited
238 if (GetX1() > GetX2()) {
239 if (GetY1() > GetY2())
240 gPad->ShowGuidelines(this, event, '2', true);
241 else
242 gPad->ShowGuidelines(this, event, '3', true);
243 } else {
244 if (GetY1() > GetY2())
245 gPad->ShowGuidelines(this, event, '1', true);
246 else
247 gPad->ShowGuidelines(this, event, '4', true);
248 }
249 }
250 if (p2) {
251 //check in which corner the BBox is edited
252 if (GetX1() > GetX2()) {
253 if (GetY1() > GetY2())
254 gPad->ShowGuidelines(this, event, '4', true);
255 else
256 gPad->ShowGuidelines(this, event, '1', true);
257 } else {
258 if (GetY1() > GetY2())
259 gPad->ShowGuidelines(this, event, '3', true);
260 else
261 gPad->ShowGuidelines(this, event, '2', true);
262 }
263 }
264 if (pL) {
265 gPad->ShowGuidelines(this, event, 'i', true);
266 }
267 gPad->Modified(kTRUE);
268 gPad->Update();
269 }
270 break;
271
272 case kButton1Up:
273
274 if (gROOT->IsEscaped()) {
275 gROOT->SetEscape(kFALSE);
276 if (opaque) {
277 SetX1(oldX1);
278 SetY1(oldY1);
279 SetX2(oldX2);
280 SetY2(oldY2);
281 gPad->Modified(kTRUE);
282 gPad->Update();
283 }
284 break;
285 }
286 if (opaque) {
287 if (ndcsav && !TestBit(kLineNDC)) {
288 SetX1((GetX1() - gPad->GetX1())/(gPad->GetX2()-gPad->GetX1()));
289 SetX2((GetX2() - gPad->GetX1())/(gPad->GetX2()-gPad->GetX1()));
290 SetY1((GetY1() - gPad->GetY1())/(gPad->GetY2()-gPad->GetY1()));
291 SetY2((GetY2() - gPad->GetY1())/(gPad->GetY2()-gPad->GetY1()));
292 SetNDC();
293 }
294 gPad->ShowGuidelines(this, event);
295 } else {
296 if (TestBit(kLineNDC)) {
297 dpx = gPad->GetX2() - gPad->GetX1();
298 dpy = gPad->GetY2() - gPad->GetY1();
299 xp1 = gPad->GetX1();
300 yp1 = gPad->GetY1();
301 if (p1) {
302 SetX1((gPad->AbsPixeltoX(px)-xp1)/dpx);
303 SetY1((gPad->AbsPixeltoY(py)-yp1)/dpy);
304 }
305 if (p2) {
306 SetX2((gPad->AbsPixeltoX(px)-xp1)/dpx);
307 SetY2((gPad->AbsPixeltoY(py)-yp1)/dpy);
308 }
309 if (pL) {
310 SetX1((gPad->AbsPixeltoX(px1)-xp1)/dpx);
311 SetY1((gPad->AbsPixeltoY(py1)-yp1)/dpy);
312 SetX2((gPad->AbsPixeltoX(px2)-xp1)/dpx);
313 SetY2((gPad->AbsPixeltoY(py2)-yp1)/dpy);
314 }
315 } else {
316 if (p1) {
317 SetX1(gPad->PadtoX(gPad->AbsPixeltoX(px)));
318 SetY1(gPad->PadtoY(gPad->AbsPixeltoY(py)));
319 }
320 if (p2) {
321 SetX2(gPad->PadtoX(gPad->AbsPixeltoX(px)));
322 SetY2(gPad->PadtoY(gPad->AbsPixeltoY(py)));
323 }
324 if (pL) {
325 SetX1(gPad->PadtoX(gPad->AbsPixeltoX(px1)));
326 SetY1(gPad->PadtoY(gPad->AbsPixeltoY(py1)));
327 SetX2(gPad->PadtoX(gPad->AbsPixeltoX(px2)));
328 SetY2(gPad->PadtoY(gPad->AbsPixeltoY(py2)));
329 }
330 }
331 if (TestBit(kVertical)) {
332 if (p1) SetX2(GetX1());
333 if (p2) SetX1(GetX2());
334 }
335 if (TestBit(kHorizontal)) {
336 if (p1) SetY2(GetY1());
337 if (p2) SetY1(GetY2());
338 }
339 gPad->Modified(kTRUE);
340 gPad->Update();
341 if (!opaque) gVirtualX->SetLineColor(-1);
342 }
343 break;
344
345 case kButton1Locate:
346
347 ExecuteEvent(kButton1Down, px, py);
348 while (1) {
349 px = py = 0;
350 event = gVirtualX->RequestLocator(1,1,px,py);
351
353
354 if (event != -1) { // button is released
355 ExecuteEvent(kButton1Up, px, py);
356 return;
357 }
358 }
359 }
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// List this line with its attributes.
364
365void TLine::ls(Option_t *) const
366{
368 printf("%s X1=%f Y1=%f X2=%f Y2=%f\n",IsA()->GetName(),fX1,fY1,fX2,fY2);
369}
370
371////////////////////////////////////////////////////////////////////////////////
372/// Paint this line with its current attributes.
373
375{
377 else PaintLine(gPad->XtoPad(fX1),gPad->YtoPad(fY1),gPad->XtoPad(fX2),gPad->YtoPad(fY2));
378}
379
380////////////////////////////////////////////////////////////////////////////////
381/// Draw this line with new coordinates.
382
384{
385 TAttLine::Modify(); //Change line attributes only if necessary
386 gPad->PaintLine(x1,y1,x2,y2);
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Draw this line with new coordinates in NDC.
391
393{
394 TAttLine::Modify(); //Change line attributes only if necessary
395 gPad->PaintLineNDC(u1,v1,u2,v2);
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Dump this line with its attributes.
400
402{
403 printf("%s X1=%f Y1=%f X2=%f Y2=%f",IsA()->GetName(),fX1,fY1,fX2,fY2);
404 if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
405 if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
406 if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
407 printf("\n");
408}
409
410////////////////////////////////////////////////////////////////////////////////
411/// Save primitive as a C++ statement(s) on output stream out
412
413void TLine::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
414{
415 if (gROOT->ClassSaved(TLine::Class())) {
416 out<<" ";
417 } else {
418 out<<" TLine *";
419 }
420 out<<"line = new TLine("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2<<");"<<std::endl;
421
422 SaveLineAttributes(out,"line",1,1,1);
423
424 if (TestBit(kLineNDC))
425 out<<" line->SetNDC();"<<std::endl;
426
427 out<<" line->Draw();"<<std::endl;
428}
429
430////////////////////////////////////////////////////////////////////////////////
431/// Check whether this line is to be drawn horizontally.
432
434{
435 return TestBit(kHorizontal);
436}
437
438////////////////////////////////////////////////////////////////////////////////
439/// Check whether this line is to be drawn vertically.
440
442{
443 return TestBit(kVertical);
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Set NDC mode on if isNDC = kTRUE, off otherwise
448
450{
452 if (isNDC) SetBit(kLineNDC);
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Force the line to be drawn horizontally.
457/// Makes fY2 equal to fY1. The line length is kept.
458/// TArrow and TGaxis also get this function by inheritance.
459
460void TLine::SetHorizontal(Bool_t set /*= kTRUE*/)
461{
462 SetBit(kHorizontal, set);
463 if (set) {
465 Int_t px1 = gPad->XtoAbsPixel(fX1);
466 Int_t px2 = gPad->XtoAbsPixel(fX2);
467 Int_t py1 = gPad->YtoAbsPixel(fY1);
468 Int_t py2 = gPad->YtoAbsPixel(fY2);
469 Int_t l = Int_t(TMath::Sqrt((px2-px1)*(px2-px1)+(py2-py1)*(py2-py1)));
470 if (fX2 >= fX1) fX2 = gPad->AbsPixeltoX(px1+l);
471 else fX2 = gPad->AbsPixeltoX(px1-l);
472 fY2 = fY1;
473 }
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Force the line to be drawn vertically.
478/// Makes fX2 equal to fX1. The line length is kept.
479/// TArrow and TGaxis also get this function by inheritance.
480
481void TLine::SetVertical(Bool_t set /*= kTRUE*/)
482{
483 SetBit(kVertical, set);
484 if (set) {
486 Int_t px1 = gPad->XtoAbsPixel(fX1);
487 Int_t px2 = gPad->XtoAbsPixel(fX2);
488 Int_t py1 = gPad->YtoAbsPixel(fY1);
489 Int_t py2 = gPad->YtoAbsPixel(fY2);
490 Int_t l = Int_t(TMath::Sqrt((px2-px1)*(px2-px1)+(py2-py1)*(py2-py1)));
491 if (fY2 >= fY1) fY2 = gPad->AbsPixeltoY(py1-l);
492 else fY2 = gPad->AbsPixeltoY(py1+l);
493 fX2 = fX1;
494 }
495}
496
497////////////////////////////////////////////////////////////////////////////////
498/// Stream an object of class TLine.
499
500void TLine::Streamer(TBuffer &R__b)
501{
502 if (R__b.IsReading()) {
503 UInt_t R__s, R__c;
504 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
505 if (R__v > 1) {
506 R__b.ReadClassBuffer(TLine::Class(), this, R__v, R__s, R__c);
507 return;
508 }
509 //====process old versions before automatic schema evolution
510 TObject::Streamer(R__b);
511 TAttLine::Streamer(R__b);
512 Float_t x1,y1,x2,y2;
513 R__b >> x1; fX1 = x1;
514 R__b >> y1; fY1 = y1;
515 R__b >> x2; fX2 = x2;
516 R__b >> y2; fY2 = y2;
517 //====end of old versions
518
519 } else {
520 R__b.WriteClassBuffer(TLine::Class(),this);
521 }
522}
523////////////////////////////////////////////////////////////////////////////////
524/// Return the bounding Box of the Line
525
527{
528 Rectangle_t BBox;
529 Int_t px1, py1, px2, py2;
530 px1 = gPad->XtoPixel(fX1);
531 px2 = gPad->XtoPixel(fX2);
532 py1 = gPad->YtoPixel(fY1);
533 py2 = gPad->YtoPixel(fY2);
534
535 Int_t tmp;
536 if (px1>px2) { tmp = px1; px1 = px2; px2 = tmp;}
537 if (py1>py2) { tmp = py1; py1 = py2; py2 = tmp;}
538
539 BBox.fX = px1;
540 BBox.fY = py1;
541 BBox.fWidth = px2-px1;
542 BBox.fHeight = py2-py1;
543
544 return (BBox);
545}
546
547////////////////////////////////////////////////////////////////////////////////
548/// Return the center of the BoundingBox as TPoint in pixels
549
551{
552 TPoint p;
553 p.SetX(gPad->XtoPixel(TMath::Min(fX1,fX2)+0.5*(TMath::Max(fX1, fX2)-TMath::Min(fX1, fX2))));
554 p.SetY(gPad->YtoPixel(TMath::Min(fY1,fY2)+0.5*(TMath::Max(fY1, fY2)-TMath::Min(fY1, fY2))));
555 return(p);
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Set center of the BoundingBox
560
562{
565 if (fX2>fX1) {
566 this->SetX1(gPad->PixeltoX(p.GetX())-0.5*w);
567 this->SetX2(gPad->PixeltoX(p.GetX())+0.5*w);
568 }
569 else {
570 this->SetX2(gPad->PixeltoX(p.GetX())-0.5*w);
571 this->SetX1(gPad->PixeltoX(p.GetX())+0.5*w);
572 }
573 if (fY2>fY1) {
574 this->SetY1(gPad->PixeltoY(p.GetY()-gPad->VtoPixel(0))-0.5*h);
575 this->SetY2(gPad->PixeltoY(p.GetY()-gPad->VtoPixel(0))+0.5*h);
576 }
577 else {
578 this->SetY2(gPad->PixeltoY(p.GetY()-gPad->VtoPixel(0))-0.5*h);
579 this->SetY1(gPad->PixeltoY(p.GetY()-gPad->VtoPixel(0))+0.5*h);
580 }
581}
582
583////////////////////////////////////////////////////////////////////////////////
584/// Set X coordinate of the center of the BoundingBox
585
587{
589 if (fX2>fX1) {
590 this->SetX1(gPad->PixeltoX(x)-0.5*w);
591 this->SetX2(gPad->PixeltoX(x)+0.5*w);
592 }
593 else {
594 this->SetX2(gPad->PixeltoX(x)-0.5*w);
595 this->SetX1(gPad->PixeltoX(x)+0.5*w);
596 }
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Set Y coordinate of the center of the BoundingBox
601
603{
605 if (fY2>fY1) {
606 this->SetY1(gPad->PixeltoY(y-gPad->VtoPixel(0))-0.5*h);
607 this->SetY2(gPad->PixeltoY(y-gPad->VtoPixel(0))+0.5*h);
608 }
609 else {
610 this->SetY2(gPad->PixeltoY(y-gPad->VtoPixel(0))-0.5*h);
611 this->SetY1(gPad->PixeltoY(y-gPad->VtoPixel(0))+0.5*h);
612 }
613}
614
615////////////////////////////////////////////////////////////////////////////////
616/// Set left hand side of BoundingBox to a value
617/// (resize in x direction on left)
618
620{
621 if (fX2>fX1)
622 this->SetX1(gPad->PixeltoX(x));
623 else
624 this->SetX2(gPad->PixeltoX(x));
625}
626
627////////////////////////////////////////////////////////////////////////////////
628/// Set right hand side of BoundingBox to a value
629/// (resize in x direction on right)
630
632{
633 if (fX2>fX1)
634 this->SetX2(gPad->PixeltoX(x));
635 else
636 this->SetX1(gPad->PixeltoX(x));
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Set top of BoundingBox to a value (resize in y direction on top)
641
643{
644 if (fY2>fY1)
645 this->SetY2(gPad->PixeltoY(y - gPad->VtoPixel(0)));
646 else
647 this->SetY1(gPad->PixeltoY(y - gPad->VtoPixel(0)));
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// Set bottom of BoundingBox to a value
652/// (resize in y direction on bottom)
653
655{
656 if (fY2>fY1)
657 this->SetY1(gPad->PixeltoY(y - gPad->VtoPixel(0)));
658 else
659 this->SetY2(gPad->PixeltoY(y - gPad->VtoPixel(0)));
660}
@ kMouseMotion
Definition: Buttons.h:23
@ kArrowKeyRelease
Definition: Buttons.h:21
@ kButton1Motion
Definition: Buttons.h:20
@ kButton1Up
Definition: Buttons.h:19
@ kArrowKeyPress
Definition: Buttons.h:21
@ kButton1Down
Definition: Buttons.h:17
@ kButton1Locate
Definition: Buttons.h:22
void Class()
Definition: Class.C:29
#define h(i)
Definition: RSha256.hxx:106
static const double x2[5]
static const double x1[5]
int Int_t
Definition: RtypesCore.h:41
short Version_t
Definition: RtypesCore.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
#define gROOT
Definition: TROOT.h:415
#define gPad
Definition: TVirtualPad.h:286
#define gVirtualX
Definition: TVirtualX.h:345
@ kMove
Definition: TVirtualX.h:46
@ kPointer
Definition: TVirtualX.h:47
Abstract base class for elements drawn in the editor.
Definition: TAttBBox2D.h:19
Line Attributes class.
Definition: TAttLine.h:18
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:35
virtual Style_t GetLineStyle() const
Return the line style.
Definition: TAttLine.h:34
virtual void Modify()
Change current line attributes if necessary.
Definition: TAttLine.cxx:242
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition: TAttLine.cxx:172
Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
Compute distance from point px,py to a line.
Definition: TAttLine.cxx:206
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition: TAttLine.cxx:270
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
A simple line.
Definition: TLine.h:23
virtual void SetY2(Double_t y2)
Definition: TLine.h:69
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the BoundingBox.
Definition: TLine.cxx:586
Double_t fY1
Y of 1st point.
Definition: TLine.h:27
Double_t fX1
X of 1st point.
Definition: TLine.h:26
virtual void SetX2(Double_t x2)
Definition: TLine.h:67
Bool_t IsVertical()
Check whether this line is to be drawn vertically.
Definition: TLine.cxx:441
virtual void ls(Option_t *option="") const
List this line with its attributes.
Definition: TLine.cxx:365
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition: TLine.cxx:88
void SetVertical(Bool_t set=kTRUE)
Force the line to be drawn vertically.
Definition: TLine.cxx:481
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition: TLine.cxx:383
TLine()
Definition: TLine.h:39
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
Definition: TLine.cxx:75
virtual void SetBBoxCenter(const TPoint &p)
Set center of the BoundingBox.
Definition: TLine.cxx:561
virtual Rectangle_t GetBBox()
Return the bounding Box of the Line.
Definition: TLine.cxx:526
virtual TLine * DrawLineNDC(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates in NDC.
Definition: TLine.cxx:100
virtual void Print(Option_t *option="") const
Dump this line with its attributes.
Definition: TLine.cxx:401
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
Definition: TLine.cxx:631
Bool_t IsHorizontal()
Check whether this line is to be drawn horizontally.
Definition: TLine.cxx:433
Double_t GetY1() const
Definition: TLine.h:53
Double_t GetX2() const
Definition: TLine.h:52
Double_t fX2
X of 2nd point.
Definition: TLine.h:28
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Definition: TLine.cxx:642
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TLine.cxx:117
@ kLineNDC
Use NDC coordinates.
Definition: TLine.h:34
@ kHorizontal
Line is horizontal.
Definition: TLine.h:36
@ kVertical
Line is vertical.
Definition: TLine.h:35
virtual void SetX1(Double_t x1)
Definition: TLine.h:66
TLine & operator=(const TLine &src)
Assignment operator.
Definition: TLine.cxx:53
Double_t fY2
Y of 2nd point.
Definition: TLine.h:29
virtual void PaintLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
Draw this line with new coordinates in NDC.
Definition: TLine.cxx:392
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the BoundingBox.
Definition: TLine.cxx:602
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition: TLine.cxx:654
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TLine.cxx:413
void Copy(TObject &line) const
Copy this line to line.
Definition: TLine.cxx:62
virtual void SetY1(Double_t y1)
Definition: TLine.h:68
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
Definition: TLine.cxx:619
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TLine.cxx:449
virtual TPoint GetBBoxCenter()
Return the center of the BoundingBox as TPoint in pixels.
Definition: TLine.cxx:550
Double_t GetX1() const
Definition: TLine.h:51
void SetHorizontal(Bool_t set=kTRUE)
Force the line to be drawn horizontally.
Definition: TLine.cxx:460
virtual void Paint(Option_t *option="")
Paint this line with its current attributes.
Definition: TLine.cxx:374
Double_t GetY2() const
Definition: TLine.h:54
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:105
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void Copy(TObject &object) const
Copy this to obj.
Definition: TObject.cxx:61
void ResetBit(UInt_t f)
Definition: TObject.h:171
@ kCanDelete
if object in a list can be deleted
Definition: TObject.h:58
Definition: TPoint.h:31
SCoord_t GetY() const
Definition: TPoint.h:47
void SetX(SCoord_t x)
Definition: TPoint.h:48
void SetY(SCoord_t y)
Definition: TPoint.h:49
SCoord_t GetX() const
Definition: TPoint.h:46
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2829
TLine * line
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Double_t Sqrt(Double_t x)
Definition: TMath.h:681
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
Short_t fX
Definition: GuiTypes.h:361
UShort_t fHeight
Definition: GuiTypes.h:362
Short_t fY
Definition: GuiTypes.h:361
UShort_t fWidth
Definition: GuiTypes.h:362
auto * l
Definition: textangle.C:4