|
|||||||||
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.SparseGridPortrayal2D
public class SparseGridPortrayal2D
Can be used to draw both continuous and discrete sparse fields. The 'location' passed into the DrawInfo2D handed to the SimplePortryal2D is an Int2D.
Field Summary | |
---|---|
DrawPolicy |
policy
|
Fields inherited from class sim.portrayal.FieldPortrayal2D |
---|
DEFAULT, DONT_USE_BUFFER, USE_BUFFER |
Fields inherited from class sim.portrayal.FieldPortrayal |
---|
classPortrayals, field, immutableField, portrayalForAll, portrayalForNonNull, portrayalForNull, portrayalForRemainder, portrayals |
Constructor Summary | |
---|---|
SparseGridPortrayal2D()
|
|
SparseGridPortrayal2D(DrawPolicy policy)
Deprecated. Use setDrawPolicy. |
Method Summary | |
---|---|
Portrayal |
getDefaultPortrayal()
Should return a portrayal which can portray any object regardless of whether it's valid or not |
DrawPolicy |
getDrawPolicy()
|
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,
GUIState gui)
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)
|
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 |
setDrawPolicy(DrawPolicy policy)
|
void |
setField(java.lang.Object field)
Sets the field, and sets the dirtyField flag to true. |
void |
setObjectPosition(java.lang.Object object,
java.awt.geom.Point2D.Double position,
DrawInfo2D fieldPortrayalInfo)
Moves (or tries to move) the object to an internal location equivalent to the given position on-screen of the provided object, assuming that the object exists within the underlying field and that this location is acceptable. |
boolean |
setSelected(LocationWrapper wrapper,
boolean selected)
Selects or deselects all of the provided objects. |
Methods inherited from class sim.portrayal.FieldPortrayal2D |
---|
draw, getBuffering, getClipLocation, getObjectPosition, getRelativeObjectPosition, hitObjects, 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 |
Field Detail |
---|
public DrawPolicy policy
Constructor Detail |
---|
public SparseGridPortrayal2D()
public SparseGridPortrayal2D(DrawPolicy policy)
Method Detail |
---|
public void setDrawPolicy(DrawPolicy policy)
public DrawPolicy getDrawPolicy()
public Portrayal getDefaultPortrayal()
FieldPortrayal
getDefaultPortrayal
in class FieldPortrayal2D
public void setField(java.lang.Object field)
FieldPortrayal
setField
in class FieldPortrayal
public Double2D getScale(DrawInfo2D info)
FieldPortrayal2D
getScale
in class FieldPortrayal2D
public java.lang.Object getPositionLocation(java.awt.geom.Point2D.Double position, DrawInfo2D info)
FieldPortrayal2D
getPositionLocation
in class FieldPortrayal2D
public void setObjectPosition(java.lang.Object object, java.awt.geom.Point2D.Double position, DrawInfo2D fieldPortrayalInfo)
FieldPortrayal2D
setObjectPosition
in class FieldPortrayal2D
public java.lang.Object getObjectLocation(java.lang.Object object, GUIState gui)
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)
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 |