>> One approach is to re-use DisplayImplJ3Ds rather than destroying
>> them and constructing new ones. Calls to its removeAllReferences()
>> and clearMaps() methods should set a DisplayImplJ3D up for re-use
>> (Dave or Curtis please correct me if anything else is needed).
>
>Won't work for me because I often have to change the DisplayRenderer of
>my DisplayImpl (DisplayRendererJ3D, TwoDDisplayRendererJ3D). Hence there
>is no setDisplayRenderer the only way to do this seems to be
>constructing a new display.
The way the VisAD SpreadSheet handles switching DisplayRenderers is
pretty simple: it constructs a separate display for each of the three
different DisplayRenderers available (DisplayRendererJ3D,
DisplayRendererJ2D, and TwoDDisplayRendererJ3D).
Then, whenever the user switches the dimension, it saves the maps and
references, clears them from the current Display, removes the Display
from the GUI, adds the new Display to the GUI, and adds the maps and
references back onto the new Display.
So, if you only have a small set of possible DisplayRenderers, you
could probably do something similar without too much overhead.
-Curtis