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
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>         at java.util.ArrayList.RangeCheck(
>         at java.util.ArrayList.get(
>         at
>         at
>         at visad.java3d.RendererJ3D.getBranch(
>         at LineTest6.displayChanged(
>         at visad.DisplayImpl.notifyListeners(
>         at visad.DisplayImpl.notifyListeners(
>         at visad.DisplayImpl.doAction(
>         at
>         at visad.util.ThreadPool$
> 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

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

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