Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLLegoPainter.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 14/06/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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_TGLLegoPainter
13 #define ROOT_TGLLegoPainter
14 
15 #include "TGLPlotPainter.h"
16 #include "TGLQuadric.h"
17 #include "TGLUtil.h"
18 #include "TString.h"
19 
20 class TGLPlotCamera;
21 class TAxis;
22 class TH1;
23 
24 /*
25  TGLLegoPainter. The concrete implementation of abstract TGLPlotPainter.
26 */
27 
28 class TGLLegoPainter : public TGLPlotPainter {
29 private:
30 
31  enum ELegoType {
32  kColorSimple,
33  kColorLevel,
34  kCylindricBars
35  };
36  //Bars, cylinders or textured bars.
37  mutable ELegoType fLegoType;
38  Double_t fMinZ;
39  Rgl::Range_t fMinMaxVal;//For texture coordinates generation.
40 
41  std::vector<Rgl::Range_t> fXEdges;
42  std::vector<Rgl::Range_t> fYEdges;
43 
44  typedef std::pair<Double_t, Double_t> CosSin_t;
45  std::vector<CosSin_t> fCosSinTableX;
46  std::vector<CosSin_t> fCosSinTableY;
47  TString fBinInfo;
48  mutable TGLQuadric fQuadric;
49  Bool_t fDrawErrors;
50 
51  mutable TGLLevelPalette fPalette;
52  mutable std::vector<Double_t> fColorLevels;
53 
54  TGLLegoPainter(const TGLLegoPainter &);
55  TGLLegoPainter &operator = (const TGLLegoPainter &);
56 
57 public:
58  TGLLegoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
59 
60  //TGLPlotPainter's final-overriders
61  char *GetPlotInfo(Int_t px, Int_t py);
62  Bool_t InitGeometry();
63  void StartPan(Int_t px, Int_t py);
64  void Pan(Int_t px, Int_t py);
65  void AddOption(const TString &stringOption);
66  void ProcessEvent(Int_t event, Int_t px, Int_t py);
67 
68 private:
69  //Auxilary functions.
70  Bool_t InitGeometryCartesian();
71  Bool_t InitGeometryPolar();
72  Bool_t InitGeometryCylindrical();
73  Bool_t InitGeometrySpherical();
74  //Overriders
75  void InitGL()const;
76  void DeInitGL()const;
77 
78  void DrawPlot()const;
79 
80  void DrawLegoCartesian()const;
81  void DrawLegoPolar()const;
82  void DrawLegoCylindrical()const;
83  void DrawLegoSpherical()const;
84 
85  void SetLegoColor()const;
86 
87  void DrawSectionXOZ()const;
88  void DrawSectionYOZ()const;
89  void DrawSectionXOY()const;
90 
91  Bool_t ClampZ(Double_t &zVal)const;
92  Bool_t PreparePalette()const;
93 
94  void DrawPalette()const;
95  void DrawPaletteAxis()const;
96 
97  ClassDef(TGLLegoPainter, 0)//Lego painter
98 };
99 
100 #endif