library: libGraf #include "TPolyLine.h"

# TPolyLine

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

## class TPolyLine : public TObject, public TAttLine, public TAttFill

| Inheritance Chart:

`TObject`

`TAttLine`

`TAttFill`

<-

`TPolyLine`

<-

`TCurlyLine`

<-

`TCurlyArc` |

        public:

                            TPolyLine()
                            TPolyLine(Int_t n, Option_t* option)
                            TPolyLine(Int_t n, Float_t* x, Float_t* y, Option_t* option)
                            TPolyLine(Int_t n, Double_t* x, Double_t* y, Option_t* option)
                            TPolyLine(const TPolyLine& polyline)
                    virtual ~TPolyLine()
             static TClass* Class()
               virtual void Copy(TObject& polyline) const
              virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
               virtual void Draw(Option_t* option)
               virtual void DrawPolyLine(Int_t n, Double_t* x, Double_t* y, Option_t* option)
               virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
              virtual Int_t GetLastPoint() const
                      Int_t GetN() const
          virtual Option_t* GetOption() const
                  Double_t* GetX() const
                  Double_t* GetY() const
            virtual TClass* IsA() const
               virtual void ls(Option_t* option) const
              virtual Int_t Merge(TCollection* list)
                 TPolyLine& operator=(const TPolyLine&)
               virtual void Paint(Option_t* option)
               virtual void PaintPolyLine(Int_t n, Double_t* x, Double_t* y, Option_t* option)
               virtual void PaintPolyLineNDC(Int_t n, Double_t* x, Double_t* y, Option_t* option)
               virtual void Print(Option_t* option) const
               virtual void SavePrimitive(ofstream& out, Option_t* option)
              virtual Int_t SetNextPoint(Double_t x, Double_t y)
               virtual void SetOption(Option_t* option)
               virtual void SetPoint(Int_t point, Double_t x, Double_t y)
               virtual void SetPolyLine(Int_t n)
               virtual void SetPolyLine(Int_t n, Float_t* x, Float_t* y, Option_t* option)
               virtual void SetPolyLine(Int_t n, Double_t* x, Double_t* y3, Option_t* option)
               virtual void ShowMembers(TMemberInspector& insp, char* parent)
              virtual Int_t Size() const
               virtual void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

              Int_t fN          Number of points
              Int_t fLastPoint  The index of the last filled point
          Double_t* fX          [fN] Array of X coordinates
          Double_t* fY          [fN] Array of Y coordinates
            TString fOption     options

## Class Description

      a PolyLine is defined by an array on N points in a 2-D space.

     One can draw the contour of the polyline or/and its fill area.
     Example:
    {
       Double_t x[5] = {.2,.7,.6,.25,.2};
       Double_t y[5] = {.5,.1,.9,.7,.5};
       TPolyLine *pline = new TPolyLine(5,x,y);
       pline->SetFillColor(38);
       pline->SetLineColor(2);
       pline->SetLineWidth(4);
       pline->Draw("f");
       pline->Draw();
    }

TPolyLine(): TObject()

    *-*-*-*-*-*-*-*-*-*-*PolyLine default constructor*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ============================

TPolyLine(Int_t n, Option_t *option) :TObject(), TAttLine(), TAttFill()

    *-*-*-**-*-*PolyLine normal constructor without initialisation*-*-*-*-*-*-*-*
    *-*         ==================================================

TPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option) :TObject(), TAttLine(), TAttFill()

    *-*-*-*-*-*-*-*-*-*-*PolyLine normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ===========================

TPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option) :TObject(), TAttLine(), TAttFill()

    *-*-*-*-*-*-*-*-*-*-*PolyLine normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ===========================

~TPolyLine()

    *-*-*-*-*-*-*-*-*-*-*PolyLine default destructor*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  ===========================

TPolyLine(const TPolyLine &polyline) : TObject(polyline), TAttLine(polyline), TAttFill(polyline)

void Copy(TObject &obj) const

    *-*-*-*-*-*-*Copy this polyline to polyline*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*          ==============================

Int_t DistancetoPrimitive(Int_t px, Int_t py)

    *-*-*-*-*-*-*-*-*Compute distance from point px,py to a polyline*-*-*-*-*-*
    *-*              ===============================================
      Compute the closest distance of approach from point px,py to each segment
      of the polyline.
      Returns when the distance found is below DistanceMaximum.
      The distance is computed in pixels units.

void Draw(Option_t *option)

    *-*-*-*-*-*-*-*-*Draw this polyline with its current attributes*-*-*-*-*-*-*
    *-*              ==============================================

void DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option)

    *-*-*-*-*-*-*-*-*Draw this polyline with new coordinates*-*-*-*-*-*-*-*-*-*
    *-*              ========================================

void ExecuteEvent(Int_t event, Int_t px, Int_t py)

    *-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
    *-*                  =========================================
      This member function is called when a polyline is clicked with the locator

      If Left button clicked on one of the line end points, this point
         follows the cursor until button is released.

      if Middle button clicked, the line is moved parallel to itself
         until the button is released.

void ls(Option_t *) const

    *-*-*-*-*-*-*-*-*-*List this polyline with its attributes*-*-*-*-*-*-*-*-*
    *-*                ======================================

Int_t Merge(TCollection *list)

     Merge polylines in the collection in this polyline

void Paint(Option_t *option)

    *-*-*-*-*-*-*-*-*Paint this polyline with its current attributes*-*-*-*-*-*-*
    *-*              ===============================================

void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option)

    *-*-*-*-*-*-*-*-*Draw this polyline with new coordinates*-*-*-*-*-*-*-*-*-*
    *-*              =======================================

      if option = 'f' or 'F' the fill area is drawn
      default is to draw the lines only

void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option)

    *-*-*-*-*-*-*-*-*Draw this polyline with new coordinates in NDC*-*-*-*-*-*-*
    *-*              ==============================================

void Print(Option_t *) const

    *-*-*-*-*-*-*-*-*Dump this polyline with its attributes*-*-*-*-*-*-*-*-*-*
    *-*              ======================================

void SavePrimitive(ofstream &out, Option_t *option)

     Save primitive as a C++ statement(s) on output stream out

Int_t SetNextPoint(Double_t x, Double_t y)

     Set point following LastPoint to x, y.
     Returns index of the point (new last point).

void SetPoint(Int_t n, Double_t x, Double_t y)

     set point number n
     if n is greater than the current size, the arrays are automatically
     extended

void SetPolyLine(Int_t n)

void SetPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option)

    *-*-*-*-*-*-*-*-*-*-*-*Set new values for this polyline*-*-*-*-*-*-*-*-*-*
    *-*                    ================================

void SetPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option)

    *-*-*-*-*-*-*-*-*-*-*-*Set new values for this polyline*-*-*-*-*-*-*-*-*-*
    *-*                    ================================

void Streamer(TBuffer &b)

    *-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    *-*              =========================================

### Inline Functions

                  Int_t GetLastPoint() const
                  Int_t GetN() const
              Double_t* GetX() const
              Double_t* GetY() const
              Option_t* GetOption() const
                   void SetOption(Option_t* option)
                  Int_t Size() const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
             TPolyLine& operator=(const TPolyLine&)

Author: Rene Brun 12/12/94
Last update: root/graf:$Name: $:$Id: TPolyLine.cxx,v 1.17 2004/04/30 06:34:58 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *