Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLPlotBox.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 31/08/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, 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_TGLPlotFrame
13 #define ROOT_TGLPlotFrame
14 
15 #include <vector>
16 
17 #include "Rtypes.h"
18 #include "TGLUtil.h"
19 
20 class TColor;
21 
22 /*
23  TGLPlotBox draws a box behind a plot.
24 */
25 
26 class TGLPlotBox {
27 private:
28  const TColor *fFrameColor;
29  const Bool_t fXOYSelectable;
30  const Bool_t fXOZSelectable;
31  const Bool_t fYOZSelectable;
32 
33  Bool_t fSelectablePairs[4][2];
34 
35  TGLVertex3 f3DBox[8];
36  mutable TGLVertex3 f2DBox[8];
37  mutable TGLVertex3 f2DBoxU[8];
38  mutable Int_t fFrontPoint;
39 
40  //The sizes of a "unit" cube.
41  Double_t fRangeXU;
42  Double_t fRangeYU;
43  Double_t fRangeZU;
44 
45  Bool_t fDrawBack;
46  Bool_t fDrawFront;
47 
48 public:
49 
50  TGLPlotBox(Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable);
51  //ClassDef macro adds some virtual functions,
52  //so, to supress g++ warnings virtual destructor declared.
53  virtual ~TGLPlotBox();
54 
55  void DrawBox(Int_t selectedPart, Bool_t selectionPass,
56  const std::vector<Double_t> &zLevels,
57  Bool_t highColor)const;
58 
59  void SetPlotBox(const Rgl::Range_t &xRange,
60  const Rgl::Range_t &yRange,
61  const Rgl::Range_t &zRange);
62  void SetPlotBox(const Rgl::Range_t &xRange, Double_t rangeXU,
63  const Rgl::Range_t &yRange, Double_t rangeYU,
64  const Rgl::Range_t &zRange, Double_t rangeZU);
65 
66  void SetFrameColor(const TColor *color);
67 
68  Int_t FindFrontPoint()const;
69  Int_t GetFrontPoint()const;
70 
71  const TGLVertex3 *Get3DBox()const;
72  const TGLVertex3 *Get2DBox()const;
73 
74  static const Int_t fgFramePlanes[][4];
75  static const Int_t fgBackPairs[][2];
76  static const Int_t fgFrontPairs[][2];
77  static const Double_t fgNormals[][3];
78 
79  void SetDrawFront(Bool_t d) {fDrawFront = d;}
80  Bool_t GetDrawFront() const {return fDrawFront;}
81 
82  void SetDrawBack(Bool_t d) {fDrawBack = d;}
83  Bool_t GetDrawBack() const {return fDrawBack;}
84 
85 private:
86  void DrawBack(Int_t selectedPart, Bool_t selectionPass, const std::vector<Double_t> &zLevels, Bool_t highColor)const;
87  void DrawFront()const;
88  void DrawBackPlane(Int_t plane, Bool_t selectionPass,
89  const std::vector<Double_t> &zLevels)const;
90 
91  ClassDef(TGLPlotBox, 0)//Back box for plot.
92 };
93 
94 #endif