Re: Data not rendering as IsoContour

Hi Russell,

> You may remember the LayerManager that is common to applications in the
> BoM from your last visit.  There are layers that each have a
> DataReference, and which generally respond to the LayerManager's request
> to set their visible state by calling renderer.toggle(boolean).  Because
> my application loads a fair number of layers at once, it spent a while
> rendering all the layers at that time, even though most of them were not
> visible immediately.  So we decided to have two fields in each layer and
> switch between them with dataRef.setData() as required.
>
> The layer has these fields:
>   field       (Time -> ((Nx,Ny)->Data))
>   nullField   (Time -> RealType.Generic)
>
> The domain sets of these two fields are the same because we need to
> ensure that the animation set never changes.  The range of nullField has
> been filled in with dummy data, ie setSample(i, new Real(i)) for each
> sample.  The point of nullField is that VisAD doesn't spend any time
> rendering it when the layer is not visible.
>
> When the layer is created, it does
>
>   dataRef.setData(nullField);
>
> When the layer is told to be visible, it does:
>
>    dataRef.setData(field);
>    renderer.toggle(true);
>
> When the layer is told to be invisible, it does:
>
>   dataRef.setData(nullField);
>   renderer.toggle(false);
>
> If we change this so that nullField is never used, we only call
> dataRef.setData(field) once, and only call renderer.toggle() when the
> layer changes visible state, then the contours are displayed as
> expected.

Thanks for this evidence, which suggests that this may be an
auto-scaling problem. So try this. Define a boolean variable
in your LayerManager:

  private contour_needs_initialize = true;

Then replace the code to make the layer visible:

  dataRef.setData(field);
  renderer.toggle(true);

by:

  if (contour_needs_initialize) {
    renderer.getDisplay().reAutoScale();
    contour_needs_initialize = false;
  }
  dataRef.setData(field);
  renderer.toggle(true);

Please let us know if this solves the problem.

> > You may be able to answer these questions by inserting calls to
> > DisplayImpl.printStack(String) in ContourControl.setMainContours()
> > and ContourControl.setSurfaceValue(), and include the value being
> > set in surfaceValue in the String argument to printStack(String).
>
> I'll try this soon, but in the meantime I hope the above information may
> be useful.

Oops, somehow I got it into my aging head that you were
talking about iso-surfaces when you were clearly talking
about 2-D iso-lines. So please forget about tracking
surfaceValue in setSurfaceValue() and setMainContours().

If my suggested fix above doesn't work, then you may need
to track down the information returned by
ContourControl.getLevels(), and the places that information
gets set in ContourControl [using calls to
DisplayImpl.printStack(String)]. But I'm hopeful that my
fix will work.

Cheers,
Bill


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