Re: resetting a DisplayImpl with new data

Robert S Laramee wrote:
> Hi Bill,
> 
> > Your code should work to display data the first time in the
> > display, but will not work to replace existing data in the
> > display by new data.  For that you would need (I think):
> > 
> >   display.clearMaps();
> > 
> > at the top of initializeMaps().
> > 
> > Does your code work to display data the first time (i.e.,
> > only fail when it comes time to replace data in the display)?
> 
> That is correct, it only fails when if comes time to replace data
> in the display.
> 
>       display.clearMaps();
> 
> by itself, does not seem to do the trick.  i noticed 2 lines in setting up
> the contour widget:
> 
>       ScalarMap mapContour=(ScalarMap)display.getMapVector().lastElement();
>       contourWidget = new ContourWidget(mapContour);
> 
> Do i have to update the ScalarMap for the contour widget as well?  If that
> is true, do i use this class ContourWidget.ContourRangeSlider?  i noticed
> it has a method:
> 
>       ContourRangeSlider.mapChanged();
> 
> Do i also have to call this method?  Does anyone know the actual syntax of
> accessing this class?  The documentation says it is an inner class of
> Contour Widget.

You might want to take a look at the switchDisplay() method in
visad/examples/DisplaySwitch.java.  This example switches all the
maps and data to a new display, rather than associating a new
dataset with an existing display, but you still might be able to
steal some code from it.

Specifically, look at the code concerning 'sMaps' and 'cMaps'.
It grabs the lists of ScalarMaps and ConstantMaps before calling
display.clearMaps(), then adds those maps back to the display.

If you add back the existing maps rather than creating new maps,
the ScalarMaps won't change and the ContourWidget will continue to
work.


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