Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/gl:$Id$
0002 // Author:  Timur Pocheptsov  14/06/2006
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, 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_TGLLegoPainter
0013 #define ROOT_TGLLegoPainter
0014 
0015 #include "TGLPlotPainter.h"
0016 #include "TGLQuadric.h"
0017 #include "TGLUtil.h"
0018 #include "TString.h"
0019 
0020 #include <vector>
0021 #include <utility>
0022 
0023 class TGLPlotCamera;
0024 class TAxis;
0025 class TH1;
0026 
0027 /*
0028    TGLLegoPainter. The concrete implementation of abstract TGLPlotPainter.
0029 */
0030 
0031 class TGLLegoPainter : public TGLPlotPainter {
0032 private:
0033 
0034    enum ELegoType {
0035       kColorSimple,
0036       kColorLevel,
0037       kCylindricBars
0038    };
0039    //Bars, cylinders or textured bars.
0040    mutable ELegoType     fLegoType;
0041    Double_t              fMinZ;
0042    Rgl::Range_t          fMinMaxVal;//For texture coordinates generation.
0043 
0044    std::vector<Rgl::Range_t>  fXEdges;
0045    std::vector<Rgl::Range_t>  fYEdges;
0046 
0047    typedef std::pair<Double_t, Double_t> CosSin_t;
0048    std::vector<CosSin_t> fCosSinTableX;
0049    std::vector<CosSin_t> fCosSinTableY;
0050    TString               fBinInfo;
0051    mutable TGLQuadric    fQuadric;
0052    Bool_t                fDrawErrors;
0053 
0054    mutable TGLLevelPalette       fPalette;
0055    mutable std::vector<Double_t> fColorLevels;
0056 
0057    TGLLegoPainter(const TGLLegoPainter &);
0058    TGLLegoPainter &operator = (const TGLLegoPainter &);
0059 
0060 public:
0061    TGLLegoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
0062 
0063    //TGLPlotPainter's final-overriders
0064    char        *GetPlotInfo(Int_t px, Int_t py) override;
0065    Bool_t       InitGeometry() override;
0066    void         StartPan(Int_t px, Int_t py) override;
0067    void         Pan(Int_t px, Int_t py) override;
0068    void         AddOption(const TString &stringOption) override;
0069    void         ProcessEvent(Int_t event, Int_t px, Int_t py) override;
0070 
0071 private:
0072    //Auxilary functions.
0073    Bool_t       InitGeometryCartesian();
0074    Bool_t       InitGeometryPolar();
0075    Bool_t       InitGeometryCylindrical();
0076    Bool_t       InitGeometrySpherical();
0077    //Overriders
0078    void         InitGL()const override;
0079    void         DeInitGL()const override;
0080 
0081    void         DrawPlot()const override;
0082 
0083    void         DrawLegoCartesian()const;
0084    void         DrawLegoPolar()const;
0085    void         DrawLegoCylindrical()const;
0086    void         DrawLegoSpherical()const;
0087 
0088    void         SetLegoColor()const;
0089 
0090    void         DrawSectionXOZ()const override;
0091    void         DrawSectionYOZ()const override;
0092    void         DrawSectionXOY()const override;
0093 
0094    Bool_t       ClampZ(Double_t &zVal)const;
0095    Bool_t       PreparePalette()const;
0096 
0097    void         DrawPalette()const;
0098    void         DrawPaletteAxis()const override;
0099 
0100    ClassDefOverride(TGLLegoPainter, 0)//Lego painter
0101 };
0102 
0103 #endif