VTK  9.1.0
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;
57 
59 
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:
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:48
vtkInteractorEventRecorder::~vtkInteractorEventRecorder
~vtkInteractorEventRecorder() override
vtkInteractorEventRecorder::ProcessDeleteEvent
static void ProcessDeleteEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkInteractorEventRecorder::InputString
char * InputString
Definition: vtkInteractorEventRecorder.h:118
vtkInteractorEventRecorder::WidgetState
WidgetState
Definition: vtkInteractorEventRecorder.h:140
vtkInteractorEventRecorder::vtkGetFilePathMacro
vtkGetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
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:82
vtkInteractorEventRecorder::State
int State
Definition: vtkInteractorEventRecorder.h:138
vtkInteractorEventRecorder::vtkInteractorEventRecorder
vtkInteractorEventRecorder()
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:85
vtkInteractorEventRecorder::SetEnabled
void SetEnabled(int) override
Methods for turning the interactor observer on and off, and determining its state.
vtkInteractorEventRecorder::WriteEvent
virtual void WriteEvent(const char *event, int pos[2], int modifiers, int keyCode, int repeatCount, char *keySym)
vtkInteractorEventRecorder::Playing
@ Playing
Definition: vtkInteractorEventRecorder.h:142
vtkInteractorEventRecorder::vtkSetFilePathMacro
vtkSetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkInteractorEventRecorder::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkInteractorEventRecorder::ModifierKey
ModifierKey
Definition: vtkInteractorEventRecorder.h:148
vtkInteractorEventRecorder::DeleteEventCallbackCommand
vtkCallbackCommand * DeleteEventCallbackCommand
Definition: vtkInteractorEventRecorder.h:114
vtkInteractorEventRecorder::Play
void Play()
Invoke this method to begin playing events from the current position.
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:192
vtkInteractorEventRecorder::ProcessCharEvent
static void ProcessCharEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkInteractorEventRecorder::OutputStream
ostream * OutputStream
Definition: vtkInteractorEventRecorder.h:122
vtkInteractorEventRecorder::Stop
void Stop()
Invoke this method to stop recording/playing events.
vtkInteractorEventRecorder::Record
void Record()
Invoke this method to begin recording events.
vtkInteractorEventRecorder::Rewind
void Rewind()
Rewind to the beginning of the file.
vtkInteractorObserver.h
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:154
vtkInteractorEventRecorder::ReadFromInputString
vtkTypeBool ReadFromInputString
Definition: vtkInteractorEventRecorder.h:117
vtkInteractorEventRecorder::SetInteractor
void SetInteractor(vtkRenderWindowInteractor *iren) override
This method is used to associate the widget with the render window interactor.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkInteractorEventRecorder::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkInteractorEventRecorder::ReadEvent
virtual void ReadEvent()
vtkInteractorEventRecorder::New
static vtkInteractorEventRecorder * New()