Class ColorMapper

java.lang.Object
org.opensourcephysics.display2d.ColorMapper

public class ColorMapper extends Object
  • Field Details

  • Constructor Details

    • ColorMapper

      public ColorMapper(int _numColors, double _floor, double _ceil, int palette)
      Constructor ColorMapper
      Parameters:
      _numColors -
      _floor -
      _ceil -
      palette -
  • Method Details

    • updateLegend

      public void updateLegend(ZExpansion zMap)
    • getLegendFrame

      public JFrame getLegendFrame()
    • showLegend

      public JFrame 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

      public Color doubleToColor(double value)
      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

      public Color indexToColor(int index)
      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

      public void setZMap(ZExpansion map)
      Sets map for z values.
      Parameters:
      map - ZExpansion
    • getFloor

      public double getFloor()
      Gets the floor.
      Returns:
    • getFloorColor

      public Color getFloorColor()
      Gets the floor color;
      Returns:
    • getCeil

      public double getCeil()
      Gets the ceiling color.
      Returns:
    • getCeilColor

      public Color getCeilColor()
      Gets the ceiling color.
      Returns:
    • getNumColors

      public int getNumColors()
      Gets the number of colors between the floor and ceiling values.
      Returns:
    • setFloorCeilColor

      public void setFloorCeilColor(Color _floorColor, Color _ceilColor)
      Sets the floor and ceiling colors.
      Parameters:
      _floorColor -
      _ceilColor -
    • getPaletteType

      public int getPaletteType()
      Returns the color palette.
      Returns:
      mode
    • setColorPalette

      public void setColorPalette(Color[] _colors)
      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

      public static Color[] getColorPalette(int numColors, int paletteType)
    • getColorPalette

      public static Color[] getColorPalette(int numColors, int paletteType, byte[][] rgbs)
      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

      public static XML.ObjectLoader 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