source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/common/eventviewer/src/EAnimator.cc @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 1.6 KB
Line 
1// ESAF : Euso Simulation and Analysis Framework
2// $Id: EAnimator.cc 2795 2008-02-11 12:50:20Z naumov $
3// Author: A.Thea   Aug,  5 2004
4
5#include "EAnimator.hh"
6
7#include "TTimer.h"
8#include "TPad.h"
9#include <TClass.h>
10
11ClassImp(EAnimator)
12
13//_____________________________________________________________________________
14EAnimator::EAnimator() {
15    //
16    // Constructor
17    //
18
19    fTimer = new TTimer(100);
20
21    fFrame     = 0;
22    fNumFrames = 0;
23
24}
25
26//_____________________________________________________________________________
27EAnimator::~EAnimator() {
28    //
29    // Destructor
30    //
31
32    if ( fTimer ) delete fTimer;
33}
34
35//_____________________________________________________________________________
36void EAnimator::Play( Option_t *opt ) {
37    //
38    // Start the movie
39    //
40
41    if ( gPad ) gPad->Clear();
42
43    TString option(opt);
44
45    Draw( option.Data() );
46
47    fTimer->Connect("Timeout()",IsA()->GetName(), this, "Animate()" );
48    Rewind();
49
50    Info("Play","Animation started");
51    fTimer->TurnOn();
52}
53
54//_____________________________________________________________________________
55void EAnimator::Stop() {
56    //
57    // Stop the movie
58    //
59
60    fTimer->TurnOff();
61    Info("Stop","Animation completed");
62
63}
64
65//_____________________________________________________________________________
66void EAnimator::Animate() {
67    //
68    // Move to next animation step and increase the counter
69    //
70   
71    if ( IsEnded() ) {
72        // leave the last frame to be painted
73        fFrame = fNumFrames-1;
74        Stop();
75        return;
76    } 
77
78    NextFrame();
79
80    if ( gPad ) {
81        gPad->Modified();
82        gPad->Update();
83    }
84}
85
Note: See TracBrowser for help on using the repository browser.