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
  • Field Details

    • notifyListeners

      public boolean notifyListeners
      LOCAL VARIABLES
    • shapeListeners

      protected java.util.ArrayList<ShapeListener> shapeListeners
    • attributes

      protected AttributeList attributes
    • parent_set

      protected ShapeSet parent_set
    • isDrawable

      protected boolean isDrawable
    • isLight

      protected boolean isLight
    • isImageShape

      protected boolean isImageShape
    • overrideAttr

      protected AttributeList overrideAttr
    • isOverridden

      protected boolean isOverridden
    • vertex_data

      protected java.util.HashMap<java.lang.String,​VertexDataColumn> vertex_data
    • data_columns

      public java.util.ArrayList<java.lang.String> data_columns
    • constraints

      protected boolean[] constraints
    • selected_nodes

      protected VertexSelection selected_nodes
    • linked_colour_maps

      protected java.util.HashMap<java.lang.String,​ColourMap> linked_colour_maps
    • icon

      protected javax.swing.Icon icon
    • ID

      protected long ID
    • is_auxiliary

      protected boolean is_auxiliary
    • last_column_added

      protected VertexDataColumn last_column_added
    • last_column_removed

      protected VertexDataColumn last_column_removed
    • last_column_changed

      protected VertexDataColumn last_column_changed
    • loader_options

      protected InterfaceIOOptions loader_options
    • writer_options

      protected InterfaceIOOptions writer_options
    • is_registered

      protected boolean is_registered
    • xml_current_type

      protected XMLObject.XMLType xml_current_type
      XML STUFF
    • xml_current_shape_options

      protected ShapeInputOptions xml_current_shape_options
    • xml_current_url

      protected java.lang.String xml_current_url
    • xml_current_loader

      protected InterfaceShapeLoader xml_current_loader
    • xml_current_shape

      protected Shape xml_current_shape
    • xml_current_column

      protected VertexDataColumn 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

      public abstract void drawShape2D​(java.awt.Graphics2D g, DrawingEngine d)
      ABSTRACT METHODS
    • updateShape

      public abstract void updateShape()
    • getGeometry

      public abstract Shape getGeometry()
      Returns the Shape associated with this object
      Returns:
    • setGeometry

      public abstract boolean setGeometry​(Shape geometry)
      Sets the Shape associated with this object. If the class type is incorrect, returns false
      Returns:
    • getGeometryInstance

      public abstract Shape getGeometryInstance()
      Returns an instance of this InterfaceShape's geometry class.
      Returns:
    • needsRedraw

      public abstract boolean needsRedraw​(Attribute<?> attribute)
      Returns true if a change to attribute will require a redraw of this shape.
      Parameters:
      attribute -
      Returns:
    • getModifiedAttribute

      public abstract Attribute<?> 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

      public SpatialUnit getUnit()
      Returns the spatial unit for this shape set.
      Returns:
      the spatial unit for this shape set
    • setUnit

      public void setUnit​(SpatialUnit unit)
    • copyAttributes

      public boolean copyAttributes​(InterfaceShape source_shape)
      Copies attributes 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

      public abstract boolean isInheritingAttribute​(Attribute<?> attribute)
      Does this child attribute inherit values from a parent shape?
      Parameters:
      attribute -
      Returns:
    • isVisible

      public boolean isVisible()
      Returns the visibility of this InterfaceShape.
      Returns:
      true if visible
    • setVisible

      public void setVisible​(boolean b)
      Sets the visibility of this InterfaceShape to true.
      Parameters:
      b -
    • inheritAttributesFromParent

      public boolean inheritAttributesFromParent()
    • isSelectable

      public boolean isSelectable()
      Returns the selectability of this InterfaceShape.
      Returns:
      true if visible
    • setSelectable

      public void setSelectable​(boolean b)
      Sets the selectability of this InterfaceShape to true.
      Parameters:
      b -
    • getAttributeValue

      public java.lang.Object getAttributeValue​(java.lang.String name)
      Description copied from interface: AttributeObject
      Gets the value of attribute name, or null if it does not exist.
      Specified by:
      getAttributeValue in interface AttributeObject
      Parameters:
      name - Name of the attribute
      Returns:
      the value of attribute name, or null if it does not exist
    • getAttribute

      public Attribute<?> getAttribute​(java.lang.String attrName)
      Description copied from interface: AttributeObject
      Returns a specific attribute for this object.
      Specified by:
      getAttribute in interface AttributeObject
      Returns:
    • getInheritedAttributeValue

      public java.lang.Object getInheritedAttributeValue​(java.lang.String name)
      Returns the (possibly inherited) value of the named attribute.
      Parameters:
      name -
      Returns:
    • getInheritedAttribute

      public Attribute<?> getInheritedAttribute​(java.lang.String attrName)
      Returns the (possibly inherited) named attribute.
    • getParentAttribute

      protected abstract Attribute<?> getParentAttribute​(java.lang.String attrName)
    • hasAttribute

      public boolean hasAttribute​(java.lang.String name)
      Determines whether this object has an attribute named name.
      Parameters:
      name -
      Returns:
    • getAttributes

      public AttributeList getAttributes()
      Description copied from interface: AttributeObject
      Returns the list of current attributes for this object.
      Specified by:
      getAttributes in interface AttributeObject
      Returns:
    • getInheritedAttributes

      public 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).
      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 interface AttributeObject
    • setAttributes

      public void setAttributes​(AttributeList thisList)
      Description copied from interface: AttributeObject
      Sets the list of attributes for this object.
      Specified by:
      setAttributes in interface AttributeObject
    • isDestroyed

      public boolean isDestroyed()
      Description copied from interface: InterfaceObject
      Test whether this object has been destroyed
      Specified by:
      isDestroyed in interface InterfaceObject
      Overrides:
      isDestroyed in class AbstractInterfaceObject
      Returns:
    • setName

      public void setName​(java.lang.String name)
      Description copied from interface: NamedObject
      Sets the name for this object.
      Specified by:
      setName in interface NamedObject
      Overrides:
      setName in class AbstractInterfaceObject
    • getName

      public java.lang.String getName()
      Description copied from interface: NamedObject
      Gets the name for this object.
      Specified by:
      getName in interface NamedObject
      Specified by:
      getName in interface VariableObject
      Overrides:
      getName in class AbstractInterfaceObject
    • 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

      public InterfacePopupMenu getPopupMenu()
      Description copied from interface: PopupMenuObject
      Produces and returns a popup menu for this object.
      Specified by:
      getPopupMenu in interface PopupMenuObject
      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

      public void setOverride​(AttributeList attr)
    • 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 event
      d -
    • setDataMin

      public void setDataMin​(java.lang.String column, double d, boolean update)
      Sets the data minimum for the column
      Parameters:
      column - Column to set minimum for
      update - Whether to fire an event
      d -
    • 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 event
      d -
    • setDataMax

      public void setDataMax​(java.lang.String column, double d, boolean update)
      Sets the data maximum for the column
      Parameters:
      column - Column to set maximum for
      update - Whether to fire an event
      d -
    • 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

      public FileLoader getFileLoader()
      Description copied from interface: PersistentObject
      Returns an instance of the file loader associated with this persistent object.
      Specified by:
      getFileLoader in interface PersistentObject
      Returns:
    • setFileLoader

      public boolean setFileLoader​(InterfaceIOType io_type)
      Description copied from interface: PersistentObject
      Sets the InterfaceIOType associated with this persistent object's loader.
      Specified by:
      setFileLoader in interface PersistentObject
      Returns:
    • getFileWriter

      public FileWriter getFileWriter()
      Description copied from interface: PersistentObject
      Returns an instance of the file writer associated with this persistent object.
      Specified by:
      getFileWriter in interface PersistentObject
      Returns:
    • getLoaderOptions

      public InterfaceIOOptions getLoaderOptions()
      Description copied from interface: PersistentObject
      Returns the options used to last load this object, if available
      Specified by:
      getLoaderOptions in interface PersistentObject
      Returns:
      The options, or null if none exist
    • setLoaderOptions

      public void setLoaderOptions​(InterfaceIOOptions options)
      Description copied from interface: PersistentObject
      Sets the options used to last load this object; can be null.
      Specified by:
      setLoaderOptions in interface PersistentObject
    • setFileWriter

      public boolean setFileWriter​(InterfaceIOType io_type)
      Description copied from interface: PersistentObject
      Sets the InterfaceIOType associated with this persistent object's writer.
      Specified by:
      setFileWriter in interface PersistentObject
      Returns:
    • getWriterOptions

      public InterfaceIOOptions getWriterOptions()
      Description copied from interface: PersistentObject
      Returns the options used to last write this object, if available
      Specified by:
      getWriterOptions in interface PersistentObject
      Returns:
      The options, or null if none exist
    • setWriterOptions

      public void setWriterOptions​(InterfaceIOOptions options)
      Description copied from interface: PersistentObject
      Sets the options used to last write this object; can be null.
      Specified by:
      setWriterOptions in interface PersistentObject
    • 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 interface PersistentObject
      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 interface PersistentObject
    • getLastColumnAdded

      public VertexDataColumn getLastColumnAdded()
      VERTEX DATA STUFF
    • getLastColumnRemoved

      public VertexDataColumn getLastColumnRemoved()
    • getLastColumnChanged

      public VertexDataColumn getLastColumnChanged()
    • vertexDataColumnChanged

      public void vertexDataColumnChanged​(VertexDataColumnEvent event)
      Specified by:
      vertexDataColumnChanged in interface VertexDataColumnListener
    • vertexDataColumnColourMapChanged

      public void vertexDataColumnColourMapChanged​(VertexDataColumnEvent event)
      Specified by:
      vertexDataColumnColourMapChanged in interface VertexDataColumnListener
    • 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

      public java.util.ArrayList<VertexDataColumn> getVertexDataColumns()
      Returns a list of all vertex data columns.
      Returns:
    • getVertexDataColumn

      public VertexDataColumn getVertexDataColumn​(java.lang.String name)
      Returns the vertex data column associated with name.
      Parameters:
      name - Name of the vertex data column
      Returns:
    • addVertexData

      public boolean addVertexData​(java.lang.String key, java.util.ArrayList<MguiNumber> data)
      Adds a new vertex data column and populates it with data.
      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 referred
      data - The values for this column
      cmap - 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 referred
      data - The values for this column
      nmap - 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 named new_name already exists, or no column named old_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 referred
      data - The values for this column
      nmap - Name map [optionally null] associating integer keys to names
      cmap - Colour map [optionally null] associating values to colours
      Returns:
    • addVertexData

      public boolean addVertexData​(java.lang.String key)
      Add a vertex-wise data column of type DataBuffer.TYPE_DOUBLE.
      Parameters:
      key - The key associated with the data column
    • addVertexData

      public boolean addVertexData​(VertexDataColumn column)
      Add a vertex-wise data column of type DataBuffer.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 type dataType, which must be one of DataBuffer.TYPE_DOUBLE, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_INT. If an incorrect type is specified, this method creates a column of type DataBuffer.TYPE_DOUBLE.
      Parameters:
      key - The key associated with the data column
      dataType - The data type with which to store the data
    • addVertexData

      public boolean addVertexData​(java.lang.String key, int dataType, ColourMap cmap)
      Add a vertex-wise data column of type dataType, which must be one of DataBuffer.TYPE_DOUBLE, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_INT. If an incorrect type is specified, this method creates a column of type DataBuffer.TYPE_DOUBLE.
      Parameters:
      key - The key associated with the data column
      dataType - The data type with which to store the data
      cmap - 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

      public VertexDataColumn getCurrentDataColumn()
      Returns the current VertexDataColumn.
      Returns:
    • newVertexData

      public java.util.ArrayList<MguiNumber> newVertexData​(DataType type)
      Returns a new array of the same size as this shape, with the specified data type
      Parameters:
      transfer_type -
      Returns:
    • getVertexDataMap

      public java.util.HashMap<java.lang.String,​java.util.ArrayList<MguiNumber>> 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

      public boolean setVertexData​(java.util.ArrayList<MguiNumber> data)
      Sets the data in the current column.
      Parameters:
      column -
      data -
    • setVertexData

      public boolean setVertexData​(java.lang.String column, java.util.ArrayList<MguiNumber> data)
      Sets the data in column.
      Parameters:
      column -
      data -
    • setVertexData

      public boolean setVertexData​(java.lang.String column, java.util.ArrayList<MguiNumber> data, boolean update)
      Sets the data in column.
      Parameters:
      column -
      data -
      Whether - to inform listeners of this update
    • getCurrentVertexData

      public java.util.ArrayList<MguiNumber> getCurrentVertexData()
      Retrieves the currently selected vertex-wise data column.
    • getLinkedVertexDatum

      public MguiNumber getLinkedVertexDatum​(java.lang.String linked_column, int index)
      Returns the value at the given vertex, for the given linked column.
      Parameters:
      linked_column -
      index -
      Returns:
    • getLinkedVertexData

      public java.util.ArrayList<MguiNumber> getLinkedVertexData​(java.lang.String linked_column)
      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

      public java.util.ArrayList<MguiNumber> getVertexData()
      Returns a live version of the data in the current column.
      Parameters:
      column -
      Returns:
    • getVertexData

      public java.util.ArrayList<MguiNumber> getVertexData​(java.lang.String column)
      Returns a live version of the data in column.
      Parameters:
      column -
      Returns:
    • getAllVertexData

      public java.util.ArrayList<java.util.ArrayList<MguiNumber>> getAllVertexData()
      Returns all vertex-wide data associated with this shape.
      Parameters:
      column -
      Returns:
    • getDatumAtVertex

      public MguiNumber getDatumAtVertex​(int index)
      Returns the datum from the current column at index.
      Parameters:
      column -
      index -
      Returns:
    • getDatumAtVertex

      public MguiNumber getDatumAtVertex​(java.lang.String column, int index)
      Returns the datum from column at index.
      Parameters:
      column -
      index -
      Returns:
    • setDatumAtVertex

      public boolean setDatumAtVertex​(int index, MguiNumber datum)
      Sets the datum from the current column at index.
      Parameters:
      column -
      index -
      Returns:
    • setDatumAtVertex

      public boolean setDatumAtVertex​(java.lang.String column, int index, MguiNumber datum)
      Sets the datum from column at index.
      Parameters:
      column -
      index -
      Returns:
    • setDatumAtVertex

      public boolean setDatumAtVertex​(int index, double datum)
      Sets the datum from the current column at index.
      Parameters:
      column -
      index -
      Returns:
    • setDatumAtVertex

      public boolean setDatumAtVertex​(java.lang.String column, int index, double datum)
      Sets the datum from column at index.
      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

      public void setDefaultColourMap​(ColourMap cm)
      COLOUR MAP STUFF
    • setDefaultColourMap

      public void setDefaultColourMap​(ColourMap cm, boolean update)
    • getColourMap

      public ColourMap 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

      public ColourMap getDefaultColourMap()
    • setColourMap

      public void setColourMap​(ColourMap cm)
      Sets the colour map for the current column.
      Parameters:
      column -
      cm -
    • setColourMap

      public void setColourMap​(java.lang.String column, ColourMap cm)
      Sets the colour map for column.
      Parameters:
      column -
      cm -
    • getColourMap

      public ColourMap getColourMap​(java.lang.String key)
      Gets the colour map for column.
      Parameters:
      column -
      cm -
    • removeColourMap

      public void removeColourMap​(java.lang.String key)
    • getNameMap

      public NameMap getNameMap()
      Returns the name map associated with the current column, or null if there is no column, or no name map associated with it.
      Returns:
    • getNameMap

      public NameMap getNameMap​(java.lang.String key)
      Returns the name map associated with column, or null if there is no name map associated with it.
      Returns:
    • setNameMap

      public void setNameMap​(java.lang.String key, NameMap map)
      Sets the name map associated with column key.
      Parameters:
      key -
      map -
    • removeNameMap

      public void removeNameMap​(java.lang.String key)
      Removes the name map associated with column key.
      Parameters:
      key -
      map -
    • getDataLink

      public LinkedDataStream<?> getDataLink​(java.lang.String column, java.lang.String key)
      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

      public boolean queryObject​(InterfaceQuery query)
      QUERY STUFF
      Specified by:
      queryObject in interface InterfaceQueryObject
      Returns:
      an instance of InterfaceQuery
      See Also:
      InterfaceQuery
    • queryShapeAtVertex

      public boolean queryShapeAtVertex​(int vertex, InterfaceShapeQuery query)
      Description copied from interface: InterfaceShapeQueryObject
      Updates query with information pertaining to the specified vertex.
      Specified by:
      queryShapeAtVertex in interface InterfaceShapeQueryObject
      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 the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Returns:
    • getXML

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

      public java.lang.String getXML​(int tab, XMLObject.XMLType type)
    • getXMLSchema

      public java.lang.String getXMLSchema()
      Description copied from interface: XMLObject
      Returns the XML schema for this object's XML representation

      See http://en.wikipedia.org/wiki/XML_schema.

      Specified by:
      getXMLSchema in interface XMLObject
      Returns:
    • handleXMLElementStart

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

      public void handleXMLElementEnd​(java.lang.String localName) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles the end of an XML element.
      Specified by:
      handleXMLElementEnd in interface XMLObject
      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.SAXException
      Description copied from interface: XMLObject
      Handles a string within an XML element.
      Specified by:
      handleXMLString in interface XMLObject
      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.IOException
      Description 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 of XMLFormat.Ascii will be used.
      Specified by:
      writeXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      Throws:
      java.io.IOException
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file, as XMLType.Normal. The default format of XMLFormat.Ascii will be used. The basic contract for this method is that it should not write a newline character at its start or end.
      Specified by:
      writeXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • getByReferenceUrls

      public java.util.List<java.lang.String> getByReferenceUrls()
      Returns a URL string for the latest call to writeXML(int,java.io.Writer). Is null 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.IOException
      Description 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 of XMLFormat.Ascii will be used.
      Specified by:
      writeXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      options - XMLOutputOptions defining the write parameters
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • cleanTreeNodes

      public void cleanTreeNodes()
      TREE NODE STUFF
    • setTreeNode

      public void setTreeNode​(InterfaceTreeNode treeNode)
      Constructs a tree node from this shape. Adds an AttributeTreeNode via the super 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 interface TreeObject
      Overrides:
      setTreeNode in class AbstractInterfaceObject
      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

      protected void fireShapeListeners​(ShapeEvent e)
    • addShapeListener

      public void addShapeListener​(ShapeListener thisListener)
    • removeShapeListener

      public void removeShapeListener​(ShapeListener thisListener)
    • 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 interface VariableObject
      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. If element is not of the correct length for the variable object (i.e., as determined by the length of VariableObject.getDimensions()), a value of Double.NaN is returned.
      Specified by:
      getVariableValue in interface VariableObject
      Parameters:
      variable - Name of the variable
      element - The element at which to retrieve a value
      Returns:
      The value at element, as a double
    • getVariableValues

      public java.lang.Object getVariableValues​(java.lang.String variable)
      Description copied from interface: VariableObject
      Returns an object containing the set of values for variable. The returned class type is specified by VariableObject.getVariableType().
      Specified by:
      getVariableValues in interface VariableObject
      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 the values object, which must be a type acceptable to the variable object. If not, a value of false is returned.
      Specified by:
      setVariableValues in interface VariableObject
      Parameters:
      variable - The variable to update
      values - An Object 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 by getVariableValues().
      Specified by:
      getVariableType in interface VariableObject
      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 generic ArrayLists. See {@link http://bugs.sun.com/view_bug.do?bug_id=5098163}
      Specified by:
      supportsVariableType in interface VariableObject
      Returns:
      true, if this class type is supported
    • getVertexSelection

      public abstract VertexSelection getVertexSelection()
      Returns a list of the currently selected vertices for this shape.
    • setVertexSelection

      public abstract void setVertexSelection​(VertexSelection selection)
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Returns an icon for this shape, if one has been defined. Returns null otherwise.
      Specified by:
      getObjectIcon in interface IconObject
      Returns:
    • setIcon

      protected void setIcon()
    • getModel

      public ShapeModel3D getModel()
    • setParentSet

      public void setParentSet​(ShapeSet set)
      Sets this shape's parent set to set. If this shape already has a parent, removes itself from the existing parent, including the shape listener.
      Parameters:
      set -
    • getParentSet

      public ShapeSet getParentSet()
    • getID

      public long getID()
    • setID

      public void setID​(long id)
    • compareTo

      public int compareTo​(InterfaceShape s)
      Specified by:
      compareTo in interface java.lang.Comparable<InterfaceShape>
    • setConstraint

      public void setConstraint​(int i, boolean c)
    • getConstraint

      public boolean getConstraint​(int i)
    • getConstraints

      public boolean[] getConstraints()