Print

Print


On Sat, Apr 4, 2009 at 8:47 PM, Gabriel Catalin Balan <[log in to unmask]> wrote:
> I belive you want Method 2: interpolation:
>
> public SimpleColorMap(double minLevel, double maxLevel, Color minColor, Color maxColor)
>
> what you're doing is Method 1: color table.
>
> public SimpleColorMap(Color[] colorTable)
>
> Here's the relevant part of the javadoc comment for the SimpleColorMap
> class:
>
> <li> Method 1: a color table.  The user can provide an array of Colors;
> if the numerical value, cast into an integer, is between 0 and (the
> length of this array - 1), then the appropriate Color is returned.
>
> <li> Method 2: color interpolation.  The user can provide a min-level,
> min-Color, max-level, and max-Color. If the numerical value is below
> min-level, then minColor is provided. If it's above max-level, then
> max-Color is provided.  If it's between min-level and max-level, then a
> linear interpolation between min-Color and max-Color is provided.

It seems to me that the SimpleColorMap is not so simple since it's
doing multiple things.  It probably should be broken into two
subclasses: DiscreteColorMap and ContinuousColorMap.  SimpleColorMap
means nothing since "simple" is an insufficient descriptor, but the
suggested subclasses' respective functionality is apparent from their
names.  I didn't even think to look at the documentation for the color
map because I suspected, incorrectly, the problem was elsewhere.  But
if those two subclasses were available I would have used the right one
from the start.