54 #ifndef vtkRenderWindowInteractor_h
55 #define vtkRenderWindowInteractor_h
59 #include "vtkRenderingCoreModule.h"
65 #define VTKI_TIMER_FIRST 0
66 #define VTKI_TIMER_UPDATE 1
70 #define VTKI_MAX_POINTERS 5
101 virtual void Initialize();
104 this->Initialized = 0;
121 virtual void Start();
133 vtkGetMacro(Done,
bool);
134 vtkSetMacro(Done,
bool);
162 vtkBooleanMacro(EnableRender,
bool);
163 vtkSetMacro(EnableRender,
bool);
164 vtkGetMacro(EnableRender,
bool);
192 virtual void UpdateSize(
int x,
int y);
210 virtual int CreateTimer(
int timerType);
211 virtual int DestroyTimer();
217 int CreateRepeatingTimer(
unsigned long duration);
223 int CreateOneShotTimer(
unsigned long duration);
229 int IsOneShotTimer(
int timerId);
234 unsigned long GetTimerDuration(
int timerId);
239 int ResetTimer(
int timerId);
245 int DestroyTimer(
int timerId);
250 virtual int GetVTKTimerId(
int platformTimerId);
270 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
271 vtkGetMacro(TimerDuration,
unsigned long);
287 vtkSetMacro(TimerEventId,
int);
288 vtkGetMacro(TimerEventId,
int);
289 vtkSetMacro(TimerEventType,
int);
290 vtkGetMacro(TimerEventType,
int);
291 vtkSetMacro(TimerEventDuration,
int);
292 vtkGetMacro(TimerEventDuration,
int);
293 vtkSetMacro(TimerEventPlatformId,
int);
294 vtkGetMacro(TimerEventPlatformId,
int);
331 vtkSetClampMacro(DesiredUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
332 vtkGetMacro(DesiredUpdateRate,
double);
341 vtkSetClampMacro(StillUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
342 vtkGetMacro(StillUpdateRate,
double);
350 vtkGetMacro(Initialized,
int);
385 virtual void ExitCallback();
386 virtual void UserCallback();
387 virtual void StartPickCallback();
388 virtual void EndPickCallback();
413 virtual void Render();
421 void FlyTo(
vtkRenderer* ren,
double x,
double y,
double z);
423 void FlyToImage(
vtkRenderer* ren,
double x,
double y);
431 vtkSetClampMacro(NumberOfFlyFrames,
int, 1,
VTK_INT_MAX);
432 vtkGetMacro(NumberOfFlyFrames,
int);
440 vtkSetMacro(Dolly,
double);
441 vtkGetMacro(Dolly,
double);
453 vtkGetVector2Macro(EventPosition,
int);
454 vtkGetVector2Macro(LastEventPosition,
int);
455 vtkSetVector2Macro(LastEventPosition,
int);
458 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
460 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
461 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
463 this->LastEventPosition[0] = this->EventPosition[0];
464 this->LastEventPosition[1] = this->EventPosition[1];
465 this->EventPosition[0] = x;
466 this->EventPosition[1] = y;
473 this->SetEventPosition(x, this->Size[1] - y - 1);
484 return this->EventPositions[pointerIndex];
492 return this->LastEventPositions[pointerIndex];
500 if (pointerIndex == 0)
502 this->LastEventPosition[0] = this->EventPosition[0];
503 this->LastEventPosition[1] = this->EventPosition[1];
504 this->EventPosition[0] = x;
505 this->EventPosition[1] = y;
507 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
508 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
509 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
510 this->LastEventPositions[pointerIndex][0] != x ||
511 this->LastEventPositions[pointerIndex][1] != y)
513 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
514 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
515 this->EventPositions[pointerIndex][0] = x;
516 this->EventPositions[pointerIndex][1] = y;
522 this->SetEventPosition(pos[0], pos[1], pointerIndex);
526 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
530 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
561 vtkSetMacro(KeyCode,
char);
562 vtkGetMacro(KeyCode,
char);
570 vtkSetMacro(RepeatCount,
int);
571 vtkGetMacro(RepeatCount,
int);
581 vtkSetStringMacro(KeySym);
582 vtkGetStringMacro(KeySym);
589 vtkSetMacro(PointerIndex,
int);
590 vtkGetMacro(PointerIndex,
int);
598 vtkGetMacro(Rotation,
double);
599 vtkGetMacro(LastRotation,
double);
606 void SetScale(
double scale);
607 vtkGetMacro(Scale,
double);
608 vtkGetMacro(LastScale,
double);
615 void SetTranslation(
double val[2]);
616 vtkGetVector2Macro(Translation,
double);
617 vtkGetVector2Macro(LastTranslation,
double);
625 const char* keysym,
int pointerIndex)
627 this->SetEventPosition(x, y, pointerIndex);
630 this->KeyCode = keycode;
631 this->RepeatCount = repeatcount;
632 this->PointerIndex = pointerIndex;
635 this->SetKeySym(keysym);
640 int repeatcount = 0,
const char* keysym =
nullptr)
642 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
652 const char* keysym,
int pointerIndex)
654 this->SetEventInformation(
655 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
658 int repeatcount = 0,
const char* keysym =
nullptr)
660 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
669 const char* keysym =
nullptr)
673 this->KeyCode = keycode;
674 this->RepeatCount = repeatcount;
677 this->SetKeySym(keysym);
695 vtkSetVector2Macro(Size,
int);
696 vtkGetVector2Macro(Size,
int);
697 vtkSetVector2Macro(EventSize,
int);
698 vtkGetVector2Macro(EventSize,
int);
726 vtkSetMacro(UseTDx,
bool);
727 vtkGetMacro(UseTDx,
bool);
736 virtual void MouseMoveEvent();
737 virtual void RightButtonPressEvent();
738 virtual void RightButtonReleaseEvent();
739 virtual void LeftButtonPressEvent();
740 virtual void LeftButtonReleaseEvent();
741 virtual void MiddleButtonPressEvent();
742 virtual void MiddleButtonReleaseEvent();
743 virtual void MouseWheelForwardEvent();
744 virtual void MouseWheelBackwardEvent();
745 virtual void MouseWheelLeftEvent();
746 virtual void MouseWheelRightEvent();
747 virtual void ExposeEvent();
748 virtual void ConfigureEvent();
749 virtual void EnterEvent();
750 virtual void LeaveEvent();
751 virtual void KeyPressEvent();
752 virtual void KeyReleaseEvent();
753 virtual void CharEvent();
754 virtual void ExitEvent();
755 virtual void FourthButtonPressEvent();
756 virtual void FourthButtonReleaseEvent();
757 virtual void FifthButtonPressEvent();
758 virtual void FifthButtonReleaseEvent();
766 virtual void StartPinchEvent();
767 virtual void PinchEvent();
768 virtual void EndPinchEvent();
769 virtual void StartRotateEvent();
770 virtual void RotateEvent();
771 virtual void EndRotateEvent();
772 virtual void StartPanEvent();
773 virtual void PanEvent();
774 virtual void EndPanEvent();
775 virtual void TapEvent();
776 virtual void LongTapEvent();
777 virtual void SwipeEvent();
787 vtkSetMacro(RecognizeGestures,
bool);
788 vtkGetMacro(RecognizeGestures,
bool);
797 vtkGetMacro(PointersDownCount,
int);
808 void ClearContact(
size_t contactID);
809 int GetPointerIndexForContact(
size_t contactID);
810 int GetPointerIndexForExistingContact(
size_t contactID);
811 bool IsPointerIndexSet(
int i);
812 void ClearPointerIndex(
int i);
853 double Translation[2];
854 double LastTranslation[2];
857 int EventPosition[2];
858 int LastEventPosition[2];
897 friend struct vtkTimerStruct;
907 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
908 virtual int InternalDestroyTimer(
int platformTimerId);
909 int GetCurrentTimerId();
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).
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
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()
Run the event loop 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
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.