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