Class Shape3DInt
- All Implemented Interfaces:
java.awt.datatransfer.Transferable,java.lang.Comparable<InterfaceShape>,AttributeListener,AttributeObject,InterfaceObject,PersistentObject,VariableObject,PopupMenuObject,NamedObject,InterfaceQueryObject,InterfaceShapeQueryObject,VertexDataColumnListener,InterfaceTransferable,TreeObject,CleanableObject,XMLObject,IconObject,org.jogamp.java3d.GeometryUpdater
- Direct Known Subclasses:
Box3DInt,Plane3DInt,PointSet3DInt,Polygon3DInt,PolygonSet3DInt,Rect3DInt,SectionSet3DInt,ShapeSet3DInt,Vector3DInt,VectorSet3DInt,Volume3DInt,X3DScene3DInt
public abstract class Shape3DInt extends InterfaceShape implements org.jogamp.java3d.GeometryUpdater
Shape3D interface objects. Provides default implementations of a number of
methods, which should typically be overridden or utilized by subclasses, including:
- obtaining Java3D scene nodes representing the shape
- obtaining
Shape2DIntobjects representing the projection or intersection of this 3D shape, and maintaining a link with this object to update and/or query it when necessary with a particular plane, and particular projection limits - obtaining a
Shape3DTreeNodefor insertion into aJTree - setting and accessing vertex-wise data
- linking to a
DataSourcewith vertex-wise index data - obtaining an XML encoding of this shape and its attributes
- obtaining an
InterfacePopupMenuand handling its events
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classShape3DInt.VertexShapeTransformerTransformer determines the rendering of verticesNested 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 Box3DboundBoxorg.jogamp.java3d.BranchGroupboundBoxNodeprotected org.jogamp.java3d.BranchGroupbounds_groupprotected org.jogamp.java3d.Shape3Dbounds_shapeSphere3DboundSphereorg.jogamp.vecmath.Point3fcenterPtprotected java.util.ArrayList<Shape2DInt>children2Dprotected booleancreatable_scene_nodeDrawingEnginedrawEngine2Dprotected org.jogamp.java3d.BranchGroupgroup_nodeprotected booleanhas_3d_nodeprotected booleanhasCameraListenerjava.lang.StringidStrprotected ShapeListenernodeListenerprotected Shape2DIntparent2Dprotected org.jogamp.java3d.BranchGroupscene3DObjectprotected ShapeSceneNodesceneNodeprotected org.jogamp.java3d.BranchGroupselected_vertices_groupprotected org.jogamp.java3d.BranchGroupshape_groupShape3Dshape3dprotected Shape3DInt.VertexShapeTransformervertex_shape_transformerprotected org.jogamp.java3d.BranchGroupvertices_groupFields 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 Shape3DInt() -
Method Summary
Modifier and Type Method Description voidaddShape2DChild(Shape2DInt shape)voidattributeUpdated(AttributeEvent e)Responds to an update in one of this shape's attributes.voidclear2DChildren()Clears the currently set 2D children for this shapebooleancontains(org.jogamp.vecmath.Point3d thisPoint)booleancopyAttributes(InterfaceShape source_shape)Copiesattributesto this shape.booleancrossesPlane(Plane3D plane)Convenience method which determines whether this shape crossplane.voidderegisterCameraListener(Camera3D c)voiddestroy()Destroy this object (prepare it to be removed from memory)protected voiddraw2D(Shape2DInt shape2d, java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist)voiddrawShape2D(java.awt.Graphics2D g, DrawingEngine d)ABSTRACT METHODSvoiddrawShape2D(java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist)Draw this shape as it is intersected by plane p, as well as its projection from distances <= spacing / 2, if required.voiddrawShape2D(java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist, boolean listen)Draw this shape as it is intersected by plane p, as well as its projection from distances <= spacing / 2, if required.voidfireChildren2D(ShapeEvent e)Fires a ShapeEvent for this shape's 2D childrenvoidfireChildren2DModified()Fires a shape modified event for this shape's 2D childrenprotected voidfireShapeListeners(ShapeEvent e)voidfireShapeModified()Notifies this shape that it has been modified and should inform its listenersvoidgeometryChanged()Called when this shape's geometry has changedfloatgetAlpha()Gets the current transparency level for this shape.Box3DgetBoundBox()org.jogamp.java3d.BranchGroupgetBoundBoxNode()Return's this shape's bounding box node.Sphere3DgetBoundSphere()Camera3DListenergetCameraListener()org.jogamp.vecmath.Point3fgetCenterOfGravity()intgetClosestVertex(org.jogamp.vecmath.Point3f point)Returns the index of the vertex of this shape which is closest topoint.int[]getDimensions()Returns the dimensions of this object as an array of integersjava.lang.StringgetDTD()Returns the Data Type Declaration (DTD) for this object's XML representationjava.lang.StringgetFullName()Returns a full name of this shape, including its parent model and shape sets, separated by dots.org.jogamp.vecmath.Point3fgetGeometricCenter()ShapegetGeometry()Returns the Shape associated with this objectShapegetGeometryInstance()Returns an instance of thisInterfaceShape's geometry class.javax.swing.IcongetIcon()Attribute<?>getInheritingAttribute(Attribute<?> attribute)Returns the 2D attribute inheriting from a 3D attribute.java.awt.ColorgetLabelColour()java.awt.FontgetLabelFont()floatgetLabelScale()java.awt.ColorgetLineColour()Returns the colour of this shape's lines/edges.java.awt.StrokegetLineStyle()Returns the line/edge style for this shape.java.lang.StringgetLocalName()Returns the local name associated with this XML object.Attribute<?>getModifiedAttribute()Shape2DIntgetParent2D()protected Attribute<?>getParentAttribute(java.lang.String attrName)InterfacePopupMenugetPopupMenu(java.util.List<java.lang.Object> selected)Subclasses should override this if necessary and call super.getPopupMenu() to get this top-level menu and add items to it.protected intgetPopupMenuLength()doublegetProximity(org.jogamp.vecmath.Point3d thisPoint)org.jogamp.java3d.BranchGroupgetScene3DObject()Returns aBranchGrouprepresenting this ShapeInt.org.jogamp.java3d.BranchGroupgetScene3DObject(ShapeSelectionSet selSet)Shape3DgetShape()protected Shape2DIntgetShape2D(Plane3D plane, float above_dist, float below_dist)To be overridden by subclasses implementing a 2D representationprotected Shape2DIntgetShape2D(Plane3D plane, float above_dist, float below_dist, org.jogamp.vecmath.Matrix4d transform)To be overridden by subclasses implementing a 2D representationShape2DIntgetShape2DInt(Plane3D plane, float above_dist, float below_dist)Shape2DIntgetShape2DInt(Plane3D p, float above_dist, float below_dist, boolean listen)Determines a 2D shape which is the projection of this 3D shape ontoplane, within the projection limits defined byabove_distandbelow_dist.ShapeSceneNodegetShapeSceneNode()Returns this ShapeInt's Java3D node.ShapeSceneNodegetShapeSceneNode(ShapeSelectionSet s)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()java.lang.StringgetTreeLabel()Returns the label text to appear in a tree node.org.jogamp.vecmath.Point3fgetVertex(int i)Returns the vertex at indexi.protected org.jogamp.java3d.AppearancegetVertexAppearance(int i)Returns the appearance of vertex i.java.awt.ColorgetVertexColour()Returns the colour of this shape's vertices.java.awt.ColorgetVertexColour(int i)Returns the colour of vertex i; depends on whether theShowDataattribute istrue, and this shape has a current vertex data column.intgetVertexCount()Returns the number of vertices defining the geometry of this shape.floatgetVertexScale()Returns the scale of this shape's verticesfloatgetVertexScale(int i)Returns the scale for vertex i; this depends on whetherScaleVertexValuesis set.VertexSelectiongetVertexSelection()Returns a list of the currently selected vertices for this shape.java.util.ArrayList<org.jogamp.vecmath.Point3f>getVertices()voidhandlePopupEvent(java.awt.event.ActionEvent e)Handles an event on this object's popup menu.booleanhasAlpha()Queries whether this shape has transparency.voidhasAlpha(boolean b)Specifies whether this shape has transparency.booleanhasCameraListener()booleanhasParentShape()Is this shape a child of another shape? Usually this refers to shapes which produce themselves in a different dimensionality; e.g., a 3D shape represented on a 2D plane.protected voidinit()booleanisDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)booleanisHeritableAttribute(java.lang.String name)Is this parent attribute inherited by a child shape?booleanisInheritingAttribute(Attribute<?> attribute)Does this child attribute inherit values from a parent shape?booleanisLive()InterfaceTreeNodeissueTreeNode()Issues a new tree node for this ShapeInt.booleanneedsRedraw(Attribute<?> a)Returnstrueif a change toattributewill require a redraw of this shape.booleanperformTransfer(javax.swing.TransferHandler.TransferSupport support)Moves a list of shapes to a position above this shape in its parent set.voidregisterCameraListener(Camera3D c)protected voidreleaseScene3DChildren()voidremoveShape2DChild(Shape2DInt shape)voidsetAlpha(float f)Sets the current transparency level for this shape.protected voidsetBoundBoxNode()Sets a bounding box node for this ShapeInt, that can be retrieved usinggetBoundBoxNode().protected voidsetCreatableSceneNode(boolean b)voidsetCurrentColumn(java.lang.String key, boolean update)booleansetGeometry(Shape geometry)Sets the Shape associated with this object.voidsetGraphic3DPopupMenu(InterfacePopupMenu menu)Subclasses should override this if necessary and call super.getGraphic3DPopupMenu() to get this top-level menu and add items to it.protected voidsetIcon()voidsetLabelColour(java.awt.Color colour)voidsetLabelFont(java.awt.Font font)voidsetLabelScale(float scale)voidsetLineStyle(java.awt.Stroke s)Returns the line/edge style for this shape.voidsetLive(boolean live)Sets the live status of this shape's scene 3D object node.voidsetParent2D(Shape2DInt parent)voidsetScene3DObject()Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes.voidsetScene3DObject(boolean make_live)Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes.voidsetSelectedVertices(java.util.ArrayList<java.lang.Integer> indices)voidsetShape(Shape3D newShape)voidsetShapeSceneNode()Sets the scene node for this shape, either by creating a new node or setting the current shape node to an existing scene node.voidsetShowSelectedVertices(boolean b)voidsetVertexSelection(VertexSelection selection)voidshowPopupMenu(java.awt.event.MouseEvent e)Shows a popup menu at the point of the givenMouseEvent.booleanshowVertices()Queries whether the vertices of this shape are visible.voidshowVertices(boolean b)Specifies whether the vertices of this shape are visible.java.lang.StringtoString()protected voidupdateChildren2D(Attribute<?> a)Updates an attribute of this shape's 2D children.voidupdateData(org.jogamp.java3d.Geometry geometry)voidupdateSelectedVertices()Updates the scene graph with the current vertex selection optionsvoidupdateShape()Updates the geometric bounds of this ShapeInt.voidupdateVertices()Updates the verticesMethods inherited from class mgui.interfaces.shapes.InterfaceShape
_init, addDataLink, addShapeListener, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, addVertexData, cleanTreeNodes, compareTo, finalizeAfterXML, fromVariable, getAllVertexData, getAttribute, getAttributes, getAttributeValue, getByReferenceUrls, getColourMap, getColourMap, getConstraint, getConstraints, getCurrentColumn, getCurrentDataColumn, getCurrentVertexData, getDataLink, getDataMax, getDataMin, getDatumAtVertex, getDatumAtVertex, getDefaultColourMap, getFileLoader, getFileWriter, getID, getInheritedAttribute, getInheritedAttributes, getInheritedAttributeValue, getLastColumnAdded, getLastColumnChanged, getLastColumnRemoved, getLegalName, getLinkedVertexData, getLinkedVertexDatum, getLoaderOptions, getModel, getName, getNameMap, getNameMap, getNonLinkedDataColumns, getObjectIcon, getParentSet, getPopupMenu, getSourceURL, getUnit, getUrlReference, getVariables, getVariableType, getVariableValue, getVariableValues, getVertexData, getVertexData, getVertexDataColumn, getVertexDataColumnCount, getVertexDataColumnNames, getVertexDataColumns, getVertexDataMap, getWriterOptions, getXML, getXML, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, hasAttribute, hasColumn, hasData, inheritAttributesFromParent, isAuxiliaryShape, isAuxiliaryShape, isDestroyed, isDrawable, isImageShape, isLegalName, isLight, isSelectable, isVisible, newVertexData, queryObject, queryShapeAtVertex, register, removeColourMap, removeDataLink, removeNameMap, removeShapeListener, removeVertexData, renameVertexDataColumn, setAttribute, setAttributes, setColourMap, setColourMap, setConstraint, setCurrentColumn, setDataMax, setDataMax, setDataMax, setDataMin, setDataMin, setDataMin, setDatumAtVertex, setDatumAtVertex, setDatumAtVertex, setDatumAtVertex, setDefaultColourMap, setDefaultColourMap, setFileLoader, setFileLoader, setFileWriter, setID, setLoaderOptions, setName, setNameMap, setOverride, setParentSet, setSelectable, setTreeNode, setUnit, setUrlReference, setVariableValues, setVariableValues, setVertexData, setVertexData, setVertexData, setVertexDataMap, setVisible, setWriterOptions, setXMLRoot, show2D, show2D, show3D, show3D, showData, showData, supportsVariableType, toVariable, unsetOverride, updateDataColumns, vertexDataColumnChanged, vertexDataColumnColourMapChanged, writeXML, writeXML, writeXMLMethods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, updateTreeNodesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface mgui.interfaces.util.CleanableObject
clean
-
Field Details
-
shape3d
-
drawEngine2D
-
idStr
public java.lang.String idStr -
children2D
-
parent2D
-
nodeListener
-
hasCameraListener
protected boolean hasCameraListener -
boundBox
-
boundSphere
-
centerPt
public org.jogamp.vecmath.Point3f centerPt -
scene3DObject
protected org.jogamp.java3d.BranchGroup scene3DObject -
sceneNode
-
boundBoxNode
public org.jogamp.java3d.BranchGroup boundBoxNode -
bounds_shape
protected org.jogamp.java3d.Shape3D bounds_shape -
group_node
protected org.jogamp.java3d.BranchGroup group_node -
bounds_group
protected org.jogamp.java3d.BranchGroup bounds_group -
shape_group
protected org.jogamp.java3d.BranchGroup shape_group -
vertices_group
protected org.jogamp.java3d.BranchGroup vertices_group -
selected_vertices_group
protected org.jogamp.java3d.BranchGroup selected_vertices_group -
has_3d_node
protected boolean has_3d_node -
vertex_shape_transformer
-
creatable_scene_node
protected boolean creatable_scene_node
-
-
Constructor Details
-
Shape3DInt
public Shape3DInt()
-
-
Method Details
-
getGeometryInstance
Description copied from class:InterfaceShapeReturns an instance of thisInterfaceShape's geometry class.- Specified by:
getGeometryInstancein classInterfaceShape- Returns:
-
init
protected void init() -
getParentAttribute
- Specified by:
getParentAttributein classInterfaceShape
-
isHeritableAttribute
public boolean isHeritableAttribute(java.lang.String name)Description copied from class:InterfaceShapeIs this parent attribute inherited by a child shape?- Specified by:
isHeritableAttributein classInterfaceShape- Returns:
-
isInheritingAttribute
Description copied from class:InterfaceShapeDoes this child attribute inherit values from a parent shape?- Specified by:
isInheritingAttributein classInterfaceShape- Returns:
-
getLabelFont
public java.awt.Font getLabelFont()- Specified by:
getLabelFontin classInterfaceShape
-
setLabelFont
public void setLabelFont(java.awt.Font font)- Specified by:
setLabelFontin classInterfaceShape
-
getLabelScale
public float getLabelScale()- Specified by:
getLabelScalein classInterfaceShape
-
setLabelScale
public void setLabelScale(float scale)- Specified by:
setLabelScalein classInterfaceShape
-
getLabelColour
public java.awt.Color getLabelColour()- Specified by:
getLabelColourin classInterfaceShape
-
setLabelColour
public void setLabelColour(java.awt.Color colour)- Specified by:
setLabelColourin classInterfaceShape
-
hasAlpha
public boolean hasAlpha()Description copied from class:InterfaceShapeQueries whether this shape has transparency.- Specified by:
hasAlphain classInterfaceShape- Returns:
-
hasAlpha
public void hasAlpha(boolean b)Description copied from class:InterfaceShapeSpecifies whether this shape has transparency.- Specified by:
hasAlphain classInterfaceShape
-
getAlpha
public float getAlpha()Description copied from class:InterfaceShapeGets the current transparency level for this shape.- Specified by:
getAlphain classInterfaceShape- Returns:
-
setAlpha
public void setAlpha(float f)Description copied from class:InterfaceShapeSets the current transparency level for this shape.- Specified by:
setAlphain classInterfaceShape
-
showVertices
public boolean showVertices()Description copied from class:InterfaceShapeQueries whether the vertices of this shape are visible.- Specified by:
showVerticesin classInterfaceShape- Returns:
-
showVertices
public void showVertices(boolean b)Description copied from class:InterfaceShapeSpecifies whether the vertices of this shape are visible.- Specified by:
showVerticesin classInterfaceShape
-
getVertexScale
public float getVertexScale()Description copied from class:InterfaceShapeReturns the scale of this shape's vertices- Specified by:
getVertexScalein classInterfaceShape- Returns:
-
getVertexScale
public float getVertexScale(int i)Returns the scale for vertex i; this depends on whetherScaleVertexValuesis set.- Parameters:
i-- Returns:
-
getVertex
public org.jogamp.vecmath.Point3f getVertex(int i)Returns the vertex at indexi.- Parameters:
i-- Returns:
-
getVertices
public java.util.ArrayList<org.jogamp.vecmath.Point3f> getVertices() -
getVertexColour
public java.awt.Color getVertexColour()Description copied from class:InterfaceShapeReturns the colour of this shape's vertices.- Specified by:
getVertexColourin classInterfaceShape- Returns:
-
getVertexColour
public java.awt.Color getVertexColour(int i)Returns the colour of vertex i; depends on whether theShowDataattribute istrue, and this shape has a current vertex data column.- Parameters:
i-- Returns:
-
getLineColour
public java.awt.Color getLineColour()Description copied from class:InterfaceShapeReturns the colour of this shape's lines/edges.- Specified by:
getLineColourin classInterfaceShape- Returns:
-
getLineStyle
public java.awt.Stroke getLineStyle()Description copied from class:InterfaceShapeReturns the line/edge style for this shape.- Specified by:
getLineStylein classInterfaceShape- Returns:
-
setLineStyle
public void setLineStyle(java.awt.Stroke s)Description copied from class:InterfaceShapeReturns the line/edge style for this shape.- Specified by:
setLineStylein classInterfaceShape
-
getGeometry
Description copied from class:InterfaceShapeReturns the Shape associated with this object- Specified by:
getGeometryin classInterfaceShape- Returns:
-
setGeometry
Description copied from class:InterfaceShapeSets the Shape associated with this object. If the class type is incorrect, returnsfalse- Specified by:
setGeometryin classInterfaceShape- Returns:
-
getFullName
public java.lang.String getFullName()Description copied from class:InterfaceShapeReturns a full name of this shape, including its parent model and shape sets, separated by dots.- Overrides:
getFullNamein classInterfaceShape- Returns:
-
hasCameraListener
public boolean hasCameraListener() -
releaseScene3DChildren
protected void releaseScene3DChildren() -
getVertexCount
public int getVertexCount()Description copied from class:InterfaceShapeReturns the number of vertices defining the geometry of this shape.- Specified by:
getVertexCountin classInterfaceShape- Returns:
-
setSelectedVertices
public void setSelectedVertices(java.util.ArrayList<java.lang.Integer> indices) -
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObjectReturns the label text to appear in a tree node.- Specified by:
getTreeLabelin interfaceTreeObject- Overrides:
getTreeLabelin classAbstractInterfaceObject- Returns:
-
setIcon
protected void setIcon()- Overrides:
setIconin classInterfaceShape
-
setCreatableSceneNode
protected void setCreatableSceneNode(boolean b) -
getClosestVertex
public int getClosestVertex(org.jogamp.vecmath.Point3f point)Returns the index of the vertex of this shape which is closest topoint.- Parameters:
point-- Returns:
-
getIcon
public final javax.swing.Icon getIcon() -
setParent2D
-
getParent2D
-
destroy
public void destroy()Description copied from interface:InterfaceObjectDestroy this object (prepare it to be removed from memory)- Specified by:
destroyin interfaceInterfaceObject- Overrides:
destroyin classAbstractInterfaceObject
-
registerCameraListener
-
deregisterCameraListener
-
getCameraListener
-
contains
public boolean contains(org.jogamp.vecmath.Point3d thisPoint) -
drawShape2D
Description copied from class:InterfaceShapeABSTRACT METHODS- Specified by:
drawShape2Din classInterfaceShape
-
drawShape2D
public void drawShape2D(java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist)Draw this shape as it is intersected by plane p, as well as its projection from distances <= spacing / 2, if required. Method calls the protected method draw2D(), which should be overridden (rather than this one) by all subclasses wishing to draw their shapes in 2D.- Parameters:
g- Graphics2D where this shape will be drawnd- DrawEngine that will do the drawingp- Plane in R3 that (possibly) intersects the shapespacing- Thickness of the section from which to project this shape to the plane p.
-
drawShape2D
public void drawShape2D(java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist, boolean listen)Draw this shape as it is intersected by plane p, as well as its projection from distances <= spacing / 2, if required. Method calls the protected method draw2D(), which should be overridden (rather than this one) by all subclasses wishing to draw their shapes in 2D.- Parameters:
g- Graphics2D where this shape will be drawnd- DrawEngine that will do the drawingp- Plane in R3 that (possibly) intersects the shapeabove_dist- Thickness of the above part of the section from which to project this shape to the plane p.below_dist- Thickness of the above part of the section from which to project this shape to the plane p.transform- Transform to apply to the shape before rendering; can benull
-
clear2DChildren
public void clear2DChildren()Clears the currently set 2D children for this shape -
draw2D
protected void draw2D(Shape2DInt shape2d, java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist) -
getShape2DInt
-
getShape2DInt
Determines a 2D shape which is the projection of this 3D shape ontoplane, within the projection limits defined byabove_distandbelow_dist.- Parameters:
plane- The plane on which to project this shapeabove_dist- The projection limit above the planeabove_dist- The projection limit below the planelisten-
-
crossesPlane
Convenience method which determines whether this shape crossplane.- Parameters:
plane-- Returns:
-
getShape2D
To be overridden by subclasses implementing a 2D representation- Parameters:
plane- Plane on which to renderabove_dist- Distance above plane within which to project a shapebelow_dist- Distance below plane within which to project a shape- Returns:
-
getShape2D
protected Shape2DInt getShape2D(Plane3D plane, float above_dist, float below_dist, org.jogamp.vecmath.Matrix4d transform)To be overridden by subclasses implementing a 2D representation- Parameters:
plane- Plane on which to renderabove_dist- Distance above plane within which to project a shapebelow_dist- Distance below plane within which to project a shapematrix- Transformation matrix to apply; can benull- Returns:
-
addShape2DChild
-
removeShape2DChild
-
getBoundSphere
-
getBoundBox
-
getCenterOfGravity
public org.jogamp.vecmath.Point3f getCenterOfGravity() -
getGeometricCenter
public org.jogamp.vecmath.Point3f getGeometricCenter() -
getProximity
public double getProximity(org.jogamp.vecmath.Point3d thisPoint) -
getShape
-
getVertexSelection
Description copied from class:InterfaceShapeReturns a list of the currently selected vertices for this shape.- Specified by:
getVertexSelectionin classInterfaceShape
-
setVertexSelection
- Specified by:
setVertexSelectionin classInterfaceShape
-
setShowSelectedVertices
public void setShowSelectedVertices(boolean b) -
updateVertices
public void updateVertices()Updates the vertices -
updateSelectedVertices
public void updateSelectedVertices()Updates the scene graph with the current vertex selection options -
getDimensions
public int[] getDimensions()Description copied from interface:VariableObjectReturns the dimensions of this object as an array of integers- Specified by:
getDimensionsin interfaceVariableObject- Returns:
- the dimensions of this object
-
issueTreeNode
Issues a new tree node for this ShapeInt. Creates the node and then callsInterfaceShape.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode)to construct it.setTreeNodeshould be overridden by subclasses.- Specified by:
issueTreeNodein interfaceTreeObject- Overrides:
issueTreeNodein classAbstractInterfaceObject- Returns:
- a new
InterfaceTreeNode, which is an instance ofShape3DTreeNode.
-
setShape
-
updateShape
public void updateShape()Updates the geometric bounds of this ShapeInt. Does not callsetScene3DObject().- Specified by:
updateShapein classInterfaceShape
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getScene3DObject
-
getScene3DObject
public org.jogamp.java3d.BranchGroup getScene3DObject()Returns aBranchGrouprepresenting this ShapeInt. This node is subject to change, and therefore is not the Java3D node that should be inserted into a Java3D graph. This should instead be retrieved usinggetShapeSceneNode, which returns a stable node.TODO: reconsider the access modifier of this method. Should probably be protected to avoid confusion and undesired external access.
- Returns:
- the scene node representing this ShapeInt
-
setBoundBoxNode
protected void setBoundBoxNode()Sets a bounding box node for this ShapeInt, that can be retrieved usinggetBoundBoxNode().TODO: reconsider the access modifier of this method; probably doesn't need to be public
-
getModifiedAttribute
- Specified by:
getModifiedAttributein classInterfaceShape
-
getBoundBoxNode
public org.jogamp.java3d.BranchGroup getBoundBoxNode()Return's this shape's bounding box node. If it hasn't yet been set, this method will set the bounding box node first.- Returns:
- boundBoxNode - A BranchGroup that can be attached to a Java3D scene for rendering
-
setScene3DObject
public void setScene3DObject()Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes. This node should be retrieved using thegetShapeSceneNode()method. A scene node will only created if one of these conditions is met:- The shape is auxiliary (i.e., not a model shape, but a helper shape such as a section polygon)
- The shape is associated with a ShapeModel3D, and this model is live (is associated with at least one Java3D scene graph).
- Parameters:
make_live-
-
setScene3DObject
public void setScene3DObject(boolean make_live)Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes. This node should be retrieved using thegetShapeSceneNode()method. A scene node will only created if one of these conditions is met:- The shape is auxiliary (i.e., not a model shape, but a helper shape such as a section polygon)
- The shape is associated with a ShapeModel3D, and this model is live (is associated with at least one Java3D scene graph).
- Parameters:
make_live-
-
setShapeSceneNode
public void setShapeSceneNode()Sets the scene node for this shape, either by creating a new node or setting the current shape node to an existing scene node.The scene node can be attached to a Java3D Locale object for rendering.
-
attributeUpdated
Responds to an update in one of this shape's attributes.Subclasses should override and call this super method AFTER handling the attribute change appropriately. Subclasses should also override needsRedraw() to indicate whether the scene node should be regenerated.
- Specified by:
attributeUpdatedin interfaceAttributeListener- Parameters:
e- anAttributeEventspecifying which attribute has been changed
-
geometryChanged
public void geometryChanged()Called when this shape's geometry has changed -
fireShapeModified
public void fireShapeModified()Description copied from class:InterfaceShapeNotifies this shape that it has been modified and should inform its listeners- Overrides:
fireShapeModifiedin classInterfaceShape
-
fireShapeListeners
- Overrides:
fireShapeListenersin classInterfaceShape
-
fireChildren2D
Fires a ShapeEvent for this shape's 2D children -
fireChildren2DModified
public void fireChildren2DModified()Fires a shape modified event for this shape's 2D children -
updateChildren2D
Updates an attribute of this shape's 2D children.- Parameters:
a-
-
getInheritingAttribute
Returns the 2D attribute inheriting from a 3D attribute. Use when InheritFromParent=true. Subclasses should override this method if certain 3D attributes are not intended to be inherited (e.g., vertex scales).- Parameters:
name-- Returns:
- The inheriting attribute, or
nullif attribute is not heritable
-
needsRedraw
Description copied from class:InterfaceShapeReturnstrueif a change toattributewill require a redraw of this shape.- Specified by:
needsRedrawin classInterfaceShape- Returns:
-
hasParentShape
public boolean hasParentShape()Description copied from class:InterfaceShapeIs this shape a child of another shape? Usually this refers to shapes which produce themselves in a different dimensionality; e.g., a 3D shape represented on a 2D plane.- Specified by:
hasParentShapein classInterfaceShape- Returns:
-
getShapeSceneNode
Returns this ShapeInt's Java3D node. This node is stable, meaning that only its children are subject to change; the node is regenerated only when this method is called for the first time, or if it has been destroyed. Thus it is suitable for insertion into a Java3D scene graph.- Returns:
- a
-
getShapeSceneNode
-
setLive
public void setLive(boolean live)Sets the live status of this shape's scene 3D object node.If
liveistrue, adds the scene 3D object node to the shape scene node if one exists.If
liveisfalse, detaches the scene 3D object node to the shape scene node if it is currently live.- Parameters:
live-
-
isLive
public boolean isLive() -
updateData
public void updateData(org.jogamp.java3d.Geometry geometry)- Specified by:
updateDatain interfaceorg.jogamp.java3d.GeometryUpdater
-
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:
-
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:
-
getPopupMenu
Subclasses should override this if necessary and call super.getPopupMenu() to get this top-level menu and add items to it.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
getPopupMenuLength
protected int getPopupMenuLength() -
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
-
copyAttributes
Description copied from class:InterfaceShapeCopiesattributesto this shape. The shape should determine which attributes may be copied.- Overrides:
copyAttributesin classInterfaceShape- Returns:
-
getVertexAppearance
protected org.jogamp.java3d.Appearance getVertexAppearance(int i)Returns the appearance of vertex i.- Parameters:
i-- Returns:
-
setCurrentColumn
public void setCurrentColumn(java.lang.String key, boolean update)- Overrides:
setCurrentColumnin classInterfaceShape
-
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
-
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
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()- Specified by:
getTransferDataFlavorsin interfacejava.awt.datatransfer.Transferable
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)- Specified by:
isDataFlavorSupportedin interfacejava.awt.datatransfer.Transferable
-
performTransfer
public boolean performTransfer(javax.swing.TransferHandler.TransferSupport support)Moves a list of shapes to a position above this shape in its parent set. Does nothing if this shape does not have a parent set.- Specified by:
performTransferin interfaceInterfaceTransferable- Returns:
trueif successful.
-