Class ContinuousColourMap

java.lang.Object
All Implemented Interfaces:
java.lang.Cloneable, InterfaceObject, NamedObject, TreeObject, CleanableObject, XMLObject, IconObject
Direct Known Subclasses:
Vector3ColourMap

public class ContinuousColourMap
extends ColourMap
Maps colours to values based upon a set of anchors (expressed on the range [0:1]) and an interpolator.
Since:
1.0 TODO: allow specific colour models; currently is 4-channel RGBA only
Version:
1.0
Author:
Andrew Reid
  • Field Details

  • Constructor Details

    • ContinuousColourMap

      public ContinuousColourMap()
    • ContinuousColourMap

      public ContinuousColourMap​(java.lang.String name)
  • Method Details

    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Returns:
    • setFromMap

      public void setFromMap​(ContinuousColourMap map)
      Set this map from map.
      Parameters:
      map -
    • getDefault2

      public static ContinuousColourMap getDefault2()
    • getDefault3

      public static ContinuousColourMap getDefault3()
    • getGreyScale

      public static ContinuousColourMap getGreyScale()
    • getColour

      public Colour getColour​(int i)
      Overrides:
      getColour in class ColourMap
    • getColour

      public Colour getColour​(java.lang.Comparable o)
      Overrides:
      getColour in class ColourMap
    • getColour

      public Colour getColour​(double d, double min, double max)
      Description copied from class: ColourMap
      Get colour for the specified value, given the specified limits.
      Overrides:
      getColour in class ColourMap
      Returns:
    • addAnchor

      public int addAnchor​(double value, Colour colour)
    • addAnchor

      public int addAnchor​(MguiNumber value, Colour colour)
    • removeAnchors

      public void removeAnchors​(MguiNumber min, MguiNumber max)
      Remove all anchor points between min and max
      Parameters:
      min -
      max -
    • removeAnchor

      public void removeAnchor​(int anchor)
    • getAnchor

      public int getAnchor​(double val, float radius)
    • resort

      public void resort()
    • getColor4fArray

      public org.jogamp.vecmath.Color4f[] getColor4fArray​(java.util.ArrayList<MguiNumber> list, double min, double max)
      Description copied from class: ColourMap
      Get an array of colours for the given list of values, given the specified limits.
      Overrides:
      getColor4fArray in class ColourMap
      Returns:
    • getColourAtValue

      protected Colour getColourAtValue​(double n)
    • getColourAtValue

      protected Colour getColourAtValue​(double n, double min, double max)
    • getColourAtValue

      protected Colour getColourAtValue​(MguiNumber n)
    • getColourAtValue

      protected Colour getColourAtValue​(MguiNumber n, double min, double max)
    • normalize

      protected MguiNumber normalize​(MguiNumber n, double mn, double mx)
    • getInterpolation

      protected double getInterpolation​(MguiNumber n1, MguiNumber n2, MguiNumber a3)
    • getDiscreteMap

      public byte[] getDiscreteMap​(int size, int channels, boolean setAlphaFromPos)
      Description copied from class: ColourMap
      Compile and return a discrete colour map of size size with channels interleaved data channels. For a given colour model (e.g., RGBA), each colour component c will be represented by the index (i * 4) + c.
      Specified by:
      getDiscreteMap in class ColourMap
      setAlphaFromPos - sets the alpha value from position rather than colour map
      Returns:
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • clone

      public java.lang.Object clone()
      Specified by:
      clone in class ColourMap
    • getXML

      public java.lang.String getXML​(int tab)
      Description copied from interface: XMLObject
      Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Overrides:
      getXML in class ColourMap
      Parameters:
      tab - The number of tabs to place before the opening XML wrapper
      Returns:
    • getShortXML

      public java.lang.String getShortXML​(int tab)
      Description copied from interface: XMLObject
      Returns a short XML representation of this object.
      Returns:
    • getXMLInstance

      public XMLObject getXMLInstance​(org.xml.sax.Attributes attributes)
    • handleXMLElementStart

      public void handleXMLElementStart​(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
      Description copied from interface: XMLObject
      Handles the start of an XML element.
      Specified by:
      handleXMLElementStart in interface XMLObject
      Overrides:
      handleXMLElementStart in class ColourMap
      Parameters:
      localName - Local name of the element
      attributes - Set of element attributes
      type - The XMLType of this element
    • handleXMLElementEnd

      public void handleXMLElementEnd​(java.lang.String localName)
      Description copied from interface: XMLObject
      Handles the end of an XML element.
      Specified by:
      handleXMLElementEnd in interface XMLObject
      Overrides:
      handleXMLElementEnd in class ColourMap
      Parameters:
      localName - Local name of the element