Apache Lucene open-source search software
LUCENE-8838: Remove support for Steiner points (#703)
Ignacio Verad9dbb70d01f9
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex fa0604cd391..f283e14bed8 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -142,6 +142,8 @@ Other* LUCENE-8778: Define analyzer SPI names as static final fields and document the names in Javadocs.(Tomoko Uchida, Uwe Schindler)+* LUCENE-8838: Remove support for Steiner points on Tessellator. (Ignacio Vera)+======================= Lucene 8.1.1 =======================(No Changes)diff --git a/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.javaindex 966db6ac341..9e96a047ff4 100644--- a/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java+++ b/lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java@@ -156,7 +156,7 @@ final public class Tessellator {Node list = createDoublyLinkedList(holes[i], nodeIndex, WindingOrder.CCW);if (list == list.next) {- list.isSteiner = true;+ throw new IllegalArgumentException("Points are all coplanar in hole: " + holes[i]);}// Determine if the resulting hole polygon was successful.if(list != null) {@@ -716,7 +716,7 @@ final public class Tessellator {continueIteration = false;nextNode = node.next;prevNode = node.previous;- if (node.isSteiner == false && isVertexEquals(node, nextNode)+ if (isVertexEquals(node, nextNode)|| area(prevNode.getX(), prevNode.getY(), node.getX(), node.getY(), nextNode.getX(), nextNode.getY()) == 0) {// Remove the noderemoveNode(node);@@ -838,8 +838,6 @@ final public class Tessellator {private Node previousZ;// next z nodeprivate Node nextZ;- // triangle center- private boolean isSteiner = false;protected Node(final Polygon polygon, final int index, final int vertexIndex) {this.idx = index;@@ -866,7 +864,6 @@ final public class Tessellator {this.next = other.next;this.previousZ = other.previousZ;this.nextZ = other.nextZ;- this.isSteiner = other.isSteiner;}/** get the x value */diff --git a/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java b/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.javaindex fcfe1abdd8f..982271817ec 100644--- a/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java+++ b/lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java@@ -289,14 +289,16 @@ public class TestTessellator extends LuceneTestCase {" 130.6765691 33.4548828, 130.6765693 33.4548793, 130.6765507 33.4548786, 130.6765509 33.4548761, 130.6765281 33.4548753, 130.6765273 33.4548919, 130.6765322 33.454892, 130.6765315 33.4549065, 130.6765323 33.4549065," +" 130.6765321 33.4549107, 130.6765257 33.4549105, 130.6765238 33.454949, 130.6765515 33.45495, 130.6765512 33.4549572, 130.6765808 33.4549583, 130.67658 33.4549747)," +" (130.6765844 33.4549234, 130.6765847 33.4549188, 130.6765847 33.4549188, 130.6765844 33.4549234))";- checkPolygon(wkt);+ Polygon polygon = (Polygon)SimpleWKTShapeParser.parse(wkt);+ expectThrows( IllegalArgumentException.class, () -> {Tessellator.tessellate(polygon); });}public void testComplexPolygon25() throws Exception {String wkt ="POLYGON((33.3275991 -8.9353026, 33.3276122 -8.9353021, 33.3276139 -8.9353425, 33.3276095 -8.9353427, 33.3276107 -8.9353706, 33.3276074 -8.9353707, 33.3276087 -8.9354024, 33.3275766 -8.9354038, 33.3275753 -8.9353739," +" 33.3275354 -8.9353756, 33.3275342 -8.9353464, 33.3275184 -8.935347, 33.3275167 -8.9353066, 33.3275381 -8.9353057, 33.3275375 -8.9352901, 33.3275598 -8.9352892, 33.3275594 -8.9352808, 33.3275981 -8.9352792, 33.3275991 -8.9353026)," +" (33.3275601 -8.9353046, 33.3275599 -8.9352988, 33.3275601 -8.9353046, 33.3275601 -8.9353046))";- checkPolygon(wkt);+ Polygon polygon = (Polygon)SimpleWKTShapeParser.parse(wkt);+ expectThrows( IllegalArgumentException.class, () -> {Tessellator.tessellate(polygon); });}public void testComplexPolygon26() throws Exception {