Logo ROOT   6.14/05
Reference Guide
camera_restore.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_eve
3 ///
4 /// \macro_code
5 ///
6 /// \author Matevz Tadel
7 
8 void camera_restore(const char* fname, int mode = 0)
9 {
11  writeCurrentCamera(fname);
12 }
13 
14 void writeCurrentCamera(const char* fname)
15 {
17  TFile* f = TFile::Open(fname, "RECREATE");
18  c.Write();
19  f->Close();
20 }
21 
22 
23 void readCurrentCamera(const char* fname)
24 {
26  TFile* f = TFile::Open(fname, "READ");
27  if (!f)
28  return;
29 
30  if (f->GetKey(c.ClassName())) {
31  f->GetKey(c.ClassName())->Read(&c);
32  c.IncTimeStamp();
34  }
35 }
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:785
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
virtual TKey * GetKey(const char *name, Short_t cycle=9999) const
Return pointer to key with name,cycle.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:47
#define f(i)
Definition: RSha256.hxx:104
TGLCamera & CurrentCamera() const
Definition: TGLViewer.h:269
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3976
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
Definition: TGLViewer.cxx:440
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
#define c(i)
Definition: RSha256.hxx:101
void IncTimeStamp()
Definition: TGLCamera.h:124
virtual void Close(Option_t *option="")
Close a file.
Definition: TFile.cxx:917