Class 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
    • 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 as getColorMapGenerator(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 as getColorMapGenerator(String)
      • generateColorMap

        public ColorMap generateColorMap​(double min,
                                         double max)
        Generate a ColorMap 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
        Throws:
        SAXException
        IOException
        ParserConfigurationException
      • 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
      • hex2Rgb

        public static Color hex2Rgb​(String colorStr)
        Convert an hex color representation to a Color
        Returns:
        the Color instance related to that color HEX string