VTK  9.2.6
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=========================================================================*/
44#ifndef vtkInteractorEventRecorder_h
45#define vtkInteractorEventRecorder_h
46
47#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
49#include "vtkRenderingCoreModule.h" // For export macro
50
51class vtkStringArray;
52
53// The superclass that all commands should be subclasses of
54class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
55{
56public:
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
61 // enumeration of data type
62 enum class vtkEventDataType : int
63 {
64 None = 0,
65 StringArray
66 };
67
68 // Satisfy the superclass API. Enable/disable listening for events.
69 void SetEnabled(int) override;
71
73
80
86 void Record();
87
93 void Play();
94
98 void Stop();
99
104 void Clear();
105
109 void Rewind();
110
112
116 vtkSetMacro(ReadFromInputString, vtkTypeBool);
117 vtkGetMacro(ReadFromInputString, vtkTypeBool);
118 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
120
122
125 vtkSetStringMacro(InputString);
126 vtkGetStringMacro(InputString);
128
129protected:
132
133 // file to read/write from
134 char* FileName;
135
136 // listens to delete events
138
139 // control whether to read from string
142
143 // for reading and writing
144 istream* InputStream;
145 ostream* OutputStream;
146
147 // methods for processing events
148 static void ProcessCharEvent(
149 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
151 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
152 static void ProcessEvents(
153 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
154
155 virtual void WriteEvent(const char* event, int pos[2], int modifiers, int keyCode,
156 int repeatCount, char* keySym, void* callData = nullptr);
157
159 "This method was not used at all and has been replaced by ReadEvent(const std::string&)")
160 virtual void ReadEvent(){};
161
165 virtual void ReadEvent(const std::string& line);
166
167 // Manage the state of the recorder
168 int State;
170 {
171 Start = 0,
173 Recording
174 };
175
176 // Associate a modifier with a bit
178 {
179 ShiftKey = 1,
180 ControlKey = 2,
181 AltKey = 4
182 };
183
184 static float StreamVersion;
186
187private:
189 void operator=(const vtkInteractorEventRecorder&) = delete;
190};
191
192#endif /* vtkInteractorEventRecorder_h */
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:34
record and play VTK events passing through a vtkRenderWindowInteractor
virtual void ReadEvent(const std::string &line)
A method that parse a event line and invoke the corresponding event.
void Record()
Invoke this method to begin recording events.
vtkGetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
static void ProcessCharEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void SetEnabled(int) override
Methods for turning the interactor observer on and off, and determining its state.
void Rewind()
Rewind the play stream to the beginning of the file.
void Play()
Invoke this method to begin playing events from the current position.
void SetInteractor(vtkRenderWindowInteractor *iren) override
This method is used to associate the widget with the render window interactor.
virtual void WriteEvent(const char *event, int pos[2], int modifiers, int keyCode, int repeatCount, char *keySym, void *callData=nullptr)
~vtkInteractorEventRecorder() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Stop()
Invoke this method to stop recording/playing events.
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkSetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
static void ProcessDeleteEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void Clear()
Invoke this method to clear recording/playing stream and be able to open another file using the same ...
vtkCallbackCommand * DeleteEventCallbackCommand
static vtkInteractorEventRecorder * New()
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
Definition vtkObject.h:57
platform-independent render window interaction including picking and frame rate control.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)