Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkMRMLInteractionWidget Class Referenceabstract

Process interaction events to update state of interaction widgets. More...

#include <Libs/MRML/DisplayableManager/vtkMRMLInteractionWidget.h>

Inheritance diagram for vtkMRMLInteractionWidget:
Collaboration diagram for vtkMRMLInteractionWidget:

Public Types

enum  {
  WidgetEventInteraction_First = WidgetEventUser , WidgetEventReserved = WidgetEventInteraction_First , WidgetEventUniformScaleStart , WidgetEventUniformScaleEnd ,
  WidgetEventCancel , WidgetEventInteraction_Last
}
 Widget events. More...
 
enum  { InteractionNone , InteractionTranslationHandle , InteractionRotationHandle , InteractionScaleHandle }
 
enum  {
  WidgetStateInteraction_First = WidgetStateUser , WidgetStateOnTranslationHandle = WidgetStateInteraction_First , WidgetStateOnRotationHandle , WidgetStateOnScaleHandle ,
  WidgetStateUniformScale , WidgetStateInteraction_Last
}
 Widget states. More...
 
- Public Types inherited from vtkMRMLAbstractWidget
enum  {
  WidgetStateAny , WidgetStateIdle , WidgetStateOnWidget , WidgetStateTranslate ,
  WidgetStateRotate , WidgetStateScale , WidgetStateUser
}
 The state of the widget. More...
 
typedef vtkObject Superclass
 Standard methods for a VTK class.
 
enum  WidgetEvents {
  WidgetEventNone , WidgetEventMouseMove , WidgetEventTranslateStart , WidgetEventTranslateEnd ,
  WidgetEventRotateStart , WidgetEventRotateEnd , WidgetEventScaleStart , WidgetEventScaleEnd ,
  WidgetEventPick , WidgetEventJumpCursor , WidgetEventAction , WidgetEventCustomAction1 ,
  WidgetEventCustomAction2 , WidgetEventCustomAction3 , WidgetEventCustomAction4 , WidgetEventCustomAction5 ,
  WidgetEventCustomAction6 , WidgetEventSelect , WidgetEventUnselect , WidgetEventToggleSelect ,
  WidgetEventMenu , WidgetEventReset , WidgetEventUser
}
 Widget events. More...
 

Public Member Functions

bool CanProcessInteractionEvent (vtkMRMLInteractionEventData *eventData, double &distance2) override
 Return true if the widget can process the event.
 
virtual int GetActiveComponentIndex ()
 
virtual int GetActiveComponentType ()
 
bool GetInteractive () override
 Allows the widget to request interactive mode (faster updates)
 
int GetMouseCursor () override
 Allows the widget to request a cursor shape.
 
void Leave (vtkMRMLInteractionEventData *eventData) override
 Called when the the widget loses the focus.
 
bool ProcessInteractionEvent (vtkMRMLInteractionEventData *eventData) override
 Process interaction event.
 
virtual void SetActiveComponentIndex (int index)
 
virtual void SetActiveComponentType (int type)
 
- Public Member Functions inherited from vtkMRMLAbstractWidget
virtual vtkWidgetEventTranslator * GetEventTranslator (int widgetState)
 
virtual bool GetGrabFocus ()
 
vtkMRMLInteractionNodeGetInteractionNode ()
 
vtkMRMLApplicationLogicGetMRMLApplicationLogic ()
 
virtual bool GetNeedToRender ()
 
virtual int GetNumberOfEventTranslators ()
 
vtkRenderer * GetRenderer ()
 
virtual vtkMRMLAbstractWidgetRepresentationGetRepresentation ()
 Get the representation.
 
virtual int GetWidgetState ()
 Convenient method to determine the state of the method.
 
virtual void NeedToRenderOff ()
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void SetEventTranslation (int widgetState, unsigned long interactionEvent, int modifiers, unsigned long widgetEvent)
 
void SetEventTranslation (unsigned long interactionEvent, int modifiers, unsigned long widgetEvent)
 
void SetEventTranslationClickAndDrag (int widgetState, unsigned long startInteractionEvent, int modifiers, int widgetStateDragging, unsigned long widgetStartEvent, unsigned long widgetEndEvent)
 
