 |
VTK
9.0.1
|
Go to the documentation of this file.
54 #ifndef vtkRenderWindowInteractor_h
55 #define vtkRenderWindowInteractor_h
59 #include "vtkRenderingCoreModule.h"
64 #define VTKI_TIMER_FIRST 0
65 #define VTKI_TIMER_UPDATE 1
69 #define VTKI_MAX_POINTERS 5
103 this->Initialized = 0;
132 vtkGetMacro(Done,
bool);
133 vtkSetMacro(Done,
bool);
161 vtkBooleanMacro(EnableRender,
bool);
162 vtkSetMacro(EnableRender,
bool);
163 vtkGetMacro(EnableRender,
bool);
269 vtkSetClampMacro(TimerDuration,
unsigned long, 1, 100000);
270 vtkGetMacro(TimerDuration,
unsigned long);
286 vtkSetMacro(TimerEventId,
int);
287 vtkGetMacro(TimerEventId,
int);
288 vtkSetMacro(TimerEventType,
int);
289 vtkGetMacro(TimerEventType,
int);
290 vtkSetMacro(TimerEventDuration,
int);
291 vtkGetMacro(TimerEventDuration,
int);
292 vtkSetMacro(TimerEventPlatformId,
int);
293 vtkGetMacro(TimerEventPlatformId,
int);
331 vtkGetMacro(DesiredUpdateRate,
double);
341 vtkGetMacro(StillUpdateRate,
double);
349 vtkGetMacro(Initialized,
int);
431 vtkGetMacro(NumberOfFlyFrames,
int);
439 vtkSetMacro(Dolly,
double);
440 vtkGetMacro(Dolly,
double);
452 vtkGetVector2Macro(EventPosition,
int);
453 vtkGetVector2Macro(LastEventPosition,
int);
454 vtkSetVector2Macro(LastEventPosition,
int);
457 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
459 if (this->EventPosition[0] != x || this->EventPosition[1] != y ||
460 this->LastEventPosition[0] != x || this->LastEventPosition[1] != y)
462 this->LastEventPosition[0] = this->EventPosition[0];
463 this->LastEventPosition[1] = this->EventPosition[1];
464 this->EventPosition[0] = x;
465 this->EventPosition[1] = y;
472 this->SetEventPosition(x, this->Size[1] - y - 1);
483 return this->EventPositions[pointerIndex];
491 return this->LastEventPositions[pointerIndex];
499 if (pointerIndex == 0)
501 this->LastEventPosition[0] = this->EventPosition[0];
502 this->LastEventPosition[1] = this->EventPosition[1];
503 this->EventPosition[0] = x;
504 this->EventPosition[1] = y;
506 vtkDebugMacro(<< this->
GetClassName() <<
" (" <<
this <<
"): setting EventPosition to (" << x
507 <<
"," << y <<
") for pointerIndex number " << pointerIndex);
508 if (this->EventPositions[pointerIndex][0] != x || this->EventPositions[pointerIndex][1] != y ||
509 this->LastEventPositions[pointerIndex][0] != x ||
510 this->LastEventPositions[pointerIndex][1] != y)
512 this->LastEventPositions[pointerIndex][0] = this->EventPositions[pointerIndex][0];
513 this->LastEventPositions[pointerIndex][1] = this->EventPositions[pointerIndex][1];
514 this->EventPositions[pointerIndex][0] = x;
515 this->EventPositions[pointerIndex][1] = y;
521 this->SetEventPosition(pos[0], pos[1], pointerIndex);
525 this->SetEventPosition(x, this->Size[1] - y - 1, pointerIndex);
529 this->SetEventPositionFlipY(pos[0], pos[1], pointerIndex);
560 vtkSetMacro(KeyCode,
char);
561 vtkGetMacro(KeyCode,
char);
569 vtkSetMacro(RepeatCount,
int);
570 vtkGetMacro(RepeatCount,
int);
580 vtkSetStringMacro(KeySym);
581 vtkGetStringMacro(KeySym);
588 vtkSetMacro(PointerIndex,
int);
589 vtkGetMacro(PointerIndex,
int);
597 vtkGetMacro(Rotation,
double);
598 vtkGetMacro(LastRotation,
double);
606 vtkGetMacro(Scale,
double);
607 vtkGetMacro(LastScale,
double);
615 vtkGetVector2Macro(Translation,
double);
616 vtkGetVector2Macro(LastTranslation,
double);
624 const char* keysym,
int pointerIndex)
626 this->SetEventPosition(x, y, pointerIndex);
629 this->KeyCode = keycode;
630 this->RepeatCount = repeatcount;
631 this->PointerIndex = pointerIndex;
634 this->SetKeySym(keysym);
639 int repeatcount = 0,
const char* keysym =
nullptr)
641 this->SetEventInformation(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
651 const char* keysym,
int pointerIndex)
653 this->SetEventInformation(
654 x, this->Size[1] - y - 1, ctrl, shift, keycode, repeatcount, keysym, pointerIndex);
657 int repeatcount = 0,
const char* keysym =
nullptr)
659 this->SetEventInformationFlipY(x, y, ctrl, shift, keycode, repeatcount, keysym, 0);
668 const char* keysym =
nullptr)
672 this->KeyCode = keycode;
673 this->RepeatCount = repeatcount;
676 this->SetKeySym(keysym);
694 vtkSetVector2Macro(Size,
int);
695 vtkGetVector2Macro(Size,
int);
696 vtkSetVector2Macro(EventSize,
int);
697 vtkGetVector2Macro(EventSize,
int);
725 vtkSetMacro(UseTDx,
bool);
726 vtkGetMacro(UseTDx,
bool);
784 vtkSetMacro(RecognizeGestures,
bool);
785 vtkGetMacro(RecognizeGestures,
bool);
794 vtkGetMacro(PointersDownCount,
int);
850 double Translation[2];
851 double LastTranslation[2];
854 int EventPosition[2];
855 int LastEventPosition[2];
894 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()
virtual void MouseWheelForwardEvent()
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 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()
virtual void MouseWheelBackwardEvent()
~vtkRenderWindowInteractor() override
virtual void RotateEvent()
virtual int InternalDestroyTimer(int platformTimerId)
vtkObserverMediator * GetObserverMediator()
Return the object used to mediate between vtkInteractorObservers contending for resources.
void SetRotation(double val)
Set/get the rotation for the gesture in degrees, update LastRotation.
void FlyTo(vtkRenderer *ren, double *x)
virtual void EndPickCallback()
virtual void Modified()
Update the modification time for this object.
void SetScale(double val)
Set/get the scale for the gesture, updates LastScale.
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)
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
virtual void LeaveEvent()
void SetEventInformation(int x, int y, int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=nullptr)
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()
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
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)
void InternalReleaseFocus()
int GetPointerIndexForContact(size_t contactID)
virtual int * GetEventPositions(int pointerIndex)
int CreateOneShotTimer(unsigned long duration)
Create a one shot timer, with the specified duration (in milliseconds).
virtual void RightButtonReleaseEvent()
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()
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.
void FlyToImage(vtkRenderer *ren, double *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()
vtkObserverMediator * ObserverMediator
Widget mediators are used to resolve contention for cursors and other resources.
virtual void SwipeEvent()
virtual void ConfigureEvent()
virtual void SetInteractorStyle(vtkInteractorObserver *)
External switching between joystick/trackball/new? modes.
a simple class to control print indentation
virtual void FourthButtonReleaseEvent()
virtual void SetEventPosition(int pos[2])
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()
virtual void LongTapEvent()
int GetPointerIndexForExistingContact(size_t contactID)
virtual vtkPickingManager * CreateDefaultPickingManager()
Create default pickingManager.
vtkInteractorObserver * InteractorStyle
virtual void LeftButtonReleaseEvent()
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])
virtual int DestroyTimer()
platform-independent render window interaction including picking and frame rate control.
virtual void EndRotateEvent()
virtual void FifthButtonPressEvent()
virtual void MiddleButtonReleaseEvent()
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()
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()
virtual void KeyReleaseEvent()
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()
virtual void Start()
Start the event loop.
void FlyToImage(vtkRenderer *ren, double x, double y)
virtual void SetEventPosition(int pos[2], int pointerIndex)
virtual void SetEventPositionFlipY(int x, int y)
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()
virtual void ExposeEvent()
virtual void MouseMoveEvent()
Fire various events.
void ClearPointerIndex(int i)
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()
virtual void FourthButtonPressEvent()
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()
virtual void StartPickCallback()
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)
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.