/// <summary> /// Request a route between two positions. /// 두 지점 사이의 route 요청 /// </summary> /// <param name="from">Specifies the starting position</param> /// <param name="to">Specifies the end position</param> public async void RequestRoute(Geocoordinates from, Geocoordinates to) { try { view = ViewPage.ROUTE_IN_PROGRESS; // Request a route with between two positions // 두 지점 사이의 route를 요청합니다. var response = await s_maps.CreateRouteSearchRequest(from, to).GetResponseAsync(); // Get the route // route 가져오기 IEnumerator <Route> route = response.GetEnumerator(); route.MoveNext(); if (view == ViewPage.ROUTE_IN_PROGRESS) { // Display the polylines after making it from the path of the route // route의 경로에서 polylines를 만든 후 표시합니다. s_mapview.Add(new Polyline((List <Geocoordinates>)route.Current.Path, ElmSharp.Color.Red, 5)); string distance; if (route.Current.Unit == DistanceUnit.Kilometer) { distance = string.Format("{0,10:N2}", route.Current.Distance); } else { distance = string.Format("{0,10:N2}", route.Current.Distance / 1000); } string duration = string.Format("{0,10:N2}", route.Current.Duration / 60); CreatePopup(distance + " km / " + duration + " min by car"); view = ViewPage.ROUTE; } } catch (Exception e) { // Display logs with the error message Log.Debug("Map", e.Message.ToString()); } }
/// <summary> /// Request a route between two positions. /// </summary> /// <param name="from">Specifies the starting position</param> /// <param name="to">Specifies the end position</param> public async void RequestRoute(Geocoordinates from, Geocoordinates to) { try { // Request a route with between two positions var response = await s_maps.CreateRouteSearchRequest(from, to).GetResponseAsync(); // Get the route IEnumerator <Route> route = response.GetEnumerator(); while (route.MoveNext()) { // Display the polylines after making it from the path of the route if (view == ViewPage.ROUTE) { s_mapview.Add(new Polyline((List <Geocoordinates>)route.Current.Path, Color.Red, 5)); } } } catch (Exception e) { // Display logs with the error message Log.Debug("Map", e.Message.ToString()); } }