Class ShapeModel3D

java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.ShapeModel3D
All Implemented Interfaces:
java.awt.datatransfer.Transferable, DisplayPanelListener, InterfaceGraphicListener, WindowListener, InterfaceObject, PopupMenuObject, NamedObject, ShapeSelectionListener, ShapeListener, InterfaceTransferable, TreeObject, TreeKeyHandler, CleanableObject, XMLObject, IconObject

public class ShapeModel3D
extends AbstractInterfaceObject
implements ShapeListener, InterfaceObject, WindowListener, InterfaceGraphicListener, XMLObject, ShapeSelectionListener, DisplayPanelListener, IconObject, PopupMenuObject, TreeKeyHandler, InterfaceTransferable
The top container for all shape interfaces.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • universe

      protected org.jogamp.java3d.VirtualUniverse universe
    • locale

      protected org.jogamp.java3d.Locale locale
    • model_node

      protected Shape3DSceneNode model_node
    • sections_node

      protected org.jogamp.java3d.BranchGroup sections_node
    • section_polygons

      protected java.util.HashMap<InterfaceGraphic2D,​Polygon3DInt> section_polygons
    • modelSet

      protected ShapeSet3DInt modelSet
    • shape_listeners

      protected java.util.ArrayList<ShapeListener> shape_listeners
    • model_listeners

      protected java.util.ArrayList<ShapeModel3DListener> model_listeners
    • selections

      public java.util.ArrayList<ShapeSelectionSet> selections
    • slisteners

      protected java.util.ArrayList<ShapeSelectionListener> slisteners
    • exclusionFilter

      protected ShapeSelectionSet exclusionFilter
    • excludeToSelection

      protected boolean excludeToSelection
    • selectionSetNode

      protected javax.swing.tree.DefaultMutableTreeNode selectionSetNode
    • displayPanel

      protected InterfaceDisplayPanel displayPanel
    • temp_shapes

      protected org.jogamp.java3d.BranchGroup temp_shapes
    • is_live3d

      protected boolean is_live3d
    • default_unit

      protected SpatialUnit default_unit
    • working_selection

      protected ShapeSelectionSet working_selection
  • Constructor Details

    • ShapeModel3D

      public ShapeModel3D()
    • ShapeModel3D

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

      public ShapeModel3D​(java.lang.String name, ShapeSet3DInt set)
    • ShapeModel3D

      public ShapeModel3D​(java.lang.String name, ShapeSet3DInt set, SpatialUnit default_unit)
  • Method Details

    • isLive3D

      public boolean isLive3D()
      Indicates whether this model has a live 3D node
      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
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Specified by:
      getObjectIcon in interface IconObject
      Returns:
    • getDefaultUnit

      public SpatialUnit getDefaultUnit()
      Returns the default spatial unit for this shape model
      Returns:
    • getWorkingSelection

      public ShapeSelectionSet getWorkingSelection()
      Returns the working selection set for this model.
      Returns:
    • clearWorkingSelection

      public void clearWorkingSelection()
    • setDefaultUnit

      public boolean setDefaultUnit​(java.lang.String name)
      Sets the default spatial unit for this model.
      Parameters:
      name -
      Returns:
    • setDisplayPanel

      public void setDisplayPanel​(InterfaceDisplayPanel panel)
    • getDisplayPanel

      public InterfaceDisplayPanel getDisplayPanel()
    • displayPanelChanged

      public void displayPanelChanged​(DisplayPanelEvent e)
      Specified by:
      displayPanelChanged in interface DisplayPanelListener
    • addTempShape

      public void addTempShape​(org.jogamp.java3d.BranchGroup shape)
    • removeTempShape

      public void removeTempShape​(org.jogamp.java3d.BranchGroup shape)
    • clearTempShapes

      public void clearTempShapes()
    • shapeSelectionChanged

      public void shapeSelectionChanged​(ShapeSelectionEvent e)
      Specified by:
      shapeSelectionChanged in interface ShapeSelectionListener
    • setModelSet

      public void setModelSet​(ShapeSet3DInt set)
    • 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
    • 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:
    • 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:
    • 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
    • handleTreeKeyEvent

      public void handleTreeKeyEvent​(java.awt.event.KeyEvent event)
      Description copied from interface: TreeKeyHandler
      Handle the key event on this object's tree node.
      Specified by:
      handleTreeKeyEvent in interface TreeKeyHandler
    • getNextID

      public long getNextID()
    • refreshModel

      public void refreshModel()
      Updates this model by setting its shape scene node. Filters the model shape set if excludeToSelection is true.
    • setSectionsNode

      protected void setSectionsNode()
      Sets the BranchGroup which visualizes the 2D windows which have section sets as their source which are members of this model.
    • getLocale

      public org.jogamp.java3d.Locale getLocale()
    • setExcludeToSelection

      public void setExcludeToSelection​(boolean b)
    • getExcludeToSelection

      public boolean getExcludeToSelection()
    • setExclusionFilter

      public void setExclusionFilter​(java.lang.String selStr)
    • setExclusionFilter

      public void setExclusionFilter​(ShapeSelectionSet selSet)
    • setExclusionFilter

      public void setExclusionFilter​(ShapeSelectionSet selSet, boolean update)
    • getExclusionFilter

      public ShapeSelectionSet getExclusionFilter()
    • hasSelectionSet

      public boolean hasSelectionSet​(ShapeSelectionSet selSet)
    • getSelectionSets

      public java.util.ArrayList<ShapeSelectionSet> getSelectionSets()
      Returns a list of this model's selection sets, including its working set.
      Returns:
    • getSelectionSet

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

      public java.util.ArrayList<ShapeSelectionSet> getSelectionSets​(InterfaceShape thisShape)
    • getModelSet

      public ShapeSet3DInt getModelSet()
    • addGraphics3D

      public void addGraphics3D​(InterfaceGraphic3D g)
    • removeGraphics3D

      public void removeGraphics3D​(InterfaceGraphic3D g)
    • getModel

      public org.jogamp.java3d.BranchGroup getModel()
    • 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
    • setTreeNode

      public void setTreeNode()
    • setTreeNode

      public void setTreeNode​(InterfaceTreeNode treeNode)
      Description copied from interface: TreeObject
      Sets the children for this node's InterfaceTreeNode.
      Specified by:
      setTreeNode in interface TreeObject
      Overrides:
      setTreeNode in class AbstractInterfaceObject
    • isDataFlavorSupported

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

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

      public boolean performTransfer​(javax.swing.TransferHandler.TransferSupport support)
      Specified by:
      performTransfer in interface InterfaceTransferable
    • 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
    • cleanTreeNodes

      protected void cleanTreeNodes()
    • getSelectionSetNode

      protected javax.swing.tree.DefaultMutableTreeNode getSelectionSetNode()
    • fireModelListeners

      protected void fireModelListeners​(ShapeModelEvent e)
    • fireShapeListeners

      protected void fireShapeListeners​(ShapeEvent e)
    • fireSelectionListeners

      protected void fireSelectionListeners​(ShapeSelectionEvent e)
    • addShapeListener

      public void addShapeListener​(ShapeListener s)
    • removeShapeListener

      public void removeShapeListener​(ShapeListener s)
    • addModelListener

      public void addModelListener​(ShapeModel3DListener s)
    • removeModelListener

      public void removeModelListener​(ShapeModel3DListener s)
    • addSelectionListener

      public void addSelectionListener​(ShapeSelectionListener s)
    • removeSelectionListener

      public void removeSelectionListener​(ShapeSelectionListener s)
    • 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
    • addSelectionSet

      public void addSelectionSet​(ShapeSelectionSet selSet)
    • setSelectionSets

      public void setSelectionSets​(java.util.ArrayList<ShapeSelectionSet> sets)
    • removeSelectionSet

      public void removeSelectionSet​(ShapeSelectionSet selSet)
    • graphicSourceChanged

      public void graphicSourceChanged​(GraphicEvent e)
      Specified by:
      graphicSourceChanged in interface InterfaceGraphicListener
    • graphicUpdated

      public void graphicUpdated​(GraphicEvent e)
      Specified by:
      graphicUpdated in interface InterfaceGraphicListener
    • windowUpdated

      public void windowUpdated​(WindowEvent e)
      Specified by:
      windowUpdated in interface WindowListener
    • 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:
    • toString

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

      public InterfaceTreeNode getTreeNodeCopy()
    • 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:
    • getXML

      public java.lang.String getXML​(int tab, XMLObject.XMLType type)
    • 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
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar, java.io.File root_dir) throws java.io.IOException
      Writes this model to an XML writer, setting the specified root directory.
      Parameters:
      tab -
      writer -
      type -
      progress_bar -
      root_dir -
      Throws:
      java.io.IOException
    • 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
    • windowSourceChanged

      public void windowSourceChanged​(WindowEvent e)
      Specified by:
      windowSourceChanged in interface WindowListener