Package org.opensourcephysics.display2d
Class ColorMapper
java.lang.Object
org.opensourcephysics.display2d.ColorMapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected ZExpansion
-
Constructor Summary
ConstructorsConstructorDescriptionColorMapper
(int _numColors, double _floor, double _ceil, int palette) Constructor ColorMapper -
Method Summary
Modifier and TypeMethodDescriptiondoubleToColor
(double value) Converts a double to a color.byte[]
doubleToComponents
(double value) Converts a double to color components.int
doubleToIndex
(double value) Converts a double to an index in the color array.double
getCeil()
Gets the ceiling color.Gets the ceiling color.static Color[]
getColorPalette
(int numColors, int paletteType) static Color[]
getColorPalette
(int numColors, int paletteType, byte[][] rgbs) Gets a array of colors for use in data visualization.double[]
Returns the thresholds for color change.double
getFloor()
Gets the floor.Gets the floor color;static XML.ObjectLoader
Gets a loader that allows a Circle to be represented as XML data.int
Gets the number of colors between the floor and ceiling values.int
Returns the color palette.indexToColor
(int index) Returns the color for an indexvoid
setColorPalette
(Color[] _colors) Sets the color palette.void
setFloorCeilColor
(Color _floorColor, Color _ceilColor) Sets the floor and ceiling colors.void
setNumberOfColors
(int _numColors) Sets the number of colorsvoid
setPaletteType
(int _paletteType) Sets the color palette.void
setScale
(double _floor, double _ceil) Sets the scale.void
setZMap
(ZExpansion map) Sets map for z values.Shows the color legend.void
updateLegend
(ZExpansion zMap)
-
Field Details
-
SPECTRUM
public static final int SPECTRUM- See Also:
-
GRAYSCALE
public static final int GRAYSCALE- See Also:
-
DUALSHADE
public static final int DUALSHADE- See Also:
-
RED
public static final int RED- See Also:
-
GREEN
public static final int GREEN- See Also:
-
BLUE
public static final int BLUE- See Also:
-
BLACK
public static final int BLACK- See Also:
-
WIREFRAME
public static final int WIREFRAME- See Also:
-
NORENDER
public static final int NORENDER- See Also:
-
REDBLUE_SHADE
public static final int REDBLUE_SHADE- See Also:
-
zMap
-
-
Constructor Details
-
ColorMapper
public ColorMapper(int _numColors, double _floor, double _ceil, int palette) Constructor ColorMapper- Parameters:
_numColors
-_floor
-_ceil
-palette
-
-
-
Method Details
-
updateLegend
-
getLegendFrame
-
showLegend
Shows the color legend. -
setScale
public void setScale(double _floor, double _ceil) Sets the scale.- Parameters:
_floor
-_ceil
-
-
doubleToComponents
public byte[] doubleToComponents(double value) Converts a double to color components.- Parameters:
value
- double- Returns:
- byte[]
-
doubleToColor
Converts a double to a color.- Parameters:
value
-- Returns:
- the color
-
doubleToIndex
public int doubleToIndex(double value) Converts a double to an index in the color array.- Parameters:
value
-- Returns:
- the index in the array with the following exceptions:
- -1 if floor color
- colors.length if ceil color
-
indexToColor
Returns the color for an index -
getColorThresholds
public double[] getColorThresholds()Returns the thresholds for color change. One more than colors, includes ceil and floor -
setZMap
Sets map for z values.- Parameters:
map
- ZExpansion
-
getFloor
public double getFloor()Gets the floor.- Returns:
-
getFloorColor
Gets the floor color;- Returns:
-
getCeil
public double getCeil()Gets the ceiling color.- Returns:
-
getCeilColor
Gets the ceiling color.- Returns:
-
getNumColors
public int getNumColors()Gets the number of colors between the floor and ceiling values.- Returns:
-
setFloorCeilColor
Sets the floor and ceiling colors.- Parameters:
_floorColor
-_ceilColor
-
-
getPaletteType
public int getPaletteType()Returns the color palette.- Returns:
- mode
-
setColorPalette
Sets the color palette.- Parameters:
_colors
-
-
setNumberOfColors
public void setNumberOfColors(int _numColors) Sets the number of colors- Parameters:
_numColors
-
-
setPaletteType
public void setPaletteType(int _paletteType) Sets the color palette.- Parameters:
_paletteType
-
-
getColorPalette
-
getColorPalette
Gets a array of colors for use in data visualization. Colors are similar to the colors returned by a color mapper instance.- Parameters:
numColors
-paletteType
-- Returns:
-
getLoader
Gets a loader that allows a Circle to be represented as XML data. Objects without XML loaders cannot be saved and retrieved from an XML file.- Returns:
- ObjectLoader
-