sim.portrayal.network
Class SimpleEdgePortrayal2D

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

public class SimpleEdgePortrayal2D
extends SimplePortrayal2D

See Also:
Serialized Form

Field Summary
 java.awt.Paint fromPaint
           
 java.awt.Font labelFont
           
 java.awt.Paint labelPaint
           
 java.awt.Paint toPaint
           
 
Constructor Summary
SimpleEdgePortrayal2D()
          Draws a single-color, undirected black line with no label.
SimpleEdgePortrayal2D(java.awt.Paint fromPaint, java.awt.Paint toPaint, java.awt.Paint labelPaint)
          If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.
SimpleEdgePortrayal2D(java.awt.Paint fromPaint, java.awt.Paint toPaint, java.awt.Paint labelPaint, java.awt.Font labelFont)
          If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.
 
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.
 java.lang.String getName(LocationWrapper wrapper)
          Returns a 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.
 
Methods inherited from class sim.portrayal.SimplePortrayal2D
getInspector, move, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fromPaint

public java.awt.Paint fromPaint

toPaint

public java.awt.Paint toPaint

labelPaint

public java.awt.Paint labelPaint

labelFont

public java.awt.Font labelFont
Constructor Detail

SimpleEdgePortrayal2D

public SimpleEdgePortrayal2D()
Draws a single-color, undirected black line with no label.


SimpleEdgePortrayal2D

public SimpleEdgePortrayal2D(java.awt.Paint fromPaint,
                             java.awt.Paint toPaint,
                             java.awt.Paint labelPaint)
If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.


SimpleEdgePortrayal2D

public SimpleEdgePortrayal2D(java.awt.Paint fromPaint,
                             java.awt.Paint toPaint,
                             java.awt.Paint labelPaint,
                             java.awt.Font labelFont)
If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.

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)
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

getName

public java.lang.String getName(LocationWrapper wrapper)
Description copied from interface: Portrayal
Returns a 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