Logo ROOT  
Reference Guide
TPolyMarker.h
Go to the documentation of this file.
1// @(#)root/hist:$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_TPolyMarker
13#define ROOT_TPolyMarker
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TPolyMarker //
19// //
20// An array of points with the same marker. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24
25#include "TObject.h"
26#include "TAttMarker.h"
27#include "TString.h"
28
29class TCollection;
30
31class TPolyMarker : public TObject, public TAttMarker {
32protected:
33 Int_t fN{0}; ///< Number of points
34 Int_t fLastPoint{-1}; ///< The index of the last filled point
35 Double_t *fX{nullptr}; ///<[fN] Array of X coordinates
36 Double_t *fY{nullptr}; ///<[fN] Array of Y coordinates
37 TString fOption; ///< Options
38
40
41public:
46 TPolyMarker(const TPolyMarker &polymarker);
47 ~TPolyMarker() override;
48 void Copy(TObject &polymarker) const override;
49 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
50 void Draw(Option_t *option="") override;
51 virtual void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
52 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
53 virtual Int_t GetLastPoint() const { return fLastPoint;}
54 virtual Int_t GetN() const {return fN;}
55 Option_t *GetOption() const override {return fOption.Data();}
56 Double_t *GetX() const {return fX;}
57 Double_t *GetY() const {return fY;}
58 void ls(Option_t *option="") const override;
59 virtual Int_t Merge(TCollection *list);
60 void Paint(Option_t *option="") override;
61 virtual void PaintPolyMarker(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 Int_t SetNextPoint(Double_t x, Double_t y); // *MENU*
65 virtual void SetPoint(Int_t point, Double_t x, Double_t y); // *MENU*
66 virtual void SetPolyMarker(Int_t n);
67 virtual void SetPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
68 virtual void SetPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
69 virtual Int_t Size() const {return fLastPoint+1;}
70
71 ClassDefOverride(TPolyMarker,4) //An array of points with the same marker
72};
73
74#endif
int Int_t
Definition: RtypesCore.h:45
float Float_t
Definition: RtypesCore.h:57
double Double_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t option
Marker Attributes class.
Definition: TAttMarker.h:19
Collection abstract base class.
Definition: TCollection.h:65
Mother of all ROOT objects.
Definition: TObject.h:41
A PolyMarker is defined by an array on N points in a 2-D space.
Definition: TPolyMarker.h:31
TPolyMarker & operator=(const TPolyMarker &)
assignment operator
virtual void PaintPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Paint polymarker.
void Copy(TObject &polymarker) const override
Copy this to obj.
void Print(Option_t *option="") const override
Print polymarker.
Double_t * fY
[fN] Array of Y coordinates
Definition: TPolyMarker.h:36
virtual Int_t GetN() const
Definition: TPolyMarker.h:54
virtual Int_t Size() const
Definition: TPolyMarker.h:69
virtual Int_t Merge(TCollection *list)
Merge polymarkers in the collection in this polymarker.
TPolyMarker()
Default constructor.
Definition: TPolyMarker.cxx:33
virtual void DrawPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw polymarker.
virtual void SetPolyMarker(Int_t n)
If n <= 0 the current arrays of points are deleted.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Int_t fN
Number of points.
Definition: TPolyMarker.h:33
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Double_t * GetX() const
Definition: TPolyMarker.h:56
~TPolyMarker() override
Destructor.
virtual Int_t SetNextPoint(Double_t x, Double_t y)
Set point following LastPoint to x, y.
Int_t fLastPoint
The index of the last filled point.
Definition: TPolyMarker.h:34
virtual Int_t GetLastPoint() const
Definition: TPolyMarker.h:53
TString fOption
Options.
Definition: TPolyMarker.h:37
void Paint(Option_t *option="") override
Paint.
Double_t * fX
[fN] Array of X coordinates
Definition: TPolyMarker.h:35
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a polymarker.
void Draw(Option_t *option="") override
Draw.
Double_t * GetY() const
Definition: TPolyMarker.h:57
virtual void SetPoint(Int_t point, Double_t x, Double_t y)
Set point number n.
Option_t * GetOption() const override
Definition: TPolyMarker.h:55
void ls(Option_t *option="") const override
ls.
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16