Re: Using data depictions to select a region...

Hi Pablo,

> Hi, I am new at this VisAD stuff, the only thing I can tell by now is that
> it looks great.
> I am trying (unsuccessfully) to put some code into de VisAd Spreadsheet so I
> can use a couple depiction points to select a region. Could you please give
> an idea (or example) of how to do that.

First, the cleanest way to customize the SpreadSheet is by
extending the visad.ss.SpreadSheet and visad.ss.FancySSCell
classs.  You can override the SpreadSheet.createCell() method
to consruct your extension of FancySSCell, where you can do
all sorts of manipulations with the cell's DisplayImpl.

This way your code remains consistent with future changes
to VisAD, rather than having your own private version of
the code.  You invoke such a custom SpreadSheet by:

  java your.package.YourExtensionOfSpreadSheet

You can implement a DisplayListener that listens for listens
for various DisplayEvent.MOUSE_PRESSED*, then apply the logic
described in:

  http://www.unidata.ucar.edu/staff/russ/visad/msg01075.html
  http://www.unidata.ucar.edu/staff/russ/visad/msg00862.html

to transform mouse locations to data locations for selecting
data.

Alternatively, you can link RealTuple objects to the DisplayImpl
via DirectManiplutationRendererJ*D, where the user drags these
in the display to drive data selection.  The Test27.java program
in visad/examples is a simple example of using draggable points
to drive display scaling.

You might set all this up in the in the constructDisplay()
method of your extension of FancySSCell, overriding its
implementation in BasicSSCell  [Curtis, please correct me
if there's a better place to do this].

This task will require understanding a variety of VisAD issues.
So please experiment, but also let us know if you have questions
or problems.

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