Class QuadPortrayal

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

public abstract class QuadPortrayal extends 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.

  • Constructor Details

    • QuadPortrayal

      public QuadPortrayal(ColorMap colorDispenser, double zScale)
  • Method Details

    • 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 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 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)