Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SVTK / SVTK_Recorder.h
diff --git a/src/SVTK/SVTK_Recorder.h b/src/SVTK/SVTK_Recorder.h
new file mode 100755 (executable)
index 0000000..4369747
--- /dev/null
@@ -0,0 +1,159 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef SVTK_RECORDER_H
+#define SVTK_RECORDER_H
+
+#include <list>
+#include <string>
+#include <vector>
+
+#include <vtkObject.h>
+
+class vtkRenderWindow;
+class vtkCallbackCommand;
+class vtkWindowToImageFilter;
+class SVTK_ImageWriterMgr;
+
+class SVTK_Recorder : public vtkObject 
+{
+ protected:
+  enum State {
+    SVTK_Recorder_Unknown=0,
+    SVTK_Recorder_Record,
+    SVTK_Recorder_Stop
+  };
+  
+ public:
+  static SVTK_Recorder *New();
+  vtkTypeRevisionMacro(SVTK_Recorder,vtkObject);
+
+  void
+  SetRenderWindow(vtkRenderWindow* theRenderWindow);
+
+  vtkRenderWindow* 
+  RenderWindow();
+
+  void 
+  SetName(const char *theName);
+
+  const char* 
+  Name() const;
+
+  void
+  SetNbFPS(const double theNbFPS);
+
+  double
+  NbFPS() const;
+
+  void
+  SetQuality(int theQuality);
+
+  int
+  GetQuality() const;
+
+  void
+  SetProgressiveMode(bool theProgressiveMode);
+
+  bool
+  GetProgressiveMode() const;
+
+  void
+  SetUseSkippedFrames(bool theUseSkippedFrames);
+
+  bool
+  UseSkippedFrames() const;
+
+  void
+  Record();
+
+  void
+  Pause();
+
+  void
+  Stop();
+
+  int
+  State() const;
+
+  int  
+  ErrorStatus() const;
+
+  void
+  CheckExistAVIMaker();
+
+protected :
+  SVTK_Recorder();
+
+  ~SVTK_Recorder();
+
+  void
+  DoRecord();
+
+  void
+  MakeFileAVI();
+
+  void
+  AddSkippedFrames();
+
+  void
+  PreWrite();
+
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+
+protected :
+  int myState;
+  int myPaused;
+  int myErrorStatus;
+
+  float myPriority;
+  double myTimeStart;
+
+  int myFrameIndex;
+  int myNbWrittenFrames;
+
+  double myNbFPS;
+  int myQuality;
+  bool myProgressiveMode;
+
+  typedef std::vector<int> TFrameIndexes;
+  TFrameIndexes myFrameIndexes;
+  bool myUseSkippedFrames;
+
+  std::string myName;
+  std::string myNameAVIMaker;
+
+  vtkCallbackCommand *myCommand;
+  vtkRenderWindow *myRenderWindow;
+  vtkWindowToImageFilter *myFilter;
+  SVTK_ImageWriterMgr *myWriterMgr;
+
+private:
+  SVTK_Recorder(const SVTK_Recorder&);  //Not implemented
+  void operator=(const SVTK_Recorder&); //Not implemented
+};
+
+#endif