Class TransformedPortrayal2D

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

public class TransformedPortrayal2D extends SimplePortrayal2D
A wrapper for other Portrayal2Ds which transforms the graphics space before drawing them.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getChild

      public SimplePortrayal2D getChild(Object object)
    • draw

      public void draw(Object object, Graphics2D graphics, DrawInfo2D info)
      Description copied from interface: Portrayal2D
      Draw a the given object with an origin at (info.draw.x, info.draw.y), and with the coordinate system scaled by so that 1 unit is in the x and y directions are equal to info.draw.width and info.draw.height respectively in pixels. The rectangle given by info.clip specifies the only region in which it is necessary to draw. If info.precise is true, try to draw using real-valued high-resolution drawing rather than faster integer drawing. It is possible that object is null. The location of the object in the field may (and may not) be stored in info.location. The form of that location varies depending on the kind of field used.
      Specified by:
      draw in interface Portrayal2D
      Overrides:
      draw in class SimplePortrayal2D
    • hitObject

      public boolean hitObject(Object object, DrawInfo2D range)
      Description copied from class: SimplePortrayal2D
      Return true if the given object, when drawn, intersects with a provided rectangle, for hit testing purposes. The object is drawn with an origin at (info.draw.x, info.draw.y), and with the coordinate system scaled by so that 1 unit is in the x and y directions are equal to info.draw.width and info.draw.height respectively in pixels. The rectangle given by info.clip specifies the region to do hit testing in; often this region is actually of 0 width or height, which might represent a single point. It is possible that object is null. The location of the object in the field may (and may not) be stored in info.location. The form of that location varies depending on the kind of field used.
      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 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