KWWidgets/Projects/3DWidgets/Widgets/TheWidgets/PolyDataSourceWidget
From KitwarePublic
vtkPolyDataSourceWidget
Description
- Abstract PolyDataSource-based 3D widget
- This abstract class serves as parent to 3D widgets that have simple vtkPolyDataSource instances defining their geometry. In addition to what is offered by the vtk3DWidget parent, this class makes it possible to manipulate the underlying polydatasource and to PlaceWidget() according to that, instead of having to make use of SetInput() or SetProp3D().
- Implementors of child classes HAVE to implement their PlaceWidget(bounds) to check for the existence of Input and Prop3D FIRST. If these don't exist, place according to the underlying PolyDataSource. Child classes also have to imprement UpdatePlacement(), which updates the widget according to the geometry of the underlying PolyDataSource.
Classes Used
- vtkPolyDataSourceWidget
- vtkPolyDataSourceRepresentation
Class Diagram

| |
Using the widget (example code)
vtkPolyDataSourceWidget * polyDataSourceWidget = vtkPolyDataSourceWidget::New();
vtkPolyDataSourceRepresentation * polyDataSourceRep = polyDataSourceWidget->GetRepresentation();
Basic event handling is automatically generated so no need to set up a callback/event translator unless you need to change the way the events are handled. In such a case use GetEventTranslator() which returns a pointer to the vtkWidgetEventTranslator in use. Thereafter, you can set event handling directly to this translator.
Anything affecting the widgets representation can be accessed using the polyDataSourceRep as shown above, such as PlaceWidget(double bounds[6]).
To set a representation other than the default vtkPolyDataSourceRepresentation, instead of calling polyDataSourceWidget->GetRepresentation(), which instantiates the default representation if none exists, use SetRepresentation(vtkPolyDataSourceRepresentation *r) to pass an instance of a representation inheriting from vtkPolyDataSourceRepresentation.

