sim.portrayal3d.grid
Class ValueGrid2D3DPortrayal

java.lang.Object
  extended bysim.portrayal.FieldPortrayal
      extended bysim.portrayal3d.FieldPortrayal3D
          extended bysim.portrayal3d.grid.ValueGrid2D3DPortrayal
All Implemented Interfaces:
ConfigurablePolyPortrayal, Portrayal, Portrayal3D, java.io.Serializable

public class ValueGrid2D3DPortrayal
extends FieldPortrayal3D
implements ConfigurablePolyPortrayal

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class sim.portrayal.FieldPortrayal
FieldPortrayal.CustomInspector
 
Field Summary
 Grid2D field
           
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
 java.lang.String valueName
           
 
Fields inherited from class sim.portrayal3d.FieldPortrayal3D
overallT
 
Fields inherited from class sim.portrayal.FieldPortrayal
classPortrayals, portrayalForAll, portrayalForNull, portrayalForRemainder, portrayals
 
Constructor Summary
ValueGrid2D3DPortrayal(Grid2D grid, double width, double height)
           
ValueGrid2D3DPortrayal(Grid2D grid, javax.media.j3d.Transform3D transf)
           
 
Method Summary
 LocationWrapper completedWrapper(LocationWrapper w, com.sun.j3d.utils.picking.PickIntersection pi)
           
 javax.media.j3d.TransformGroup createModel()
          Create J3D subgraphs for all objects in the field note that each subgraph points to the simulation object it represents, for update purposes.
 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 current field.
 javax.media.j3d.TransformGroup getModel(java.lang.Object obj, javax.media.j3d.TransformGroup modelTG)
          If argument is null, it should behave like createModel; otherwise, it is updateModel.
 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 getPolyAttributes()
           
 void setField(java.lang.Object grid)
          Attaches the field portrayal to the given field.
 
Methods inherited from class sim.portrayal3d.FieldPortrayal3D
setParentPortrayal
 
Methods inherited from class sim.portrayal.FieldPortrayal
getDefaultNullPortrayal, getInspector, getPortrayalForAll, getPortrayalForNull, getPortrayalForObject, getPortrayalForRemainder, setPortrayalForAll, setPortrayalForClass, setPortrayalForNull, setPortrayalForObject, setPortrayalForRemainder, 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, setSelected
 

Field Detail

field

public Grid2D field

valueName

public java.lang.String valueName

tmpVect

protected javax.vecmath.Vector3d tmpVect
tmp Vector3d


tmpLocalT

protected javax.media.j3d.Transform3D tmpLocalT
tmp Transform3D it is reused, since the TGs are copying it internally

Constructor Detail

ValueGrid2D3DPortrayal

public ValueGrid2D3DPortrayal(Grid2D grid,
                              double width,
                              double height)

ValueGrid2D3DPortrayal

public ValueGrid2D3DPortrayal(Grid2D grid,
                              javax.media.j3d.Transform3D transf)
Method Detail

getField

public java.lang.Object getField()
Description copied from class: FieldPortrayal
Returns the current field.

Specified by:
getField in class FieldPortrayal

getPolyAttributes

public javax.media.j3d.PolygonAttributes getPolyAttributes()
Specified by:
getPolyAttributes in interface ConfigurablePolyPortrayal

setField

public void setField(java.lang.Object grid)
Description copied from class: FieldPortrayal
Attaches the field portrayal to the given field. Should throw an exception if the object is invalid.

Specified by:
setField in class FieldPortrayal

getDefaultPortrayal

public Portrayal getDefaultPortrayal()
Description copied from class: FieldPortrayal
Should return a portrayal which can portray any object regardless of whether it's valid or not

Specified by:
getDefaultPortrayal in class FieldPortrayal

createModel

public javax.media.j3d.TransformGroup createModel()
Create J3D subgraphs for all objects in the field note that each subgraph points to the simulation object it represents, for update purposes.


getModel

public javax.media.j3d.TransformGroup getModel(java.lang.Object obj,
                                               javax.media.j3d.TransformGroup modelTG)
Description copied from interface: Portrayal3D
If argument is null, it should behave like createModel; otherwise, it is updateModel. The newly created version or the updated one should be returned. The sub-scene graph repesented by a portrayal is wraped in a TransformGroup, so the parent could place the child at the apropriate position relative to the parent's coordinate system. The child is responsible for positioning itself relative to its own coordinate system. E.g. if the model assumes the position for an object is the postion of its center/upper-left corner/etc, then the portrayal for the object should have the center/upper-left corner of the J3D model of the object in the origin of its coorniate system.

Specified by:
getModel in interface Portrayal3D

getName

public java.lang.String getName(LocationWrapper wrapper)
Description copied from interface: Portrayal
Returns a name for the given object that is useful for a human to distinguish it from other objects. A simple default would be just to return "" + object.

Specified by:
getName in interface Portrayal
Overrides:
getName in class FieldPortrayal

completedWrapper

public LocationWrapper completedWrapper(LocationWrapper w,
                                        com.sun.j3d.utils.picking.PickIntersection pi)
Specified by:
completedWrapper in class FieldPortrayal3D