Class ValueGrid2DPortrayal3D
- All Implemented Interfaces:
Portrayal
,Portrayal3D
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
Fields inherited from class sim.portrayal.FieldPortrayal
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals
-
Constructor Summary
ConstructorDescriptionBe completely opaque, with a value name of "Value".ValueGrid2DPortrayal3D
(String valueName) Be completely opaque.ValueGrid2DPortrayal3D
(String valueName, double transparency) Be somewhat transparent (1.0 is fully opaque, 0.0f is fully transparent).ValueGrid2DPortrayal3D
(String valueName, Image image) Use a fully opaque image as the appearance. -
Method Summary
Modifier and TypeMethodDescriptioncompletedWrapper
(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
Format is:double
doubleValue
(Object obj) Should return a portrayal which can portray any object regardless of whether it's valid or notgetField()
Returns the field.getImage()
double
boolean
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
Provides a PolygonAttributes which can be modified to change the underlying model's attributes (culling, vertex versus point versus fill).void
Sets the field, and sets the dirtyField flag to true.void
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
(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, getObjectLocation, getTransform, resetTransform, rotateX, rotateY, rotateZ, scale, scale, setCurrentDisplay, setObjectLocation, setTransform, transform, translate
Methods inherited from class sim.portrayal.FieldPortrayal
getAlternatePortrayalOrdering, getDefaultNullPortrayal, getInspector, getName, getPortrayalForAll, getPortrayalForNonNull, getPortrayalForNull, getPortrayalForObject, getPortrayalForRemainder, getStatus, isDirtyField, isImmutableField, reset, setAlternatePortrayalOrdering, setDirtyField, setImmutableField, setPortrayalForAll, setPortrayalForClass, setPortrayalForNonNull, setPortrayalForNull, setPortrayalForObject, setPortrayalForRemainder, setSelected, setSelected
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 Details
-
tmpVect
protected javax.vecmath.Vector3d tmpVecttmp Vector3d
-
-
Constructor Details
-
ValueGrid2DPortrayal3D
Use a fully opaque image as the appearance. The default portrayal is a simple TilePortrayal which ranges from blue to red. -
ValueGrid2DPortrayal3D
Be somewhat transparent (1.0 is fully opaque, 0.0f is fully transparent). The default portrayal is a simple TilePortrayal which ranges from blue to red. -
ValueGrid2DPortrayal3D
Be completely opaque. The default portrayal is a simple TilePortrayal which ranges from blue to red. -
ValueGrid2DPortrayal3D
public ValueGrid2DPortrayal3D()Be completely opaque, with a value name of "Value". The default portrayal is a simple TilePortrayal which ranges from blue to red.
-
-
Method Details
-
isUsingTriangles
public boolean isUsingTriangles() -
setUsingTriangles
public void setUsingTriangles(boolean val) -
getField
Description copied from class:FieldPortrayal
Returns the field.- Overrides:
getField
in classFieldPortrayal
-
getValueName
-
setValueName
-
getTransparency
public double getTransparency() -
setTransparency
public void setTransparency(double transparency) Sets non-image transparency: 1.0 is fully opaque, 0.0 is fully transparent. -
setImage
Set the appearance to a fully opaque image. If image is null, then removes any image. -
getImage
-
polygonAttributes
public javax.media.j3d.PolygonAttributes polygonAttributes()Description copied from interface:Portrayal3D
Provides a PolygonAttributes which can be modified to change the underlying model's attributes (culling, vertex versus point versus fill). This is an optional function: you are free to return null- Specified by:
polygonAttributes
in interfacePortrayal3D
- Overrides:
polygonAttributes
in classFieldPortrayal3D
-
getDefaultPortrayal
Description copied from class:FieldPortrayal
Should return a portrayal which can portray any object regardless of whether it's valid or not- Overrides:
getDefaultPortrayal
in classFieldPortrayal3D
-
setField
Description copied from class:FieldPortrayal
Sets the field, and sets the dirtyField flag to true. May throw an exception if the field is inappropriate. The default version just sets the field and sets the dirtyField flag.- Overrides:
setField
in classFieldPortrayal
-
doubleValue
-
createModel
public javax.media.j3d.TransformGroup createModel()Format is:- Specified by:
createModel
in classFieldPortrayal3D
-
updateModel
public void updateModel(javax.media.j3d.TransformGroup modelTG) Description copied from class:FieldPortrayal3D
Returns a tree structure of the form InternalTransformGroup[model info]....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.
- Overrides:
updateModel
in classFieldPortrayal3D
-
newValue
public double newValue(int x, int y, double value) This method is called by the default inspector to filter new values set by the user. You should return the "corrected" value if the given value is invalid. The default version of this method bases values on the values passed into the setLevels() and setColorTable() methods. -
completedWrapper
public LocationWrapper completedWrapper(LocationWrapper w, com.sun.j3d.utils.picking.PickIntersection pi, com.sun.j3d.utils.picking.PickResult pr) Description copied from class:FieldPortrayal3D
Given the provided PickIntersection and the PickResult it came from, fill in w the location of the picked object, and return it. Alternatively, return a new LocationWrapper with all information filled in. The PickResult is provided you in case the object is in a shared group and you need to identify what link had connected to it.- Specified by:
completedWrapper
in classFieldPortrayal3D
-