> I try to adjust the Scalar mapping for the RGB or IsoContour and having some
> problem in that. As far as I know, the VisAD is using the linear scaling
> method to map the colour for the values. My requirement is for a range of
> figures with negative and positive values, I want to specify a certain
> colour for -ve values, another colour for zero, and different colour again
> for +ve values. On top of that, the linear scaling can be applied for
> individual regions to project a better view. May I know how should I do
> that? Thank you for all who read my emails and response to my mail. Have a
> nice day.
Map colors like this:
int TABLE_SIZE = 256; // may be whatever you want
ScalarMap rgbMap = new ScalarMap(yourRealType, Display.RGB);
display.addMap(rgbMap):
rgbMap.setRange(lowValueOfRange, hiValueOfRange);
ColorControl rgbControl = (ColorControl) rgbMap.getControl();
float [][] table = new float[3][TABLE_SIZE];
for (int i=0; i<TABLE_SIZE; i++) {
table[0][i] = // red for i-th value
table[1][i] = // green for i-th value
table[2][i] = // blue for i-th value
}
rgbControl.setTable(table);
The table values are distributed linearly between lowValueOfRange
and hiValueOfRange, but you can make the table as large as
you like, by adjusting TABLE_SIZE, so the table itself can
approximate any non-linear color mapping.
Cheers,
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