0030412: Visualization, TKV3d - add presentation of camera frustum
[occt.git] / src / AIS / AIS_AnimationTimer.hxx
CommitLineData
1beb58d7 1// Created by: Kirill Gavrilov
2// Copyright (c) 2016 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _AIS_AnimationTimer_HeaderFile
16#define _AIS_AnimationTimer_HeaderFile
17
18#include <OSD_Timer.hxx>
19#include <Standard_Transient.hxx>
20#include <Standard_Type.hxx>
21
22//! Auxiliary class defining the animation timer.
23class AIS_AnimationTimer : public Standard_Transient
24{
0e9fe060 25 DEFINE_STANDARD_RTTIEXT(AIS_AnimationTimer, Standard_Transient)
1beb58d7 26public:
27
28 //! Empty constructor.
29 AIS_AnimationTimer() : myTimerFrom (0.0), myTimerSpeed (1.0) {}
30
31 //! Return elapsed time in seconds.
32 Standard_Real ElapsedTime() const
33 {
34 return myTimerFrom + myTimer.ElapsedTime() * myTimerSpeed;
35 }
36
37 //! Return playback speed coefficient (1.0 means normal speed).
38 Standard_Real PlaybackSpeed() const { return myTimerSpeed; }
39
40 //! Setup playback speed coefficient.
41 Standard_EXPORT void SetPlaybackSpeed (const Standard_Real theSpeed);
42
43 //! Return true if timer has been started.
44 Standard_Boolean IsStarted() const
45 {
46 return myTimer.IsStarted();
47 }
48
49 //! Start the timer.
50 void Start()
51 {
52 myTimer.Start();
53 }
54
55 //! Pause the timer.
56 Standard_EXPORT void Pause();
57
58 //! Stop the timer.
59 Standard_EXPORT void Stop();
60
61 //! Seek the timer to specified position.
62 Standard_EXPORT void Seek (const Standard_Real theTime);
63
64protected:
65
66 OSD_Timer myTimer;
67 Standard_Real myTimerFrom;
68 Standard_Real myTimerSpeed;
69
70};
71
72DEFINE_STANDARD_HANDLE(AIS_AnimationTimer, Standard_Transient)
73
74#endif // _AIS_AnimationTimer_HeaderFile