Class GradientColorMapGenerator
- Object
-
- GradientColorMapGenerator
-
public class GradientColorMapGenerator extends Object
A class mainly used to parse an SVG file and create a ColorMap on top of the LinearGradientEntry contained on it, or create a ColorMap on top of a ";" separated values list of colors such as: rgb(0,0,255);rgb(0,255,0);rgb(255,0,0);... or #0000FF;#00FF00;#FF0000 as an instance. *- Author:
- Daniele Romagnoli, GeoSolutions SAS
-
-
Field Summary
Fields Modifier and Type Field Description static String
HEX_INLINEVALUE_MARKER
static String
HEX2_INLINEVALUE_MARKER
static String
RGB_INLINEVALUE_MARKER
static String
RGBA_INLINEVALUE_MARKER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorMap
generateColorMap(double min, double max)
Generate aColorMap
object, by updating the ColorMapEntries quantities on top of the min and max values reported here.static GradientColorMapGenerator
getColorMapGenerator(File file)
Get an SVG ColorMap generator for the specified filestatic GradientColorMapGenerator
getColorMapGenerator(String colorValues)
Get an SVG ColorMap generator for the specified filestatic Color
hex2Rgb(String colorStr)
Convert an hex color representation to aColor
void
setAfterColor(Color color)
Sets the color to be used after the max value.void
setAfterColor(String color)
Sets the color to be used after the max value, as a string, it accepts the same syntax asgetColorMapGenerator(String)
void
setBeforeColor(Color color)
Sets the color to be used before the min value.void
setBeforeColor(String color)
Sets the color to be used before the min value, as a string, it accepts the same syntax asgetColorMapGenerator(String)
-
-
-
Field Detail
-
RGB_INLINEVALUE_MARKER
public static final String RGB_INLINEVALUE_MARKER
- See Also:
- Constant Field Values
-
RGBA_INLINEVALUE_MARKER
public static final String RGBA_INLINEVALUE_MARKER
- See Also:
- Constant Field Values
-
HEX_INLINEVALUE_MARKER
public static final String HEX_INLINEVALUE_MARKER
- See Also:
- Constant Field Values
-
HEX2_INLINEVALUE_MARKER
public static final String HEX2_INLINEVALUE_MARKER
- See Also:
- Constant Field Values
-
-
Method Detail
-
setBeforeColor
public void setBeforeColor(Color color)
Sets the color to be used before the min value. By default it's transparent
-
setBeforeColor
public void setBeforeColor(String color)
Sets the color to be used before the min value, as a string, it accepts the same syntax asgetColorMapGenerator(String)
-
setAfterColor
public void setAfterColor(Color color)
Sets the color to be used after the max value. By default it's transparent
-
setAfterColor
public void setAfterColor(String color)
Sets the color to be used after the max value, as a string, it accepts the same syntax asgetColorMapGenerator(String)
-
generateColorMap
public ColorMap generateColorMap(double min, double max)
Generate aColorMap
object, by updating the ColorMapEntries quantities on top of the min and max values reported here.
-
getColorMapGenerator
public static GradientColorMapGenerator getColorMapGenerator(File file) throws SAXException, IOException, ParserConfigurationException
Get an SVG ColorMap generator for the specified file
-
getColorMapGenerator
public static GradientColorMapGenerator getColorMapGenerator(String colorValues) throws IOException, ParserConfigurationException
Get an SVG ColorMap generator for the specified file- Parameters:
colorValues
- ";" separated list of colors in the form c1;c2;c3;... where each color can use syntaxes as rgb(r0,g0,b0), rgba(r0,g0,b0,alpha_0_to_1), #RRGGBB or 0xRRGGBB- Throws:
IOException
ParserConfigurationException
-
-