1 2 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
|
/*=========================================================================
Program: ParaView
Module: vtkAnimationPlayer.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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.
=========================================================================*/
/**
* @class vtkAnimationPlayer
*
* Abstract superclass for an animation player.
*/
#ifndef vtkAnimationPlayer_h
#define vtkAnimationPlayer_h
#include "vtkObject.h"
#include "vtkPVAnimationModule.h" // needed for export macro
#include "vtkWeakPointer.h" // needed for vtkWeakPointer.
class vtkSMAnimationScene;
class VTKPVANIMATION_EXPORT vtkAnimationPlayer : public vtkObject
{
public:
vtkTypeMacro(vtkAnimationPlayer, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@{
/**
* Set the animation scene that is to be played by this player.
* Note that the animation scene is not reference counted to avoid loops.
*/
virtual void SetAnimationScene(vtkSMAnimationScene*);
vtkSMAnimationScene* GetAnimationScene();
//@}
/**
* Start playing the animation.
* Fires StartEvent when play begins and EndEvent when play stops.
*/
void Play();
/**
* Stop playing the animation.
*/
void Stop();
/**
* Returns if the animation is currently playing.
*/
int IsInPlay() { return this->InPlay ? 1 : 0; }
vtkGetMacro(InPlay, bool);
//@{
/**
* Set to true to play the animation in a loop.
*/
vtkSetMacro(Loop, bool);
vtkGetMacro(Loop, bool);
//@}
/**
* Take the animation scene to next frame.
*/
void GoToNext();
/**
* Take animation scene to previous frame.
*/
void GoToPrevious();
/**
* Take animation scene to first frame.
*/
void GoToFirst();
/**
* Take animation scene to last frame.
*/
void GoToLast();
protected:
vtkAnimationPlayer();
~vtkAnimationPlayer();
friend class vtkCompositeAnimationPlayer;
virtual void StartLoop(double starttime, double endtime, double* playbackWindow) = 0;
virtual void EndLoop() = 0;
/**
* Return the next time given the current time.
*/
virtual double GetNextTime(double currentime) = 0;
virtual double GoToNext(double start, double end, double currenttime) = 0;
virtual double GoToPrevious(double start, double end, double currenttime) = 0;
private:
vtkAnimationPlayer(const vtkAnimationPlayer&) VTK_DELETE_FUNCTION;
void operator=(const vtkAnimationPlayer&) VTK_DELETE_FUNCTION;
vtkWeakPointer<vtkSMAnimationScene> AnimationScene;
bool InPlay;
bool StopPlay;
bool Loop;
double CurrentTime;
};
#endif
|