public void setOverlayVisibleBounds(VisibleBoundsVO data) { if (mOverlays != null && mOverlays.size() > 0) { LatLngBounds.Builder builder = LatLngBounds.builder(); for (int i = 0; i < mOverlays.size(); i++) { LatLng item = mOverlays.get(i); builder.include(item); } aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), data.getPadding())); } }
public void setMarkerVisibleBounds(VisibleBoundsVO data) { List<Marker> list = aMap.getMapScreenMarkers(); if (list != null && list.size() > 0) { LatLngBounds.Builder builder = LatLngBounds.builder(); for (int i = 0; i < list.size(); i++) { LatLng item = list.get(i).getPosition(); builder.include(item); } aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), data.getPadding())); } }
private LatLngBounds getLatLngBounds() { LatLngBounds.Builder b = LatLngBounds.builder(); b.include(new LatLng(startPoint.latitude, startPoint.longitude)); b.include(new LatLng(endPoint.latitude, endPoint.longitude)); if (this.throughPointList != null && this.throughPointList.size() > 0) { for (int i = 0; i < this.throughPointList.size(); i++) { b.include( new LatLng( this.throughPointList.get(i).getLatitude(), this.throughPointList.get(i).getLongitude())); } } return b.build(); }