Package mgui.interfaces.maps
Class ContinuousColourMap
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.maps.ColourMap
mgui.interfaces.maps.ContinuousColourMap
- 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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classContinuousColourMap.AnchorNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description java.util.ArrayList<ContinuousColourMap.Anchor>anchorsstatic ContinuousColourMapDEFAULT_2static ContinuousColourMapDEFAULT_3static ContinuousColourMapGREY_SCALEprotected booleanxml_anchors_failedprotected booleanxml_in_anchorsFields inherited from class mgui.interfaces.maps.ColourMap
name, nullColourFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description ContinuousColourMap()ContinuousColourMap(java.lang.String name) -
Method Summary
Modifier and Type Method Description intaddAnchor(double value, Colour colour)intaddAnchor(MguiNumber value, Colour colour)java.lang.Objectclone()intgetAnchor(double val, float radius)org.jogamp.vecmath.Color4f[]getColor4fArray(java.util.ArrayList<MguiNumber> list, double min, double max)Get an array of colours for the given list of values, given the specified limits.ColourgetColour(double d, double min, double max)Get colour for the specified value, given the specified limits.ColourgetColour(int i)ColourgetColour(java.lang.Comparable o)protected ColourgetColourAtValue(double n)protected ColourgetColourAtValue(double n, double min, double max)protected ColourgetColourAtValue(MguiNumber n)protected ColourgetColourAtValue(MguiNumber n, double min, double max)static ContinuousColourMapgetDefault2()static ContinuousColourMapgetDefault3()byte[]getDiscreteMap(int size, int channels, boolean setAlphaFromPos)Compile and return a discrete colour map of sizesizewithchannelsinterleaved data channels.static ContinuousColourMapgetGreyScale()protected doublegetInterpolation(MguiNumber n1, MguiNumber n2, MguiNumber a3)javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.java.lang.StringgetShortXML(int tab)Returns a short XML representation of this object.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.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.protected MguiNumbernormalize(MguiNumber n, double mn, double mx)voidremoveAnchor(int anchor)voidremoveAnchors(MguiNumber min, MguiNumber max)Remove all anchor points between min and maxvoidresort()voidsetFromMap(ContinuousColourMap map)Set this map frommap.java.lang.StringtoString()Methods inherited from class mgui.interfaces.maps.ColourMap
getColor3fArray, getColor3fArray, getColor4fArray, getColour, getDiscreteMap, getDTD, getLayoutPanel, 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
-
DEFAULT_2
-
DEFAULT_3
-
GREY_SCALE
-
anchors
-
xml_in_anchors
protected boolean xml_in_anchors -
xml_anchors_failed
protected boolean xml_anchors_failed
-
-
Constructor Details
-
ContinuousColourMap
public ContinuousColourMap() -
ContinuousColourMap
public ContinuousColourMap(java.lang.String name)
-
-
Method Details
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Returns:
-
setFromMap
Set this map frommap.- Parameters:
map-
-
getDefault2
-
getDefault3
-
getGreyScale
-
getColour
-
getColour
-
getColour
Description copied from class:ColourMapGet colour for the specified value, given the specified limits. -
addAnchor
-
addAnchor
-
removeAnchors
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:ColourMapGet an array of colours for the given list of values, given the specified limits.- Overrides:
getColor4fArrayin classColourMap- Returns:
-
getColourAtValue
-
getColourAtValue
-
getColourAtValue
-
getColourAtValue
-
normalize
-
getInterpolation
-
getDiscreteMap
public byte[] getDiscreteMap(int size, int channels, boolean setAlphaFromPos)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 classColourMapsetAlphaFromPos- sets the alpha value from position rather than colour map- Returns:
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
clone
public java.lang.Object clone() -
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:
-
getXMLInstance
-
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
-