Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:15

0001 // Created by: Kirill Gavrilov
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Media_Timer_HeaderFile
0016 #define _Media_Timer_HeaderFile
0017 
0018 #include <OSD_Timer.hxx>
0019 #include <Standard_Transient.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 //! Auxiliary class defining the animation timer.
0023 class Media_Timer : public Standard_Transient
0024 {
0025   DEFINE_STANDARD_RTTIEXT(Media_Timer, Standard_Transient)
0026 public:
0027 
0028   //! Empty constructor.
0029   Media_Timer() : myTimerFrom (0.0), myTimerSpeed (1.0) {}
0030 
0031   //! Return elapsed time in seconds.
0032   Standard_Real ElapsedTime() const
0033   {
0034     return myTimerFrom + myTimer.ElapsedTime() * myTimerSpeed;
0035   }
0036 
0037   //! Return playback speed coefficient (1.0 means normal speed).
0038   Standard_Real PlaybackSpeed() const { return myTimerSpeed; }
0039 
0040   //! Setup playback speed coefficient.
0041   Standard_EXPORT void SetPlaybackSpeed (const Standard_Real theSpeed);
0042 
0043   //! Return true if timer has been started.
0044   Standard_Boolean IsStarted() const
0045   {
0046     return myTimer.IsStarted();
0047   }
0048 
0049   //! Start the timer.
0050   void Start()
0051   {
0052     myTimer.Start();
0053   }
0054 
0055   //! Pause the timer.
0056   Standard_EXPORT void Pause();
0057 
0058   //! Stop the timer.
0059   Standard_EXPORT void Stop();
0060 
0061   //! Seek the timer to specified position.
0062   Standard_EXPORT void Seek (const Standard_Real theTime);
0063 
0064 protected:
0065 
0066   OSD_Timer     myTimer;
0067   Standard_Real myTimerFrom;
0068   Standard_Real myTimerSpeed;
0069 
0070 };
0071 
0072 DEFINE_STANDARD_HANDLE(Media_Timer, Standard_Transient)
0073 
0074 #endif // _Media_Timer_HeaderFile