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 =========================================================================*/
47 #ifndef vtkInteractorEventRecorder_h
48 #define vtkInteractorEventRecorder_h
49 
50 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
51 #include "vtkInteractorObserver.h"
52 #include "vtkRenderingCoreModule.h" // For export macro
53 
54 class vtkStringArray;
55 
56 // The superclass that all commands should be subclasses of
57 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
58 {
59 public:
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
64  // enumeration of data type
65  enum class vtkEventDataType : int
66  {
67  None = 0,
68  StringArray
69  };
70 
71  // Satisfy the superclass API. Enable/disable listening for events.
72  void SetEnabled(int) override;
73  void SetInteractor(vtkRenderWindowInteractor* iren) override;
74 
76 
80  vtkSetFilePathMacro(FileName);
81  vtkGetFilePathMacro(FileName);
83 
89  void Record();
90 
96  void Play();
97 
101  void Stop();
102 
107  void Clear();
108 
112  void Rewind();
113 
115 
119  vtkSetMacro(ReadFromInputString, vtkTypeBool);
120  vtkGetMacro(ReadFromInputString, vtkTypeBool);
121  vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
123 
125 
128  vtkSetStringMacro(InputString);
129  vtkGetStringMacro(InputString);
131 
132 protected:
134  ~vtkInteractorEventRecorder() override;
135 
136  // file to read/write from
137  char* FileName;
138 
139  // listens to delete events
141 
142  // control whether to read from string
144  char* InputString;
145 
146  // for reading and writing
147  istream* InputStream;
148  ostream* OutputStream;
149 
150  // methods for processing events
151  static void ProcessCharEvent(
152  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
153  static void ProcessDeleteEvent(
154  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
155  static void ProcessEvents(
156  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
157 
158  virtual void WriteEvent(const char* event, int pos[2], int modifiers, int keyCode,
159  int repeatCount, char* keySym, void* callData = nullptr);
160 
162  "This method was not used at all and has been replaced by ReadEvent(const std::string&)")
163  virtual void ReadEvent(){};
164 
168  virtual void ReadEvent(const std::string& line);
169 
170  // Manage the state of the recorder
171  int State;
173  {
174  Start = 0,
176  Recording
177  };
178 
179  // Associate a modifier with a bit
181  {
182  ShiftKey = 1,
183  ControlKey = 2,
184  AltKey = 4
185  };
186 
187  static float StreamVersion;
189 
190 private:
192  void operator=(const vtkInteractorEventRecorder&) = delete;
193 };
194 
195 #endif /* vtkInteractorEventRecorder_h */
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
This method is used to associate the widget with the render window interactor.
abstract base class for most VTK objects
Definition: vtkObject.h:62
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Handles the char widget activation event.
#define VTK_DEPRECATED_IN_9_2_0(reason)
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
a vtkAbstractArray subclass for strings
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
int vtkTypeBool
Definition: vtkABI.h:69
platform-independent render window interaction including picking and frame rate control.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCallbackCommand * DeleteEventCallbackCommand
record and play VTK events passing through a vtkRenderWindowInteractor
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...