|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal3d.SimplePortrayal3D
sim.portrayal3d.simple.CircledPortrayal3D
public class CircledPortrayal3D
A wrapper for other Portrayal3Ds which also draws a big translucent sphere around them -- useful for distinguishing one object from other similar-looking objects. When you create this CirclePortrayal3D, you will pass in an underlying Portrayal3D which is supposed to draw the actual object; CirclePortrayal3D will then add on the sphere. If the object will draw itself (it's its own Portrayal3D), you can signify this by passing in null for the underlying Portrayal3D.
There are certain guidelines you can specify for when the sphere is to be drawn. At construction time you can state that the sphere should only be drawn when the object is selected. Additionally if you call the setCircleShowing(...) function, you can turn off or on sphere drawing entirely for this CirclePortrayal3D.
You may specify a color or appearance for the sphere (the default is 25%-opaque flat white). If you specify a color with some degree of alpha, the sphere will be drawn to that degree of transparency. You can also specify a scale -- equivalent to the diameter of the sphere. The default scale (2.0f) draws the sphere in the (-1,-1,-1) to (1,1,1) box.
Why's it not called a "SpheredPortrayal3D?" One, because there's no such word as "sphered", you big goof. More importantly, we thought it'd be useful to stay consistent with CircledPortrayal2D.
Field Summary | |
---|---|
javax.media.j3d.Appearance |
appearance
|
protected SimplePortrayal3D |
child
|
static javax.media.j3d.Appearance |
DEFAULT_CIRCLED_APPEARANCE
|
float |
scale
|
Fields inherited from class sim.portrayal3d.SimplePortrayal3D |
---|
DEFAULT_APPEARANCE, parentPortrayal |
Constructor Summary | |
---|---|
CircledPortrayal3D(SimplePortrayal3D child)
|
|
CircledPortrayal3D(SimplePortrayal3D child,
javax.media.j3d.Appearance appearance,
float scale,
boolean onlyCircleWhenSelected)
|
|
CircledPortrayal3D(SimplePortrayal3D child,
java.awt.Color color)
|
|
CircledPortrayal3D(SimplePortrayal3D child,
java.awt.Color color,
float scale,
boolean onlyCircleWhenSelected)
|
|
CircledPortrayal3D(SimplePortrayal3D child,
float scale)
|
|
CircledPortrayal3D(SimplePortrayal3D child,
float scale,
boolean onlyCircleWhenSelected)
|
Method Summary | |
---|---|
SimplePortrayal3D |
getChild(java.lang.Object object)
|
Inspector |
getInspector(LocationWrapper wrapper,
GUIState state)
Provide an inspector for an object. |
javax.media.j3d.TransformGroup |
getModel(java.lang.Object obj,
javax.media.j3d.TransformGroup j3dModel)
Provides a TransformGroup which defines the node(s) to place in the scenegraph. |
java.lang.String |
getName(LocationWrapper wrapper)
Returns a static, one-line name for the given object that is useful for a human to distinguish it from other objects. |
boolean |
getOnlyCircleWhenSelected()
|
boolean |
isCircleShowing()
|
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 |
setCircleShowing(boolean val)
|
void |
setOnlyCircleWhenSelected(boolean val)
|
void |
setParentPortrayal(FieldPortrayal3D p)
Sets the parent portrayal (a FieldPortrayal3D). |
boolean |
setSelected(LocationWrapper wrapper,
boolean selected)
Change the portrayal state to reflect the fact that you've been selected or not selected. |
void |
updateSwitch(javax.media.j3d.Switch jswitch)
|
Methods inherited from class sim.portrayal3d.SimplePortrayal3D |
---|
appearanceForColor, appearanceForImage, clearPickableFlags, getStatus, setPickableFlags, setPickableFlags |
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_CIRCLED_APPEARANCE
public float scale
public javax.media.j3d.Appearance appearance
protected SimplePortrayal3D child
Constructor Detail |
---|
public CircledPortrayal3D(SimplePortrayal3D child)
public CircledPortrayal3D(SimplePortrayal3D child, float scale)
public CircledPortrayal3D(SimplePortrayal3D child, float scale, boolean onlyCircleWhenSelected)
public CircledPortrayal3D(SimplePortrayal3D child, java.awt.Color color)
public CircledPortrayal3D(SimplePortrayal3D child, java.awt.Color color, float scale, boolean onlyCircleWhenSelected)
public CircledPortrayal3D(SimplePortrayal3D child, javax.media.j3d.Appearance appearance, float scale, boolean onlyCircleWhenSelected)
Method Detail |
---|
public javax.media.j3d.PolygonAttributes polygonAttributes()
Portrayal3D
polygonAttributes
in interface Portrayal3D
polygonAttributes
in class SimplePortrayal3D
public Inspector getInspector(LocationWrapper wrapper, GUIState state)
Portrayal
getInspector
in interface Portrayal
getInspector
in class SimplePortrayal3D
public java.lang.String getName(LocationWrapper wrapper)
Portrayal
getName
in interface Portrayal
getName
in class SimplePortrayal3D
public void setParentPortrayal(FieldPortrayal3D p)
SimplePortrayal3D
setParentPortrayal
in class SimplePortrayal3D
public boolean setSelected(LocationWrapper wrapper, boolean selected)
Portrayal
setSelected
in interface Portrayal
setSelected
in class SimplePortrayal3D
public SimplePortrayal3D getChild(java.lang.Object object)
public void setOnlyCircleWhenSelected(boolean val)
public boolean getOnlyCircleWhenSelected()
public boolean isCircleShowing()
public void setCircleShowing(boolean val)
public void updateSwitch(javax.media.j3d.Switch jswitch)
public javax.media.j3d.TransformGroup getModel(java.lang.Object obj, javax.media.j3d.TransformGroup j3dModel)
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
getModel
in class SimplePortrayal3D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |