sim.portrayal.simple
Class HexagonalPortrayal2D

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

public class HexagonalPortrayal2D
extends SimplePortrayal2D

A simple portrayal for 2D visualization of hexagons. It extends the SimplePortrayal2D and it manages the drawing and hit-testing for hexagonal shapes. If the DrawInfo2D parameter received by draw and hitObject functions is an instance of HexaDrawInfo2D, better information is extracted and used to make everthing look better. Otherwise, hexagons may be created from information stored in simple DrawInfo2D objects, but overlapping or extra empty spaces may be observed (especially when increasing the scale).

See Also:
Serialized Form

Field Summary
 boolean drawFrame
           
protected  java.awt.geom.GeneralPath generalPath
           
 java.awt.Paint paint
           
 
Constructor Summary
HexagonalPortrayal2D()
           
HexagonalPortrayal2D(boolean drawFrame)
           
HexagonalPortrayal2D(java.awt.Paint paint)
           
HexagonalPortrayal2D(java.awt.Paint paint, boolean drawFrame)
           
 
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

drawFrame

public boolean drawFrame

generalPath

protected java.awt.geom.GeneralPath generalPath
Constructor Detail

HexagonalPortrayal2D

public HexagonalPortrayal2D()

HexagonalPortrayal2D

public HexagonalPortrayal2D(java.awt.Paint paint)

HexagonalPortrayal2D

public HexagonalPortrayal2D(boolean drawFrame)

HexagonalPortrayal2D

public HexagonalPortrayal2D(java.awt.Paint paint,
                            boolean drawFrame)
Method Detail

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

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