com.vividsolutions.jcs.graph
Class DirectedEdge
java.lang.Object
com.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
|
Constructor Summary |
DirectedEdge(Node from,
Node to,
com.vividsolutions.jts.geom.Coordinate directionPt,
boolean edgeDirection)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
DirectedEdge
public DirectedEdge(Node from,
Node to,
com.vividsolutions.jts.geom.Coordinate directionPt,
boolean edgeDirection)
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)