]> SALOME platform Git repositories - modules/gui.git/blob - src/SVTK/SVTK_Recorder.h
Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SVTK / SVTK_Recorder.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef SVTK_RECORDER_H
23 #define SVTK_RECORDER_H
24
25 #include <list>
26 #include <string>
27 #include <vector>
28
29 #include <vtkObject.h>
30
31 class vtkRenderWindow;
32 class vtkCallbackCommand;
33 class vtkWindowToImageFilter;
34 class SVTK_ImageWriterMgr;
35
36 class SVTK_Recorder : public vtkObject 
37 {
38  protected:
39   enum State {
40     SVTK_Recorder_Unknown=0,
41     SVTK_Recorder_Record,
42     SVTK_Recorder_Stop
43   };
44   
45  public:
46   static SVTK_Recorder *New();
47   vtkTypeRevisionMacro(SVTK_Recorder,vtkObject);
48
49   void
50   SetRenderWindow(vtkRenderWindow* theRenderWindow);
51
52   vtkRenderWindow* 
53   RenderWindow();
54
55   void 
56   SetName(const char *theName);
57
58   const char* 
59   Name() const;
60
61   void
62   SetNbFPS(const double theNbFPS);
63
64   double
65   NbFPS() const;
66
67   void
68   SetQuality(int theQuality);
69
70   int
71   GetQuality() const;
72
73   void
74   SetProgressiveMode(bool theProgressiveMode);
75
76   bool
77   GetProgressiveMode() const;
78
79   void
80   SetUseSkippedFrames(bool theUseSkippedFrames);
81
82   bool
83   UseSkippedFrames() const;
84
85   void
86   Record();
87
88   void
89   Pause();
90
91   void
92   Stop();
93
94   int
95   State() const;
96
97   int  
98   ErrorStatus() const;
99
100   void
101   CheckExistAVIMaker();
102
103 protected :
104   SVTK_Recorder();
105
106   ~SVTK_Recorder();
107
108   void
109   DoRecord();
110
111   void
112   MakeFileAVI();
113
114   void
115   AddSkippedFrames();
116
117   void
118   PreWrite();
119
120   static
121   void
122   ProcessEvents(vtkObject* theObject, 
123                 unsigned long theEvent,
124                 void* theClientData, 
125                 void* theCallData);
126
127 protected :
128   int myState;
129   int myPaused;
130   int myErrorStatus;
131
132   float myPriority;
133   double myTimeStart;
134
135   int myFrameIndex;
136   int myNbWrittenFrames;
137
138   double myNbFPS;
139   int myQuality;
140   bool myProgressiveMode;
141
142   typedef std::vector<int> TFrameIndexes;
143   TFrameIndexes myFrameIndexes;
144   bool myUseSkippedFrames;
145
146   std::string myName;
147   std::string myNameAVIMaker;
148
149   vtkCallbackCommand *myCommand;
150   vtkRenderWindow *myRenderWindow;
151   vtkWindowToImageFilter *myFilter;
152   SVTK_ImageWriterMgr *myWriterMgr;
153
154 private:
155   SVTK_Recorder(const SVTK_Recorder&);  //Not implemented
156   void operator=(const SVTK_Recorder&); //Not implemented
157 };
158
159 #endif