|
|||||||||
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. The 'location' passed into the DrawInfo2D handed to the SimplePortryal2D is a MutableInt2D.
Nested Class Summary | |
---|---|
static class |
ObjectGridPortrayal2D.Message
|
Nested classes/interfaces inherited from class sim.portrayal.FieldPortrayal |
---|
FieldPortrayal.CustomInspector |
Field Summary | |
---|---|
protected MutableInt2D |
locationToPass
|
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 | |
---|---|
java.lang.Object |
getClipLocation(DrawInfo2D fieldPortrayalInfo)
Returns an object representing the location in the field of the origin of the clip of the DrawInfo2D. |
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 |
getLocationPosition(java.lang.Object location,
DrawInfo2D info)
Returns the position on-screen of the provided location in the underlying field. |
java.lang.Object |
getObjectLocation(java.lang.Object object)
Returns the first location in the underlying field of the given object, if such a thing is reasonable. |
java.lang.Object |
getPositionLocation(java.awt.geom.Point2D.Double position,
DrawInfo2D info)
Returns the Location, in the parlance of the underlying Field, of the given position. |
Double2D |
getScale(DrawInfo2D info)
Returns the width and height, in pixels, of 1.0 x 1.0 units in the underlying field. |
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, getObjectPosition, getRelativeObjectPosition, hitObjects, setBuffering, setObjectPosition |
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 |
Field Detail |
---|
protected final MutableInt2D locationToPass
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 Double2D getScale(DrawInfo2D info)
FieldPortrayal2D
getScale
in class FieldPortrayal2D
public java.lang.Object getClipLocation(DrawInfo2D fieldPortrayalInfo)
FieldPortrayal2D
getClipLocation
in class FieldPortrayal2D
public java.lang.Object getPositionLocation(java.awt.geom.Point2D.Double position, DrawInfo2D info)
FieldPortrayal2D
getPositionLocation
in class FieldPortrayal2D
public java.lang.Object getObjectLocation(java.lang.Object object)
FieldPortrayal2D
getObjectLocation
in class FieldPortrayal2D
public java.awt.geom.Point2D.Double getLocationPosition(java.lang.Object location, DrawInfo2D info)
FieldPortrayal2D
getLocationPosition
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 |