You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/04/11 11:45:11 UTC

lucene-solr:branch_6x: LUCENE-7189: use fewer sampling points for small earth-surface rectangles

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 4c984af8b -> 9cbe3e761


LUCENE-7189: use fewer sampling points for small earth-surface rectangles


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9cbe3e76
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9cbe3e76
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9cbe3e76

Branch: refs/heads/branch_6x
Commit: 9cbe3e761b6e79acf62b8c6117704ce1656809b2
Parents: 4c984af
Author: Mike McCandless <mi...@apache.org>
Authored: Mon Apr 11 05:45:42 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Mon Apr 11 05:47:11 2016 -0400

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/geo/EarthDebugger.java        | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9cbe3e76/lucene/test-framework/src/java/org/apache/lucene/geo/EarthDebugger.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/geo/EarthDebugger.java b/lucene/test-framework/src/java/org/apache/lucene/geo/EarthDebugger.java
index 14956f2..6c06c94 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/geo/EarthDebugger.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/geo/EarthDebugger.java
@@ -62,9 +62,14 @@ public class EarthDebugger {
     }
   }
 
+  private static double MAX_LAT_LON_PER_STEP = 5.0;
+
   // first point is inclusive, last point is exclusive!
   private void drawSegment(double minLat, double maxLat, double minLon, double maxLon) {
-    int steps = 20;
+    int steps = (int) Math.round(Math.max(Math.abs(maxLat-minLat)/MAX_LAT_LON_PER_STEP, Math.abs(maxLon-minLon)/MAX_LAT_LON_PER_STEP));
+    if (steps < 1) {
+      steps = 1;
+    }
     for(int i=0;i<steps;i++) {
       b.append("          [" + (minLat + (maxLat - minLat) * i / steps) + ", " + (minLon + (maxLon - minLon) * i / steps) + "],\n");
     }
@@ -75,6 +80,7 @@ public class EarthDebugger {
     String name = "rect" + nextShape;
     nextShape++;
 
+    b.append("        // lat: " + minLat + " TO " + maxLat + "; lon: " + minLon + " TO " + maxLon + "\n");
     b.append("        var " + name + " = WE.polygon([\n");
 
     b.append("          // min -> max lat, min lon\n");