Re: Mouse Interactions with VisAD

Hi Yuan,
 
> I am writing a program to visualize some isosurface. We would
> like to get an active interface. That is, in response to users
> moving mouse, our program will generate control events
> implicitly according to current mouse location.
 
You might also consider another approach, where VisAD does
more of the work for you.  You can addReference Data objects
to Displays using DirectManipulationRendererJ3D (or ...J2D)
and when the user drags the depictions of these Data objects
with the mouse, the values of the Data objects change.  See
Test00.java and Test27.java in the visad/examples directory
for examples.  You can also link these same DaatReferences
to CellImpls that compute things and change Display states
in response to the user mouse drags.  Test27.java calls
setRange on spatial ScalarMaps to zoom the display.
 
You can also map RealTypes in the Data objects to
Display.Shape in order to make custom cursors to drag.  See
visad/rabin/Rain.java for an example.  In order to control
iso-surfaces, the CellImpl linked to the draggable Data object
would invoke the setSurfaceValue() method of the ContourControl
returned by getControl() of the ScalarMap to Display.IsoContour.
 
Note that the user drags these data depictions using the right
mouse button.
 
Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html