42 #ifndef vtkRenderWindowInteractor_h
43 #define vtkRenderWindowInteractor_h
48 #include "vtkRenderingCoreModule.h"
52 VTK_ABI_NAMESPACE_BEGIN
56 #define VTKI_TIMER_FIRST 0
57 #define VTKI_TIMER_UPDATE 1
61 #define VTKI_MAX_POINTERS 5
94 virtual void Initialize();
97 this->Initialized = 0;
114 virtual void Start();
127 vtkGetMacro(Done,
bool);
128 vtkSetMacro(Done,
bool);
156 vtkBooleanMacro(EnableRender,
bool);
158 vtkSetMacro(EnableRender,
bool);
160 vtkGetMacro(EnableRender,
bool);
189 virtual
void UpdateSize(
int x,
int y);
208 virtual
int CreateTimer(
int timerType);
209 virtual
int DestroyTimer();
215 int CreateRepeatingTimer(
unsigned long duration);
221 int CreateOneShotTimer(
unsigned long duration);
227 int IsOneShotTimer(
int timerId);
232 unsigned long GetTimerDuration(
int timerId);
237 int ResetTimer(
int timerId);
243 int DestroyTimer(
int timerId);
248 virtual
int GetVTKTimerId(
int platformTimerId);
268 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
269 vtkGetMacro(TimerDuration,
unsigned long);
285 vtkSetMacro(TimerEventId,
int);
286 vtkGetMacro(TimerEventId,
int);
287 vtkSetMacro(TimerEventType,
int);
288 vtkGetMacro(TimerEventType,
int);
289 vtkSetMacro(TimerEventDuration,
int);
290 vtkGetMacro(TimerEventDuration,
int);
291 vtkSetMacro(TimerEventPlatformId,
int);
292 vtkGetMacro(TimerEventPlatformId,
int);
338 vtkSetClampMacro(DesiredUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
339 vtkGetMacro(DesiredUpdateRate,
double);
348 vtkSetClampMacro(StillUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
349 vtkGetMacro(StillUpdateRate,
double);
357 vtkGetMacro(Initialized,
int);
386 vtkGetObjectMacro(PickingManager, vtkPickingManager);
394 virtual
void ExitCallback();
395 virtual
void UserCallback();
396 virtual
void StartPickCallback();
397 virtual
void EndPickCallback();
403 virtual
void GetMousePosition(
int* x,
int* y)
422 virtual void Render();
430 void FlyTo(
vtkRenderer* ren,
double x,
double y,
double z);
432 void FlyToImage(
vtkRenderer* ren,
double x,
double y);
440 vtkSetClampMacro(NumberOfFlyFrames,
int, 1,
VTK_INT_MAX);
441 vtkGetMacro(NumberOfFlyFrames,
int);
449 vtkSetMacro(Dolly,
double);
450 vtkGetMacro(Dolly,
double);
463 vtkGetVector2Macro(EventPosition,
int);
465 vtkGetVector2Macro(LastEventPosition,
int);
467 vtkSetVector2Macro(LastEventPosition,
int);
469 virtual
void SetEventPosition(
int x,
int y)
471 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
473 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
474 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
476 this->LastEventPosition[0] = this->EventPosition[0];
477 this->LastEventPosition[1] = this->EventPosition[1];
478 this->EventPosition[0] = x;
479 this->EventPosition[1] = y;
487 this->SetEventPosition(x, this->Size[1] - y - 1);
498 return this->EventPositions[pointerIndex];
506 return this->LastEventPositions[pointerIndex];
514 if (pointerIndex == 0)
516 this->LastEventPosition[0] = this->EventPosition[0];
517 this->LastEventPosition[1] = this->EventPosition[1];
518 this->EventPosition[0] = x;
519 this->EventPosition[1] = y;
521 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
522 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
523 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
524 this->LastEventPositions[pointerIndex][0] != x ||
525 this->LastEventPositions[pointerIndex][1] != y)
527 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
528 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
529 this->EventPositions[pointerIndex][0] = x;
530 this->EventPositions[pointerIndex][1] = y;
536 this->SetEventPosition(pos[0], pos[1], pointerIndex);
540 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
544 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
555 vtkSetMacro(AltKey,
int);
556 vtkGetMacro(AltKey,
int);
565 vtkSetMacro(ControlKey,
int);
566 vtkGetMacro(ControlKey,
int);
573 vtkSetMacro(ShiftKey,
int);
574 vtkGetMacro(ShiftKey,
int);
601 vtkSetMacro(KeyCode,
char);
602 vtkGetMacro(KeyCode,
char);
610 vtkSetMacro(RepeatCount,
int);
611 vtkGetMacro(RepeatCount,
int);
635 vtkSetStringMacro(KeySym);
636 vtkGetStringMacro(KeySym);
643 vtkSetMacro(PointerIndex,
int);
644 vtkGetMacro(PointerIndex,
int);
652 vtkGetMacro(Rotation,
double);
653 vtkGetMacro(LastRotation,
double);
660 void SetScale(
double scale);
661 vtkGetMacro(Scale,
double);
662 vtkGetMacro(LastScale,
double);
669 void SetTranslation(
double val[2]);
670 vtkGetVector2Macro(Translation,
double);
671 vtkGetVector2Macro(LastTranslation,
double);
679 const char* keysym,
int pointerIndex)
681 this->SetEventPosition(x, y, pointerIndex);
682 this->ControlKey = ctrl;
683 this->ShiftKey = shift;
684 this->KeyCode = keycode;
685 this->RepeatCount = repeatcount;
686 this->PointerIndex = pointerIndex;
689 this->SetKeySym(keysym);
694 int repeatcount = 0,
const char* keysym =
nullptr)
696 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
706 const char* keysym,
int pointerIndex)
708 this->SetEventInformation(
709 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
712 int repeatcount = 0,
const char* keysym =
nullptr)
714 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
723 const char* keysym =
nullptr)
725 this->ControlKey = ctrl;
726 this->ShiftKey = shift;
727 this->KeyCode = keycode;
728 this->RepeatCount = repeatcount;
731 this->SetKeySym(keysym);
749 vtkSetVector2Macro(Size,
int);
750 vtkGetVector2Macro(Size,
int);
751 vtkSetVector2Macro(EventSize,
int);
752 vtkGetVector2Macro(EventSize,
int);
780 vtkSetMacro(UseTDx,
bool);
781 vtkGetMacro(UseTDx,
bool);
790 virtual void MouseMoveEvent();
791 virtual void RightButtonPressEvent();
792 virtual void RightButtonReleaseEvent();
793 virtual void LeftButtonPressEvent();
794 virtual void LeftButtonReleaseEvent();
795 virtual void MiddleButtonPressEvent();
796 virtual void MiddleButtonReleaseEvent();
797 virtual void MouseWheelForwardEvent();
798 virtual void MouseWheelBackwardEvent();
799 virtual void MouseWheelLeftEvent();
800 virtual void MouseWheelRightEvent();
801 virtual void ExposeEvent();
802 virtual void ConfigureEvent();
803 virtual void EnterEvent();
804 virtual void LeaveEvent();
805 virtual void KeyPressEvent();
806 virtual void KeyReleaseEvent();
807 virtual void CharEvent();
808 virtual void ExitEvent();
809 virtual void FourthButtonPressEvent();
810 virtual void FourthButtonReleaseEvent();
811 virtual void FifthButtonPressEvent();
812 virtual void FifthButtonReleaseEvent();
820 virtual void StartPinchEvent();
821 virtual void PinchEvent();
822 virtual void EndPinchEvent();
823 virtual void StartRotateEvent();
824 virtual void RotateEvent();
825 virtual void EndRotateEvent();
826 virtual void StartPanEvent();
827 virtual void PanEvent();
828 virtual void EndPanEvent();
829 virtual void TapEvent();
830 virtual void LongTapEvent();
831 virtual void SwipeEvent();
841 vtkSetMacro(RecognizeGestures,
bool);
842 vtkGetMacro(RecognizeGestures,
bool);
851 vtkGetMacro(PointersDownCount,
int);
862 void ClearContact(
size_t contactID);
863 int GetPointerIndexForContact(
size_t contactID);
864 int GetPointerIndexForExistingContact(
size_t contactID);
865 bool IsPointerIndexSet(
int i);
866 void ClearPointerIndex(
int i);
888 vtkBooleanMacro(TrackInteractorObserverInstances,
bool);
889 vtkSetMacro(TrackInteractorObserverInstances,
bool);
890 vtkGetMacro(TrackInteractorObserverInstances,
bool);
962 double Translation[2];
963 double LastTranslation[2];
966 int EventPosition[2];
967 int LastEventPosition[2];
1006 friend struct vtkTimerStruct;
1016 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
1017 virtual int InternalDestroyTimer(
int platformTimerId);
1018 int GetCurrentTimerId();
1041 bool TrackInteractorObserverInstances =
false;
1053 VTK_ABI_NAMESPACE_END
create a window for renderers to draw into
virtual void SetEventPositionFlipY(int pos[2])
Set/Get information about the current event.
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 InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
abstract base class for most VTK objects
Class defines API to manage the picking process.
virtual void Enable()
Enable/Disable interactions.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned long TimerDuration
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.
virtual void SetEventPosition(int pos[2], int pointerIndex)
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
abstract specification for renderers
vtkRenderWindow * RenderWindow
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
vtkCommand::EventIds CurrentGesture
virtual int * GetLastEventPositions(int pointerIndex)
vtkTypeBool LightFollowCamera
virtual void SetEventPosition(int pos[2])
Set/Get information about the current event.
virtual int * GetEventPositions(int pointerIndex)
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
static bool InteractorManagesTheEventLoop
This flag is useful when you are integrating VTK in a larger system.
void FlyTo(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
platform-independent render window interaction including picking and frame rate control.
void InternalReleaseFocus()
These methods allow a command to exclusively grab all events.
void ReInitialize()
Prepare for handling events and set the Enabled flag to true.
superclass for callback/observer methods
virtual void UnRegister(vtkObjectBase *o)
Decrease the reference count (release by another object).
a list of nodes that form an assembly path
vtkObserverMediator * ObserverMediator
Widget mediators are used to resolve contention for cursors and other resources.
a simple class to control print indentation
const char * GetClassName() const
Return the class name as a string.
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
vtkHardwareWindow * HardwareWindow
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 Modified()
Update the modification time for this object.
record and play VTK events passing through a vtkRenderWindowInteractor
virtual void SetEventPosition(int x, int y, int pointerIndex)
vtkSmartPointer< vtkInteractorObserver > InteractorStyle
abstract base class for most VTK objects
virtual void ProcessEvents()
Process all user-interaction, timer events and return.
#define VTK_MARSHALEXCLUDE(reason)
virtual void SetEventPositionFlipY(int x, int y, int pointerIndex)
abstract API for pickers that can pick an instance of vtkProp
create a window for renderers to draw into
create and manipulate ordered lists of objects
#define VTKI_MAX_POINTERS
vtkAbstractPicker * Picker
virtual void TerminateApp()
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
define API for picking subclasses
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkPickingManager * PickingManager
void FlyToImage(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
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 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.
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
virtual void SetEventPositionFlipY(int x, int y)
Set/Get information about the current event.