mirror of https://github.com/apache/lucene.git
Fix TestShapeDocValues.testLatLonPolygonBBox (#13743)
This commit is contained in:
parent
568d1f3fbe
commit
111ccf6c30
|
@ -56,12 +56,14 @@ public class TestShapeDocValues extends LuceneTestCase {
|
|||
|
||||
public void testLatLonPolygonBBox() {
|
||||
Polygon p = GeoTestUtil.nextPolygon();
|
||||
Rectangle expected = (Rectangle) computeBoundingBox(p);
|
||||
LatLonShapeDocValuesField dv = LatLonShape.createDocValueField(FIELD_NAME, p);
|
||||
assertEquals(expected.minLat, dv.getBoundingBox().minLat, TOLERANCE);
|
||||
assertEquals(expected.maxLat, dv.getBoundingBox().maxLat, TOLERANCE);
|
||||
assertEquals(expected.minLon, dv.getBoundingBox().minLon, TOLERANCE);
|
||||
assertEquals(expected.maxLon, dv.getBoundingBox().maxLon, TOLERANCE);
|
||||
if (area(p) != 0) {
|
||||
Rectangle expected = (Rectangle) computeBoundingBox(p);
|
||||
LatLonShapeDocValuesField dv = LatLonShape.createDocValueField(FIELD_NAME, p);
|
||||
assertEquals(expected.minLat, dv.getBoundingBox().minLat, TOLERANCE);
|
||||
assertEquals(expected.maxLat, dv.getBoundingBox().maxLat, TOLERANCE);
|
||||
assertEquals(expected.minLon, dv.getBoundingBox().minLon, TOLERANCE);
|
||||
assertEquals(expected.maxLon, dv.getBoundingBox().maxLon, TOLERANCE);
|
||||
}
|
||||
}
|
||||
|
||||
public void testXYPolygonBBox() {
|
||||
|
@ -255,4 +257,9 @@ public class TestShapeDocValues extends LuceneTestCase {
|
|||
}
|
||||
return tess;
|
||||
}
|
||||
|
||||
/** Compute signed area of rectangle */
|
||||
private static double area(Polygon p) {
|
||||
return (p.maxLon - p.minLon) * (p.maxLat - p.minLat);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue