Logo ROOT  
Reference Guide
TLine.h
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 #ifndef ROOT_TLine
13 #define ROOT_TLine
14 
15 
16 #include "TObject.h"
17 #include "TAttLine.h"
18 #include "TAttBBox2D.h"
19 
20 class TPoint;
21 
22 class TLine : public TObject, public TAttLine, public TAttBBox2D {
23 
24 protected:
25  Double_t fX1{0}; ///< X of 1st point
26  Double_t fY1{0}; ///< Y of 1st point
27  Double_t fX2{0}; ///< X of 2nd point
28  Double_t fY2{0}; ///< Y of 2nd point
29 
30 public:
31  // TLine status bits
32  enum {
33  kLineNDC = BIT(14), ///< Use NDC coordinates
34  kVertical = BIT(15), ///< Line is vertical
35  kHorizontal = BIT(16) ///< Line is horizontal
36  };
37 
38  TLine() {}
40  TLine(const TLine &line);
41  virtual ~TLine() = default;
42 
43  TLine &operator=(const TLine &src);
44 
45  void Copy(TObject &line) const;
46  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
49  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
50  Double_t GetX1() const {return fX1;}
51  Double_t GetX2() const {return fX2;}
52  Double_t GetY1() const {return fY1;}
53  Double_t GetY2() const {return fY2;}
56  virtual void ls(Option_t *option="") const;
57  virtual void Paint(Option_t *option="");
58  virtual void PaintLine(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
59  virtual void PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t v2);
60  virtual void Print(Option_t *option="") const;
61  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
62  virtual void SetNDC(Bool_t isNDC=kTRUE);
63  void SetHorizontal(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsHorizontal
64  void SetVertical(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsVertical
65  virtual void SetX1(Double_t x1) {fX1=x1;}
66  virtual void SetX2(Double_t x2) {fX2=x2;}
67  virtual void SetY1(Double_t y1) {fY1=y1;}
68  virtual void SetY2(Double_t y2) {fY2=y2;}
69  virtual Rectangle_t GetBBox();
70  virtual TPoint GetBBoxCenter();
71  virtual void SetBBoxCenter(const TPoint &p);
72  virtual void SetBBoxCenterX(const Int_t x);
73  virtual void SetBBoxCenterY(const Int_t y);
74  virtual void SetBBoxX1(const Int_t x);
75  virtual void SetBBoxX2(const Int_t x);
76  virtual void SetBBoxY1(const Int_t y);
77  virtual void SetBBoxY2(const Int_t y);
78 
79  ClassDef(TLine,3) //A line segment
80 };
81 
82 #endif
TAttBBox2D.h
TLine::SetBBoxCenter
virtual void SetBBoxCenter(const TPoint &p)
Set center of the BoundingBox.
Definition: TLine.cxx:562
TLine::GetX2
Double_t GetX2() const
Definition: TLine.h:51
TLine::DrawLine
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
TLine::fX1
Double_t fX1
X of 1st point.
Definition: TLine.h:25
TLine::SetY2
virtual void SetY2(Double_t y2)
Definition: TLine.h:68
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TLine::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TLine.cxx:118
TLine
A simple line.
Definition: TLine.h:22
Option_t
const char Option_t
Definition: RtypesCore.h:66
TLine::fX2
Double_t fX2
X of 2nd point.
Definition: TLine.h:27
TLine::kLineNDC
@ kLineNDC
Use NDC coordinates.
Definition: TLine.h:33
TLine::SetBBoxY2
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition: TLine.cxx:655
Rectangle_t
Definition: GuiTypes.h:360
TLine::IsVertical
Bool_t IsVertical()
Check whether this line is to be drawn vertically.
Definition: TLine.cxx:442
TLine::GetX1
Double_t GetX1() const
Definition: TLine.h:50
TLine::GetY1
Double_t GetY1() const
Definition: TLine.h:52
TLine::TLine
TLine()
Definition: TLine.h:38
TLine::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a line.
Definition: TLine.cxx:76
TLine::PaintLineNDC
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
Int_t
int Int_t
Definition: RtypesCore.h:45
x
Double_t x[n]
Definition: legend1.C:17
TLine::ls
virtual void ls(Option_t *option="") const
List this line with its attributes.
Definition: TLine.cxx:366
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TLine::SetBBoxY1
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Definition: TLine.cxx:643
TLine::SetBBoxCenterX
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the BoundingBox.
Definition: TLine.cxx:587
TLine::SetHorizontal
void SetHorizontal(Bool_t set=kTRUE)
Force the line to be drawn horizontally.
Definition: TLine.cxx:461
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TAttBBox2D
Abstract base class for elements drawn in the editor.
Definition: TAttBBox2D.h:19
TAttLine.h
TLine::Paint
virtual void Paint(Option_t *option="")
Paint this line with its current attributes.
Definition: TLine.cxx:375
TLine::IsHorizontal
Bool_t IsHorizontal()
Check whether this line is to be drawn horizontally.
Definition: TLine.cxx:434
TLine::PaintLine
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::fY1
Double_t fY1
Y of 1st point.
Definition: TLine.h:26
TAttLine
Line Attributes class.
Definition: TAttLine.h:18
TLine::SetX2
virtual void SetX2(Double_t x2)
Definition: TLine.h:66
TLine::GetBBoxCenter
virtual TPoint GetBBoxCenter()
Return the center of the BoundingBox as TPoint in pixels.
Definition: TLine.cxx:551
TLine::SetBBoxX2
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
TLine::SetBBoxX1
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
TLine::SetX1
virtual void SetX1(Double_t x1)
Definition: TLine.h:65
TLine::SetY1
virtual void SetY1(Double_t y1)
Definition: TLine.h:67
BIT
#define BIT(n)
Definition: Rtypes.h:85
y
Double_t y[n]
Definition: legend1.C:17
line
TLine * line
Definition: entrylistblock_figure1.C:235
TLine::SetVertical
void SetVertical(Bool_t set=kTRUE)
Force the line to be drawn vertically.
Definition: TLine.cxx:482
TLine::Print
virtual void Print(Option_t *option="") const
Dump this line with its attributes.
Definition: TLine.cxx:402
TLine::GetBBox
virtual Rectangle_t GetBBox()
Return the bounding Box of the Line.
Definition: TLine.cxx:527
TLine::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TLine.cxx:414
TLine::DrawLineNDC
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
TPoint
Definition: TPoint.h:31
v1
@ v1
Definition: rootcling_impl.cxx:3637
Double_t
double Double_t
Definition: RtypesCore.h:59
TObject.h
v2
@ v2
Definition: rootcling_impl.cxx:3638
TLine::~TLine
virtual ~TLine()=default
TLine::kHorizontal
@ kHorizontal
Line is horizontal.
Definition: TLine.h:35
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TLine::SetNDC
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TLine.cxx:450
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TLine::operator=
TLine & operator=(const TLine &src)
Assignment operator.
Definition: TLine.cxx:54
TLine::fY2
Double_t fY2
Y of 2nd point.
Definition: TLine.h:28
TLine::SetBBoxCenterY
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the BoundingBox.
Definition: TLine.cxx:603
TLine::kVertical
@ kVertical
Line is vertical.
Definition: TLine.h:34
TLine::GetY2
Double_t GetY2() const
Definition: TLine.h:53
TLine::Copy
void Copy(TObject &line) const
Copy this line to line.
Definition: TLine.cxx:63
int