Package org.locationtech.jts.geomgraph
Class PlanarGraph
- java.lang.Object
-
- org.locationtech.jts.geomgraph.PlanarGraph
-
- Direct Known Subclasses:
GeometryGraph
public class PlanarGraph extends java.lang.Object
The computation of theIntersectionMatrix
relies on the use of a structure called a "topology graph". The topology graph contains nodes and edges corresponding to the nodes and line segments of aGeometry
. Each node and edge in the graph is labeled with its topological location relative to the source geometry.Note that there is no requirement that points of self-intersection be a vertex. Thus to obtain a correct topology graph,
Geometry
s must be self-noded before constructing their graphs.Two fundamental operations are supported by topology graphs:
- Computing the intersections between all the edges and nodes of a single graph
- Computing the intersections between the edges and nodes of two different graphs
- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description PlanarGraph()
PlanarGraph(NodeFactory nodeFact)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(EdgeEnd e)
void
addEdges(java.util.List edgesToAdd)
Add a set of edges to the graph.Node
addNode(Coordinate coord)
Node
addNode(Node node)
Node
find(Coordinate coord)
Find coordinate.Edge
findEdge(Coordinate p0, Coordinate p1)
Returns the edge whose first two coordinates are p0 and p1EdgeEnd
findEdgeEnd(Edge e)
Returns the EdgeEnd which has edge e as its base edge (MD 18 Feb 2002 - this should return a pair of edges)Edge
findEdgeInSameDirection(Coordinate p0, Coordinate p1)
Returns the edge which starts at p0 and whose first segment is parallel to p1java.util.Collection
getEdgeEnds()
java.util.Iterator
getEdgeIterator()
java.util.Iterator
getNodeIterator()
java.util.Collection
getNodes()
boolean
isBoundaryNode(int geomIndex, Coordinate coord)
void
linkAllDirectedEdges()
Link the DirectedEdges at the nodes of the graph.void
linkResultDirectedEdges()
Link the DirectedEdges at the nodes of the graph.static void
linkResultDirectedEdges(java.util.Collection nodes)
For nodes in the Collection, link the DirectedEdges at the node that are in the result.void
printEdges(java.io.PrintStream out)
-
-
-
Constructor Detail
-
PlanarGraph
public PlanarGraph(NodeFactory nodeFact)
-
PlanarGraph
public PlanarGraph()
-
-
Method Detail
-
linkResultDirectedEdges
public static void linkResultDirectedEdges(java.util.Collection nodes)
For nodes in the Collection, link the DirectedEdges at the node that are in the result. This allows clients to link only a subset of nodes in the graph, for efficiency (because they know that only a subset is of interest).- Parameters:
nodes
- Collection of nodes
-
getEdgeIterator
public java.util.Iterator getEdgeIterator()
-
getEdgeEnds
public java.util.Collection getEdgeEnds()
-
isBoundaryNode
public boolean isBoundaryNode(int geomIndex, Coordinate coord)
-
add
public void add(EdgeEnd e)
-
getNodeIterator
public java.util.Iterator getNodeIterator()
-
getNodes
public java.util.Collection getNodes()
-
addNode
public Node addNode(Coordinate coord)
-
find
public Node find(Coordinate coord)
Find coordinate.- Parameters:
coord
- Coordinate to find- Returns:
- the node if found; null otherwise
-
addEdges
public void addEdges(java.util.List edgesToAdd)
Add a set of edges to the graph. For each edge two DirectedEdges will be created. DirectedEdges are NOT linked by this method.- Parameters:
edgesToAdd
- Set of edges to add to the graph
-
linkResultDirectedEdges
public void linkResultDirectedEdges()
Link the DirectedEdges at the nodes of the graph. This allows clients to link only a subset of nodes in the graph, for efficiency (because they know that only a subset is of interest).
-
linkAllDirectedEdges
public void linkAllDirectedEdges()
Link the DirectedEdges at the nodes of the graph. This allows clients to link only a subset of nodes in the graph, for efficiency (because they know that only a subset is of interest).
-
findEdgeEnd
public EdgeEnd findEdgeEnd(Edge e)
Returns the EdgeEnd which has edge e as its base edge (MD 18 Feb 2002 - this should return a pair of edges)- Parameters:
e
- Edge- Returns:
- the edge, if found
null
if the edge was not found
-
findEdge
public Edge findEdge(Coordinate p0, Coordinate p1)
Returns the edge whose first two coordinates are p0 and p1- Parameters:
p0
- first coordinate to matchp1
- second coordinate to match- Returns:
- the edge, if found
null
if the edge was not found
-
findEdgeInSameDirection
public Edge findEdgeInSameDirection(Coordinate p0, Coordinate p1)
Returns the edge which starts at p0 and whose first segment is parallel to p1- Parameters:
p0
- Starting coordinatep1
- Coordinate used to establish direction- Returns:
- matching edge, if found
null
if the edge was not found
-
printEdges
public void printEdges(java.io.PrintStream out)
-
-