001package horstmann.ch08_graphed;
002import java.awt.Graphics2D;
003import java.awt.geom.Point2D;
004
005/**
006   An edge that is shaped like a straight line.
007 */
008@SuppressWarnings("serial")
009public class LineEdge extends AbstractEdge
010{
011        public void draw(Graphics2D g2)
012        {
013                g2.draw(getConnectionPoints());
014        }
015
016        public boolean contains(Point2D aPoint)
017        {
018                final double MAX_DIST = 2;
019                return getConnectionPoints().ptSegDist(aPoint)
020                                < MAX_DIST;
021        }
022}