Package mgui.interfaces.maps
Class DiscreteColourMap
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.maps.ColourMap
mgui.interfaces.maps.DiscreteColourMap
- All Implemented Interfaces:
java.lang.Cloneable,InterfaceObject,NamedObject,TreeObject,CleanableObject,XMLObject,IconObject
public class DiscreteColourMap extends ColourMap
Colour map for discrete 1-to-1 mappings (integers to colours).
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description java.util.HashMap<java.lang.Integer,Colour>coloursNameMapnameMapstatic DiscreteColourMapRANDOM_600Fields inherited from class mgui.interfaces.maps.ColourMap
name, nullColourFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description DiscreteColourMap()DiscreteColourMap(java.lang.String name)DiscreteColourMap(NameMap map) -
Method Summary
Modifier and Type Method Description java.lang.Objectclone()ContinuousColourMapgetAsContinuousMap(int no_anchors)Converts this discrete map to a continuous map by sampling at 0, N andno_anchors- 2 evenly-spaced indices.ColourgetColour(int i)ColourgetColour(java.lang.Comparable<?> o)ColourgetColour(java.lang.String value)byte[]getDiscreteMap(int max_size, int channels, boolean setAlphaFromMax)Compile and return a discrete colour map of sizesizewithchannelsinterleaved data channels.java.util.HashMap<java.lang.Integer,java.lang.Integer>getIndexMap()Returns a mapping from the index values of this discrete colour map to the byte map indices return by getDiscreteMap(int,int,boolean).java.util.ArrayList<java.lang.Integer>getIndices()InterfaceLayoutPanelgetLayoutPanel()intgetMax()Returns the maximum value in this map's indicesintgetMin()Returns the minimum value in this map's indicesNameMapgetNameMap()javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.static DiscreteColourMapgetRandom600()java.lang.StringgetShortXML(int tab)Returns a short XML representation of this object.intgetSize()java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.static XMLObjectgetXMLInstance(org.xml.sax.Attributes attributes)voidhandleXMLElementEnd(java.lang.String localName)Handles the end of an XML element.voidhandleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Handles the start of an XML element.booleanhasNameMap()voidsetColour(int i, java.lang.String n, Colour c)voidsetColour(int i, Colour c)voidsetColour(java.lang.String name, Colour c)voidsetNameMap(boolean b)voidsetNameMap(NameMap map)java.lang.StringtoString()Methods inherited from class mgui.interfaces.maps.ColourMap
getColor3fArray, getColor3fArray, getColor4fArray, getColor4fArray, getColour, getColour, getDiscreteMap, getDTD, getLocalName, getName, getXML, getXMLSchema, handleXMLString, printToConsole, setName, writeXML, writeXML, writeXMLMethods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, issueTreeNode, setTreeNode, updateTreeNodesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
RANDOM_600
-
colours
-
nameMap
-
-
Constructor Details
-
DiscreteColourMap
public DiscreteColourMap() -
DiscreteColourMap
public DiscreteColourMap(java.lang.String name) -
DiscreteColourMap
-
-
Method Details
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Returns:
-
getIndices
public java.util.ArrayList<java.lang.Integer> getIndices() -
getColour
-
getColour
-
setColour
-
setColour
-
setColour
-
getAsContinuousMap
Converts this discrete map to a continuous map by sampling at 0, N andno_anchors- 2 evenly-spaced indices. The discrete map should be a discretized continuous map for this to make sense.- Parameters:
no_anchors-- Returns:
-
hasNameMap
public boolean hasNameMap() -
setNameMap
-
setNameMap
public void setNameMap(boolean b) -
getNameMap
-
getColour
-
getRandom600
-
getMax
public int getMax()Returns the maximum value in this map's indices- Returns:
-
getMin
public int getMin()Returns the minimum value in this map's indices- Returns:
-
getSize
public int getSize() -
getIndexMap
public java.util.HashMap<java.lang.Integer,java.lang.Integer> getIndexMap()Returns a mapping from the index values of this discrete colour map to the byte map indices return by getDiscreteMap(int,int,boolean).- Returns:
-
getDiscreteMap
public byte[] getDiscreteMap(int max_size, int channels, boolean setAlphaFromMax)Description copied from class:ColourMapCompile and return a discrete colour map of sizesizewithchannelsinterleaved data channels. For a given colour model (e.g., RGBA), each colour componentcwill be represented by the index(i * 4) + c.- Specified by:
getDiscreteMapin classColourMapsetAlphaFromMax- sets the alpha value from position rather than colour map- Returns:
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObjectReturns 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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)functions to write larger objects to file. -
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObjectReturns a short XML representation of this object.- Returns:
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Description copied from interface:XMLObjectHandles the start of an XML element.- Specified by:
handleXMLElementStartin interfaceXMLObject- Overrides:
handleXMLElementStartin classColourMap- Parameters:
localName- Local name of the elementattributes- Set of element attributestype- TheXMLTypeof this element
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObjectHandles the end of an XML element.- Specified by:
handleXMLElementEndin interfaceXMLObject- Overrides:
handleXMLElementEndin classColourMap- Parameters:
localName- Local name of the element
-
getXMLInstance
-
getLayoutPanel
- Overrides:
getLayoutPanelin classColourMap
-
clone
public java.lang.Object clone()
-