Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 09:09:54

0001 // @(#)root/hist:$Id$
0002 // Author: Rene Brun   12/12/94
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TPolyMarker
0013 #define ROOT_TPolyMarker
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TPolyMarker                                                          //
0019 //                                                                      //
0020 // An array of points with the same marker.                             //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 
0025 #include "TObject.h"
0026 #include "TAttMarker.h"
0027 #include "TString.h"
0028 
0029 class TCollection;
0030 
0031 class TPolyMarker : public TObject, public TAttMarker {
0032 protected:
0033    Int_t       fN{0};             ///< Number of points internally reserved (not necessarily used)
0034    Int_t       fLastPoint{-1};    ///< The index of the last filled point
0035    Double_t   *fX{nullptr};       ///<[fN] Array of X coordinates
0036    Double_t   *fY{nullptr};       ///<[fN] Array of Y coordinates
0037    TString     fOption;           ///< Options
0038 
0039    TPolyMarker& operator=(const TPolyMarker&);
0040 
0041 public:
0042    TPolyMarker();
0043    TPolyMarker(Int_t n, Option_t *option="");
0044    TPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
0045    TPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
0046    TPolyMarker(const TPolyMarker &polymarker);
0047    ~TPolyMarker() override;
0048    void     Copy(TObject &polymarker) const override;
0049    Int_t    DistancetoPrimitive(Int_t px, Int_t py) override;
0050    void     Draw(Option_t *option="") override;
0051    virtual void     DrawPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
0052    void     ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0053    /// \brief Get the index of the last filled point
0054    /// \note In case the TPolyMarker was filled in sequential order, the returned value + 1 matches
0055    /// the total number of points used (and is less or equal than the capacity GetN()).
0056    virtual Int_t    GetLastPoint() const { return fLastPoint;}
0057    /// \brief Get the current capacity (reserved size) of the TPolyMarker.
0058    /// \note In contrast to TGraph::GetN(), this does not necessarily match with the used points
0059    /// \warning Do not add points via SetPoint(pm->GetN(), x, y) as with a TGraph, use instead TPolyMarker::SetNextPoint
0060    /// \see GetLastPoint()
0061    virtual Int_t    GetN() const {return fN;}
0062    Option_t        *GetOption() const override {return fOption.Data();}
0063    Double_t        *GetX() const {return fX;}
0064    Double_t        *GetY() const {return fY;}
0065    void     ls(Option_t *option="") const override;
0066    virtual Int_t    Merge(TCollection *list);
0067    void     Paint(Option_t *option="") override;
0068    virtual void     PaintPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
0069    void     Print(Option_t *option="") const override;
0070    void     SavePrimitive(std::ostream &out, Option_t *option = "") override;
0071    virtual Int_t    SetNextPoint(Double_t x, Double_t y); // *MENU*
0072    virtual void     SetPoint(Int_t point, Double_t x, Double_t y); // *MENU*
0073    virtual void     SetPolyMarker(Int_t n);
0074    virtual void     SetPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
0075    virtual void     SetPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
0076    virtual Int_t    Size() const {return fLastPoint+1;}
0077 
0078    ClassDefOverride(TPolyMarker,4)  //An array of points with the same marker
0079 };
0080 
0081 #endif