Package mgui.interfaces.shapes
Class InterfaceShape
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.InterfaceShape
- All Implemented Interfaces:
java.awt.datatransfer.Transferable
,java.lang.Comparable<InterfaceShape>
,AttributeListener
,AttributeObject
,InterfaceObject
,PersistentObject
,VariableObject
,PopupMenuObject
,NamedObject
,InterfaceQueryObject
,InterfaceShapeQueryObject
,VertexDataColumnListener
,InterfaceTransferable
,TreeObject
,CleanableObject
,XMLObject
,IconObject
- Direct Known Subclasses:
Shape2DInt
,Shape3DInt
public abstract class InterfaceShape extends AbstractInterfaceObject implements InterfaceObject, AttributeListener, AttributeObject, java.lang.Comparable<InterfaceShape>, IconObject, XMLObject, PopupMenuObject, InterfaceTransferable, VariableObject, InterfaceShapeQueryObject, VertexDataColumnListener, PersistentObject
Abstract base class for all shape interfaces (ShapeInts). Implements vertex-wise data, data links,
attributes, attribute overriding, colour maps, name maps, node selection, shape listeners, and regions-
of-interest. Also keeps track of I/O parameters used to load or write it, and extends
XMLObject
to read/write itself in XML format.
See Development Notes: Interface Shapes for a more detailed description.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
InterfaceShape.VertexDataSet
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected AttributeList
attributes
protected boolean[]
constraints
java.util.ArrayList<java.lang.String>
data_columns
protected javax.swing.Icon
icon
protected long
ID
protected boolean
is_auxiliary
protected boolean
is_registered
protected boolean
isDrawable
protected boolean
isImageShape
protected boolean
isLight
protected boolean
isOverridden
protected VertexDataColumn
last_column_added
protected VertexDataColumn
last_column_changed
protected VertexDataColumn
last_column_removed
protected java.util.HashMap<java.lang.String,ColourMap>
linked_colour_maps
protected InterfaceIOOptions
loader_options
boolean
notifyListeners
LOCAL VARIABLESprotected AttributeList
overrideAttr
protected ShapeSet
parent_set
protected VertexSelection
selected_nodes
protected java.util.ArrayList<ShapeListener>
shapeListeners
protected java.util.HashMap<java.lang.String,VertexDataColumn>
vertex_data
protected InterfaceIOOptions
writer_options
protected VertexDataColumn
xml_current_column
protected InterfaceShapeLoader
xml_current_loader
protected Shape
xml_current_shape
protected ShapeInputOptions
xml_current_shape_options
protected XMLObject.XMLType
xml_current_type
XML STUFFprotected java.lang.String
xml_current_url
protected boolean
xml_is_vertex_data
protected java.lang.String
xml_root_dir
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description InterfaceShape()
-
Method Summary
Modifier and Type Method Description protected void
_init()
INITIALIZATIONvoid
addDataLink(java.lang.String column, java.lang.String key, LinkedDataStream<?> link_stream)
void
addShapeListener(ShapeListener thisListener)
boolean
addVertexData(java.lang.String key)
Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE
.boolean
addVertexData(java.lang.String column, double[] data)
Add data as a double arrayboolean
addVertexData(java.lang.String key, int dataType)
Add a vertex-wise data column of typedataType
, which must be one ofDataBuffer.TYPE_DOUBLE
,DataBuffer.TYPE_FLOAT
, orDataBuffer.TYPE_INT
.boolean
addVertexData(java.lang.String key, int dataType, ColourMap cmap)
Add a vertex-wise data column of typedataType
, which must be one ofDataBuffer.TYPE_DOUBLE
,DataBuffer.TYPE_FLOAT
, orDataBuffer.TYPE_INT
.boolean
addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data)
Adds a new vertex data column and populates it withdata
.boolean
addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, ColourMap cmap)
Adds vertex-wise data to this shape.boolean
addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, NameMap nmap)
Adds vertex-wise data to this shape.boolean
addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, NameMap nmap, ColourMap cmap)
Adds vertex-wise data to this shape.boolean
addVertexData(VertexDataColumn column)
Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE
.void
cleanTreeNodes()
TREE NODE STUFFint
compareTo(InterfaceShape s)
boolean
copyAttributes(InterfaceShape source_shape)
Copiesattributes
to this shape.abstract void
drawShape2D(java.awt.Graphics2D g, DrawingEngine d)
ABSTRACT METHODSvoid
finalizeAfterXML()
Allows subclasses to do some finalization after an XML load operation.protected void
fireShapeListeners(ShapeEvent e)
void
fireShapeModified()
Notifies this shape that it has been modified and should inform its listenersstatic java.lang.String
fromVariable(java.lang.String string)
Converts a variable name back to its original column namejava.util.ArrayList<java.util.ArrayList<MguiNumber>>
getAllVertexData()
Returns all vertex-wide data associated with this shape.abstract float
getAlpha()
Gets the current transparency level for this shape.Attribute<?>
getAttribute(java.lang.String attrName)
Returns a specific attribute for this object.AttributeList
getAttributes()
Returns the list of current attributes for this object.java.lang.Object
getAttributeValue(java.lang.String name)
Gets the value of attributename
, ornull
if it does not exist.java.util.List<java.lang.String>
getByReferenceUrls()
Returns a URL string for the latest call to writeXML(int,java.io.Writer).ColourMap
getColourMap()
Returns the ColourMap associated with the current data column.ColourMap
getColourMap(java.lang.String key)
Gets the colour map forcolumn
.boolean
getConstraint(int i)
boolean[]
getConstraints()
java.lang.String
getCurrentColumn()
Returns the name of the current data columnVertexDataColumn
getCurrentDataColumn()
Returns the current VertexDataColumn.java.util.ArrayList<MguiNumber>
getCurrentVertexData()
Retrieves the currently selected vertex-wise data column.LinkedDataStream<?>
getDataLink(java.lang.String column, java.lang.String key)
DATA LINK STUFFdouble
getDataMax()
double
getDataMin()
MguiNumber
getDatumAtVertex(int index)
Returns the datum from the current column atindex
.MguiNumber
getDatumAtVertex(java.lang.String column, int index)
Returns the datum fromcolumn
atindex
.ColourMap
getDefaultColourMap()
FileLoader
getFileLoader()
Returns an instance of the file loader associated with this persistent object.FileWriter
getFileWriter()
Returns an instance of the file writer associated with this persistent object.java.lang.String
getFullName()
Returns a full name of this shape, including its parent model and shape sets, separated by dots.abstract Shape
getGeometry()
Returns the Shape associated with this objectabstract Shape
getGeometryInstance()
Returns an instance of thisInterfaceShape
's geometry class.long
getID()
Attribute<?>
getInheritedAttribute(java.lang.String attrName)
Returns the (possibly inherited) named attribute.AttributeList
getInheritedAttributes()
Returns an AttributeList object reflecting the current attributes for this shape, whether local or inherited (i.e., overridden by this shape's parent).java.lang.Object
getInheritedAttributeValue(java.lang.String name)
Returns the (possibly inherited) value of the named attribute.abstract java.awt.Color
getLabelColour()
abstract java.awt.Font
getLabelFont()
abstract float
getLabelScale()
VertexDataColumn
getLastColumnAdded()
VERTEX DATA STUFFVertexDataColumn
getLastColumnChanged()
VertexDataColumn
getLastColumnRemoved()
protected java.lang.String
getLegalName(java.lang.String name)
abstract java.awt.Color
getLineColour()
Returns the colour of this shape's lines/edges.abstract java.awt.Stroke
getLineStyle()
Returns the line/edge style for this shape.java.util.ArrayList<MguiNumber>
getLinkedVertexData(java.lang.String linked_column)
Retrieves the vertex-wise data associated with a data-linked column.MguiNumber
getLinkedVertexDatum(java.lang.String linked_column, int index)
Returns the value at the given vertex, for the given linked column.InterfaceIOOptions
getLoaderOptions()
Returns the options used to last load this object, if availableShapeModel3D
getModel()
abstract Attribute<?>
getModifiedAttribute()
java.lang.String
getName()
Gets the name for this object.NameMap
getNameMap()
Returns the name map associated with the current column, ornull
if there is no column, or no name map associated with it.NameMap
getNameMap(java.lang.String key)
Returns the name map associated withcolumn
, ornull
if there is no name map associated with it.java.util.ArrayList<java.lang.String>
getNonLinkedDataColumns()
Returns a list of this shape's data columns, minus the linked columns.javax.swing.Icon
getObjectIcon()
Returns an icon for this shape, if one has been defined.protected abstract Attribute<?>
getParentAttribute(java.lang.String attrName)
ShapeSet
getParentSet()
InterfacePopupMenu
getPopupMenu()
Produces and returns a popup menu for this object.java.lang.String
getSourceURL()
SpatialUnit
getUnit()
Returns the spatial unit for this shape set.java.net.URL
getUrlReference()
Returns the URL reference for this persistent object; i.e., the location where its data were loaded and where it should be written.java.util.ArrayList<java.lang.String>
getVariables()
Returns this shape's columns as a list of variables.java.lang.Class<?>
getVariableType()
Specifies the class type of the object returned bygetVariableValues()
.double
getVariableValue(java.lang.String variable, int[] element)
Returns the value of a variable in this object, at the specified element location.java.lang.Object
getVariableValues(java.lang.String variable)
Returns an object containing the set of values forvariable
.abstract java.awt.Color
getVertexColour()
Returns the colour of this shape's vertices.abstract int
getVertexCount()
Returns the number of vertices defining the geometry of this shape.java.util.ArrayList<MguiNumber>
getVertexData()
Returns a live version of the data in the current column.java.util.ArrayList<MguiNumber>
getVertexData(java.lang.String column)
Returns a live version of the data incolumn
.VertexDataColumn
getVertexDataColumn(java.lang.String name)
Returns the vertex data column associated withname
.int
getVertexDataColumnCount()
Returns the number of vertex data columns associated with this shape.java.util.ArrayList<java.lang.String>
getVertexDataColumnNames()
Returns a list of the names of all vertex data columns.java.util.ArrayList<VertexDataColumn>
getVertexDataColumns()
Returns a list of all vertex data columns.java.util.HashMap<java.lang.String,java.util.ArrayList<MguiNumber>>
getVertexDataMap()
Retrieves a hash map containing the vertex-wise data associated with this shape.abstract float
getVertexScale()
Returns the scale of this shape's verticesabstract VertexSelection
getVertexSelection()
Returns a list of the currently selected vertices for this shape.InterfaceIOOptions
getWriterOptions()
Returns the options used to last write this object, if availablejava.lang.String
getXML()
Returns this object's XML representation as a single string.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.java.lang.String
getXML(int tab, XMLObject.XMLType type)
java.lang.String
getXMLSchema()
Returns the XML schema for this object's XML representationvoid
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.void
handleXMLString(java.lang.String s)
Handles a string within an XML element.abstract boolean
hasAlpha()
Queries whether this shape has transparency.abstract void
hasAlpha(boolean b)
Specifies whether this shape has transparency.boolean
hasAttribute(java.lang.String name)
Determines whether this object has an attribute namedname
.boolean
hasColumn(java.lang.String s)
boolean
hasData()
abstract boolean
hasParentShape()
Is this shape a child of another shape? Usually this refers to shapes which produce themselves in a different dimensionality; e.g., a 3D shape represented on a 2D plane.boolean
inheritAttributesFromParent()
boolean
isAuxiliaryShape()
CORE ATTRIBUTESvoid
isAuxiliaryShape(boolean is_auxiliary)
boolean
isDestroyed()
Test whether this object has been destroyedboolean
isDrawable()
abstract boolean
isHeritableAttribute(java.lang.String name)
Is this parent attribute inherited by a child shape?boolean
isImageShape()
abstract boolean
isInheritingAttribute(Attribute<?> attribute)
Does this child attribute inherit values from a parent shape?boolean
isLegalName(java.lang.String name)
Is this a legal name for a shape.boolean
isLight()
boolean
isSelectable()
Returns the selectability of thisInterfaceShape
.boolean
isVisible()
Returns the visibility of thisInterfaceShape
.abstract boolean
needsRedraw(Attribute<?> attribute)
Returnstrue
if a change toattribute
will require a redraw of this shape.java.util.ArrayList<MguiNumber>
newVertexData(DataType type)
Returns a new array of the same size as this shape, with the specified data typeboolean
queryObject(InterfaceQuery query)
QUERY STUFFboolean
queryShapeAtVertex(int vertex, InterfaceShapeQuery query)
Updatesquery
with information pertaining to the specifiedvertex
.void
register()
Registers this shape with the current session, if it hasn't already been done, by assigning it a unique identifier.void
removeColourMap(java.lang.String key)
void
removeDataLink(java.lang.String column, java.lang.String key)
void
removeNameMap(java.lang.String key)
Removes the name map associated with columnkey
.void
removeShapeListener(ShapeListener thisListener)
void
removeVertexData(java.lang.String key)
Remove a vertex data column from this shape.boolean
renameVertexDataColumn(java.lang.String old_name, java.lang.String new_name)
Renames the current column.abstract void
setAlpha(float f)
Sets the current transparency level for this shape.void
setAttribute(java.lang.String attrName, java.lang.Object newValue)
Sets a value for a specific attribute.void
setAttributes(AttributeList thisList)
Sets the list of attributes for this object.void
setColourMap(java.lang.String column, ColourMap cm)
Sets the colour map forcolumn
.void
setColourMap(ColourMap cm)
Sets the colour map for the current column.void
setConstraint(int i, boolean c)
void
setCurrentColumn(java.lang.String key)
void
setCurrentColumn(java.lang.String key, boolean update)
void
setDataMax(double d)
Sets the data maximum for the current column, and fires an eventvoid
setDataMax(double d, boolean update)
Sets the data maximum for the current columnvoid
setDataMax(java.lang.String column, double d, boolean update)
Sets the data maximum for thecolumn
void
setDataMin(double d)
Sets the data minimum for the current column, and fires an eventvoid
setDataMin(double d, boolean update)
Sets the data minimum for the current columnvoid
setDataMin(java.lang.String column, double d, boolean update)
Sets the data minimum for thecolumn
boolean
setDatumAtVertex(int index, double datum)
Sets the datum from the current column atindex
.boolean
setDatumAtVertex(int index, MguiNumber datum)
Sets the datum from the current column atindex
.boolean
setDatumAtVertex(java.lang.String column, int index, double datum)
Sets the datum fromcolumn
atindex
.boolean
setDatumAtVertex(java.lang.String column, int index, MguiNumber datum)
Sets the datum fromcolumn
atindex
.void
setDefaultColourMap(ColourMap cm)
COLOUR MAP STUFFvoid
setDefaultColourMap(ColourMap cm, boolean update)
void
setFileLoader(java.lang.String loader)
PERSISTENCE STUFFboolean
setFileLoader(InterfaceIOType io_type)
Sets theInterfaceIOType
associated with this persistent object's loader.boolean
setFileWriter(InterfaceIOType io_type)
Sets theInterfaceIOType
associated with this persistent object's writer.abstract boolean
setGeometry(Shape geometry)
Sets the Shape associated with this object.protected void
setIcon()
void
setID(long id)
abstract void
setLabelColour(java.awt.Color colour)
abstract void
setLabelFont(java.awt.Font font)
abstract void
setLabelScale(float scale)
abstract void
setLineStyle(java.awt.Stroke s)
Returns the line/edge style for this shape.void
setLoaderOptions(InterfaceIOOptions options)
Sets the options used to last load this object; can benull
.void
setName(java.lang.String name)
Sets the name for this object.void
setNameMap(java.lang.String key, NameMap map)
Sets the name map associated with columnkey
.void
setOverride(AttributeList attr)
void
setParentSet(ShapeSet set)
Sets this shape's parent set toset
.void
setSelectable(boolean b)
Sets the selectability of thisInterfaceShape
totrue
.void
setTreeNode(InterfaceTreeNode treeNode)
Constructs a tree node from this shape.void
setUnit(SpatialUnit unit)
void
setUrlReference(java.net.URL ref)
Sets the URL reference for this persistent object; i.e., the location where its data were loaded and where it should be written.boolean
setVariableValues(java.lang.String variable, java.lang.Object values)
Sets the variable's values with thevalues
object, which must be a type acceptable to the variable object.boolean
setVariableValues(java.lang.String variable, java.lang.Object values, VertexSelection selection)
boolean
setVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data)
Sets the data incolumn
.boolean
setVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data, boolean update)
Sets the data incolumn
.boolean
setVertexData(java.util.ArrayList<MguiNumber> data)
Sets the data in the current column.void
setVertexDataMap(java.util.HashMap<java.lang.String,java.util.ArrayList<MguiNumber>> data)
Sets the hash map specified the vertex-wise data associated with this shape.abstract void
setVertexSelection(VertexSelection selection)
void
setVisible(boolean b)
Sets the visibility of thisInterfaceShape
totrue
.void
setWriterOptions(InterfaceIOOptions options)
Sets the options used to last write this object; can benull
.void
setXMLRoot(java.lang.String root_dir)
boolean
show2D()
void
show2D(boolean b)
Specifies whether to show this shape in 2D.boolean
show3D()
void
show3D(boolean b)
Specifies whether to show this shape in 2D.boolean
showData()
void
showData(boolean b)
abstract boolean
showVertices()
Queries whether the vertices of this shape are visible.abstract void
showVertices(boolean b)
Specifies whether the vertices of this shape are visible.boolean
supportsVariableType(java.lang.Class<?> type)
Specifies whether this variable object supports the given class type when setting variables.static java.lang.String
toVariable(java.lang.String string)
Converts a column name to a legitimate variable namevoid
unsetOverride()
protected void
updateDataColumns()
abstract void
updateShape()
void
vertexDataColumnChanged(VertexDataColumnEvent event)
void
vertexDataColumnColourMapChanged(VertexDataColumnEvent event)
void
writeXML(int tab, java.io.Writer writer)
Writes the XML representation of this object to file.void
writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)
Writes the XML representation of this object to file, asXMLType.Normal
.void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, issueTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface mgui.interfaces.attributes.AttributeListener
attributeUpdated
Methods inherited from interface mgui.interfaces.util.CleanableObject
clean
Methods inherited from interface mgui.interfaces.InterfaceObject
destroy
Methods inherited from interface mgui.interfaces.transfers.InterfaceTransferable
performTransfer
Methods inherited from interface mgui.interfaces.menus.PopupMenuObject
getPopupMenu, handlePopupEvent, showPopupMenu
Methods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported
Methods inherited from interface mgui.interfaces.trees.TreeObject
getTreeLabel, issueTreeNode
Methods inherited from interface mgui.interfaces.math.VariableObject
getDimensions
Methods inherited from interface mgui.interfaces.xml.XMLObject
getDTD, getLocalName, getShortXML
-
Field Details
-
notifyListeners
public boolean notifyListenersLOCAL VARIABLES -
shapeListeners
-
attributes
-
parent_set
-
isDrawable
protected boolean isDrawable -
isLight
protected boolean isLight -
isImageShape
protected boolean isImageShape -
overrideAttr
-
isOverridden
protected boolean isOverridden -
vertex_data
-
data_columns
public java.util.ArrayList<java.lang.String> data_columns -
constraints
protected boolean[] constraints -
selected_nodes
-
linked_colour_maps
-
icon
protected javax.swing.Icon icon -
ID
protected long ID -
is_auxiliary
protected boolean is_auxiliary -
last_column_added
-
last_column_removed
-
last_column_changed
-
loader_options
-
writer_options
-
is_registered
protected boolean is_registered -
xml_current_type
XML STUFF -
xml_current_shape_options
-
xml_current_url
protected java.lang.String xml_current_url -
xml_current_loader
-
xml_current_shape
-
xml_current_column
-
xml_root_dir
protected java.lang.String xml_root_dir -
xml_is_vertex_data
protected boolean xml_is_vertex_data
-
-
Constructor Details
-
InterfaceShape
public InterfaceShape()
-
-
Method Details
-
drawShape2D
ABSTRACT METHODS -
updateShape
public abstract void updateShape() -
getGeometry
Returns the Shape associated with this object- Returns:
-
setGeometry
Sets the Shape associated with this object. If the class type is incorrect, returnsfalse
- Returns:
-
getGeometryInstance
Returns an instance of thisInterfaceShape
's geometry class.- Returns:
-
needsRedraw
Returnstrue
if a change toattribute
will require a redraw of this shape.- Parameters:
attribute
-- Returns:
-
getModifiedAttribute
-
getVertexCount
public abstract int getVertexCount()Returns the number of vertices defining the geometry of this shape.- Returns:
-
hasParentShape
public abstract boolean hasParentShape()Is this shape a child of another shape? Usually this refers to shapes which produce themselves in a different dimensionality; e.g., a 3D shape represented on a 2D plane.- Returns:
-
_init
protected void _init()INITIALIZATION -
isAuxiliaryShape
public boolean isAuxiliaryShape()CORE ATTRIBUTES -
isAuxiliaryShape
public void isAuxiliaryShape(boolean is_auxiliary) -
register
public void register()Registers this shape with the current session, if it hasn't already been done, by assigning it a unique identifier. -
getUnit
Returns the spatial unit for this shape set.- Returns:
- the spatial unit for this shape set
-
setUnit
-
copyAttributes
Copiesattributes
to this shape. The shape should determine which attributes may be copied.- Parameters:
attributes
-- Returns:
-
isHeritableAttribute
public abstract boolean isHeritableAttribute(java.lang.String name)Is this parent attribute inherited by a child shape?- Parameters:
attribute
-- Returns:
-
isInheritingAttribute
Does this child attribute inherit values from a parent shape?- Parameters:
attribute
-- Returns:
-
isVisible
public boolean isVisible()Returns the visibility of thisInterfaceShape
.- Returns:
true
if visible
-
setVisible
public void setVisible(boolean b)Sets the visibility of thisInterfaceShape
totrue
.- Parameters:
b
-
-
inheritAttributesFromParent
public boolean inheritAttributesFromParent() -
isSelectable
public boolean isSelectable()Returns the selectability of thisInterfaceShape
.- Returns:
true
if visible
-
setSelectable
public void setSelectable(boolean b)Sets the selectability of thisInterfaceShape
totrue
.- Parameters:
b
-
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObject
Gets the value of attributename
, ornull
if it does not exist.- Specified by:
getAttributeValue
in interfaceAttributeObject
- Parameters:
name
- Name of the attribute- Returns:
- the value of attribute
name
, ornull
if it does not exist
-
getAttribute
Description copied from interface:AttributeObject
Returns a specific attribute for this object.- Specified by:
getAttribute
in interfaceAttributeObject
- Returns:
-
getInheritedAttributeValue
public java.lang.Object getInheritedAttributeValue(java.lang.String name)Returns the (possibly inherited) value of the named attribute.- Parameters:
name
-- Returns:
-
getInheritedAttribute
Returns the (possibly inherited) named attribute. -
getParentAttribute
-
hasAttribute
public boolean hasAttribute(java.lang.String name)Determines whether this object has an attribute namedname
.- Parameters:
name
-- Returns:
-
getAttributes
Description copied from interface:AttributeObject
Returns the list of current attributes for this object.- Specified by:
getAttributes
in interfaceAttributeObject
- Returns:
-
getInheritedAttributes
Returns an AttributeList object reflecting the current attributes for this shape, whether local or inherited (i.e., overridden by this shape's parent).- Returns:
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObject
Sets a value for a specific attribute.- Specified by:
setAttribute
in interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObject
Sets the list of attributes for this object.- Specified by:
setAttributes
in interfaceAttributeObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObject
Test whether this object has been destroyed- Specified by:
isDestroyed
in interfaceInterfaceObject
- Overrides:
isDestroyed
in classAbstractInterfaceObject
- Returns:
-
setName
public void setName(java.lang.String name)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
- Overrides:
setName
in classAbstractInterfaceObject
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Specified by:
getName
in interfaceVariableObject
- Overrides:
getName
in classAbstractInterfaceObject
-
isLegalName
public boolean isLegalName(java.lang.String name)Is this a legal name for a shape. Must not contain a '.' character...- Parameters:
name
-- Returns:
-
getLegalName
protected java.lang.String getLegalName(java.lang.String name) -
getFullName
public java.lang.String getFullName()Returns a full name of this shape, including its parent model and shape sets, separated by dots.- Returns:
-
getLabelFont
public abstract java.awt.Font getLabelFont() -
setLabelFont
public abstract void setLabelFont(java.awt.Font font) -
getLabelScale
public abstract float getLabelScale() -
setLabelScale
public abstract void setLabelScale(float scale) -
getLabelColour
public abstract java.awt.Color getLabelColour() -
setLabelColour
public abstract void setLabelColour(java.awt.Color colour) -
isDrawable
public boolean isDrawable() -
isLight
public boolean isLight() -
isImageShape
public boolean isImageShape() -
show2D
public boolean show2D() -
show3D
public boolean show3D() -
show2D
public void show2D(boolean b)Specifies whether to show this shape in 2D.- Parameters:
b
-
-
show3D
public void show3D(boolean b)Specifies whether to show this shape in 2D.- Parameters:
b
-
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
hasAlpha
public abstract boolean hasAlpha()Queries whether this shape has transparency.- Returns:
-
hasAlpha
public abstract void hasAlpha(boolean b)Specifies whether this shape has transparency.- Parameters:
b
-
-
showVertices
public abstract boolean showVertices()Queries whether the vertices of this shape are visible.- Returns:
-
showVertices
public abstract void showVertices(boolean b)Specifies whether the vertices of this shape are visible.- Parameters:
b
-
-
getAlpha
public abstract float getAlpha()Gets the current transparency level for this shape.- Returns:
-
setAlpha
public abstract void setAlpha(float f)Sets the current transparency level for this shape. -
setOverride
-
unsetOverride
public void unsetOverride() -
getDataMin
public double getDataMin() -
getDataMax
public double getDataMax() -
getVertexScale
public abstract float getVertexScale()Returns the scale of this shape's vertices- Returns:
-
setDataMin
public void setDataMin(double d)Sets the data minimum for the current column, and fires an event- Parameters:
d
-
-
setDataMin
public void setDataMin(double d, boolean update)Sets the data minimum for the current column- Parameters:
update
- Whether to fire an eventd
-
-
setDataMin
public void setDataMin(java.lang.String column, double d, boolean update)Sets the data minimum for thecolumn
- Parameters:
column
- Column to set minimum forupdate
- Whether to fire an eventd
-
-
setDataMax
public void setDataMax(double d)Sets the data maximum for the current column, and fires an event- Parameters:
d
-
-
setDataMax
public void setDataMax(double d, boolean update)Sets the data maximum for the current column- Parameters:
update
- Whether to fire an eventd
-
-
setDataMax
public void setDataMax(java.lang.String column, double d, boolean update)Sets the data maximum for thecolumn
- Parameters:
column
- Column to set maximum forupdate
- Whether to fire an eventd
-
-
getSourceURL
public java.lang.String getSourceURL() -
getVertexColour
public abstract java.awt.Color getVertexColour()Returns the colour of this shape's vertices.- Returns:
-
getLineColour
public abstract java.awt.Color getLineColour()Returns the colour of this shape's lines/edges.- Returns:
-
getLineStyle
public abstract java.awt.Stroke getLineStyle()Returns the line/edge style for this shape.- Returns:
-
setLineStyle
public abstract void setLineStyle(java.awt.Stroke s)Returns the line/edge style for this shape. -
setFileLoader
public void setFileLoader(java.lang.String loader)PERSISTENCE STUFF -
getFileLoader
Description copied from interface:PersistentObject
Returns an instance of the file loader associated with this persistent object.- Specified by:
getFileLoader
in interfacePersistentObject
- Returns:
-
setFileLoader
Description copied from interface:PersistentObject
Sets theInterfaceIOType
associated with this persistent object's loader.- Specified by:
setFileLoader
in interfacePersistentObject
- Returns:
-
getFileWriter
Description copied from interface:PersistentObject
Returns an instance of the file writer associated with this persistent object.- Specified by:
getFileWriter
in interfacePersistentObject
- Returns:
-
getLoaderOptions
Description copied from interface:PersistentObject
Returns the options used to last load this object, if available- Specified by:
getLoaderOptions
in interfacePersistentObject
- Returns:
- The options, or
null
if none exist
-
setLoaderOptions
Description copied from interface:PersistentObject
Sets the options used to last load this object; can benull
.- Specified by:
setLoaderOptions
in interfacePersistentObject
-
setFileWriter
Description copied from interface:PersistentObject
Sets theInterfaceIOType
associated with this persistent object's writer.- Specified by:
setFileWriter
in interfacePersistentObject
- Returns:
-
getWriterOptions
Description copied from interface:PersistentObject
Returns the options used to last write this object, if available- Specified by:
getWriterOptions
in interfacePersistentObject
- Returns:
- The options, or
null
if none exist
-
setWriterOptions
Description copied from interface:PersistentObject
Sets the options used to last write this object; can benull
.- Specified by:
setWriterOptions
in interfacePersistentObject
-
getUrlReference
public java.net.URL getUrlReference()Description copied from interface:PersistentObject
Returns the URL reference for this persistent object; i.e., the location where its data were loaded and where it should be written.- Specified by:
getUrlReference
in interfacePersistentObject
- Returns:
-
setUrlReference
public void setUrlReference(java.net.URL ref)Description copied from interface:PersistentObject
Sets the URL reference for this persistent object; i.e., the location where its data were loaded and where it should be written.- Specified by:
setUrlReference
in interfacePersistentObject
-
getLastColumnAdded
VERTEX DATA STUFF -
getLastColumnRemoved
-
getLastColumnChanged
-
vertexDataColumnChanged
- Specified by:
vertexDataColumnChanged
in interfaceVertexDataColumnListener
-
vertexDataColumnColourMapChanged
- Specified by:
vertexDataColumnColourMapChanged
in interfaceVertexDataColumnListener
-
getVertexDataColumnNames
public java.util.ArrayList<java.lang.String> getVertexDataColumnNames()Returns a list of the names of all vertex data columns.- Returns:
-
getVertexDataColumnCount
public int getVertexDataColumnCount()Returns the number of vertex data columns associated with this shape.- Returns:
-
getVertexDataColumns
Returns a list of all vertex data columns.- Returns:
-
getVertexDataColumn
Returns the vertex data column associated withname
.- Parameters:
name
- Name of the vertex data column- Returns:
-
addVertexData
Adds a new vertex data column and populates it withdata
.- Parameters:
key
-data
-- Returns:
-
addVertexData
public boolean addVertexData(java.lang.String column, double[] data)Add data as a double array- Parameters:
column
-data
-- Returns:
-
addVertexData
public boolean addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, ColourMap cmap)Adds vertex-wise data to this shape.- Parameters:
key
- The key by which this column is to be referreddata
- The values for this columncmap
- Colour map [optionally null] associating values to colours- Returns:
-
addVertexData
public boolean addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, NameMap nmap)Adds vertex-wise data to this shape.- Parameters:
key
- The key by which this column is to be referreddata
- The values for this columnnmap
- Name map [optionally null] associating integer keys to names- Returns:
-
renameVertexDataColumn
public boolean renameVertexDataColumn(java.lang.String old_name, java.lang.String new_name)Renames the current column.- Parameters:
old_name
-new_name
-- Returns:
false
if a column namednew_name
already exists, or no column namedold_name
exists;true
otherwise
-
addVertexData
public boolean addVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, NameMap nmap, ColourMap cmap)Adds vertex-wise data to this shape.- Parameters:
key
- The key by which this column is to be referreddata
- The values for this columnnmap
- Name map [optionally null] associating integer keys to namescmap
- Colour map [optionally null] associating values to colours- Returns:
-
addVertexData
public boolean addVertexData(java.lang.String key)Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE
.- Parameters:
key
- The key associated with the data column
-
addVertexData
Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE
.- Parameters:
key
- The key associated with the data column
-
addVertexData
public boolean addVertexData(java.lang.String key, int dataType)Add a vertex-wise data column of typedataType
, which must be one ofDataBuffer.TYPE_DOUBLE
,DataBuffer.TYPE_FLOAT
, orDataBuffer.TYPE_INT
. If an incorrect type is specified, this method creates a column of typeDataBuffer.TYPE_DOUBLE
.- Parameters:
key
- The key associated with the data columndataType
- The data type with which to store the data
-
addVertexData
Add a vertex-wise data column of typedataType
, which must be one ofDataBuffer.TYPE_DOUBLE
,DataBuffer.TYPE_FLOAT
, orDataBuffer.TYPE_INT
. If an incorrect type is specified, this method creates a column of typeDataBuffer.TYPE_DOUBLE
.- Parameters:
key
- The key associated with the data columndataType
- The data type with which to store the datacmap
- The colour map to associate with this column
-
removeVertexData
public void removeVertexData(java.lang.String key)Remove a vertex data column from this shape. This also removes all associated data, and calls listeners to update, for instance, tree nodes.- Parameters:
key
-
-
getCurrentColumn
public java.lang.String getCurrentColumn()Returns the name of the current data column- Returns:
-
getCurrentDataColumn
Returns the current VertexDataColumn.- Returns:
-
newVertexData
Returns a new array of the same size as this shape, with the specified data type- Parameters:
transfer_type
-- Returns:
-
getVertexDataMap
Retrieves a hash map containing the vertex-wise data associated with this shape.- Returns:
-
setVertexDataMap
public void setVertexDataMap(java.util.HashMap<java.lang.String,java.util.ArrayList<MguiNumber>> data)Sets the hash map specified the vertex-wise data associated with this shape.- Parameters:
data
-
-
setVertexData
Sets the data in the current column.- Parameters:
column
-data
-
-
setVertexData
Sets the data incolumn
.- Parameters:
column
-data
-
-
setVertexData
public boolean setVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data, boolean update)Sets the data incolumn
.- Parameters:
column
-data
-Whether
- to inform listeners of this update
-
getCurrentVertexData
Retrieves the currently selected vertex-wise data column. -
getLinkedVertexDatum
Returns the value at the given vertex, for the given linked column.- Parameters:
linked_column
-index
-- Returns:
-
getLinkedVertexData
Retrieves the vertex-wise data associated with a data-linked column.- Parameters:
linked_column
-- Returns:
-
hasColumn
public boolean hasColumn(java.lang.String s) -
setCurrentColumn
public void setCurrentColumn(java.lang.String key) -
setCurrentColumn
public void setCurrentColumn(java.lang.String key, boolean update) -
getVertexData
Returns a live version of the data in the current column.- Parameters:
column
-- Returns:
-
getVertexData
Returns a live version of the data incolumn
.- Parameters:
column
-- Returns:
-
getAllVertexData
Returns all vertex-wide data associated with this shape.- Parameters:
column
-- Returns:
-
getDatumAtVertex
Returns the datum from the current column atindex
.- Parameters:
column
-index
-- Returns:
-
getDatumAtVertex
Returns the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVertex
Sets the datum from the current column atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVertex
Sets the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVertex
public boolean setDatumAtVertex(int index, double datum)Sets the datum from the current column atindex
.- Parameters:
column
-index
-- Returns:
-
setDatumAtVertex
public boolean setDatumAtVertex(java.lang.String column, int index, double datum)Sets the datum fromcolumn
atindex
.- Parameters:
column
-index
-- Returns:
-
hasData
public boolean hasData() -
showData
public void showData(boolean b) -
showData
public boolean showData() -
getNonLinkedDataColumns
public java.util.ArrayList<java.lang.String> getNonLinkedDataColumns()Returns a list of this shape's data columns, minus the linked columns.- Returns:
-
updateDataColumns
protected void updateDataColumns() -
setDefaultColourMap
COLOUR MAP STUFF -
setDefaultColourMap
-
getColourMap
Returns the ColourMap associated with the current data column. If there is no associated colour map, returns the default colour map for this shape.- Returns:
-
getDefaultColourMap
-
setColourMap
Sets the colour map for the current column.- Parameters:
column
-cm
-
-
setColourMap
Sets the colour map forcolumn
.- Parameters:
column
-cm
-
-
getColourMap
Gets the colour map forcolumn
.- Parameters:
column
-cm
-
-
removeColourMap
public void removeColourMap(java.lang.String key) -
getNameMap
Returns the name map associated with the current column, ornull
if there is no column, or no name map associated with it.- Returns:
-
getNameMap
Returns the name map associated withcolumn
, ornull
if there is no name map associated with it.- Returns:
-
setNameMap
Sets the name map associated with columnkey
.- Parameters:
key
-map
-
-
removeNameMap
public void removeNameMap(java.lang.String key)Removes the name map associated with columnkey
.- Parameters:
key
-map
-
-
getDataLink
DATA LINK STUFF -
addDataLink
public void addDataLink(java.lang.String column, java.lang.String key, LinkedDataStream<?> link_stream) -
removeDataLink
public void removeDataLink(java.lang.String column, java.lang.String key) -
queryObject
QUERY STUFF- Specified by:
queryObject
in interfaceInterfaceQueryObject
- Returns:
- an instance of
InterfaceQuery
- See Also:
InterfaceQuery
-
queryShapeAtVertex
Description copied from interface:InterfaceShapeQueryObject
Updatesquery
with information pertaining to the specifiedvertex
.- Specified by:
queryShapeAtVertex
in interfaceInterfaceShapeQueryObject
- Returns:
-
getXML
public java.lang.String getXML()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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
getXML
-
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObject
Returns the XML schema for this object's XML representation- Specified by:
getXMLSchema
in interfaceXMLObject
- Returns:
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the start of an XML element.- Specified by:
handleXMLElementStart
in interfaceXMLObject
- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
of this element- Throws:
org.xml.sax.SAXException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the end of an XML element.- Specified by:
handleXMLElementEnd
in interfaceXMLObject
- Parameters:
localName
- Local name of the element- Throws:
org.xml.sax.SAXException
-
finalizeAfterXML
public void finalizeAfterXML()Allows subclasses to do some finalization after an XML load operation. Does nothing by default. -
handleXMLString
public void handleXMLString(java.lang.String s) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles a string within an XML element.- Specified by:
handleXMLString
in interfaceXMLObject
- Parameters:
s
- String to handle- Throws:
org.xml.sax.SAXException
-
setXMLRoot
public void setXMLRoot(java.lang.String root_dir) -
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file, asXMLType.Normal
. The default format ofXMLFormat.Ascii
will be used. The basic contract for this method is that it should not write a newline character at its start or end. -
getByReferenceUrls
public java.util.List<java.lang.String> getByReferenceUrls()Returns a URL string for the latest call to writeXML(int,java.io.Writer). Isnull
if no call has yet been made, or the latest write was not by reference.- Returns:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used. -
cleanTreeNodes
public void cleanTreeNodes()TREE NODE STUFF -
setTreeNode
Constructs a tree node from this shape. Adds anAttributeTreeNode
via thesuper
method, and also adds a node to display the vertex-wise data columns associated with this ShapeInt.If overriding this method, subclass implementations should first call this super method to initialize the node and provide a basic construction.
- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in classAbstractInterfaceObject
- Parameters:
treeNode
- the tree node to construct
-
fireShapeModified
public void fireShapeModified()Notifies this shape that it has been modified and should inform its listeners -
fireShapeListeners
-
addShapeListener
-
removeShapeListener
-
getVariables
public java.util.ArrayList<java.lang.String> getVariables()Returns this shape's columns as a list of variables. Note that the names will have been altered to remove special characters, including spaces, operators, and brackets- Specified by:
getVariables
in interfaceVariableObject
- Returns:
- The list of variables contained in this object
-
toVariable
public static java.lang.String toVariable(java.lang.String string)Converts a column name to a legitimate variable name- Parameters:
string
-- Returns:
-
fromVariable
public static java.lang.String fromVariable(java.lang.String string)Converts a variable name back to its original column name- Parameters:
string
-- Returns:
-
getVariableValue
public double getVariableValue(java.lang.String variable, int[] element)Description copied from interface:VariableObject
Returns the value of a variable in this object, at the specified element location. Ifelement
is not of the correct length for the variable object (i.e., as determined by the length ofVariableObject.getDimensions()
), a value ofDouble.NaN
is returned.- Specified by:
getVariableValue
in interfaceVariableObject
- Parameters:
variable
- Name of the variableelement
- The element at which to retrieve a value- Returns:
- The value at
element
, as adouble
-
getVariableValues
public java.lang.Object getVariableValues(java.lang.String variable)Description copied from interface:VariableObject
Returns an object containing the set of values forvariable
. The returned class type is specified byVariableObject.getVariableType()
.- Specified by:
getVariableValues
in interfaceVariableObject
- Returns:
- The values corresponding to
variable
-
setVariableValues
public boolean setVariableValues(java.lang.String variable, java.lang.Object values)Description copied from interface:VariableObject
Sets the variable's values with thevalues
object, which must be a type acceptable to the variable object. If not, a value offalse
is returned.- Specified by:
setVariableValues
in interfaceVariableObject
- Parameters:
variable
- The variable to updatevalues
- AnObject
containing the new data
-
setVariableValues
public boolean setVariableValues(java.lang.String variable, java.lang.Object values, VertexSelection selection) -
getVariableType
public java.lang.Class<?> getVariableType()Description copied from interface:VariableObject
Specifies the class type of the object returned bygetVariableValues()
.- Specified by:
getVariableType
in interfaceVariableObject
- Returns:
- The class type
-
supportsVariableType
public boolean supportsVariableType(java.lang.Class<?> type)Description copied from interface:VariableObject
Specifies whether this variable object supports the given class type when setting variables. TODO: solve erasure issue which prevents type-checking of genericArrayList
s. See {@link http://bugs.sun.com/view_bug.do?bug_id=5098163}- Specified by:
supportsVariableType
in interfaceVariableObject
- Returns:
true
, if this class type is supported
-
getVertexSelection
Returns a list of the currently selected vertices for this shape. -
setVertexSelection
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Returns an icon for this shape, if one has been defined. Returns null otherwise.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
setIcon
protected void setIcon() -
getModel
-
setParentSet
Sets this shape's parent set toset
. If this shape already has a parent, removes itself from the existing parent, including the shape listener.- Parameters:
set
-
-
getParentSet
-
getID
public long getID() -
setID
public void setID(long id) -
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<InterfaceShape>
-
setConstraint
public void setConstraint(int i, boolean c) -
getConstraint
public boolean getConstraint(int i) -
getConstraints
public boolean[] getConstraints()
-