LUCENE-7965: GeoBBoxFactory was constructing the wrong shape at the poles, if the longitude range provided was greater than 180 degrees.

This commit is contained in:
Karl Wright 2017-09-09 01:01:33 -04:00
parent 2b6c82ed32
commit fe7582e9d7
1 changed files with 8 additions and 1 deletions

View File

@ -82,6 +82,11 @@ public class GeoBBoxFactory {
//System.err.println(" not vertical line"); //System.err.println(" not vertical line");
if (extent >= Math.PI) { if (extent >= Math.PI) {
if (Math.abs(topLat - bottomLat) < Vector.MINIMUM_ANGULAR_RESOLUTION) { if (Math.abs(topLat - bottomLat) < Vector.MINIMUM_ANGULAR_RESOLUTION) {
if (Math.abs(topLat - Math.PI * 0.5) < Vector.MINIMUM_ANGULAR_RESOLUTION) {
return new GeoDegeneratePoint(planetModel, topLat, 0.0);
} else if (Math.abs(bottomLat + Math.PI * 0.5) < Vector.MINIMUM_ANGULAR_RESOLUTION) {
return new GeoDegeneratePoint(planetModel, bottomLat, 0.0);
}
//System.err.println(" wide degenerate line"); //System.err.println(" wide degenerate line");
return new GeoWideDegenerateHorizontalLine(planetModel, topLat, leftLon, rightLon); return new GeoWideDegenerateHorizontalLine(planetModel, topLat, leftLon, rightLon);
} }
@ -94,8 +99,10 @@ public class GeoBBoxFactory {
return new GeoWideRectangle(planetModel, topLat, bottomLat, leftLon, rightLon); return new GeoWideRectangle(planetModel, topLat, bottomLat, leftLon, rightLon);
} }
if (Math.abs(topLat - bottomLat) < Vector.MINIMUM_ANGULAR_RESOLUTION) { if (Math.abs(topLat - bottomLat) < Vector.MINIMUM_ANGULAR_RESOLUTION) {
if (Math.abs(topLat - Math.PI * 0.5) < Vector.MINIMUM_ANGULAR_RESOLUTION || Math.abs(topLat + Math.PI * 0.5) < Vector.MINIMUM_ANGULAR_RESOLUTION) { if (Math.abs(topLat - Math.PI * 0.5) < Vector.MINIMUM_ANGULAR_RESOLUTION) {
return new GeoDegeneratePoint(planetModel, topLat, 0.0); return new GeoDegeneratePoint(planetModel, topLat, 0.0);
} else if (Math.abs(bottomLat + Math.PI * 0.5) < Vector.MINIMUM_ANGULAR_RESOLUTION) {
return new GeoDegeneratePoint(planetModel, bottomLat, 0.0);
} }
//System.err.println(" horizontal line"); //System.err.println(" horizontal line");
return new GeoDegenerateHorizontalLine(planetModel, topLat, leftLon, rightLon); return new GeoDegenerateHorizontalLine(planetModel, topLat, leftLon, rightLon);