Github user iverase commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/246#discussion_r138555768
--- Diff:
lucene/spatial-extras/src/java/org/apache/lucene/spatial/spatial4j/Geo3dShape.java
---
@@ -96,45 +95,25 @@ else if (relationship == GeoArea.DISJOINT)
}
protected SpatialRelation relate(Point p) {
- // Create a GeoPoint
- GeoPoint point = new GeoPoint(planetModel, p.getY()*
DistanceUtils.DEGREES_TO_RADIANS, p.getX()* DistanceUtils.DEGREES_TO_RADIANS);
+ GeoPoint point = new GeoPoint(shape.getPlanetModel(), p.getY()*
DistanceUtils.DEGREES_TO_RADIANS, p.getX()* DistanceUtils.DEGREES_TO_RADIANS);
if (shape.isWithin(point)) {
- // Point within shape
return SpatialRelation.CONTAINS;
}
return SpatialRelation.DISJOINT;
}
-
-
@Override
public Rectangle getBoundingBox() {
Rectangle bbox = this.boundingBox;//volatile read once
if (bbox == null) {
LatLonBounds bounds = new LatLonBounds();
shape.getBounds(bounds);
- double leftLon;
- double rightLon;
- if (bounds.checkNoLongitudeBound()) {
- leftLon = -180.0;
- rightLon = 180.0;
- } else {
- leftLon = bounds.getLeftLongitude().doubleValue() *
DistanceUtils.RADIANS_TO_DEGREES;
- rightLon = bounds.getRightLongitude().doubleValue() *
DistanceUtils.RADIANS_TO_DEGREES;
- }
- double minLat;
- if (bounds.checkNoBottomLatitudeBound()) {
- minLat = -90.0;
- } else {
- minLat = bounds.getMinLatitude().doubleValue() *
DistanceUtils.RADIANS_TO_DEGREES;
- }
- double maxLat;
- if (bounds.checkNoTopLatitudeBound()) {
- maxLat = 90.0;
- } else {
- maxLat = bounds.getMaxLatitude().doubleValue() *
DistanceUtils.RADIANS_TO_DEGREES;
- }
- bbox = new RectangleImpl(leftLon, rightLon, minLat, maxLat,
ctx).getBuffered(ROUNDOFF_ADJUSTMENT, ctx);
--- End diff --
Yes, it seems not necessary. Not sure what was needed before but I am glad
that we can hopefully get rid of that.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]