sim.portrayal3d.simple
Class Shape3DPortrayal3D

java.lang.Object
  extended by sim.portrayal3d.SimplePortrayal3D
      extended by sim.portrayal3d.simple.PrimitivePortrayal3D
          extended by sim.portrayal3d.simple.Shape3DPortrayal3D
All Implemented Interfaces:
java.io.Serializable, Portrayal, Portrayal3D
Direct Known Subclasses:
ValuePortrayal3D

public class Shape3DPortrayal3D
extends PrimitivePortrayal3D

A simple portrayal for displaying Shape3D objects. You can find Shape3D objects, or CompressedGeometry objects (which you can make into a Shape3D in its constructor) all over the web.

Important note: CompressedGeometry cannot have any appearances set: it ignores all of them and only uses what's defined in the geometry itself. That's Java3D for you.

Some examples (be sure to import javax.media.j3d.*; import com.sun.j3d.utils.geometry.*; import java.awt.Font.*;)

See Also:
Serialized Form

Field Summary
 
Fields inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
group
 
Fields inherited from class sim.portrayal3d.SimplePortrayal3D
DEFAULT_APPEARANCE
 
Constructor Summary
Shape3DPortrayal3D(javax.media.j3d.Geometry geometry)
          Constructs a Shape3DPortrayal3D with the given geometry and a default (flat opaque white) appearance.
Shape3DPortrayal3D(javax.media.j3d.Geometry geometry, javax.media.j3d.Appearance appearance)
          Constructs a Shape3DPortrayal3D with the given geometry and appearance.
Shape3DPortrayal3D(javax.media.j3d.Geometry geometry, java.awt.Color color)
          Constructs a Shape3DPortrayal3D with the given geometry and a flat opaque appearance of the given color.
Shape3DPortrayal3D(javax.media.j3d.Geometry geometry, java.awt.Image image)
          Constructs a Shape3DPortrayal3D with the given geometry and (opaque) image.
Shape3DPortrayal3D(javax.media.j3d.Shape3D shape)
          Constructs a Shape3DPortrayal3D with the given shape and a default (flat opaque white) appearance.
Shape3DPortrayal3D(javax.media.j3d.Shape3D shape, javax.media.j3d.Appearance appearance)
          Constructs a Shape3DPortrayal3D with the given shape and appearance.
Shape3DPortrayal3D(javax.media.j3d.Shape3D shape, java.awt.Color color)
          Constructs a Shape3DPortrayal3D with the given shape and a flat opaque appearance of the given color.
Shape3DPortrayal3D(javax.media.j3d.Shape3D shape, java.awt.Image image)
          Constructs a Shape3DPortrayal3D with the given shape and (opaque) image.
 
Method Summary
protected  javax.media.j3d.Shape3D getShape(javax.media.j3d.TransformGroup j3dModel, int shapeNumber)
          Returns the shape by the given index.
protected  int numShapes()
          Returns the number of shapes handled by this primitive or Shape3D.
 
Methods inherited from class sim.portrayal3d.simple.PrimitivePortrayal3D
getAppearance, getModel, setAppearance, setPickable, setScale, setShape3DFlags, setTransform
 
Methods inherited from class sim.portrayal3d.SimplePortrayal3D
appearanceForColor, appearanceForColors, appearanceForImage, clearPickableFlags, getCurrentDisplay, getCurrentFieldPortrayal, getCurrentGUIState, getInspector, getName, getStatus, isSelected, polygonAttributes, setAppearanceFlags, setCurrentDisplay, setCurrentFieldPortrayal, setPickableFlags, setPickableFlags, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Shape3D shape)
Constructs a Shape3DPortrayal3D with the given shape and a default (flat opaque white) appearance.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Shape3D shape,
                          java.awt.Color color)
Constructs a Shape3DPortrayal3D with the given shape and a flat opaque appearance of the given color.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Shape3D shape,
                          java.awt.Image image)
Constructs a Shape3DPortrayal3D with the given shape and (opaque) image.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Shape3D shape,
                          javax.media.j3d.Appearance appearance)
Constructs a Shape3DPortrayal3D with the given shape and appearance.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Geometry geometry)
Constructs a Shape3DPortrayal3D with the given geometry and a default (flat opaque white) appearance.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Geometry geometry,
                          java.awt.Color color)
Constructs a Shape3DPortrayal3D with the given geometry and a flat opaque appearance of the given color.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Geometry geometry,
                          java.awt.Image image)
Constructs a Shape3DPortrayal3D with the given geometry and (opaque) image.


Shape3DPortrayal3D

public Shape3DPortrayal3D(javax.media.j3d.Geometry geometry,
                          javax.media.j3d.Appearance appearance)
Constructs a Shape3DPortrayal3D with the given geometry and appearance.

Method Detail

numShapes

protected int numShapes()
Description copied from class: PrimitivePortrayal3D
Returns the number of shapes handled by this primitive or Shape3D. Shape3D objects only have a single shape. Cylinder has three shapes (BODY=0, TOP=1, BOTTOM=2), while Cone has two shapes (BODY=0, CAP=1) and Sphere has a single shape (BODY=0).

Specified by:
numShapes in class PrimitivePortrayal3D

getShape

protected javax.media.j3d.Shape3D getShape(javax.media.j3d.TransformGroup j3dModel,
                                           int shapeNumber)
Description copied from class: PrimitivePortrayal3D
Returns the shape by the given index. Cylinder has three shapes (BODY=0, TOP=1, BOTTOM=2), while Cone has two shapes (BODY=0, CAP=1) and Sphere has a single shape (BODY=0). Useful for use in for-loops in combination with numShapes().

Overrides:
getShape in class PrimitivePortrayal3D