/** * Ensures that given point will be within output bounds. Output bounds guaranteed to be * as small as possible and enclose all given points. * * @return same {@link com.car2go.maps.model.LatLngBounds.Builder} */ public Builder include(LatLng point) { southWestLattitude = Math.min(southWestLattitude, point.latitude); northEastLattitude = Math.max(northEastLattitude, point.latitude); if (Double.isNaN(southWestLongitude)) { southWestLongitude = point.longitude; northEastLongitude = point.longitude; } else if (!withinBounds(point.longitude)) { if (degreeDifference(southWestLongitude, point.longitude) < degreeDifference(point.longitude, northEastLongitude)) { southWestLongitude = point.longitude; } else { northEastLongitude = point.longitude; } } return this; }
/** * @return {@link com.car2go.maps.model.LatLngBounds.Builder} for {@link LatLngBounds} */ public static Builder builder() { return new Builder(); }