Class ShapeSelectionSet

java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.selection.ShapeSelectionSet
All Implemented Interfaces:
java.awt.datatransfer.Transferable, AttributeObject, InterfaceObject, PopupMenuObject, NamedObject, ShapeSet, ShapeListener, InterfaceTransferable, TreeObject, CleanableObject, XMLObject

public class ShapeSelectionSet
extends AbstractInterfaceObject
implements ShapeSet, XMLObject, PopupMenuObject, InterfaceTransferable, AttributeObject
  • Field Details

  • Constructor Details

    • ShapeSelectionSet

      public ShapeSelectionSet()
    • ShapeSelectionSet

      public ShapeSelectionSet​(java.lang.String name)
    • ShapeSelectionSet

      public ShapeSelectionSet​(ShapeSelectionSet set)
  • Method Details

    • isSelectable

      public boolean isSelectable()
      Specified by:
      isSelectable in interface ShapeSet
    • setSourceURL

      public void setSourceURL​(java.lang.String url)
    • getSourceURL

      public java.lang.String getSourceURL()
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
    • setFromSelectionSet

      public void setFromSelectionSet​(ShapeSelectionSet set)
      Sets this set's selection to those in set.
      Parameters:
      set -
    • setFromSelectionSet

      public void setFromSelectionSet​(ShapeSelectionSet set, boolean update)
      Sets this set's selection to those in set.
      Parameters:
      set -
    • getIndexOf

      public int getIndexOf​(InterfaceShape shape)
      Returns the index of shape in this set.
      Specified by:
      getIndexOf in interface ShapeSet
      Returns:
      index of shape, or -1 if it is not in this set
    • getMembers

      public java.util.ArrayList<InterfaceShape> getMembers()
      Returns a copy of this set's member list.
      Specified by:
      getMembers in interface ShapeSet
      Returns:
      a list of members
    • getModel

      public ShapeModel3D getModel()
      Specified by:
      getModel in interface ShapeSet
    • isVisible

      public boolean isVisible()
      Specified by:
      isVisible in interface ShapeSet
    • show2D

      public boolean show2D()
      Specified by:
      show2D in interface ShapeSet
    • show3D

      public boolean show3D()
      Specified by:
      show3D in interface ShapeSet
    • setModel

      public void setModel​(ShapeModel3D m)
    • asShapeSet3D

      public ShapeSet3DInt asShapeSet3D()
    • shapeUpdated

      public void shapeUpdated​(ShapeEvent e)
      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 interface ShapeListener
    • asShapeSet2D

      public ShapeSet2DInt asShapeSet2D()
    • getSize

      public int getSize()
      Description copied from interface: ShapeSet
      Returns the number of shapes in this set
      Specified by:
      getSize in interface ShapeSet
      Returns:
    • setOverride

      public void setOverride​(AttributeList attr)
    • unsetOverride

      public void unsetOverride()
    • getShapeSet

      public java.util.Set<InterfaceShape> getShapeSet()
      Specified by:
      getShapeSet in interface ShapeSet
    • addShape

      public boolean addShape​(InterfaceShape s)
      Description copied from interface: ShapeSet
      Adds a shape to this set
      Specified by:
      addShape in interface ShapeSet
      Returns:
    • getSubSets

      public java.util.Set<ShapeSet> getSubSets()
      Specified by:
      getSubSets in interface ShapeSet
    • getUnion

      public ShapeSelectionSet getUnion​(ShapeSet set, boolean recursive)
    • addUnion

      public void addUnion​(ShapeSet set, boolean recursive)
    • needsRedraw

      public boolean needsRedraw​(Attribute a)
    • addShape

      public boolean addShape​(InterfaceShape s, boolean update)
    • addShapes

      public void addShapes​(java.util.TreeSet<InterfaceShape> shapes)
    • addShapes

      public void addShapes​(java.util.ArrayList<InterfaceShape> shapes)
    • addShapes

      public void addShapes​(ShapeSelectionSet set)
    • addSet

      public void addSet​(ShapeSelectionSet set)
    • removeSet

      public void removeSet​(ShapeSelectionSet set)
    • removeShape

      public void removeShape​(InterfaceShape s)
      Description copied from interface: ShapeSet
      Removes a shape from this set
      Specified by:
      removeShape in interface ShapeSet
    • getFilteredSectionSet

      public SectionSet3DInt getFilteredSectionSet​(SectionSet3DInt sectSet)
      Returns a section set which is sectSet, filtered by this selection set
      Parameters:
      sectSet -
      Returns:
      SectionSet3DInt filtered by this selection set
    • getFilteredShapeSet3D

      public ShapeSet3DInt getFilteredShapeSet3D​(ShapeSet3DInt thisSet)
      Return a shape3D set which is thisSet, filtered by this selection set.
      Parameters:
      thisSet -
      Returns:
      filtered ShapeSet3DInt
    • getFilteredShapeSet2D

      public ShapeSet2DInt getFilteredShapeSet2D​(ShapeSet2DInt thisSet)
      Return a shape2D set which is thisSet, filtered by this selection set.
      Parameters:
      thisSet -
      Returns:
      filtered ShapeSet2DInt
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • hasShape

      public boolean hasShape​(InterfaceShape shape)
      Returns true if shape is in this selection set. TODO: implement to search member shape and selection sets
      Specified by:
      hasShape in interface ShapeSet
    • hasShape

      public boolean hasShape​(InterfaceShape shape, boolean recurse)
      Current returns the same as hasShape(mgui.interfaces.shapes.InterfaceShape) TODO: implement to search member shape and selection sets
      Specified by:
      hasShape in interface ShapeSet
    • resetTreeNode

      public void resetTreeNode()
    • setTreeNode

      public void setTreeNode​(TreeListener l)
    • setTreeNode

      public void setTreeNode()
    • issueTreeNode

      public InterfaceTreeNode issueTreeNode()
      Description copied from class: AbstractInterfaceObject
      Issues a new tree node and sets it using AbstractInterfaceObject.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 method AbstractInterfaceObject.updateTreeNodes().
      Specified by:
      issueTreeNode in interface TreeObject
      Overrides:
      issueTreeNode in class AbstractInterfaceObject
      Returns:
      a new InterfaceTreeNode
    • fireSelectionListeners

      public void fireSelectionListeners​(ShapeSelectionEvent e)
    • addSelectionListener

      public void addSelectionListener​(ShapeSelectionListener s)
    • removeSelectionListener

      public void removeSelectionListener​(ShapeSelectionListener s)
    • getIterator

      public java.util.Iterator<InterfaceShape> getIterator()
    • sort

      public void sort()
    • getShapeSceneNode

      public ShapeSceneNode getShapeSceneNode()
    • destroy

      public void destroy()
      Description copied from interface: InterfaceObject
      Destroy this object (prepare it to be removed from memory)
      Specified by:
      destroy in interface InterfaceObject
      Specified by:
      destroy in interface ShapeListener
      Overrides:
      destroy in class AbstractInterfaceObject
    • isDestroyed

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

      protected void fireShapeDestroyed()
    • getDTD

      public java.lang.String getDTD()
      Description copied from interface: XMLObject
      Returns the Data Type Declaration (DTD) for this object's XML representation

      See http://en.wikipedia.org/wiki/Document_Type_Definition for a description.

      Specified by:
      getDTD in interface XMLObject
      Returns:
    • getLocalName

      public java.lang.String getLocalName()
      Description copied from interface: XMLObject
      Returns the local name associated with this XML object.
      Specified by:
      getLocalName in interface XMLObject
      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:
    • getShortXML

      public java.lang.String getShortXML​(int tab)
      Description copied from interface: XMLObject
      Returns a short XML representation of this object.
      Specified by:
      getShortXML in interface XMLObject
      Returns:
    • 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:
    • handleXMLElementEnd

      public void handleXMLElementEnd​(java.lang.String localName)
      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
    • handleXMLElementStart

      public void handleXMLElementStart​(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
      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
    • handleXMLString

      public void handleXMLString​(java.lang.String s)
      Description copied from interface: XMLObject
      Handles a string within an XML element.
      Specified by:
      handleXMLString in interface XMLObject
      Parameters:
      s - String to handle
    • 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
    • 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
    • getLastAdded

      public InterfaceShape getLastAdded()
      Not implemented.
      Specified by:
      getLastAdded in interface ShapeSet
    • getLastRemoved

      public InterfaceShape getLastRemoved()
      Not implemented.
      Specified by:
      getLastRemoved in interface ShapeSet
    • getLastModified

      public InterfaceShape getLastModified()
      Not implemented.
      Specified by:
      getLastModified in interface ShapeSet
    • getLastInserted

      public InterfaceShape getLastInserted()
      Not implemented.
      Specified by:
      getLastInserted in interface ShapeSet
    • getLastMoved

      public InterfaceShape getLastMoved()
      Not implemented.
      Specified by:
      getLastMoved in interface ShapeSet
    • getLastInsert

      public int getLastInsert()
      Not implemented.
      Specified by:
      getLastInsert in interface ShapeSet
    • getPopupMenu

      public InterfacePopupMenu getPopupMenu​(java.util.List<java.lang.Object> selection)
      Description copied from interface: PopupMenuObject
      Produces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.
      Specified by:
      getPopupMenu in interface PopupMenuObject
      Returns:
    • 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:
    • handlePopupEvent

      public void handlePopupEvent​(java.awt.event.ActionEvent e)
      Description copied from interface: PopupMenuObject
      Handles an event on this object's popup menu.
      Specified by:
      handlePopupEvent in interface PopupMenuObject
    • showPopupMenu

      public void showPopupMenu​(java.awt.event.MouseEvent e)
      Description copied from interface: PopupMenuObject
      Shows a popup menu at the point of the given MouseEvent.
      Specified by:
      showPopupMenu in interface PopupMenuObject
    • getTransferData

      public java.lang.Object getTransferData​(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
      Specified by:
      getTransferData in interface java.awt.datatransfer.Transferable
      Throws:
      java.awt.datatransfer.UnsupportedFlavorException
      java.io.IOException
    • getTransferDataFlavors

      public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
      Specified by:
      getTransferDataFlavors in interface java.awt.datatransfer.Transferable
    • isDataFlavorSupported

      public boolean isDataFlavorSupported​(java.awt.datatransfer.DataFlavor flavor)
      Specified by:
      isDataFlavorSupported in interface java.awt.datatransfer.Transferable
    • performTransfer

      public boolean performTransfer​(javax.swing.TransferHandler.TransferSupport support)
      Specified by:
      performTransfer in interface InterfaceTransferable
    • getUnit

      public SpatialUnit getUnit()
      Specified by:
      getUnit in interface ShapeSet
    • isAncestorSet

      public boolean isAncestorSet​(ShapeSet set)
      Description copied from interface: ShapeSet
      Determines whether set is an ancestor set of this set; i.e., whether this set is a subset of set.
      Specified by:
      isAncestorSet in interface ShapeSet
      Returns:
    • moveShapeBefore

      public boolean moveShapeBefore​(InterfaceShape shape, InterfaceShape target)
      Description copied from interface: ShapeSet
      Moves the order of shape to the spot before target.
      Specified by:
      moveShapeBefore in interface ShapeSet
      Returns:
    • setUnit

      public void setUnit​(SpatialUnit unit)
      Specified by:
      setUnit in interface ShapeSet
    • 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
      Overrides:
      getName in class AbstractInterfaceObject
      Returns:
    • getFullName

      public java.lang.String getFullName()
      Specified by:
      getFullName in interface ShapeSet
    • 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:
    • 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
    • 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:
    • 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