library: libCore #include "TAttLine.h"

# TAttLine

class description - source file - inheritance tree (.pdf)

## class TAttLine

| Inheritance Chart:

`TAttLine`

<-

`TBox`

<-

`TPave`

<-

`TLegend` |

`TPaletteAxis` |

`TPaveLabel`

<-

`TPaveClass` |

`TPaveText`

<-

`TDiamond` |

`TPaveStats` |

`TPavesText` |

[more...]

        public:

                          TAttLine()
                          TAttLine(Color_t lcolor, Style_t lstyle, Width_t lwidth)
                          TAttLine(const TAttLine&)
                  virtual ~TAttLine()
           static TClass* Class()
                     void Copy(TAttLine& attline) const
                    Int_t DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
          virtual Color_t GetLineColor() const
          virtual Style_t GetLineStyle() const
          virtual Width_t GetLineWidth() const
          virtual TClass* IsA() const
             virtual void Modify()
                TAttLine& operator=(const TAttLine&)
             virtual void ResetAttLine(Option_t* option = "")
             virtual void SaveLineAttributes(ofstream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1)
             virtual void SetLineAttributes()
             virtual void SetLineColor(Color_t lcolor)
             virtual void SetLineStyle(Style_t lstyle)
             virtual void SetLineWidth(Width_t lwidth)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          Color_t fLineColor  line color
          Style_t fLineStyle  line style
          Width_t fLineWidth  line width

## Class Description

    *-*-*-*-*-*-*-*-*-*-*-*-*Line Attributes class*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      =====================
    *-*  Line attributes are:
    *-*    Line Color (see TAttFill for the list of colors)
    *-*    Line Width expressed in pixel units
    *-*    Line Style 1=solid, 2=dash, 3=dot-dot, 4=dash-dot. Additional line
    *-*               styles can be defined using TStyle::SetLineStyleString.
    *-*               Example:
    *-*               gStyle->SetLineStyleString(5,"20 12 4 12");
    *-*               gStyle->SetLineStyleString(6,"20 12 4 12 4 12 4 12");
    *-*               gStyle->SetLineStyleString(7,"20 20");
    *-*               gStyle->SetLineStyleString(8,"20 12 4 12 4 12");
    *-*               gStyle->SetLineStyleString(9,"80 20");
    *-*

/* */

    *-*
    *-*  This class is used (in general by secondary inheritance)
    *-*  by many other classes (graphics, histograms).
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

TAttLine()

    *-*-*-*-*-*-*-*-*-*-*-*-*AttLine default constructor*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      ===========================
    *-*  Default line attributes are taking from the current style
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

TAttLine(Color_t color, Style_t style, Width_t width)

    *-*-*-*-*-*-*-*-*-*-*-*-*AttLine normal constructor*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      ===========================
    *-*  Line attributes are taking from the argument list
    *-*    color : must be one of the valid color index
    *-*    style : 1=solid, 2=dash, 3=dash-dot, 4=dot-dot. New styles can be
    *-*            defined using TStyle::SetLineStyleString.
    *-*    width : expressed in pixel units
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

~TAttLine()

    *-*-*-*-*-*-*-*-*-*-*-*-*AttLine destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                      =================

void Copy(TAttLine &attline) const

    *-*-*-*-*-*-*-*-*Copy this line attributes to a new attline*-*-*-*-*-*-*-*-*
    *-*              ==========================================

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*-*-*-*-*-*
    *-*                  ===========================================
    *-*  Compute the closest distance of approach from point px,py to this line.
    *-*  The distance is computed in pixels units.
    *-*
    *-*  Algorithm:
    *-*
    *-*    A(x1,y1)         P                             B(x2,y2)
    *-*    ------------------------------------------------
    *-*                     I
    *-*                     I
    *-*                     I
    *-*                     I
    *-*                    M(x,y)
    *-*
    *-*  Let us call  a = distance AM     A=a**2
    *-*               b = distance BM     B=b**2
    *-*               c = distance AB     C=c**2
    *-*               d = distance PM     D=d**2
    *-*               u = distance AP     U=u**2
    *-*               v = distance BP     V=v**2     c = u + v
    *-*
    *-*  D = A - U
    *-*  D = B - V  = B -(c-u)**2
    *-*     ==> u = (A -B +C)/2c
    *-*
    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

void Modify()

    *-*-*-*-*-*-*-*-*-*Change current line attributes if necessary*-*-*-*-*-*-*
    *-*                ===========================================

void ResetAttLine(Option_t *)

    *-*-*-*-*-*-*-*-*Reset this line attributes to default values*-*-*-*-*-*-*
    *-*              ============================================

void SaveLineAttributes(ofstream &out, const char *name, Int_t coldef, Int_t stydef, Int_t widdef)

     Save line attributes as C++ statement(s) on output stream out

void SetLineAttributes()

    *-*-*-*-*-*-*-*-*Invoke the DialogCanvas Line attributes*-*-*-*-*-*-*
    *-*              =======================================

### Inline Functions

                Color_t GetLineColor() const
                Style_t GetLineStyle() const
                Width_t GetLineWidth() const
                   void SetLineColor(Color_t lcolor)
                   void SetLineStyle(Style_t lstyle)
                   void SetLineWidth(Width_t lwidth)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
               TAttLine TAttLine(const TAttLine&)
              TAttLine& operator=(const TAttLine&)

Author: Rene Brun 28/11/94
Last update: root/base:$Name: $:$Id: TAttLine.cxx,v 1.10 2005/04/26 16:36:47 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *