Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:59

0001 #ifndef ROOT_TGLH2PolyPainter
0002 #define ROOT_TGLH2PolyPainter
0003 
0004 #include <vector>
0005 #include <list>
0006 
0007 #include "TGLPlotPainter.h"
0008 #include "TGLPadUtils.h"
0009 #include "TString.h"
0010 
0011 class TMultiGraph;
0012 class TGraph;
0013 
0014 class TGLH2PolyPainter : public TGLPlotPainter {
0015 public:
0016    TGLH2PolyPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
0017 
0018    char        *GetPlotInfo(Int_t px, Int_t py) override;
0019    Bool_t       InitGeometry() override;
0020    void         StartPan(Int_t px, Int_t py) override;
0021    void         Pan(Int_t px, Int_t py) override;
0022    void         AddOption(const TString &stringOption) override;
0023    void         ProcessEvent(Int_t event, Int_t px, Int_t py) override;
0024 
0025 private:
0026    //Overriders
0027    void         InitGL()const override;
0028    void         DeInitGL()const override;
0029    void         DrawPlot()const override;
0030    //Aux. functions.
0031    //Draw edges of a bin.
0032    void         DrawExtrusion()const;
0033    void         DrawExtrusion(const TGraph *polygon, Double_t zMin, Double_t zMax, Int_t nBin)const;
0034    void         DrawExtrusion(const TMultiGraph *polygon, Double_t zMin, Double_t zMax, Int_t nBin)const;
0035 
0036    //Draw caps for a bin.
0037    typedef std::list<Rgl::Pad::Tesselation_t>::const_iterator CIter_t;
0038    void         DrawCaps()const;
0039    void         DrawCap(CIter_t cap, Int_t bin, bool bottomCap)const;
0040    //
0041    Bool_t       CacheGeometry();
0042    Bool_t       BuildTesselation(Rgl::Pad::Tesselator & tess, const TGraph *g, Double_t z);
0043    Bool_t       BuildTesselation(Rgl::Pad::Tesselator & tess, const TMultiGraph *mg, Double_t z);
0044    Bool_t       UpdateGeometry();
0045    //Find the color in palette using bin content.
0046    void         SetBinColor(Int_t bin)const;
0047 
0048    //Empty overriders.
0049    void         DrawSectionXOZ()const override;
0050    void         DrawSectionYOZ()const override;
0051    void         DrawSectionXOY()const override;
0052    void         DrawPalette()const;
0053    void         DrawPaletteAxis()const override;
0054 
0055    //Aux. staff.
0056    void         FillTemporaryPolygon(const Double_t *xs, const Double_t *ys, Double_t z, Int_t n)const;
0057    void         MakePolygonCCW()const;
0058    Bool_t       ClampZ(Double_t &zVal)const;
0059 
0060    TString                            fBinInfo; //Used by GetPlotInfo.
0061 
0062    std::vector<Int_t>                 fBinColors;
0063 
0064    mutable std::vector<Double_t>      fPolygon; //Temporary array for polygon's vertices.
0065    std::list<Rgl::Pad::Tesselation_t> fCaps;//Caps for all bins.
0066 
0067    Bool_t                             fZLog;//Change in logZ updates only bin heights.
0068    Double_t                           fZMin;
0069 
0070    ClassDefOverride(TGLH2PolyPainter, 0); //Painter class for TH2Poly.
0071 };
0072 
0073 #endif