sao tôi đã hình nó ra. Tôi cần phải tạo ra một hộp bounding chứa tất cả các dấu hiệu
final BoundingBox zoomLevel = findZoomLevel(hotelLocation,poiLocations);
mv.zoomToBoundingBox(zoomLevel,true,true);
.....
private BoundingBox findZoomLevel(LatLng hotelLocation, LatLng[] poiLocations) {
double bottomPadding = 0.002;
double topPadding = 0.005;
BoundingBox box = new BoundingBox(findTopMost(hotelLocation,poiLocations).getLatitude() + topPadding,
findRightMost(hotelLocation,poiLocations).getLongitude(),
findBottomMost(hotelLocation,poiLocations).getLatitude() - bottomPadding,
findLeftMost(hotelLocation,poiLocations).getLongitude());
return box;
}
Cập nhật
LatLngBounds latLngBounds = new LatLngBounds.Builder()
.include(new LatLng(lat1,lng1))
.include(new LatLng(lat2,lng2))
.build();
mapboxMap.moveCamera(
CameraUpdateFactory.newLatLngBounds(LatLngBounds bounds,
int paddingLeft,
int paddingTop,
int paddingRight,
int paddingBottom));
** zoomToBoundingBox() ** dường như không có sẵn nữa. những gì thay thế? –
@LordFlash xem http://stackoverflow.com/a/37561003/284318 –
Đơn vị nào được đo lường? – cuddlecheek