Re: IndexOutOfBoundsException with RendererJ3D

Hi Desiree,

> a few years ago you helped me to grab my created VisAD-Shape3Ds and put
> them into my own scenegraph.
> Today I tried to grab my newly created 3D-lines for the profile and put
> them into my scenegraph as well. Unforetunately I get an
> 
> J:\java\visad\tutorial>java LineTest6
> In enumeration
> Located Shape3D javax.media.j3d.Shape3D@d10a5c
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>         at java.util.ArrayList.RangeCheck(ArrayList.java:508)
>         at java.util.ArrayList.get(ArrayList.java:320)
>         at javax.media.j3d.GroupRetained.getChild(GroupRetained.java:408)
>         at javax.media.j3d.Group.getChild(Group.java:224)
>         at visad.java3d.RendererJ3D.getBranch(RendererJ3D.java:258)
>         at LineTest6.displayChanged(LineTest6.java:165)
>         at visad.DisplayImpl.notifyListeners(DisplayImpl.java:484)
>         at visad.DisplayImpl.notifyListeners(DisplayImpl.java:466)
>         at visad.DisplayImpl.doAction(DisplayImpl.java:1510)
>         at visad.ActionImpl.run(ActionImpl.java:303)
>         at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95)
> 
> exception the second time I try to get hold of the VisAD-BranchGroup.
> 
> A little test programm trying to simulate the flow is attached:
> 
> First I am creating my terrain and add it two the view.
> The terrain is grabbed and in reality put into my own scene.
> After that I am creating my 3D-line and add it into the VisAD-View (In
> reality I need some user input to create the clipping plane).
> Trying to grab the VisAD BranchGroup a second time, directs me to the
> error.
> 
> I was thinking of not detaching the BranchGroup in the first place, so
> that I only need to grap the group once. But then I am not allowed to look
> for the geometry, because of capability bits, which are not set.

Your call to 'branchGroup.detach()' is certainly causing this
Exception.

> Can I avoid the error?
> Is it possible to reattach the VisAD-BranchGroup, and would that help?
> Or is there another solution?

One solution may be to call removeReference() after you
detach the BranchGroup. I am not sure that wouldn't trigger
an Exception, but if it doesn't it would be an easy solution.

Another solution may be to extend DefaultRendererJ3D and
override its doTransform() method to be exactly the same
code as DefaultRendererJ3D, except to copy the contents
of 'branch' before returning it (to RendererJ3D.doAction()
which then adds it to the live scene graph).

Good luck,
Bill


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