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 100 virtual void Initialize();
103 this->Initialized = 0;
120 virtual void Start();
132 vtkGetMacro(Done,
bool);
133 vtkSetMacro(Done,
bool);
161 vtkBooleanMacro(EnableRender,
bool);
162 vtkSetMacro(EnableRender,
bool);
163 vtkGetMacro(EnableRender,
bool);
191 virtual void UpdateSize(
int x,
int y);
209 virtual int CreateTimer(
int timerType);
210 virtual int DestroyTimer();
216 int CreateRepeatingTimer(
unsigned long duration);
222 int CreateOneShotTimer(
unsigned long duration);
228 int IsOneShotTimer(
int timerId);
233 unsigned long GetTimerDuration(
int timerId);
238 int ResetTimer(
int timerId);
244 int DestroyTimer(
int timerId);
249 virtual int GetVTKTimerId(
int platformTimerId);
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);
330 vtkSetClampMacro(DesiredUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
331 vtkGetMacro(DesiredUpdateRate,
double);
340 vtkSetClampMacro(StillUpdateRate,
double, 0.0001,
VTK_FLOAT_MAX);
341 vtkGetMacro(StillUpdateRate,
double);
349 vtkGetMacro(Initialized,
int);
384 virtual void ExitCallback();
385 virtual void UserCallback();
386 virtual void StartPickCallback();
387 virtual void EndPickCallback();
412 virtual void Render();
420 void FlyTo(
vtkRenderer* ren,
double x,
double y,
double z);
422 void FlyToImage(
vtkRenderer* ren,
double x,
double y);
430 vtkSetClampMacro(NumberOfFlyFrames,
int, 1,
VTK_INT_MAX);
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);
596 void SetRotation(
double val);
597 vtkGetMacro(Rotation,
double);
598 vtkGetMacro(LastRotation,
double);
605 void SetScale(
double val);
606 vtkGetMacro(Scale,
double);
607 vtkGetMacro(LastScale,
double);
614 void SetTranslation(
double val[2]);
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);
735 virtual void MouseMoveEvent();
736 virtual void RightButtonPressEvent();
737 virtual void RightButtonReleaseEvent();
738 virtual void LeftButtonPressEvent();
739 virtual void LeftButtonReleaseEvent();
740 virtual void MiddleButtonPressEvent();
741 virtual void MiddleButtonReleaseEvent();
742 virtual void MouseWheelForwardEvent();
743 virtual void MouseWheelBackwardEvent();
744 virtual void MouseWheelLeftEvent();
745 virtual void MouseWheelRightEvent();
746 virtual void ExposeEvent();
747 virtual void ConfigureEvent();
748 virtual void EnterEvent();
749 virtual void LeaveEvent();
750 virtual void KeyPressEvent();
751 virtual void KeyReleaseEvent();
752 virtual void CharEvent();
753 virtual void ExitEvent();
754 virtual void FourthButtonPressEvent();
755 virtual void FourthButtonReleaseEvent();
756 virtual void FifthButtonPressEvent();
757 virtual void FifthButtonReleaseEvent();
765 virtual void StartPinchEvent();
766 virtual void PinchEvent();
767 virtual void EndPinchEvent();
768 virtual void StartRotateEvent();
769 virtual void RotateEvent();
770 virtual void EndRotateEvent();
771 virtual void StartPanEvent();
772 virtual void PanEvent();
773 virtual void EndPanEvent();
774 virtual void TapEvent();
775 virtual void LongTapEvent();
776 virtual void SwipeEvent();
786 vtkSetMacro(RecognizeGestures,
bool);
787 vtkGetMacro(RecognizeGestures,
bool);
796 vtkGetMacro(PointersDownCount,
int);
807 void ClearContact(
size_t contactID);
808 int GetPointerIndexForContact(
size_t contactID);
809 int GetPointerIndexForExistingContact(
size_t contactID);
810 bool IsPointerIndexSet(
int i);
811 void ClearPointerIndex(
int i);
852 double Translation[2];
853 double LastTranslation[2];
856 int EventPosition[2];
857 int LastEventPosition[2];
896 friend struct vtkTimerStruct;
906 virtual int InternalCreateTimer(
int timerId,
int timerType,
unsigned long duration);
907 virtual int InternalDestroyTimer(
int platformTimerId);
908 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.