Re: Controls for display.Value

Hi Vic,

> Earlier on in the year Bill passed on this code fragment to Mike Ashworth for
> setting up a colour table:
>   ColorControl control = (ColorControl) RGBMap.getControl();
>   float[][] table = new float[3][table_length];
>   for (int i=0; i<table_length; i++) {
>     table[0][i] = ... // red for i, between 0.0f and 1.0f
>     table[1][i] = ... // green for i
>     table[2][i] = ... // blue for i
>   }
>   control.setTable(table)
> I'm trying to do a similar thing as Mike - I'm using a Linear2DSet to load
> Ocean bathymetry in as a surface but want to mask out the land. Making my own
> Delauney seems a little too difficult at the moment and making the land black
> using a ColourMapWidget when I map the bathymetry to RGB seems to work fine.
> (and looks marvellous on a spherical projection!). However, as I'm using RGB
> values for another dataset in the same scene I'm using Display.Value to give
> a greyscale value to my bathymetry surface. The trouble is I cant find either
> an equivalent to ColourMapWidget or ColorControl for Value. Is there one? I'd
> like to say I could have a go at writing one if not but I'm quite doubtfull.

ColorControl and ColourMapWidget are used with ScalarMaps to
Display.RGB in order to control the function from 1-D value
to 3-D RGB space. However, a ScalarMap to Display.Value defines
a function from 1-D value to 1-D Display.Value, which is linear
with details controlled by the setRange() of the ScalarMap.

A ScalarMap to Display.HSV defines a function from 1-D value to
3-D HSV (i.e., Hue, Saturation, Value) space and can be
controlled via ColorControl (note Hue values are in the range
0.0 to 360.0 rather than 0.0 to 1.0 for other color components).
But we have never written widgets appropriate for ColorControls
with ScalarMaps to HSV or CMY.

Good luck,

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