Esempio n. 1
0
        private RoutePoint GetNextPointOnRoute(GeoPosition position, Distance maxSkipDistance)
        {
            var last         = GetLastWayPoint();
            var skipDistance = 0d;

            foreach (var routePoint in _route.GetEnumerable(NextWaypoint, NavigationDirection))
            {
                var expectedPosition = MapExtensions.ClosestPositionBetweenPoints(last, routePoint, position);
                skipDistance += last.Distance(routePoint);

                if (VisitedWaypoints.Contains(routePoint) || skipDistance > maxSkipDistance.Miles)
                {
                    break;
                }

                if (IsOnRoute(expectedPosition, position))
                {
                    return(last);
                }

                last = routePoint;
            }

            return(null);
        }
Esempio n. 2
0
        private void ActivateNextWaypoint()
        {
            _distanceWalkedMiles += GetLastWayPoint().Distance(NextWaypoint);
            VisitedWaypoints.Add(RouteEnumerator.Current);

            if (!RouteEnumerator.MoveNext())
            {
                OnNavigationFinished();
            }
            NextWaypoint = RouteEnumerator.Current;
        }
Esempio n. 3
0
        private void UpdateMap(GeoPosition position, GeoPosition expectedPosition, bool onTrack)
        {
            var rotation = GetLastWayPoint().DegreeBearing(NextWaypoint);

            if (onTrack)
            {
                _mapView.CenterView(expectedPosition, -rotation);
            }
            else
            {
                _mapView.CenterView(position, 0);
            }


            _walkedPathLayer.UpdatePath(VisitedWaypoints.Append(expectedPosition));

            _positionLayer.Update(position, 0);
            _expectedPositionLayer.Update(expectedPosition, rotation);
        }
Esempio n. 4
0
 private RoutePoint GetLastWayPoint()
 {
     return(VisitedWaypoints.LastOrDefault());
 }