|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal.FieldPortrayal
sim.portrayal.FieldPortrayal2D
sim.portrayal.grid.ObjectGridPortrayal2D
public class ObjectGridPortrayal2D
A portrayal for grids containing objects, such as maybe agents or agent bodies.
By default this portrayal describes objects as gray ovals (that's what getDefaultPortrayal() returns) and null values as empty regions (that's what getDefaultNullPortrayal() returns). You may wish to override this for your own purposes.
Nested Class Summary | |
---|---|
static class |
ObjectGridPortrayal2D.Message
|
Nested classes/interfaces inherited from class sim.portrayal.FieldPortrayal |
---|
FieldPortrayal.CustomInspector |
Field Summary |
---|
Fields inherited from class sim.portrayal.FieldPortrayal2D |
---|
DEFAULT, DONT_USE_BUFFER, USE_BUFFER |
Fields inherited from class sim.portrayal.FieldPortrayal |
---|
classPortrayals, dirtyField, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals |
Constructor Summary | |
---|---|
ObjectGridPortrayal2D()
|
Method Summary | |
---|---|
Portrayal |
getDefaultNullPortrayal()
Returns a default portrayal for null. |
Portrayal |
getDefaultPortrayal()
Should return a portrayal which can portray any object regardless of whether it's valid or not |
java.awt.geom.Point2D.Double |
getPositionInFieldPortrayal(java.lang.Object object,
DrawInfo2D info)
Returns the location of the given object were it to be drawn on the screen. |
LocationWrapper |
getWrapper(java.lang.Object object,
Int2D location)
|
protected void |
hitOrDraw(java.awt.Graphics2D graphics,
DrawInfo2D info,
Bag putInHere)
Instead of overriding the draw and hitObjects methods, you can optionally override this method to provide both the draw(...) and hitObjects(...) functionality in a single method, as it's common that these two methods have nearly identical code. |
void |
setField(java.lang.Object field)
Sets the field. |
boolean |
setSelected(LocationWrapper wrapper,
boolean selected)
Selects or deselects all of the provided objects. |
Methods inherited from class sim.portrayal.FieldPortrayal2D |
---|
draw, getBuffering, hitObjects, move, setBuffering |
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, getName, getStatus |
Constructor Detail |
---|
public ObjectGridPortrayal2D()
Method Detail |
---|
public void setField(java.lang.Object field)
FieldPortrayal
setField
in class FieldPortrayal2D
public Portrayal getDefaultPortrayal()
FieldPortrayal
getDefaultPortrayal
in class FieldPortrayal2D
public Portrayal getDefaultNullPortrayal()
FieldPortrayal
getDefaultNullPortrayal
in class FieldPortrayal
public java.awt.geom.Point2D.Double getPositionInFieldPortrayal(java.lang.Object object, DrawInfo2D info)
FieldPortrayal2D
getPositionInFieldPortrayal
in class FieldPortrayal2D
protected void hitOrDraw(java.awt.Graphics2D graphics, DrawInfo2D info, Bag putInHere)
FieldPortrayal2D
hitOrDraw
in class FieldPortrayal2D
public LocationWrapper getWrapper(java.lang.Object object, Int2D location)
public boolean setSelected(LocationWrapper wrapper, boolean selected)
FieldPortrayal
setSelected
in interface Portrayal
setSelected
in class FieldPortrayal
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |