MapOptions.RouteHighlightColor Property
The highlight color (RouteHighlightColor enumeration) to use for a route (other than construction areas). Default is DefaultColor (green).
Public Dim RouteHighlightColor As [Namespace].RouteHighlightColor
Member of [Namespace].MapOptions
[C#]
public [Namespace].RouteHighlightColor RouteHighlightColor
Member of [Namespace].MapOptions
Remarks
- MapPoint Web Service determines where to apply the RouteHighlightColor property based on a Direction.Action property value of anything other than ConstructionDelay or ConstructionStop.
- Highlight colors for construction areas are set in the ConstructionClosureHighlightColor and ConstructionDelayHighlightColor properties.
Example
[Visual Basic]
'This example assumes that the service instances
''routeService' and 'renderService' have already
'been created and that the MapPoint Web Service namespace
'has been imported
'Route between two locations
Dim latLongs(1) As LatLong
latLongs(0) = New LatLong()
latLongs(1) = New LatLong()
latLongs(0).Latitude = 40
latLongs(0).Longitude = -120
latLongs(1).Latitude = 41
latLongs(1).Longitude = -121
Dim myRoute As Route
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest)
'Get a map of the route, changing the route highlight colors
Dim myRouteViews(0) As ViewByHeightWidth
myRouteViews(0) = myRoute.Itinerary.View.ByHeightWidth
Dim mapSpec As New MapSpecification()
mapSpec.DataSourceName = "MapPoint.NA"
mapSpec.Route = myRoute
mapSpec.Views = myRouteViews
mapSpec.Options = New MapOptions()
mapSpec.Options.ConstructionClosureHighlightColor = RouteHighlightColor.Green
mapSpec.Options.ConstructionDelayHighlightColor = RouteHighlightColor.Red
mapSpec.Options.RouteHighlightColor = RouteHighlightColor.Cyan
Dim myMaps() As MapImage
myMaps = renderService.GetMap(mapSpec)
[C#]
//This example assumes that the service instances
//'routeService' and 'renderService' have already
//been created and that the MapPoint Web Service namespace
//has been imported
//Route between two locations
LatLong[] latLongs = new LatLong[2];
latLongs[0] = new LatLong();
latLongs[1] = new LatLong();
latLongs[0].Latitude = 40;
latLongs[0].Longitude = -120;
latLongs[1].Latitude = 41;
latLongs[1].Longitude = -121;
Route myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Quickest);
//Get a map of the route, changing the route highlight colors
ViewByHeightWidth[] myRouteViews = new ViewByHeightWidth[1];
myRouteViews[0] = myRoute.Itinerary.View.ByHeightWidth;
MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Route = myRoute;
mapSpec.Views = myRouteViews;
mapSpec.Options = new MapOptions();
mapSpec.Options.ConstructionClosureHighlightColor = RouteHighlightColor.Green;
mapSpec.Options.ConstructionDelayHighlightColor = RouteHighlightColor.Red;
mapSpec.Options.RouteHighlightColor = RouteHighlightColor.Cyan;
MapImage[] myMaps = renderService.GetMap(mapSpec);
See Also
MapOptions Class | RouteHighlightColor Enumeration | Direction.Action Property