ROOT logo
// @(#)root/gl:$Id$
// Author:  Timur Pocheptsov  31/08/2006

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGLPlotFrame
#define ROOT_TGLPlotFrame

#include <vector>

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_TGLUtil
#include "TGLUtil.h"
#endif

class TColor;

/*
   TGLPlotBox draws a box behind a plot.
*/

class TGLPlotBox {
private:
   const TColor          *fFrameColor;
   const Bool_t           fXOYSelectable;
   const Bool_t           fXOZSelectable;
   const Bool_t           fYOZSelectable;

   Bool_t                 fSelectablePairs[4][2];

   TGLVertex3             f3DBox[8];
   mutable TGLVertex3     f2DBox[8];
   mutable TGLVertex3     f2DBoxU[8];
   mutable Int_t          fFrontPoint;

   //The sizes of a "unit" cube.
   Double_t               fRangeXU;
   Double_t               fRangeYU;
   Double_t               fRangeZU;
   
   Bool_t                 fDrawBack;
   Bool_t                 fDrawFront;

public:

   TGLPlotBox(Bool_t xoySelectable, Bool_t xozSelectable, Bool_t yozSelectable);
   //ClassDef macro adds some virtual functions,
   //so, to supress g++ warnings virtual destructor declared.
   virtual ~TGLPlotBox();

   void DrawBox(Int_t selectedPart, Bool_t selectionPass,
                const std::vector<Double_t> &zLevels,
                Bool_t highColor)const;

   void SetPlotBox(const Rgl::Range_t &xRange,
                   const Rgl::Range_t &yRange,
                   const Rgl::Range_t &zRange);
   void SetPlotBox(const Rgl::Range_t &xRange, Double_t rangeXU,
                   const Rgl::Range_t &yRange, Double_t rangeYU,
                   const Rgl::Range_t &zRange, Double_t rangeZU);

   void SetFrameColor(const TColor *color);

   Int_t FindFrontPoint()const;
   Int_t GetFrontPoint()const;

   const TGLVertex3 *Get3DBox()const;
   const TGLVertex3 *Get2DBox()const;

   static const Int_t    fgFramePlanes[][4];
   static const Int_t    fgBackPairs[][2];
   static const Int_t    fgFrontPairs[][2];
   static const Double_t fgNormals[][3];
   
   void SetDrawFront(Bool_t d) {fDrawFront = d;}
   Bool_t GetDrawFront() const {return fDrawFront;}

   void SetDrawBack(Bool_t d) {fDrawBack = d;}
   Bool_t GetDrawBack() const {return fDrawBack;}

private:
   void DrawBack(Int_t selectedPart, Bool_t selectionPass, const std::vector<Double_t> &zLevels, Bool_t highColor)const;
   void DrawFront()const;
   void DrawBackPlane(Int_t plane, Bool_t selectionPass,
                      const std::vector<Double_t> &zLevels)const;

   ClassDef(TGLPlotBox, 0)//Back box for plot.
};

#endif
 TGLPlotBox.h:1
 TGLPlotBox.h:2
 TGLPlotBox.h:3
 TGLPlotBox.h:4
 TGLPlotBox.h:5
 TGLPlotBox.h:6
 TGLPlotBox.h:7
 TGLPlotBox.h:8
 TGLPlotBox.h:9
 TGLPlotBox.h:10
 TGLPlotBox.h:11
 TGLPlotBox.h:12
 TGLPlotBox.h:13
 TGLPlotBox.h:14
 TGLPlotBox.h:15
 TGLPlotBox.h:16
 TGLPlotBox.h:17
 TGLPlotBox.h:18
 TGLPlotBox.h:19
 TGLPlotBox.h:20
 TGLPlotBox.h:21
 TGLPlotBox.h:22
 TGLPlotBox.h:23
 TGLPlotBox.h:24
 TGLPlotBox.h:25
 TGLPlotBox.h:26
 TGLPlotBox.h:27
 TGLPlotBox.h:28
 TGLPlotBox.h:29
 TGLPlotBox.h:30
 TGLPlotBox.h:31
 TGLPlotBox.h:32
 TGLPlotBox.h:33
 TGLPlotBox.h:34
 TGLPlotBox.h:35
 TGLPlotBox.h:36
 TGLPlotBox.h:37
 TGLPlotBox.h:38
 TGLPlotBox.h:39
 TGLPlotBox.h:40
 TGLPlotBox.h:41
 TGLPlotBox.h:42
 TGLPlotBox.h:43
 TGLPlotBox.h:44
 TGLPlotBox.h:45
 TGLPlotBox.h:46
 TGLPlotBox.h:47
 TGLPlotBox.h:48
 TGLPlotBox.h:49
 TGLPlotBox.h:50
 TGLPlotBox.h:51
 TGLPlotBox.h:52
 TGLPlotBox.h:53
 TGLPlotBox.h:54
 TGLPlotBox.h:55
 TGLPlotBox.h:56
 TGLPlotBox.h:57
 TGLPlotBox.h:58
 TGLPlotBox.h:59
 TGLPlotBox.h:60
 TGLPlotBox.h:61
 TGLPlotBox.h:62
 TGLPlotBox.h:63
 TGLPlotBox.h:64
 TGLPlotBox.h:65
 TGLPlotBox.h:66
 TGLPlotBox.h:67
 TGLPlotBox.h:68
 TGLPlotBox.h:69
 TGLPlotBox.h:70
 TGLPlotBox.h:71
 TGLPlotBox.h:72
 TGLPlotBox.h:73
 TGLPlotBox.h:74
 TGLPlotBox.h:75
 TGLPlotBox.h:76
 TGLPlotBox.h:77
 TGLPlotBox.h:78
 TGLPlotBox.h:79
 TGLPlotBox.h:80
 TGLPlotBox.h:81
 TGLPlotBox.h:82
 TGLPlotBox.h:83
 TGLPlotBox.h:84
 TGLPlotBox.h:85
 TGLPlotBox.h:86
 TGLPlotBox.h:87
 TGLPlotBox.h:88
 TGLPlotBox.h:89
 TGLPlotBox.h:90
 TGLPlotBox.h:91
 TGLPlotBox.h:92
 TGLPlotBox.h:93
 TGLPlotBox.h:94
 TGLPlotBox.h:95
 TGLPlotBox.h:96
 TGLPlotBox.h:97
 TGLPlotBox.h:98