TGLLegoPainter.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLLegoPainter.h 28464 2009-05-06 12:37:21Z brun $
00002 // Author:  Timur Pocheptsov  14/06/2006
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGLLegoPainter
00013 #define ROOT_TGLLegoPainter
00014 
00015 #ifndef ROOT_TGLPlotPainter
00016 #include "TGLPlotPainter.h"
00017 #endif
00018 #ifndef ROOT_TGLQuadric
00019 #include "TGLQuadric.h"
00020 #endif
00021 #ifndef ROOT_TGLUtil
00022 #include "TGLUtil.h"
00023 #endif
00024 #ifndef ROOT_TString
00025 #include "TString.h"
00026 #endif
00027 
00028 class TGLPlotCamera;
00029 class TAxis;
00030 class TH1;
00031 
00032 /*
00033    TGLLegoPainter. The concrete implementation of abstract TGLPlotPainter.
00034 */
00035 
00036 class TGLLegoPainter : public TGLPlotPainter {
00037 private:
00038 
00039    enum ELegoType {
00040       kColorSimple,
00041       kColorLevel,
00042       kCylindricBars
00043    };
00044    //Bars, cylinders or textured bars.
00045    mutable ELegoType     fLegoType;
00046    Double_t              fMinZ;
00047    Rgl::Range_t          fMinMaxVal;//For texture coordinates generation.
00048 
00049    std::vector<Rgl::Range_t>  fXEdges;
00050    std::vector<Rgl::Range_t>  fYEdges;
00051 
00052    typedef std::pair<Double_t, Double_t> CosSin_t;
00053    std::vector<CosSin_t> fCosSinTableX;
00054    std::vector<CosSin_t> fCosSinTableY;
00055    TString               fBinInfo;
00056    mutable TGLQuadric    fQuadric;
00057    Bool_t                fDrawErrors;
00058 
00059    mutable TGLLevelPalette       fPalette;
00060    mutable std::vector<Double_t> fColorLevels;
00061 
00062    TGLLegoPainter(const TGLLegoPainter &);
00063    TGLLegoPainter &operator = (const TGLLegoPainter &);
00064 
00065 public:
00066    TGLLegoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
00067 
00068    //TGLPlotPainter's final-overriders
00069    char        *GetPlotInfo(Int_t px, Int_t py);
00070    Bool_t       InitGeometry();
00071    void         StartPan(Int_t px, Int_t py);
00072    void         Pan(Int_t px, Int_t py);
00073    void         AddOption(const TString &stringOption);
00074    void         ProcessEvent(Int_t event, Int_t px, Int_t py);
00075 
00076 private:
00077    //Auxilary functions.
00078    Bool_t       InitGeometryCartesian();
00079    Bool_t       InitGeometryPolar();
00080    Bool_t       InitGeometryCylindrical();
00081    Bool_t       InitGeometrySpherical();
00082    //Overriders
00083    void         InitGL()const;
00084    void         DeInitGL()const;
00085    
00086    void         DrawPlot()const;
00087 
00088    void         DrawLegoCartesian()const;
00089    void         DrawLegoPolar()const;
00090    void         DrawLegoCylindrical()const;
00091    void         DrawLegoSpherical()const;
00092 
00093    void         SetLegoColor()const;
00094 
00095    void         DrawSectionXOZ()const;
00096    void         DrawSectionYOZ()const;
00097    void         DrawSectionXOY()const;
00098 
00099    Bool_t       ClampZ(Double_t &zVal)const;
00100    Bool_t       PreparePalette()const;
00101 
00102    void         DrawPalette()const;
00103    void         DrawPaletteAxis()const;
00104 
00105    ClassDef(TGLLegoPainter, 0)//Lego painter
00106 };
00107 
00108 #endif

Generated on Tue Jul 5 14:16:46 2011 for ROOT_528-00b_version by  doxygen 1.5.1