|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.horstmann.violet.framework.ShapeEdge
public abstract class ShapeEdge
A class that assumes that an edge can yield its shape and then takes advantage of the fact that containment testing can be done by stroking the shape with a fat stroke. NOTE: Ideally, you should be able to draw the same shape that is used for containment testing. However, in JDK 1.4, BasicStroke.createStrokedShape returns shitty-looking shapes.
Constructor Summary | |
---|---|
ShapeEdge()
|
Method Summary | |
---|---|
java.lang.Object |
clone()
|
void |
connect(Node s,
Node e)
Connect this edge to two nodes. |
boolean |
contains(java.awt.geom.Point2D aPoint)
Tests whether the edge contains a point. |
java.awt.geom.Rectangle2D |
getBounds(java.awt.Graphics2D g2)
Gets the smallest rectangle that bounds this edge. |
java.awt.geom.Line2D |
getConnectionPoints()
Gets the points at which this edge is connected to its nodes. |
Node |
getEnd()
Gets the ending node. |
abstract java.awt.Shape |
getShape()
Returns the path that should be stroked to draw this edge. |
Node |
getStart()
Gets the starting node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.horstmann.violet.framework.Edge |
---|
draw |
Constructor Detail |
---|
public ShapeEdge()
Method Detail |
---|
public abstract java.awt.Shape getShape()
public java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
Edge
getBounds
in interface Edge
public boolean contains(java.awt.geom.Point2D aPoint)
Edge
aPoint
- the point to test
public java.lang.Object clone()
clone
in interface Edge
clone
in class java.lang.Object
public void connect(Node s, Node e)
Edge
connect
in interface Edge
s
- the starting nodee
- the ending nodepublic Node getStart()
Edge
getStart
in interface Edge
public Node getEnd()
Edge
getEnd
in interface Edge
public java.awt.geom.Line2D getConnectionPoints()
Edge
getConnectionPoints
in interface Edge
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |