@Test public void containsTest() { BoundingBox boundingBox = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); GeoPoint geoPoint1 = new GeoPoint(MIN_LATITUDE, MIN_LONGITUDE); GeoPoint geoPoint2 = new GeoPoint(MAX_LATITUDE, MAX_LONGITUDE); GeoPoint geoPoint3 = new GeoPoint(MIN_LONGITUDE, MIN_LONGITUDE); GeoPoint geoPoint4 = new GeoPoint(MAX_LATITUDE, MAX_LATITUDE); Assert.assertTrue(boundingBox.contains(geoPoint1)); Assert.assertTrue(boundingBox.contains(geoPoint2)); Assert.assertFalse(boundingBox.contains(geoPoint3)); Assert.assertFalse(boundingBox.contains(geoPoint4)); }
public boolean contains(GeoPoint geoPoint) { return this.minLatitude <= geoPoint.latitude && this.maxLatitude >= geoPoint.latitude && this.minLongitude <= geoPoint.longitude && this.maxLongitude >= geoPoint.longitude; }
BoundingBox implements Serializable { public boolean contains(GeoPoint geoPoint) { return this.minLatitude <= geoPoint.latitude && this.maxLatitude >= geoPoint.latitude && this.minLongitude <= geoPoint.longitude && this.maxLongitude >= geoPoint.longitude; } }
BoundingBox implements Serializable { public boolean contains(GeoPoint geoPoint) { return this.minLatitude <= geoPoint.latitude && this.maxLatitude >= geoPoint.latitude && this.minLongitude <= geoPoint.longitude && this.maxLongitude >= geoPoint.longitude; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); }
BoundingBox implements Serializable { public boolean contains(GeoPoint geoPoint) { return this.minLatitude <= geoPoint.latitude && this.maxLatitude >= geoPoint.latitude && this.minLongitude <= geoPoint.longitude && this.maxLongitude >= geoPoint.longitude; } 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 boolean contains(GeoPoint geoPoint) { return this.minLatitude <= geoPoint.latitude && this.maxLatitude >= geoPoint.latitude && this.minLongitude <= geoPoint.longitude && this.maxLongitude >= geoPoint.longitude; } 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; }