Пример #1
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);
        }
Пример #2
0
 public bool OnMarkerClick(Marker marker)
 {
     Button button = new Button(overlayDemo.ApplicationContext);
     button.SetBackgroundResource(Resource.Drawable.popup);
     LatLng ll = marker.Position;// ����
     Point p = overlayDemo.mBaiduMap.Projection.ToScreenLocation(ll);
     p.Y -= 47;
     LatLng llInfo = overlayDemo.mBaiduMap.Projection.FromScreenLocation(p);
     InfoWindow.IOnInfoWindowClickListener listener = null;
     if (marker.Equals(overlayDemo.mMarkerA) || marker.Equals(overlayDemo.mMarkerD))
     {
         button.Text = "�����";
         listener = new IOnInfoWindowClickListenerImplA(this, ll, marker);
     }
     else if (marker.Equals(overlayDemo.mMarkerB))
     {
         button.Text = "����ͼ��";
         listener = new IOnInfoWindowClickListenerImplB(this, marker);
     }
     else if (marker.Equals(overlayDemo.mMarkerC))
     {
         button.Text = "ɾ��";
         listener = new IOnInfoWindowClickListenerImplC(this, marker);
     }
     overlayDemo.mInfoWindow = new InfoWindow(button, llInfo, listener);
     overlayDemo.mBaiduMap.ShowInfoWindow(overlayDemo.mInfoWindow);
     return true;
 }
Пример #3
0
 public IOnInfoWindowClickListenerImplC(IOnMarkerClickListenerImpl iOnMarkerClickListenerImpl, Marker marker)
 {
     this.iOnMarkerClickListenerImpl = iOnMarkerClickListenerImpl;
     this.marker = marker;
 }
Пример #4
0
 public IOnInfoWindowClickListenerImplA(IOnMarkerClickListenerImpl iOnMarkerClickListenerImpl, LatLng ll, Marker marker)
 {
     this.iOnMarkerClickListenerImpl = iOnMarkerClickListenerImpl;
     this.ll = ll;
     this.marker = marker;
 }
Пример #5
0
 public void OnGetReverseGeoCodeResult(ReverseGeoCodeResult result)
 {
     if (result == null || result.Error != SearchResult.ERRORNO.NoError)
     {
         Toast.MakeText(this, "��Ǹ��δ�ҵ����",
                 ToastLength.Long).Show();
         return;
     }
     mBaiduMap.Clear();
     mBaiduMap.SetOnMarkerClickListener(this);
     mAddrMarker = Android.Runtime.Extensions.JavaCast<Marker>(mBaiduMap.AddOverlay(new MarkerOptions()
             .InvokeIcon(BitmapDescriptorFactory
                     .FromResource(Resource.Drawable.icon_marka))
             .InvokeTitle(result.Address).InvokePosition(result.Location)));
 }
Пример #6
0
 public bool OnMarkerClick(Marker marker)
 {
     if (marker == mAddrMarker)
     {
         mShareUrlSearch
                 .RequestLocationShareUrl(new LocationShareURLOption()
                         .Location(marker.Position).Snippet("���Է����")
                         .Name(marker.Title));
     }
     return true;
 }