public class JGrassColorTable extends java.lang.Object
Colortables for GRASS 5 and greater are supported.
Format of the color file, which is located in location/mapset/colr/mapname:
The first line is a % character and two numbers indicating the minimum and maximum data values which have colors. Note that in JGrass after the range values we add a third value for alpha support.
After the first line, the list of color rules appears, that can be of the following formats:
value1:r:g:b value2:r:g:binterpolation of colors between the two values with the two colors
value1:r:g:bassumption that it means that value1 == value2
nv:r:g:bnovalues could also have color with such a rule.
|Constructor and Description|
Creates a new instance of ColorTable
|Modifier and Type||Method and Description|
Creates a default rainbow color table given a data range.
Getter for the alpha value.
Getter for the color rules.
parses a color rule.
public JGrassColorTable(JGrassMapEnvironment readerGrassEnv, double dataRange) throws java.io.IOException
readerGrassEnv- the grass environment used to identify paths.
dataRange- the datarange to be used if the native one is missing.
public static java.util.List<java.lang.String> createDefaultColorTable(double dataRange, int alpha)
dataRange- the data range for which the color table is created
value1:r:g:b value2:r:g:b alpha
public java.util.List<java.lang.String> getColorRules()
public int getAlpha()
public static void parseColorRule(java.lang.String rule, double values, java.awt.Color colors)
Arrays of doubles and colors have to be passed, that will be filled with the values of the color rule.
rule- the color rule as taken from the list returned by
values- the array of doubles to be filled with the values.
colors- the array of
Colorto be filled with the colors (can be null).
Copyright © 1996-2014 Geotools. All Rights Reserved.