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();
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);
241 vtkGetMacro(TimerEventId,
int);
243 vtkGetMacro(TimerEventType,
int);
245 vtkGetMacro(TimerEventDuration,
int);
247 vtkGetMacro(TimerEventPlatformId,
int);
272 vtkGetMacro(LightFollowCamera,
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);
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);
494 vtkGetMacro(AltKey,
int);
502 vtkGetMacro(ControlKey,
int);
510 vtkGetMacro(ShiftKey,
int);
518 vtkGetMacro(KeyCode,
char);
527 vtkGetMacro(RepeatCount,
int);
537 vtkSetStringMacro(KeySym);
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);
590 this->ControlKey = ctrl;
591 this->ShiftKey = shift;
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=0)
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=0)
638 this->SetEventInformationFlipY(x,y,ctrl,shift,keycode,repeatcount,keysym,0);
650 const char* keysym=0)
652 this->ControlKey = ctrl;
653 this->ShiftKey = shift;
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);
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();
741 virtual void StartPinchEvent();
742 virtual void PinchEvent();
743 virtual void EndPinchEvent();
744 virtual void StartRotateEvent();
745 virtual void RotateEvent();
746 virtual void EndRotateEvent();
747 virtual void StartPanEvent();
748 virtual void PanEvent();
749 virtual void EndPanEvent();
750 virtual void TapEvent();
751 virtual void LongTapEvent();
752 virtual void SwipeEvent();
763 vtkGetMacro(RecognizeGestures,
bool);
772 vtkGetMacro(PointersDownCount,
int);
783 void ClearContact(
size_t contactID);
784 int GetPointerIndexForContact(
size_t contactID);
785 int GetPointerIndexForExistingContact(
size_t contactID);
786 bool IsPointerIndexSet(
int i);
787 void ClearPointerIndex(
int i);
825 double Translation[2];
826 double LastTranslation[2];
829 int EventPosition[2];
830 int LastEventPosition[2];
868 friend struct vtkTimerStruct;
878 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
879 virtual int InternalDestroyTimer(
int platformTimerId);
880 int GetCurrentTimerId();
900 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)
vtkInteractorObserver * InteractorStyle
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
abstract specification for renderers
vtkRenderWindow * RenderWindow
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.
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
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)
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
vtkAbstractPicker * Picker
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...
vtkPickingManager * PickingManager
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.