42 #ifndef vtkRenderWindowInteractor_h
43 #define vtkRenderWindowInteractor_h
47 #include "vtkRenderingCoreModule.h"
50 VTK_ABI_NAMESPACE_BEGIN
54 #define VTKI_TIMER_FIRST 0
55 #define VTKI_TIMER_UPDATE 1
59 #define VTKI_MAX_POINTERS 5
90 virtual void Initialize();
93 this->Initialized = 0;
110 virtual void Start();
123 vtkGetMacro(Done,
bool);
124 vtkSetMacro(Done,
bool);
152 vtkBooleanMacro(EnableRender,
bool);
153 vtkSetMacro(EnableRender,
bool);
154 vtkGetMacro(EnableRender,
bool);
182 virtual void UpdateSize(
int x,
int y);
200 virtual int CreateTimer(
int timerType);
201 virtual int DestroyTimer();
207 int CreateRepeatingTimer(
unsigned long duration);
213 int CreateOneShotTimer(
unsigned long duration);
219 int IsOneShotTimer(
int timerId);
224 unsigned long GetTimerDuration(
int timerId);
229 int ResetTimer(
int timerId);
235 int DestroyTimer(
int timerId);
240 virtual int GetVTKTimerId(
int platformTimerId);
260 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
261 vtkGetMacro(TimerDuration,
unsigned long);
277 vtkSetMacro(TimerEventId,
int);
278 vtkGetMacro(TimerEventId,
int);
279 vtkSetMacro(TimerEventType,
int);
280 vtkGetMacro(TimerEventType,
int);
281 vtkSetMacro(TimerEventDuration,
int);
282 vtkGetMacro(TimerEventDuration,
int);
283 vtkSetMacro(TimerEventPlatformId,
int);
284 vtkGetMacro(TimerEventPlatformId,
int);
321 vtkSetClampMacro(DesiredUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
322 vtkGetMacro(DesiredUpdateRate,
double);
331 vtkSetClampMacro(StillUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
332 vtkGetMacro(StillUpdateRate,
double);
340 vtkGetMacro(Initialized,
int);
375 virtual void ExitCallback();
376 virtual void UserCallback();
377 virtual void StartPickCallback();
378 virtual void EndPickCallback();
403 virtual void Render();
411 void FlyTo(
vtkRenderer* ren,
double x,
double y,
double z);
413 void FlyToImage(
vtkRenderer* ren,
double x,
double y);
421 vtkSetClampMacro(NumberOfFlyFrames,
int, 1,
VTK_INT_MAX);
422 vtkGetMacro(NumberOfFlyFrames,
int);
430 vtkSetMacro(Dolly,
double);
431 vtkGetMacro(Dolly,
double);
443 vtkGetVector2Macro(EventPosition,
int);
444 vtkGetVector2Macro(LastEventPosition,
int);
445 vtkSetVector2Macro(LastEventPosition,
int);
448 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
450 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
451 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
453 this->LastEventPosition[0] = this->EventPosition[0];
454 this->LastEventPosition[1] = this->EventPosition[1];
455 this->EventPosition[0] = x;
456 this->EventPosition[1] = y;
463 this->SetEventPosition(x, this->Size[1] - y - 1);
474 return this->EventPositions[pointerIndex];
482 return this->LastEventPositions[pointerIndex];
490 if (pointerIndex == 0)
492 this->LastEventPosition[0] = this->EventPosition[0];
493 this->LastEventPosition[1] = this->EventPosition[1];
494 this->EventPosition[0] = x;
495 this->EventPosition[1] = y;
497 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
498 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
499 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
500 this->LastEventPositions[pointerIndex][0] != x ||
501 this->LastEventPositions[pointerIndex][1] != y)
503 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
504 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
505 this->EventPositions[pointerIndex][0] = x;
506 this->EventPositions[pointerIndex][1] = y;
512 this->SetEventPosition(pos[0], pos[1], pointerIndex);
516 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
520 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
551 vtkSetMacro(KeyCode,
char);
552 vtkGetMacro(KeyCode,
char);
560 vtkSetMacro(RepeatCount,
int);
561 vtkGetMacro(RepeatCount,
int);
571 vtkSetStringMacro(KeySym);
572 vtkGetStringMacro(KeySym);
579 vtkSetMacro(PointerIndex,
int);
580 vtkGetMacro(PointerIndex,
int);
588 vtkGetMacro(Rotation,
double);
589 vtkGetMacro(LastRotation,
double);
596 void SetScale(
double scale);
597 vtkGetMacro(Scale,
double);
598 vtkGetMacro(LastScale,
double);
605 void SetTranslation(
double val[2]);
606 vtkGetVector2Macro(Translation,
double);
607 vtkGetVector2Macro(LastTranslation,
double);
615 const char* keysym,
int pointerIndex)
617 this->SetEventPosition(x, y, pointerIndex);
620 this->KeyCode = keycode;
621 this->RepeatCount = repeatcount;
622 this->PointerIndex = pointerIndex;
625 this->SetKeySym(keysym);
630 int repeatcount = 0,
const char* keysym =
nullptr)
632 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
642 const char* keysym,
int pointerIndex)
644 this->SetEventInformation(
645 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
648 int repeatcount = 0,
const char* keysym =
nullptr)
650 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
659 const char* keysym =
nullptr)
663 this->KeyCode = keycode;
664 this->RepeatCount = repeatcount;
667 this->SetKeySym(keysym);
685 vtkSetVector2Macro(Size,
int);
686 vtkGetVector2Macro(Size,
int);
687 vtkSetVector2Macro(EventSize,
int);
688 vtkGetVector2Macro(EventSize,
int);
716 vtkSetMacro(UseTDx,
bool);
717 vtkGetMacro(UseTDx,
bool);
726 virtual void MouseMoveEvent();
727 virtual void RightButtonPressEvent();
728 virtual void RightButtonReleaseEvent();
729 virtual void LeftButtonPressEvent();
730 virtual void LeftButtonReleaseEvent();
731 virtual void MiddleButtonPressEvent();
732 virtual void MiddleButtonReleaseEvent();
733 virtual void MouseWheelForwardEvent();
734 virtual void MouseWheelBackwardEvent();
735 virtual void MouseWheelLeftEvent();
736 virtual void MouseWheelRightEvent();
737 virtual void ExposeEvent();
738 virtual void ConfigureEvent();
739 virtual void EnterEvent();
740 virtual void LeaveEvent();
741 virtual void KeyPressEvent();
742 virtual void KeyReleaseEvent();
743 virtual void CharEvent();
744 virtual void ExitEvent();
745 virtual void FourthButtonPressEvent();
746 virtual void FourthButtonReleaseEvent();
747 virtual void FifthButtonPressEvent();
748 virtual void FifthButtonReleaseEvent();
756 virtual void StartPinchEvent();
757 virtual void PinchEvent();
758 virtual void EndPinchEvent();
759 virtual void StartRotateEvent();
760 virtual void RotateEvent();
761 virtual void EndRotateEvent();
762 virtual void StartPanEvent();
763 virtual void PanEvent();
764 virtual void EndPanEvent();
765 virtual void TapEvent();
766 virtual void LongTapEvent();
767 virtual void SwipeEvent();
777 vtkSetMacro(RecognizeGestures,
bool);
778 vtkGetMacro(RecognizeGestures,
bool);
787 vtkGetMacro(PointersDownCount,
int);
798 void ClearContact(
size_t contactID);
799 int GetPointerIndexForContact(
size_t contactID);
800 int GetPointerIndexForExistingContact(
size_t contactID);
801 bool IsPointerIndexSet(
int i);
802 void ClearPointerIndex(
int i);
843 double Translation[2];
844 double LastTranslation[2];
847 int EventPosition[2];
848 int LastEventPosition[2];
887 friend struct vtkTimerStruct;
897 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
898 virtual int InternalDestroyTimer(
int platformTimerId);
899 int GetCurrentTimerId();
928 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.
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
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 ...
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 SetEventPosition(int x, int y)
Set/Get information about the current event.
virtual void ProcessEvents()
Process all user-interaction, timer events and return.
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
#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
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.
virtual void SetEventPositionFlipY(int x, int y)
Set/Get information about the current event.