Class ColorScale

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class ColorScale
    extends Object
    implements Cloneable, Serializable
    A ColorScale is used for false-color data mapping. It contains an array of java.awt.Color, along with an assignment of a data interval to each Color.

    ColorScale.Panel handles the displaying of a ColorScale. It also works with ColorScaleManager to allow editing and defining new ColorScales.

    See Also:
    Serialized Form
    • Field Detail

      • redHot

        public static final Color[] redHot
      • redBlue

        public static final Color[] redBlue
      • hueBands

        public static final Color[] hueBands
      • spectrum2

        public static final Color[] spectrum2
    • Constructor Detail

      • ColorScale

        public ColorScale​(String name,
                          Color[] c)
      • ColorScale

        public ColorScale​(String name)
      • ColorScale

        public ColorScale()
    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener​(PropertyChangeListener l)
        add action event listener
      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener l)
        remove action event listener
      • getName

        public String getName()
        Get the colorscale name.
      • setName

        public void setName​(String name)
        Set the colorscale name.
      • getNumColors

        public int getNumColors()
        Get the number of colors in the colorscale.
      • setNumColors

        public void setNumColors​(int n)
        Set the number of colors in the colorscale.
      • getColor

        public Color getColor​(int i)
      • getEdge

        public double getEdge​(int index)
        Get the edge of the ith interval. see @link setMinMax
      • getMissingDataColor

        public Color getMissingDataColor()
      • getIndexFromValue

        public int getIndexFromValue​(double value)
        Get which color interval this value lies in.
        Parameters:
        value - minimum data value.
        Returns:
        the color index.
      • getIndexFromValueLog

        public int getIndexFromValueLog​(double value)
      • setMinMax

        public void setMinMax​(double min,
                              double max)
        Set the data min/max interval. The color intervals are set based on this. A PropertyChangeEvent is sent when this is called. Currently the intervals are calculated in the following way (where incr = (max-min)/(n-2)) :
         

        edge data interval 0 min value <= min 1 min+incr min <= value < min + incr 2 min+2*incr min+incr <= value < min+2*incr ith min+i*incr min+(i-1)*incr <= value < min+i*incr n-2 max min+(n-3)*incr <= value < max n-1 max max < value n value = missingDataValue

        Parameters:
        min - minimum data value
        max - maximum data value
      • getHistMax

        public int getHistMax()
        This is an optimization for counting the number of colors in each interval. the histpogram is populated by calls to getIndexFromValue().
        Returns:
        the index with the maximum histogram count.
      • resetHist

        public void resetHist()
        reset the histogram.