|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal3d.SimplePortrayal3D
The superclass of all 3D Simple Portrayals which by default adds nothing to the 3D scene. Since nothing is added to the scene, nothing is shown and you cannot select anything. Subclasses add items to the scene, so they can then be selected if they so choose. By default SimplePortrayal3Ds respond to requests for inspectors by providing a basic LabelledList which shows all the portrayed object's object properties (see sim.util.SimpleProperties). They also respond to inspector update requests by updating this same LabelledList. No polygonAttributes are provided by default, and setSelected always returns false.
SimplePortrayal3Ds have a parentPortrayal, which is the FieldPortrayal3D which houses them. This value can be null if the SimplePortrayal3D was added directly into the Display3D's collection of portrayals rather than being used inside a field portrayal. The contract SimplePortrayal3Ds may assume is that the parentPortrayal, if it exists, will have been set prior to getModel(...) being called.
Various utility functions are provided. setPickableFlags makes a Java3D object pickable (necessary for inspectability and selection). clearPickableFlags does the opposite. appearanceForColor creates a Java3D appearance that's a flat version of the color which requires no lighting -- a very basic default appearance function. If the color has a degree of transparency, the appearance will as well.
A default appearance is provided for subclasses which wish to draw themselves using a default: flat white opaque.
Field Summary | |
static javax.media.j3d.Appearance |
DEFAULT_APPEARANCE
Flat white opaque. |
protected FieldPortrayal3D |
parentPortrayal
Used by the SimplePortrayal3D to add its parent to its pickInfo object when the user picks the SimplePortrayal3D. |
Constructor Summary | |
SimplePortrayal3D()
|
Method Summary | |
static javax.media.j3d.Appearance |
appearanceForColor(java.awt.Color color)
Creates an Appearance equivalent to a flat opaque surface of the provided color, needing no lighting. |
static javax.media.j3d.Appearance |
appearanceForImage(java.awt.Image image,
boolean opaque)
Creates an Appearance using the provided image. |
static void |
clearPickableFlags(javax.media.j3d.Node n)
Utility method which makes the given Node unpickable. |
Inspector |
getInspector(LocationWrapper wrapper,
GUIState state)
Provide an inspector for an object. |
javax.media.j3d.TransformGroup |
getModel(java.lang.Object object,
javax.media.j3d.TransformGroup prev)
Provides a TransformGroup which defines the node(s) to place in the scenegraph. |
java.lang.String |
getName(LocationWrapper wrapper)
Returns a name for the given object that is useful for a human to distinguish it from other objects. |
javax.media.j3d.PolygonAttributes |
polygonAttributes()
Provides a PolygonAttributes which can be modified to change the underlying model's attributes (culling, vertex versus point versus fill). |
void |
setParentPortrayal(FieldPortrayal3D p)
Sets the parent portrayal (a FieldPortrayal3D). |
static void |
setPickableFlags(javax.media.j3d.Geometry geom)
Utility method which prepares the given Geometry to be pickable (for selection and inspection). |
static void |
setPickableFlags(javax.media.j3d.Shape3D s3d)
Utility method which prepares the given Shape3D to be pickable (for selection and inspection). |
boolean |
setSelected(LocationWrapper wrapper,
boolean selected)
Change the portrayal state to reflect the fact that you've been selected or not selected. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final javax.media.j3d.Appearance DEFAULT_APPEARANCE
protected FieldPortrayal3D parentPortrayal
Constructor Detail |
public SimplePortrayal3D()
Method Detail |
public static javax.media.j3d.Appearance appearanceForColor(java.awt.Color color)
public static javax.media.j3d.Appearance appearanceForImage(java.awt.Image image, boolean opaque)
public javax.media.j3d.PolygonAttributes polygonAttributes()
Portrayal3D
polygonAttributes
in interface Portrayal3D
public javax.media.j3d.TransformGroup getModel(java.lang.Object object, javax.media.j3d.TransformGroup prev)
Portrayal3D
You should hang your model off of the TransformGroup provided. You should not transform that TransformGroup in any way -- it is used elsewhere. Instead if you wish to transform your model (rotate it etc.) you should add your own additional TransformGroup as necessary.
The provided TransformGroup can be null; in this case you need to create and return the outer TransformGroup for the object. If the provided TransformGroup is non-null, you should modify it and return the same.
SimplePortrayals should assume the following contract: at the point that getModel(...) is called, the parentPortrayal will have already been set if it exists, else it will be null.
getModel
in interface Portrayal3D
public Inspector getInspector(LocationWrapper wrapper, GUIState state)
Portrayal
getInspector
in interface Portrayal
public java.lang.String getName(LocationWrapper wrapper)
Portrayal
getName
in interface Portrayal
public void setParentPortrayal(FieldPortrayal3D p)
public boolean setSelected(LocationWrapper wrapper, boolean selected)
Portrayal
setSelected
in interface Portrayal
public static void setPickableFlags(javax.media.j3d.Shape3D s3d)
public static void setPickableFlags(javax.media.j3d.Geometry geom)
public static void clearPickableFlags(javax.media.j3d.Node n)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |