sim.portrayal.simple
Class ValuePortrayal2D

java.lang.Object
  extended bysim.portrayal.SimplePortrayal2D
      extended bysim.portrayal.simple.RectanglePortrayal2D
          extended bysim.portrayal.simple.ValuePortrayal2D
All Implemented Interfaces:
Portrayal, Portrayal2D, java.io.Serializable

public class ValuePortrayal2D
extends RectanglePortrayal2D

The ValuePortrayal2D is the default portrayal for ValueGridPortrayal2Ds. It requires a parent (the ValueGridPortrayal2D), which it uses to determine the correct colors for a given object. The objects portrayed must be instances of MutableDouble, where the value represents the level of the color.

See Also:
Serialized Form

Nested Class Summary
static class ValuePortrayal2D.DoubleFilter
           
static class ValuePortrayal2D.Filter
           
static class ValuePortrayal2D.IntFilter
           
 
Field Summary
 boolean isTransparent
           
 double level
           
 ValueGridPortrayal2D parent
           
 
Fields inherited from class sim.portrayal.simple.RectanglePortrayal2D
paint, scale
 
Constructor Summary
ValuePortrayal2D(ValueGridPortrayal2D parent)
           
 
Method Summary
 void draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)
          Draw a portrayed object centered at the origin in info, and with the given scaling factors.
 Inspector getInspector(LocationWrapper wrapper, GUIState state)
          Provide an inspector for an object.
 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.
 void setParent(ValueGridPortrayal2D parent)
           
 
Methods inherited from class sim.portrayal.simple.RectanglePortrayal2D
hitObject
 
Methods inherited from class sim.portrayal.SimplePortrayal2D
move, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level

public double level

isTransparent

public boolean isTransparent

parent

public ValueGridPortrayal2D parent
Constructor Detail

ValuePortrayal2D

public ValuePortrayal2D(ValueGridPortrayal2D parent)
Method Detail

setParent

public void setParent(ValueGridPortrayal2D parent)

draw

public void draw(java.lang.Object object,
                 java.awt.Graphics2D graphics,
                 DrawInfo2D info)
Description copied from interface: Portrayal2D
Draw a portrayed object centered at the origin in info, and with the given scaling factors. draw(...) will not be called until portray(obj) has been called on a Portrayal2D at least once. But you should have some default null drawing capability just in case.

Specified by:
draw in interface Portrayal2D
Overrides:
draw in class RectanglePortrayal2D

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
Overrides:
getInspector in class SimplePortrayal2D

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 SimplePortrayal2D