Class ColorMaps
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionclosureMap
(Map<groovy.lang.Closure<Boolean>, COLOR> map) Returns a function which uses closure functions to determine which colors is returned for an input value.closureMap
(Map<groovy.lang.Closure<Boolean>, COLOR> map, Color outOfRangeColor) Returns a function which uses closure functions to determine which colors is returned for an input value.closureMap
(Map<groovy.lang.Closure<Boolean>, COLOR> map, Paint outOfRangeColor, Paint nullColor) Returns a function which uses closure functions to determine which colors is returned for an input value.heatMap
(double min, double max) Returns a heat map to map numerical values to colors.Returns a heat map to map numerical values to colors.Returns a heat map to map numerical values to colors.predicateMap
(Map<ColorMaps.SerializablePredicate<Double>, COLOR> map) Returns a function which uses predicate functions to determine which colors is returned for an input value.predicateMap
(Map<ColorMaps.SerializablePredicate<Double>, COLOR> map, Color outOfRangeColor) Returns a function which uses predicate functions to determine which colors is returned for an input value.predicateMap
(Map<ColorMaps.SerializablePredicate<Double>, COLOR> map, Paint outOfRangeColor, Paint nullColor) Returns a function which uses predicate functions to determine which colors is returned for an input value.MapsRange
s of values to specific colors.MapsRange
s of values to specific colors.MapsRange
s of values to specific colors.
-
Method Details
-
heatMap
Returns a heat map to map numerical values to colors.Values less than or equal to
min
return the starting color. Values greater than or equal tomax
return the ending color. Values in between this range are a linear combination of the RGB components of these two colors. Higher values return colors that are closer to the ending color, and lower values return colors that are closer to the starting color.Inputs that are null or Double.NaN return a null color.
- Parameters:
min
- minimummax
- maximum- Returns:
- function for mapping double values to colors. The starting color is blue (#0000FF) and the ending color is yellow (#FFFF00).
-
heatMap
public static Function<Double,Color> heatMap(double min, double max, Color startColor, Color endColor) Returns a heat map to map numerical values to colors.Values less than or equal to
min
return the starting color. Values greater than or equal tomax
return the ending color. Values in between this range are a linear combination of the RGB components of these two colors. Higher values return colors that are closer to the ending color, and lower values return colors that are closer to the starting color.Inputs that are null or Double.NaN return a null color.
- Parameters:
min
- minimummax
- maximumstartColor
- color at values less than or equal tomin
endColor
- color at values greater than or equal tomax
- Returns:
- function for mapping double values to colors
-
heatMap
public static Function<Double,Color> heatMap(double min, double max, Color startColor, Color endColor, Color nullColor) Returns a heat map to map numerical values to colors.Values less than or equal to
min
return the starting color. Values greater than or equal tomax
return the ending color. Values in between this range are a linear combination of the RGB components of these two colors. Higher values return colors that are closer to the ending color, and lower values return colors that are closer to the starting color.Inputs that are null or Double.NaN return a null color.
- Parameters:
min
- minimummax
- maximumstartColor
- color at values less than or equal tomin
endColor
- color at values greater than or equal tomax
nullColor
- color at null input values- Returns:
- function for mapping double values to colors
-
rangeMap
-
rangeMap
public static <COLOR extends Paint> Function<Double,Paint> rangeMap(Map<Range, COLOR> map, Color outOfRangeColor) -
rangeMap
public static <COLOR extends Paint> Function<Double,Paint> rangeMap(Map<Range, COLOR> map, Paint outOfRangeColor, Paint nullColor) -
predicateMap
public static <COLOR extends Paint> Function<Double,Paint> predicateMap(Map<ColorMaps.SerializablePredicate<Double>, COLOR> map) Returns a function which uses predicate functions to determine which colors is returned for an input value. For each input value, a map is iterated through until the predicate function (map key) returns true. When the predicate returns true, the associated color (map value) is returned. If no such predicate is found, an out of range color is returned.- Type Parameters:
COLOR
- type ofPaint
inmap
- Parameters:
map
- map fromColorMaps.SerializablePredicate
to color- Returns:
- function which returns the color mapped to the first
ColorMaps.SerializablePredicate
for which the input is true. Out of range, null, and NaN values return null.
-
predicateMap
public static <COLOR extends Paint> Function<Double,Paint> predicateMap(Map<ColorMaps.SerializablePredicate<Double>, COLOR> map, Color outOfRangeColor) Returns a function which uses predicate functions to determine which colors is returned for an input value. For each input value, a map is iterated through until the predicate function (map key) returns true. When the predicate returns true, the associated color (map value) is returned. If no such predicate is found, an out of range color is returned.- Type Parameters:
COLOR
- type ofPaint
inmap
- Parameters:
map
- map fromColorMaps.SerializablePredicate
to coloroutOfRangeColor
- color returned when the input satisfies noColorMaps.SerializablePredicate
in themap
- Returns:
- function which returns the color mapped to the first
ColorMaps.SerializablePredicate
for which the input is true. Null and NaN inputs return null.
-
predicateMap
public static <COLOR extends Paint> Function<Double,Paint> predicateMap(Map<ColorMaps.SerializablePredicate<Double>, COLOR> map, Paint outOfRangeColor, Paint nullColor) Returns a function which uses predicate functions to determine which colors is returned for an input value. For each input value, a map is iterated through until the predicate function (map key) returns true. When the predicate returns true, the associated color (map value) is returned. If no such predicate is found, an out of range color is returned.- Type Parameters:
COLOR
- type ofPaint
inmap
- Parameters:
map
- map fromColorMaps.SerializablePredicate
to coloroutOfRangeColor
- color returned when the input satisfies noColorMaps.SerializablePredicate
in themap
nullColor
- color returned when the input is null or Double.NaN- Returns:
- function which returns the color mapped to the first
ColorMaps.SerializablePredicate
for which the input is true
-
closureMap
public static <COLOR extends Paint> Function<Double,Paint> closureMap(Map<groovy.lang.Closure<Boolean>, COLOR> map) Returns a function which uses closure functions to determine which colors is returned for an input value. For each input value, a map is iterated through until the closure function (map key) returns true. When the closure returns true, the associated color (map value) is returned. If no such closure is found, an out of range color is returned.- Type Parameters:
COLOR
- type ofPaint
inmap
- Parameters:
map
- map fromClosure
to color- Returns:
- function which returns the color mapped to the first
Closure
for which the input is true. Out of range, null, and NaN inputs return null.
-
closureMap
public static <COLOR extends Paint> Function<Double,Paint> closureMap(Map<groovy.lang.Closure<Boolean>, COLOR> map, Color outOfRangeColor) Returns a function which uses closure functions to determine which colors is returned for an input value. For each input value, a map is iterated through until the closure function (map key) returns true. When the closure returns true, the associated color (map value) is returned. If no such closure is found, an out of range color is returned.- Type Parameters:
COLOR
- type ofPaint
inmap
- Parameters:
map
- map fromClosure
to coloroutOfRangeColor
- color returned when the input satisfies noClosure
in themap
- Returns:
- function which returns the color mapped to the first
Closure
for which the input is true. Null and NaN inputs return null.
-
closureMap
public static <COLOR extends Paint> Function<Double,Paint> closureMap(Map<groovy.lang.Closure<Boolean>, COLOR> map, Paint outOfRangeColor, Paint nullColor) Returns a function which uses closure functions to determine which colors is returned for an input value. For each input value, a map is iterated through until the closure function (map key) returns true. When the closure returns true, the associated color (map value) is returned. If no such closure is found, an out of range color is returned.- Type Parameters:
COLOR
- type ofPaint
inmap
- Parameters:
map
- map fromClosure
to coloroutOfRangeColor
- color returned when the input satisfies noClosure
in themap
nullColor
- color returned when the input is null or Double.NaN- Returns:
- function which returns the color mapped to the first
Closure
for which the input is true
-