samples.preview_new_graphdraw
Class VisEdge

java.lang.Object
  extended by samples.preview_new_graphdraw.VisEdge
Direct Known Subclasses:
CircleEdge, SpringLayout.SpringEdge

public class VisEdge
extends Object

This implements an edge between two points. Any subclasses--whether for straight edges or curved--must implement (at least) getBack(), getFront(), getSquareDistance(), and getEdge().

Author:
Scott and Danyel

Field Summary
protected  VisVertex mBack
           
protected  Edge mEdge
           
protected  VisVertex mFront
           
 
Constructor Summary
VisEdge(Edge e, VisVertex v1, VisVertex v2)
           
 
Method Summary
 VisEdge copy(VisVertex front, VisVertex back)
          Creates a new VisEdge from the specified VisVertex instances and this instance's Edge.
 Coordinates getBack()
          Returns the location of the first endpoint of the Edge which this VisEdge represents.
 Edge getEdge()
          Returns the Edge which this VisEdge represents.
 Coordinates getFront()
          Returns the location of the second endpoint of the Edge which this VisEdge represents.
 double getSquareDistance(double x, double y)
          Returns the squared distance from this edge to the point (x,y).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mEdge

protected Edge mEdge

mFront

protected VisVertex mFront

mBack

protected VisVertex mBack
Constructor Detail

VisEdge

public VisEdge(Edge e,
               VisVertex v1,
               VisVertex v2)
Method Detail

getSquareDistance

public double getSquareDistance(double x,
                                double y)
Returns the squared distance from this edge to the point (x,y). The default implementation takes care of a distance from a straight edge to a point; more complex edges should have corresponding functions.


getEdge

public Edge getEdge()
Returns the Edge which this VisEdge represents.


getFront

public Coordinates getFront()
Returns the location of the second endpoint of the Edge which this VisEdge represents.


getBack

public Coordinates getBack()
Returns the location of the first endpoint of the Edge which this VisEdge represents.


copy

public VisEdge copy(VisVertex front,
                    VisVertex back)
Creates a new VisEdge from the specified VisVertex instances and this instance's Edge.