Re: Newbie questions: selecting objects, changing viewpoints, and

  • To: Harry Hochheiser <hsh@xxxxxxx>
  • Subject: Re: Newbie questions: selecting objects, changing viewpoints, and
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Thu, 5 Feb 2004 13:52:09 -0600 (CST)
Hi Harry,

> 1) Using PickManipulationRendererJ3D, I'd like to be able to have some
> way of telling what I've picked. Currently, I'm doing this by having a
> separate field and DataReferenceImpl for each thing that I might want
> to pick, and passing the Java object in to an appropriately designed
> subclass of CellImpl. Since there's a separate CellImpl for each
> object, I can then tell which object i've clicked on.
> This works, but seems a bit clunky. Is there a cleaner way to do it?

If the picked Data object is a Field or a Set, then you can
call the getCloseIndex() method of the PickManipulationRendererJ3D
to get the index of the Field or Set point that has been picked.
See the main() method of PickManipulationRendererJ3D for examples.

Other than that, you need to construct multiple CellImpls.

> 2) Having clicked on something, I'd like to remap its appearance, which
> is currently determined by a reference to a ConstantMap which defines
> colors and point sizes. What's the best way to go about redefining the
> constant map?

You can't change a ConstantMap (hence its name). You can either:

1. Call removeReference() for the Data, construct new and
   different ConstantMaps that you pass to a new call to
2. Put your Data in a Tuple with a bunch of Reals whose RealTypes
   are in ScalarMaps (instead of your ConstantMaps). To change
   mapped values, construct a new Tuple with changed Real values
   and your same old main Data.

The second option is usually best.

> 3) How would I go about changing the initial view (zoom and camera
> position) of a DisplayImplJ3D?

This would be via the getMatrix() and setMatrix of the
ProjectionControlJ3D that you get from the getProjectionControl()
method of the DisplayImplJ3D. The multiply_matrix() and
make_matrix() methods of MouseBehaviorJ3D (or the
static_multiply_matrix() and static_make_matrix()).

> 4) I'd like to revise the rotation behavior for the DisplayImpleJ3D.
> Specifically, I'd like to support (at the user's discretion) rotation
> that is constrained along one axis at a time. What would be the best
> way to do this?


The MouseHelper.setFunctionMap() method (for an example,
see visad/examples/ provides a lot of control
over how the mouse controls view changes, but constraining
rotation around one axis would require a custom
MouseBehaviorJ3D as described briefly at:

Good luck,