| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 
 | /*=========================================================================
  Program:   Visualization Toolkit
  Module:    vtkAnimationScene.h
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkAnimationScene - the animation scene manager.
// .SECTION Description
// vtkAnimationCue and vtkAnimationScene provide the framework to support
// animations in VTK. vtkAnimationCue represents an entity that changes/
// animates with time, while vtkAnimationScene represents scene or setup
// for the animation, which consists of individual cues or other scenes.
//
// A scene can be played in real time mode, or as a seqence of frames
// 1/frame rate apart in time.
// .SECTION See Also
// vtkAnimationCue
#ifndef vtkAnimationScene_h
#define vtkAnimationScene_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkAnimationCue.h"
class vtkAnimationCue;
class vtkCollection;
class vtkCollectionIterator;
class vtkTimerLog;
class VTKCOMMONDATAMODEL_EXPORT vtkAnimationScene: public vtkAnimationCue
{
public:
  vtkTypeMacro(vtkAnimationScene, vtkAnimationCue);
  void PrintSelf(ostream& os, vtkIndent indent);
  static vtkAnimationScene* New();
  // Description:
  // Get/Set the PlayMode for running/playing the animation scene.
  // In the Sequence mode, all the frames are generated one after the other.
  // The time reported to each Tick of the constituent cues (during Play) is
  // incremented by 1/frame rate, irrespective of the current time.
  // In the RealTime mode, time indicates the instance in time.
  vtkSetMacro(PlayMode, int);
  void SetModeToSequence() { this->SetPlayMode(PLAYMODE_SEQUENCE); }
  void SetModeToRealTime() { this->SetPlayMode(PLAYMODE_REALTIME); }
  vtkGetMacro(PlayMode, int);
  // Description:
  // Get/Set the frame rate (in frames per second).
  // This parameter affects only in the Sequence mode. The time interval
  // indicated to each cue on every tick is progressed by 1/frame-rate seconds.
  vtkSetMacro(FrameRate, double);
  vtkGetMacro(FrameRate, double);
  // Description:
  // Add/Remove an AnimationCue to/from the Scene.
  // It's an error to add a cue twice to the Scene.
  void AddCue(vtkAnimationCue* cue);
  void RemoveCue(vtkAnimationCue* cue);
  void RemoveAllCues();
  int  GetNumberOfCues();
  // Description:
  // Starts playing the animation scene. Fires a vtkCommand::StartEvent
  // before play beings and vtkCommand::EndEvent after play ends.
  virtual void Play();
  // Description:
  // Stops the animation scene that is running.
  void Stop();
  // Description:
  // Enable/Disable animation loop.
  vtkSetMacro(Loop, int);
  vtkGetMacro(Loop, int);
  // Description:
  // Makes the state of the scene same as the given time.
  void SetAnimationTime(double time);
  vtkGetMacro(AnimationTime, double);
  // Description:
  // Overridden to allow change to Normalized mode only
  // if none of the constituent cues is in Relative time mode.
  virtual void SetTimeMode(int mode);
  // Description:
  // Returns if the animation is being played.
  int IsInPlay() { return this->InPlay; }
  enum PlayModes
  {
    PLAYMODE_SEQUENCE=0,
    PLAYMODE_REALTIME=1
  };
protected:
  vtkAnimationScene();
  ~vtkAnimationScene();
  // Description:
  // Called on every valid tick.
  // Calls ticks on all the contained cues.
  virtual void TickInternal(double currenttime, double deltatime, double clocktime);
  virtual void StartCueInternal();
  virtual void EndCueInternal();
  void InitializeChildren();
  void FinalizeChildren();
  int PlayMode;
  double FrameRate;
  int Loop;
  int InPlay;
  int StopPlay;
  double AnimationTime;
  vtkCollection* AnimationCues;
  vtkCollectionIterator* AnimationCuesIterator;
  vtkTimerLog* AnimationTimer;
private:
  vtkAnimationScene(const vtkAnimationScene&); // Not implemented.
  void operator=(const vtkAnimationScene&); // Not implemented.
};
#endif
 |