VTK  9.5.2
vtkInteractorEventRecorder.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
31
32#ifndef vtkInteractorEventRecorder_h
33#define vtkInteractorEventRecorder_h
34
36#include "vtkRenderingCoreModule.h" // For export macro
37
38#include "vtkNew.h" // vtkNew
39
40VTK_ABI_NAMESPACE_BEGIN
41
42class vtkActor2D;
43class vtkStringArray;
44
45// The superclass that all commands should be subclasses of
46class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
47{
48public:
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
53 // enumeration of data type
54 enum class vtkEventDataType : int
55 {
56 None = 0,
57 StringArray
58 };
59
60 // Satisfy the superclass API. Enable/disable listening for events.
61 void SetEnabled(int) override;
63
65
72
78 void Record();
79
85 void Play();
86
90 void Stop();
91
96 void Clear();
97
101 void Rewind();
102
104
112
114
117 vtkSetStringMacro(InputString);
118 vtkGetStringMacro(InputString);
120
122
129 vtkSetMacro(ShowCursor, bool);
130 vtkGetMacro(ShowCursor, bool);
131 vtkBooleanMacro(ShowCursor, bool);
133
134protected:
137
138 // file to read/write from
139 char* FileName;
140
141 // listens to delete events
143
144 // control whether to read from string
147
148 // for reading and writing
149 istream* InputStream;
150 ostream* OutputStream;
151
152 // methods for processing events
153 static void ProcessCharEvent(
154 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
156 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
157 static void ProcessEvents(
158 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
159
160 virtual void WriteEvent(const char* event, int pos[2], int modifiers, int keyCode,
161 int repeatCount, char* keySym, void* callData = nullptr);
162
166 virtual void ReadEvent(const std::string& line);
167
168 // Manage the state of the recorder
169 int State;
176
177 // Associate a modifier with a bit
179 {
183 };
184
185 static float StreamVersion;
187
188private:
190 void operator=(const vtkInteractorEventRecorder&) = delete;
191
192 bool ShowCursor = false;
193 vtkNew<vtkActor2D> CursorActor;
194};
195
196VTK_ABI_NAMESPACE_END
197#endif /* vtkInteractorEventRecorder_h */
a actor that draws 2D data
Definition vtkActor2D.h:36
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:29
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()
Allocate and hold a VTK object.
Definition vtkNew.h:58
platform-independent render window interaction including picking and frame rate control.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
@ None
!< For HCURL