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
134 vtkGetMacro(EnableRender,
bool);
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);
285 vtkGetMacro(DesiredUpdateRate,
double);
295 vtkGetMacro(StillUpdateRate,
double);
303 vtkGetMacro(Initialized,
int);
372 {this->FlyTo(ren, x[0], x[1], x[2]);}
375 {this->FlyToImage(ren, x[0], x[1]);}
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);
554 vtkGetMacro(Rotation,
double);
555 vtkGetMacro(LastRotation,
double);
563 vtkGetMacro(Scale,
double);
564 vtkGetMacro(LastScale,
double);
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);
763 vtkGetMacro(RecognizeGestures,
bool);
772 vtkGetMacro(PointersDownCount,
int);
825 double Translation[2];
826 double LastTranslation[2];
829 int EventPosition[2];
830 int LastEventPosition[2];
868 friend struct vtkTimerStruct;
define API for picking subclasses
abstract API for pickers that can pick an instance of vtkProp
a list of nodes that form an assembly path
superclass for callback/observer methods
a simple class to control print indentation
record and play VTK events passing through a vtkRenderWindowInteractor
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
const char * GetClassName() const
Return the class name as a string.
abstract base class for most VTK objects
void InternalReleaseFocus()
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
These methods allow a command to exclusively grab all events.
virtual void Modified()
Update the modification time for this object.
Class defines API to manage the picking process.
platform-independent render window interaction including picking and frame rate control.
unsigned long GetTimerDuration(int timerId)
Get the duration (in milliseconds) for the specified timerId.
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 StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void PinchEvent()
virtual void SwipeEvent()
virtual void StartRotateEvent()
void SetRenderWindow(vtkRenderWindow *aren)
Set/Get the rendering window being controlled by this object.
virtual void SetEventPositionFlipY(int pos[2], int pointerIndex)
virtual void EndPinchEvent()
virtual void KeyReleaseEvent()
virtual void EndPickCallback()
virtual void Enable()
Enable/Disable interactions.
virtual int InternalDestroyTimer(int platformTimerId)
int CreateRepeatingTimer(unsigned long duration)
Create a repeating timer, with the specified duration (in milliseconds).
virtual vtkAbstractPropPicker * CreateDefaultPicker()
Create default picker.
vtkObserverMediator * ObserverMediator
Widget mediators are used to resolve contention for cursors and other resources.
virtual void EndRotateEvent()
void FlyToImage(vtkRenderer *ren, double x, double y)
virtual void ExposeEvent()
virtual void EndPanEvent()
virtual void Render()
Render the scene.
virtual void MouseWheelForwardEvent()
virtual void SetEventPosition(int x, int y)
~vtkRenderWindowInteractor()
virtual void UserCallback()
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.
virtual void LeftButtonReleaseEvent()
virtual int DestroyTimer()
int IsOneShotTimer(int timerId)
Query whether the specified timerId is a one shot timer.
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.
vtkObserverMediator * GetObserverMediator()
Return the object used to mediate between vtkInteractorObservers contending for resources.
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
virtual void UpdateSize(int x, int y)
Event loop notification member for window size change.
void SetEventInformation(int x, int y, int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=0)
virtual int * GetEventPositions(int pointerIndex)
virtual void LeaveEvent()
virtual void EnterEvent()
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
static vtkRenderWindowInteractor * New()
virtual void RightButtonPressEvent()
virtual void Start()
Start the event loop.
virtual vtkPickingManager * CreateDefaultPickingManager()
Create default pickingManager.
virtual void ConfigureEvent()
virtual vtkRenderer * FindPokedRenderer(int, int)
When an event occurs, we must determine which Renderer the event occurred within, since one RenderWin...
virtual void StartPanEvent()
virtual int CreateTimer(int timerType)
This class provides two groups of methods for manipulating timers.
virtual void UnRegister(vtkObjectBase *o)
This Method detects loops of RenderWindow-Interactor, so objects are freed properly.
int ResetTimer(int timerId)
Reset the specified timer.
virtual void MouseWheelBackwardEvent()
virtual void SetInteractorStyle(vtkInteractorObserver *)
External switching between joystick/trackball/new? modes.
void ClearContact(size_t contactID)
Most multitouch systems use persistent contact/pointer ids to track events/motion during multitouch e...
void SetRotation(double val)
Set/get the rotation for the gesture in degrees, update LastRotation.
void FlyTo(vtkRenderer *ren, double x, double y, double z)
Given a position x, move the current camera's focal point to x.
int CreateOneShotTimer(unsigned long duration)
Create a one shot timer, with the specified duretion (in milliseconds).
virtual void ExitCallback()
These methods correspond to the the Exit, User and Pick callbacks.
vtkPickingManager * PickingManager
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
int DestroyTimer(int timerId)
Destroy the timer specified by timerId.
void SetTranslation(double val[2])
Set/get the tranlation for pan/swipe gestures, update LastTranslation.
void FlyToImage(vtkRenderer *ren, double *x)
unsigned long TimerDuration
virtual void RightButtonReleaseEvent()
vtkCommand::EventIds CurrentGesture
virtual void SetEventPositionFlipY(int x, int y, int pointerIndex)
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 GetMousePosition(int *x, int *y)
Get the current position of the mouse.
virtual void SetEventPositionFlipY(int x, int y)
int GetPointerIndexForContact(size_t contactID)
bool IsPointerIndexSet(int i)
virtual void LeftButtonPressEvent()
virtual void MiddleButtonPressEvent()
virtual int * GetLastEventPositions(int pointerIndex)
virtual void StartPickCallback()
int GetPointerIndexForExistingContact(size_t contactID)
virtual void MouseMoveEvent()
Fire various events.
void FlyTo(vtkRenderer *ren, double *x)
vtkAbstractPicker * Picker
vtkInteractorObserver * InteractorStyle
virtual void StartPinchEvent()
Fire various gesture based events.
virtual void SetEventPosition(int pos[2])
virtual void SetPicker(vtkAbstractPicker *)
Set/Get the object used to perform pick operations.
virtual int GetVTKTimerId(int platformTimerId)
Get the VTK timer ID that corresponds to the supplied platform ID.
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
virtual void RotateEvent()
void SetEventInformationFlipY(int x, int y, int ctrl=0, int shift=0, char keycode=0, int repeatcount=0, const char *keysym=0)
virtual void SetEventPositionFlipY(int pos[2])
virtual void SetEventPosition(int x, int y, int pointerIndex)
void ClearPointerIndex(int i)
virtual void LongTapEvent()
void SetScale(double val)
Set/get the scale for the gesture, updates LastScale.
virtual void MiddleButtonReleaseEvent()
virtual void RecognizeGesture(vtkCommand::EventIds)
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
virtual void SetEventPosition(int pos[2], int pointerIndex)
virtual void SetPickingManager(vtkPickingManager *)
Set the picking manager.
vtkRenderWindow * RenderWindow
vtkRenderWindowInteractor()
virtual void KeyPressEvent()
create a window for renderers to draw into
abstract specification for renderers
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTKI_MAX_POINTERS