Package mgui.interfaces.shapes
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected SpatialUnitdefault_unitprotected InterfaceDisplayPaneldisplayPanelprotected booleanexcludeToSelectionprotected ShapeSelectionSetexclusionFilterprotected booleanis_live3dprotected org.jogamp.java3d.Localelocaleprotected java.util.ArrayList<ShapeModel3DListener>model_listenersprotected Shape3DSceneNodemodel_nodeprotected ShapeSet3DIntmodelSetprotected java.util.HashMap<InterfaceGraphic2D,Polygon3DInt>section_polygonsprotected org.jogamp.java3d.BranchGroupsections_nodejava.util.ArrayList<ShapeSelectionSet>selectionsprotected javax.swing.tree.DefaultMutableTreeNodeselectionSetNodeprotected java.util.ArrayList<ShapeListener>shape_listenersprotected java.util.ArrayList<ShapeSelectionListener>slistenersprotected org.jogamp.java3d.BranchGrouptemp_shapesprotected org.jogamp.java3d.VirtualUniverseuniverseprotected ShapeSelectionSetworking_selectionFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description ShapeModel3D()ShapeModel3D(java.lang.String name)ShapeModel3D(java.lang.String name, ShapeSet3DInt set)ShapeModel3D(java.lang.String name, ShapeSet3DInt set, SpatialUnit default_unit) -
Method Summary
Modifier and Type Method Description voidaddGraphics3D(InterfaceGraphic3D g)voidaddModelListener(ShapeModel3DListener s)voidaddSelectionListener(ShapeSelectionListener s)voidaddSelectionSet(ShapeSelectionSet selSet)voidaddShapeListener(ShapeListener s)voidaddTempShape(org.jogamp.java3d.BranchGroup shape)protected voidcleanTreeNodes()voidclearTempShapes()voidclearWorkingSelection()voiddestroy()Destroy this object (prepare it to be removed from memory)voiddisplayPanelChanged(DisplayPanelEvent e)protected voidfireModelListeners(ShapeModelEvent e)protected voidfireSelectionListeners(ShapeSelectionEvent e)protected voidfireShapeListeners(ShapeEvent e)SpatialUnitgetDefaultUnit()Returns the default spatial unit for this shape modelInterfaceDisplayPanelgetDisplayPanel()java.lang.StringgetDTD()Returns the Data Type Declaration (DTD) for this object's XML representationbooleangetExcludeToSelection()ShapeSelectionSetgetExclusionFilter()org.jogamp.java3d.LocalegetLocale()java.lang.StringgetLocalName()Returns the local name associated with this XML object.org.jogamp.java3d.BranchGroupgetModel()ShapeSet3DIntgetModelSet()longgetNextID()javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.InterfacePopupMenugetPopupMenu()Produces and returns a popup menu for this object.InterfacePopupMenugetPopupMenu(java.util.List<java.lang.Object> selection)Produces and returns a popup menu for this object.ShapeSelectionSetgetSelectionSet(java.lang.String name)protected javax.swing.tree.DefaultMutableTreeNodegetSelectionSetNode()java.util.ArrayList<ShapeSelectionSet>getSelectionSets()Returns a list of this model's selection sets, including its working set.java.util.ArrayList<ShapeSelectionSet>getSelectionSets(InterfaceShape thisShape)java.lang.StringgetShortXML(int tab)Returns a short XML representation of this object.java.lang.ObjectgetTransferData(java.awt.datatransfer.DataFlavor flavor)java.awt.datatransfer.DataFlavor[]getTransferDataFlavors()InterfaceTreeNodegetTreeNodeCopy()ShapeSelectionSetgetWorkingSelection()Returns the working selection set for this model.java.lang.StringgetXML()Returns this object's XML representation as a single string.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.java.lang.StringgetXML(int tab, XMLObject.XMLType type)java.lang.StringgetXMLSchema()Returns the XML schema for this object's XML representationvoidgraphicSourceChanged(GraphicEvent e)voidgraphicUpdated(GraphicEvent e)voidhandlePopupEvent(java.awt.event.ActionEvent e)Handles an event on this object's popup menu.voidhandleTreeKeyEvent(java.awt.event.KeyEvent event)Handle the keyeventon this object's tree node.voidhandleXMLElementEnd(java.lang.String localName)Handles the end of an XML element.voidhandleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Handles the start of an XML element.voidhandleXMLString(java.lang.String s)Handles a string within an XML element.booleanhasSelectionSet(ShapeSelectionSet selSet)booleanisDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)booleanisDestroyed()Test whether this object has been destroyedbooleanisLive3D()Indicates whether this model has a live 3D nodeInterfaceTreeNodeissueTreeNode()Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode).booleanperformTransfer(javax.swing.TransferHandler.TransferSupport support)voidrefreshModel()Updates this model by setting its shape scene node.voidremoveGraphics3D(InterfaceGraphic3D g)voidremoveModelListener(ShapeModel3DListener s)voidremoveSelectionListener(ShapeSelectionListener s)voidremoveSelectionSet(ShapeSelectionSet selSet)voidremoveShapeListener(ShapeListener s)voidremoveTempShape(org.jogamp.java3d.BranchGroup shape)booleansetDefaultUnit(java.lang.String name)Sets the default spatial unit for this model.voidsetDisplayPanel(InterfaceDisplayPanel panel)voidsetExcludeToSelection(boolean b)voidsetExclusionFilter(java.lang.String selStr)voidsetExclusionFilter(ShapeSelectionSet selSet)voidsetExclusionFilter(ShapeSelectionSet selSet, boolean update)voidsetModelSet(ShapeSet3DInt set)voidsetName(java.lang.String name)Sets the name for this object.protected voidsetSectionsNode()Sets theBranchGroupwhich visualizes the 2D windows which have section sets as their source which are members of this model.voidsetSelectionSets(java.util.ArrayList<ShapeSelectionSet> sets)voidsetTreeNode()voidsetTreeNode(InterfaceTreeNode treeNode)Sets the children for this node'sInterfaceTreeNode.voidshapeSelectionChanged(ShapeSelectionEvent e)voidshapeUpdated(ShapeEvent e)A shape that this object is listening to has been updated.voidshowPopupMenu(java.awt.event.MouseEvent e)Shows a popup menu at the point of the givenMouseEvent.java.lang.StringtoString()voidwindowSourceChanged(WindowEvent e)voidwindowUpdated(WindowEvent e)voidwriteXML(int tab, java.io.Writer writer)Writes the XML representation of this object to file.voidwriteXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)Writes the XML representation of this object to file, asXMLType.Normal.voidwriteXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)Writes the XML representation of this object to file.voidwriteXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar, java.io.File root_dir)Writes this model to an XML writer, setting the specified root directory.Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, getName, getTreeLabel, updateTreeNodesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface mgui.interfaces.util.CleanableObject
cleanMethods inherited from interface mgui.interfaces.NamedObject
getNameMethods inherited from interface mgui.interfaces.trees.TreeObject
getTreeLabel
-
Field Details
-
universe
protected org.jogamp.java3d.VirtualUniverse universe -
locale
protected org.jogamp.java3d.Locale locale -
model_node
-
sections_node
protected org.jogamp.java3d.BranchGroup sections_node -
section_polygons
-
modelSet
-
shape_listeners
-
model_listeners
-
selections
-
slisteners
-
exclusionFilter
-
excludeToSelection
protected boolean excludeToSelection -
selectionSetNode
protected javax.swing.tree.DefaultMutableTreeNode selectionSetNode -
displayPanel
-
temp_shapes
protected org.jogamp.java3d.BranchGroup temp_shapes -
is_live3d
protected boolean is_live3d -
default_unit
-
working_selection
-
-
Constructor Details
-
ShapeModel3D
public ShapeModel3D() -
ShapeModel3D
public ShapeModel3D(java.lang.String name) -
ShapeModel3D
-
ShapeModel3D
-
-
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:NamedObjectSets the name for this object.- Specified by:
setNamein interfaceNamedObject- Overrides:
setNamein classAbstractInterfaceObject
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Returns:
-
getDefaultUnit
Returns the default spatial unit for this shape model- Returns:
-
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
-
getDisplayPanel
-
displayPanelChanged
- Specified by:
displayPanelChangedin interfaceDisplayPanelListener
-
addTempShape
public void addTempShape(org.jogamp.java3d.BranchGroup shape) -
removeTempShape
public void removeTempShape(org.jogamp.java3d.BranchGroup shape) -
clearTempShapes
public void clearTempShapes() -
shapeSelectionChanged
- Specified by:
shapeSelectionChangedin interfaceShapeSelectionListener
-
setModelSet
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObjectShows a popup menu at the point of the givenMouseEvent.- Specified by:
showPopupMenuin interfacePopupMenuObject
-
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObjectHandles an event on this object's popup menu.- Specified by:
handlePopupEventin interfacePopupMenuObject
-
handleTreeKeyEvent
public void handleTreeKeyEvent(java.awt.event.KeyEvent event)Description copied from interface:TreeKeyHandlerHandle the keyeventon this object's tree node.- Specified by:
handleTreeKeyEventin interfaceTreeKeyHandler
-
getNextID
public long getNextID() -
refreshModel
public void refreshModel()Updates this model by setting its shape scene node. Filters the model shape set ifexcludeToSelectionis true. -
setSectionsNode
protected void setSectionsNode()Sets theBranchGroupwhich 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
-
setExclusionFilter
-
getExclusionFilter
-
hasSelectionSet
-
getSelectionSets
Returns a list of this model's selection sets, including its working set.- Returns:
-
getSelectionSet
-
getSelectionSets
-
getModelSet
-
addGraphics3D
-
removeGraphics3D
-
getModel
public org.jogamp.java3d.BranchGroup getModel() -
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 classAbstractInterfaceObject- Returns:
- a new
InterfaceTreeNode
-
setTreeNode
public void setTreeNode() -
setTreeNode
Description copied from interface:TreeObjectSets the children for this node'sInterfaceTreeNode.- Specified by:
setTreeNodein interfaceTreeObject- Overrides:
setTreeNodein classAbstractInterfaceObject
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)- Specified by:
isDataFlavorSupportedin interfacejava.awt.datatransfer.Transferable
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()- Specified by:
getTransferDataFlavorsin interfacejava.awt.datatransfer.Transferable
-
performTransfer
public boolean performTransfer(javax.swing.TransferHandler.TransferSupport support)- Specified by:
performTransferin interfaceInterfaceTransferable
-
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException- Specified by:
getTransferDatain interfacejava.awt.datatransfer.Transferable- Throws:
java.awt.datatransfer.UnsupportedFlavorExceptionjava.io.IOException
-
cleanTreeNodes
protected void cleanTreeNodes() -
getSelectionSetNode
protected javax.swing.tree.DefaultMutableTreeNode getSelectionSetNode() -
fireModelListeners
-
fireShapeListeners
-
fireSelectionListeners
-
addShapeListener
-
removeShapeListener
-
addModelListener
-
removeModelListener
-
addSelectionListener
-
removeSelectionListener
-
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
-
addSelectionSet
-
setSelectionSets
-
removeSelectionSet
-
graphicSourceChanged
- Specified by:
graphicSourceChangedin interfaceInterfaceGraphicListener
-
graphicUpdated
- Specified by:
graphicUpdatedin interfaceInterfaceGraphicListener
-
windowUpdated
- Specified by:
windowUpdatedin interfaceWindowListener
-
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 classAbstractInterfaceObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObjectTest whether this object has been destroyed- Specified by:
isDestroyedin interfaceInterfaceObject- Specified by:
isDestroyedin interfaceShapeListener- Overrides:
isDestroyedin classAbstractInterfaceObject- Returns:
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getTreeNodeCopy
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObjectReturns the Data Type Declaration (DTD) for this object's XML representationSee http://en.wikipedia.org/wiki/Document_Type_Definition for a description.
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObjectReturns the local name associated with this XML object.- Specified by:
getLocalNamein interfaceXMLObject- Returns:
-
getXML
public java.lang.String getXML()Description copied from interface:XMLObjectReturns 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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)functions to write larger objects to file. -
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObjectReturns 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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)functions to write larger objects to file. -
getXML
-
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites 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 ofXMLFormat.Asciiwill be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites the XML representation of this object to file, asXMLType.Normal. The default format ofXMLFormat.Asciiwill be used. The basic contract for this method is that it should not write a newline character at its start or end. -
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites 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 ofXMLFormat.Asciiwill be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar, java.io.File root_dir) throws java.io.IOExceptionWrites 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:XMLObjectReturns a short XML representation of this object.- Specified by:
getShortXMLin interfaceXMLObject- Returns:
-
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObjectReturns the XML schema for this object's XML representation- Specified by:
getXMLSchemain interfaceXMLObject- Returns:
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObjectHandles the end of an XML element.- Specified by:
handleXMLElementEndin interfaceXMLObject- 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:XMLObjectHandles the start of an XML element.- Specified by:
handleXMLElementStartin interfaceXMLObject- Parameters:
localName- Local name of the elementattributes- Set of element attributestype- TheXMLTypeof this element
-
handleXMLString
public void handleXMLString(java.lang.String s)Description copied from interface:XMLObjectHandles a string within an XML element.- Specified by:
handleXMLStringin interfaceXMLObject- Parameters:
s- String to handle
-
windowSourceChanged
- Specified by:
windowSourceChangedin interfaceWindowListener
-