Section: Visualization Toolkit Widget Classes
.SECTION Event Bindings By default, the widget responds to the following VTK events (i.e., it watches the vtkRenderWindowInteractor for these events): <pre> LeftButtonPressEvent - add a point or select a handle (i.e., seed) RightButtonPressEvent - finish adding the seeds MouseMoveEvent - move a handle (i.e., seed) LeftButtonReleaseEvent - release the selected handle (seed) </pre>
Note that the event bindings described above can be changed using this class's vtkWidgetEventTranslator. This class translates VTK events into the vtkSeedWidget's widget events: <pre> vtkWidgetEvent::AddPoint -- add one point; depending on the state it may the first or second point added. Or, if near handle, select handle. vtkWidgetEvent::Completed -- finished adding seeds. vtkWidgetEvent::Move -- move the second point or handle depending on the state. vtkWidgetEvent::EndSelect -- the handle manipulation process has completed. </pre>
This widget invokes the following VTK events on itself (which observers can listen for): <pre> vtkCommand::StartInteractionEvent (beginning to interact) vtkCommand::EndInteractionEvent (completing interaction) vtkCommand::InteractionEvent (moving after selecting something) vtkCommand::PlacePointEvent (after point is positioned; call data includes handle id (0,1)) </pre>
To create an instance of class vtkSeedWidget, simply invoke its constructor as follows
obj = vtkSeedWidget
obj
is an instance of the vtkSeedWidget class.
string = obj.GetClassName ()
- Standard methods for a VTK class.
int = obj.IsA (string name)
- Standard methods for a VTK class.
vtkSeedWidget = obj.NewInstance ()
- Standard methods for a VTK class.
vtkSeedWidget = obj.SafeDownCast (vtkObject o)
- Standard methods for a VTK class.
obj.SetEnabled (int )
- The method for activiating and deactiviating this widget. This method
must be overridden because it is a composite widget and does more than
its superclasses' vtkAbstractWidget::SetEnabled() method.
obj.SetCurrentRenderer (vtkRenderer )
- Set the current renderer. This method also propagates to all the child
handle widgets, if any exist
obj.SetInteractor (vtkRenderWindowInteractor )
- Set the interactor. This method also propagates to all the child
handle widgets, if any exist
obj.SetRepresentation (vtkSeedRepresentation rep)
- Create the default widget representation if one is not set.
obj.CreateDefaultRepresentation ()
- Create the default widget representation if one is not set.
obj.SetProcessEvents (int )
- Methods to change the whether the widget responds to interaction.
Overridden to pass the state to component widgets.
obj.CompleteInteraction ()
- Method to be called when the seed widget should stop responding to
the place point interaction. The seed widget, when defined allows you
place seeds by clicking on the render window. Use this method to
indicate that you would like to stop placing seeds interactively. If
you'd like the widget to stop responding to *any* user interaction
simply disable event processing by the widget by calling
widget->ProcessEventsOff()
obj.RestartInteraction ()
- Method to be called when the seed widget should start responding
to the interaction.
vtkHandleWidget = obj.CreateNewHandle ()
- Use this method to programmatically create a new handle. In interactive
mode, (when the widget is in the PlacingSeeds state) this method is
automatically invoked. The method returns the handle created.
A valid seed representation must exist for the widget to create a new
handle.
obj.DeleteSeed (int n)
- Delete the nth seed.
vtkHandleWidget = obj.GetSeed (int n)
- Get the nth seed