@Test public void getCenterPointTest() { BoundingBox boundingBox = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); GeoPoint centerPoint = boundingBox.getCenterPoint(); Assert.assertEquals((MIN_LATITUDE + MAX_LATITUDE) / 2, centerPoint.latitude, 0); Assert.assertEquals((MIN_LONGITUDE + MAX_LONGITUDE) / 2, centerPoint.longitude, 0); }
public GeoPoint getCenterPoint() { double latitudeOffset = (this.maxLatitude - this.minLatitude) / 2; double longitudeOffset = (this.maxLongitude - this.minLongitude) / 2; return new GeoPoint(this.minLatitude + latitudeOffset, this.minLongitude + longitudeOffset); }
BoundingBox implements Serializable { public GeoPoint getCenterPoint() { double latitudeOffset = (this.maxLatitude - this.minLatitude) / 2; double longitudeOffset = (this.maxLongitude - this.minLongitude) / 2; return new GeoPoint(this.minLatitude + latitudeOffset, this.minLongitude + longitudeOffset); } }
BoundingBox implements Serializable { public GeoPoint getCenterPoint() { double latitudeOffset = (this.maxLatitude - this.minLatitude) / 2; double longitudeOffset = (this.maxLongitude - this.minLongitude) / 2; return new GeoPoint(this.minLatitude + latitudeOffset, this.minLongitude + longitudeOffset); } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); }
BoundingBox implements Serializable { public GeoPoint getCenterPoint() { double latitudeOffset = (this.maxLatitude - this.minLatitude) / 2; double longitudeOffset = (this.maxLongitude - this.minLongitude) / 2; return new GeoPoint(this.minLatitude + latitudeOffset, this.minLongitude + longitudeOffset); } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); static BoundingBox fromString(String boundingBoxString); boolean contains(GeoPoint geoPoint); @Override boolean equals(Object obj); GeoPoint getCenterPoint(); double getLatitudeSpan(); double getLongitudeSpan(); @Override int hashCode(); boolean intersects(BoundingBox boundingBox); @Override String toString(); }
BoundingBox implements Serializable { public GeoPoint getCenterPoint() { double latitudeOffset = (this.maxLatitude - this.minLatitude) / 2; double longitudeOffset = (this.maxLongitude - this.minLongitude) / 2; return new GeoPoint(this.minLatitude + latitudeOffset, this.minLongitude + longitudeOffset); } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); static BoundingBox fromString(String boundingBoxString); boolean contains(GeoPoint geoPoint); @Override boolean equals(Object obj); GeoPoint getCenterPoint(); double getLatitudeSpan(); double getLongitudeSpan(); @Override int hashCode(); boolean intersects(BoundingBox boundingBox); @Override String toString(); final double maxLatitude; final double maxLongitude; final double minLatitude; final double minLongitude; }