public class FastValueGridPortrayal2D extends ValueGridPortrayal2D
Additionally, FastValueGridPortrayal2D is useful if your grid never changes past its first drawing. For example, if you're drawing static obstacles, cities, etc., which never change in value during the invocation of the simulation, then FastValueGridPortrayal2D can draw them efficiently by just drawing once into its buffer and re-displaying the buffer over and over again. Just pass in true in the constructor.
If your grid does change but only occasionally, you can also use this technique as well; just manually call reset() whenever the grid changes to inform the FastValueGridPortrayal2D that it needs to re-compute the buffer. reset() is threadsafe.
locationToPass, valueToPass
DEFAULT, DONT_USE_BUFFER, USE_BUFFER
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals
Constructor and Description |
---|
FastValueGridPortrayal2D() |
FastValueGridPortrayal2D(boolean immutableField)
If immutableField is true, we presume that the grid doesn't change.
|
FastValueGridPortrayal2D(java.lang.String valueName) |
FastValueGridPortrayal2D(java.lang.String valueName,
boolean immutableField)
If immutableField is true, we presume that the grid doesn't change.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
Draws the field with its origin at [info.draw.x,info.draw.y], relative to the
scaled coordinate system defined by [info.draw.width,info.draw.height].
|
getDefaultPortrayal, getLocationPosition, getMap, getPositionLocation, getScale, getValueName, getWrapper, hitOrDraw, newValue, setBorder, setBorderColor, setBorderLineFraction, setBorderLineMinMaxWidth, setField, setGridColor, setGridLineFraction, setGridLineMinMaxWidth, setGridLines, setGridMinSpacing, setGridModulus, setMap, setValueName
getBuffering, getClipLocation, getObjectPosition, getRelativeObjectPosition, hitObjects, setBuffering, setObjectPosition
getDefaultNullPortrayal, getField, getInspector, getName, getObjectLocation, getPortrayalForAll, getPortrayalForNonNull, getPortrayalForNull, getPortrayalForObject, getPortrayalForRemainder, getStatus, isDirtyField, isImmutableField, reset, setDirtyField, setImmutableField, setObjectLocation, setPortrayalForAll, setPortrayalForClass, setPortrayalForNonNull, setPortrayalForNull, setPortrayalForObject, setPortrayalForRemainder, setSelected, setSelected
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInspector, getName, getStatus, setSelected
public FastValueGridPortrayal2D(java.lang.String valueName, boolean immutableField)
public FastValueGridPortrayal2D(java.lang.String valueName)
public FastValueGridPortrayal2D(boolean immutableField)
public FastValueGridPortrayal2D()
public void draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)
FieldPortrayal2D
draw
in interface Portrayal2D
draw
in class FieldPortrayal2D