 |
VTK
9.1.0
|
Go to the documentation of this file.
163 #ifndef vtkRenderWindowInteractor_h
164 #define vtkRenderWindowInteractor_h
168 #include "vtkRenderingCoreModule.h"
173 #define VTKI_TIMER_FIRST 0
174 #define VTKI_TIMER_UPDATE 1
178 #define VTKI_MAX_POINTERS 5
212 this->Initialized = 0;
241 vtkGetMacro(Done,
bool);
242 vtkSetMacro(Done,
bool);
270 vtkBooleanMacro(EnableRender,
bool);
271 vtkSetMacro(EnableRender,
bool);
272 vtkGetMacro(EnableRender,
bool);
378 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
379 vtkGetMacro(TimerDuration,
unsigned long);
395 vtkSetMacro(TimerEventId,
int);
396 vtkGetMacro(TimerEventId,
int);
397 vtkSetMacro(TimerEventType,
int);
398 vtkGetMacro(TimerEventType,
int);
399 vtkSetMacro(TimerEventDuration,
int);
400 vtkGetMacro(TimerEventDuration,
int);
401 vtkSetMacro(TimerEventPlatformId,
int);
402 vtkGetMacro(TimerEventPlatformId,
int);
440 vtkGetMacro(DesiredUpdateRate,
double);
450 vtkGetMacro(StillUpdateRate,
double);
458 vtkGetMacro(Initialized,
int);
540 vtkGetMacro(NumberOfFlyFrames,
int);
548 vtkSetMacro(Dolly,
double);
549 vtkGetMacro(Dolly,
double);
561 vtkGetVector2Macro(EventPosition,
int);
562 vtkGetVector2Macro(LastEventPosition,
int);
563 vtkSetVector2Macro(LastEventPosition,
int);
566 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
568 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
569 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
571 this->LastEventPosition[0] = this->EventPosition[0];
572 this->LastEventPosition[1] = this->EventPosition[1];
573 this->EventPosition[0] = x;
574 this->EventPosition[1] = y;
581 this->SetEventPosition(x, this->Size[1] - y - 1);
592 return this->EventPositions[pointerIndex];
600 return this->LastEventPositions[pointerIndex];
608 if (pointerIndex == 0)
610 this->LastEventPosition[0] = this->EventPosition[0];
611 this->LastEventPosition[1] = this->EventPosition[1];
612 this->EventPosition[0] = x;
613 this->EventPosition[1] = y;
615 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
616 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
617 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
618 this->LastEventPositions[pointerIndex][0] != x ||
619 this->LastEventPositions[pointerIndex][1] != y)
621 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
622 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
623 this->EventPositions[pointerIndex][0] = x;
624 this->EventPositions[pointerIndex][1] = y;
630 this->SetEventPosition(pos[0], pos[1], pointerIndex);
634 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
638 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
669 vtkSetMacro(KeyCode,
char);
670 vtkGetMacro(KeyCode,
char);
678 vtkSetMacro(RepeatCount,
int);
679 vtkGetMacro(RepeatCount,
int);
689 vtkSetStringMacro(KeySym);
690 vtkGetStringMacro(KeySym);
697 vtkSetMacro(PointerIndex,
int);
698 vtkGetMacro(PointerIndex,
int);
706 vtkGetMacro(Rotation,
double);
707 vtkGetMacro(LastRotation,
double);
715 vtkGetMacro(Scale,
double);
716 vtkGetMacro(LastScale,
double);
724 vtkGetVector2Macro(Translation,
double);
725 vtkGetVector2Macro(LastTranslation,
double);
733 const char* keysym,
int pointerIndex)
735 this->SetEventPosition(x, y, pointerIndex);
738 this->KeyCode = keycode;
739 this->RepeatCount = repeatcount;
740 this->PointerIndex = pointerIndex;
743 this->SetKeySym(keysym);
748 int repeatcount = 0,
const char* keysym =
nullptr)
750 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
760 const char* keysym,
int pointerIndex)
762 this->SetEventInformation(
763 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
766 int repeatcount = 0,
const char* keysym =
nullptr)
768 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
777 const char* keysym =
nullptr)
781 this->KeyCode = keycode;
782 this->RepeatCount = repeatcount;
785 this->SetKeySym(keysym);
803 vtkSetVector2Macro(Size,
int);
804 vtkGetVector2Macro(Size,
int);
805 vtkSetVector2Macro(EventSize,
int);
806 vtkGetVector2Macro(EventSize,
int);
834 vtkSetMacro(UseTDx,
bool);
835 vtkGetMacro(UseTDx,
bool);
895 vtkSetMacro(RecognizeGestures,
bool);
896 vtkGetMacro(RecognizeGestures,
bool);
905 vtkGetMacro(PointersDownCount,
int);
961 double Translation[2];
962 double LastTranslation[2];
965 int EventPosition[2];
966 int LastEventPosition[2];
1005 friend struct vtkTimerStruct;
void SetRenderWindow(vtkRenderWindow *aren)
Set/Get the rendering window being controlled by this object.
static vtkRenderWindowInteractor * New()
superclass for callback/observer methods
virtual void StartPanEvent()
Fire various gesture based events.
virtual void MouseWheelForwardEvent()
Fire various events.
virtual void MouseWheelLeftEvent()
Fire various events.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
record and play VTK events passing through a vtkRenderWindowInteractor
virtual void ExitEvent()
Fire various events.
virtual int CreateTimer(int timerType)
This class provides two groups of methods for manipulating timers.
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void MiddleButtonPressEvent()
Fire various events.
virtual void MouseWheelBackwardEvent()
Fire various events.
~vtkRenderWindowInteractor() override
virtual void RotateEvent()
Fire various gesture based events.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
vtkObserverMediator * GetObserverMediator()
Return the object used to mediate between vtkInteractorObservers contending for resources.
void FlyTo(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
virtual void EndPickCallback()
These methods correspond to the Exit, User and Pick callbacks.
virtual void Modified()
Update the modification time for this object.
abstract base class for most VTK objects
virtual void UpdateSize(int x, int y)
Event loop notification member for window size change.
vtkRenderWindow * RenderWindow
virtual void SetEventPosition(int x, int y)
Set/Get information about the current event.
virtual void PanEvent()
Fire various gesture based events.
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
virtual void LeaveEvent()
Fire various events.
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 UnRegister(vtkObjectBase *o) override
This Method detects loops of RenderWindow-Interactor, so objects are freed properly.
vtkPickingManager * PickingManager
define API for picking subclasses
a list of nodes that form an assembly path
virtual void SetPickingManager(vtkPickingManager *)
Set the picking manager.
virtual void KeyPressEvent()
Fire various events.
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
virtual void TapEvent()
Fire various gesture based events.
virtual vtkRenderer * FindPokedRenderer(int, int)
When an event occurs, we must determine which Renderer the event occurred within, since one RenderWin...
virtual int * GetLastEventPositions(int pointerIndex)
bool IsPointerIndexSet(int i)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
void InternalReleaseFocus()
These methods allow a command to exclusively grab all events.
int GetPointerIndexForContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
virtual int * GetEventPositions(int pointerIndex)
int CreateOneShotTimer(unsigned long duration)
Create a one shot timer, with the specified duration (in milliseconds).
virtual void RightButtonReleaseEvent()
Fire various events.
virtual void MouseWheelRightEvent()
Fire various events.
vtkHardwareWindow * HardwareWindow
vtkAbstractPicker * Picker
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 RightButtonPressEvent()
Fire various events.
const char * GetClassName() const
Return the class name as a string.
virtual void GetMousePosition(int *x, int *y)
Get the current position of the mouse.
virtual void CharEvent()
Fire various events.
int GetCurrentTimerId()
Internal methods for creating and destroying timers that must be implemented by subclasses.
void FlyToImage(vtkRenderer *ren, double *x)
Given a position x, move the current camera's focal point to x.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract base class for most VTK objects
virtual void EndPanEvent()
Fire various gesture based events.
vtkObserverMediator * ObserverMediator
Widget mediators are used to resolve contention for cursors and other resources.
virtual void SwipeEvent()
Fire various gesture based events.
virtual void ConfigureEvent()
Fire various events.
virtual void SetInteractorStyle(vtkInteractorObserver *)
External switching between joystick/trackball/new? modes.
a simple class to control print indentation
virtual void FourthButtonReleaseEvent()
Fire various events.
virtual void SetEventPosition(int pos[2])
Set/Get information about the current event.
int DestroyTimer(int timerId)
Destroy the timer specified by timerId.
int ResetTimer(int timerId)
Reset the specified timer.
int IsOneShotTimer(int timerId)
Query whether the specified timerId is a one shot timer.
unsigned long GetTimerDuration(int timerId)
Get the duration (in milliseconds) for the specified timerId.
virtual void EndPinchEvent()
Fire various gesture based events.
virtual void LongTapEvent()
Fire various gesture based events.
int GetPointerIndexForExistingContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
void SetRotation(double rotation)
Set/get the rotation for the gesture in degrees, update LastRotation.
virtual vtkPickingManager * CreateDefaultPickingManager()
Create default pickingManager.
vtkInteractorObserver * InteractorStyle
void ReInitialize()
Prepare for handling events and set the Enabled flag to true.
virtual void LeftButtonReleaseEvent()
Fire various events.
virtual vtkAbstractPropPicker * CreateDefaultPicker()
Create default picker.
virtual void SetEventPosition(int x, int y, int pointerIndex)
virtual void Render()
Render the scene.
virtual void SetEventPositionFlipY(int pos[2])
Set/Get information about the current event.
virtual int DestroyTimer()
platform-independent render window interaction including picking and frame rate control.
virtual void EndRotateEvent()
Fire various gesture based events.
virtual void FifthButtonPressEvent()
Fire various events.
virtual void MiddleButtonReleaseEvent()
Fire various events.
void SetHardwareWindow(vtkHardwareWindow *aren)
Set/Get the hardware window being controlled by this object.
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
abstract API for pickers that can pick an instance of vtkProp
virtual void UserCallback()
These methods correspond to the Exit, User and Pick callbacks.
void SetScale(double scale)
Set/get the scale for the gesture, updates LastScale.
virtual void RecognizeGesture(vtkCommand::EventIds)
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
vtkTypeBool LightFollowCamera
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
virtual void Enable()
Enable/Disable interactions.
virtual void EnterEvent()
Fire various events.
virtual void KeyReleaseEvent()
Fire various events.
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.
vtkRenderWindowInteractor()
abstract specification for renderers
virtual void StartRotateEvent()
Fire various gesture based events.
virtual void Start()
Start the event loop.
void FlyToImage(vtkRenderer *ren, double x, double y)
Given a position x, move the current camera's focal point to x.
virtual void SetEventPosition(int pos[2], int pointerIndex)
virtual void SetEventPositionFlipY(int x, int y)
Set/Get information about the current event.
virtual void SetPicker(vtkAbstractPicker *)
Set/Get the object used to perform pick operations.
#define VTKI_MAX_POINTERS
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
void FlyTo(vtkRenderer *ren, double x, double y, double z)
Given a position x, move the current camera's focal point to x.
void SetTranslation(double val[2])
Set/get the translation for pan/swipe gestures, update LastTranslation.
virtual void SetEventPositionFlipY(int x, int y, int pointerIndex)
virtual void ProcessEvents()
Run the event loop and return.
int CreateRepeatingTimer(unsigned long duration)
Create a repeating timer, with the specified duration (in milliseconds).
virtual void LeftButtonPressEvent()
Fire various events.
virtual void ExposeEvent()
Fire various events.
void ShowCursor()
Hide or show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual void MouseMoveEvent()
Fire various events.
void ClearPointerIndex(int i)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
create a window for renderers to draw into
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
void ClearContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
virtual void PinchEvent()
Fire various gesture based events.
virtual void FourthButtonPressEvent()
Fire various events.
void HideCursor()
Hide or show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual void StartPinchEvent()
Fire various gesture based events.
create a window for renderers to draw into
vtkCommand::EventIds CurrentGesture
virtual void FifthButtonReleaseEvent()
Fire various events.
virtual void StartPickCallback()
These methods correspond to the Exit, User and Pick callbacks.
virtual int GetVTKTimerId(int platformTimerId)
Get the VTK timer ID that corresponds to the supplied platform ID.
unsigned long TimerDuration
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.
Class defines API to manage the picking process.
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.