54 #ifndef vtkRenderWindowInteractor_h
55 #define vtkRenderWindowInteractor_h
59 #include "vtkRenderingCoreModule.h"
64 #define VTKI_TIMER_FIRST 0
65 #define VTKI_TIMER_UPDATE 1
69 #define VTKI_MAX_POINTERS 5
100 virtual void Initialize();
103 this->Initialized = 0;
120 virtual void Start();
132 vtkGetMacro(Done,
bool);
133 vtkSetMacro(Done,
bool);
161 vtkBooleanMacro(EnableRender,
bool);
162 vtkSetMacro(EnableRender,
bool);
163 vtkGetMacro(EnableRender,
bool);
191 virtual void UpdateSize(
int x,
int y);
209 virtual int CreateTimer(
int timerType);
210 virtual int DestroyTimer();
216 int CreateRepeatingTimer(
unsigned long duration);
222 int CreateOneShotTimer(
unsigned long duration);
228 int IsOneShotTimer(
int timerId);
233 unsigned long GetTimerDuration(
int timerId);
238 int ResetTimer(
int timerId);
244 int DestroyTimer(
int timerId);
249 virtual int GetVTKTimerId(
int platformTimerId);
269 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
270 vtkGetMacro(TimerDuration,
unsigned long);
286 vtkSetMacro(TimerEventId,
int);
287 vtkGetMacro(TimerEventId,
int);
288 vtkSetMacro(TimerEventType,
int);
289 vtkGetMacro(TimerEventType,
int);
290 vtkSetMacro(TimerEventDuration,
int);
291 vtkGetMacro(TimerEventDuration,
int);
292 vtkSetMacro(TimerEventPlatformId,
int);
293 vtkGetMacro(TimerEventPlatformId,
int);
330 vtkSetClampMacro(DesiredUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
331 vtkGetMacro(DesiredUpdateRate,
double);
340 vtkSetClampMacro(StillUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
341 vtkGetMacro(StillUpdateRate,
double);
349 vtkGetMacro(Initialized,
int);
384 virtual void ExitCallback();
385 virtual void UserCallback();
386 virtual void StartPickCallback();
387 virtual void EndPickCallback();
412 virtual void Render();
420 void FlyTo(
vtkRenderer* ren,
double x,
double y,
double z);
422 void FlyToImage(
vtkRenderer* ren,
double x,
double y);
430 vtkSetClampMacro(NumberOfFlyFrames,
int, 1,
VTK_INT_MAX);
431 vtkGetMacro(NumberOfFlyFrames,
int);
439 vtkSetMacro(Dolly,
double);
440 vtkGetMacro(Dolly,
double);
452 vtkGetVector2Macro(EventPosition,
int);
453 vtkGetVector2Macro(LastEventPosition,
int);
454 vtkSetVector2Macro(LastEventPosition,
int);
457 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
459 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
460 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
462 this->LastEventPosition[0] = this->EventPosition[0];
463 this->LastEventPosition[1] = this->EventPosition[1];
464 this->EventPosition[0] = x;
465 this->EventPosition[1] = y;
472 this->SetEventPosition(x, this->Size[1] - y - 1);
483 return this->EventPositions[pointerIndex];
491 return this->LastEventPositions[pointerIndex];
499 if (pointerIndex == 0)
501 this->LastEventPosition[0] = this->EventPosition[0];
502 this->LastEventPosition[1] = this->EventPosition[1];
503 this->EventPosition[0] = x;
504 this->EventPosition[1] = y;
506 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
507 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
508 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
509 this->LastEventPositions[pointerIndex][0] != x ||
510 this->LastEventPositions[pointerIndex][1] != y)
512 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
513 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
514 this->EventPositions[pointerIndex][0] = x;
515 this->EventPositions[pointerIndex][1] = y;
521 this->SetEventPosition(pos[0], pos[1], pointerIndex);
525 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
529 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
560 vtkSetMacro(KeyCode,
char);
561 vtkGetMacro(KeyCode,
char);
569 vtkSetMacro(RepeatCount,
int);
570 vtkGetMacro(RepeatCount,
int);
580 vtkSetStringMacro(KeySym);
581 vtkGetStringMacro(KeySym);
588 vtkSetMacro(PointerIndex,
int);
589 vtkGetMacro(PointerIndex,
int);
596 void SetRotation(
double val);
597 vtkGetMacro(Rotation,
double);
598 vtkGetMacro(LastRotation,
double);
605 void SetScale(
double val);
606 vtkGetMacro(Scale,
double);
607 vtkGetMacro(LastScale,
double);
614 void SetTranslation(
double val[2]);
615 vtkGetVector2Macro(Translation,
double);
616 vtkGetVector2Macro(LastTranslation,
double);
624 const char* keysym,
int pointerIndex)
626 this->SetEventPosition(x, y, pointerIndex);
629 this->KeyCode = keycode;
630 this->RepeatCount = repeatcount;
631 this->PointerIndex = pointerIndex;
634 this->SetKeySym(keysym);
639 int repeatcount = 0,
const char* keysym =
nullptr)
641 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
651 const char* keysym,
int pointerIndex)
653 this->SetEventInformation(
654 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
657 int repeatcount = 0,
const char* keysym =
nullptr)
659 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
668 const char* keysym =
nullptr)
672 this->KeyCode = keycode;
673 this->RepeatCount = repeatcount;
676 this->SetKeySym(keysym);
694 vtkSetVector2Macro(Size,
int);
695 vtkGetVector2Macro(Size,
int);
696 vtkSetVector2Macro(EventSize,
int);
697 vtkGetVector2Macro(EventSize,
int);
725 vtkSetMacro(UseTDx,
bool);
726 vtkGetMacro(UseTDx,
bool);
735 virtual void MouseMoveEvent();
736 virtual void RightButtonPressEvent();
737 virtual void RightButtonReleaseEvent();
738 virtual void LeftButtonPressEvent();
739 virtual void LeftButtonReleaseEvent();
740 virtual void MiddleButtonPressEvent();
741 virtual void MiddleButtonReleaseEvent();
742 virtual void MouseWheelForwardEvent();
743 virtual void MouseWheelBackwardEvent();
744 virtual void ExposeEvent();
745 virtual void ConfigureEvent();
746 virtual void EnterEvent();
747 virtual void LeaveEvent();
748 virtual void KeyPressEvent();
749 virtual void KeyReleaseEvent();
750 virtual void CharEvent();
751 virtual void ExitEvent();
752 virtual void FourthButtonPressEvent();
753 virtual void FourthButtonReleaseEvent();
754 virtual void FifthButtonPressEvent();
755 virtual void FifthButtonReleaseEvent();
763 virtual void StartPinchEvent();
764 virtual void PinchEvent();
765 virtual void EndPinchEvent();
766 virtual void StartRotateEvent();
767 virtual void RotateEvent();
768 virtual void EndRotateEvent();
769 virtual void StartPanEvent();
770 virtual void PanEvent();
771 virtual void EndPanEvent();
772 virtual void TapEvent();
773 virtual void LongTapEvent();
774 virtual void SwipeEvent();
784 vtkSetMacro(RecognizeGestures,
bool);
785 vtkGetMacro(RecognizeGestures,
bool);
794 vtkGetMacro(PointersDownCount,
int);
805 void ClearContact(
size_t contactID);
806 int GetPointerIndexForContact(
size_t contactID);
807 int GetPointerIndexForExistingContact(
size_t contactID);
808 bool IsPointerIndexSet(
int i);
809 void ClearPointerIndex(
int i);
850 double Translation[2];
851 double LastTranslation[2];
854 int EventPosition[2];
855 int LastEventPosition[2];
894 friend struct vtkTimerStruct;
904 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
905 virtual int InternalDestroyTimer(
int platformTimerId);
906 int GetCurrentTimerId();