コード例 #1
0
        void FetchNearestPoints()
        {
            List <MapPoint> pts;

            using (var client = new MapPointProvider.Client(AppCommon.Inst.GetThriftProtocol(AppCommon.PortOffsets.MapPointProvider))) {
                pts = client.getMapPoint(true, LastLoc);
            }

            var ptDirs = pts.Take(3).Select(x => new PointDirection {
                Point = x
            }).ToList();
            var version = _version;

            PointDirections = ptDirs;

            // Draw routes only if current accuracy radius is less than a quarter of route distances
            // No point drawing non-sense route
            var curAccuracy = AppCommon.Inst.LocationProvider.CurLocInfo.Value.Accuracy;

            if (curAccuracy.HasValue && pts.Count > 0 && CommonUtils.GeoDistance(pts[0].Loc, LastLoc) > 3 * curAccuracy.Value)
            {
                foreach (var ptDir in ptDirs)
                {
                    AppCommon.Inst.DirectionsProvider.GetRoutesAsync(
                        str => {
                        ptDir.Direction = JsonConvert.DeserializeObject <JsDirection> (str);
                        OnEvent(DirectionAdded, new DirAddedEvtArg {
                            Version = version, PointDir = ptDir
                        });
                    }, AppCommon.Inst.LocationProvider.CurLocInfo.Value.Loc, ptDir.Point.Loc, DirectionsProvider.Walking);
                }
            }
        }
コード例 #2
0
        public void FetchNearestPoints(bool isSrc)
        {
            List <MapPoint> pts;

            using (var client = new MapPointProvider.Client(AppCommon.Inst.GetThriftProtocol(AppCommon.PortOffsets.MapPointProvider))) {
                pts = client.getMapPoint(isSrc, MapCentre);
            }
            var ptDirs = pts.Take(3).Select(x => new PointDirection {
                Point = x
            }).ToList();

            ResetPoints(ptDirs);

            foreach (var pd in ptDirs)
            {
                AppCommon.Inst.DirectionsProvider.GetRoutesAsync(
                    str => AddDirection(new PointDirection {
                    Point     = pd.Point,
                    Direction = JsonConvert.DeserializeObject <JsDirection> (str)
                }),
                    pd.Point.Loc, new GeoLoc {
                    Lat = MapCentre.Lat, Lng = MapCentre.Lng
                }, DirectionsProvider.Walking);
            }
        }
コード例 #3
0
		public void FetchNearestPoints (bool isSrc)
		{
			List<MapPoint> pts;
			using (var client = new MapPointProvider.Client (AppCommon.Inst.GetThriftProtocol (AppCommon.PortOffsets.MapPointProvider))) {
				pts = client.getMapPoint (isSrc, MapCentre);
			}
			var ptDirs = pts.Take(3).Select (x => new PointDirection { Point = x }).ToList();
			ResetPoints (ptDirs);

			foreach (var pd in ptDirs) {
				AppCommon.Inst.DirectionsProvider.GetRoutesAsync (
					str => AddDirection (new PointDirection { Point = pd.Point, 
						Direction = JsonConvert.DeserializeObject<JsDirection> (str)}),
					pd.Point.Loc, new GeoLoc { Lat = MapCentre.Lat, Lng = MapCentre.Lng }, DirectionsProvider.Walking);
			}
		}