void SetKeyboardEventTranslation (int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
 
void SetKeyboardEventTranslation (int widgetState, int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
 
virtual void SetMRMLApplicationLogic (vtkMRMLApplicationLogic *applicationLogic)
 
void SetRenderer (vtkRenderer *renderer)
 
virtual void SetRepresentation (vtkMRMLAbstractWidgetRepresentation *r)
 
virtual void SetWidgetState (int)
 Convenient method to change what state the widget is in.
 
virtual unsigned long TranslateInteractionEventToWidgetEvent (vtkMRMLInteractionEventData *eventData)
 Get widget event from translation event.
 
virtual void UpdateFromMRML (vtkMRMLNode *caller, unsigned long event, void *callData=nullptr)
 Build the actors of the representation with the info stored in the MRML scene.
 

Protected Member Functions

virtual void ApplyTransform (vtkTransform *transform)=0
 
void EndWidgetInteraction ()
 
virtual bool GetClosestPointOnInteractionAxis (int type, int index, const double inputDisplay[2], double outputIntersectionWorld[3])
 
virtual bool GetIntersectionOnAxisPlane (int type, int index, const double inputDisplay[2], double outputIntersectionWorld[3])
 
virtual vtkMRMLNodeGetMRMLNode ()=0
 
virtual bool JumpToHandlePosition (int type, int index)
 
virtual bool ProcessCancelEvent (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessEndMouseDrag (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessJumpCursor (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessMouseMove (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessWidgetMenu (vtkMRMLInteractionEventData *eventData)=0
 
virtual bool ProcessWidgetMenuDisplayNodeTypeAndIndex (vtkMRMLInteractionEventData *eventData, vtkMRMLDisplayNode *displayNode, int type, int index)
 
virtual bool ProcessWidgetRotateStart (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessWidgetScaleStart (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessWidgetTranslateStart (vtkMRMLInteractionEventData *eventData)
 
virtual bool ProcessWidgetUniformScaleStart (vtkMRMLInteractionEventData *eventData)
 
virtual void RestoreInitialState ()
 
virtual void RotateWidget (double eventPos[2])
 
virtual void SaveInitialState ()
 
virtual void ScaleWidget (double eventPos[2], bool uniform=false)
 
void StartWidgetInteraction (vtkMRMLInteractionEventData *eventData)
 
virtual void TranslateWidget (double eventPos[2])
 
 vtkMRMLInteractionWidget ()
 
 ~vtkMRMLInteractionWidget () override
 
- Protected Member Functions inherited from vtkMRMLAbstractWidget
bool CanProcessButtonClickEvent (vtkMRMLInteractionEventData *eventData, double &distance2)
 Generate a button click event and checks if it can be processed with CanProcessInteractionEvent.
 
const char * GetAssociatedNodeID (vtkMRMLInteractionEventData *eventData)
 
virtual int ProcessButtonClickEvent (vtkMRMLInteractionEventData *eventData)
 
unsigned long TranslateInteractionEventToWidgetEvent (vtkWidgetEventTranslator *translator, vtkMRMLInteractionEventData *eventData)
 Helper function that attempts to translate an event with a specific translator only.
 
 vtkMRMLAbstractWidget ()
 
 ~vtkMRMLAbstractWidget () override
 

Protected Attributes

double LastEventPosition [2]
 Variables for translate/rotate/scale.
 
vtkSmartPointer< vtkMRMLNodeOriginalStateNode { nullptr }
 
int PreviewPointIndex
 
- Protected Attributes inherited from vtkMRMLAbstractWidget
vtkWeakPointer< vtkMRMLApplicationLogicApplicationLogic
 
std::vector< vtkSmartPointer< vtkWidgetEventTranslator > > EventTranslators
 
vtkWeakPointer< vtkRenderer > Renderer
 
vtkSmartPointer< vtkMRMLAbstractWidgetRepresentationWidgetRep
 
int WidgetState
 
typedef vtkMRMLAbstractWidget Superclass
 
virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
static int IsTypeOf (const char *type)
 
static vtkMRMLInteractionWidgetSafeDownCast (vtkObject *o)
 

Additional Inherited Members

- Static Public Member Functions inherited from vtkMRMLAbstractWidget
static int IsTypeOf (const char *type)
 
static vtkMRMLAbstractWidgetSafeDownCast (vtkObject *o)
 

Detailed Description

Process interaction events to update state of interaction widgets.

See also
vtkMRMLAbstractWidget vtkSlicerWidgetRepresentation vtkSlicerWidgetEventTranslator

Definition at line 49 of file vtkMRMLInteractionWidget.h.

Member Typedef Documentation

◆ Superclass

Standard VTK class macros.

Definition at line 55 of file vtkMRMLInteractionWidget.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Widget events.

Enumerator
WidgetEventInteraction_First 
WidgetEventReserved 
WidgetEventUniformScaleStart 
WidgetEventUniformScaleEnd 
WidgetEventCancel 
WidgetEventInteraction_Last 

Definition at line 79 of file vtkMRMLInteractionWidget.h.

◆ anonymous enum

anonymous enum
Enumerator
InteractionNone 
InteractionTranslationHandle 
InteractionRotationHandle 
InteractionScaleHandle 

Definition at line 59 of file vtkMRMLInteractionWidget.h.

◆ anonymous enum

anonymous enum

Widget states.

Enumerator
WidgetStateInteraction_First 
WidgetStateOnTranslationHandle 
WidgetStateOnRotationHandle 
WidgetStateOnScaleHandle 
WidgetStateUniformScale 
WidgetStateInteraction_Last 

Definition at line 68 of file vtkMRMLInteractionWidget.h.

Constructor & Destructor Documentation

◆ vtkMRMLInteractionWidget()

vtkMRMLInteractionWidget::vtkMRMLInteractionWidget ( )
protected

◆ ~vtkMRMLInteractionWidget()

vtkMRMLInteractionWidget::~vtkMRMLInteractionWidget ( )
overrideprotected

Member Function Documentation

◆ ApplyTransform()

virtual void vtkMRMLInteractionWidget::ApplyTransform ( vtkTransform * transform)
protectedpure virtual

◆ CanProcessInteractionEvent()

bool vtkMRMLInteractionWidget::CanProcessInteractionEvent ( vtkMRMLInteractionEventData * eventData,
double & distance2 )
overridevirtual

Return true if the widget can process the event.

Reimplemented from vtkMRMLAbstractWidget.

Reimplemented in vtkMRMLTransformHandleWidget.

◆ EndWidgetInteraction()

void vtkMRMLInteractionWidget::EndWidgetInteraction ( )
protected

◆ GetActiveComponentIndex()

virtual int vtkMRMLInteractionWidget::GetActiveComponentIndex ( )
virtual

◆ GetActiveComponentType()

virtual int vtkMRMLInteractionWidget::GetActiveComponentType ( )
virtual

◆ GetClassName()

virtual const char * vtkMRMLInteractionWidget::GetClassName ( )
virtual

◆ GetClosestPointOnInteractionAxis()

virtual bool vtkMRMLInteractionWidget::GetClosestPointOnInteractionAxis ( int type,
int index,
const double inputDisplay[2],
double outputIntersectionWorld[3] )
protectedvirtual

Get the closest point on the line defined by the interaction handle axis. Input coordinates are in display coordinates, while output are in world coordinates.

◆ GetInteractive()

bool vtkMRMLInteractionWidget::GetInteractive ( )
overridevirtual

Allows the widget to request interactive mode (faster updates)

Reimplemented from vtkMRMLAbstractWidget.

◆ GetIntersectionOnAxisPlane()

virtual bool vtkMRMLInteractionWidget::GetIntersectionOnAxisPlane ( int type,
int index,
const double inputDisplay[2],
double outputIntersectionWorld[3] )
protectedvirtual

Get the closest point on the plane defined using the interaction handle axis as the plane normal. Input coordinates are in display coordinates, while output are in world coordinates

◆ GetMouseCursor()

int vtkMRMLInteractionWidget::GetMouseCursor ( )
overridevirtual

Allows the widget to request a cursor shape.

Reimplemented from vtkMRMLAbstractWidget.

◆ GetMRMLNode()

virtual vtkMRMLNode * vtkMRMLInteractionWidget::GetMRMLNode ( )
protectedpure virtual

◆ IsA()

virtual int vtkMRMLInteractionWidget::IsA ( const char * type)
virtual

◆ IsTypeOf()

static int vtkMRMLInteractionWidget::IsTypeOf ( const char * type)
static

◆ JumpToHandlePosition()

virtual bool vtkMRMLInteractionWidget::JumpToHandlePosition ( int type,
int index )
protectedvirtual

◆ Leave()

void vtkMRMLInteractionWidget::Leave ( vtkMRMLInteractionEventData * eventData)
overridevirtual

Called when the the widget loses the focus.

Reimplemented from vtkMRMLAbstractWidget.

◆ PrintSelf()

void vtkMRMLInteractionWidget::PrintSelf ( ostream & os,
vtkIndent indent )
override

◆ ProcessCancelEvent()

virtual bool vtkMRMLInteractionWidget::ProcessCancelEvent ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

◆ ProcessEndMouseDrag()

virtual bool vtkMRMLInteractionWidget::ProcessEndMouseDrag ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

Reimplemented in vtkMRMLTransformHandleWidget.

◆ ProcessInteractionEvent()

bool vtkMRMLInteractionWidget::ProcessInteractionEvent ( vtkMRMLInteractionEventData * eventData)
overridevirtual

Process interaction event.

Reimplemented from vtkMRMLAbstractWidget.

Reimplemented in vtkMRMLTransformHandleWidget, and vtkSlicerMarkupsInteractionWidget.

◆ ProcessJumpCursor()

virtual bool vtkMRMLInteractionWidget::ProcessJumpCursor ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

Reimplemented in vtkMRMLTransformHandleWidget.

◆ ProcessMouseMove()

virtual bool vtkMRMLInteractionWidget::ProcessMouseMove ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

Callback interface to capture events when placing the widget. Return true if the event is processed.

Reimplemented in vtkMRMLTransformHandleWidget.

◆ ProcessWidgetMenu()

virtual bool vtkMRMLInteractionWidget::ProcessWidgetMenu ( vtkMRMLInteractionEventData * eventData)
protectedpure virtual

◆ ProcessWidgetMenuDisplayNodeTypeAndIndex()

virtual bool vtkMRMLInteractionWidget::ProcessWidgetMenuDisplayNodeTypeAndIndex ( vtkMRMLInteractionEventData * eventData,
vtkMRMLDisplayNode * displayNode,
int type,
int index )
protectedvirtual

◆ ProcessWidgetRotateStart()

virtual bool vtkMRMLInteractionWidget::ProcessWidgetRotateStart ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

◆ ProcessWidgetScaleStart()

virtual bool vtkMRMLInteractionWidget::ProcessWidgetScaleStart ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

◆ ProcessWidgetTranslateStart()

virtual bool vtkMRMLInteractionWidget::ProcessWidgetTranslateStart ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

◆ ProcessWidgetUniformScaleStart()

virtual bool vtkMRMLInteractionWidget::ProcessWidgetUniformScaleStart ( vtkMRMLInteractionEventData * eventData)
protectedvirtual

◆ RestoreInitialState()

virtual void vtkMRMLInteractionWidget::RestoreInitialState ( )
protectedvirtual

◆ RotateWidget()

virtual void vtkMRMLInteractionWidget::RotateWidget ( double eventPos[2])
protectedvirtual

◆ SafeDownCast()

static vtkMRMLInteractionWidget * vtkMRMLInteractionWidget::SafeDownCast ( vtkObject * o)
static

◆ SaveInitialState()

virtual void vtkMRMLInteractionWidget::SaveInitialState ( )
protectedvirtual

◆ ScaleWidget()

virtual void vtkMRMLInteractionWidget::ScaleWidget ( double eventPos[2],
bool uniform = false )
protectedvirtual

◆ SetActiveComponentIndex()

virtual void vtkMRMLInteractionWidget::SetActiveComponentIndex ( int index)
virtual

◆ SetActiveComponentType()

virtual void vtkMRMLInteractionWidget::SetActiveComponentType ( int type)
virtual

◆ StartWidgetInteraction()

void vtkMRMLInteractionWidget::StartWidgetInteraction ( vtkMRMLInteractionEventData * eventData)
protected

◆ TranslateWidget()

virtual void vtkMRMLInteractionWidget::TranslateWidget ( double eventPos[2])
protectedvirtual

Member Data Documentation

◆ LastEventPosition

double vtkMRMLInteractionWidget::LastEventPosition[2]
protected

Variables for translate/rotate/scale.

Definition at line 155 of file vtkMRMLInteractionWidget.h.

◆ OriginalStateNode

vtkSmartPointer<vtkMRMLNode> vtkMRMLInteractionWidget::OriginalStateNode { nullptr }
protected

Definition at line 157 of file vtkMRMLInteractionWidget.h.

◆ PreviewPointIndex

int vtkMRMLInteractionWidget::PreviewPointIndex
protected

Index of the control point that is currently being previewed (follows the mouse pointer). If <0 it means that there is currently no point being previewed.

Definition at line 123 of file vtkMRMLInteractionWidget.h.


The documentation for this class was generated from the following file: