Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 #include "TPoint.h"
20 #include "GuiTypes.h"
21 
22 
23 class TLine : public TObject, public TAttLine, public TAttBBox2D {
24 
25 protected:
26  Double_t fX1{0}; ///< X of 1st point
27  Double_t fY1{0}; ///< Y of 1st point
28  Double_t fX2{0}; ///< X of 2nd point
29  Double_t fY2{0}; ///< Y of 2nd point
30 
31 public:
32  // TLine status bits
33  enum {
34  kLineNDC = BIT(14), ///< Use NDC coordinates
35  kVertical = BIT(15), ///< Line is vertical
36  kHorizontal = BIT(16) ///< Line is horizontal
37  };
38 
39  TLine() {}
40  TLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
41  TLine(const TLine &line);
42  virtual ~TLine() = default;
43 
44  TLine &operator=(const TLine &src);
45 
46  void Copy(TObject &line) const;
47  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
48  virtual TLine *DrawLine(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
49  virtual TLine *DrawLineNDC(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
50  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
51  Double_t GetX1() const {return fX1;}
52  Double_t GetX2() const {return fX2;}
53  Double_t GetY1() const {return fY1;}
54  Double_t GetY2() const {return fY2;}
55  Bool_t IsHorizontal();
56  Bool_t IsVertical();
57  virtual void ls(Option_t *option="") const;
58  virtual void Paint(Option_t *option="");
59  virtual void PaintLine(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
60  virtual void PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t v2);
61  virtual void Print(Option_t *option="") const;
62  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
63  virtual void SetNDC(Bool_t isNDC=kTRUE);
64  void SetHorizontal(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsHorizontal
65  void SetVertical(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsVertical
66  virtual void SetX1(Double_t x1) {fX1=x1;}
67  virtual void SetX2(Double_t x2) {fX2=x2;}
68  virtual void SetY1(Double_t y1) {fY1=y1;}
69  virtual void SetY2(Double_t y2) {fY2=y2;}
70  virtual Rectangle_t GetBBox();
71  virtual TPoint GetBBoxCenter();
72  virtual void SetBBoxCenter(const TPoint &p);
73  virtual void SetBBoxCenterX(const Int_t x);
74  virtual void SetBBoxCenterY(const Int_t y);
75  virtual void SetBBoxX1(const Int_t x);
76  virtual void SetBBoxX2(const Int_t x);
77  virtual void SetBBoxY1(const Int_t y);
78  virtual void SetBBoxY2(const Int_t y);
79 
80  ClassDef(TLine,3) //A line segment
81 };
82 
83 #endif