예제 #1
0
 private void Render(ICanvasWriter canvasWriter)
 {
     canvasWriter.DrawVehicles(m_Simulation.Vehicles.Select(v => new VehicleDisplay
     {
         Guid        = v.Guid,
         CentrePoint = m_SimulationToCanvasMapping.Convert(v.CentrePoint),
         Size        = m_SimulationToCanvasMapping.Convert(v.Size),
         Heading     = v.Heading
     }).ToList());
 }
예제 #2
0
        public void Converter(BaiduMaps.Map map, double lat, double lng)
        {
            try
            {
                //初始化坐标转换工具类,指定源坐标类型和坐标数据
                CoordinateConverter converter = new CoordinateConverter()
                                                .From(CoordinateConverter.CoordType.Gps)
                                                .Coord(new Com.Baidu.Mapapi.Model.LatLng(lat, lng));

                //desLatLng 转换后的坐标
                var lct = converter.Convert();

                if (map != null && lct != null)
                {
                    if (lct.Latitude > 0 && lct.Longitude > 0)
                    {
                        map.Center = new Coordinate(lct.Latitude, lct.Longitude);
                        map.SendStatusChanged(lct.Latitude, lct.Longitude);
                    }
                }

                if (lct != null && lct.Latitude > 0 && lct.Longitude > 0)
                {
                    GlobalSettings.UpdatePoi(lct.Latitude, lct.Longitude);
                }
            }
            catch (Exception) { }
        }
예제 #3
0
        public void Converter(double lat, double lng)
        {
            //初始化坐标转换工具类,指定源坐标类型和坐标数据
            CoordinateConverter converter = new CoordinateConverter()
                                            .From(CoordinateConverter.CoordType.Gps)
                                            .Coord(new Com.Baidu.Mapapi.Model.LatLng(lat, lng));
            //desLatLng 转换后的坐标
            var lct = converter.Convert();

            System.Diagnostics.Debug.Print($"{lct.Latitude} {lct.Longitude}");
            GlobalSettings.UpdatePoi(lct.Latitude, lct.Longitude);
        }
예제 #4
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);
        }
예제 #5
0
        public void Converter(double lat, double lng)
        {
            //初始化坐标转换工具类,指定源坐标类型和坐标数据
            CoordinateConverter converter = new CoordinateConverter()
                                            .From(CoordinateConverter.CoordType.Gps)
                                            .Coord(new Com.Baidu.Mapapi.Model.LatLng(lat, lng));

            //desLatLng 转换后的坐标
            var lct = converter.Convert();

            if (lct != null && lct.Latitude > 0 && lct.Longitude > 0)
            {
                GlobalSettings.UpdatePoi(lct.Latitude, lct.Longitude);
            }
        }
		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);

		}
예제 #7
0
        /// <summary>
        /// 把一個明眼字元轉換成點字(BrailleWord)。
        /// 原則上,能夠在這裡處理掉點字特殊規則的,就盡量在這裡處理掉,
        /// 特別是不可斷行分開的點字,例如:一個中文字的所有點字碼、特殊單音字附加的「ㄦ」等等。
        /// </summary>
        /// <param name="reader">字串流。</param>
        /// <returns>若成功轉換成點字,則傳回已轉換的點字 BrailleWord 物件串列,否則傳回 null。</returns>
        /// <remarks>若轉換成功,則已轉換的字元會從串流中讀出,否則該字元仍會保留在串流中。</remarks>
        public List <BrailleWord> ConvertWord(Stack <char> chars)
        {
            List <BrailleWord> brWordList = null;

            // Two-pass 處理(因為有些點字必須再交給其它點字轉換器,故需兩次)。
            for (int pass = 0; pass < 2; pass++)
            {
                if (chars.Count < 1)
                {
                    break;
                }

                // 1. 轉換情境標籤。NOTE: 情境標籤一定要先處理!
                if (chars.Count > 0 && m_ContextTagConverter != null)
                {
                    brWordList = m_ContextTagConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }

                // 2. 轉換座標符號
                if (chars.Count > 0 && m_CoordConverter != null && m_ContextTagManager.IsActive(ContextTagNames.Coordinate))
                {
                    brWordList = m_CoordConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }

                // 3. 轉換數學符號。
                if (chars.Count > 0 && m_ContextTagManager.IsActive(ContextTagNames.Math) && m_MathConverter != null)
                {
                    brWordList = m_MathConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }

                // 4. 轉換表格符號。
                if (chars.Count > 0 && m_ContextTagManager.IsActive(ContextTagNames.Table) && m_TableConverter != null)
                {
                    brWordList = m_TableConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }

                // 5. 轉換音標符號.
                if (chars.Count > 0 && m_ContextTagManager.IsActive(ContextTagNames.Phonetic) && m_PhoneticConverter != null)
                {
                    brWordList = m_PhoneticConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }

                // 6. 轉換中文。
                if (chars.Count > 0 && m_ChineseConverter != null)
                {
                    // 若成功轉換成點字,就不再 pass 給其它轉換器。
                    brWordList = m_ChineseConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }

                // 7. 轉換英文。
                if (chars.Count > 0 && m_EnglishConverter != null)
                {
                    // 若成功轉換成點字,就不再 pass 給其它轉換器。
                    brWordList = m_EnglishConverter.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }
            }

            if (chars.Count > 0)
            {
                // 其它註冊的轉換器。
                foreach (WordConverter cvt in m_Converters)
                {
                    // 若其中一個轉換器成功轉換成點字,就不再 pass 給其它轉換器。
                    brWordList = cvt.Convert(chars, m_ContextTagManager);
                    if (brWordList != null && brWordList.Count > 0)
                    {
                        return(brWordList);
                    }
                }
            }

            // TODO: 碰到無法轉換成點字的情況時,觸發事件通知呼叫端處理,例如:顯示在在訊息視窗裡。

            return(null);
        }
예제 #8
0
        public String Get(String dcm)
        {
            var dc = coordinateConverter.Convert(dcm);

            return("DD: " + dc.ToString());
        }