예제 #1
0
 private void OnShowRouteDetails(Route route)
 {
     _data.SelectedRoute.Value = route;
     _navigationService.Navigate<RouteDetailsViewModel>();
 }
예제 #2
0
        public static Route ToLocalRoute(this Codify.GoogleMaps.Entities.Route route)
        {
            if (route == null) throw new ArgumentNullException("route", "Cannot convert null Codify.GoogleMaps.Entities.Route to local Travlexer.Data.Route.");
            var newRoute = new Route();

            var legs = route.Legs;
            if (!legs.IsNullOrEmpty())
            {
                var leg = legs[0];
                newRoute.Distance = leg.Distance.Value;
                newRoute.Duration = leg.Duration.Value;

                var steps = leg.Steps;
                if (!steps.IsNullOrEmpty())
                {
                    var points = new Collection<Location>();
                    var routeSteps = new Collection<RouteStep>();
                    foreach (var step in steps)
                    {
                        points.AddRange(Utilities.DecodePolylinePoints(step.Polyline.Points));
                        routeSteps.Add(new RouteStep
                        {
                            Distance = step.Distance.Value,
                            Duration = step.Duration.Value,
                            Instruction = XmlTagRegex.Replace(DivTagRegex.Replace(step.HtmlInstructions, Environment.NewLine), string.Empty),
                            StartLocation = step.StartLocation.ToLocalLocation(),
                            EndLocation = step.EndLocation.ToLocalLocation()
                        });
                    }
                    newRoute.Points = points;
                    newRoute.Steps = routeSteps;
                }
            }

            return newRoute;
        }
예제 #3
0
 /// <summary>
 ///     Sets the map view to the optimal position for the specified route.
 /// </summary>
 /// <param name="route">The route.</param>
 private void SetViewForRoute(Route route)
 {
     var locations = route.Points;
     var coordinates = locations.Select(l => l.ToGeoCoordinate()).ToArray();
     if (!coordinates.Any())
     {
         return;
     }
     Map.SetView(LocationRect.CreateLocationRect(coordinates));
 }
예제 #4
0
파일: Route.cs 프로젝트: soleon/Travlexer
 public bool Equals(Route other)
 {
     if (ReferenceEquals(null, other))
     {
         return false;
     }
     if (ReferenceEquals(this, other))
     {
         return true;
     }
     int pointCount;
     return other.Method == Method
            && other.Mode == Mode
            && other.Points != null
            && Points != null
            && other.Points.Count == (pointCount = Points.Count)
            && other.Points[0] == Points[0]
            && other.Points[--pointCount] == Points[pointCount];
 }