public class EdgeGraph
extends java.lang.Object
HalfEdge
s.
It supports tracking the vertices in the graph
via edges incident on them,
to allow efficient lookup of edges and vertices.
This class may be subclassed to use a
different subclass of HalfEdge,
by overriding createEdge(Coordinate)
.
If additional logic is required to initialize
edges then addEdge(Coordinate, Coordinate)
can be overridden as well.
Modifier and Type | Field and Description |
---|---|
private java.util.Map |
vertexMap |
Constructor and Description |
---|
EdgeGraph() |
Modifier and Type | Method and Description |
---|---|
HalfEdge |
addEdge(Coordinate orig,
Coordinate dest)
Adds an edge between the coordinates orig and dest
to this graph.
|
private HalfEdge |
create(Coordinate p0,
Coordinate p1) |
protected HalfEdge |
createEdge(Coordinate orig)
Creates a single HalfEdge.
|
HalfEdge |
findEdge(Coordinate orig,
Coordinate dest)
Finds an edge in this graph with the given origin
and destination, if one exists.
|
java.util.Collection |
getVertexEdges() |
private HalfEdge |
insert(Coordinate orig,
Coordinate dest,
HalfEdge eAdj)
Inserts an edge not already present into the graph.
|
static boolean |
isValidEdge(Coordinate orig,
Coordinate dest)
Tests if the given coordinates form a valid edge (with non-zero length).
|
protected HalfEdge createEdge(Coordinate orig)
orig
- the origin locationprivate HalfEdge create(Coordinate p0, Coordinate p1)
public HalfEdge addEdge(Coordinate orig, Coordinate dest)
orig
- the edge origin locationdest
- the edge destination location.isValidEdge(Coordinate, Coordinate)
public static boolean isValidEdge(Coordinate orig, Coordinate dest)
orig
- the start coordinatedest
- the end coordinateprivate HalfEdge insert(Coordinate orig, Coordinate dest, HalfEdge eAdj)
orig
- the edge origin locationdest
- the edge destination locationeAdj
- an existing edge with same orig (if any)public java.util.Collection getVertexEdges()
public HalfEdge findEdge(Coordinate orig, Coordinate dest)
orig
- the origin locationdest
- the destination location.