TGLPlot3D.cxx

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLPlot3D.cxx 33579 2010-05-19 12:43:08Z rdm $
00002 // Author: Matevz Tadel 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, 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 #include "TGLPlot3D.h"
00013 
00014 #include "TH3.h"
00015 #include "TH3GL.h"
00016 #include "TH2.h"
00017 #include "TH2GL.h"
00018 #include "TF2.h"
00019 #include "TF2GL.h"
00020 #include "TGLParametric.h"
00021 #include "TGLParametricEquationGL.h"
00022 
00023 #include "TVirtualPad.h"
00024 
00025 //______________________________________________________________________________
00026 // Description of TGLPlot3D
00027 //
00028 
00029 ClassImp(TGLPlot3D);
00030 
00031 //______________________________________________________________________________
00032 TGLPlot3D::TGLPlot3D() : TGLObject(), fPlotPainter(0)
00033 {
00034    // Constructor.
00035 
00036    fDLCache = kFALSE; // Disable display list.
00037 }
00038 
00039 //______________________________________________________________________________
00040 TGLPlot3D::~TGLPlot3D()
00041 {
00042    // Destructor.
00043 
00044    delete fPlotPainter;
00045 }
00046 
00047 //______________________________________________________________________________
00048 void TGLPlot3D::SetPainter(TGLPlotPainter* p)
00049 {
00050    // Set painter object and destroy the old one.
00051 
00052    delete fPlotPainter;
00053    fPlotPainter = p;
00054 }
00055 
00056 //==============================================================================
00057 
00058 //______________________________________________________________________________
00059 TGLPlot3D* TGLPlot3D::InstantiatePlot(TObject* obj)
00060 {
00061    // Instantiate the correct plot-painter for given object.
00062    // Protected method.
00063 
00064    if (obj->InheritsFrom(TH3::Class()))
00065    {
00066       return new TH3GL();
00067    }
00068    else if (obj->InheritsFrom(TH2::Class()))
00069    {
00070       return new TH2GL();
00071    }
00072    else if (obj->InheritsFrom(TF2::Class()))
00073    {
00074       return new TF2GL();
00075    }
00076    else if (obj->InheritsFrom(TGLParametricEquation::Class()))
00077    {
00078       return new TGLParametricEquationGL();
00079    }
00080 
00081    return 0;
00082 }
00083 
00084 //______________________________________________________________________________
00085 TGLPlot3D* TGLPlot3D::CreatePlot(TObject* obj, const Option_t* opt, TVirtualPad* pad)
00086 {
00087    // Create GL plot for specified object and options.
00088    // Which axes are logarithmic is determined from a pad.
00089 
00090    TGLPlot3D* log = InstantiatePlot(obj);
00091 
00092    if (log)
00093    {
00094       log->fCoord.SetXLog(pad->GetLogx());
00095       log->fCoord.SetYLog(pad->GetLogy());
00096       log->fCoord.SetZLog(pad->GetLogz());
00097       log->SetModel(obj, opt);
00098       log->SetBBox();
00099    }
00100 
00101    return log;
00102 }
00103 
00104 //______________________________________________________________________________
00105 TGLPlot3D* TGLPlot3D::CreatePlot(TObject* obj, const Option_t* opt, Bool_t logx, Bool_t logy, Bool_t logz)
00106 {
00107    // Create GL plot for specified object and options.
00108    // Which axes are logarithmic is determined from explicit arguments.
00109 
00110    TGLPlot3D* log = InstantiatePlot(obj);
00111 
00112    if (log)
00113    {
00114       log->fCoord.SetXLog(logx);
00115       log->fCoord.SetYLog(logy);
00116       log->fCoord.SetZLog(logz);
00117       log->SetModel(obj, opt);
00118       log->SetBBox();
00119    }
00120 
00121    return log;
00122 }

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