Re: updating data interactively

Hi Vladimir,

> I would need to instantiate an Irregular1DSet
> WHITHOUT copying the samples... but the constructor
> that allows this is package private, why?

The idea is that Sets are supposed to be immutable, as
a thread-safeness measure.

> Actually, I need to interactively update the samples of the
> domain Set and the range Set of a FaltField
> Updating the range Set is easy, by using the method
> setSamples(float[][],boolean) of FlatField.
> (by seting boolean to false, you avoid copying the
> array, so if the array is modified, the graphic is updated)
> But there is no equivalent for the domain Set...
> because you can't avoid copying the samples!
> If I want to update the domain set, must I instantiate a new
> Irregular1DSet and a new FlatField?

Actually, you can even now do:

  Irregular1DSet set = ...
  float[][] samples = set.getSamples(false);

And this will give you a pointer to the actual samples array
inside set.

However, I have made the Irregular1DSet constructor with
'boolean copy' public, and it will be on our server the
next time I run the tests and update it.  Meanwhile, you can
edit your source to declare it public.

Note that plugging new values into the samples array
bypasses the VisAD event logic.  If you want your displays
to update, change range values by a call to
FlatField.setSamples(float[][] range, false)
after you update your domain Set samples.

The actual values of domain Set samples are not a big thread
safeness issue, but changes to domain Set length and other Field
metadata by one thread coulod cause Exceptions in other threads.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

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