|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal.FieldPortrayal
sim.portrayal3d.FieldPortrayal3D
sim.portrayal3d.grid.ValueGrid2DPortrayal3D
public class ValueGrid2DPortrayal3D
Displays ValueGrid2Ds values along the XY grid using a surface. The kind of surface is defined by the underlying Portrayal used for the objects, which must be a subclass of QuadPortrayal. Presently there are two kinds of surfaces: TilePortrayal and MeshPortrayal. TilePortrayal draws values as square regions on the surface. MeshPortrayal draws values as the intersections of square regions. This distinction is important because QuadPortrayals may additionally specify a scale which determines how "high" on the Z dimension the QuadPortrayal is drawn to reflect its underlying value. Thus MeshPortrayals look like landscapes, and TilePortrayals look like space-age stairs. QuadPortrayals can also change color to reflect their underlying values, and scale is often 0 by default.
ValueGrid2DPortrayal3Ds can also be wrapped with an opaque image which obscures any colors, and can be set to have some degree of overall transparency (but not the two in combination). Images will be squished to fit just within the field space.
ValueGrid2DPortrayal3Ds do not allow you to specify transparency on a per-gridpoint basis unfortunately. This is due to a lack of this feature in Java3D. Sorry abut that. You can change the colors from gridpoint to gridpoint, but you can't change the transparency from gridpoint to gridpoint.
Bug in MeshPortrayal. It appears that if values in MeshPortrayals cause "bends" in the angle of the underlying squares that are too severe (we've seen over 45 degrees), then when Java3D tries to pick the square you've double-clicked on, the "bent" squares will insist on being included in the pick collection. We believe this to be a bug in Sun's Java3D code. You'll see this happen when you double-click on a MeshPortrayal and the wrong-coordinate object pops up. You can get around this by calling setUsingTriangles(true), which tells the ValueGrid2DPortrayal3D to draw grids using two triangles per cell rather than a rectangle per cell. There are only minor disadvantages to using triangles rather than squares: (1) it's very very slightly slower and (2) if the user displays the grids as a wireframe mesh, he'll see the diagonal line dividing the triangles.
Field Summary | |
---|---|
protected javax.media.j3d.Transform3D |
tmpLocalT
tmp Transform3D it is reused, since the TGs are copying it internally |
protected javax.vecmath.Vector3d |
tmpVect
tmp Vector3d |
Fields inherited from class sim.portrayal.FieldPortrayal |
---|
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals |
Constructor Summary | |
---|---|
ValueGrid2DPortrayal3D()
Be completely opaque, with a value name of "Value". |
|
ValueGrid2DPortrayal3D(java.lang.String valueName)
Be completely opaque. |
|
ValueGrid2DPortrayal3D(java.lang.String valueName,
double transparency)
Be somewhat transparent (1.0 is fully opaque, 0.0f is fully transparent). |
|
ValueGrid2DPortrayal3D(java.lang.String valueName,
java.awt.Image image)
Use a fully opaque image as the appearance. |
Method Summary | |
---|---|
LocationWrapper |
completedWrapper(LocationWrapper w,
com.sun.j3d.utils.picking.PickIntersection pi,
com.sun.j3d.utils.picking.PickResult pr)
Given the provided PickIntersection and the PickResult it came from, fill in w the location of the picked object, and return it. |
javax.media.j3d.TransformGroup |
createModel()
Format is: |
double |
doubleValue(java.lang.Object obj)
|
Portrayal |
getDefaultPortrayal()
Should return a portrayal which can portray any object regardless of whether it's valid or not |
java.lang.Object |
getField()
Returns the field. |
java.awt.Image |
getImage()
|
double |
getTransparency()
|
java.lang.String |
getValueName()
|
boolean |
isUsingTriangles()
|
double |
newValue(int x,
int y,
double value)
This method is called by the default inspector to filter new values set by the user. |
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 |
setField(java.lang.Object grid)
Sets the field, and sets the dirtyField flag to true. |
void |
setImage(java.awt.Image image)
Set the appearance to a fully opaque image. |
void |
setTransparency(double transparency)
Sets non-image transparency: 1.0 is fully opaque, 0.0 is fully transparent. |
void |
setUsingTriangles(boolean val)
|
void |
setValueName(java.lang.String name)
|
void |
updateModel(javax.media.j3d.TransformGroup modelTG)
Returns a tree structure of the form InternalTransformGroup[model info]. |
Methods inherited from class sim.portrayal3d.FieldPortrayal3D |
---|
getCurrentDisplay, getCurrentGUIState, getDefaultTransform, getModel, getTransform, resetTransform, rotateX, rotateY, rotateZ, scale, scale, setCurrentDisplay, setTransform, transform, translate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface sim.portrayal.Portrayal |
---|
getInspector, getName, getStatus, setSelected |
Field Detail |
---|
protected javax.vecmath.Vector3d tmpVect
protected javax.media.j3d.Transform3D tmpLocalT
Constructor Detail |
---|
public ValueGrid2DPortrayal3D(java.lang.String valueName, java.awt.Image image)
public ValueGrid2DPortrayal3D(java.lang.String valueName, double transparency)
public ValueGrid2DPortrayal3D(java.lang.String valueName)
public ValueGrid2DPortrayal3D()
Method Detail |
---|
public boolean isUsingTriangles()
public void setUsingTriangles(boolean val)
public java.lang.Object getField()
FieldPortrayal
getField
in class FieldPortrayal
public java.lang.String getValueName()
public void setValueName(java.lang.String name)
public double getTransparency()
public void setTransparency(double transparency)
public void setImage(java.awt.Image image)
public java.awt.Image getImage()
public javax.media.j3d.PolygonAttributes polygonAttributes()
Portrayal3D
polygonAttributes
in interface Portrayal3D
polygonAttributes
in class FieldPortrayal3D
public Portrayal getDefaultPortrayal()
FieldPortrayal
getDefaultPortrayal
in class FieldPortrayal3D
public void setField(java.lang.Object grid)
FieldPortrayal
setField
in class FieldPortrayal
public double doubleValue(java.lang.Object obj)
public javax.media.j3d.TransformGroup createModel()
createModel
in class FieldPortrayal3D
public void updateModel(javax.media.j3d.TransformGroup modelTG)
FieldPortrayal3D
...where InternalTransformGroup is an identity transformgroup whose transform will be modified elsewhere (don't play with it). By default, this function does nothing. Override it to update the model when it's called.
updateModel
in class FieldPortrayal3D
public double newValue(int x, int y, double value)
public LocationWrapper completedWrapper(LocationWrapper w, com.sun.j3d.utils.picking.PickIntersection pi, com.sun.j3d.utils.picking.PickResult pr)
FieldPortrayal3D
completedWrapper
in class FieldPortrayal3D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |