Logo ROOT   6.18/05
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
21class TCollection;
22
23class TPolyLine : public TObject, public TAttLine, public TAttFill {
24
25protected:
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
33
34public:
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
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define BIT(n)
Definition: Rtypes.h:83
Fill Area Attributes class.
Definition: TAttFill.h:19
Line Attributes class.
Definition: TAttLine.h:18
Collection abstract base class.
Definition: TCollection.h:63
Mother of all ROOT objects.
Definition: TObject.h:37
Defined by an array on N points in a 2-D space.
Definition: TPolyLine.h:23
TString fOption
options
Definition: TPolyLine.h:30
virtual Int_t Size() const
Definition: TPolyLine.h:71
virtual void Print(Option_t *option="") const
Dump this polyline with its attributes.
Definition: TPolyLine.cxx:584
@ kPolyLineNDC
Polyline coordinates are in NDC space.
Definition: TPolyLine.h:37
Int_t fLastPoint
The index of the last filled point.
Definition: TPolyLine.h:27
virtual Int_t Merge(TCollection *list)
Merge polylines in the collection in this polyline.
Definition: TPolyLine.cxx:495
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
virtual Int_t GetLastPoint() const
Definition: TPolyLine.h:52
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
Double_t * GetX() const
Definition: TPolyLine.h:54
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:639
virtual ~TPolyLine()
PolyLine default destructor.
Definition: TPolyLine.cxx:142
TPolyLine()
PolyLine default constructor.
Definition: TPolyLine.cxx:45
Int_t GetN() const
Definition: TPolyLine.h:53
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 * GetY() const
Definition: TPolyLine.h:55
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
Double_t * fX
[fN] Array of X coordinates
Definition: TPolyLine.h:28
Option_t * GetOption() const
Definition: TPolyLine.h:56
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TPolyLine.cxx:261
TPolyLine & operator=(const TPolyLine &)
assignment operator
Definition: TPolyLine.cxx:124
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TPolyLine.cxx:592
Int_t fN
Number of points.
Definition: TPolyLine.h:26
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Definition: TPolyLine.cxx:232
virtual void Copy(TObject &polyline) const
Copy this polyline to polyline.
Definition: TPolyLine.cxx:163
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
Definition: TPolyLine.cxx:531
Double_t * fY
[fN] Array of Y coordinates
Definition: TPolyLine.h:29
virtual void SetPolyLine(Int_t n)
Resize this polyline to size n.
Definition: TPolyLine.cxx:671
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
Definition: TPolyLine.cxx:617
virtual void ls(Option_t *option="") const
List this polyline with its attributes.
Definition: TPolyLine.cxx:486
virtual Int_t SetNextPoint(Double_t x, Double_t y)
Set point following LastPoint to x, y.
Definition: TPolyLine.cxx:627
virtual void SetOption(Option_t *option="")
Definition: TPolyLine.h:66
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16