VTK  9.0.1
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 =========================================================================*/
40 #ifndef vtkInteractorEventRecorder_h
41 #define vtkInteractorEventRecorder_h
42 
43 #include "vtkInteractorObserver.h"
44 #include "vtkRenderingCoreModule.h" // For export macro
45 
46 // The superclass that all commands should be subclasses of
47 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
48 {
49 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
54  // Satisfy the superclass API. Enable/disable listening for events.
55  void SetEnabled(int) override;
56  void SetInteractor(vtkRenderWindowInteractor* iren) override;
57 
59 
62  vtkSetStringMacro(FileName);
63  vtkGetStringMacro(FileName);
65 
70  void Record();
71 
76  void Play();
77 
81  void Stop();
82 
86  void Rewind();
87 
89 
93  vtkSetMacro(ReadFromInputString, vtkTypeBool);
94  vtkGetMacro(ReadFromInputString, vtkTypeBool);
95  vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
97 
99 
102  vtkSetStringMacro(InputString);
103  vtkGetStringMacro(InputString);
105 
106 protected:
108  ~vtkInteractorEventRecorder() override;
109 
110  // file to read/write from
111  char* FileName;
112 
113  // listens to delete events
115 
116  // control whether to read from string
118  char* InputString;
119 
120  // for reading and writing
121  istream* InputStream;
122  ostream* OutputStream;
123 
124  // methods for processing events
125  static void ProcessCharEvent(
126  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
127  static void ProcessDeleteEvent(
128  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
129  static void ProcessEvents(
130  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
131 
132  virtual void WriteEvent(
133  const char* event, int pos[2], int modifiers, int keyCode, int repeatCount, char* keySym);
134 
135  virtual void ReadEvent();
136 
137  // Manage the state of the recorder
138  int State;
140  {
141  Start = 0,
143  Recording
144  };
145 
146  // Associate a modifier with a bit
148  {
149  ShiftKey = 1,
150  ControlKey = 2,
151  AltKey = 4
152  };
153 
154  static float StreamVersion;
155 
156 private:
158  void operator=(const vtkInteractorEventRecorder&) = delete;
159 };
160 
161 #endif /* vtkInteractorEventRecorder_h */
vtkInteractorEventRecorder::InputStream
istream * InputStream
Definition: vtkInteractorEventRecorder.h:121
vtkInteractorEventRecorder
record and play VTK events passing through a vtkRenderWindowInteractor
Definition: vtkInteractorEventRecorder.h:47
vtkInteractorEventRecorder::InputString
char * InputString
Definition: vtkInteractorEventRecorder.h:118
vtkInteractorEventRecorder::WidgetState
WidgetState
Definition: vtkInteractorEventRecorder.h:139
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:111
vtkInteractorEventRecorder::StreamVersion
static float StreamVersion
Definition: vtkInteractorEventRecorder.h:154
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkInteractorEventRecorder::State
int State
Definition: vtkInteractorEventRecorder.h:138
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:65
vtkInteractorEventRecorder::Playing
@ Playing
Definition: vtkInteractorEventRecorder.h:142
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:79
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkInteractorEventRecorder::ModifierKey
ModifierKey
Definition: vtkInteractorEventRecorder.h:147
vtkInteractorEventRecorder::DeleteEventCallbackCommand
vtkCallbackCommand * DeleteEventCallbackCommand
Definition: vtkInteractorEventRecorder.h:114
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:82
vtkInteractorEventRecorder::OutputStream
ostream * OutputStream
Definition: vtkInteractorEventRecorder.h:122
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:117
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69