Java Reference
In-Depth Information
Figure 8. Example picking controls on instruments
Some examples of the type of controls for the instruments in the application are shown
in Figure 8. In general, the behavior for interacting with these controls in the laboratory
are implemented in the following manner.
1. MainprocessStimulusfunction: This is given in Section H.32 and will be invoked
by the system whenever a mouse move event is detected. The closest object that
intersects with the picking ray is captured.
2. Object identification: The type and ID of the object being picked is then identified.
Specifically, button and knob objects can be differentiated based on the fact that a knob
is created by using TriangleFanArray while a button is created by using QuadArray.
The identity number of the object can be obtained by using the WhichObject function
in Section H.17.
3.
Manipulation: The turning of a knob is based on pressing the left button of the
mouse and dragging the mouse to turn the knob. As the mouse is dragged, the knob
should turn accordingly. The total angle of the mouse dragging operation relative
to the initial position when the mouse left button is first pressed corresponds to the
angle that the knob should be turned. In implementation, the first pressing of the
left button of the mouse will be detected and a knob turning operation will be taken
to have started. Then, the change in mouse movement will be detected periodically
while the mouse left button is held down. When this change exceeds the smallest
angle for turning the knob after an normalization operation to convert from screen
position to knob angle, the knob will be turned by invoking the appropriate function.
Also, the new knob position will be stored so that any further dragging of the mouse
will be regarded as relative to this position. The moving of sliders and the pressing
of buttons are simplier operations and are implemented in the same way.
4.
Visualization: To make it as user friendly as possible, a red dot will be displayed
when the mouse is over a control that has received focus. As shown in Figure 8, the
Search WWH ::




Custom Search