ROOT logo
// @(#)root/eve:$Id$
// Author: Matevz Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, 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_TGLAutoRotator
#define ROOT_TGLAutoRotator

#include "TObject.h"
#include "TString.h"

class TGLCamera;
class TGLViewer;
class TTimer;
class TStopwatch;

class TGLAutoRotator : public TObject
{
private:
   TGLAutoRotator(const TGLAutoRotator&);            // Not implemented
   TGLAutoRotator& operator=(const TGLAutoRotator&); // Not implemented
 
protected:
   TGLViewer  *fViewer;
   TGLCamera  *fCamera;
   TTimer     *fTimer;
   TStopwatch *fWatch;

   Bool_t     fRotateScene;

   Double_t   fDeltaPhi;

   Double_t   fDt;
   Double_t   fWPhi;
   Double_t   fWTheta, fATheta;
   Double_t   fWDolly, fADolly;

   Double_t   fThetaA0, fDollyA0;
   Bool_t     fTimerRunning;

   TString    fImageName;
   Int_t      fImageCount;
   Bool_t     fImageAutoSave;

   TString    fImageGUIBaseName;
   Int_t      fImageGUIOutMode;

public:
   TGLAutoRotator(TGLViewer* v);
   virtual ~TGLAutoRotator();

   TGLViewer* GetViewer() const { return fViewer; }
   TGLCamera* GetCamera() const { return fCamera; }

   // --------------------------------

   void Start();
   void Stop();

   void Timeout();
   void RotateScene();

   // --------------------------------

   Bool_t   IsRunning() const     { return fTimerRunning; }

   Bool_t   GetRotateScene() const { return fRotateScene; }
   void     SetRotateScene(Bool_t rotateScene) {Stop(); fRotateScene = rotateScene; }

   Double_t GetDeltaPhi() const {return fDeltaPhi; }
   void     SetDeltaPhi(Double_t dPhi) {fDeltaPhi = dPhi; }

   Double_t GetDt() const         { return fDt; }
   void     SetDt(Double_t dt);

   Double_t GetWPhi() const       { return fWPhi; }
   void     SetWPhi(Double_t w)   { fWPhi = w;    }

   Double_t GetWTheta() const     { return fWTheta; }
   void     SetWTheta(Double_t w) { fWTheta = w;    }
   Double_t GetATheta() const     { return fATheta; }
   void     SetATheta(Double_t a);

   Double_t GetWDolly() const     { return fWDolly; }
   void     SetWDolly(Double_t w) { fWDolly = w;    }
   Double_t GetADolly() const     { return fADolly; }
   void     SetADolly(Double_t a);

   TString  GetImageName() const              { return fImageName;  }
   void     SetImageName(const TString& name) { fImageName = name;  }
   Int_t    GetImageCount() const             { return fImageCount; }
   void     SetImageCount(Int_t ic)           { fImageCount = ic;   }
   Bool_t   GetImageAutoSave() const          { return fImageAutoSave; }
   void     SetImageAutoSave(Bool_t s)        { fImageAutoSave = s; }

   void     StartImageAutoSaveAnimatedGif(const TString& filename);
   void     StartImageAutoSave(const TString& filename);
   void     StopImageAutoSave();

   TString  GetImageGUIBaseName() const               { return fImageGUIBaseName;  }
   void     SetImageGUIBaseName(const TString& gname) { fImageGUIBaseName = gname; }

   Int_t    GetImageGUIOutMode() const  { return fImageGUIOutMode; }
   void     SetImageGUIOutMode(Int_t m);

   void     StartImageAutoSaveWithGUISettings();

   ClassDef(TGLAutoRotator, 0); // Automatic, timer-based, rotation of GL-viewer's camera.
};

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