FreeMat
|
Section: Visualization Toolkit Widget Classes
This 3D widget defines a line that can be interactively placed in a scene. The line has two handles (at its endpoints), plus the line can be picked to translate it in the scene. A nice feature of the object is that the vtkLineWidget, like any 3D widget, will work with the current interactor style and any other widgets present in the scene. That is, if vtkLineWidget does not handle an event, then all other registered observers (including the interactor style) have an opportunity to process the event. Otherwise, the vtkLineWidget will terminate the processing of the event that it handles.
To use this object, just invoke SetInteractor() with the argument of the method a vtkRenderWindowInteractor. You may also wish to invoke "PlaceWidget()" to initially position the widget. The interactor will act normally until the "i" key (for "interactor") is pressed, at which point the vtkLineWidget will appear. (See superclass documentation for information about changing this behavior.) By grabbing one of the two end point handles (use the left mouse button), the line can be oriented and stretched (the other end point remains fixed). By grabbing the line itself, or using the middle mouse button, the entire line can be translated. Scaling (about the center of the line) is achieved by using the right mouse button. By moving the mouse "up" the render window the line will be made bigger; by moving "down" the render window the widget will be made smaller. Turn off the widget by pressing the "i" key again (or invoke the Off() method). (Note: picking the line or either one of the two end point handles causes a vtkPointWidget to appear. This widget has the ability to constrain motion to an axis by pressing the "shift" key while moving the mouse.)
The vtkLineWidget has several methods that can be used in conjunction with other VTK objects. The Set/GetResolution() methods control the number of subdivisions of the line; the GetPolyData() method can be used to get the polygonal representation and can be used for things like seeding streamlines. Typical usage of the widget is to make use of the StartInteractionEvent, InteractionEvent, and EndInteractionEvent events. The InteractionEvent is called on mouse motion; the other two events are called on button down and button up (either left or right button).
Some additional features of this class include the ability to control the properties of the widget. You can set the properties of the selected and unselected representations of the line. For example, you can set the property for the handles and line. In addition there are methods to constrain the line so that it is aligned along the x-y-z axes.
To create an instance of class vtkLineWidget, simply invoke its constructor as follows
obj = vtkLineWidget
The class vtkLineWidget has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, obj
is an instance of the vtkLineWidget class.
string = obj.GetClassName ()
int = obj.IsA (string name)
vtkLineWidget = obj.NewInstance ()
vtkLineWidget = obj.SafeDownCast (vtkObject o)
obj.SetEnabled (int )
- Methods that satisfy the superclass' API. obj.PlaceWidget (double bounds[6])
- Methods that satisfy the superclass' API. obj.PlaceWidget ()
- Methods that satisfy the superclass' API. obj.PlaceWidget (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
- Set/Get the resolution (number of subdivisions) of the line. obj.SetResolution (int r)
- Set/Get the resolution (number of subdivisions) of the line. int = obj.GetResolution ()
- Set/Get the position of first end point. obj.SetPoint1 (double x, double y, double z)
- Set/Get the position of first end point. obj.SetPoint1 (double x[3])
- Set/Get the position of first end point. double = obj.GetPoint1 ()
- Set/Get the position of first end point. obj.GetPoint1 (double xyz[3])
- Set position of other end point. obj.SetPoint2 (double x, double y, double z)
- Set position of other end point. obj.SetPoint2 (double x[3])
- Set position of other end point. double = obj.GetPoint2 ()
- Set position of other end point. obj.GetPoint2 (double xyz[3])
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. obj.SetAlign (int )
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. int = obj.GetAlignMinValue ()
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. int = obj.GetAlignMaxValue ()
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. int = obj.GetAlign ()
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. obj.SetAlignToXAxis ()
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. obj.SetAlignToYAxis ()
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. obj.SetAlignToZAxis ()
- Force the line widget to be aligned with one of the x-y-z axes. Remember that when the state changes, a ModifiedEvent is invoked. This can be used to snap the line to the axes if it is orginally not aligned. obj.SetAlignToNone ()
- Enable/disable clamping of the point end points to the bounding box of the data. The bounding box is defined from the last PlaceWidget() invocation, and includes the effect of the PlaceFactor which is used to gram/shrink the bounding box. obj.SetClampToBounds (int )
- Enable/disable clamping of the point end points to the bounding box of the data. The bounding box is defined from the last PlaceWidget() invocation, and includes the effect of the PlaceFactor which is used to gram/shrink the bounding box. int = obj.GetClampToBounds ()
- Enable/disable clamping of the point end points to the bounding box of the data. The bounding box is defined from the last PlaceWidget() invocation, and includes the effect of the PlaceFactor which is used to gram/shrink the bounding box. obj.ClampToBoundsOn ()
- Enable/disable clamping of the point end points to the bounding box of the data. The bounding box is defined from the last PlaceWidget() invocation, and includes the effect of the PlaceFactor which is used to gram/shrink the bounding box. obj.ClampToBoundsOff ()
- Enable/disable clamping of the point end points to the bounding box of the data. The bounding box is defined from the last PlaceWidget() invocation, and includes the effect of the PlaceFactor which is used to gram/shrink the bounding box. obj.GetPolyData (vtkPolyData pd)
- Grab the polydata (including points) that defines the line. The polydata consists of n+1 points, where n is the resolution of the line. These point values are guaranteed to be up-to-date when either the InteractionEvent or EndInteraction events are invoked. The user provides the vtkPolyData and the points and polyline are added to it. vtkProperty = obj.GetHandleProperty ()
- Get the handle properties (the little balls are the handles). The properties of the handles when selected and normal can be manipulated. vtkProperty = obj.GetSelectedHandleProperty ()
- Get the handle properties (the little balls are the handles). The properties of the handles when selected and normal can be manipulated. vtkProperty = obj.GetLineProperty ()
- Get the line properties. The properties of the line when selected and unselected can be manipulated. vtkProperty = obj.GetSelectedLineProperty ()
- Get the line properties. The properties of the line when selected and unselected can be manipulated.