VTK
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 =========================================================================*/
34 #ifndef vtkInteractorEventRecorder_h
35 #define vtkInteractorEventRecorder_h
36 
37 #include "vtkRenderingCoreModule.h" // For export macro
38 #include "vtkInteractorObserver.h"
39 
40 // The superclass that all commands should be subclasses of
41 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
48  // Satisfy the superclass API. Enable/disable listening for events.
49  void SetEnabled(int) override;
50  void SetInteractor(vtkRenderWindowInteractor* iren) override;
51 
53 
56  vtkSetStringMacro(FileName);
57  vtkGetStringMacro(FileName);
59 
64  void Record();
65 
70  void Play();
71 
75  void Stop();
76 
80  void Rewind();
81 
83 
87  vtkSetMacro(ReadFromInputString,vtkTypeBool);
88  vtkGetMacro(ReadFromInputString,vtkTypeBool);
89  vtkBooleanMacro(ReadFromInputString,vtkTypeBool);
91 
93 
96  vtkSetStringMacro(InputString);
97  vtkGetStringMacro(InputString);
99 
100 protected:
102  ~vtkInteractorEventRecorder() override;
103 
104  // file to read/write from
105  char *FileName;
106 
107  //listens to delete events
109 
110  // control whether to read from string
112  char *InputString;
113 
114  // for reading and writing
115  istream *InputStream;
116  ostream *OutputStream;
117 
118  //methods for processing events
119  static void ProcessCharEvent(vtkObject* object, unsigned long event,
120  void* clientdata, void* calldata);
121  static void ProcessDeleteEvent(vtkObject* object, unsigned long event,
122  void* clientdata, void* calldata);
123  static void ProcessEvents(vtkObject* object, unsigned long event,
124  void* clientdata, void* calldata);
125 
126  virtual void WriteEvent(const char* event, int pos[2], int ctrlKey,
127  int shiftKey, int keyCode, int repeatCount,
128  char* keySym);
129 
130  virtual void ReadEvent();
131 
132  // Manage the state of the recorder
133  int State;
135  {
136  Start=0,
138  Recording
139  };
140 
141  static float StreamVersion;
142 
143 private:
145  void operator=(const vtkInteractorEventRecorder&) = delete;
146 
147 };
148 
149 #endif /* vtkInteractorEventRecorder_h */
150 
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:53
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Handles the char widget activation event.
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
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:33
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...