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.VertexDataSetNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected IDFactoryidFactoryjava.util.ArrayList<Shape2DInt>membersTODO: replace this with a hashmap, with ID as key.protected SectionSet3DIntparent_section_setprotected Shape2DSectionNodesection_nodeFields inherited from class mgui.interfaces.shapes.Shape2DInt
bounds, centerPt, child3D, drawEngine, idStr, map_idx_to_parent, nodeListener, parentShape, sceneNode, thisShapeFields 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_dirFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description ShapeSet2DInt() -
Method Summary
Modifier and Type Method Description booleanaddShape(InterfaceShape shape)Adds a shape to this setintaddShape(Shape2DInt thisShape, boolean updateShape, boolean updateListeners)intaddShape(Shape2DInt thisShape, int index)intaddShape(Shape2DInt thisShape, int index, boolean update)intaddShape(Shape2DInt shape, int index, boolean updateShape, boolean updateListeners)intaddUnionSet(ShapeSet2DInt thisSet)intaddUnionSet(ShapeSet2DInt thisSet, boolean updateShape, boolean updateListeners)voidapplyOverride()Applies this set's attributes to all members.voiddestroy()Destroy this object (prepare it to be removed from memory)voiddrawMember2D(int index, java.awt.Graphics2D g, DrawingEngine d)voiddrawShape2D(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; ifrecurseisfalse, limits this list to the set's members; otherwise, also adds all members of all subsets (along with the sets themselves).intgetIndexOf(InterfaceShape shape)Returns the index ofshapein this set.InterfaceShapegetLastAdded()intgetLastInsert()InterfaceShapegetLastInserted()InterfaceShapegetLastModified()InterfaceShapegetLastMoved()InterfaceShapegetLastRemoved()Shape2DIntgetMember(int i)java.util.ArrayList<InterfaceShape>getMembers()Returns a copy of this set's member list.ShapeModel3DgetModel()Shape2DIntgetShape(int i)intgetShapeCount()Shape2DSectionNodegetShapeSectionNode(SectionSet3DInt set, int section)java.util.Set<InterfaceShape>getShapeSet()ShapeSet2DIntgetShapeType(Shape2DInt thisShape)ShapeSet2DIntgetShapeType(Shape2DInt thisShape, boolean recurse)ShapeSet2DIntgetShapeType(Shape2DInt thisShape, ShapeSet2DInt thisSet, boolean recurse)intgetSize()Returns the number of members in this setjava.util.Set<ShapeSet>getSubSets()java.awt.datatransfer.DataFlavor[]getTransferDataFlavors()SpatialUnitgetUnit()Returns the spatial unit for this shape set.java.util.ArrayList<org.jogamp.vecmath.Point2f>getVertices()booleanhasShape(InterfaceShape s)booleanhasShape(InterfaceShape s, boolean recurse)booleanisAncestorSet(ShapeSet set)Determines whethersetis an ancestor of this set.booleanisOverriding()InterfaceTreeNodeissueTreeNode()Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode).booleanisVisible(int i)booleanmoveShapeBefore(InterfaceShape shape, InterfaceShape target)Moves the order ofshapeto the spot beforetarget.booleanperformTransfer(javax.swing.TransferHandler.TransferSupport support)voidremoveOverride()voidremoveShape(int index)voidremoveShape(InterfaceShape shape)Removes a shape from this setvoidremoveShape(Shape2DInt shape, boolean updateShape, boolean updateListeners)protected voidsetIcon()voidsetOverride(AttributeList attr)If attr is non-null, sets override attributes for all members of this set, and sets isOverridden to true.voidsetShapeSceneNode(SectionSet3DInt s, int section)voidsetShapeSceneNode(SectionSet3DInt s, int section, boolean update)voidsetShapeSceneNode(SectionSet3DInt s, int section, boolean update, ShapeSelectionSet filter)voidsetShapeSectionNode(SectionSet3DInt set, int section)voidsetTreeNode(InterfaceTreeNode treeNode)Constructs a tree node from this shape.voidsetUnit(SpatialUnit unit)voidshapeUpdated(ShapeEvent e)A shape that this object is listening to has been updated.java.lang.StringtoString()voidunsetOverride()Unsets the override on this set.voidupdateShape()booleanvalidateNodes()voidwriteXML(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, writeXMLMethods 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, writeXMLMethods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, updateTreeNodesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface mgui.interfaces.util.CleanableObject
cleanMethods inherited from interface mgui.interfaces.NamedObject
getName, setNameMethods inherited from interface mgui.interfaces.shapes.util.ShapeListener
isDestroyedMethods 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 ofshapein this set.- Specified by:
getIndexOfin interfaceShapeSet- Returns:
- index of shape, or -1 if it is not in this set
-
setIcon
protected void setIcon()- Overrides:
setIconin classShape2DInt
-
getMembers
Returns a copy of this set's member list.- Specified by:
getMembersin interfaceShapeSet- Returns:
- a list of members
-
getUnit
Description copied from class:InterfaceShapeReturns the spatial unit for this shape set.- Specified by:
getUnitin interfaceShapeSet- Overrides:
getUnitin classInterfaceShape- Returns:
- the spatial unit for this shape set
-
setUnit
- Specified by:
setUnitin interfaceShapeSet- Overrides:
setUnitin classInterfaceShape
-
isAncestorSet
Determines whethersetis an ancestor of this set.- Specified by:
isAncestorSetin interfaceShapeSet- Parameters:
set-- Returns:
-
getLastAdded
- Specified by:
getLastAddedin interfaceShapeSet
-
getLastInserted
- Specified by:
getLastInsertedin interfaceShapeSet
-
getLastInsert
public int getLastInsert()- Specified by:
getLastInsertin interfaceShapeSet
-
getModel
- Specified by:
getModelin interfaceShapeSet- Overrides:
getModelin classInterfaceShape
-
setOverride
If attr is non-null, sets override attributes for all members of this set, and sets isOverridden to true.- Overrides:
setOverridein 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:
unsetOverridein 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; ifrecurseisfalse, 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:InterfaceObjectDestroy this object (prepare it to be removed from memory)- Specified by:
destroyin interfaceInterfaceObject- Specified by:
destroyin interfaceShapeListener- Overrides:
destroyin classShape2DInt
-
hasShape
-
hasShape
-
addShape
Description copied from interface:ShapeSetAdds a shape to this set -
getSubSets
- Specified by:
getSubSetsin interfaceShapeSet
-
getShapeSet
- Specified by:
getShapeSetin interfaceShapeSet
-
addShape
-
addShape
-
addShape
-
addShape
-
removeShape
Description copied from interface:ShapeSetRemoves a shape from this set- Specified by:
removeShapein interfaceShapeSet
-
removeShape
-
moveShapeBefore
Description copied from interface:ShapeSetMoves the order ofshapeto the spot beforetarget.- Specified by:
moveShapeBeforein interfaceShapeSet- Returns:
-
getLastRemoved
- Specified by:
getLastRemovedin interfaceShapeSet
-
getLastMoved
- Specified by:
getLastMovedin interfaceShapeSet
-
removeShape
public void removeShape(int index) -
getLastModified
- Specified by:
getLastModifiedin interfaceShapeSet
-
drawMember2D
-
drawShape2D
Description copied from class:InterfaceShapeABSTRACT METHODS- Overrides:
drawShape2Din classShape2DInt
-
getMember
-
issueTreeNode
Description copied from class:AbstractInterfaceObjectIssues 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:
issueTreeNodein interfaceTreeObject- Overrides:
issueTreeNodein classShape2DInt- Returns:
- a new
InterfaceTreeNode
-
setTreeNode
Description copied from class:InterfaceShapeConstructs 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 classShape2DInt- Parameters:
treeNode- the tree node to construct
-
toString
public java.lang.String toString()- Overrides:
toStringin classShape2DInt
-
addUnionSet
-
addUnionSet
-
updateShape
public void updateShape()- Overrides:
updateShapein classShape2DInt
-
shapeUpdated
Description copied from interface:ShapeListenerA shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.- Specified by:
shapeUpdatedin interfaceShapeListener- Overrides:
shapeUpdatedin classShape2DInt
-
getShapeType
-
getShapeType
-
getShapeType
-
getVertices
public java.util.ArrayList<org.jogamp.vecmath.Point2f> getVertices()- Overrides:
getVerticesin classShape2DInt
-
validateNodes
public boolean validateNodes()- Overrides:
validateNodesin 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:
getTransferDataFlavorsin interfacejava.awt.datatransfer.Transferable- Overrides:
getTransferDataFlavorsin classShape2DInt
-
performTransfer
public boolean performTransfer(javax.swing.TransferHandler.TransferSupport support)- Specified by:
performTransferin interfaceInterfaceTransferable- Overrides:
performTransferin classShape2DInt
-