From KitwarePublic
Jump to: navigation, search



Position a point in 3D space
This 3D widget allows the user to position a point in 3D space using a 3D cursor. The cursor has an outline bounding box, axes-aligned cross-hairs, and axes shadows. (The outline and shadows can be turned off.) Any of these can be turned off. A nice feature of the object is that the vtkPointWidget, like any 3D widget, will work with the current interactor style.
Some additional features of this class include the ability to control the rendered properties of the widget. You can set the properties of the selected and unselected representations of the parts of the widget. For example, you can set the property of the 3D cursor in its normal and selected states.

Classes Used

  • vtkPointWidget
  • vtkPointRepresentation
  • vtkActor
  • vtkCellPicker
  • vtkCursor3D
  • vtkPolyDataMapper
  • vtkProperty

Class Diagram

3DWidgets class arch point.jpg

Using the widget (example code)

vtkPointWidget * pointWidget = vtkPointWidget::New();
vtkPointRepresentation * pointRep = PointWidget->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 pointRep as shown above, such as PlaceWidget(double bounds[6]).

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

KWWidgets: [Welcome | Site Map]