From 7cc8b1b4845932e5d71d166711d6c839aa26caa2 Mon Sep 17 00:00:00 2001 From: Grant Ingersoll Date: Wed, 31 Mar 2010 19:54:41 +0000 Subject: [PATCH] added some comments, removed an extra, useless if check git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@929698 13f79535-47bb-0310-9956-ffa450edef68 --- .../spatial/tier/CartesianPolyFilterBuilder.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lucene/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java b/lucene/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java index 043e283c6ed..f58dccc8e89 100644 --- a/lucene/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java +++ b/lucene/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java @@ -72,11 +72,12 @@ public class CartesianPolyFilterBuilder { double longY = ur.getLng(); double longX = ll.getLng(); double longX2 = 0.0; - + //Are we crossing the 180 deg. longitude, if so, we need to do some special things if (ur.getLng() < 0.0 && ll.getLng() > 0.0) { longX2 = ll.getLng(); longX = -180.0; } + //are we crossing the prime meridian (0 degrees)? If so, we need to account for it and boxes on both sides if (ur.getLng() > 0.0 && ll.getLng() < 0.0) { longX2 = ll.getLng(); longX = 0.0; @@ -101,18 +102,19 @@ public class CartesianPolyFilterBuilder { // shape.add(currentLat.currentLong); shape = getShapeLoop(shape,ctp,latX,longX,latY,longY); - if (longX2 != 0.0) { + if (longX2 != 0.0) { + //We are around the prime meridian if (longX == 0.0) { longX = longX2; longY = 0.0; - shape = getShapeLoop(shape,ctp,latX,longX,latY,longY); - } else { + shape = getShapeLoop(shape,ctp,latX,longX,latY,longY); + } else {//we are around the 180th longitude longX = longX2; longY = -180.0; - shape = getShapeLoop(shape,ctp,latY,longY,latX,longX); - } + shape = getShapeLoop(shape,ctp,latY,longY,latX,longX); } + //System.err.println("getBoxShape2:"+latY+"," + longY); //System.err.println("getBoxShape2:"+latX+"," + longX); }