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) override;
50 
51  // Satisfy the superclass API. Enable/disable listening for events.
52  void SetEnabled(int) override;
53  void SetInteractor(vtkRenderWindowInteractor* iren) override;
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,vtkTypeBool);
91  vtkGetMacro(ReadFromInputString,vtkTypeBool);
92  vtkBooleanMacro(ReadFromInputString,vtkTypeBool);
94 
96 
99  vtkSetStringMacro(InputString);
100  vtkGetStringMacro(InputString);
102 
103 protected:
105  ~vtkInteractorEventRecorder() override;
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 modifiers,
130  int keyCode, int repeatCount, char* keySym);
131 
132  virtual void ReadEvent();
133 
134  // Manage the state of the recorder
135  int State;
137  {
138  Start=0,
140  Recording
141  };
142 
143  // Associate a modifier with a bit
145  {
146  ShiftKey=1,
147  ControlKey=2,
148  AltKey=4
149  };
150 
151  static float StreamVersion;
152 
153 private:
155  void operator=(const vtkInteractorEventRecorder&) = delete;
156 
157 };
158 
159 #endif /* vtkInteractorEventRecorder_h */
160 
vtkInteractorEventRecorder::InputStream
istream * InputStream
Definition: vtkInteractorEventRecorder.h:118
vtkInteractorEventRecorder
record and play VTK events passing through a vtkRenderWindowInteractor
Definition: vtkInteractorEventRecorder.h:44
vtkInteractorEventRecorder::InputString
char * InputString
Definition: vtkInteractorEventRecorder.h:115
vtkInteractorEventRecorder::WidgetState
WidgetState
Definition: vtkInteractorEventRecorder.h:136
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:108
vtkInteractorEventRecorder::StreamVersion
static float StreamVersion
Definition: vtkInteractorEventRecorder.h:151
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkInteractorEventRecorder::State
int State
Definition: vtkInteractorEventRecorder.h:135
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:59
vtkInteractorEventRecorder::Playing
Definition: vtkInteractorEventRecorder.h:139
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:39
vtkInteractorEventRecorder::ModifierKey
ModifierKey
Definition: vtkInteractorEventRecorder.h:144
vtkInteractorEventRecorder::DeleteEventCallbackCommand
vtkCallbackCommand * DeleteEventCallbackCommand
Definition: vtkInteractorEventRecorder.h:111
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:78
vtkInteractorEventRecorder::OutputStream
ostream * OutputStream
Definition: vtkInteractorEventRecorder.h:119
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:50
vtkInteractorEventRecorder::ReadFromInputString
vtkTypeBool ReadFromInputString
Definition: vtkInteractorEventRecorder.h:114
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69