RouteCalculationResult.RouteResults Property
Returns all routes calculated for this request.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
List<BingRouteResult> | A list of BingRouteResult objects. |
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();
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RouteResults property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
See Also