sim.portrayal3d.grid.quad
Class QuadPortrayal

java.lang.Object
  extended by sim.portrayal3d.grid.quad.QuadPortrayal
All Implemented Interfaces:
java.io.Serializable, Portrayal
Direct Known Subclasses:
MeshPortrayal, TilePortrayal

public abstract class QuadPortrayal
extends java.lang.Object
implements Portrayal

A QuadPortrayal is the abstract superclass of objects which describe how rectangles in a in a ValueGrid2DPortrayal3D are associated with the underlying ValueGrid2D. These objects are not true Portrayal3D objects: they can only be used with ValueGrid2DPortrayal3D.

There are two standard subclasses: TilePortrayal represents objects as squares on the grid. MeshPortrayal represents objects as the *intersections* of the grid lines.

QuadPortrayals may be associated with a zScale, indicating the degree to which the value effects the "height" of the rectangle. In TilePortrayal, different "heights" result in stair-step effects. In MeshsPortrayal, different "heights" result in a mountainscape.

QuadPortrayals are also associated with a colorDispenser which specifies the color of the ValueGrid2D point, just as in ValueGridPortrayal2D.

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.

See Also:
Serialized Form

Nested Class Summary
static class QuadPortrayal.DoubleFilter
           
static class QuadPortrayal.Filter
           
static class QuadPortrayal.IntFilter
           
static class QuadPortrayal.ObjectFilter
           
 
Constructor Summary
QuadPortrayal(ColorMap colorDispenser, double zScale)
           
 
Method Summary
 Int2D getCellForIntersection(com.sun.j3d.utils.picking.PickIntersection pi, Grid2D field)
           
 Inspector getInspector(LocationWrapper wrapper, GUIState state)
          Provide an inspector for an object.
 ColorMap getMap()
           
 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.
 java.lang.String getStatus(LocationWrapper wrapper)
          Returns a simple, informative one-line description of the current status of the object, which may change at any time to reflect how the object is changing.
 double getZScale()
           
abstract  void setData(ValueGridCellInfo gridCell, float[] coordinates, float[] colors, int quadIndex, int gridWidth, int gridHeight)
           
 void setMap(ColorMap map)
           
 boolean setSelected(LocationWrapper wrapper, boolean selected)
          Change the portrayal state to reflect the fact that you've been selected or not selected.
 void setZScale(double scale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadPortrayal

public QuadPortrayal(ColorMap colorDispenser,
                     double zScale)
Method Detail

getMap

public ColorMap getMap()

setMap

public void setMap(ColorMap map)

getZScale

public double getZScale()

setZScale

public void setZScale(double scale)

setData

public abstract void setData(ValueGridCellInfo gridCell,
                             float[] coordinates,
                             float[] colors,
                             int quadIndex,
                             int gridWidth,
                             int gridHeight)

getStatus

public java.lang.String getStatus(LocationWrapper wrapper)
Description copied from interface: Portrayal
Returns a simple, informative one-line description of the current status of the object, which may change at any time to reflect how the object is changing. A simple default would be just to return getName(wrapper).

Specified by:
getStatus in interface Portrayal

getName

public java.lang.String getName(LocationWrapper wrapper)
Description copied from interface: Portrayal
Returns a static, one-line 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

setSelected

public boolean setSelected(LocationWrapper wrapper,
                           boolean selected)
Description copied from interface: Portrayal
Change the portrayal state to reflect the fact that you've been selected or not selected. Always return true, except if you've received a setSelected(true) and in fact do not wish to be selectable, in which case return false in that sole situation.

Specified by:
setSelected in interface Portrayal

getInspector

public Inspector getInspector(LocationWrapper wrapper,
                              GUIState state)
Description copied from interface: Portrayal
Provide an inspector for an object.

Specified by:
getInspector in interface Portrayal

getCellForIntersection

public Int2D getCellForIntersection(com.sun.j3d.utils.picking.PickIntersection pi,
                                    Grid2D field)