예제 #1
0
 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);
     }
 }
예제 #2
0
        public void InitOverlay()
        {
            // add marker overlay
            LatLng llA = new LatLng(39.963175, 116.400244);
            LatLng llB = new LatLng(39.942821, 116.369199);
            LatLng llC = new LatLng(39.939723, 116.425541);
            LatLng llD = new LatLng(39.906965, 116.401394);

            OverlayOptions ooA = new MarkerOptions().InvokePosition(llA).InvokeIcon(bdA)
                    .InvokeZIndex(9);
            mMarkerA = Android.Runtime.Extensions.JavaCast<Marker>(mBaiduMap.AddOverlay(ooA));
            OverlayOptions ooB = new MarkerOptions().InvokePosition(llB).InvokeIcon(bdB)
                    .InvokeZIndex(5);
            mMarkerB = Android.Runtime.Extensions.JavaCast<Marker>(mBaiduMap.AddOverlay(ooB));
            OverlayOptions ooC = new MarkerOptions().InvokePosition(llC).InvokeIcon(bdC)
                    .Perspective(false).Anchor(0.5f, 0.5f).InvokeRotate(30).InvokeZIndex(7);
            mMarkerC = Android.Runtime.Extensions.JavaCast<Marker>(mBaiduMap.AddOverlay(ooC));
            OverlayOptions ooD = new MarkerOptions().InvokePosition(llD).InvokeIcon(bdD)
                    .Perspective(false).InvokeZIndex(7);
            mMarkerD = Android.Runtime.Extensions.JavaCast<Marker>(mBaiduMap.AddOverlay(ooD));

            // add ground overlay
            LatLng southwest = new LatLng(39.92235, 116.380338);
            LatLng northeast = new LatLng(39.947246, 116.414977);
            LatLngBounds bounds = new LatLngBounds.Builder().Include(northeast)
                    .Include(southwest).Build();

            OverlayOptions ooGround = new GroundOverlayOptions()
                    .PositionFromBounds(bounds).InvokeImage(bdGround).InvokeTransparency(0.8f);
            mBaiduMap.AddOverlay(ooGround);

            MapStatusUpdate u = MapStatusUpdateFactory
                    .NewLatLng(bounds.Center);
            mBaiduMap.SetMapStatus(u);
        }