42#ifndef vtkRenderWindowInteractor_h
43#define vtkRenderWindowInteractor_h
47#include "vtkRenderingCoreModule.h"
51VTK_ABI_NAMESPACE_BEGIN
55#define VTKI_TIMER_FIRST 0
56#define VTKI_TIMER_UPDATE 1
60#define VTKI_MAX_POINTERS 5
94 this->Initialized = 0;
124 vtkGetMacro(Done,
bool);
125 vtkSetMacro(Done,
bool);
146 vtkGetMacro(Enabled,
int);
153 vtkBooleanMacro(EnableRender,
bool);
155 vtkSetMacro(EnableRender,
bool);
157 vtkGetMacro(EnableRender,
bool);
185 virtual
void UpdateSize(
int x,
int y);
204 virtual
int CreateTimer(
int timerType);
205 virtual
int DestroyTimer();
211 int CreateRepeatingTimer(
unsigned long duration);
217 int CreateOneShotTimer(
unsigned long duration);
223 int IsOneShotTimer(
int timerId);
228 unsigned long GetTimerDuration(
int timerId);
233 int ResetTimer(
int timerId);
239 int DestroyTimer(
int timerId);
244 virtual
int GetVTKTimerId(
int platformTimerId);
264 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
265 vtkGetMacro(TimerDuration,
unsigned long);
281 vtkSetMacro(TimerEventId,
int);
282 vtkGetMacro(TimerEventId,
int);
283 vtkSetMacro(TimerEventType,
int);
284 vtkGetMacro(TimerEventType,
int);
285 vtkSetMacro(TimerEventDuration,
int);
286 vtkGetMacro(TimerEventDuration,
int);
287 vtkSetMacro(TimerEventPlatformId,
int);
288 vtkGetMacro(TimerEventPlatformId,
int);
326 vtkGetMacro(DesiredUpdateRate,
double);
336 vtkGetMacro(StillUpdateRate,
double);
344 vtkGetMacro(Initialized,
int);
383 virtual
void ExitCallback();
384 virtual
void UserCallback();
385 virtual
void StartPickCallback();
386 virtual
void EndPickCallback();
392 virtual
void GetMousePosition(
int* x,
int* y)
430 vtkGetMacro(NumberOfFlyFrames,
int);
438 vtkSetMacro(Dolly,
double);
439 vtkGetMacro(Dolly,
double);
451 vtkGetVector2Macro(EventPosition,
int);
452 vtkGetVector2Macro(LastEventPosition,
int);
453 vtkSetVector2Macro(LastEventPosition,
int);
456 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
458 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
459 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
461 this->LastEventPosition[0] = this->EventPosition[0];
462 this->LastEventPosition[1] = this->EventPosition[1];
463 this->EventPosition[0] = x;
464 this->EventPosition[1] = y;
471 this->SetEventPosition(x, this->Size[1] - y - 1);
482 return this->EventPositions[pointerIndex];
490 return this->LastEventPositions[pointerIndex];
498 if (pointerIndex == 0)
500 this->LastEventPosition[0] = this->EventPosition[0];
501 this->LastEventPosition[1] = this->EventPosition[1];
502 this->EventPosition[0] = x;
503 this->EventPosition[1] = y;
505 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
506 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
507 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
508 this->LastEventPositions[pointerIndex][0] != x ||
509 this->LastEventPositions[pointerIndex][1] != y)
511 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
512 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
513 this->EventPositions[pointerIndex][0] = x;
514 this->EventPositions[pointerIndex][1] = y;
520 this->SetEventPosition(pos[0], pos[1], pointerIndex);
524 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
528 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
539 vtkSetMacro(AltKey,
int);
540 vtkGetMacro(AltKey,
int);
549 vtkSetMacro(ControlKey,
int);
550 vtkGetMacro(ControlKey,
int);
557 vtkSetMacro(ShiftKey,
int);
558 vtkGetMacro(ShiftKey,
int);
585 vtkSetMacro(KeyCode,
char);
586 vtkGetMacro(KeyCode,
char);
594 vtkSetMacro(RepeatCount,
int);
595 vtkGetMacro(RepeatCount,
int);
619 vtkSetStringMacro(KeySym);
620 vtkGetStringMacro(KeySym);
627 vtkSetMacro(PointerIndex,
int);
628 vtkGetMacro(PointerIndex,
int);
636 vtkGetMacro(Rotation,
double);
637 vtkGetMacro(LastRotation,
double);
645 vtkGetMacro(Scale,
double);
646 vtkGetMacro(LastScale,
double);
654 vtkGetVector2Macro(Translation,
double);
655 vtkGetVector2Macro(LastTranslation,
double);
663 const char* keysym,
int pointerIndex)
665 this->SetEventPosition(x, y, pointerIndex);
666 this->ControlKey = ctrl;
667 this->ShiftKey = shift;
668 this->KeyCode = keycode;
669 this->RepeatCount = repeatcount;
670 this->PointerIndex = pointerIndex;
673 this->SetKeySym(keysym);
678 int repeatcount = 0,
const char* keysym =
nullptr)
680 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
690 const char* keysym,
int pointerIndex)
692 this->SetEventInformation(
693 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
696 int repeatcount = 0,
const char* keysym =
nullptr)
698 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
707 const char* keysym =
nullptr)
709 this->ControlKey = ctrl;
710 this->ShiftKey = shift;
711 this->KeyCode = keycode;
712 this->RepeatCount = repeatcount;
715 this->SetKeySym(keysym);
733 vtkSetVector2Macro(Size,
int);
734 vtkGetVector2Macro(Size,
int);
735 vtkSetVector2Macro(EventSize,
int);
736 vtkGetVector2Macro(EventSize,
int);
764 vtkSetMacro(UseTDx,
bool);
765 vtkGetMacro(UseTDx,
bool);
825 vtkSetMacro(RecognizeGestures,
bool);
826 vtkGetMacro(RecognizeGestures,
bool);
835 vtkGetMacro(PointersDownCount,
int);
922 double Translation[2];
923 double LastTranslation[2];
926 int EventPosition[2];
927 int LastEventPosition[2];
956 this->Superclass::InternalGrabFocus(mouseEvents, keypressEvents);
966 friend struct vtkTimerStruct;
1007VTK_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
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.
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 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 int * GetLastEventPositions(int pointerIndex)
virtual void Enable()
Enable/Disable interactions.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
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 vtkRenderer * FindPokedRenderer(int, int)
When an event occurs, we must determine which Renderer the event occurred within, since one RenderWin...
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 TerminateApp()
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
virtual void LeftButtonReleaseEvent()
Fire various events.
virtual void CharEvent()
Fire various events.
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual vtkPickingManager * CreateDefaultPickingManager()
Create default pickingManager.
virtual void LeaveEvent()
Fire various events.
static bool InteractorManagesTheEventLoop
This flag is useful when you are integrating VTK in a larger system.
virtual vtkInteractorObserver * GetInteractorStyle()
External switching between joystick/trackball/new? modes.
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.
~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 void ConfigureEvent()
Fire various events.
virtual void FifthButtonPressEvent()
Fire various events.
virtual int * GetEventPositions(int pointerIndex)
virtual void StartPanEvent()
Fire various gesture based events.
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.
void ReInitialize()
Prepare for handling events and set the Enabled flag to true.
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.
vtkSmartPointer< vtkInteractorObserver > InteractorStyle
void SetTranslation(double val[2])
Set/get the translation for pan/swipe gestures, update LastTranslation.
virtual void SetCurrentGesture(vtkCommand::EventIds eid)
Get the current gesture that was recognized when handling multitouch and VR events.
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()
Process all user-interaction, timer events 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 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...
static vtkRenderWindowInteractor * New()
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 vtkCommand::EventIds GetCurrentGesture() const
Get the current gesture that was recognized when handling multitouch and VR events.
virtual void MiddleButtonPressEvent()
Fire various events.
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.
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)
vtkRenderWindow * RenderWindow
vtkRenderWindowInteractor()
virtual void KeyPressEvent()
Fire various events.
create a window for renderers to draw into
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
#define VTKI_MAX_POINTERS
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALEXCLUDE(reason)