[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ScreenLockedRendererJ3D()



Jim-

Jim Koutsovasilis wrote:
> thanks for the encouraging email.

Thanks for the code. ;-)

> We have disabled rotation by using MouseHelper.setFunctionMap(),
> so we don't experience the problem you are having.
> 
> I ran a quick test, and re-enabled rotation, and as you noted, the
> scale does behave strangely.  The scale was not written to handle
> rotation, and I'm not sure (off the top of my head) how I would
> go about changing SignalStrengthScale.redraw() to allow for this.

Since I'm not using SignalStrengthScale per-se but am using
ScreenLockedRendererJ3D(), I'm not using redraw so this is not
an issue.  I guess the issue is how the
ShadowScreenLockedFunctionTypeJ3D.ProjectionControlListener.controlChanged
method could be modified to handle shapes in general.

> SignalStrenghScale.setupDataCoords() converts from screen-coordinates
> to data-coordinates, so this is probably the place to account for rotation.
> 
> However, there is a bigger problem...SignalStrengthScale.java does
> not use the screen-locked renderer.  Instead, the scale is redrawn
> when the user releases the left mouse button (ie. the display may have
> been zoomed/panned).  So this is like "pseudo-screenlocked".
> 
> I have had problems with ShadowScreenLockedFunctionTypeJ3D to
> the point where I had to stop using it, and will be posting to the
> visad-renderer list soon.
> 
> By the way, your extension to ShadowScreenLockedFunctionTypeJ3D is
> spot-on.  That's exactly what I had done when I tried using the
> screen locked renderer for our radar rain-rate scale.  I haven't fed the
> changes back to Bill because I've had some problems with
> ShadowScreenLockedFunctionTypeJ3D.

Actually, there is one more tweak to this.  You need to make sure
that the transformGroup does not already have a parent before
calling addChild:

  /**
   * Adds the group to the scene graph hierarchy.
   * Create a new transform group and place the text under this
   * transform group.  This allows us to set the scale, translation
   * and rotation of the data independently of the rest of the nodes
   * in the scene graph.
   */
  public boolean addToGroup(Object group, VisADGeometryArray geomArray,
    GraphicsModeControl control, float alpha, float [] color)
    throws VisADException
  {
    if (transformGroup.getParent() == null) {
        ((Group) group).addChild(transformGroup);
    }
    return super.addToGroup(transformGroup, geomArray, control, alpha,
      color);
  }

Otherwise you get an Exception when there are multiple VisADGeometryArray
objects.

> I'll post an email to the visad-renderer list today/tomorrow.  I'll have to
> put together a sample program that illustrates the problem.

Okay.

> PS. as a quick fix to your problem, comment out the calls to
> SignalStrength.redraw(), except for this one:
> 
> if (!firstFrameDone) {
>  firstFrameDone = true;
>  redraw();
>  return;
> }
> 
> and use the attached "visad.bom.ShadowScreenLockedFunctionTypeJ3D.java".
> 
> This will draw the scale once, right at the start, when the rotation is 
> zero,
> and the scale will be locked to the screen, even if you try rotating.  The
> problems I am having are related to when the user pans/zooms while
> "please wait" is displayed, but I'll talk about that more in my 
> visad-renderer
> email.

Thanks for your help.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@unidata.ucar.edu                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************