Class RelateComputer
- java.lang.Object
-
- org.locationtech.jts.operation.relate.RelateComputer
-
public class RelateComputer extends java.lang.Object
Computes the topological relationship between two Geometries.RelateComputer does not need to build a complete graph structure to compute the IntersectionMatrix. The relationship between the geometries can be computed by simply examining the labelling of edges incident on each node.
RelateComputer does not currently support arbitrary GeometryCollections. This is because GeometryCollections can contain overlapping Polygons. In order to correct compute relate on overlapping Polygons, they would first need to be noded and merged (if not explicitly, at least implicitly).
- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private GeometryGraph[]
arg
private IntersectionMatrix
im
private Coordinate
invalidPoint
private java.util.ArrayList
isolatedEdges
private LineIntersector
li
private NodeMap
nodes
private PointLocator
ptLocator
-
Constructor Summary
Constructors Constructor Description RelateComputer(GeometryGraph[] arg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
computeDisjointIM(IntersectionMatrix im)
If the Geometries are disjoint, we need to enter their dimension and boundary dimension in the Ext rows in the IMIntersectionMatrix
computeIM()
private void
computeIntersectionNodes(int argIndex)
Insert nodes for all intersections on the edges of a Geometry.private void
computeProperIntersectionIM(SegmentIntersector intersector, IntersectionMatrix im)
private void
copyNodesAndLabels(int argIndex)
Copy all nodes from an arg geometry into this graph.private void
insertEdgeEnds(java.util.List ee)
private void
labelIntersectionNodes(int argIndex)
For all intersections on the edges of a Geometry, label the corresponding node IF it doesn't already have a label.private void
labelIsolatedEdge(Edge e, int targetIndex, Geometry target)
Label an isolated edge of a graph with its relationship to the target geometry.private void
labelIsolatedEdges(int thisIndex, int targetIndex)
Processes isolated edges by computing their labelling and adding them to the isolated edges list.private void
labelIsolatedNode(Node n, int targetIndex)
Label an isolated node with its relationship to the target geometry.private void
labelIsolatedNodes()
Isolated nodes are nodes whose labels are incomplete (e.g.private void
labelNodeEdges()
private void
updateIM(IntersectionMatrix im)
update the IM with the sum of the IMs for each component
-
-
-
Field Detail
-
li
private LineIntersector li
-
ptLocator
private PointLocator ptLocator
-
arg
private GeometryGraph[] arg
-
nodes
private NodeMap nodes
-
im
private IntersectionMatrix im
-
isolatedEdges
private java.util.ArrayList isolatedEdges
-
invalidPoint
private Coordinate invalidPoint
-
-
Constructor Detail
-
RelateComputer
public RelateComputer(GeometryGraph[] arg)
-
-
Method Detail
-
computeIM
public IntersectionMatrix computeIM()
-
insertEdgeEnds
private void insertEdgeEnds(java.util.List ee)
-
computeProperIntersectionIM
private void computeProperIntersectionIM(SegmentIntersector intersector, IntersectionMatrix im)
-
copyNodesAndLabels
private void copyNodesAndLabels(int argIndex)
Copy all nodes from an arg geometry into this graph. The node label in the arg geometry overrides any previously computed label for that argIndex. (E.g. a node may be an intersection node with a computed label of BOUNDARY, but in the original arg Geometry it is actually in the interior due to the Boundary Determination Rule)
-
computeIntersectionNodes
private void computeIntersectionNodes(int argIndex)
Insert nodes for all intersections on the edges of a Geometry. Label the created nodes the same as the edge label if they do not already have a label. This allows nodes created by either self-intersections or mutual intersections to be labelled. Endpoint nodes will already be labelled from when they were inserted.
-
labelIntersectionNodes
private void labelIntersectionNodes(int argIndex)
For all intersections on the edges of a Geometry, label the corresponding node IF it doesn't already have a label. This allows nodes created by either self-intersections or mutual intersections to be labelled. Endpoint nodes will already be labelled from when they were inserted.
-
computeDisjointIM
private void computeDisjointIM(IntersectionMatrix im)
If the Geometries are disjoint, we need to enter their dimension and boundary dimension in the Ext rows in the IM
-
labelNodeEdges
private void labelNodeEdges()
-
updateIM
private void updateIM(IntersectionMatrix im)
update the IM with the sum of the IMs for each component
-
labelIsolatedEdges
private void labelIsolatedEdges(int thisIndex, int targetIndex)
Processes isolated edges by computing their labelling and adding them to the isolated edges list. Isolated edges are guaranteed not to touch the boundary of the target (since if they did, they would have caused an intersection to be computed and hence would not be isolated)
-
labelIsolatedEdge
private void labelIsolatedEdge(Edge e, int targetIndex, Geometry target)
Label an isolated edge of a graph with its relationship to the target geometry. If the target has dim 2 or 1, the edge can either be in the interior or the exterior. If the target has dim 0, the edge must be in the exterior
-
labelIsolatedNodes
private void labelIsolatedNodes()
Isolated nodes are nodes whose labels are incomplete (e.g. the location for one Geometry is null). This is the case because nodes in one graph which don't intersect nodes in the other are not completely labelled by the initial process of adding nodes to the nodeList. To complete the labelling we need to check for nodes that lie in the interior of edges, and in the interior of areas.
-
labelIsolatedNode
private void labelIsolatedNode(Node n, int targetIndex)
Label an isolated node with its relationship to the target geometry.
-
-