KWWidgets/Projects/3DWidgets/Widgets/TheWidgets/BoxWidget

From KitwarePublic

Jump to: navigation, search

vtkBoxWidget

Description

Orthogonal hexahedron 3D widget
This 3D widget defines a region of interest that is represented by an arbitrarily oriented hexahedron with interior face angles of 90 degrees (orthogonal faces). The object creates 7 handles that can be moused on and manipulated. The first six correspond to the six faces, the seventh is in the center of the hexahedron. In addition, a bounding box outline is shown, the "faces" of which can be selected for object rotation or scaling. A nice feature of the object is that the vtkBoxWidget, like any 3D widget, will work with the current interactor style.
The vtkBoxWidget is very flexible. It can be used to select, cut, clip, or perform any other operation that depends on an implicit function (use the GetPlanes() method); or it can be used to transform objects using a linear transformation (use the GetTransform() method).

Classes Used

  • vtkAbstractWidget
  • vtkEventTranslator
  • vtkCallbackMapper
  • vtkWidgetRepresentation
  • vtkBoxWidget
  • vtkBoxRepresentation
  • vtkActor
  • vtkCellPicker
  • vtkPolyData
  • vtkPolyDataMapper
  • vtkProperty
  • vtkSphereSource
  • vtkTransform


Class Diagram

3DWidgets class arch box.jpg

Using the widget (example code)

vtkBoxWidget * boxWidget = vtkBoxWidget::New();
vtkBoxRepresentation * boxRep = boxWidget->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 boxRep as shown above, such as PlaceWidget(double bounds[6]).

To set a representation other than the default vtkBoxRepresentation, instead of calling boxWidget->GetRepresentation(), which instatiates the default representation if none exists, use SetRepresentation(vtkBoxRepresentation *r) to pass an instance of a representation inheriting from vtkBoxRepresentation.



KWWidgets: [Welcome | Site Map]