Package ucar.unidata.util
Class ColorTable
java.lang.Object
ucar.unidata.util.ColorTable
- All Implemented Interfaces:
NamedObject
Holds a name and a 2D float array that represents a color table
- Author:
- IDV development team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A class to hold color table breakpoint information -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
the Atd-Radar categorystatic final String
The "Basic" categorystatic final String
The Miscellaneous categorystatic final String
The Radar categorystatic final String
The Satellite categorystatic final String
The solid categorystatic final int
Alpha indexstatic final int
Blue indexstatic final int
Green indexstatic final int
Red index -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorColorTable
(String name, String category, float[][] table) Create a new ColorTable.ColorTable
(String id, String name, String category, float[][] table) Create a new ColorTable.ColorTable
(String id, String name, String category, float[][] table, boolean tableFlipped) Create a new ColorTable.ColorTable
(ColorTable otherTable) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic final float[][]
addAlpha
(float[][] colorTable) Make a color-alpha table for VisAD displays mapped to Display.RGBA; the 4th entry at each level being alpha (1.0) for transparency.static final float[][]
addAlpha
(ColorTable colorTable) Wrapper aroundaddAlpha(float[][])
.static final float[][]
changeTransparency
(float[][] colorTable, float alpha) Revise a color-alpha table for VisAD displays mapped to Display.RGBA; the 4th entry at each level (alpha) is reset to input arg alphaOutput the table as a String.boolean
equalsTable
(ColorTable other) See if another color table is equivalent to this oneboolean
Get the active flag.float[][]
Get the table with alpha.Get the breakpoints for this table.Get the table category.Convert the colorTable into a list of Color-sgetColorList
(boolean includeAlpha) Convert the colorTable into a list of Color-sfloat[][]
Get the color table pallette.Get the table descriptiongetId()
Get the ID of this tablegetName()
Get the name of this table.float[][]
Get the table without alpha values.getRange()
Get the Range for this color table.float[]
Get the ScaleFactor property.float[][]
getTable()
Get the color table palette Note: this is around for legacy purposes and we will move to a new setTableArray/getTableArray methodinit
(String name, String category, ArrayList colors, ArrayList scales, ArrayList breakpoints, Range r) Initialize a color table a new ColorTable.Initialize a color table a new ColorTable.print()
Print the table infostatic final float[][]
removeAlpha
(float[][] colorTable) Remove the alpha valuesvoid
setActive
(boolean a) Set the active flag.void
Set the breakpoints for this color table.void
setCategory
(String category) Set the table category.void
setDescription
(String description) Set the table descriptionvoid
Set the id of this tablevoid
Set the name of this tablevoid
Set the range for this table.void
setScaleFactor
(float[] value) Set the ScaleFactor property.void
setTable
(float[][] table) Set the color table palette Note: this is around for legacy purposes and we will move to a new setTableArray/getTableArray methodvoid
Set the table with a list of colorsvoid
setTableArray
(float[][] table) Set the table arrayvoid
setTransparency
(float alpha) Set the transparencytoString()
Get a descriptive String for this object.
-
Field Details
-
IDX_RED
public static final int IDX_REDRed index- See Also:
-
IDX_GREEN
public static final int IDX_GREENGreen index- See Also:
-
IDX_BLUE
public static final int IDX_BLUEBlue index- See Also:
-
IDX_ALPHA
public static final int IDX_ALPHAAlpha index- See Also:
-
CATEGORY_BASIC
The "Basic" category- See Also:
-
CATEGORY_MISC
The Miscellaneous category- See Also:
-
CATEGORY_SATELLITE
The Satellite category- See Also:
-
CATEGORY_RADAR
The Radar category- See Also:
-
CATEGORY_SOLID
The solid category- See Also:
-
CATEGORY_ATD_RADAR
the Atd-Radar category- See Also:
-
-
Constructor Details
-
ColorTable
Copy constructor- Parameters:
otherTable
- other table to copy
-
ColorTable
public ColorTable()Default constructor -
ColorTable
Create a new ColorTable.- Parameters:
name
- name of the tablecategory
- category of the tabletable
- table values
-
ColorTable
Create a new ColorTable.- Parameters:
id
- id of the tablename
- name of the tablecategory
- category of the tabletable
- table values
-
ColorTable
Create a new ColorTable.- Parameters:
id
- id of the tablename
- name of the tablecategory
- category of the tabletable
- table valuestableFlipped
- flipped flag
-
-
Method Details
-
init
public ColorTable init(String name, String category, ArrayList colors, ArrayList breakpoints, Range r) Initialize a color table a new ColorTable.- Parameters:
name
- name of the tablecategory
- category of the tablecolors
- table colorsbreakpoints
- breakpointsr
- Range of values- Returns:
- filled in ColorTable
-
init
public ColorTable init(String name, String category, ArrayList colors, ArrayList scales, ArrayList breakpoints, Range r) Initialize a color table a new ColorTable.- Parameters:
name
- name of the tablecategory
- category of the tablecolors
- table colorsscales
- scale factorsbreakpoints
- breakpointsr
- Range of values- Returns:
- filled in ColorTable
-
equalsTable
See if another color table is equivalent to this one- Parameters:
other
- other table to check- Returns:
- true ifthey are equal.
-
setRange
Set the range for this table.- Parameters:
r
- range
-
getRange
Get the Range for this color table.- Returns:
- the range
-
setActive
public void setActive(boolean a) Set the active flag.- Parameters:
a
- true for active
-
getActive
public boolean getActive()Get the active flag.- Returns:
- true if active
-
setBreakpoints
Set the breakpoints for this color table.- Parameters:
l
- list of breakpoints
-
getBreakpoints
Get the breakpoints for this table.- Returns:
- the breakpoints
-
getNonAlphaTable
public float[][] getNonAlphaTable()Get the table without alpha values.- Returns:
- table with alpha removed.
-
getAlphaTable
public float[][] getAlphaTable()Get the table with alpha.- Returns:
- the alpha table
-
getColorTable
public float[][] getColorTable()Get the color table pallette. This applies any scale factor.- Returns:
- the table of values
-
setTable
public void setTable(float[][] table) Set the color table palette Note: this is around for legacy purposes and we will move to a new setTableArray/getTableArray method- Parameters:
table
- table of values
-
getTable
public float[][] getTable()Get the color table palette Note: this is around for legacy purposes and we will move to a new setTableArray/getTableArray method- Returns:
- get the color table as a float array
-
setTableArray
public void setTableArray(float[][] table) Set the table array- Parameters:
table
- the table as a float array
-
getName
Get the name of this table.- Specified by:
getName
in interfaceNamedObject
- Returns:
- the name of this table
-
setName
Set the name of this table- Specified by:
setName
in interfaceNamedObject
- Parameters:
name
- the new name
-
getId
Get the ID of this table- Returns:
- the id
-
setId
Set the id of this table- Parameters:
id
- the table id
-
getDescription
Get the table description- Specified by:
getDescription
in interfaceNamedObject
- Returns:
- the table description
-
setDescription
Set the table description- Parameters:
description
- the table description
-
getCategory
Get the table category.- Returns:
- the table category
-
setCategory
Set the table category.- Parameters:
category
- the new category
-
dataToString
Output the table as a String.- Returns:
- the table values as a string.
-
print
Print the table info- Returns:
- the table info
-
toString
Get a descriptive String for this object. -
setTable
Set the table with a list of colors- Parameters:
colors
- list of colors
-
getColorList
Convert the colorTable into a list of Color-s- Returns:
- list of colors
-
getColorList
Convert the colorTable into a list of Color-s- Parameters:
includeAlpha
- true to use alpha- Returns:
- list of colors
-
addAlpha
Wrapper aroundaddAlpha(float[][])
.- Parameters:
colorTable
- color table to use- Returns:
- color table values
-
removeAlpha
public static final float[][] removeAlpha(float[][] colorTable) Remove the alpha values- Parameters:
colorTable
- color table values- Returns:
- color table values without alpha
-
addAlpha
public static final float[][] addAlpha(float[][] colorTable) Make a color-alpha table for VisAD displays mapped to Display.RGBA; the 4th entry at each level being alpha (1.0) for transparency.- Parameters:
colorTable
- a float [3][len], any usual VisAd color table- Returns:
- float[4][len] the color table
-
setTransparency
public void setTransparency(float alpha) Set the transparency- Parameters:
alpha
- the alpha value
-
changeTransparency
public static final float[][] changeTransparency(float[][] colorTable, float alpha) Revise a color-alpha table for VisAD displays mapped to Display.RGBA; the 4th entry at each level (alpha) is reset to input arg alpha- Parameters:
colorTable
- a float [4][len], a VisAd color-alpha tablealpha
- the new alpha value- Returns:
- float[4][len] the revised color table: same colors; new alpha
-
setScaleFactor
public void setScaleFactor(float[] value) Set the ScaleFactor property.- Parameters:
value
- The new value for ScaleFactor
-
getScaleFactor
public float[] getScaleFactor()Get the ScaleFactor property.- Returns:
- The ScaleFactor
-