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