ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TPolyLine.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_TPolyLine
13 #define ROOT_TPolyLine
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TPolyLine //
19 // //
20 // A PolyLine. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 
25 #ifndef ROOT_TString
26 #include "TString.h"
27 #endif
28 #ifndef ROOT_TObject
29 #include "TObject.h"
30 #endif
31 #ifndef ROOT_TAttLine
32 #include "TAttLine.h"
33 #endif
34 #ifndef ROOT_TAttFill
35 #include "TAttFill.h"
36 #endif
37 
38 class TCollection;
39 
40 class TPolyLine : public TObject, public TAttLine, public TAttFill {
41 
42 protected:
43  Int_t fN; //Number of points
44  Int_t fLastPoint; //The index of the last filled point
45  Double_t *fX; //[fN] Array of X coordinates
46  Double_t *fY; //[fN] Array of Y coordinates
47  TString fOption; //options
48 
49  TPolyLine& operator=(const TPolyLine&);
50 
51 public:
52  // TPolyLine status bits
53  enum { kPolyLineNDC = BIT(14) };
54 
55  TPolyLine();
56  TPolyLine(Int_t n, Option_t *option="");
57  TPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
58  TPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
59  TPolyLine(const TPolyLine &polyline);
60  virtual ~TPolyLine();
61 
62  virtual void Copy(TObject &polyline) const;
64  virtual void Draw(Option_t *option="");
65  virtual void DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
66  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
67  virtual Int_t GetLastPoint() const { return fLastPoint;}
68  Int_t GetN() const {return fN;}
69  Double_t *GetX() const {return fX;}
70  Double_t *GetY() const {return fY;}
71  Option_t *GetOption() const {return fOption.Data();}
72  virtual void ls(Option_t *option="") const;
73  virtual Int_t Merge(TCollection *list);
74  virtual void Paint(Option_t *option="");
75  virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
76  virtual void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
77  virtual void Print(Option_t *option="") const;
78  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
79  virtual void SetNDC(Bool_t isNDC=kTRUE);
80  virtual Int_t SetNextPoint(Double_t x, Double_t y); // *MENU*
81  virtual void SetOption(Option_t *option="") {fOption = option;}
82  virtual void SetPoint(Int_t point, Double_t x, Double_t y); // *MENU*
83  virtual void SetPolyLine(Int_t n);
84  virtual void SetPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
85  virtual void SetPolyLine(Int_t n, Double_t *x, Double_t *y3, Option_t *option="");
86  virtual Int_t Size() const {return fLastPoint+1;}
87 
88  ClassDef(TPolyLine,3) //A PolyLine
89 };
90 
91 #endif
92 
virtual Int_t Size() const
Definition: TPolyLine.h:86
Int_t fN
Definition: TPolyLine.h:43
Double_t * GetX() const
Definition: TPolyLine.h:69
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
#define BIT(n)
Definition: Rtypes.h:120
Double_t * fY
Definition: TPolyLine.h:46
TString fOption
Definition: TPolyLine.h:47
virtual Int_t GetLastPoint() const
Definition: TPolyLine.h:67
TPolyLine & operator=(const TPolyLine &)
assignment operator
Definition: TPolyLine.cxx:124
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SetPoint(Int_t point, Double_t x, Double_t y)
Set point number n to (x, y) If n is greater than the current size, the arrays are automatically exte...
Definition: TPolyLine.cxx:638
virtual Int_t Merge(TCollection *list)
Merge polylines in the collection in this polyline.
Definition: TPolyLine.cxx:495
Float_t py
Definition: hprod.C:33
Int_t fLastPoint
Definition: TPolyLine.h:44
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TPolyLine.cxx:591
virtual void ls(Option_t *option="") const
List this polyline with its attributes.
Definition: TPolyLine.cxx:486
const char * Data() const
Definition: TString.h:349
Fill Area Attributes class.
Definition: TAttFill.h:32
Double_t x[n]
Definition: legend1.C:17
Double_t * GetY() const
Definition: TPolyLine.h:70
Int_t GetN() const
Definition: TPolyLine.h:68
Option_t * GetOption() const
Definition: TPolyLine.h:71
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TPolyLine.cxx:261
ClassDef(TAttLine, 2)
char * out
Definition: TBase64.cxx:29
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Definition: TPolyLine.cxx:232
Collection abstract base class.
Definition: TCollection.h:48
virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates.
Definition: TPolyLine.cxx:548
virtual void SetPolyLine(Int_t n)
Resize this polyline to size n.
Definition: TPolyLine.cxx:670
virtual ~TPolyLine()
PolyLine default destructor.
Definition: TPolyLine.cxx:142
double Double_t
Definition: RtypesCore.h:55
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Returns closest distance in pixels from point (px, py) to a polyline.
Definition: TPolyLine.cxx:198
Double_t y[n]
Definition: legend1.C:17
Mother of all ROOT objects.
Definition: TObject.h:58
Float_t px
Definition: hprod.C:33
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TPolyLine.cxx:616
Defined by an array on N points in a 2-D space.
Definition: TPolyLine.h:40
virtual void Copy(TObject &polyline) const
Copy this polyline to polyline.
Definition: TPolyLine.cxx:163
virtual Int_t SetNextPoint(Double_t x, Double_t y)
Set point following LastPoint to x, y.
Definition: TPolyLine.cxx:626
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
Definition: TPolyLine.cxx:531
Double_t * fX
Definition: TPolyLine.h:45
virtual void SetOption(Option_t *option="")
Definition: TPolyLine.h:81
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates in NDC.
Definition: TPolyLine.cxx:572
const Int_t n
Definition: legend1.C:16
Line Attributes class.
Definition: TAttLine.h:32
virtual void DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates.
Definition: TPolyLine.cxx:240
virtual void Print(Option_t *option="") const
Dump this polyline with its attributes.
Definition: TPolyLine.cxx:583