コード例 #1
0
        void IBDLocationListener.OnReceiveLocation(BDLocation location)
        {
            if (location == null)
            {
                return;
            }
            //Resolver.Resolve<IUserDialogService> ().Alert ("receive dialog");
            MyLocationData locData = new MyLocationData.Builder()
                                     .Accuracy(location.Radius)
                                     // 此处设置开发者获取到的方向信息,顺时针0-360
                                     .Direction(100).Latitude(location.Latitude)
                                     .Longitude(location.Longitude).Build();

            mBaiduMap.SetMyLocationData(locData);
            LatLng cenpt = new LatLng(location.Latitude, location.Longitude);
            //定义地图状态
            MapStatus mMapStatus = new MapStatus.Builder()
                                   .Target(cenpt)
                                   .Zoom(14)
                                   .Build();
            //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
            //
            MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.NewMapStatus(mMapStatus);

            //改变地图状态
            mBaiduMap.SetMapStatus(mMapStatusUpdate);
        }
コード例 #2
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);
     }
 }