Package org.locationtech.jts.edgegraph
Class EdgeGraph
java.lang.Object
org.locationtech.jts.edgegraph.EdgeGraph
- Direct Known Subclasses:
DissolveEdgeGraph
A graph comprised of
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEdge
(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.findEdge
(Coordinate orig, Coordinate dest) Finds an edge in this graph with the given origin and destination, if one exists.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).
-
Field Details
-
vertexMap
-
-
Constructor Details
-
EdgeGraph
public EdgeGraph()
-
-
Method Details
-
createEdge
Creates a single HalfEdge. Override to use a different HalfEdge subclass.- Parameters:
orig
- the origin location- Returns:
- a new HalfEdge with the given origin
-
create
-
addEdge
Adds an edge between the coordinates orig and dest to this graph. Only valid edges can be added (in particular, zero-length segments cannot be added)- Parameters:
orig
- the edge origin locationdest
- the edge destination location.- Returns:
- the created edge
- See Also:
-
isValidEdge
Tests if the given coordinates form a valid edge (with non-zero length).- Parameters:
orig
- the start coordinatedest
- the end coordinate- Returns:
- true if the edge formed is valid
-
insert
Inserts an edge not already present into the graph.- Parameters:
orig
- the edge origin locationdest
- the edge destination locationeAdj
- an existing edge with same orig (if any)- Returns:
- the created edge
-
getVertexEdges
-
findEdge
Finds an edge in this graph with the given origin and destination, if one exists.- Parameters:
orig
- the origin locationdest
- the destination location.- Returns:
- an edge with the given orig and dest, or null if none exists
-