mirror of https://github.com/apache/lucene.git
LUCENE-7125: remove additional confusion (we already quantize once, don't do it again).
This commit is contained in:
parent
d74572ac9c
commit
69da13ff6f
|
@ -53,28 +53,14 @@ public class TestLatLonPointQueries extends BaseGeoPointTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean rectContainsPoint(GeoRect rect, double pointLat, double pointLon) {
|
protected Boolean rectContainsPoint(GeoRect rect, double pointLat, double pointLon) {
|
||||||
|
|
||||||
assert Double.isNaN(pointLat) == false;
|
assert Double.isNaN(pointLat) == false;
|
||||||
|
|
||||||
int rectLatMinEnc = LatLonPoint.encodeLatitude(rect.minLat);
|
|
||||||
int rectLatMaxEnc = LatLonPoint.encodeLatitude(rect.maxLat);
|
|
||||||
int rectLonMinEnc = LatLonPoint.encodeLongitude(rect.minLon);
|
|
||||||
int rectLonMaxEnc = LatLonPoint.encodeLongitude(rect.maxLon);
|
|
||||||
|
|
||||||
int pointLatEnc = LatLonPoint.encodeLatitude(pointLat);
|
|
||||||
int pointLonEnc = LatLonPoint.encodeLongitude(pointLon);
|
|
||||||
|
|
||||||
if (rect.minLon < rect.maxLon) {
|
if (rect.minLon < rect.maxLon) {
|
||||||
return pointLatEnc >= rectLatMinEnc &&
|
return GeoRelationUtils.pointInRectPrecise(pointLon, pointLat, rect.minLon, rect.minLat, rect.maxLon, rect.maxLat);
|
||||||
pointLatEnc <= rectLatMaxEnc &&
|
|
||||||
pointLonEnc >= rectLonMinEnc &&
|
|
||||||
pointLonEnc <= rectLonMaxEnc;
|
|
||||||
} else {
|
} else {
|
||||||
// Rect crosses dateline:
|
// Rect crosses dateline:
|
||||||
return pointLatEnc >= rectLatMinEnc &&
|
return GeoRelationUtils.pointInRectPrecise(pointLon, pointLat, -180.0, rect.minLat, rect.maxLon, rect.maxLat)
|
||||||
pointLatEnc <= rectLatMaxEnc &&
|
|| GeoRelationUtils.pointInRectPrecise(pointLon, pointLat, rect.minLon, rect.minLat, 180.0, rect.maxLat);
|
||||||
(pointLonEnc >= rectLonMinEnc ||
|
|
||||||
pointLonEnc <= rectLonMaxEnc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue