You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2016/04/14 01:21:33 UTC
[17/50] lucene-solr:jira/SOLR-8908: LUCENE-7189: use fewer sampling
points for small earth-surface rectangles
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/739c752c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/739c752c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/739c752c
Branch: refs/heads/jira/SOLR-8908
Commit: 739c752cd30b73713a1334d67da4e3b4fc83f9c9
Parents: 38bf7dd
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:45:42 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/739c752c/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");