Package mgui.interfaces.shapes
Class ShapeSet2DInt
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.InterfaceShape
mgui.interfaces.shapes.Shape2DInt
mgui.interfaces.shapes.ShapeSet2DInt
- All Implemented Interfaces:
java.awt.datatransfer.Transferable
,java.lang.Cloneable
,java.lang.Comparable<InterfaceShape>
,AttributeListener
,AttributeObject
,InterfaceObject
,PersistentObject
,VariableObject
,PopupMenuObject
,NamedObject
,InterfaceQueryObject
,InterfaceShapeQueryObject
,ShapeSet
,ShapeListener
,VertexDataColumnListener
,InterfaceTransferable
,TreeObject
,CleanableObject
,XMLObject
,IconObject
public class ShapeSet2DInt extends Shape2DInt implements ShapeSet
Represents a set of
Shape2DInt
objects. This class is itself a descendant of Shape2DInt
,
which means it inherits much of its behaviour and attributes, and can be added to another ShapeSet2DInt
.
Shapes added to a shape set inherit its spatial unit; thus, all shapes in a set must be defined in the same unit.
See Development Notes: Shape Sets for a more detailed description.
TODO: Also implement and enforce set-wide coordinate systems
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from class mgui.interfaces.shapes.InterfaceShape
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 IDFactory
idFactory
java.util.ArrayList<Shape2DInt>
members
TODO: replace this with a hashmap, with ID as key.protected SectionSet3DInt
parent_section_set
protected Shape2DSectionNode
section_node
Fields inherited from class mgui.interfaces.shapes.Shape2DInt
bounds, centerPt, child3D, drawEngine, idStr, map_idx_to_parent, nodeListener, parentShape, sceneNode, thisShape
Fields inherited from class mgui.interfaces.shapes.InterfaceShape
attributes, constraints, data_columns, icon, ID, is_auxiliary, is_registered, isDrawable, isImageShape, isLight, isOverridden, last_column_added, last_column_changed, last_column_removed, linked_colour_maps, loader_options, notifyListeners, overrideAttr, parent_set, selected_nodes, shapeListeners, vertex_data, writer_options, xml_current_column, xml_current_loader, xml_current_shape, xml_current_shape_options, xml_current_type, xml_current_url, xml_is_vertex_data, xml_root_dir
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description ShapeSet2DInt()
-
Method Summary
Modifier and Type Method Description boolean
addShape(InterfaceShape shape)
Adds a shape to this setint
addShape(Shape2DInt thisShape, boolean updateShape, boolean updateListeners)
int
addShape(Shape2DInt thisShape, int index)
int
addShape(Shape2DInt thisShape, int index, boolean update)
int
addShape(Shape2DInt shape, int index, boolean updateShape, boolean updateListeners)
int
addUnionSet(ShapeSet2DInt thisSet)
int
addUnionSet(ShapeSet2DInt thisSet, boolean updateShape, boolean updateListeners)
void
applyOverride()
Applies this set's attributes to all members.void
destroy()
Destroy this object (prepare it to be removed from memory)void
drawMember2D(int index, java.awt.Graphics2D g, DrawingEngine d)
void
drawShape2D(java.awt.Graphics2D g, DrawingEngine d)
ABSTRACT METHODSjava.util.ArrayList<Shape2DInt>
get2DShapes()
java.util.ArrayList<Shape2DInt>
get2DShapes(boolean recurse)
Returns all shapes in this shape set; ifrecurse
isfalse
, limits this list to the set's members; otherwise, also adds all members of all subsets (along with the sets themselves).int
getIndexOf(InterfaceShape shape)
Returns the index ofshape
in this set.InterfaceShape
getLastAdded()
int
getLastInsert()
InterfaceShape
getLastInserted()
InterfaceShape
getLastModified()
InterfaceShape
getLastMoved()
InterfaceShape
getLastRemoved()
Shape2DInt
getMember(int i)
java.util.ArrayList<InterfaceShape>
getMembers()
Returns a copy of this set's member list.ShapeModel3D
getModel()
Shape2DInt
getShape(int i)
int
getShapeCount()
Shape2DSectionNode
getShapeSectionNode(SectionSet3DInt set, int section)
java.util.Set<InterfaceShape>
getShapeSet()
ShapeSet2DInt
getShapeType(Shape2DInt thisShape)
ShapeSet2DInt
getShapeType(Shape2DInt thisShape, boolean recurse)
ShapeSet2DInt
getShapeType(Shape2DInt thisShape, ShapeSet2DInt thisSet, boolean recurse)
int
getSize()
Returns the number of members in this setjava.util.Set<ShapeSet>
getSubSets()
java.awt.datatransfer.DataFlavor[]
getTransferDataFlavors()
SpatialUnit
getUnit()
Returns the spatial unit for this shape set.java.util.ArrayList<org.jogamp.vecmath.Point2f>
getVertices()
boolean
hasShape(InterfaceShape s)
boolean
hasShape(InterfaceShape s, boolean recurse)
boolean
isAncestorSet(ShapeSet set)
Determines whetherset
is an ancestor of this set.boolean
isOverriding()
InterfaceTreeNode
issueTreeNode()
Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode)
.boolean
isVisible(int i)
boolean
moveShapeBefore(InterfaceShape shape, InterfaceShape target)
Moves the order ofshape
to the spot beforetarget
.boolean
performTransfer(javax.swing.TransferHandler.TransferSupport support)
void
removeOverride()
void
removeShape(int index)
void
removeShape(InterfaceShape shape)
Removes a shape from this setvoid
removeShape(Shape2DInt shape, boolean updateShape, boolean updateListeners)
protected void
setIcon()
void
setOverride(AttributeList attr)
If attr is non-null, sets override attributes for all members of this set, and sets isOverridden to true.void
setShapeSceneNode(SectionSet3DInt s, int section)
void
setShapeSceneNode(SectionSet3DInt s, int section, boolean update)
void
setShapeSceneNode(SectionSet3DInt s, int section, boolean update, ShapeSelectionSet filter)
void
setShapeSectionNode(SectionSet3DInt set, int section)
void
setTreeNode(InterfaceTreeNode treeNode)
Constructs a tree node from this shape.void
setUnit(SpatialUnit unit)
void
shapeUpdated(ShapeEvent e)
A shape that this object is listening to has been updated.java.lang.String
toString()
void
unsetOverride()
Unsets the override on this set.void
updateShape()
boolean
validateNodes()
void
writeXML(int tab, java.io.Writer writer, XMLObject.XMLType type, InterfaceProgressBar progress_bar)
Methods inherited from class mgui.interfaces.shapes.Shape2DInt
addVertexData, addVertexData, addVertexData, addVertexData, attributeUpdated, clone, contains, destroy, draw, fireShapeListeners, getAllVertexData, getAlpha, getBounds, getBoundShape, getCenterPoint, getChild3D, getClosestVertex, getClosestVertex3D, getCurrentColumn, getCurrentVertexData, getDatumAtVertex, getDimensions, getDTD, getExtBounds, getGeometry, getGeometryInstance, getLabelColour, getLabelFont, getLabelScale, getLineColour, getLineStyle, getLinkedVertexData, getLinkedVertexDatum, getLocalName, getMapIdxToParent, getModifiedAttribute, getNonLinkedDataColumns, getParentAttribute, getParentShape, getPopupMenu, getPopupMenu, getProximity, getShape, getShape3D, getShape3DInt, getShape3DInt, getShortXML, getTransferData, getTreeLabel, getVertex, getVertexColour, getVertexCount, getVertexData, getVertexDataColumn, getVertexDataColumnNames, getVertexDataColumns, getVertexDataMap, getVertexScale, getVertexSelection, getVertexShape, getVisibility, handlePopupEvent, hasAlpha, hasAlpha, hasColumn, hasData, hasParentShape, isDataFlavorSupported, isHeritableAttribute, isInheritingAttribute, isLabelShape, needsRedraw, printNodes, removeVertexData, setAlpha, setChild3D, setCurrentColumn, setCurrentColumn, setGeometry, setGraphic2DPopupMenu, setLabelColour, setLabelFont, setLabelScale, setLineStyle, setMapIdxToParent, setParentShape, setShape, setVertexDataMap, setVertexSelection, setVertexShape, showPopupMenu, showVertices, showVertices, updateDataColumns, writeShapeToXML, writeXML
Methods inherited from class mgui.interfaces.shapes.InterfaceShape
_init, addDataLink, addShapeListener, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, cleanTreeNodes, compareTo, copyAttributes, finalizeAfterXML, fireShapeModified, fromVariable, getAttribute, getAttributes, getAttributeValue, getByReferenceUrls, getColourMap, getColourMap, getConstraint, getConstraints, getCurrentDataColumn, getDataLink, getDataMax, getDataMin, getDatumAtVertex, getDefaultColourMap, getFileLoader, getFileWriter, getFullName, getID, getInheritedAttribute, getInheritedAttributes, getInheritedAttributeValue, getLastColumnAdded, getLastColumnChanged, getLastColumnRemoved, getLegalName, getLoaderOptions, getName, getNameMap, getNameMap, getObjectIcon, getParentSet, getSourceURL, getUrlReference, getVariables, getVariableType, getVariableValue, getVariableValues, getVertexData, getVertexDataColumnCount, getWriterOptions, getXML, getXML, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, hasAttribute, inheritAttributesFromParent, isAuxiliaryShape, isAuxiliaryShape, isDestroyed, isDrawable, isImageShape, isLegalName, isLight, isSelectable, isVisible, newVertexData, queryObject, queryShapeAtVertex, register, removeColourMap, removeDataLink, removeNameMap, removeShapeListener, renameVertexDataColumn, setAttribute, setAttributes, setColourMap, setColourMap, setConstraint, setDataMax, setDataMax, setDataMax, setDataMin, setDataMin, setDataMin, setDatumAtVertex, setDatumAtVertex, setDatumAtVertex, setDatumAtVertex, setDefaultColourMap, setDefaultColourMap, setFileLoader, setFileLoader, setFileWriter, setID, setLoaderOptions, setName, setNameMap, setParentSet, setSelectable, setUrlReference, setVariableValues, setVariableValues, setVertexData, setVertexData, setVertexData, setVisible, setWriterOptions, setXMLRoot, show2D, show2D, show3D, show3D, showData, showData, supportsVariableType, toVariable, vertexDataColumnChanged, vertexDataColumnColourMapChanged, writeXML, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, updateTreeNodes
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface mgui.interfaces.util.CleanableObject
clean
Methods inherited from interface mgui.interfaces.NamedObject
getName, setName
Methods inherited from interface mgui.interfaces.shapes.util.ShapeListener
isDestroyed
Methods inherited from interface mgui.interfaces.shapes.ShapeSet
getFullName, isSelectable, isVisible, show2D, show3D
-
Field Details
-
idFactory
-
members
TODO: replace this with a hashmap, with ID as key. Also provide a name map to ensure 1. no duplicate names and 2. shapes can be referenced by name as well as ID. -
parent_section_set
-
section_node
-
-
Constructor Details
-
ShapeSet2DInt
public ShapeSet2DInt()
-
-
Method Details
-
getIndexOf
Returns the index ofshape
in this set.- Specified by:
getIndexOf
in interfaceShapeSet
- Returns:
- index of shape, or -1 if it is not in this set
-
setIcon
protected void setIcon()- Overrides:
setIcon
in classShape2DInt
-
getMembers
Returns a copy of this set's member list.- Specified by:
getMembers
in interfaceShapeSet
- Returns:
- a list of members
-
getUnit
Description copied from class:InterfaceShape
Returns the spatial unit for this shape set.- Specified by:
getUnit
in interfaceShapeSet
- Overrides:
getUnit
in classInterfaceShape
- Returns:
- the spatial unit for this shape set
-
setUnit
- Specified by:
setUnit
in interfaceShapeSet
- Overrides:
setUnit
in classInterfaceShape
-
isAncestorSet
Determines whetherset
is an ancestor of this set.- Specified by:
isAncestorSet
in interfaceShapeSet
- Parameters:
set
-- Returns:
-
getLastAdded
- Specified by:
getLastAdded
in interfaceShapeSet
-
getLastInserted
- Specified by:
getLastInserted
in interfaceShapeSet
-
getLastInsert
public int getLastInsert()- Specified by:
getLastInsert
in interfaceShapeSet
-
getModel
- Specified by:
getModel
in interfaceShapeSet
- Overrides:
getModel
in classInterfaceShape
-
setOverride
If attr is non-null, sets override attributes for all members of this set, and sets isOverridden to true.- Overrides:
setOverride
in classInterfaceShape
- Parameters:
attr
- AttributeList with which to override the members of this set
-
unsetOverride
public void unsetOverride()Unsets the override on this set. If this set is overriding, itself, this override will be reapplied to its members.- Overrides:
unsetOverride
in classInterfaceShape
-
applyOverride
public void applyOverride()Applies this set's attributes to all members. -
removeOverride
public void removeOverride() -
isOverriding
public boolean isOverriding() -
isVisible
public boolean isVisible(int i) -
getSize
public int getSize()Returns the number of members in this set -
get2DShapes
-
get2DShapes
Returns all shapes in this shape set; ifrecurse
isfalse
, limits this list to the set's members; otherwise, also adds all members of all subsets (along with the sets themselves).- Parameters:
recurse
-- Returns:
-
getShape
-
destroy
public void destroy()Description copied from interface:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
- Specified by:
destroy
in interfaceShapeListener
- Overrides:
destroy
in classShape2DInt
-
hasShape
-
hasShape
-
addShape
Description copied from interface:ShapeSet
Adds a shape to this set -
getSubSets
- Specified by:
getSubSets
in interfaceShapeSet
-
getShapeSet
- Specified by:
getShapeSet
in interfaceShapeSet
-
addShape
-
addShape
-
addShape
-
addShape
-
removeShape
Description copied from interface:ShapeSet
Removes a shape from this set- Specified by:
removeShape
in interfaceShapeSet
-
removeShape
-
moveShapeBefore
Description copied from interface:ShapeSet
Moves the order ofshape
to the spot beforetarget
.- Specified by:
moveShapeBefore
in interfaceShapeSet
- Returns:
-
getLastRemoved
- Specified by:
getLastRemoved
in interfaceShapeSet
-
getLastMoved
- Specified by:
getLastMoved
in interfaceShapeSet
-
removeShape
public void removeShape(int index) -
getLastModified
- Specified by:
getLastModified
in interfaceShapeSet
-
drawMember2D
-
drawShape2D
Description copied from class:InterfaceShape
ABSTRACT METHODS- Overrides:
drawShape2D
in classShape2DInt
-
getMember
-
issueTreeNode
Description copied from class:AbstractInterfaceObject
Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode)
. The tree node is stored in this object, which facilitates their destruction when necessary (e.g., when this object is destroyed). All issued tree nodes can informed of changes to their user object using the methodAbstractInterfaceObject.updateTreeNodes()
.- Specified by:
issueTreeNode
in interfaceTreeObject
- Overrides:
issueTreeNode
in classShape2DInt
- Returns:
- a new
InterfaceTreeNode
-
setTreeNode
Description copied from class:InterfaceShape
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 classShape2DInt
- Parameters:
treeNode
- the tree node to construct
-
toString
public java.lang.String toString()- Overrides:
toString
in classShape2DInt
-
addUnionSet
-
addUnionSet
-
updateShape
public void updateShape()- Overrides:
updateShape
in classShape2DInt
-
shapeUpdated
Description copied from interface:ShapeListener
A shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.- Specified by:
shapeUpdated
in interfaceShapeListener
- Overrides:
shapeUpdated
in classShape2DInt
-
getShapeType
-
getShapeType
-
getShapeType
-
getVertices
public java.util.ArrayList<org.jogamp.vecmath.Point2f> getVertices()- Overrides:
getVertices
in classShape2DInt
-
validateNodes
public boolean validateNodes()- Overrides:
validateNodes
in classShape2DInt
-
getShapeCount
public int getShapeCount() -
setShapeSceneNode
-
setShapeSceneNode
-
setShapeSceneNode
public void setShapeSceneNode(SectionSet3DInt s, int section, boolean update, ShapeSelectionSet filter) -
getShapeSectionNode
-
setShapeSectionNode
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLObject.XMLType type, InterfaceProgressBar progress_bar) throws java.io.IOException- Throws:
java.io.IOException
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()- Specified by:
getTransferDataFlavors
in interfacejava.awt.datatransfer.Transferable
- Overrides:
getTransferDataFlavors
in classShape2DInt
-
performTransfer
public boolean performTransfer(javax.swing.TransferHandler.TransferSupport support)- Specified by:
performTransfer
in interfaceInterfaceTransferable
- Overrides:
performTransfer
in classShape2DInt
-