public void OnGetSearchResult(CloudSearchResult result, int error) { if (result != null && result.PoiList != null && result.PoiList.Count > 0) { Log.Debug(LTAG, "onGetSearchResult, result length: " + result.PoiList.Count); mBaiduMap.Clear(); BitmapDescriptor bd = BitmapDescriptorFactory.FromResource(Resource.Drawable.icon_gcoding); LatLng ll; LatLngBounds.Builder builder = new LatLngBounds.Builder(); foreach (CloudPoiInfo info in result.PoiList) { ll = new LatLng(info.Latitude, info.Longitude); OverlayOptions oo = new MarkerOptions().InvokeIcon(bd).InvokePosition(ll); mBaiduMap.AddOverlay(oo); builder.Include(ll); } LatLngBounds bounds = builder.Build(); MapStatusUpdate u = MapStatusUpdateFactory.NewLatLngBounds(bounds); mBaiduMap.AnimateMapStatus(u); } }
public void OnGetSearchResult(CloudSearchResult result, int error) { if (result != null && result.PoiList != null && result.PoiList.Count > 0) { CloudOverlay poiOverlay = new CloudOverlay(this, mMapView); poiOverlay.SetData(result.PoiList); mMapView.Overlays.Clear(); mMapView.Overlays.Add(poiOverlay); mMapView.Refresh(); mMapView.Controller.AnimateTo(new GeoPoint((int)((result.PoiList)[0].Latitude * 1e6), (int)((result.PoiList)[0].Longitude * 1e6))); } }