sim.portrayal.simple
Class TransformedPortrayal2D

java.lang.Object
  extended bysim.portrayal.SimplePortrayal2D
      extended bysim.portrayal.simple.TransformedPortrayal2D
All Implemented Interfaces:
Portrayal, Portrayal2D, java.io.Serializable

public class TransformedPortrayal2D
extends SimplePortrayal2D

A wrapper for other Portrayal2Ds which transforms the graphics space before drawing them.

See Also:
Serialized Form

Field Summary
 SimplePortrayal2D child
           
 java.awt.geom.AffineTransform transform
           
 
Constructor Summary
TransformedPortrayal2D(SimplePortrayal2D child, java.awt.geom.AffineTransform transform)
           
 
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.
 SimplePortrayal2D getChild(java.lang.Object object)
           
 Inspector getInspector(LocationWrapper wrapper, GUIState state)
          Provide an inspector for an object.
 java.lang.String getName(LocationWrapper wrapper)
          Returns a static, one-line name for the given object that is useful for a human to distinguish it from other objects.
 boolean hitObject(java.lang.Object object, DrawInfo2D range)
          If drawing area intersects selected area, return true.
 boolean setSelected(LocationWrapper wrapper, boolean selected)
          Change the portrayal state to reflect the fact that you've been selected or not selected.
 
Methods inherited from class sim.portrayal.SimplePortrayal2D
getStatus, move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

child

public SimplePortrayal2D child

transform

public java.awt.geom.AffineTransform transform
Constructor Detail

TransformedPortrayal2D

public TransformedPortrayal2D(SimplePortrayal2D child,
                              java.awt.geom.AffineTransform transform)
Method Detail

getChild

public SimplePortrayal2D getChild(java.lang.Object object)

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. It is possible that object is null.

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

hitObject

public boolean hitObject(java.lang.Object object,
                         DrawInfo2D range)
Description copied from class: SimplePortrayal2D
If drawing area intersects selected area, return true. The default computes the intersection with the (-0.5,-0.5) to (0.5,0.5) rectangle.

Overrides:
hitObject in class SimplePortrayal2D

setSelected

public boolean setSelected(LocationWrapper wrapper,
                           boolean selected)
Description copied from interface: Portrayal
Change the portrayal state to reflect the fact that you've been selected or not selected. Always return true, except if you've received a setSelected(true) and in fact do not wish to be selectable, in which case return false in that sole situation.

Specified by:
setSelected in interface Portrayal
Overrides:
setSelected in class SimplePortrayal2D

getInspector

public Inspector getInspector(LocationWrapper wrapper,
                              GUIState state)
Description copied from interface: Portrayal
Provide an inspector for an object.

Specified by:
getInspector in interface Portrayal
Overrides:
getInspector in class SimplePortrayal2D

getName

public java.lang.String getName(LocationWrapper wrapper)
Description copied from interface: Portrayal
Returns a static, one-line name for the given object that is useful for a human to distinguish it from other objects. A simple default would be just to return "" + object.

Specified by:
getName in interface Portrayal
Overrides:
getName in class SimplePortrayal2D