sim.portrayal.geo
Class GeomPortrayal

java.lang.Object
  extended by sim.portrayal.SimplePortrayal2D
      extended by sim.portrayal.geo.GeomPortrayal
All Implemented Interfaces:
java.io.Serializable, sim.portrayal.Portrayal, sim.portrayal.Portrayal2D

public class GeomPortrayal
extends sim.portrayal.SimplePortrayal2D

The portrayal for MasonGeometry objects. The class draws the JTS geometry object (currently, we can draw Point, LineString, Polygon, MultiLineString and MultiPolygon objects), and sets up the inspectors for the MasonGeometry object. The inspector is TabbedInspector with at most three tabs: the first tab shows various information about the JTS geometry, the second tab shows the associated attribute information, and the third tab shows information about the MasonGeometry userData field, which can be any Java object.

See Also:
Serialized Form

Field Summary
 boolean filled
          Should objects be filled when painting?
 java.awt.Paint paint
          How to paint each object
 double scale
          Scale for each object
 
Fields inherited from class sim.portrayal.SimplePortrayal2D
TYPE_HIT_OBJECT, TYPE_SELECTED_OBJECT
 
Constructor Summary
GeomPortrayal()
          Default constructor creates filled, gray objects with a scale of 1.0
GeomPortrayal(boolean filled)
           
GeomPortrayal(double scale)
           
GeomPortrayal(double scale, boolean filled)
           
GeomPortrayal(java.awt.Paint paint)
           
GeomPortrayal(java.awt.Paint paint, boolean filled)
           
GeomPortrayal(java.awt.Paint paint, double scale)
           
GeomPortrayal(java.awt.Paint paint, double scale, boolean filled)
           
 
Method Summary
 void draw(java.lang.Object object, java.awt.Graphics2D graphics, sim.portrayal.DrawInfo2D info)
          Draw a JTS geometry object.
 sim.portrayal.Inspector getInspector(sim.portrayal.LocationWrapper wrapper, sim.display.GUIState state)
          Use our custom Inspector.
 boolean hitObject(java.lang.Object object, sim.portrayal.DrawInfo2D range)
          Determine if the object was hit or not.
 
Methods inherited from class sim.portrayal.SimplePortrayal2D
getName, getStatus, handleMouseEvent, 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
How to paint each object


scale

public double scale
Scale for each object


filled

public boolean filled
Should objects be filled when painting?

Constructor Detail

GeomPortrayal

public GeomPortrayal()
Default constructor creates filled, gray objects with a scale of 1.0


GeomPortrayal

public GeomPortrayal(java.awt.Paint paint)

GeomPortrayal

public GeomPortrayal(double scale)

GeomPortrayal

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

GeomPortrayal

public GeomPortrayal(java.awt.Paint paint,
                     boolean filled)

GeomPortrayal

public GeomPortrayal(double scale,
                     boolean filled)

GeomPortrayal

public GeomPortrayal(boolean filled)

GeomPortrayal

public GeomPortrayal(java.awt.Paint paint,
                     double scale,
                     boolean filled)
Method Detail

getInspector

public sim.portrayal.Inspector getInspector(sim.portrayal.LocationWrapper wrapper,
                                            sim.display.GUIState state)
Use our custom Inspector. We create a TabbedInspector for each object that allows inspection of the JTS geometry, attribute information, and the MasonGeometry userData field.

Specified by:
getInspector in interface sim.portrayal.Portrayal
Overrides:
getInspector in class sim.portrayal.SimplePortrayal2D

draw

public void draw(java.lang.Object object,
                 java.awt.Graphics2D graphics,
                 sim.portrayal.DrawInfo2D info)
Draw a JTS geometry object. The JTS geometries are converted to Java general path objects, which are then drawn using the native Graphics2D methods.

Specified by:
draw in interface sim.portrayal.Portrayal2D
Overrides:
draw in class sim.portrayal.SimplePortrayal2D

hitObject

public boolean hitObject(java.lang.Object object,
                         sim.portrayal.DrawInfo2D range)
Determine if the object was hit or not.

Overrides:
hitObject in class sim.portrayal.SimplePortrayal2D