Skip to main content

BingRouteResult.RoutePath Property

Returns a list of geographical points that together, comprise the route path.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.1.dll

NuGet Package: DevExpress.Win.Map

Declaration

public List<GeoPoint> RoutePath { get; }

Property Value

Type Description
List<GeoPoint>

A list of GeoPoint objects.

Example

View Example

private void OnRouteCalculated(object sender, BingRouteCalculatedEventArgs e) {
    RouteCalculationResult result = e.CalculationResult;
    if((result.RouteResults == null) ||
        (result.ResultCode == RequestResultCode.BadRequest)) {
        rtbResults.Text = "The Bing Route service does not work for this location.";
        return;
    }

    StringBuilder resultList = new StringBuilder("");

    if(result.IntermediatePoints != null) {
        resultList.Append(String.Format("_________________________\n"));

        for(int i = 0; i < e.CalculationResult.IntermediatePoints.Count; i++)
            resultList.Append(
                String.Format("Starting point {0}: {1} ({2})\n",
                i + 1,
                e.CalculationResult.IntermediatePoints[i].Description,
                e.CalculationResult.IntermediatePoints[i].Location)
            );
    }

    if((result.RouteResults != null) & (result.ResultCode == RequestResultCode.Success)) {

        for(int rnum = 0; rnum < e.CalculationResult.RouteResults.Count; rnum++) {
            resultList.Append(String.Format("_________________________\n"));
            resultList.Append(String.Format("Path {0}:\n", rnum + 1));
            resultList.Append(String.Format(
                "Distance: {0}\n",
                e.CalculationResult.RouteResults[rnum].Distance
            ));
            resultList.Append(String.Format(
                "Time: {0}\n",
                e.CalculationResult.RouteResults[0].Time
            ));

            if(e.CalculationResult.RouteResults[rnum].Legs != null) {
                int legNum = 1;
                foreach(BingRouteLeg leg in e.CalculationResult.RouteResults[rnum].Legs) {
                    resultList.Append(String.Format("\tLeg {0}:\n", legNum++));
                    resultList.Append(String.Format("\tDistance: {0}\n", leg.Distance));
                    resultList.Append(String.Format("\tTime: {0}\n", leg.Time));
                    if(leg.Itinerary != null) {
                        foreach(BingItineraryItem itineraryItem in leg.Itinerary) {
                            resultList.Append(String.Format(itineraryItem.Maneuver + "\n"));
                            resultList.Append(String.Format(
                                "\t\tLocation: {0}\n",
                                itineraryItem.Location
                            ));
                        }
                    }
                }
            }
        }
    }
    rtbResults.Text = resultList.ToString();
}
See Also