Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There is a way to customise an appearance for both, main and alternate route polylines on the map by setting NMRouteDisplayParameters object to NMRouteVisualizerRequest.requestDisplayingPolylineAndWaypointsOfRoute and RouteVisualizerRequest.requestDisplayingPolylinesOfAlternativeRoutes methods.

The following settings can be changed:

  • Minimum route polyline width;

  • maximum route polyline width;

  • route color;

  • if a halo should be displayed around the route polyline (its color can also be specified);

  • if direction arrows should be shown on the main route;

  • if waypoint flags should be shown;

  • if traffic overlay should be shown on route polylines;

  • markers used to represent waypoints (start, finish and intermediate stops).

If NMRouteDisplayParameters object is null, the default settings will be used.

Here is an example of route customisation:

Code Block
NMRouteDisplayParameters *routeDisplayParams = [NMRouteDisplayParameters new];
routeDisplayParams.minRouteWidth = [NSNumber numberWithFloat:10];
routeDisplayParams.maxRouteWidth = [NSNumber numberWithFloat:50];
routeDisplayParams.routeColor = [UIColor blueColor];
routeDisplayParams.showRouteHalo = [NSNumber numberWithBool:YES];
routeDisplayParams.routeHaloColor = [UIColor blackColor];
routeDisplayParams.startMarker = [[NMRouteMarker alloc] initWithAnchorPoint:CGPointMake(0.5,0.5) image:[UIImage imageNamed:@"yellow_flag"]];
routeDisplayParams.finishMarker = [[NMRouteMarker alloc] initWithAnchorPoint:CGPointMake(0.5,0.5) image:[UIImage imageNamed:@"yellow_flag"]];

NMRouteVisualizerRequest *request = [[NMRouteVisualizerRequest alloc] init];
[request requestDisplayingPolylineOfRoute:selectedRoute parameters:routeDisplayParams];
[request requestDisplayingPolylinesOfAlternativeRoutes:nonSelectedRoutes parameters:routeDisplayParameters];

[navmiiSDK.routeVisualizer performRequest:request];

The next capture depicts the route builded with selected parameters:

...

To use custom road markers an NMRouteMarker object should be specified.

Code Block
NMRouteMarker *startMarker = [[NMRouteMarker alloc] initWithAnchorPoint:CGPointMake(0.5,0.5) image:[UIImage imageNamed:@"start_marker"]];
routeDisplayParams.startMarker = startMarker;

In case of null, the default marker will be used. Anchor point provides a marker’s location, (0.0, 0.0) is for the top left corner, (1.0, 1.0) is for the bottom right corner. 

Warning

start_marker, finish_market and yellow_flag icons only exist in the sample application only.