示例#1
0
 private void UpdateCenter()
 {
     if (NativeMap.Map != null)
     {
         var locData = new MyLocationData.Builder().Latitude(Map.Center.Latitude).Longitude(Map.Center.Longitude).Build();
         NativeMap.Map.AnimateMapStatus(MapStatusUpdateFactory.NewLatLng(Map.Center.ToNative()));
         NativeMap.Map.SetMyLocationData(locData);
     }
 }
示例#2
0
        private void InitView()
        {
            //设置标题栏

            var img_header_back = FindViewById <ImageView> (Resource.Id.img_header_back);

            img_header_back.Click += (sender, e) =>
            {
                this.Finish();
                OverridePendingTransition(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
            };
            var bundle        = Intent.Extras;
            var alarmPosition = bundle.GetString("alarmPosition");

            if (!string.IsNullOrEmpty(alarmPosition) && alarmPosition.Contains(","))
            {
                var Positions = alarmPosition.Split(new char[] { ',' });
                nPosition = Convert.ToDouble(Positions [0].Substring(1));
                ePosition = Convert.ToDouble(Positions [1].Substring(1));
            }

            var tv_back = FindViewById <TextView> (Resource.Id.tv_back);

            tv_back.Text = "报警详细";
            var tv_desc = FindViewById <TextView> (Resource.Id.tv_desc);

            tv_desc.Text = "报警位置显示";

            mMapView      = FindViewById <MapView> (Resource.Id.bmap_view);
            bdMap         = mMapView.Map;
            bdMap.MapType = BaiduMap.MapTypeNormal;
            LatLng sourceLatLng = new LatLng(nPosition, ePosition);
            // 将GPS设备采集的原始GPS坐标转换成百度坐标
            CoordinateConverter converter = new CoordinateConverter();

            converter.From(Com.Baidu.Mapapi.Utils.CoordinateConverter.CoordType.Gps);
            // sourceLatLng待转换坐标
            converter.Coord(sourceLatLng);
            LatLng desLatLng = converter.Convert();
            //构建MarkerOption,用于在地图上添加Marker
            //构建Marker图标
            BitmapDescriptor bitmap = BitmapDescriptorFactory
                                      .FromResource(Resource.Drawable.ic_map);
            OverlayOptions option = new MarkerOptions().InvokePosition(desLatLng).InvokeIcon(bitmap).Draggable(true).InvokeZIndex(9);

            //在地图上添加Marker,并显示
            bdMap.AddOverlay(option);
            // 将地图移动到覆盖物位置
            MapStatusUpdate u = MapStatusUpdateFactory.NewLatLng(desLatLng);

            bdMap.SetMapStatus(u);
        }
示例#3
0
 void UpdateCenter()
 {
     NativeMap.Map.AnimateMapStatus(
         MapStatusUpdateFactory.NewLatLng(Map.Center.ToNative())
         );
 }