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 =========================================================================*/
34 #ifndef vtkInteractorEventRecorder_h
35 #define vtkInteractorEventRecorder_h
36 
37 #include "vtkRenderingCoreModule.h" // For export macro
38 #include "vtkInteractorObserver.h"
39 
40 // The superclass that all commands should be subclasses of
41 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
48  // Satisfy the superclass API. Enable/disable listening for events.
49  void SetEnabled(int) override;
50  void SetInteractor(vtkRenderWindowInteractor* iren) override;
51 
53 
56  vtkSetStringMacro(FileName);
57  vtkGetStringMacro(FileName);
59 
64  void Record();
65 
70  void Play();
71 
75  void Stop();
76 
80  void Rewind();
81 
83 
87  vtkSetMacro(ReadFromInputString,vtkTypeBool);
88  vtkGetMacro(ReadFromInputString,vtkTypeBool);
89  vtkBooleanMacro(ReadFromInputString,vtkTypeBool);
91 
93 
96  vtkSetStringMacro(InputString);
97  vtkGetStringMacro(InputString);
99 
100 protected:
102  ~vtkInteractorEventRecorder() override;
103 
104  // file to read/write from
105  char *FileName;
106 
107  //listens to delete events
109 
110  // control whether to read from string
112  char *InputString;
113 
114  // for reading and writing
115  istream *InputStream;
116  ostream *OutputStream;
117 
118  //methods for processing events
119  static void ProcessCharEvent(vtkObject* object, unsigned long event,
120  void* clientdata, void* calldata);
121  static void ProcessDeleteEvent(vtkObject* object, unsigned long event,
122  void* clientdata, void* calldata);
123  static void ProcessEvents(vtkObject* object, unsigned long event,
124  void* clientdata, void* calldata);
125 
126  virtual void WriteEvent(const char* event, int pos[2], int modifiers,
127  int keyCode, int repeatCount, char* keySym);
128 
129  virtual void ReadEvent();
130 
131  // Manage the state of the recorder
132  int State;
134  {
135  Start=0,
137  Recording
138  };
139 
140  // Associate a modifier with a bit
142  {
143  ShiftKey=1,
144  ControlKey=2,
145  AltKey=4
146  };
147 
148  static float StreamVersion;
149 
150 private:
152  void operator=(const vtkInteractorEventRecorder&) = delete;
153 
154 };
155 
156 #endif /* vtkInteractorEventRecorder_h */
157 
vtkInteractorEventRecorder::InputStream
istream * InputStream
Definition: vtkInteractorEventRecorder.h:115
vtkInteractorEventRecorder
record and play VTK events passing through a vtkRenderWindowInteractor
Definition: vtkInteractorEventRecorder.h:41
vtkInteractorEventRecorder::InputString
char * InputString
Definition: vtkInteractorEventRecorder.h:112
vtkInteractorEventRecorder::WidgetState
WidgetState
Definition: vtkInteractorEventRecorder.h:133
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkInteractorEventRecorder::FileName
char * FileName
Definition: vtkInteractorEventRecorder.h:105
vtkInteractorEventRecorder::StreamVersion
static float StreamVersion
Definition: vtkInteractorEventRecorder.h:148
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkInteractorEventRecorder::State
int State
Definition: vtkInteractorEventRecorder.h:132
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:59
vtkInteractorEventRecorder::Playing
Definition: vtkInteractorEventRecorder.h:136
vtkInteractorObserver::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Handles the char widget activation event.
vtkInteractorObserver::SetEnabled
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
Definition: vtkInteractorObserver.h:73
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkInteractorEventRecorder::ModifierKey
ModifierKey
Definition: vtkInteractorEventRecorder.h:141
vtkInteractorEventRecorder::DeleteEventCallbackCommand
vtkCallbackCommand * DeleteEventCallbackCommand
Definition: vtkInteractorEventRecorder.h:108
vtkInteractorObserver::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:72
vtkInteractorEventRecorder::OutputStream
ostream * OutputStream
Definition: vtkInteractorEventRecorder.h:116
vtkInteractorObserver::SetInteractor
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
This method is used to associate the widget with the render window interactor.
vtkInteractorObserver.h
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:44
vtkInteractorEventRecorder::ReadFromInputString
vtkTypeBool ReadFromInputString
Definition: vtkInteractorEventRecorder.h:111
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69