Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VVTK / VVTK_Recorder.h
1 //  SALOME VTKViewer : build VTK viewer into Salome desktop\r
2 //\r
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
5 // \r
6 //  This library is free software; you can redistribute it and/or \r
7 //  modify it under the terms of the GNU Lesser General Public \r
8 //  License as published by the Free Software Foundation; either \r
9 //  version 2.1 of the License. \r
10 // \r
11 //  This library is distributed in the hope that it will be useful, \r
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of \r
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
14 //  Lesser General Public License for more details. \r
15 // \r
16 //  You should have received a copy of the GNU Lesser General Public \r
17 //  License along with this library; if not, write to the Free Software \r
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA \r
19 // \r
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
21 //\r
22 //\r
23 //\r
24 //  File   : \r
25 //  Author : \r
26 //  Module : SALOME\r
27 //  $Header$\r
28 \r
29 #ifndef _VVTK_Recorder_Header_File_\r
30 #define _VVTK_Recorder_Header_File_\r
31 \r
32 #include <list>\r
33 #include <string>\r
34 #include <vector>\r
35 \r
36 #include <vtkObject.h>\r
37 \r
38 class vtkRenderWindow;\r
39 class vtkCallbackCommand;\r
40 class vtkWindowToImageFilter;\r
41 class VVTK_ImageWriterMgr;\r
42 //\r
43 class VVTK_Recorder : public vtkObject \r
44 {\r
45  protected:\r
46   enum State {\r
47     VVTK_Recorder_Unknown=0,\r
48     VVTK_Recorder_Record,\r
49     VVTK_Recorder_Stop\r
50   };\r
51   \r
52  public:\r
53   static VVTK_Recorder *New();\r
54   vtkTypeRevisionMacro(VVTK_Recorder,vtkObject);\r
55 \r
56   void\r
57   SetRenderWindow(vtkRenderWindow* theRenderWindow);\r
58 \r
59   vtkRenderWindow* \r
60   RenderWindow();\r
61 \r
62   void \r
63   SetName(const char *theName);\r
64 \r
65   const char* \r
66   Name() const;\r
67 \r
68   void\r
69   SetNbFPS(const double theNbFPS);\r
70 \r
71   double\r
72   NbFPS() const;\r
73 \r
74   void\r
75   SetQuality(int theQuality);\r
76 \r
77   int\r
78   GetQuality() const;\r
79 \r
80   void\r
81   SetProgressiveMode(bool theProgressiveMode);\r
82 \r
83   bool\r
84   GetProgressiveMode() const;\r
85 \r
86   void\r
87   SetUseSkippedFrames(bool theUseSkippedFrames);\r
88 \r
89   bool\r
90   UseSkippedFrames() const;\r
91 \r
92   void\r
93   Record();\r
94 \r
95   void\r
96   Pause();\r
97 \r
98   void\r
99   Stop();\r
100 \r
101   int\r
102   State() const;\r
103 \r
104   int  \r
105   ErrorStatus() const;\r
106 \r
107   void\r
108   CheckExistAVIMaker();\r
109 \r
110 protected :\r
111   VVTK_Recorder();\r
112 \r
113   ~VVTK_Recorder();\r
114 \r
115   void\r
116   DoRecord();\r
117 \r
118   void\r
119   MakeFileAVI();\r
120 \r
121   void\r
122   AddSkippedFrames();\r
123 \r
124   void\r
125   PreWrite();\r
126 \r
127   static\r
128   void\r
129   ProcessEvents(vtkObject* theObject, \r
130                 unsigned long theEvent,\r
131                 void* theClientData, \r
132                 void* theCallData);\r
133 \r
134 protected :\r
135   int myState;\r
136   int myPaused;\r
137   int myErrorStatus;\r
138 \r
139   float myPriority;\r
140   double myTimeStart;\r
141 \r
142   int myFrameIndex;\r
143   int myNbWrittenFrames;\r
144 \r
145   double myNbFPS;\r
146   int myQuality;\r
147   bool myProgressiveMode;\r
148 \r
149   typedef std::vector<int> TFrameIndexes;\r
150   TFrameIndexes myFrameIndexes;\r
151   bool myUseSkippedFrames;\r
152 \r
153   std::string myName;\r
154   std::string myNameAVIMaker;\r
155 \r
156   vtkCallbackCommand *myCommand;\r
157   vtkRenderWindow *myRenderWindow;\r
158   vtkWindowToImageFilter *myFilter;\r
159   VVTK_ImageWriterMgr *myWriterMgr;\r
160 \r
161 \r
162 private:\r
163   VVTK_Recorder(const VVTK_Recorder&);  //Not implemented\r
164   void operator=(const VVTK_Recorder&); //Not implemented\r
165 };\r
166 #endif\r