Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 internally reserved (not necessarily used)
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 /// \brief Get the index of the last filled point
54 /// \note In case the TPolyMarker was filled in sequential order, the returned value + 1 matches
55 /// the total number of points used (and is less or equal than the capacity GetN()).
56 virtual Int_t GetLastPoint() const { return fLastPoint;}
57 /// \brief Get the current capacity (reserved size) of the TPolyMarker.
58 /// \note In contrast to TGraph::GetN(), this does not necessarily match with the used points
59 /// \warning Do not add points via SetPoint(pm->GetN(), x, y) as with a TGraph, use instead TPolyMarker::SetNextPoint
60 /// \see GetLastPoint()
61 virtual Int_t GetN() const {return fN;}
62 Option_t *GetOption() const override {return fOption.Data();}
63 Double_t *GetX() const {return fX;}
64 Double_t *GetY() const {return fY;}
65 void ls(Option_t *option="") const override;
66 virtual Int_t Merge(TCollection *list);
67 void Paint(Option_t *option="") override;
68 virtual void PaintPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
69 void Print(Option_t *option="") const override;
70 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
71 virtual Int_t SetNextPoint(Double_t x, Double_t y); // *MENU*
72 virtual void SetPoint(Int_t point, Double_t x, Double_t y); // *MENU*
73 virtual void SetPolyMarker(Int_t n);
74 virtual void SetPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
75 virtual void SetPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
76 virtual Int_t Size() const {return fLastPoint+1;}
77
78 ClassDefOverride(TPolyMarker,4) //An array of points with the same marker
79};
80
81#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:346
Option_t Option_t option
Option_t Option_t TPoint DrawPolyMarker
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
Get the current capacity (reserved size) of the TPolyMarker.
Definition TPolyMarker.h:61
virtual Int_t Size() const
Definition TPolyMarker.h:76
virtual Int_t Merge(TCollection *list)
Merge polymarkers in the collection in this polymarker.
TPolyMarker()
Default constructor.
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 internally reserved (not necessarily used)
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:63
~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
Get the index of the last filled point.
Definition TPolyMarker.h:56
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.
Double_t * GetY() const
Definition TPolyMarker.h:64
virtual void SetPoint(Int_t point, Double_t x, Double_t y)
Set point number n.
Option_t * GetOption() const override
Definition TPolyMarker.h:62
void ls(Option_t *option="") const override
ls.
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
th1 Draw()