Package PamView

Class ColourArray

java.lang.Object
PamView.ColourArray
All Implemented Interfaces:
Serializable, Cloneable, ManagedParameters

public class ColourArray extends Object implements Cloneable, Serializable, ManagedParameters
A series of functions for creating arrays of colours

Can be used for spectrogram colouring, contour colouring, etc.

Author:
Doug Gillespie
See Also:
  • Method Details

    • getName

      public static String getName(ColourArray.ColourArrayType type)
    • createStandardColourArray

      public static ColourArray createStandardColourArray(int nPoints, ColourArray.ColourArrayType type)
    • createWhiteToBlackArray

      public static ColourArray createWhiteToBlackArray(int nPoints)
    • createBlackToWhiteArray

      public static ColourArray createBlackToWhiteArray(int nPoints)
    • createRainbowArray

      public static ColourArray createRainbowArray(int nPoints)
      Color.BLACK, Color.BLUE, Color.CYAN, Color.GREEN, Color.ORANGE, Color.RED
      Parameters:
      nPoints -
      Returns:
    • createHSVArray

      public static ColourArray createHSVArray(int nPoints)
      Color.RED, Color.YELLOW, Color.GREEN, Color.CYAN, Color.BLUE, Color.MAGENTA, Color.RED
      Parameters:
      nPoints -
      Returns:
    • createHotArray

      public static ColourArray createHotArray(int nPoints)
      Colour array from black to white, via red, orange and yellow
      Parameters:
      nPoints -
      Returns:
    • createPatrioticArray

      public static ColourArray createPatrioticArray(int nPoints)
      Red white blue colour array
      Parameters:
      nPoints -
      Returns:
    • createMultiColouredArray

      public static ColourArray createMultiColouredArray(int nPoints, Color... colourList)
      Create a multicoloured array of colours that merges in turn between each of the colours given in the list.
      Parameters:
      nPoints - total number of colour points
      colourList - variable number of colours.
      Returns:
      a new ColourArray object.
    • createMergedArray

      public static ColourArray createMergedArray(int nPoints, Color c1, Color c2)
    • getColours

      public Color[] getColours()
    • checkColour

      public Color checkColour(int iCol)
      Get a colour with index checking to make sure it's in the rangee 0 - nCol-1.
      Parameters:
      iCol - colour index
      Returns:
      colour
    • getColour

      public Color getColour(int iCol)
      Get the colour for the index. No checking so can throw an indexoutofbounds error
      Parameters:
      iCol - colour index
      Returns:
      colour
    • getIntColourArray

      public int[] getIntColourArray(int iCol)
      Get a three digit colour array
      Parameters:
      iCol -
      Returns:
    • get4IntColourArray

      public int[] get4IntColourArray(int iCol)
      Get a four digit colour array with the alpha value set to 255 (opaque)
      Parameters:
      iCol -
      Returns:
    • getNumbColours

      public int getNumbColours()
    • reverseArray

      public void reverseArray()
    • getContrastingColour

      public Color getContrastingColour()
      Return a contrasting colour which is different to ALL of the colours in the array. This can be used to draw additional lines over 3D plots made with the array colours.
      Returns:
      the contrastingColor
    • getContrastingColor

      public Color getContrastingColor()
      Added just so that contrastingColor field would be included in getParameterSet method
      Returns:
    • setAlpha

      public void setAlpha(int alpha)
    • setContrastingColour

      public void setContrastingColour(Color contrastingColor)
      Set a contrasting colour which is different to ALL of the colours in the array. This can be used to draw additional lines over 3D plots made with the array colours.
      Parameters:
      contrastingColor - the contrastingColor to set
    • getColour

      public Color getColour(double colValue, double min, double max)
      Get a colour for a data value if the colourmap is between two data limits.
      Parameters:
      colValue - - the data value to find colour for.
      min - - the minimum data value of the colour array.
      max - - the maximum data value of the colour array.
      Returns:
      colour representing the data value
    • getParameterSet

      public PamParameterSet getParameterSet()
      Description copied from interface: ManagedParameters
      Get a set of data that describes all of the parameters in a class
      Specified by:
      getParameterSet in interface ManagedParameters
      Returns:
      description of the parameters in a class.