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
Class DrawInfo2D

    java.lang.Object
      sim.portrayal.DrawInfo2D

Direct Known Subclasses:
  EdgeDrawInfo2D

    public class DrawInfo2D

extends java.lang.Object

The DrawInfo2D class provides two Rectangles which define a simple drawing situation.

The draw rectangle describes a box which should be considered to define the coordinates and scale for the object being drawn. That is, the object should imagine that it's located at the origin [the box's coordinate], and is being drawn relative to the scale [the box's values]. While continuous objects will probably center themselves on the origin, Discrete 2D objects typically will draw themselves to fill the box (the box effectively defines the [0,0] to [1,1] range). You may assume that the coordinates will never be fipped or zeroed (that is, the width and height will not be negative or 0).

Why is this rectangle being provided instead of just using an affine transform on the grahics object to scale and translate the space? Two reasons. First, affine transforms are expensive in Java2D. Second, if you need to draw auxillary information (like readable text), the text would also get transformed (scaled), which is not what we want. Line thickness is also likewise transformed, which might or might not be desirable.

The clip rectangle describes a box defining a region that must be drawn. This region will always intersect at least partially with the draw rectangle.

Why provide this clip rectangle? Because to my knowledge there's no standard way to tell objects that only part of them needs to be updated in Java2D and Swing -- a failure of the system design.

The precise flag hints to the underlying portrayals that the drawing should be done precisely rather than rapidly: this is primarily for generating PDF images. It may be ignored.

The selected flag indicates to the underlying portrayals that the object in question is in selected mode. This flag is only set by FieldPortrayals.

The location object may store the location of the item in the outer Field. Fields are free to not store anything here if they see fit. Further, this object may not be the actual kind of object used to store the location (for example, it might be a MutableDouble2D, even though the object is associated with a Double2D).

Field Summary
`java.awt.geom.Rectangle2D.Double` | `clip`
`java.awt.geom.Rectangle2D.Double` | `draw`
`java.lang.Object` | `location`
`boolean` | `precise`
`boolean` | `selected`

Constructor Summary
`DrawInfo2D(DrawInfo2D other)`
`DrawInfo2D(DrawInfo2D other, double translateX, double translateY)`
`DrawInfo2D(java.awt.geom.Rectangle2D.Double draw, java.awt.geom.Rectangle2D.Double clip)`
`DrawInfo2D(java.awt.Rectangle draw, java.awt.Rectangle clip)`
`DrawInfo2D(java.awt.geom.RectangularShape draw, java.awt.geom.RectangularShape clip)`

Method Summary
`boolean` | `equals(java.lang.Object obj)`
`java.lang.String` | `toString()`

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

Field Detail

### draw

    public java.awt.geom.Rectangle2D.Double draw

### clip

    public java.awt.geom.Rectangle2D.Double clip

### selected

    public boolean selected

### precise

    public boolean precise

### location

    public java.lang.Object location

Constructor Detail

### DrawInfo2D

    public DrawInfo2D(java.awt.geom.Rectangle2D.Double draw,
                      java.awt.geom.Rectangle2D.Double clip)

### DrawInfo2D

    public DrawInfo2D(java.awt.Rectangle draw,
                      java.awt.Rectangle clip)

### DrawInfo2D

    public DrawInfo2D(java.awt.geom.RectangularShape draw,
                      java.awt.geom.RectangularShape clip)

### DrawInfo2D

    public DrawInfo2D(DrawInfo2D other,
                      double translateX,
                      double translateY)

### DrawInfo2D

    public DrawInfo2D(DrawInfo2D other)

Method Detail

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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