Hi Jim,
You can make it work OK by inserting:
display.reAutoScale();
before:
dataRef.setData(createField());
I will have to look into whether this should be necessary,
but am travelling right now and will have to look into it
later. The reAutoScale() sets a correct setRange() for the
ScalarMap to RGBA, which does not get set for the UnionSet.
Cheers,
Bill
On Fri, 2 May 2003, Jim Koutsovasilis wrote:
> Hello,
>
> we are having a problem which involves a data reference
> being used for a UnionSet, and then for a FlatField.
>
> When the data reference's setData() is initially passed a
> UnionSet, the data is displayed. Sometime later, the
> data reference's setData() is called again, but this time
> a FlatField is passed to it.
>
> The results are inconsistant. Sometimes the FlatField
> is displayed, and sometimes it isn't.
>
> Attached is a sample program (DataRefBug.java)
> which illustrates the problem.
>
> You can run it in 2 ways:
>
> > java DataRefBug
> - will display the UnionSet data first (a cross). Click on
> the "Change Data" button, and the data reference's
> setData() is passed a FlatField. In all our tests, the
> visad window goes black, and the FlatField is not shown.
>
> OR
>
> > javaDataRefBug 0
> - will display the FlatField first. Click on the "Change Data"
> button, and the data reference's setData() is passed a
> UnionSet. In all our tests, this works and the UnionSet
> data is shown.
>
> You can continue to click the "Change Data" button to cycle
> between the UnionSet data and the FlatField data.
>
> Does anyone have any ideas?
>
> Why does the display correctly update when the FlatField
> is shown first and not when the UnionSet is shown first?
>
> Thanks,
> Jim.
> ---
> Jim Koutsovasilis
> Bureau of Meteorology, Australia
> jimk@xxxxxxxxxx
>
>