vtkAnimationPlayer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
9 #ifndef vtkAnimationPlayer_h
10 #define vtkAnimationPlayer_h
11 
12 #include "vtkObject.h"
13 #include "vtkRemotingAnimationModule.h" // needed for export macro
14 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
15 
17 class VTKREMOTINGANIMATION_EXPORT vtkAnimationPlayer : public vtkObject
18 {
19 public:
20  vtkTypeMacro(vtkAnimationPlayer, vtkObject);
21  void PrintSelf(ostream& os, vtkIndent indent) override;
22 
24 
28  virtual void SetAnimationScene(vtkSMAnimationScene*);
29  vtkSMAnimationScene* GetAnimationScene();
31 
38  void Play(int dir = 1);
39 
43  void Stop();
44 
48  int IsInPlay() { return this->InPlay ? 1 : 0; }
49  vtkGetMacro(InPlay, bool);
50 
52 
55  vtkSetMacro(Loop, bool);
56  vtkGetMacro(Loop, bool);
58 
62  void GoToNext();
63 
67  void GoToPrevious();
68 
72  void GoToFirst();
73 
77  void GoToLast();
78 
80 
86  vtkGetMacro(Stride, int);
87  vtkSetClampMacro(Stride, int, 1, VTK_INT_MAX);
89 
90 protected:
92  ~vtkAnimationPlayer() override;
93 
95 
97 
100  // initialize inner variables. Call it before any GetNextTime/GetPreviousTime call.
101  virtual void StartLoop(
102  double starttime, double endtime, double curtime, double* playbackWindow) = 0;
103  // finalize loop
104  virtual void EndLoop() = 0;
105  // Return the next time in the loop given the current time.
106  virtual double GetNextTime(double currentime) = 0;
107  // Return the previous time in the loop given the current time.
108  virtual double GetPreviousTime(double currenttime) = 0;
110 
112 
115  virtual double GoToNext(double start, double end, double currenttime) = 0;
116  virtual double GoToPrevious(double start, double end, double currenttime) = 0;
118 
119 private:
120  vtkAnimationPlayer(const vtkAnimationPlayer&) = delete;
121  void operator=(const vtkAnimationPlayer&) = delete;
122 
124  bool InPlay;
125  bool StopPlay;
126  bool Loop;
127  double CurrentTime;
128  int Stride = 1;
129 };
130 
131 #endif
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkCompositeAnimationPlayer::EndLoop
void EndLoop() override
Delegated to the active animation player.
vtkSMAnimationScene
animation scene for ParaView.
Definition: vtkSMAnimationScene.h:34
vtkObject
vtkCompositeAnimationPlayer
Definition: vtkCompositeAnimationPlayer.h:22
vtkAnimationPlayer::IsInPlay
int IsInPlay()
Returns if the animation is currently playing.
Definition: vtkAnimationPlayer.h:48
vtkCompositeAnimationPlayer::GetPreviousTime
double GetPreviousTime(double currenttime) override
Delegated to the active animation player.
vtkAnimationPlayer::GoToPrevious
void GoToPrevious()
Take animation scene to previous frame.
vtkIndent
vtkAnimationPlayer
Definition: vtkAnimationPlayer.h:17
vtkAnimationPlayer::GoToNext
void GoToNext()
Take the animation scene to next frame.
vtkCompositeAnimationPlayer::StartLoop
void StartLoop(double starttime, double endtime, double curtime, double *playbackWindow) override
Delegated to the active animation player.
vtkWeakPointer.h
vtkObject.h
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkAnimationPlayer::vtkAnimationPlayer
vtkAnimationPlayer()
vtkWeakPointer< vtkSMAnimationScene >
vtkCompositeAnimationPlayer::GetNextTime
double GetNextTime(double currentime) override
Delegated to the active animation player.