|
|||||||||
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.continuous.ContinuousPortrayal2D
public class ContinuousPortrayal2D
Portrays Continuous2D fields. When asked to portray objects, this field computes the buckets covered by the requested region, then includes an additional boundary of two buckets in each direction just in case objects leak over the boundary region. The 'location' passed into the DrawInfo2D handed to the SimplePortryal2D is a Double2D.
Nested Class Summary |
---|
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 | |
---|---|
ContinuousPortrayal2D()
|
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 |
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 fieldPortrayalInfo)
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 fieldPortrayalInfo)
Returns the Location, in the parlance of the underlying Field, of the given position. |
java.awt.geom.Point2D.Double |
getRelativeObjectPosition(java.lang.Object location,
java.lang.Object otherObjectLocation,
DrawInfo2D otherObjectInfo)
Returns the position on-screen of an object at a given location in the field, using another object's location and DrawInfo2D to perform the computation. |
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 obj)
|
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. |
boolean |
isDisplayingToroidally()
Returns TRUE if the portrayal is displaying objects multiply (in a toroidal fashion) if they overlap on the edges of the field. |
void |
setDisplayingToroidally(boolean val)
Set this to TRUE to cause the portrayal to display objects multiply (in a toroidal fashion) if they overlap on the edges of the field. |
void |
setField(java.lang.Object field)
Sets the field. |
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, getObjectPosition, 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 |
Constructor Detail |
---|
public ContinuousPortrayal2D()
Method Detail |
---|
public void setField(java.lang.Object field)
FieldPortrayal
setField
in class FieldPortrayal2D
public Portrayal getDefaultPortrayal()
FieldPortrayal
getDefaultPortrayal
in class FieldPortrayal2D
public java.awt.geom.Point2D.Double getRelativeObjectPosition(java.lang.Object location, java.lang.Object otherObjectLocation, DrawInfo2D otherObjectInfo)
FieldPortrayal2D
getRelativeObjectPosition
in class FieldPortrayal2D
public java.lang.Object getClipLocation(DrawInfo2D fieldPortrayalInfo)
FieldPortrayal2D
getClipLocation
in class FieldPortrayal2D
public Double2D getScale(DrawInfo2D info)
FieldPortrayal2D
getScale
in class FieldPortrayal2D
public java.lang.Object getPositionLocation(java.awt.geom.Point2D.Double position, DrawInfo2D fieldPortrayalInfo)
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)
FieldPortrayal2D
getObjectLocation
in class FieldPortrayal2D
public java.awt.geom.Point2D.Double getLocationPosition(java.lang.Object location, DrawInfo2D fieldPortrayalInfo)
FieldPortrayal2D
getLocationPosition
in class FieldPortrayal2D
public void setDisplayingToroidally(boolean val)
public boolean isDisplayingToroidally()
protected void hitOrDraw(java.awt.Graphics2D graphics, DrawInfo2D info, Bag putInHere)
FieldPortrayal2D
hitOrDraw
in class FieldPortrayal2D
public LocationWrapper getWrapper(java.lang.Object obj)
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 |