Re: change color optimization

Hi Doug,
> I have a bunch of station data with many time samples of each. I'm
> displaying them with shapes ( time -> ((x,y,z) -> (color, shape)) ). I
> use the "color" type to map to RGB. I give it a constant color by giving
> BaseColorControl a table with a single color. Thus, I can easily change
> colors of my shapes via the BaseColorControl. I map time to Animation to
> get the sample I want.
>
> Unfortunately, if I change the color of one shape, VisAD seems to be
> working very hard with everything in the display instead of only the
> shape being modified. All the data in the display blinks during this and
> is not pretty. It's not so bad without the Animation map, but it still
> seems slow. I tried display.disableAction() before calling
> control.setTable() but that doesn't seem to help.
>
> Any ideas how to optimize changing colors (and other properties via
> controls)?
When a Control changes (e.g., a ColorControl.setColorTable()
call), the unit of re-transform is each Data object under
DataReferences linked to the Display (the only current
exception to this is for time sequences of images using
ImageRendererJ3D). And every Data object will be transformed
that includes the affected Real (in your case, every Data
object that includes 'color').
Armed with this understanding, there are several approaches
to reducing the size of retransformed units of Data. The
most obvious is to divide your Field of stations into a
number of fields with only a few stations each (or even
into a RealTuple for each station), and give each of these
Fields or RealTuples a different color RealType. For example,
Real("color1"), Real("color2"), etc. And each of these "color"
RealTypes would have its own ScalarMap to RGB and its own
ColorControl.
Another approach is to put each station in its own RealTuple
'rt', then to combine this into a Tuple (r, g, b, rt) that is
linked to the Display via its own DataReference. Of course the
Reals r, g and b would have their RealTypes mapped to Red, Green
and Blue. Each time you want to change its color, construct new
Reals r, g and b, and:
new Tuple(new Data[] {r, g, b, rt}, false)
then pass this to setData().
Good luck,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html