Re: identify data by mouseclick

Hi Sven,

> i'm just starting with visad. i have several data in a function (index) ->
> (xCoord,yCoord,color) and want to show the points in a 2D display. that's
> not the problem. now i have to find the index of a point by mouse-clicking
> on it. How can i do this? is it possible to highlight the current point?

You can use to do
this. See its main() method for an example of how to use
PickManipulationRendererJ3D. Note that field1d has MathType
(x -> y) and is linked to display using the
PickManipulationRendererJ3D pmr1d. Right mouse clicks on
the depiction of field1d trigger the doAction() method of
cellfield1d, and in that method a call to pmr1d.getCloseIndex()
returns the index of the sample in field1d closest to the
mouse click.

To highlight the point in your own Field (index -> (xCoord,yCoord,color)),
you could do something like:

  int index = pmr1d.getCloseIndex();
  RealTuple rt = field.getSample(index);

Tnen link rt to display, possibly using a ConstantMap to
PointSize to make a large point.

Good luck,
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738