Logo ROOT   6.08/07
Reference Guide
TGLH2PolyPainter.h
Go to the documentation of this file.
1 #ifndef ROOT_TGLH2PolyPainter
2 #define ROOT_TGLH2PolyPainter
3 
4 #include <vector>
5 #include <list>
6 
7 #ifndef ROOT_TGLPlotPainter
8 #include "TGLPlotPainter.h"
9 #endif
10 #ifndef ROOT_TGLPadUtils
11 #include "TGLPadUtils.h"
12 #endif
13 #ifndef ROOT_TString
14 #include "TString.h"
15 #endif
16 
17 class TMultiGraph;
18 class TGraph;
19 
21 public:
22  TGLH2PolyPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
23 
24  char *GetPlotInfo(Int_t px, Int_t py);
26  void StartPan(Int_t px, Int_t py);
27  void Pan(Int_t px, Int_t py);
28  void AddOption(const TString &stringOption);
29  void ProcessEvent(Int_t event, Int_t px, Int_t py);
30 
31 private:
32  //Overriders
33  void InitGL()const;
34  void DeInitGL()const;
35  void DrawPlot()const;
36  //Aux. functions.
37  //Draw edges of a bin.
38  void DrawExtrusion()const;
39  void DrawExtrusion(const TGraph *polygon, Double_t zMin, Double_t zMax, Int_t nBin)const;
40  void DrawExtrusion(const TMultiGraph *polygon, Double_t zMin, Double_t zMax, Int_t nBin)const;
41 
42  //Draw caps for a bin.
43  typedef std::list<Rgl::Pad::Tesselation_t>::const_iterator CIter_t;
44  void DrawCaps()const;
45  void DrawCap(CIter_t cap, Int_t bin, bool bottomCap)const;
46  //
51  //Find the color in palette using bin content.
52  void SetBinColor(Int_t bin)const;
53 
54  //Empty overriders.
55  void DrawSectionXOZ()const;
56  void DrawSectionYOZ()const;
57  void DrawSectionXOY()const;
58  void DrawPalette()const;
59  void DrawPaletteAxis()const;
60 
61  //Aux. staff.
62  void FillTemporaryPolygon(const Double_t *xs, const Double_t *ys, Double_t z, Int_t n)const;
63  void MakePolygonCCW()const;
64  Bool_t ClampZ(Double_t &zVal)const;
65 
66  TString fBinInfo; //Used by GetPlotInfo.
67 
68  std::vector<Int_t> fBinColors;
69 
70  mutable std::vector<Double_t> fPolygon; //Temporary array for polygon's vertices.
71  std::list<Rgl::Pad::Tesselation_t> fCaps;//Caps for all bins.
72 
73  Bool_t fZLog;//Change in logZ updates only bin heights.
75 
76  ClassDef(TGLH2PolyPainter, 0); //Painter class for TH2Poly.
77 };
78 
79 #endif
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:21
char * GetPlotInfo(Int_t px, Int_t py)
Show number of bin and bin contents, if bin is under the cursor.
void DrawPaletteAxis() const
Not yet.
void DrawPlot() const
Draw extruded polygons and plot&#39;s frame.
std::vector< Int_t > fBinColors
A TMultiGraph is a collection of TGraph (or derived) objects.
Definition: TMultiGraph.h:37
Bool_t ClampZ(Double_t &zVal) const
Clamp z value.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGLH2PolyPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Ctor.
void MakePolygonCCW() const
Code taken from the original TH2Poly.
Bool_t CacheGeometry()
Cache all data for TH2Poly object.
#define ClassDef(name, id)
Definition: Rtypes.h:254
void DrawSectionXOZ() const
No sections.
std::list< Rgl::Pad::Tesselation_t >::const_iterator CIter_t
void DrawCaps() const
Caps on bins.
Paint TH2Poly.
void DrawSectionXOY() const
No sections.
void DeInitGL() const
Return some gl states to original values.
void DrawCap(CIter_t cap, Int_t bin, bool bottomCap) const
Draw a cap on top of a bin.
Bool_t UpdateGeometry()
Update cap&#39;s z-coordinates for all caps.
void StartPan(Int_t px, Int_t py)
User clicks on a lego with middle mouse button (middle for pad).
void AddOption(const TString &stringOption)
No additional options.
Bool_t BuildTesselation(Rgl::Pad::Tesselator &tess, const TGraph *g, Double_t z)
Tesselate a polygon described by TGraph.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
void FillTemporaryPolygon(const Double_t *xs, const Double_t *ys, Double_t z, Int_t n) const
Since I probably have to re-orient polygon, I need a temporary polygon.
void Pan(Int_t px, Int_t py)
Mouse events handler.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
std::vector< Double_t > fPolygon
double Double_t
Definition: RtypesCore.h:55
Bool_t InitGeometry()
Tesselate polygons, if not done yet.
The TH1 histogram class.
Definition: TH1.h:80
void DrawSectionYOZ() const
No sections.
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
void SetBinColor(Int_t bin) const
Set bin&#39;s color.
void InitGL() const
Initialize some gl state variables.
void ProcessEvent(Int_t event, Int_t px, Int_t py)
No events.
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
void DrawExtrusion() const
Extruded part of bins.
std::list< Rgl::Pad::Tesselation_t > fCaps
void DrawPalette() const
Not yet.
const Int_t n
Definition: legend1.C:16