diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSections.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSections.java index 487709ba19..33d94616e8 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSections.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSections.java @@ -57,10 +57,11 @@ public RelateNode createNode() { while (i < sections.size()) { int blockSize = 1; NodeSection ns = sections.get(i); + //-- are there multiple polygon sections incident at node? if (ns.isArea() && hasMultiplePolygonSections(sections, i)) { List polySections = collectPolygonSections(sections, i); - List nsInvert = PolygonNodeConverter.convert(polySections); - node.addEdges(nsInvert); + List nsConvert = PolygonNodeConverter.convert(polySections); + node.addEdges(nsConvert); blockSize = polySections.size(); } else { diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/PolygonNodeConverter.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/PolygonNodeConverter.java index 84f9ed9652..5ac07f6580 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/PolygonNodeConverter.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/PolygonNodeConverter.java @@ -27,16 +27,16 @@ * which all lies inside the polygon * (i.e. they does not enclose hole edges). * This allows a simple area-additive semantics to be used - * for adding edges and propagating edge locations - * in {@link RelateNode}. + * in {@link RelateNode} + * for adding edges and propagating edge locations. *

- * The arrangement of shells and holes must be topologically valid. - * I.e. the node sections must not cross. * The input node sections are assumed to have canonical orientation * (CW shells and CCW holes). + * The arrangement of shells and holes must be topologically valid. + * Specifically, the node sections must not cross or be collinear. *

* This also supports multiple shell-shell touches - * (including ones containing holes) and hold-hole touches, + * (including ones containing holes), and hole-hole touches, * This generalizes the relate algorithm to support * both the OGC model and the self-touch model. * diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/TopologyBuilder.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/TopologyBuilder.java index 8c5bf41952..7c635c2300 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/TopologyBuilder.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/TopologyBuilder.java @@ -151,7 +151,7 @@ public void finish() { predicate.finish(); } - private NodeSections getNode(Coordinate nodePt) { + private NodeSections getNodeSections(Coordinate nodePt) { NodeSections node = nodeMap.get(nodePt); if (node == null) { node = new NodeSections(nodePt); @@ -170,10 +170,10 @@ public void addIntersection(NodeSection a, NodeSection b) { addNodeSections(a, b); } - private void addNodeSections(NodeSection e0, NodeSection e1) { - NodeSections node = getNode(e0.nodePt()); - node.addNodeSection(e0); - node.addNodeSection(e1); + private void addNodeSections(NodeSection ns0, NodeSection ns1) { + NodeSections sections = getNodeSections(ns0.nodePt()); + sections.addNodeSection(ns0); + sections.addNodeSection(ns1); } private void updateABIntersection(NodeSection a, NodeSection b) {