/** * Constructor with center position, and lat and lng span. Constructor used with MapView * informations. * * @param center Center of bounds * @param latSpan Span between SW and NE latitude * @param lngSpan Span between SW and NE longitude */ public LatLngBounds(LatLng center, double latSpan, double lngSpan) { mCenter = center; calculateBounds(latSpan, lngSpan); }
/** * Constructor with center position, and lat and lng span. Constructor used with MapView * informations. * * @param center Center of bounds * @param latSpanE6 Span between SW and NE latitude, * 100.000 * @param lngSpanE6 Span between SW and NE longitude, * 100.000 */ public LatLngBounds(GeoPoint center, int latSpanE6, int lngSpanE6) { mCenter = new LatLng(center); calculateBounds(latSpanE6, lngSpanE6); }
/** * Constructor with center position, and lat and lng span. Constructor used with MapView * informations. * * @param center Center of bounds * @param latSpanE6 Span between SW and NE latitude, * 100.000 * @param lngSpanE6 Span between SW and NE longitude, * 100.000 */ public LatLngBounds(LatLng center, int latSpanE6, int lngSpanE6) { mCenter = center; calculateBounds(latSpanE6, lngSpanE6); }
/** * Calculates LatLng SW and NE when center and latSpanE6 and lngSpanE6 are known. * * @param latSpanE6 Latitude span between SW lat and NE lat * @param latSpanE6 Latitude span between SW lng and NE lng */ private void calculateBounds(int latSpanE6, int lngSpanE6) { double deltaLat = (((double) latSpanE6) / 1000000) / 2; double deltaLng = (((double) lngSpanE6) / 1000000) / 2; calculateBounds(deltaLat, deltaLng); }