Re: Newbie questions: selecting objects, changing viewpoints,

  • To: Harry Hochheiser <hsh@xxxxxxx>
  • Subject: Re: Newbie questions: selecting objects, changing viewpoints,
  • From: Curtis Rueden <curtis@xxxxxxxxxxxxx>
  • Date: Thu, 05 Feb 2004 13:37:08 -0600
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?

I'm no expert on PickManipulationRenderer, so I'll have to pass this one off to 
someone else.

>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?

Instead of using ConstantMaps to color, you could use ScalarMaps, and have the 
color values be range values of a field. Then it's easy to change the colors 
with FieldImpl or FlatField's setSamples method. Changing PointSize dynamically 
is trickier, since you can't use a ScalarMap to PointSize. Maybe someone else 
knows an easier way to do it than to remove and re-add your data reference.

Personally, I recommend against using a variable PointSize to represent some 
aspect of the data, since the point size is fixed with respect to zoom. (That's 
why I suggested using Display.Shape instead when we talked before. Speaking of 
which, I notice you haven't mentioned it. Did you get it figured out?)

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

DisplayImpl.getProjectionControl().setMatrix(double[][]) lets you set the 
display's orientation and aspect ratio however you want. Just construct an 
appropriate matrix before showing the display onscreen. These matrices are 
standard 4x4 3D projection matrices.

>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?

I think the cleanest way to do this would be to create a subclass of 
visad.java3d.MouseBehaviorJ3D and visad.MouseHelper. If you take a look at 
MouseBehaviorJ3D.processStimulus, you'll see that the actual processing for 
mouse events is done in MouseHelper.processEvent, which would be the core 
method for handling your custom logic.


  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: