// @(#)root/graf:$Id$
// Author: Rene Brun   12/12/94

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TLine
#define ROOT_TLine


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TLine                                                                //
//                                                                      //
// A line segment.                                                      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TAttLine
#include "TAttLine.h"
#endif
#ifndef ROOT_TAttBBox2D
#include "TAttBBox2D.h"
#endif
#ifndef ROOT_TPoint
#include "TPoint.h"
#endif
#ifndef ROOT_GuiTypes
#include "GuiTypes.h"
#endif


class TLine : public TObject, public TAttLine, public TAttBBox2D {

protected:
   Double_t      fX1;           //X of 1st point
   Double_t      fY1;           //Y of 1st point
   Double_t      fX2;           //X of 2nd point
   Double_t      fY2;           //Y of 2nd point

public:
   // TLine status bits
   enum {
      kLineNDC    = BIT(14), // Use NDC coordinates
      kVertical   = BIT(15), // Line is vertical
      kHorizontal = BIT(16)  // Line is horizontal
   };

   TLine();
   TLine(Double_t x1, Double_t y1,Double_t x2, Double_t  y2);
   TLine(const TLine &line);
   virtual ~TLine();

   void                 Copy(TObject &line) const;
   virtual Int_t        DistancetoPrimitive(Int_t px, Int_t py);
   virtual TLine       *DrawLine(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
   virtual TLine       *DrawLineNDC(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
   virtual void         ExecuteEvent(Int_t event, Int_t px, Int_t py);
   Double_t             GetX1() const {return fX1;}
   Double_t             GetX2() const {return fX2;}
   Double_t             GetY1() const {return fY1;}
   Double_t             GetY2() const {return fY2;}
   Bool_t               IsHorizontal();
   Bool_t               IsVertical();
   virtual void         ls(Option_t *option="") const;
   virtual void         Paint(Option_t *option="");
   virtual void         PaintLine(Double_t x1, Double_t y1,Double_t x2, Double_t  y2);
   virtual void         PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t  v2);
   virtual void         Print(Option_t *option="") const;
   virtual void         SavePrimitive(std::ostream &out, Option_t *option = "");
   virtual void         SetNDC(Bool_t isNDC=kTRUE);
   void                 SetHorizontal(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsHorizontal
   void                 SetVertical(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsVertical
   virtual void         SetX1(Double_t x1) {fX1=x1;}
   virtual void         SetX2(Double_t x2) {fX2=x2;}
   virtual void         SetY1(Double_t y1) {fY1=y1;}
   virtual void         SetY2(Double_t y2) {fY2=y2;}
   virtual Rectangle_t  GetBBox();
   virtual TPoint       GetBBoxCenter();
   virtual void         SetBBoxCenter(const TPoint &p);
   virtual void         SetBBoxCenterX(const Int_t x);
   virtual void         SetBBoxCenterY(const Int_t y);
   virtual void         SetBBoxX1(const Int_t x);
   virtual void         SetBBoxX2(const Int_t x);
   virtual void         SetBBoxY1(const Int_t y);
   virtual void         SetBBoxY2(const Int_t y);

   ClassDef(TLine,3)  //A line segment
};

#endif
 TLine.h:1
 TLine.h:2
 TLine.h:3
 TLine.h:4
 TLine.h:5
 TLine.h:6
 TLine.h:7
 TLine.h:8
 TLine.h:9
 TLine.h:10
 TLine.h:11
 TLine.h:12
 TLine.h:13
 TLine.h:14
 TLine.h:15
 TLine.h:16
 TLine.h:17
 TLine.h:18
 TLine.h:19
 TLine.h:20
 TLine.h:21
 TLine.h:22
 TLine.h:23
 TLine.h:24
 TLine.h:25
 TLine.h:26
 TLine.h:27
 TLine.h:28
 TLine.h:29
 TLine.h:30
 TLine.h:31
 TLine.h:32
 TLine.h:33
 TLine.h:34
 TLine.h:35
 TLine.h:36
 TLine.h:37
 TLine.h:38
 TLine.h:39
 TLine.h:40
 TLine.h:41
 TLine.h:42
 TLine.h:43
 TLine.h:44
 TLine.h:45
 TLine.h:46
 TLine.h:47
 TLine.h:48
 TLine.h:49
 TLine.h:50
 TLine.h:51
 TLine.h:52
 TLine.h:53
 TLine.h:54
 TLine.h:55
 TLine.h:56
 TLine.h:57
 TLine.h:58
 TLine.h:59
 TLine.h:60
 TLine.h:61
 TLine.h:62
 TLine.h:63
 TLine.h:64
 TLine.h:65
 TLine.h:66
 TLine.h:67
 TLine.h:68
 TLine.h:69
 TLine.h:70
 TLine.h:71
 TLine.h:72
 TLine.h:73
 TLine.h:74
 TLine.h:75
 TLine.h:76
 TLine.h:77
 TLine.h:78
 TLine.h:79
 TLine.h:80
 TLine.h:81
 TLine.h:82
 TLine.h:83
 TLine.h:84
 TLine.h:85
 TLine.h:86
 TLine.h:87
 TLine.h:88
 TLine.h:89
 TLine.h:90
 TLine.h:91
 TLine.h:92
 TLine.h:93
 TLine.h:94
 TLine.h:95
 TLine.h:96
 TLine.h:97
 TLine.h:98
 TLine.h:99