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.simple
Class RectanglePortrayal2D

    java.lang.Object
      sim.portrayal.SimplePortrayal2D
          sim.portrayal.simple.RectanglePortrayal2D

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

Direct Known Subclasses:
  ImagePortrayal2D, ValuePortrayal2D

public class RectanglePortrayal2D
extends SimplePortrayal2D

A simple portrayal for 2D visualization of rectangles. It extends the SimplePortrayal2D and it manages the drawing and hit-testing for rectangular shapes.

See Also:
  Serialized Form

Field Summary
`java.awt.Paint` | `paint`
`double` | `scale`

Constructor Summary
`RectanglePortrayal2D()`
`RectanglePortrayal2D(double scale)`
`RectanglePortrayal2D(java.awt.Paint paint)`
`RectanglePortrayal2D(java.awt.Paint paint, double scale)`

Method Summary
`void` | `draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)` Draw a portrayed object centered at the origin in info, and with the given scaling factors.
`boolean` | `hitObject(java.lang.Object object, DrawInfo2D range)` If drawing area intersects selected area, add last portrayed object to the bag

Methods inherited from class sim.portrayal.SimplePortrayal2D
`getInspector, getName, move, setSelected`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### paint

    public java.awt.Paint paint

### scale

    public double scale

Constructor Detail

### RectanglePortrayal2D

    public RectanglePortrayal2D()

### RectanglePortrayal2D

    public RectanglePortrayal2D(java.awt.Paint paint)

### RectanglePortrayal2D

    public RectanglePortrayal2D(double scale)

### RectanglePortrayal2D

    public RectanglePortrayal2D(java.awt.Paint paint,
                                double scale)

Method Detail

### hitObject

    public boolean hitObject(java.lang.Object object,
                             DrawInfo2D range)

  If drawing area intersects selected area, add last portrayed object to the bag

  Overrides:
    `hitObject` in class `SimplePortrayal2D`

### draw

    public void draw(java.lang.Object object,
                     java.awt.Graphics2D graphics,
                     DrawInfo2D info)

  Description copied from interface: `Portrayal2D`
  Draw a portrayed object centered at the origin in info, and with the given scaling factors. draw(...) will not be called until portray(obj) has been called on a Portrayal2D at least once. But you should have some default null drawing capability just in case.

  Specified by:
    `draw` in interface `Portrayal2D`
  Overrides:
    `draw` in class `SimplePortrayal2D`

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