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();
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);
235 vtkGetMacro(TimerEventId,
int);
237 vtkGetMacro(TimerEventType,
int);
239 vtkGetMacro(TimerEventDuration,
int);
241 vtkGetMacro(TimerEventPlatformId,
int);
266 vtkGetMacro(LightFollowCamera,
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);
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);
488 vtkGetMacro(AltKey,
int);
496 vtkGetMacro(ControlKey,
int);
504 vtkGetMacro(ShiftKey,
int);
512 vtkGetMacro(KeyCode,
char);
521 vtkGetMacro(RepeatCount,
int);
531 vtkSetStringMacro(KeySym);
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);
584 this->ControlKey = ctrl;
585 this->ShiftKey = shift;
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=0)
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=0)
632 this->SetEventInformationFlipY(x,y,ctrl,shift,keycode,repeatcount,keysym,0);
644 const char* keysym=0)
646 this->ControlKey = ctrl;
647 this->ShiftKey = shift;
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);
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();
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);
809 int LightFollowCamera;
811 double DesiredUpdateRate;
812 double StillUpdateRate;
823 double Translation[2];
824 double LastTranslation[2];
827 int EventPosition[2];
828 int LastEventPosition[2];
833 int TimerEventDuration;
834 int TimerEventPlatformId;
837 int LastEventPositions[VTKI_MAX_POINTERS][2];
840 size_t PointerIndexLookup[VTKI_MAX_POINTERS];
843 int NumberOfFlyFrames;
866 friend struct vtkTimerStruct;
876 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
877 virtual int InternalDestroyTimer(
int platformTimerId);
878 int GetCurrentTimerId();
898 virtual void RecognizeGesture(vtkCommand::EventIds);
virtual void SetEventPositionFlipY(int pos[2])
Set/Get information about the current event.
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
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=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=0)
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=0)
Calls SetEventInformation, but flips the Y based on the current Size[1] value (i.e.
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 SetRenderWindow(vtkRenderWindow *renwin)
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
abstract specification for renderers
void SetKeyEventInformation(int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=0)
Set all the keyboard-related event information in one call.
vtkCommand::EventIds CurrentGesture
virtual int * GetLastEventPositions(int pointerIndex)
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.
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
These methods allow a command to exclusively grab all events.
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...
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.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
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)
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
These methods enable an interactor observer to exclusively grab all events invoked by its associated ...
abstract base class for most VTK objects
virtual void SetEventPosition(int x, int y)
Set/Get information about the current event.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkWeakPointer< vtkRenderWindow > RenderWindow
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
define API for picking subclasses
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void FlyToImage(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
virtual void SetEventPositionFlipY(int x, int y)
Set/Get information about the current event.