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 classInterfaceShape.VertexDataSetNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected AttributeListattributesprotected boolean[]constraintsjava.util.ArrayList<java.lang.String>data_columnsprotected javax.swing.Iconiconprotected longIDprotected booleanis_auxiliaryprotected booleanis_registeredprotected booleanisDrawableprotected booleanisImageShapeprotected booleanisLightprotected booleanisOverriddenprotected VertexDataColumnlast_column_addedprotected VertexDataColumnlast_column_changedprotected VertexDataColumnlast_column_removedprotected java.util.HashMap<java.lang.String,ColourMap>linked_colour_mapsprotected InterfaceIOOptionsloader_optionsbooleannotifyListenersLOCAL VARIABLESprotected AttributeListoverrideAttrprotected ShapeSetparent_setprotected VertexSelectionselected_nodesprotected java.util.ArrayList<ShapeListener>shapeListenersprotected java.util.HashMap<java.lang.String,VertexDataColumn>vertex_dataprotected InterfaceIOOptionswriter_optionsprotected VertexDataColumnxml_current_columnprotected InterfaceShapeLoaderxml_current_loaderprotected Shapexml_current_shapeprotected ShapeInputOptionsxml_current_shape_optionsprotected XMLObject.XMLTypexml_current_typeXML STUFFprotected java.lang.Stringxml_current_urlprotected booleanxml_is_vertex_dataprotected java.lang.Stringxml_root_dirFields 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()INITIALIZATIONvoidaddDataLink(java.lang.String column, java.lang.String key, LinkedDataStream<?> link_stream)voidaddShapeListener(ShapeListener thisListener)booleanaddVertexData(java.lang.String key)Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE.booleanaddVertexData(java.lang.String column, double[] data)Add data as a double arraybooleanaddVertexData(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.booleanaddVertexData(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.booleanaddVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data)Adds a new vertex data column and populates it withdata.booleanaddVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, ColourMap cmap)Adds vertex-wise data to this shape.booleanaddVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, NameMap nmap)Adds vertex-wise data to this shape.booleanaddVertexData(java.lang.String key, java.util.ArrayList<MguiNumber> data, NameMap nmap, ColourMap cmap)Adds vertex-wise data to this shape.booleanaddVertexData(VertexDataColumn column)Add a vertex-wise data column of typeDataBuffer.TYPE_DOUBLE.voidcleanTreeNodes()TREE NODE STUFFintcompareTo(InterfaceShape s)booleancopyAttributes(InterfaceShape source_shape)Copiesattributesto this shape.abstract voiddrawShape2D(java.awt.Graphics2D g, DrawingEngine d)ABSTRACT METHODSvoidfinalizeAfterXML()Allows subclasses to do some finalization after an XML load operation.protected voidfireShapeListeners(ShapeEvent e)voidfireShapeModified()Notifies this shape that it has been modified and should inform its listenersstatic java.lang.StringfromVariable(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 floatgetAlpha()Gets the current transparency level for this shape.Attribute<?>getAttribute(java.lang.String attrName)Returns a specific attribute for this object.AttributeListgetAttributes()Returns the list of current attributes for this object.java.lang.ObjectgetAttributeValue(java.lang.String name)Gets the value of attributename, ornullif 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).ColourMapgetColourMap()Returns the ColourMap associated with the current data column.ColourMapgetColourMap(java.lang.String key)Gets the colour map forcolumn.booleangetConstraint(int i)boolean[]getConstraints()java.lang.StringgetCurrentColumn()Returns the name of the current data columnVertexDataColumngetCurrentDataColumn()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 STUFFdoublegetDataMax()doublegetDataMin()MguiNumbergetDatumAtVertex(int index)Returns the datum from the current column atindex.MguiNumbergetDatumAtVertex(java.lang.String column, int index)Returns the datum fromcolumnatindex.ColourMapgetDefaultColourMap()FileLoadergetFileLoader()Returns an instance of the file loader associated with this persistent object.FileWritergetFileWriter()Returns an instance of the file writer associated with this persistent object.java.lang.StringgetFullName()Returns a full name of this shape, including its parent model and shape sets, separated by dots.abstract ShapegetGeometry()Returns the Shape associated with this objectabstract ShapegetGeometryInstance()Returns an instance of thisInterfaceShape's geometry class.longgetID()Attribute<?>getInheritedAttribute(java.lang.String attrName)Returns the (possibly inherited) named attribute.AttributeListgetInheritedAttributes()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.ObjectgetInheritedAttributeValue(java.lang.String name)Returns the (possibly inherited) value of the named attribute.abstract java.awt.ColorgetLabelColour()abstract java.awt.FontgetLabelFont()abstract floatgetLabelScale()VertexDataColumngetLastColumnAdded()VERTEX DATA STUFFVertexDataColumngetLastColumnChanged()VertexDataColumngetLastColumnRemoved()protected java.lang.StringgetLegalName(java.lang.String name)abstract java.awt.ColorgetLineColour()Returns the colour of this shape's lines/edges.abstract java.awt.StrokegetLineStyle()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.MguiNumbergetLinkedVertexDatum(java.lang.String linked_column, int index)Returns the value at the given vertex, for the given linked column.InterfaceIOOptionsgetLoaderOptions()Returns the options used to last load this object, if availableShapeModel3DgetModel()abstract Attribute<?>getModifiedAttribute()java.lang.StringgetName()Gets the name for this object.NameMapgetNameMap()Returns the name map associated with the current column, ornullif there is no column, or no name map associated with it.NameMapgetNameMap(java.lang.String key)Returns the name map associated withcolumn, ornullif 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.IcongetObjectIcon()Returns an icon for this shape, if one has been defined.protected abstract Attribute<?>getParentAttribute(java.lang.String attrName)ShapeSetgetParentSet()InterfacePopupMenugetPopupMenu()Produces and returns a popup menu for this object.java.lang.StringgetSourceURL()SpatialUnitgetUnit()Returns the spatial unit for this shape set.java.net.URLgetUrlReference()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().doublegetVariableValue(java.lang.String variable, int[] element)Returns the value of a variable in this object, at the specified element location.java.lang.ObjectgetVariableValues(java.lang.String variable)Returns an object containing the set of values forvariable.abstract java.awt.ColorgetVertexColour()Returns the colour of this shape's vertices.abstract intgetVertexCount()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.VertexDataColumngetVertexDataColumn(java.lang.String name)Returns the vertex data column associated withname.intgetVertexDataColumnCount()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 floatgetVertexScale()Returns the scale of this shape's verticesabstract VertexSelectiongetVertexSelection()Returns a list of the currently selected vertices for this shape.InterfaceIOOptionsgetWriterOptions()Returns the options used to last write this object, if availablejava.lang.StringgetXML()Returns this object's XML representation as a single string.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.java.lang.StringgetXML(int tab, XMLObject.XMLType type)java.lang.StringgetXMLSchema()Returns the XML schema for this object's XML representationvoidhandleXMLElementEnd(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.voidhandleXMLString(java.lang.String s)Handles a string within an XML element.abstract booleanhasAlpha()Queries whether this shape has transparency.abstract voidhasAlpha(boolean b)Specifies whether this shape has transparency.booleanhasAttribute(java.lang.String name)Determines whether this object has an attribute namedname.booleanhasColumn(java.lang.String s)booleanhasData()abstract booleanhasParentShape()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.booleaninheritAttributesFromParent()booleanisAuxiliaryShape()CORE ATTRIBUTESvoidisAuxiliaryShape(boolean is_auxiliary)booleanisDestroyed()Test whether this object has been destroyedbooleanisDrawable()abstract booleanisHeritableAttribute(java.lang.String name)Is this parent attribute inherited by a child shape?booleanisImageShape()abstract booleanisInheritingAttribute(Attribute<?> attribute)Does this child attribute inherit values from a parent shape?booleanisLegalName(java.lang.String name)Is this a legal name for a shape.booleanisLight()booleanisSelectable()Returns the selectability of thisInterfaceShape.booleanisVisible()Returns the visibility of thisInterfaceShape.abstract booleanneedsRedraw(Attribute<?> attribute)Returnstrueif a change toattributewill 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 typebooleanqueryObject(InterfaceQuery query)QUERY STUFFbooleanqueryShapeAtVertex(int vertex, InterfaceShapeQuery query)Updatesquerywith information pertaining to the specifiedvertex.voidregister()Registers this shape with the current session, if it hasn't already been done, by assigning it a unique identifier.voidremoveColourMap(java.lang.String key)voidremoveDataLink(java.lang.String column, java.lang.String key)voidremoveNameMap(java.lang.String key)Removes the name map associated with columnkey.voidremoveShapeListener(ShapeListener thisListener)voidremoveVertexData(java.lang.String key)Remove a vertex data column from this shape.booleanrenameVertexDataColumn(java.lang.String old_name, java.lang.String new_name)Renames the current column.abstract voidsetAlpha(float f)Sets the current transparency level for this shape.voidsetAttribute(java.lang.String attrName, java.lang.Object newValue)Sets a value for a specific attribute.voidsetAttributes(AttributeList thisList)Sets the list of attributes for this object.voidsetColourMap(java.lang.String column, ColourMap cm)Sets the colour map forcolumn.voidsetColourMap(ColourMap cm)Sets the colour map for the current column.voidsetConstraint(int i, boolean c)voidsetCurrentColumn(java.lang.String key)voidsetCurrentColumn(java.lang.String key, boolean update)voidsetDataMax(double d)Sets the data maximum for the current column, and fires an eventvoidsetDataMax(double d, boolean update)Sets the data maximum for the current columnvoidsetDataMax(java.lang.String column, double d, boolean update)Sets the data maximum for thecolumnvoidsetDataMin(double d)Sets the data minimum for the current column, and fires an eventvoidsetDataMin(double d, boolean update)Sets the data minimum for the current columnvoidsetDataMin(java.lang.String column, double d, boolean update)Sets the data minimum for thecolumnbooleansetDatumAtVertex(int index, double datum)Sets the datum from the current column atindex.booleansetDatumAtVertex(int index, MguiNumber datum)Sets the datum from the current column atindex.booleansetDatumAtVertex(java.lang.String column, int index, double datum)Sets the datum fromcolumnatindex.booleansetDatumAtVertex(java.lang.String column, int index, MguiNumber datum)Sets the datum fromcolumnatindex.voidsetDefaultColourMap(ColourMap cm)COLOUR MAP STUFFvoidsetDefaultColourMap(ColourMap cm, boolean update)voidsetFileLoader(java.lang.String loader)PERSISTENCE STUFFbooleansetFileLoader(InterfaceIOType io_type)Sets theInterfaceIOTypeassociated with this persistent object's loader.booleansetFileWriter(InterfaceIOType io_type)Sets theInterfaceIOTypeassociated with this persistent object's writer.abstract booleansetGeometry(Shape geometry)Sets the Shape associated with this object.protected voidsetIcon()voidsetID(long id)abstract voidsetLabelColour(java.awt.Color colour)abstract voidsetLabelFont(java.awt.Font font)abstract voidsetLabelScale(float scale)abstract voidsetLineStyle(java.awt.Stroke s)Returns the line/edge style for this shape.voidsetLoaderOptions(InterfaceIOOptions options)Sets the options used to last load this object; can benull.voidsetName(java.lang.String name)Sets the name for this object.voidsetNameMap(java.lang.String key, NameMap map)Sets the name map associated with columnkey.voidsetOverride(AttributeList attr)voidsetParentSet(ShapeSet set)Sets this shape's parent set toset.voidsetSelectable(boolean b)Sets the selectability of thisInterfaceShapetotrue.voidsetTreeNode(InterfaceTreeNode treeNode)Constructs a tree node from this shape.voidsetUnit(SpatialUnit unit)voidsetUrlReference(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.booleansetVariableValues(java.lang.String variable, java.lang.Object values)Sets the variable's values with thevaluesobject, which must be a type acceptable to the variable object.booleansetVariableValues(java.lang.String variable, java.lang.Object values, VertexSelection selection)booleansetVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data)Sets the data incolumn.booleansetVertexData(java.lang.String column, java.util.ArrayList<MguiNumber> data, boolean update)Sets the data incolumn.booleansetVertexData(java.util.ArrayList<MguiNumber> data)Sets the data in the current column.voidsetVertexDataMap(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 voidsetVertexSelection(VertexSelection selection)voidsetVisible(boolean b)Sets the visibility of thisInterfaceShapetotrue.voidsetWriterOptions(InterfaceIOOptions options)Sets the options used to last write this object; can benull.voidsetXMLRoot(java.lang.String root_dir)booleanshow2D()voidshow2D(boolean b)Specifies whether to show this shape in 2D.booleanshow3D()voidshow3D(boolean b)Specifies whether to show this shape in 2D.booleanshowData()voidshowData(boolean b)abstract booleanshowVertices()Queries whether the vertices of this shape are visible.abstract voidshowVertices(boolean b)Specifies whether the vertices of this shape are visible.booleansupportsVariableType(java.lang.Class<?> type)Specifies whether this variable object supports the given class type when setting variables.static java.lang.StringtoVariable(java.lang.String string)Converts a column name to a legitimate variable namevoidunsetOverride()protected voidupdateDataColumns()abstract voidupdateShape()voidvertexDataColumnChanged(VertexDataColumnEvent event)voidvertexDataColumnColourMapChanged(VertexDataColumnEvent event)voidwriteXML(int tab, java.io.Writer writer)Writes the XML representation of this object to file.voidwriteXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)Writes the XML representation of this object to file, asXMLType.Normal.voidwriteXML(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, updateTreeNodesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mgui.interfaces.attributes.AttributeListener
attributeUpdatedMethods inherited from interface mgui.interfaces.util.CleanableObject
cleanMethods inherited from interface mgui.interfaces.InterfaceObject
destroyMethods inherited from interface mgui.interfaces.transfers.InterfaceTransferable
performTransferMethods inherited from interface mgui.interfaces.menus.PopupMenuObject
getPopupMenu, handlePopupEvent, showPopupMenuMethods inherited from interface java.awt.datatransfer.Transferable
getTransferData, getTransferDataFlavors, isDataFlavorSupportedMethods inherited from interface mgui.interfaces.trees.TreeObject
getTreeLabel, issueTreeNodeMethods inherited from interface mgui.interfaces.math.VariableObject
getDimensionsMethods 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
Returnstrueif a change toattributewill 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
Copiesattributesto 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:
trueif visible
-
setVisible
public void setVisible(boolean b)Sets the visibility of thisInterfaceShapetotrue.- Parameters:
b-
-
inheritAttributesFromParent
public boolean inheritAttributesFromParent() -
isSelectable
public boolean isSelectable()Returns the selectability of thisInterfaceShape.- Returns:
trueif visible
-
setSelectable
public void setSelectable(boolean b)Sets the selectability of thisInterfaceShapetotrue.- Parameters:
b-
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObjectGets the value of attributename, ornullif it does not exist.- Specified by:
getAttributeValuein interfaceAttributeObject- Parameters:
name- Name of the attribute- Returns:
- the value of attribute
name, ornullif it does not exist
-
getAttribute
Description copied from interface:AttributeObjectReturns a specific attribute for this object.- Specified by:
getAttributein 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:AttributeObjectReturns the list of current attributes for this object.- Specified by:
getAttributesin 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:AttributeObjectSets a value for a specific attribute.- Specified by:
setAttributein interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObjectSets the list of attributes for this object.- Specified by:
setAttributesin interfaceAttributeObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObjectTest whether this object has been destroyed- Specified by:
isDestroyedin interfaceInterfaceObject- Overrides:
isDestroyedin classAbstractInterfaceObject- Returns:
-
setName
public void setName(java.lang.String name)Description copied from interface:NamedObjectSets the name for this object.- Specified by:
setNamein interfaceNamedObject- Overrides:
setNamein classAbstractInterfaceObject
-
getName
public java.lang.String getName()Description copied from interface:NamedObjectGets the name for this object.- Specified by:
getNamein interfaceNamedObject- Specified by:
getNamein interfaceVariableObject- Overrides:
getNamein 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:PopupMenuObjectProduces and returns a popup menu for this object.- Specified by:
getPopupMenuin 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:PersistentObjectReturns an instance of the file loader associated with this persistent object.- Specified by:
getFileLoaderin interfacePersistentObject- Returns:
-
setFileLoader
Description copied from interface:PersistentObjectSets theInterfaceIOTypeassociated with this persistent object's loader.- Specified by:
setFileLoaderin interfacePersistentObject- Returns:
-
getFileWriter
Description copied from interface:PersistentObjectReturns an instance of the file writer associated with this persistent object.- Specified by:
getFileWriterin interfacePersistentObject- Returns:
-
getLoaderOptions
Description copied from interface:PersistentObjectReturns the options used to last load this object, if available- Specified by:
getLoaderOptionsin interfacePersistentObject- Returns:
- The options, or
nullif none exist
-
setLoaderOptions
Description copied from interface:PersistentObjectSets the options used to last load this object; can benull.- Specified by:
setLoaderOptionsin interfacePersistentObject
-
setFileWriter
Description copied from interface:PersistentObjectSets theInterfaceIOTypeassociated with this persistent object's writer.- Specified by:
setFileWriterin interfacePersistentObject- Returns:
-
getWriterOptions
Description copied from interface:PersistentObjectReturns the options used to last write this object, if available- Specified by:
getWriterOptionsin interfacePersistentObject- Returns:
- The options, or
nullif none exist
-
setWriterOptions
Description copied from interface:PersistentObjectSets the options used to last write this object; can benull.- Specified by:
setWriterOptionsin interfacePersistentObject
-
getUrlReference
public java.net.URL getUrlReference()Description copied from interface:PersistentObjectReturns the URL reference for this persistent object; i.e., the location where its data were loaded and where it should be written.- Specified by:
getUrlReferencein interfacePersistentObject- Returns:
-
setUrlReference
public void setUrlReference(java.net.URL ref)Description copied from interface:PersistentObjectSets the URL reference for this persistent object; i.e., the location where its data were loaded and where it should be written.- Specified by:
setUrlReferencein interfacePersistentObject
-
getLastColumnAdded
VERTEX DATA STUFF -
getLastColumnRemoved
-
getLastColumnChanged
-
vertexDataColumnChanged
- Specified by:
vertexDataColumnChangedin interfaceVertexDataColumnListener
-
vertexDataColumnColourMapChanged
- Specified by:
vertexDataColumnColourMapChangedin 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:
falseif a column namednew_namealready exists, or no column namedold_nameexists;trueotherwise
-
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 fromcolumnatindex.- Parameters:
column-index-- Returns:
-
setDatumAtVertex
Sets the datum from the current column atindex.- Parameters:
column-index-- Returns:
-
setDatumAtVertex
Sets the datum fromcolumnatindex.- 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 fromcolumnatindex.- 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, ornullif there is no column, or no name map associated with it.- Returns:
-
getNameMap
Returns the name map associated withcolumn, ornullif 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:
queryObjectin interfaceInterfaceQueryObject- Returns:
- an instance of
InterfaceQuery - See Also:
InterfaceQuery
-
queryShapeAtVertex
Description copied from interface:InterfaceShapeQueryObjectUpdatesquerywith information pertaining to the specifiedvertex.- Specified by:
queryShapeAtVertexin interfaceInterfaceShapeQueryObject- Returns:
-
getXML
public java.lang.String getXML()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. -
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. -
getXML
-
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObjectReturns the XML schema for this object's XML representation- Specified by:
getXMLSchemain 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:XMLObjectHandles the start of an XML element.- Specified by:
handleXMLElementStartin interfaceXMLObject- Parameters:
localName- Local name of the elementattributes- Set of element attributestype- TheXMLTypeof this element- Throws:
org.xml.sax.SAXException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObjectHandles the end of an XML element.- Specified by:
handleXMLElementEndin 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:XMLObjectHandles a string within an XML element.- Specified by:
handleXMLStringin 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:XMLObjectWrites 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.Asciiwill be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites the XML representation of this object to file, asXMLType.Normal. The default format ofXMLFormat.Asciiwill 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). Isnullif 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:XMLObjectWrites 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.Asciiwill be used. -
cleanTreeNodes
public void cleanTreeNodes()TREE NODE STUFF -
setTreeNode
Constructs a tree node from this shape. Adds anAttributeTreeNodevia thesupermethod, 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:
setTreeNodein interfaceTreeObject- Overrides:
setTreeNodein 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:
getVariablesin 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:VariableObjectReturns the value of a variable in this object, at the specified element location. Ifelementis not of the correct length for the variable object (i.e., as determined by the length ofVariableObject.getDimensions()), a value ofDouble.NaNis returned.- Specified by:
getVariableValuein 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:VariableObjectReturns an object containing the set of values forvariable. The returned class type is specified byVariableObject.getVariableType().- Specified by:
getVariableValuesin interfaceVariableObject- Returns:
- The values corresponding to
variable
-
setVariableValues
public boolean setVariableValues(java.lang.String variable, java.lang.Object values)Description copied from interface:VariableObjectSets the variable's values with thevaluesobject, which must be a type acceptable to the variable object. If not, a value offalseis returned.- Specified by:
setVariableValuesin interfaceVariableObject- Parameters:
variable- The variable to updatevalues- AnObjectcontaining 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:VariableObjectSpecifies the class type of the object returned bygetVariableValues().- Specified by:
getVariableTypein interfaceVariableObject- Returns:
- The class type
-
supportsVariableType
public boolean supportsVariableType(java.lang.Class<?> type)Description copied from interface:VariableObjectSpecifies whether this variable object supports the given class type when setting variables. TODO: solve erasure issue which prevents type-checking of genericArrayLists. See {@link http://bugs.sun.com/view_bug.do?bug_id=5098163}- Specified by:
supportsVariableTypein 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:
getObjectIconin 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:
compareToin interfacejava.lang.Comparable<InterfaceShape>
-
setConstraint
public void setConstraint(int i, boolean c) -
getConstraint
public boolean getConstraint(int i) -
getConstraints
public boolean[] getConstraints()
-