TLine.h

Go to the documentation of this file.
00001 // @(#)root/graf:$Id: TLine.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   12/12/94
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TLine
00013 #define ROOT_TLine
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TLine                                                                //
00019 //                                                                      //
00020 // A line segment.                                                      //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TObject
00025 #include "TObject.h"
00026 #endif
00027 
00028 #ifndef ROOT_TAttLine
00029 #include "TAttLine.h"
00030 #endif
00031 
00032 
00033 class TLine : public TObject, public TAttLine {
00034 
00035 protected:
00036    Double_t      fX1;           //X of 1st point
00037    Double_t      fY1;           //Y of 1st point
00038    Double_t      fX2;           //X of 2nd point
00039    Double_t      fY2;           //Y of 2nd point
00040 
00041 public:
00042    // TLine status bits
00043    enum {
00044       kLineNDC    = BIT(14), // Use NDC coordinates
00045       kVertical   = BIT(15), // Line is vertical
00046       kHorizontal = BIT(16)  // Line is horizontal
00047    };
00048 
00049    TLine();
00050    TLine(Double_t x1, Double_t y1,Double_t x2, Double_t  y2);
00051    TLine(const TLine &line);
00052    virtual ~TLine();
00053 
00054    void           Copy(TObject &line) const;
00055    virtual Int_t  DistancetoPrimitive(Int_t px, Int_t py);
00056    virtual TLine *DrawLine(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
00057    virtual TLine *DrawLineNDC(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
00058    virtual void   ExecuteEvent(Int_t event, Int_t px, Int_t py);
00059    Double_t       GetX1() const {return fX1;}
00060    Double_t       GetX2() const {return fX2;}
00061    Double_t       GetY1() const {return fY1;}
00062    Double_t       GetY2() const {return fY2;}
00063    Bool_t         IsHorizontal();
00064    Bool_t         IsVertical();
00065    virtual void   ls(Option_t *option="") const;
00066    virtual void   Paint(Option_t *option="");
00067    virtual void   PaintLine(Double_t x1, Double_t y1,Double_t x2, Double_t  y2);
00068    virtual void   PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t  v2);
00069    virtual void   Print(Option_t *option="") const;
00070    virtual void   SavePrimitive(ostream &out, Option_t *option = "");
00071    void           SetHorizontal(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsHorizontal
00072    void           SetVertical(Bool_t set = kTRUE); // *TOGGLE* *GETTER=IsVertical
00073    virtual void   SetX1(Double_t x1) {fX1=x1;}
00074    virtual void   SetX2(Double_t x2) {fX2=x2;}
00075    virtual void   SetY1(Double_t y1) {fY1=y1;}
00076    virtual void   SetY2(Double_t y2) {fY2=y2;}
00077 
00078    ClassDef(TLine,2)  //A line segment
00079 };
00080 
00081 #endif

Generated on Tue Jul 5 14:14:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1