Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.portrayal.continuous
Class ContinuousPortrayal2D

    java.lang.Object
      sim.portrayal.FieldPortrayal
          sim.portrayal.FieldPortrayal2D
              sim.portrayal.continuous.ContinuousPortrayal2D

All Implemented Interfaces:
  java.io.Serializable, Portrayal, Portrayal2D

    public class ContinuousPortrayal2D

extends FieldPortrayal2D

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.

See Also:
  Serialized Form

Field Summary

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
`ContinuousPortrayal2D()`

Method Summary
`java.awt.Paint` | `getAxes()`
`Portrayal` | `getDefaultPortrayal()` Should return a portrayal which can portray any object regardless of whether it's valid or not
`boolean` | `getDrawsFrameAndAxesInFront()`
`java.awt.Paint` | `getFame()`
`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, 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 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` | `setAxes(java.awt.Paint p)` If you provide a Paint, a thin frame of this paint will be drawn around the (0,0,width,height) space 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` | `setDrawsFrameAndAxesInFront(boolean val)`
`void` | `setField(java.lang.Object field)` Sets the field, and sets the dirtyField flag to true.
`void` | `setFrame(java.awt.Paint p)` If you provide a Paint, a thin frame of this paint will be drawn around the (0,0,width,height) space of 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, getClipLocation, getObjectPosition, hitObjects, setBuffering`

Methods inherited from class sim.portrayal.FieldPortrayal
`getDefaultNullPortrayal, getField, getInspector, getName, getPortrayalForAll, getPortrayalForNonNull, getPortrayalForNull, getPortrayalForObject, getPortrayalForRemainder, getStatus, isDirtyField, isImmutableField, reset, setDirtyField, setImmutableField, setPortrayalForAll, setPortrayalForClass, setPortrayalForNonNull, setPortrayalForNull, setPortrayalForObject, setPortrayalForRemainder, setSelected`

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

### ContinuousPortrayal2D

    public ContinuousPortrayal2D()

Method Detail

### setFrame

    public void setFrame(java.awt.Paint p)

  If you provide a Paint, a thin frame of this paint will be drawn around the (0,0,width,height) space of the field. This is mostly useful for seeing the frame of the field when clipping is turned off and you're zoomed out.

### getFame

    public java.awt.Paint getFame()

### setAxes

    public void setAxes(java.awt.Paint p)

  If you provide a Paint, a thin frame of this paint will be drawn around the (0,0,width,height) space of the field. This is mostly useful for seeing the frame of the field when clipping is turned off and you're zoomed out.

### getAxes

    public java.awt.Paint getAxes()

### getDrawsFrameAndAxesInFront

    public boolean getDrawsFrameAndAxesInFront()

### setDrawsFrameAndAxesInFront

    public void setDrawsFrameAndAxesInFront(boolean val)

### setField

    public void setField(java.lang.Object field)

  Description copied from class: `FieldPortrayal`
  Sets the field, and sets the dirtyField flag to true. May throw an exception if the field is inappropriate. The default version just sets the field and sets the dirtyField flag.

  Overrides:
    `setField` in class `FieldPortrayal`

### getDefaultPortrayal

    public Portrayal getDefaultPortrayal()

  Description copied from class: `FieldPortrayal`
  Should return a portrayal which can portray any object regardless of whether it's valid or not

  Overrides:
    `getDefaultPortrayal` in class `FieldPortrayal2D`

### getRelativeObjectPosition

    public java.awt.geom.Point2D.Double getRelativeObjectPosition(java.lang.Object location,
                                                                  java.lang.Object otherObjectLocation,
                                                                  DrawInfo2D otherObjectInfo)

  Description copied from class: `FieldPortrayal2D`
  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. Returns null if we can't compute it -- this happens by default if the two locations are neither Int2D nor Double2D. This method is largely used by TrailPortrayal2D.

  Overrides:
    `getRelativeObjectPosition` in class `FieldPortrayal2D`

### getScale

    public Double2D getScale(DrawInfo2D info)

  Description copied from class: `FieldPortrayal2D`
  Returns the width and height, in pixels, of 1.0 x 1.0 units in the underlying field. Optionally overridable. The default version thows an error if called.

  Overrides:
    `getScale` in class `FieldPortrayal2D`

### getPositionLocation

    public java.lang.Object getPositionLocation(java.awt.geom.Point2D.Double position,
                                                DrawInfo2D fieldPortrayalInfo)

  Description copied from class: `FieldPortrayal2D`
  Returns the Location, in the parlance of the underlying Field, of the given position. If there is no such Location, then null is returned. Optionally overridable. By default null is returned.

  Overrides:
    `getPositionLocation` in class `FieldPortrayal2D`

### setObjectPosition

    public void setObjectPosition(java.lang.Object object,
                                  java.awt.geom.Point2D.Double position,
                                  DrawInfo2D fieldPortrayalInfo)

  Description copied from class: `FieldPortrayal2D`
  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. Optionally overridable. The default implementation does nothing.

  Overrides:
    `setObjectPosition` in class `FieldPortrayal2D`

### getObjectLocation

    public java.lang.Object getObjectLocation(java.lang.Object object,
                                              GUIState gui)

  Description copied from class: `FieldPortrayal2D`
  Returns the first location in the underlying field of the given object, if such a thing is reasonable. Largely used for getObjectPosition(...). If null is returned, then the portrayal is unable to determine the position of the field location. Optionally overridable. The default implementation returns null.

  Overrides:
    `getObjectLocation` in class `FieldPortrayal2D`

### getLocationPosition

    public java.awt.geom.Point2D.Double getLocationPosition(java.lang.Object location,
                                                            DrawInfo2D fieldPortrayalInfo)

  Description copied from class: `FieldPortrayal2D`
  Returns the position on-screen of the provided location in the underlying field. Negative positions are acceptable. If null is returned, then the portrayal is unable to perform the requested action on the given location. Optionally overridable. The default implementation returns null.

  Overrides:
    `getLocationPosition` in class `FieldPortrayal2D`

### setDisplayingToroidally

    public 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. Note that this incurs a slight constant overhead. By default this setting is FALSE.

### isDisplayingToroidally

    public boolean isDisplayingToroidally()

  Returns TRUE if the portrayal is displaying objects multiply (in a toroidal fashion) if they overlap on the edges of the field.

### hitOrDraw

    protected void hitOrDraw(java.awt.Graphics2D graphics,
                             DrawInfo2D info,
                             Bag putInHere)

  Description copied from class: `FieldPortrayal2D`
  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. You should test which operation to do based on whether or not graphics is null (if it is, you're hitting, else you're drawing).

  Overrides:
    `hitOrDraw` in class `FieldPortrayal2D`

### getWrapper

    public LocationWrapper getWrapper(java.lang.Object obj)

### setSelected

    public boolean setSelected(LocationWrapper wrapper,
                               boolean selected)

  Description copied from class: `FieldPortrayal`
  Selects or deselects all of the provided objects.

  Specified by:
    `setSelected` in interface `Portrayal`
  Overrides:
    `setSelected` in class `FieldPortrayal`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD