com.vividsolutions.jcs.graph
Class DirectedEdge

java.lang.Object
  extended bycom.vividsolutions.jcs.graph.DirectedEdge
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
PolyDirectedEdge, RoadDirectedEdge

public class DirectedEdge
extends java.lang.Object
implements java.lang.Comparable


Field Summary
protected  double angle
           
protected static com.vividsolutions.jts.algorithm.RobustCGAlgorithms cga
           
protected  boolean edgeDirection
           
protected  Node from
           
protected  com.vividsolutions.jts.geom.Coordinate p0
           
protected  com.vividsolutions.jts.geom.Coordinate p1
           
protected  Edge parentEdge
           
protected  int quadrant
           
protected  DirectedEdge sym
           
protected  Node to
           
 
Constructor Summary
DirectedEdge(Node from, Node to, com.vividsolutions.jts.geom.Coordinate directionPt, boolean edgeDirection)
           
 
Method Summary
 int compareDirection(DirectedEdge e)
          Implements the total order relation:
 int compareTo(java.lang.Object obj)
           
 double getAngle()
          Returns the starting angle of this DirectedEdge.
 Edge getEdge()
           
 boolean getEdgeDirection()
           
 Node getFromNode()
           
 DirectedEdge getSym()
           
 Node getToNode()
           
 void print(java.io.PrintStream out)
           
 void setEdge(Edge parentEdge)
           
 void setSym(DirectedEdge sym)
           
static java.util.List toEdges(java.util.Collection dirEdges)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cga

protected static final com.vividsolutions.jts.algorithm.RobustCGAlgorithms cga

parentEdge

protected Edge parentEdge

from

protected Node from

to

protected Node to

p0

protected com.vividsolutions.jts.geom.Coordinate p0

p1

protected com.vividsolutions.jts.geom.Coordinate p1

sym

protected DirectedEdge sym

edgeDirection

protected boolean edgeDirection

quadrant

protected int quadrant

angle

protected double angle
Constructor Detail

DirectedEdge

public DirectedEdge(Node from,
                    Node to,
                    com.vividsolutions.jts.geom.Coordinate directionPt,
                    boolean edgeDirection)
Method Detail

toEdges

public static java.util.List toEdges(java.util.Collection dirEdges)

getEdge

public Edge getEdge()

setEdge

public void setEdge(Edge parentEdge)

getEdgeDirection

public boolean getEdgeDirection()

getFromNode

public Node getFromNode()

getToNode

public Node getToNode()

getAngle

public double getAngle()
Returns the starting angle of this DirectedEdge.


getSym

public DirectedEdge getSym()

setSym

public void setSym(DirectedEdge sym)

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable

compareDirection

public int compareDirection(DirectedEdge e)
Implements the total order relation:

a has a greater angle with the positive x-axis than b

Using the obvious algorithm of simply computing the angle is not robust, since the angle calculation is obviously susceptible to roundoff. A robust algorithm is: - first compare the quadrant. If the quadrants are different, it it trivial to determine which vector is "greater". - if the vectors lie in the same quadrant, the computeOrientation function can be used to decide the relative orientation of the vectors.


print

public void print(java.io.PrintStream out)