コード例 #1
0
        public void StartUserNavigation()
        {
            if (!CurrentUserStatus.CanNavigate)
            {
                return;
            }

            userNotified = false;

            Geoposition currentUserPosition = PushpinManager.GetCurrentUserPosition();
            IEnumerable <Geoposition> userRoutePositions = RouteManager.GetCurrentUserRoute();

            if (userRoutePositions == null || !userRoutePositions.Any())
            {
                return;
            }

            // now user has a route and start navigating
            CurrentUserStatus.AttendingIncidentId = FormsMap.CurrentIncident.Id;
            CurrentUserStatus.IsNavigating        = true;

            var route = new Route <UserRole>(userRoutePositions.ToArray());

            route.Element = null;
            route.AddStartPoint(currentUserPosition);
            route.Init();
            _routeUpdater.AddRoute(route);
        }
コード例 #2
0
        public async Task DrawRouteToIncident(IncidentModel incident)
        {
            Geoposition from = PushpinManager.GetCurrentUserPosition();

            if (from == default(Geoposition))
            {
                return;
            }

            Geoposition to = new Geoposition
            {
                Latitude  = incident.Latitude,
                Longitude = incident.Longitude
            };

            IEnumerable <Geoposition> routePositions = await CalculateRoute(from, to);

            DrawRouteInMap(routePositions);
        }