163 #ifndef vtkRenderWindowInteractor_h
164 #define vtkRenderWindowInteractor_h
168 #include "vtkRenderingCoreModule.h"
171 VTK_ABI_NAMESPACE_BEGIN
175 #define VTKI_TIMER_FIRST 0
176 #define VTKI_TIMER_UPDATE 1
180 #define VTKI_MAX_POINTERS 5
214 this->Initialized = 0;
243 vtkGetMacro(Done,
bool);
244 vtkSetMacro(Done,
bool);
272 vtkBooleanMacro(EnableRender,
bool);
273 vtkSetMacro(EnableRender,
bool);
274 vtkGetMacro(EnableRender,
bool);
380 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
381 vtkGetMacro(TimerDuration,
unsigned long);
397 vtkSetMacro(TimerEventId,
int);
398 vtkGetMacro(TimerEventId,
int);
399 vtkSetMacro(TimerEventType,
int);
400 vtkGetMacro(TimerEventType,
int);
401 vtkSetMacro(TimerEventDuration,
int);
402 vtkGetMacro(TimerEventDuration,
int);
403 vtkSetMacro(TimerEventPlatformId,
int);
404 vtkGetMacro(TimerEventPlatformId,
int);
442 vtkGetMacro(DesiredUpdateRate,
double);
452 vtkGetMacro(StillUpdateRate,
double);
460 vtkGetMacro(Initialized,
int);
542 vtkGetMacro(NumberOfFlyFrames,
int);
550 vtkSetMacro(Dolly,
double);
551 vtkGetMacro(Dolly,
double);
563 vtkGetVector2Macro(EventPosition,
int);
564 vtkGetVector2Macro(LastEventPosition,
int);
565 vtkSetVector2Macro(LastEventPosition,
int);
568 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
570 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
571 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
573 this->LastEventPosition[0] = this->EventPosition[0];
574 this->LastEventPosition[1] = this->EventPosition[1];
575 this->EventPosition[0] = x;
576 this->EventPosition[1] = y;
583 this->SetEventPosition(x, this->Size[1] - y - 1);
594 return this->EventPositions[pointerIndex];
602 return this->LastEventPositions[pointerIndex];
610 if (pointerIndex == 0)
612 this->LastEventPosition[0] = this->EventPosition[0];
613 this->LastEventPosition[1] = this->EventPosition[1];
614 this->EventPosition[0] = x;
615 this->EventPosition[1] = y;
617 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
618 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
619 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
620 this->LastEventPositions[pointerIndex][0] != x ||
621 this->LastEventPositions[pointerIndex][1] != y)
623 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
624 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
625 this->EventPositions[pointerIndex][0] = x;
626 this->EventPositions[pointerIndex][1] = y;
632 this->SetEventPosition(pos[0], pos[1], pointerIndex);
636 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
640 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
671 vtkSetMacro(KeyCode,
char);
672 vtkGetMacro(KeyCode,
char);
680 vtkSetMacro(RepeatCount,
int);
681 vtkGetMacro(RepeatCount,
int);
691 vtkSetStringMacro(KeySym);
692 vtkGetStringMacro(KeySym);
699 vtkSetMacro(PointerIndex,
int);
700 vtkGetMacro(PointerIndex,
int);
708 vtkGetMacro(Rotation,
double);
709 vtkGetMacro(LastRotation,
double);
717 vtkGetMacro(Scale,
double);
718 vtkGetMacro(LastScale,
double);
726 vtkGetVector2Macro(Translation,
double);
727 vtkGetVector2Macro(LastTranslation,
double);
735 const char* keysym,
int pointerIndex)
737 this->SetEventPosition(x, y, pointerIndex);
740 this->KeyCode = keycode;
741 this->RepeatCount = repeatcount;
742 this->PointerIndex = pointerIndex;
745 this->SetKeySym(keysym);
750 int repeatcount = 0,
const char* keysym =
nullptr)
752 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
762 const char* keysym,
int pointerIndex)
764 this->SetEventInformation(
765 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
768 int repeatcount = 0,
const char* keysym =
nullptr)
770 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
779 const char* keysym =
nullptr)
783 this->KeyCode = keycode;
784 this->RepeatCount = repeatcount;
787 this->SetKeySym(keysym);
805 vtkSetVector2Macro(Size,
int);
806 vtkGetVector2Macro(Size,
int);
807 vtkSetVector2Macro(EventSize,
int);
808 vtkGetVector2Macro(EventSize,
int);
836 vtkSetMacro(UseTDx,
bool);
837 vtkGetMacro(UseTDx,
bool);
897 vtkSetMacro(RecognizeGestures,
bool);
898 vtkGetMacro(RecognizeGestures,
bool);
907 vtkGetMacro(PointersDownCount,
int);
963 double Translation[2];
964 double LastTranslation[2];
967 int EventPosition[2];
968 int LastEventPosition[2];
1007 friend struct vtkTimerStruct;
1048 VTK_ABI_NAMESPACE_END
define API for picking subclasses
abstract API for pickers that can pick an instance of vtkProp
a list of nodes that form an assembly path
superclass for callback/observer methods
create a window for renderers to draw into
a simple class to control print indentation
record and play VTK events passing through a vtkRenderWindowInteractor
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
const char * GetClassName() const
Return the class name as a string.
abstract base class for most VTK objects
void InternalReleaseFocus()
These methods allow a command to exclusively grab all events.
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
virtual void Modified()
Update the modification time for this object.
Class defines API to manage the picking process.
platform-independent render window interaction including picking and frame rate control.
unsigned long GetTimerDuration(int timerId)
Get the duration (in milliseconds) for the specified timerId.
void HideCursor()
Hide or show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void FourthButtonReleaseEvent()
Fire various events.
virtual void PinchEvent()
Fire various gesture based events.
virtual void SwipeEvent()
Fire various gesture based events.
vtkHardwareWindow * HardwareWindow
virtual void StartRotateEvent()
Fire various gesture based events.
void SetRenderWindow(vtkRenderWindow *aren)
Set/Get the rendering window being controlled by this object.
void SetKeyEventInformation(int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=nullptr)
Set all the keyboard-related event information in one call.
void UnRegister(vtkObjectBase *o) override
This Method detects loops of RenderWindow-Interactor, so objects are freed properly.
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
virtual void EndPinchEvent()
Fire various gesture based events.
virtual void KeyReleaseEvent()
Fire various events.
virtual void EndPickCallback()
These methods correspond to the Exit, User and Pick callbacks.
virtual void Enable()
Enable/Disable interactions.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
int CreateRepeatingTimer(unsigned long duration)
Create a repeating timer, with the specified duration (in milliseconds).
virtual vtkAbstractPropPicker * CreateDefaultPicker()
Create default picker.
vtkObserverMediator * ObserverMediator
Widget mediators are used to resolve contention for cursors and other resources.
virtual void EndRotateEvent()
Fire various gesture based events.
virtual void ExitEvent()
Fire various events.
void FlyToImage(vtkRenderer *ren, double x, double y)
Given a position x, move the current camera's focal point to x.
void SetRotation(double rotation)
Set/get the rotation for the gesture in degrees, update LastRotation.
virtual void ExposeEvent()
Fire various events.
virtual void EndPanEvent()
Fire various gesture based events.
virtual void Render()
Render the scene.
virtual void MouseWheelLeftEvent()
Fire various events.
virtual void MouseWheelForwardEvent()
Fire various events.
virtual void SetEventPosition(int x, int y)
Set/Get information about the current event.
virtual void UserCallback()
These methods correspond to the Exit, User and Pick callbacks.
void SetHardwareWindow(vtkHardwareWindow *aren)
Set/Get the hardware window being controlled by this object.
virtual void LeftButtonReleaseEvent()
Fire various events.
virtual void CharEvent()
Fire various events.
virtual int DestroyTimer()
int IsOneShotTimer(int timerId)
Query whether the specified timerId is a one shot timer.
void SetEventInformation(int x, int y, int ctrl, int shift, char keycode, int repeatcount, const char *keysym, int pointerIndex)
Set all the event information in one call.
vtkObserverMediator * GetObserverMediator()
Return the object used to mediate between vtkInteractorObservers contending for resources.
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void UpdateSize(int x, int y)
Event loop notification member for window size change.
virtual int * GetEventPositions(int pointerIndex)
virtual vtkInteractorObserver * GetInteractorStyle()
External switching between joystick/trackball/new? modes.
virtual void LeaveEvent()
Fire various events.
virtual void FourthButtonPressEvent()
Fire various events.
virtual void MouseWheelRightEvent()
Fire various events.
virtual void EnterEvent()
Fire various events.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
static vtkRenderWindowInteractor * New()
~vtkRenderWindowInteractor() override
virtual void RightButtonPressEvent()
Fire various events.
virtual void Start()
Start the event loop.
void SetEventInformation(int x, int y, int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=nullptr)
Set all the event information in one call.
void ShowCursor()
Hide or show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual vtkPickingManager * CreateDefaultPickingManager()
Create default pickingManager.
virtual void ConfigureEvent()
Fire various events.
virtual void FifthButtonPressEvent()
Fire various events.
virtual vtkRenderer * FindPokedRenderer(int, int)
When an event occurs, we must determine which Renderer the event occurred within, since one RenderWin...
virtual void StartPanEvent()
Fire various gesture based events.
virtual int CreateTimer(int timerType)
This class provides two groups of methods for manipulating timers.
int ResetTimer(int timerId)
Reset the specified timer.
int GetCurrentTimerId()
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual void MouseWheelBackwardEvent()
Fire various events.
virtual void SetInteractorStyle(vtkInteractorObserver *)
External switching between joystick/trackball/new? modes.
void ClearContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
void FlyTo(vtkRenderer *ren, double x, double y, double z)
Given a position x, move the current camera's focal point to x.
int CreateOneShotTimer(unsigned long duration)
Create a one shot timer, with the specified duration (in milliseconds).
void ReInitialize()
Prepare for handling events and set the Enabled flag to true.
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
vtkPickingManager * PickingManager
void SetEventInformationFlipY(int x, int y, int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=nullptr)
Calls SetEventInformation, but flips the Y based on the current Size[1] value (i.e.
int DestroyTimer(int timerId)
Destroy the timer specified by timerId.
vtkSmartPointer< vtkInteractorObserver > InteractorStyle
void SetTranslation(double val[2])
Set/get the translation for pan/swipe gestures, update LastTranslation.
void FlyToImage(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
virtual void PanEvent()
Fire various gesture based events.
virtual void ProcessEvents()
Run the event loop and return.
unsigned long TimerDuration
virtual void RightButtonReleaseEvent()
Fire various events.
vtkCommand::EventIds CurrentGesture
virtual void SetEventPositionFlipY(int x, int y, int pointerIndex)
void SetEventInformationFlipY(int x, int y, int ctrl, int shift, char keycode, int repeatcount, const char *keysym, int pointerIndex)
Calls SetEventInformation, but flips the Y based on the current Size[1] value (i.e.
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
virtual void SetEventPositionFlipY(int x, int y)
Set/Get information about the current event.
int GetPointerIndexForContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
virtual void FifthButtonReleaseEvent()
Fire various events.
bool IsPointerIndexSet(int i)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
virtual void LeftButtonPressEvent()
Fire various events.
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
virtual void MiddleButtonPressEvent()
Fire various events.
virtual int * GetLastEventPositions(int pointerIndex)
virtual void StartPickCallback()
These methods correspond to the Exit, User and Pick callbacks.
int GetPointerIndexForExistingContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
virtual void MouseMoveEvent()
Fire various events.
void FlyTo(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
vtkAbstractPicker * Picker
virtual void StartPinchEvent()
Fire various gesture based events.
virtual void SetEventPosition(int pos[2])
Set/Get information about the current event.
virtual void SetPicker(vtkAbstractPicker *)
Set/Get the object used to perform pick operations.
virtual int GetVTKTimerId(int platformTimerId)
Get the VTK timer ID that corresponds to the supplied platform ID.
void SetScale(double scale)
Set/get the scale for the gesture, updates LastScale.
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
virtual void RotateEvent()
Fire various gesture based events.
virtual void TapEvent()
Fire various gesture based events.
virtual void SetEventPositionFlipY(int pos[2])
Set/Get information about the current event.
vtkTypeBool LightFollowCamera
virtual void SetEventPosition(int x, int y, int pointerIndex)
void ClearPointerIndex(int i)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
virtual void LongTapEvent()
Fire various gesture based events.
virtual void MiddleButtonReleaseEvent()
Fire various events.
virtual void RecognizeGesture(vtkCommand::EventIds)
virtual void SetEventPosition(int pos[2], int pointerIndex)
virtual void SetPickingManager(vtkPickingManager *)
Set the picking manager.
vtkRenderWindow * RenderWindow
vtkRenderWindowInteractor()
virtual void KeyPressEvent()
Fire various events.
create a window for renderers to draw into
abstract specification for renderers
#define VTKI_MAX_POINTERS