Class 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
    • Constructor Detail

    • Method Detail

      • insertEdgeEnds

        private void insertEdgeEnds​(java.util.List ee)
      • 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.