Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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{0}; ///<Number of points
27 Int_t fLastPoint{-1}; ///<The index of the last filled point
28 Double_t *fX{nullptr}; ///<[fN] Array of X coordinates
29 Double_t *fY{nullptr}; ///<[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
41 TPolyLine(Int_t n, Option_t *option="");
44 TPolyLine(const TPolyLine &polyline);
45 ~TPolyLine() override;
46
47 void Copy(TObject &polyline) const override;
49 void Draw(Option_t *option="") override;
51 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
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 override { return fOption.Data(); }
57 void ls(Option_t *option="") const override;
58 virtual Int_t Merge(TCollection *list);
59 void Paint(Option_t *option="") override;
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 void Print(Option_t *option="") const override;
63 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
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
74};
75
76#endif
77
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Collection abstract base class.
Definition TCollection.h:65
TObject()
TObject constructor.
Definition TObject.h:259
TString fOption
options
Definition TPolyLine.h:30
virtual Int_t Size() const
Definition TPolyLine.h:71
virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Int_t fLastPoint
The index of the last filled point.
Definition TPolyLine.h:27
void Copy(TObject &polyline) const override
Copy this to obj.
virtual Int_t GetLastPoint() const
Definition TPolyLine.h:52
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="")
Double_t * GetX() const
Definition TPolyLine.h:54
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
Int_t GetN() const
Definition TPolyLine.h:53
~TPolyLine() override
virtual Int_t SetNextPoint(Double_t x, Double_t y)
Double_t * GetY() const
Definition TPolyLine.h:55
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
virtual void SetPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="")
Double_t * fX
[fN] Array of X coordinates
Definition TPolyLine.h:28
@ kPolyLineNDC
Polyline coordinates are in NDC space.
Definition TPolyLine.h:37
void Paint(Option_t *option="") override
This method must be overridden if a class wants to paint itself.
virtual void SetPolyLine(Int_t n, Double_t *x, Double_t *y3, Option_t *option="")
void ls(Option_t *option="") const override
The ls function lists the contents of a class on stdout.
virtual Int_t Merge(TCollection *list)
TPolyLine & operator=(const TPolyLine &)
virtual void SetPoint(Int_t point, Double_t x, Double_t y)
virtual TPolyLine * DrawPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
virtual void SetNDC(Bool_t isNDC=kTRUE)
TPolyLine(const TPolyLine &polyline)
TPolyLine(Int_t n, Option_t *option="")
Int_t fN
Number of points.
Definition TPolyLine.h:26
Option_t * GetOption() const override
Definition TPolyLine.h:56
Double_t * fY
[fN] Array of Y coordinates
Definition TPolyLine.h:29
TPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
virtual void SetPolyLine(Int_t n)
virtual void SetOption(Option_t *option="")
Definition TPolyLine.h:66
Basic string class.
Definition TString.h:138
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16