45 #ifndef vtkRenderWindowInteractor_h
46 #define vtkRenderWindowInteractor_h
48 #include "vtkRenderingCoreModule.h"
55 #define VTKI_TIMER_FIRST 0
56 #define VTKI_TIMER_UPDATE 1
60 #define VTKI_MAX_POINTERS 5
90 virtual void Initialize();
106 virtual void Start();
126 vtkBooleanMacro(EnableRender,
bool);
127 vtkSetMacro(EnableRender,
bool);
128 vtkGetMacro(EnableRender,
bool);
143 virtual void UpdateSize(
int x,
int y);
161 virtual int CreateTimer(
int timerType);
162 virtual int DestroyTimer();
168 int CreateRepeatingTimer(
unsigned long duration);
174 int CreateOneShotTimer(
unsigned long duration);
180 int IsOneShotTimer(
int timerId);
185 unsigned long GetTimerDuration(
int timerId);
190 int ResetTimer(
int timerId);
196 int DestroyTimer(
int timerId);
201 virtual int GetVTKTimerId(
int platformTimerId);
205 enum {OneShotTimer=1,RepeatingTimer};
217 vtkSetClampMacro(TimerDuration,
unsigned long,1,100000);
218 vtkGetMacro(TimerDuration,
unsigned long);
234 vtkSetMacro(TimerEventId,
int);
235 vtkGetMacro(TimerEventId,
int);
236 vtkSetMacro(TimerEventType,
int);
237 vtkGetMacro(TimerEventType,
int);
238 vtkSetMacro(TimerEventDuration,
int);
239 vtkGetMacro(TimerEventDuration,
int);
240 vtkSetMacro(TimerEventPlatformId,
int);
241 vtkGetMacro(TimerEventPlatformId,
int);
278 vtkSetClampMacro(DesiredUpdateRate,
double,0.0001,
VTK_FLOAT_MAX);
279 vtkGetMacro(DesiredUpdateRate,
double);
288 vtkSetClampMacro(StillUpdateRate,
double,0.0001,
VTK_FLOAT_MAX);
289 vtkGetMacro(StillUpdateRate,
double);
297 vtkGetMacro(Initialized,
int);
332 virtual void ExitCallback();
333 virtual void UserCallback();
334 virtual void StartPickCallback();
335 virtual void EndPickCallback();
356 virtual void Render();
364 void FlyTo(
vtkRenderer *ren,
double x,
double y,
double z);
366 {this->FlyTo(ren, x[0], x[1], x[2]);}
367 void FlyToImage(
vtkRenderer *ren,
double x,
double y);
369 {this->FlyToImage(ren, x[0], x[1]);}
376 vtkSetClampMacro(NumberOfFlyFrames,
int,1,
VTK_INT_MAX);
377 vtkGetMacro(NumberOfFlyFrames,
int);
385 vtkSetMacro(Dolly,
double);
386 vtkGetMacro(Dolly,
double);
398 vtkGetVector2Macro(EventPosition,
int);
399 vtkGetVector2Macro(LastEventPosition,
int);
400 vtkSetVector2Macro(LastEventPosition,
int);
404 <<
"): setting EventPosition to (" << x <<
"," << y <<
")");
405 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
406 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
408 this->LastEventPosition[0] = this->EventPosition[0];
409 this->LastEventPosition[1] = this->EventPosition[1];
410 this->EventPosition[0] = x;
411 this->EventPosition[1] = y;
417 this->SetEventPosition(pos[0], pos[1]);
421 this->SetEventPosition(x, this->Size[1] - y - 1);
425 this->SetEventPositionFlipY(pos[0], pos[1]);
435 return this->EventPositions[pointerIndex];
443 return this->LastEventPositions[pointerIndex];
451 if (pointerIndex == 0)
453 this->LastEventPosition[0] = this->EventPosition[0];
454 this->LastEventPosition[1] = this->EventPosition[1];
455 this->EventPosition[0] = x;
456 this->EventPosition[1] = y;
459 <<
"): setting EventPosition to (" << x <<
"," << y <<
") for pointerIndex number " << pointerIndex);
460 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
461 this->LastEventPositions[pointerIndex][0] != x || this->LastEventPositions[pointerIndex][1] != y)
463 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
464 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
465 this->EventPositions[pointerIndex][0] = x;
466 this->EventPositions[pointerIndex][1] = y;
472 this->SetEventPosition(pos[0], pos[1], pointerIndex);
476 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
480 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
511 vtkSetMacro(KeyCode,
char);
512 vtkGetMacro(KeyCode,
char);
520 vtkSetMacro(RepeatCount,
int);
521 vtkGetMacro(RepeatCount,
int);
531 vtkSetStringMacro(KeySym);
532 vtkGetStringMacro(KeySym);
539 vtkSetMacro(PointerIndex,
int);
540 vtkGetMacro(PointerIndex,
int);
547 void SetRotation(
double val);
548 vtkGetMacro(Rotation,
double);
549 vtkGetMacro(LastRotation,
double);
556 void SetScale(
double val);
557 vtkGetMacro(Scale,
double);
558 vtkGetMacro(LastScale,
double);
565 void SetTranslation(
double val[2]);
566 vtkGetVector2Macro(Translation,
double);
567 vtkGetVector2Macro(LastTranslation,
double);
583 this->SetEventPosition(x,y,pointerIndex);
586 this->KeyCode = keycode;
587 this->RepeatCount = repeatcount;
588 this->PointerIndex = pointerIndex;
591 this->SetKeySym(keysym);
596 int ctrl=0,
int shift=0,
599 const char* keysym=
nullptr)
601 this->SetEventInformation(x,y,ctrl,shift,keycode,repeatcount,keysym,0);
617 this->SetEventInformation(x,
618 this->Size[1] - y - 1,
627 int ctrl=0,
int shift=0,
630 const char* keysym=
nullptr)
632 this->SetEventInformationFlipY(x,y,ctrl,shift,keycode,repeatcount,keysym,0);
644 const char* keysym=
nullptr)
648 this->KeyCode = keycode;
649 this->RepeatCount = repeatcount;
652 this->SetKeySym(keysym);
670 vtkSetVector2Macro(Size,
int);
671 vtkGetVector2Macro(Size,
int);
672 vtkSetVector2Macro(EventSize,
int);
673 vtkGetVector2Macro(EventSize,
int);
701 vtkSetMacro(UseTDx,
bool);
702 vtkGetMacro(UseTDx,
bool);
711 virtual void MouseMoveEvent();
712 virtual void RightButtonPressEvent();
713 virtual void RightButtonReleaseEvent();
714 virtual void LeftButtonPressEvent();
715 virtual void LeftButtonReleaseEvent();
716 virtual void MiddleButtonPressEvent();
717 virtual void MiddleButtonReleaseEvent();
718 virtual void MouseWheelForwardEvent();
719 virtual void MouseWheelBackwardEvent();
720 virtual void ExposeEvent();
721 virtual void ConfigureEvent();
722 virtual void EnterEvent();
723 virtual void LeaveEvent();
724 virtual void KeyPressEvent();
725 virtual void KeyReleaseEvent();
726 virtual void CharEvent();
727 virtual void ExitEvent();
728 virtual void FourthButtonPressEvent();
729 virtual void FourthButtonReleaseEvent();
730 virtual void FifthButtonPressEvent();
731 virtual void FifthButtonReleaseEvent();
739 virtual void StartPinchEvent();
740 virtual void PinchEvent();
741 virtual void EndPinchEvent();
742 virtual void StartRotateEvent();
743 virtual void RotateEvent();
744 virtual void EndRotateEvent();
745 virtual void StartPanEvent();
746 virtual void PanEvent();
747 virtual void EndPanEvent();
748 virtual void TapEvent();
749 virtual void LongTapEvent();
750 virtual void SwipeEvent();
760 vtkSetMacro(RecognizeGestures,
bool);
761 vtkGetMacro(RecognizeGestures,
bool);
770 vtkGetMacro(PointersDownCount,
int);
781 void ClearContact(
size_t contactID);
782 int GetPointerIndexForContact(
size_t contactID);
783 int GetPointerIndexForExistingContact(
size_t contactID);
784 bool IsPointerIndexSet(
int i);
785 void ClearPointerIndex(
int i);
823 double Translation[2];
824 double LastTranslation[2];
827 int EventPosition[2];
828 int LastEventPosition[2];
866 friend struct vtkTimerStruct;
876 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
877 virtual int InternalDestroyTimer(
int platformTimerId);
878 int GetCurrentTimerId();