Logo ROOT  
Reference Guide
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 #include "TString.h"
17 #include "TObject.h"
18 #include "TAttLine.h"
19 #include "TAttFill.h"
20 
21 class TCollection;
22 
23 class TPolyLine : public TObject, public TAttLine, public TAttFill {
24 
25 protected:
26  Int_t fN; ///<Number of points
27  Int_t fLastPoint; ///<The index of the last filled point
28  Double_t *fX; ///<[fN] Array of X coordinates
29  Double_t *fY; ///<[fN] Array of Y coordinates
30  TString fOption; ///<options
31 
32  TPolyLine& operator=(const TPolyLine&);
33 
34 public:
35  // TPolyLine status bits
36  enum {
37  kPolyLineNDC = BIT(14) ///< Polyline coordinates are in NDC space.
38  };
39 
40  TPolyLine();
41  TPolyLine(Int_t n, Option_t *option="");
42  TPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
43  TPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
44  TPolyLine(const TPolyLine &polyline);
45  virtual ~TPolyLine();
46 
47  virtual void Copy(TObject &polyline) const;
48  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
49  virtual void Draw(Option_t *option="");
50  virtual void DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
51  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
52  virtual Int_t GetLastPoint() const { return fLastPoint;}
53  Int_t GetN() const {return fN;}
54  Double_t *GetX() const {return fX;}
55  Double_t *GetY() const {return fY;}
56  Option_t *GetOption() const {return fOption.Data();}
57  virtual void ls(Option_t *option="") const;
58  virtual Int_t Merge(TCollection *list);
59  virtual void Paint(Option_t *option="");
60  virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
61  virtual void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
62  virtual void Print(Option_t *option="") const;
63  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
64  virtual void SetNDC(Bool_t isNDC=kTRUE);
65  virtual Int_t SetNextPoint(Double_t x, Double_t y); // *MENU*
66  virtual void SetOption(Option_t *option="") {fOption = option;}
67  virtual void SetPoint(Int_t point, Double_t x, Double_t y); // *MENU*
68  virtual void SetPolyLine(Int_t n);
69  virtual void SetPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
70  virtual void SetPolyLine(Int_t n, Double_t *x, Double_t *y3, Option_t *option="");
71  virtual Int_t Size() const {return fLastPoint+1;}
72 
73  ClassDef(TPolyLine,3) //A PolyLine
74 };
75 
76 #endif
77 
TPolyLine::SetNextPoint
virtual Int_t SetNextPoint(Double_t x, Double_t y)
Set point following LastPoint to x, y.
Definition: TPolyLine.cxx:623
TPolyLine
Definition: TPolyLine.h:23
n
const Int_t n
Definition: legend1.C:16
TPolyLine::SetOption
virtual void SetOption(Option_t *option="")
Definition: TPolyLine.h:66
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TPolyLine::TPolyLine
TPolyLine()
PolyLine default constructor.
Definition: TPolyLine.cxx:46
TPolyLine::GetLastPoint
virtual Int_t GetLastPoint() const
Definition: TPolyLine.h:52
TPolyLine::fY
Double_t * fY
[fN] Array of Y coordinates
Definition: TPolyLine.h:29
TPolyLine::PaintPolyLine
virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates.
Definition: TPolyLine.cxx:544
TString::Data
const char * Data() const
Definition: TString.h:369
TPolyLine::SetNDC
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TPolyLine.cxx:613
Float_t
float Float_t
Definition: RtypesCore.h:57
TPolyLine::DistancetoPrimitive
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:194
Int_t
int Int_t
Definition: RtypesCore.h:45
x
Double_t x[n]
Definition: legend1.C:17
TPolyLine::operator=
TPolyLine & operator=(const TPolyLine &)
assignment operator
Definition: TPolyLine.cxx:125
TPolyLine::SetPoint
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:635
TPolyLine::Merge
virtual Int_t Merge(TCollection *list)
Merge polylines in the collection in this polyline.
Definition: TPolyLine.cxx:491
TString
Definition: TString.h:136
TPolyLine::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TPolyLine.cxx:588
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TString.h
TPolyLine::Size
virtual Int_t Size() const
Definition: TPolyLine.h:71
TPolyLine::fN
Int_t fN
Number of points.
Definition: TPolyLine.h:26
TAttLine.h
TPolyLine::GetY
Double_t * GetY() const
Definition: TPolyLine.h:55
TPolyLine::Draw
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Definition: TPolyLine.cxx:228
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TPolyLine::GetOption
Option_t * GetOption() const
Definition: TPolyLine.h:56
TAttFill.h
TAttLine
Definition: TAttLine.h:18
BIT
#define BIT(n)
Definition: Rtypes.h:85
y
Double_t y[n]
Definition: legend1.C:17
TPolyLine::DrawPolyLine
virtual void DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates.
Definition: TPolyLine.cxx:236
TPolyLine::ls
virtual void ls(Option_t *option="") const
List this polyline with its attributes.
Definition: TPolyLine.cxx:482
TPolyLine::GetN
Int_t GetN() const
Definition: TPolyLine.h:53
TPolyLine::Print
virtual void Print(Option_t *option="") const
Dump this polyline with its attributes.
Definition: TPolyLine.cxx:580
Double_t
double Double_t
Definition: RtypesCore.h:59
TPolyLine::~TPolyLine
virtual ~TPolyLine()
PolyLine default destructor.
Definition: TPolyLine.cxx:136
TPolyLine::fLastPoint
Int_t fLastPoint
The index of the last filled point.
Definition: TPolyLine.h:27
TPolyLine::SetPolyLine
virtual void SetPolyLine(Int_t n)
Resize this polyline to size n.
Definition: TPolyLine.cxx:667
TObject.h
TPolyLine::Paint
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
Definition: TPolyLine.cxx:527
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TPolyLine::PaintPolyLineNDC
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:568
TPolyLine::kPolyLineNDC
@ kPolyLineNDC
Polyline coordinates are in NDC space.
Definition: TPolyLine.h:37
TCollection
Definition: TCollection.h:63
TAttFill
Definition: TAttFill.h:19
TPolyLine::fOption
TString fOption
options
Definition: TPolyLine.h:30
TPolyLine::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TPolyLine.cxx:257
TPolyLine::fX
Double_t * fX
[fN] Array of X coordinates
Definition: TPolyLine.h:28
int
TPolyLine::Copy
virtual void Copy(TObject &polyline) const
Copy this polyline to polyline.
Definition: TPolyLine.cxx:157
TPolyLine::GetX
Double_t * GetX() const
Definition: TPolyLine.h:54