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
Shape2DInt
objects 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
Shape3DTreeNode
for insertion into aJTree
- setting and accessing vertex-wise data
- linking to a
DataSource
with vertex-wise index data - obtaining an XML encoding of this shape and its attributes
- obtaining an
InterfacePopupMenu
and handling its events
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Shape3DInt.VertexShapeTransformer
Transformer determines the rendering of verticesNested classes/interfaces inherited from class mgui.interfaces.shapes.InterfaceShape
InterfaceShape.VertexDataSet
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description Box3D
boundBox
org.jogamp.java3d.BranchGroup
boundBoxNode
protected org.jogamp.java3d.BranchGroup
bounds_group
protected org.jogamp.java3d.Shape3D
bounds_shape
Sphere3D
boundSphere
org.jogamp.vecmath.Point3f
centerPt
protected java.util.ArrayList<Shape2DInt>
children2D
protected boolean
creatable_scene_node
DrawingEngine
drawEngine2D
protected org.jogamp.java3d.BranchGroup
group_node
protected boolean
has_3d_node
protected boolean
hasCameraListener
java.lang.String
idStr
protected ShapeListener
nodeListener
protected Shape2DInt
parent2D
protected org.jogamp.java3d.BranchGroup
scene3DObject
protected ShapeSceneNode
sceneNode
protected org.jogamp.java3d.BranchGroup
selected_vertices_group
protected org.jogamp.java3d.BranchGroup
shape_group
Shape3D
shape3d
protected Shape3DInt.VertexShapeTransformer
vertex_shape_transformer
protected org.jogamp.java3d.BranchGroup
vertices_group
Fields 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_dir
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description Shape3DInt()
-
Method Summary
Modifier and Type Method Description void
addShape2DChild(Shape2DInt shape)
void
attributeUpdated(AttributeEvent e)
Responds to an update in one of this shape's attributes.void
clear2DChildren()
Clears the currently set 2D children for this shapeboolean
contains(org.jogamp.vecmath.Point3d thisPoint)
boolean
copyAttributes(InterfaceShape source_shape)
Copiesattributes
to this shape.boolean
crossesPlane(Plane3D plane)
Convenience method which determines whether this shape crossplane
.void
deregisterCameraListener(Camera3D c)
void
destroy()
Destroy this object (prepare it to be removed from memory)protected void
draw2D(Shape2DInt shape2d, java.awt.Graphics2D g, DrawingEngine d, Plane3D p, float above_dist, float below_dist)
void
drawShape2D(java.awt.Graphics2D g, DrawingEngine d)
ABSTRACT METHODSvoid
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.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.void
fireChildren2D(ShapeEvent e)
Fires a ShapeEvent for this shape's 2D childrenvoid
fireChildren2DModified()
Fires a shape modified event for this shape's 2D childrenprotected void
fireShapeListeners(ShapeEvent e)
void
fireShapeModified()
Notifies this shape that it has been modified and should inform its listenersvoid
geometryChanged()
Called when this shape's geometry has changedfloat
getAlpha()
Gets the current transparency level for this shape.Box3D
getBoundBox()
org.jogamp.java3d.BranchGroup
getBoundBoxNode()
Return's this shape's bounding box node.Sphere3D
getBoundSphere()
Camera3DListener
getCameraListener()
org.jogamp.vecmath.Point3f
getCenterOfGravity()
int
getClosestVertex(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.String
getDTD()
Returns the Data Type Declaration (DTD) for this object's XML representationjava.lang.String
getFullName()
Returns a full name of this shape, including its parent model and shape sets, separated by dots.org.jogamp.vecmath.Point3f
getGeometricCenter()
Shape
getGeometry()
Returns the Shape associated with this objectShape
getGeometryInstance()
Returns an instance of thisInterfaceShape
's geometry class.javax.swing.Icon
getIcon()
Attribute<?>
getInheritingAttribute(Attribute<?> attribute)
Returns the 2D attribute inheriting from a 3D attribute.java.awt.Color
getLabelColour()
java.awt.Font
getLabelFont()
float
getLabelScale()
java.awt.Color
getLineColour()
Returns the colour of this shape's lines/edges.java.awt.Stroke
getLineStyle()
Returns the line/edge style for this shape.java.lang.String
getLocalName()
Returns the local name associated with this XML object.Attribute<?>
getModifiedAttribute()
Shape2DInt
getParent2D()
protected Attribute<?>
getParentAttribute(java.lang.String attrName)
InterfacePopupMenu
getPopupMenu(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 int
getPopupMenuLength()
double
getProximity(org.jogamp.vecmath.Point3d thisPoint)
org.jogamp.java3d.BranchGroup
getScene3DObject()
Returns aBranchGroup
representing this ShapeInt.org.jogamp.java3d.BranchGroup
getScene3DObject(ShapeSelectionSet selSet)
Shape3D
getShape()
protected Shape2DInt
getShape2D(Plane3D plane, float above_dist, float below_dist)
To be overridden by subclasses implementing a 2D representationprotected Shape2DInt
getShape2D(Plane3D plane, float above_dist, float below_dist, org.jogamp.vecmath.Matrix4d transform)
To be overridden by subclasses implementing a 2D representationShape2DInt
getShape2DInt(Plane3D plane, float above_dist, float below_dist)
Shape2DInt
getShape2DInt(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_dist
andbelow_dist
.ShapeSceneNode
getShapeSceneNode()
Returns this ShapeInt's Java3D node.ShapeSceneNode
getShapeSceneNode(ShapeSelectionSet s)
java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.java.lang.Object
getTransferData(java.awt.datatransfer.DataFlavor flavor)
java.awt.datatransfer.DataFlavor[]
getTransferDataFlavors()
java.lang.String
getTreeLabel()
Returns the label text to appear in a tree node.org.jogamp.vecmath.Point3f
getVertex(int i)
Returns the vertex at indexi
.protected org.jogamp.java3d.Appearance
getVertexAppearance(int i)
Returns the appearance of vertex i.java.awt.Color
getVertexColour()
Returns the colour of this shape's vertices.java.awt.Color
getVertexColour(int i)
Returns the colour of vertex i; depends on whether theShowData
attribute istrue
, and this shape has a current vertex data column.int
getVertexCount()
Returns the number of vertices defining the geometry of this shape.float
getVertexScale()
Returns the scale of this shape's verticesfloat
getVertexScale(int i)
Returns the scale for vertex i; this depends on whetherScaleVertexValues
is set.VertexSelection
getVertexSelection()
Returns a list of the currently selected vertices for this shape.java.util.ArrayList<org.jogamp.vecmath.Point3f>
getVertices()
void
handlePopupEvent(java.awt.event.ActionEvent e)
Handles an event on this object's popup menu.boolean
hasAlpha()
Queries whether this shape has transparency.void
hasAlpha(boolean b)
Specifies whether this shape has transparency.boolean
hasCameraListener()
boolean
hasParentShape()
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 void
init()
boolean
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
boolean
isHeritableAttribute(java.lang.String name)
Is this parent attribute inherited by a child shape?boolean
isInheritingAttribute(Attribute<?> attribute)
Does this child attribute inherit values from a parent shape?boolean
isLive()
InterfaceTreeNode
issueTreeNode()
Issues a new tree node for this ShapeInt.boolean
needsRedraw(Attribute<?> a)
Returnstrue
if a change toattribute
will require a redraw of this shape.boolean
performTransfer(javax.swing.TransferHandler.TransferSupport support)
Moves a list of shapes to a position above this shape in its parent set.void
registerCameraListener(Camera3D c)
protected void
releaseScene3DChildren()
void
removeShape2DChild(Shape2DInt shape)
void
setAlpha(float f)
Sets the current transparency level for this shape.protected void
setBoundBoxNode()
Sets a bounding box node for this ShapeInt, that can be retrieved usinggetBoundBoxNode()
.protected void
setCreatableSceneNode(boolean b)
void
setCurrentColumn(java.lang.String key, boolean update)
boolean
setGeometry(Shape geometry)
Sets the Shape associated with this object.void
setGraphic3DPopupMenu(InterfacePopupMenu menu)
Subclasses should override this if necessary and call super.getGraphic3DPopupMenu() to get this top-level menu and add items to it.protected void
setIcon()
void
setLabelColour(java.awt.Color colour)
void
setLabelFont(java.awt.Font font)
void
setLabelScale(float scale)
void
setLineStyle(java.awt.Stroke s)
Returns the line/edge style for this shape.void
setLive(boolean live)
Sets the live status of this shape's scene 3D object node.void
setParent2D(Shape2DInt parent)
void
setScene3DObject()
Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes.void
setScene3DObject(boolean make_live)
Sets this ShapeInt's Java3D scene node from its current geometry and rendering attributes.void
setSelectedVertices(java.util.ArrayList<java.lang.Integer> indices)
void
setShape(Shape3D newShape)
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.void
setShowSelectedVertices(boolean b)
void
setVertexSelection(VertexSelection selection)
void
showPopupMenu(java.awt.event.MouseEvent e)
Shows a popup menu at the point of the givenMouseEvent
.boolean
showVertices()
Queries whether the vertices of this shape are visible.void
showVertices(boolean b)
Specifies whether the vertices of this shape are visible.java.lang.String
toString()
protected void
updateChildren2D(Attribute<?> a)
Updates an attribute of this shape's 2D children.void
updateData(org.jogamp.java3d.Geometry geometry)
void
updateSelectedVertices()
Updates the scene graph with the current vertex selection optionsvoid
updateShape()
Updates the geometric bounds of this ShapeInt.void
updateVertices()
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, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:InterfaceShape
Returns an instance of thisInterfaceShape
's geometry class.- Specified by:
getGeometryInstance
in classInterfaceShape
- Returns:
-
init
protected void init() -
getParentAttribute
- Specified by:
getParentAttribute
in classInterfaceShape
-
isHeritableAttribute
public boolean isHeritableAttribute(java.lang.String name)Description copied from class:InterfaceShape
Is this parent attribute inherited by a child shape?- Specified by:
isHeritableAttribute
in classInterfaceShape
- Returns:
-
isInheritingAttribute
Description copied from class:InterfaceShape
Does this child attribute inherit values from a parent shape?- Specified by:
isInheritingAttribute
in classInterfaceShape
- Returns:
-
getLabelFont
public java.awt.Font getLabelFont()- Specified by:
getLabelFont
in classInterfaceShape
-
setLabelFont
public void setLabelFont(java.awt.Font font)- Specified by:
setLabelFont
in classInterfaceShape
-
getLabelScale
public float getLabelScale()- Specified by:
getLabelScale
in classInterfaceShape
-
setLabelScale
public void setLabelScale(float scale)- Specified by:
setLabelScale
in classInterfaceShape
-
getLabelColour
public java.awt.Color getLabelColour()- Specified by:
getLabelColour
in classInterfaceShape
-
setLabelColour
public void setLabelColour(java.awt.Color colour)- Specified by:
setLabelColour
in classInterfaceShape
-
hasAlpha
public boolean hasAlpha()Description copied from class:InterfaceShape
Queries whether this shape has transparency.- Specified by:
hasAlpha
in classInterfaceShape
- Returns:
-
hasAlpha
public void hasAlpha(boolean b)Description copied from class:InterfaceShape
Specifies whether this shape has transparency.- Specified by:
hasAlpha
in classInterfaceShape
-
getAlpha
public float getAlpha()Description copied from class:InterfaceShape
Gets the current transparency level for this shape.- Specified by:
getAlpha
in classInterfaceShape
- Returns:
-
setAlpha
public void setAlpha(float f)Description copied from class:InterfaceShape
Sets the current transparency level for this shape.- Specified by:
setAlpha
in classInterfaceShape
-
showVertices
public boolean showVertices()Description copied from class:InterfaceShape
Queries whether the vertices of this shape are visible.- Specified by:
showVertices
in classInterfaceShape
- Returns:
-
showVertices
public void showVertices(boolean b)Description copied from class:InterfaceShape
Specifies whether the vertices of this shape are visible.- Specified by:
showVertices
in classInterfaceShape
-
getVertexScale
public float getVertexScale()Description copied from class:InterfaceShape
Returns the scale of this shape's vertices- Specified by:
getVertexScale
in classInterfaceShape
- Returns:
-
getVertexScale
public float getVertexScale(int i)Returns the scale for vertex i; this depends on whetherScaleVertexValues
is 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:InterfaceShape
Returns the colour of this shape's vertices.- Specified by:
getVertexColour
in classInterfaceShape
- Returns:
-
getVertexColour
public java.awt.Color getVertexColour(int i)Returns the colour of vertex i; depends on whether theShowData
attribute istrue
, and this shape has a current vertex data column.- Parameters:
i
-- Returns:
-
getLineColour
public java.awt.Color getLineColour()Description copied from class:InterfaceShape
Returns the colour of this shape's lines/edges.- Specified by:
getLineColour
in classInterfaceShape
- Returns:
-
getLineStyle
public java.awt.Stroke getLineStyle()Description copied from class:InterfaceShape
Returns the line/edge style for this shape.- Specified by:
getLineStyle
in classInterfaceShape
- Returns:
-
setLineStyle
public void setLineStyle(java.awt.Stroke s)Description copied from class:InterfaceShape
Returns the line/edge style for this shape.- Specified by:
setLineStyle
in classInterfaceShape
-
getGeometry
Description copied from class:InterfaceShape
Returns the Shape associated with this object- Specified by:
getGeometry
in classInterfaceShape
- Returns:
-
setGeometry
Description copied from class:InterfaceShape
Sets the Shape associated with this object. If the class type is incorrect, returnsfalse
- Specified by:
setGeometry
in classInterfaceShape
- Returns:
-
getFullName
public java.lang.String getFullName()Description copied from class:InterfaceShape
Returns a full name of this shape, including its parent model and shape sets, separated by dots.- Overrides:
getFullName
in classInterfaceShape
- Returns:
-
hasCameraListener
public boolean hasCameraListener() -
releaseScene3DChildren
protected void releaseScene3DChildren() -
getVertexCount
public int getVertexCount()Description copied from class:InterfaceShape
Returns the number of vertices defining the geometry of this shape.- Specified by:
getVertexCount
in classInterfaceShape
- Returns:
-
setSelectedVertices
public void setSelectedVertices(java.util.ArrayList<java.lang.Integer> indices) -
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObject
Returns the label text to appear in a tree node.- Specified by:
getTreeLabel
in interfaceTreeObject
- Overrides:
getTreeLabel
in classAbstractInterfaceObject
- Returns:
-
setIcon
protected void setIcon()- Overrides:
setIcon
in 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:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
- Overrides:
destroy
in classAbstractInterfaceObject
-
registerCameraListener
-
deregisterCameraListener
-
getCameraListener
-
contains
public boolean contains(org.jogamp.vecmath.Point3d thisPoint) -
drawShape2D
Description copied from class:InterfaceShape
ABSTRACT METHODS- Specified by:
drawShape2D
in 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_dist
andbelow_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:InterfaceShape
Returns a list of the currently selected vertices for this shape.- Specified by:
getVertexSelection
in classInterfaceShape
-
setVertexSelection
- Specified by:
setVertexSelection
in 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:VariableObject
Returns the dimensions of this object as an array of integers- Specified by:
getDimensions
in 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.setTreeNode
should be overridden by subclasses.- Specified by:
issueTreeNode
in interfaceTreeObject
- Overrides:
issueTreeNode
in 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:
updateShape
in classInterfaceShape
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getScene3DObject
-
getScene3DObject
public org.jogamp.java3d.BranchGroup getScene3DObject()Returns aBranchGroup
representing 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:
getModifiedAttribute
in 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:
attributeUpdated
in interfaceAttributeListener
- Parameters:
e
- anAttributeEvent
specifying 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:InterfaceShape
Notifies this shape that it has been modified and should inform its listeners- Overrides:
fireShapeModified
in classInterfaceShape
-
fireShapeListeners
- Overrides:
fireShapeListeners
in 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
null
if attribute is not heritable
-
needsRedraw
Description copied from class:InterfaceShape
Returnstrue
if a change toattribute
will require a redraw of this shape.- Specified by:
needsRedraw
in classInterfaceShape
- Returns:
-
hasParentShape
public boolean hasParentShape()Description copied from class:InterfaceShape
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.- Specified by:
hasParentShape
in 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
live
istrue
, adds the scene 3D object node to the shape scene node if one exists.If
live
isfalse
, 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:
updateData
in interfaceorg.jogamp.java3d.GeometryUpdater
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObject
Returns 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:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- 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 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:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
getPopupMenuLength
protected int getPopupMenuLength() -
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 interfacePopupMenuObject
-
copyAttributes
Description copied from class:InterfaceShape
Copiesattributes
to this shape. The shape should determine which attributes may be copied.- Overrides:
copyAttributes
in 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:
setCurrentColumn
in classInterfaceShape
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObject
Shows a popup menu at the point of the givenMouseEvent
.- Specified by:
showPopupMenu
in interfacePopupMenuObject
-
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException- Specified by:
getTransferData
in interfacejava.awt.datatransfer.Transferable
- Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()- Specified by:
getTransferDataFlavors
in interfacejava.awt.datatransfer.Transferable
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)- Specified by:
isDataFlavorSupported
in 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:
performTransfer
in interfaceInterfaceTransferable
- Returns:
true
if successful.
-