Back to Devexpress

AzureRouteOptions.CustomParameters Property

windowsforms-devexpress-dot-xtramap-dot-azurerouteoptions-192cd5db.md

latest3.7 KB
Original Source

AzureRouteOptions.CustomParameters Property

Specifies additional route definitions.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(null)]
public Dictionary<string, string> CustomParameters { get; set; }
vb
<DefaultValue(Nothing)>
Public Property CustomParameters As Dictionary(Of String, String)

Property Value

TypeDefaultDescription
Dictionary<String, String>null

The dictionary that stores additional route definitions.

|

Remarks

Use this property to add route instructions and thus adjust route calculation.

The following code snippet allows the Azure Route service to rearrange waypoints passed to the AzureRouteDataProvider.CalculateRoute method to create an optimized route:

csharp
using DevExpress.XtraMap;
// ...
const string key = "your key";
// ...
AzureRouteDataProvider routeProvider = new AzureRouteDataProvider();
    routeProvider.AzureKey = key;
List<RouteWaypoint> waypoints = new List<RouteWaypoint>();
waypoints.Add(new RouteWaypoint("NY", new GeoPoint(41.145556, -73.995)));
waypoints.Add(new RouteWaypoint("Oklahoma", new GeoPoint(36.131389, -95.937222)));
waypoints.Add(new RouteWaypoint("Las Vegas", new GeoPoint(36.175, -115.136389)));
// Call the AzureRouteDataProvider.CalculateRoute method.
routeProvider.CalculateRoute(waypoints, new AzureRouteOptions() {
    TravelMode = AzureTravelMode.Car,
    AvoidTypes = AzureRouteAvoidType.None,
    CustomParameters = new Dictionary<string, string>() { { "computeBestOrder", "true" } }
});
vb
Imports DevExpress.XtraMap
' ...
Private Const key As String = "your key"
' ...
Private routeProvider As New AzureRouteDataProvider()
    routeProvider.AzureKey = key
Dim waypoints As New List(Of RouteWaypoint)()
waypoints.Add(New RouteWaypoint("NY", New GeoPoint(41.145556, -73.995)))
waypoints.Add(New RouteWaypoint("Oklahoma", New GeoPoint(36.131389, -95.937222)))
waypoints.Add(New RouteWaypoint("Las Vegas", New GeoPoint(36.175, -115.136389)))
' Call the AzureRouteDataProvider.CalculateRoute method.
routeProvider.CalculateRoute(waypoints, New AzureRouteOptions() With {
    .TravelMode = AzureTravelMode.Car,
    .AvoidTypes = AzureRouteAvoidType.None,
    .CustomParameters = New Dictionary(Of String, String)() From {
        { "computeBestOrder", "true" }
    }
})

See Also

AzureRouteOptions Class

AzureRouteOptions Members

DevExpress.XtraMap Namespace