@Test public void northEast_doesReturnMostNortheastCoordinate() throws Exception { Point southwest = Point.fromLngLat(1.0, 2.0); Point northeast = Point.fromLngLat(3.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertTrue(northeast.equals(boundingBox.northeast())); }
@Test public void southWest_doesReturnMostSouthwestCoordinate() throws Exception { Point southwest = Point.fromLngLat(1.0, 2.0); Point northeast = Point.fromLngLat(3.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertTrue(southwest.equals(boundingBox.southwest())); }
@Test public void sanity() throws Exception { Point southwest = Point.fromLngLat(2.0, 2.0); Point northeast = Point.fromLngLat(4.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertNotNull(boundingBox); }
@Test public void east_doesReturnMostEastCoordinate() throws Exception { Point southwest = Point.fromLngLat(1.0, 2.0); Point northeast = Point.fromLngLat(3.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertEquals(3.0, boundingBox.east(), DELTA); }
@Test public void north_doesReturnMostNorthCoordinate() throws Exception { Point southwest = Point.fromLngLat(1.0, 2.0); Point northeast = Point.fromLngLat(3.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertEquals(4.0, boundingBox.north(), DELTA); } }
@Test public void west_doesReturnMostWestCoordinate() throws Exception { Point southwest = Point.fromLngLat(1.0, 2.0); Point northeast = Point.fromLngLat(3.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertEquals(1.0, boundingBox.west(), DELTA); }
@Test public void south_doesReturnMostSouthCoordinate() throws Exception { Point southwest = Point.fromLngLat(1.0, 2.0); Point northeast = Point.fromLngLat(3.0, 4.0); BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast); assertEquals(2.0, boundingBox.south(), DELTA); }
@Test public void bbox_basic_shift() throws Exception { Point southwest = Point.fromLngLat(2.0, 2.0); Point northeast = Point.fromLngLat(4.0, 4.0); CoordinateShifter shifter = new TestCoordinateShifter(); // Manually shifted List<Double> shifted = shifter.shiftLonLat(southwest.longitude(), southwest.latitude()); Point southwestManualShifted = Point.fromLngLat(shifted.get(0), shifted.get(1)); shifted = shifter.shiftLonLat(northeast.longitude(), northeast.latitude()); Point northeastManualShifted = Point.fromLngLat(shifted.get(0), shifted.get(1)); CoordinateShifterManager.setCoordinateShifter(shifter); BoundingBox boundingBoxFromDouble = BoundingBox.fromLngLats(2.0, 2.0, 4.0, 4.0); BoundingBox boundingBoxFromPoints = BoundingBox.fromPoints(Point.fromLngLat(2.0, 2.0), Point.fromLngLat(4.0, 4.0)); assertEquals(boundingBoxFromDouble, boundingBoxFromPoints); assertEquals(southwestManualShifted, boundingBoxFromPoints.southwest()); assertEquals(northeastManualShifted, boundingBoxFromPoints.northeast()); CoordinateShifterManager.setCoordinateShifter(null); }