You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2019/06/24 07:44:07 UTC

[lucene-solr] branch branch_8x updated: LUCENE-8838: Remove support for Steiner points (#703)

This is an automated email from the ASF dual-hosted git repository.

ivera pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 40886d4  LUCENE-8838: Remove support for Steiner points (#703)
40886d4 is described below

commit 40886d4690b04a1b96ec5fae49740e9235a2a8ae
Author: Ignacio Vera <iv...@apache.org>
AuthorDate: Mon Jun 24 09:41:33 2019 +0200

    LUCENE-8838: Remove support for Steiner points (#703)
    
    This is currently not used/supported.
---
 lucene/CHANGES.txt                                                 | 2 ++
 lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java     | 7 ++-----
 lucene/sandbox/src/test/org/apache/lucene/geo/TestTessellator.java | 6 ++++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index f0371eb..e0910df 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -118,6 +118,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.java
index 966db6a..9e96a04 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 node
         removeNode(node);
@@ -838,8 +838,6 @@ final public class Tessellator {
     private Node previousZ;
     // next z node
     private 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.java
index fcfe1ab..9822718 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 {