Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 {
10  TEveManager::Create();
11  writeCurrentCamera(fname);
12 }
13 
14 void writeCurrentCamera(const char* fname)
15 {
16  TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera();
17  TFile* f = TFile::Open(fname, "RECREATE");
18  c.Write();
19  f->Close();
20 }
21 
22 
23 void readCurrentCamera(const char* fname)
24 {
25  TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera();
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();
33  gEve->GetDefaultGLViewer()->RequestDraw();
34  }
35 }