51 #ifndef vtkRenderWindowInteractor_h
52 #define vtkRenderWindowInteractor_h
54 #include "vtkRenderingCoreModule.h"
61 #define VTKI_TIMER_FIRST 0
62 #define VTKI_TIMER_UPDATE 1
66 #define VTKI_MAX_POINTERS 5
96 virtual void Initialize();
112 virtual void Start();
132 vtkBooleanMacro(EnableRender,
bool);
133 vtkSetMacro(EnableRender,
bool);
134 vtkGetMacro(EnableRender,
bool);
149 virtual void UpdateSize(
int x,
int y);
167 virtual int CreateTimer(
int timerType);
168 virtual int DestroyTimer();
174 int CreateRepeatingTimer(
unsigned long duration);
180 int CreateOneShotTimer(
unsigned long duration);
186 int IsOneShotTimer(
int timerId);
191 unsigned long GetTimerDuration(
int timerId);
196 int ResetTimer(
int timerId);
202 int DestroyTimer(
int timerId);
207 virtual int GetVTKTimerId(
int platformTimerId);
211 enum {OneShotTimer=1,RepeatingTimer};
223 vtkSetClampMacro(TimerDuration,
unsigned long,1,100000);
224 vtkGetMacro(TimerDuration,
unsigned long);
240 vtkSetMacro(TimerEventId,
int);
241 vtkGetMacro(TimerEventId,
int);
242 vtkSetMacro(TimerEventType,
int);
243 vtkGetMacro(TimerEventType,
int);
244 vtkSetMacro(TimerEventDuration,
int);
245 vtkGetMacro(TimerEventDuration,
int);
246 vtkSetMacro(TimerEventPlatformId,
int);
247 vtkGetMacro(TimerEventPlatformId,
int);
284 vtkSetClampMacro(DesiredUpdateRate,
double,0.0001,
VTK_FLOAT_MAX);
285 vtkGetMacro(DesiredUpdateRate,
double);
294 vtkSetClampMacro(StillUpdateRate,
double,0.0001,
VTK_FLOAT_MAX);
295 vtkGetMacro(StillUpdateRate,
double);
303 vtkGetMacro(Initialized,
int);
338 virtual void ExitCallback();
339 virtual void UserCallback();
340 virtual void StartPickCallback();
341 virtual void EndPickCallback();
362 virtual void Render();
370 void FlyTo(
vtkRenderer *ren,
double x,
double y,
double z);
372 {this->FlyTo(ren, x[0], x[1], x[2]);}
373 void FlyToImage(
vtkRenderer *ren,
double x,
double y);
375 {this->FlyToImage(ren, x[0], x[1]);}
382 vtkSetClampMacro(NumberOfFlyFrames,
int,1,
VTK_INT_MAX);
383 vtkGetMacro(NumberOfFlyFrames,
int);
391 vtkSetMacro(Dolly,
double);
392 vtkGetMacro(Dolly,
double);
404 vtkGetVector2Macro(EventPosition,
int);
405 vtkGetVector2Macro(LastEventPosition,
int);
406 vtkSetVector2Macro(LastEventPosition,
int);
410 <<
"): setting EventPosition to (" << x <<
"," << y <<
")");
411 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
412 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
414 this->LastEventPosition[0] = this->EventPosition[0];
415 this->LastEventPosition[1] = this->EventPosition[1];
416 this->EventPosition[0] = x;
417 this->EventPosition[1] = y;
423 this->SetEventPosition(pos[0], pos[1]);
427 this->SetEventPosition(x, this->Size[1] - y - 1);
431 this->SetEventPositionFlipY(pos[0], pos[1]);
441 return this->EventPositions[pointerIndex];
449 return this->LastEventPositions[pointerIndex];
457 if (pointerIndex == 0)
459 this->LastEventPosition[0] = this->EventPosition[0];
460 this->LastEventPosition[1] = this->EventPosition[1];
461 this->EventPosition[0] = x;
462 this->EventPosition[1] = y;
465 <<
"): setting EventPosition to (" << x <<
"," << y <<
") for pointerIndex number " << pointerIndex);
466 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
467 this->LastEventPositions[pointerIndex][0] != x || this->LastEventPositions[pointerIndex][1] != y)
469 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
470 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
471 this->EventPositions[pointerIndex][0] = x;
472 this->EventPositions[pointerIndex][1] = y;
478 this->SetEventPosition(pos[0], pos[1], pointerIndex);
482 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
486 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
517 vtkSetMacro(KeyCode,
char);
518 vtkGetMacro(KeyCode,
char);
526 vtkSetMacro(RepeatCount,
int);
527 vtkGetMacro(RepeatCount,
int);
537 vtkSetStringMacro(KeySym);
538 vtkGetStringMacro(KeySym);
545 vtkSetMacro(PointerIndex,
int);
546 vtkGetMacro(PointerIndex,
int);
553 void SetRotation(
double val);
554 vtkGetMacro(Rotation,
double);
555 vtkGetMacro(LastRotation,
double);
562 void SetScale(
double val);
563 vtkGetMacro(Scale,
double);
564 vtkGetMacro(LastScale,
double);
571 void SetTranslation(
double val[2]);
572 vtkGetVector2Macro(Translation,
double);
573 vtkGetVector2Macro(LastTranslation,
double);
589 this->SetEventPosition(x,y,pointerIndex);
592 this->KeyCode = keycode;
593 this->RepeatCount = repeatcount;
594 this->PointerIndex = pointerIndex;
597 this->SetKeySym(keysym);
602 int ctrl=0,
int shift=0,
605 const char* keysym=
nullptr)
607 this->SetEventInformation(x,y,ctrl,shift,keycode,repeatcount,keysym,0);
623 this->SetEventInformation(x,
624 this->Size[1] - y - 1,
633 int ctrl=0,
int shift=0,
636 const char* keysym=
nullptr)
638 this->SetEventInformationFlipY(x,y,ctrl,shift,keycode,repeatcount,keysym,0);
650 const char* keysym=
nullptr)
654 this->KeyCode = keycode;
655 this->RepeatCount = repeatcount;
658 this->SetKeySym(keysym);
676 vtkSetVector2Macro(Size,
int);
677 vtkGetVector2Macro(Size,
int);
678 vtkSetVector2Macro(EventSize,
int);
679 vtkGetVector2Macro(EventSize,
int);
707 vtkSetMacro(UseTDx,
bool);
708 vtkGetMacro(UseTDx,
bool);
717 virtual void MouseMoveEvent();
718 virtual void RightButtonPressEvent();
719 virtual void RightButtonReleaseEvent();
720 virtual void LeftButtonPressEvent();
721 virtual void LeftButtonReleaseEvent();
722 virtual void MiddleButtonPressEvent();
723 virtual void MiddleButtonReleaseEvent();
724 virtual void MouseWheelForwardEvent();
725 virtual void MouseWheelBackwardEvent();
726 virtual void ExposeEvent();
727 virtual void ConfigureEvent();
728 virtual void EnterEvent();
729 virtual void LeaveEvent();
730 virtual void KeyPressEvent();
731 virtual void KeyReleaseEvent();
732 virtual void CharEvent();
733 virtual void ExitEvent();
734 virtual void FourthButtonPressEvent();
735 virtual void FourthButtonReleaseEvent();
736 virtual void FifthButtonPressEvent();
737 virtual void FifthButtonReleaseEvent();
745 virtual void StartPinchEvent();
746 virtual void PinchEvent();
747 virtual void EndPinchEvent();
748 virtual void StartRotateEvent();
749 virtual void RotateEvent();
750 virtual void EndRotateEvent();
751 virtual void StartPanEvent();
752 virtual void PanEvent();
753 virtual void EndPanEvent();
754 virtual void TapEvent();
755 virtual void LongTapEvent();
756 virtual void SwipeEvent();
766 vtkSetMacro(RecognizeGestures,
bool);
767 vtkGetMacro(RecognizeGestures,
bool);
776 vtkGetMacro(PointersDownCount,
int);
787 void ClearContact(
size_t contactID);
788 int GetPointerIndexForContact(
size_t contactID);
789 int GetPointerIndexForExistingContact(
size_t contactID);
790 bool IsPointerIndexSet(
int i);
791 void ClearPointerIndex(
int i);
829 double Translation[2];
830 double LastTranslation[2];
833 int EventPosition[2];
834 int LastEventPosition[2];
872 friend struct vtkTimerStruct;
882 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
883 virtual int InternalDestroyTimer(
int platformTimerId);
884 int GetCurrentTimerId();