2014-10-03 18 views

cevap

6

tamam ben rakam dışarı ettik android sürüm bulamıyor. Bütün işaretleri mevcut cevabı artık çalışmıyor son SDK sürümü ile

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; 
} 

Güncelleme

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)); 
+2

sağlanması için ** zoomToBoundingBox() ** artık mevcut değil gibi görünüyor. alternatif nedir? –

+0

@LordFlash bkz http://stackoverflow.com/a/37561003/284318 –

+0

Hangi birim ölçülen ölçüldü? – cuddlecheek

7

içeren bir sınırlayıcı kutusu oluşturmak gerekir. Bunun yerine, bu kullanın: dostu Mapbox desteğine

LatLngBounds latLngBounds = new LatLngBounds.Builder() 
    .include(new LatLng(<marker 1 latlng position>)) 
    .include(new LatLng(<marker 2 latlng position>)) 
    .build(); 

mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, 50)); 

Teşekkür bu cevabı :)

İlgili konular