VTK
vtkInteractorEventRecorder.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractorEventRecorder.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
37 #ifndef vtkInteractorEventRecorder_h
38 #define vtkInteractorEventRecorder_h
39 
40 #include "vtkRenderingCoreModule.h" // For export macro
41 #include "vtkInteractorObserver.h"
42 
43 // The superclass that all commands should be subclasses of
44 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent);
50 
51  // Satisfy the superclass API. Enable/disable listening for events.
52  virtual void SetEnabled(int);
54 
56 
59  vtkSetStringMacro(FileName);
60  vtkGetStringMacro(FileName);
62 
67  void Record();
68 
73  void Play();
74 
78  void Stop();
79 
83  void Rewind();
84 
86 
90  vtkSetMacro(ReadFromInputString,int);
91  vtkGetMacro(ReadFromInputString,int);
92  vtkBooleanMacro(ReadFromInputString,int);
94 
96 
99  vtkSetStringMacro(InputString);
100  vtkGetStringMacro(InputString);
102 
103 protected:
106 
107  // file to read/write from
108  char *FileName;
109 
110  //listens to delete events
112 
113  // control whether to read from string
115  char *InputString;
116 
117  // for reading and writing
118  istream *InputStream;
119  ostream *OutputStream;
120 
121  //methods for processing events
122  static void ProcessCharEvent(vtkObject* object, unsigned long event,
123  void* clientdata, void* calldata);
124  static void ProcessDeleteEvent(vtkObject* object, unsigned long event,
125  void* clientdata, void* calldata);
126  static void ProcessEvents(vtkObject* object, unsigned long event,
127  void* clientdata, void* calldata);
128 
129  virtual void WriteEvent(const char* event, int pos[2], int ctrlKey,
130  int shiftKey, int keyCode, int repeatCount,
131  char* keySym);
132 
133  virtual void ReadEvent();
134 
135  // Manage the state of the recorder
136  int State;
138  {
139  Start=0,
141  Recording
142  };
143 
144  static float StreamVersion;
145 
146 private:
147  vtkInteractorEventRecorder(const vtkInteractorEventRecorder&) VTK_DELETE_FUNCTION;
148  void operator=(const vtkInteractorEventRecorder&) VTK_DELETE_FUNCTION;
149 
150 };
151 
152 #endif /* vtkInteractorEventRecorder_h */
153 
vtkInteractorEventRecorder::InputStream
istream * InputStream
Definition: vtkInteractorEventRecorder.h:118
vtkInteractorEventRecorder
record and play VTK events passing through a vtkRenderWindowInteractor
Definition: vtkInteractorEventRecorder.h:45
vtkInteractorEventRecorder::ProcessDeleteEvent
static void ProcessDeleteEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkInteractorEventRecorder::InputString
char * InputString
Definition: vtkInteractorEventRecorder.h:115
vtkInteractorEventRecorder::WidgetState
WidgetState
Definition: vtkInteractorEventRecorder.h:138
vtkInteractorEventRecorder::FileName
char * FileName
Definition: vtkInteractorEventRecorder.h:108
vtkInteractorEventRecorder::StreamVersion
static float StreamVersion
Definition: vtkInteractorEventRecorder.h:144
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkInteractorEventRecorder::State
int State
Definition: vtkInteractorEventRecorder.h:136
vtkInteractorEventRecorder::vtkInteractorEventRecorder
vtkInteractorEventRecorder()
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:60
vtkInteractorEventRecorder::SetEnabled
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
vtkInteractorEventRecorder::Playing
@ Playing
Definition: vtkInteractorEventRecorder.h:140
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkInteractorEventRecorder::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkInteractorEventRecorder::SetInteractor
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
This method is used to associate the widget with the render window interactor.
vtkInteractorEventRecorder::DeleteEventCallbackCommand
vtkCallbackCommand * DeleteEventCallbackCommand
Definition: vtkInteractorEventRecorder.h:111
vtkInteractorEventRecorder::Play
void Play()
Invoke this method to begin playing events from the current position.
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:79
vtkInteractorEventRecorder::ProcessCharEvent
static void ProcessCharEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkInteractorEventRecorder::OutputStream
ostream * OutputStream
Definition: vtkInteractorEventRecorder.h:119
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkInteractorEventRecorder::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkInteractorEventRecorder::Stop
void Stop()
Invoke this method to stop recording/playing events.
vtkInteractorEventRecorder::Record
void Record()
Invoke this method to begin recording events.
vtkInteractorEventRecorder::Rewind
void Rewind()
Rewind to the beginning of the file.
vtkInteractorEventRecorder::WriteEvent
virtual void WriteEvent(const char *event, int pos[2], int ctrlKey, int shiftKey, int keyCode, int repeatCount, char *keySym)
vtkInteractorObserver.h
vtkInteractorEventRecorder::~vtkInteractorEventRecorder
~vtkInteractorEventRecorder()
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:51
vtkInteractorEventRecorder::ReadFromInputString
int ReadFromInputString
Definition: vtkInteractorEventRecorder.h:114
vtkX3D::shiftKey
@ shiftKey
Definition: vtkX3D.h:474
vtkInteractorEventRecorder::ReadEvent
virtual void ReadEvent()
vtkInteractorEventRecorder::New
static vtkInteractorEventRecorder * New()