48 #ifndef vtkRenderWindowInteractor_h 49 #define vtkRenderWindowInteractor_h 53 #include "vtkRenderingCoreModule.h" 58 #define VTKI_TIMER_FIRST 0 59 #define VTKI_TIMER_UPDATE 1 63 #define VTKI_MAX_POINTERS 5 94 virtual void Initialize();
97 this->Initialized = 0;
114 virtual void Start();
126 vtkGetMacro(Done,
bool);
127 vtkSetMacro(Done,
bool);
155 vtkBooleanMacro(EnableRender,
bool);
156 vtkSetMacro(EnableRender,
bool);
157 vtkGetMacro(EnableRender,
bool);
185 virtual void UpdateSize(
int x,
int y);
203 virtual int CreateTimer(
int timerType);
204 virtual int DestroyTimer();
210 int CreateRepeatingTimer(
unsigned long duration);
216 int CreateOneShotTimer(
unsigned long duration);
222 int IsOneShotTimer(
int timerId);
227 unsigned long GetTimerDuration(
int timerId);
232 int ResetTimer(
int timerId);
238 int DestroyTimer(
int timerId);
243 virtual int GetVTKTimerId(
int platformTimerId);
263 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
264 vtkGetMacro(TimerDuration,
unsigned long);
280 vtkSetMacro(TimerEventId,
int);
281 vtkGetMacro(TimerEventId,
int);
282 vtkSetMacro(TimerEventType,
int);
283 vtkGetMacro(TimerEventType,
int);
284 vtkSetMacro(TimerEventDuration,
int);
285 vtkGetMacro(TimerEventDuration,
int);
286 vtkSetMacro(TimerEventPlatformId,
int);
287 vtkGetMacro(TimerEventPlatformId,
int);
324 vtkSetClampMacro(DesiredUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
325 vtkGetMacro(DesiredUpdateRate,
double);
334 vtkSetClampMacro(StillUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
335 vtkGetMacro(StillUpdateRate,
double);
343 vtkGetMacro(Initialized,
int);
378 virtual void ExitCallback();
379 virtual void UserCallback();
380 virtual void StartPickCallback();
381 virtual void EndPickCallback();
406 virtual void Render();
414 void FlyTo(
vtkRenderer* ren,
double x,
double y,
double z);
416 void FlyToImage(
vtkRenderer* ren,
double x,
double y);
424 vtkSetClampMacro(NumberOfFlyFrames,
int, 1,
VTK_INT_MAX);
425 vtkGetMacro(NumberOfFlyFrames,
int);
433 vtkSetMacro(Dolly,
double);
434 vtkGetMacro(Dolly,
double);
446 vtkGetVector2Macro(EventPosition,
int);
447 vtkGetVector2Macro(LastEventPosition,
int);
448 vtkSetVector2Macro(LastEventPosition,
int);
451 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
453 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
454 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
456 this->LastEventPosition[0] = this->EventPosition[0];
457 this->LastEventPosition[1] = this->EventPosition[1];
458 this->EventPosition[0] = x;
459 this->EventPosition[1] = y;
466 this->SetEventPosition(x, this->Size[1] - y - 1);
477 return this->EventPositions[pointerIndex];
485 return this->LastEventPositions[pointerIndex];
493 if (pointerIndex == 0)
495 this->LastEventPosition[0] = this->EventPosition[0];
496 this->LastEventPosition[1] = this->EventPosition[1];
497 this->EventPosition[0] = x;
498 this->EventPosition[1] = y;
500 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
501 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
502 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
503 this->LastEventPositions[pointerIndex][0] != x ||
504 this->LastEventPositions[pointerIndex][1] != y)
506 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
507 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
508 this->EventPositions[pointerIndex][0] = x;
509 this->EventPositions[pointerIndex][1] = y;
515 this->SetEventPosition(pos[0], pos[1], pointerIndex);
519 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
523 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
554 vtkSetMacro(KeyCode,
char);
555 vtkGetMacro(KeyCode,
char);
563 vtkSetMacro(RepeatCount,
int);
564 vtkGetMacro(RepeatCount,
int);
574 vtkSetStringMacro(KeySym);
575 vtkGetStringMacro(KeySym);
582 vtkSetMacro(PointerIndex,
int);
583 vtkGetMacro(PointerIndex,
int);
590 void SetRotation(
double val);
591 vtkGetMacro(Rotation,
double);
592 vtkGetMacro(LastRotation,
double);
599 void SetScale(
double val);
600 vtkGetMacro(Scale,
double);
601 vtkGetMacro(LastScale,
double);
608 void SetTranslation(
double val[2]);
609 vtkGetVector2Macro(Translation,
double);
610 vtkGetVector2Macro(LastTranslation,
double);
618 const char* keysym,
int pointerIndex)
620 this->SetEventPosition(x, y, pointerIndex);
623 this->KeyCode = keycode;
624 this->RepeatCount = repeatcount;
625 this->PointerIndex = pointerIndex;
628 this->SetKeySym(keysym);
633 int repeatcount = 0,
const char* keysym =
nullptr)
635 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
645 const char* keysym,
int pointerIndex)
647 this->SetEventInformation(
648 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
651 int repeatcount = 0,
const char* keysym =
nullptr)
653 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
662 const char* keysym =
nullptr)
666 this->KeyCode = keycode;
667 this->RepeatCount = repeatcount;
670 this->SetKeySym(keysym);
688 vtkSetVector2Macro(Size,
int);
689 vtkGetVector2Macro(Size,
int);
690 vtkSetVector2Macro(EventSize,
int);
691 vtkGetVector2Macro(EventSize,
int);
719 vtkSetMacro(UseTDx,
bool);
720 vtkGetMacro(UseTDx,
bool);
729 virtual void MouseMoveEvent();
730 virtual void RightButtonPressEvent();
731 virtual void RightButtonReleaseEvent();
732 virtual void LeftButtonPressEvent();
733 virtual void LeftButtonReleaseEvent();
734 virtual void MiddleButtonPressEvent();
735 virtual void MiddleButtonReleaseEvent();
736 virtual void MouseWheelForwardEvent();
737 virtual void MouseWheelBackwardEvent();
738 virtual void ExposeEvent();
739 virtual void ConfigureEvent();
740 virtual void EnterEvent();
741 virtual void LeaveEvent();
742 virtual void KeyPressEvent();
743 virtual void KeyReleaseEvent();
744 virtual void CharEvent();
745 virtual void ExitEvent();
746 virtual void FourthButtonPressEvent();
747 virtual void FourthButtonReleaseEvent();
748 virtual void FifthButtonPressEvent();
749 virtual void FifthButtonReleaseEvent();
757 virtual void StartPinchEvent();
758 virtual void PinchEvent();
759 virtual void EndPinchEvent();
760 virtual void StartRotateEvent();
761 virtual void RotateEvent();
762 virtual void EndRotateEvent();
763 virtual void StartPanEvent();
764 virtual void PanEvent();
765 virtual void EndPanEvent();
766 virtual void TapEvent();
767 virtual void LongTapEvent();
768 virtual void SwipeEvent();
778 vtkSetMacro(RecognizeGestures,
bool);
779 vtkGetMacro(RecognizeGestures,
bool);
788 vtkGetMacro(PointersDownCount,
int);
799 void ClearContact(
size_t contactID);
800 int GetPointerIndexForContact(
size_t contactID);
801 int GetPointerIndexForExistingContact(
size_t contactID);
802 bool IsPointerIndexSet(
int i);
803 void ClearPointerIndex(
int i);
844 double Translation[2];
845 double LastTranslation[2];
848 int EventPosition[2];
849 int LastEventPosition[2];
888 friend struct vtkTimerStruct;
898 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
899 virtual int InternalDestroyTimer(
int platformTimerId);
900 int GetCurrentTimerId();
create a window for renderers to draw into
virtual void SetEventPositionFlipY(int pos[2])
Set/Get information about the current event.
void SetKeyEventInformation(int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=nullptr)
Set all the keyboard-related event information in one call.
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
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, 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)
vtkInteractorObserver * InteractorStyle
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
abstract specification for renderers
vtkRenderWindow * RenderWindow
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
vtkCommand::EventIds CurrentGesture
virtual int * GetLastEventPositions(int pointerIndex)
vtkTypeBool LightFollowCamera
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.
superclass for callback/observer methods
const char * GetClassName() const
Return the class name as a string.
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
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...
vtkHardwareWindow * HardwareWindow
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.
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.
virtual void ProcessEvents()
Run the event loop and return.
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
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.
void SetEventInformation(int x, int y, int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=nullptr)
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=nullptr)
Calls SetEventInformation, but flips the Y based on the current Size[1] value (i.e.
virtual void SetEventPositionFlipY(int x, int y)
Set/Get information about the current event.