Versions Compared

Key

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

The core component of Navmii SDK responsible for visualization of route-related data is NMRouteVisualizer. This class provides the API to render routes, alternative routes and waypoint markers on map.

CREATING ROUTE VISUALIZER

NMSdk class contains the routeVisualizer property providing access to the instance of route visualizer. The route visualizer instance can be accessed only after the SDK was started.

VISUALIZING THE DATA

NMRouteVisualizer class has the performRequest: method which allows to execute a route-related data visualization request. The specified request parameter contains data to visualize.

...

  • set or remove an active route (active route polyline is rendered with route color and traffic is displayed on it);
  • set or remove any number of alternative routes (alternative routes are rendered with grey color and traffic is displayed on it);
  • set or remove route waypoint markers, including special markers for start and finish points.

CREATING ROUTE VISUALIZATION REQUEST

Navmii SDK contains the NMRouteVisualizerRequest class which should be used to create requests configured to render the required data on map.

...

Tip

If possible, try to create a single request configured to perform all the required actions rather than creating a new request for each action. The less often the performRequest: method of NMRouteVisualizer is called, the better.

VISUALIZING ROUTES

The NMRouteVisualizerRequest class contains the requestDisplayingPolylineOfRoute: method which allows to create an NMRouteVisualizerRequest instance configured so that the new request, in addition to the previously configured actions, will display the active route polyline on map. The route parameter is an instance of NMRoute class which is used to get a polyline to render. The active route polyline is rendered with the route color (magenta by default). You can change it using the routeLineColor property of NMMapView. Traffic is displayed on the route polyline if the route contains it.

...

The requestRemovingRoutePolyline and requestRemovingAlternativeRoutePolylines methods allow to create an NMRouteVisualizerRequest instance configured so that the new request, in addition to the previously configured actions, will remove the active and the alternative route polylines respectively.

VISUALIZING WAYPOINT MARKERS

The NMRouteVisualizerRequest contains the requestDisplayingWaypointMarkersAtCoordinates:consideringFirstOneAsStart: method which allows to render waypoint markers on map. The coordinates parameter specifies an array of waypoint marker coordinates. Each coordinate is an instance of NMMapCoordinates class. The special finish marker (black-and-white flag) is used for the last waypoint. The special start marker (blue flag) is used for the first waypoint if YES is specified for the consideringFirstOneAsStart parameter, otherwise the regular waypoint marker (yellow flag) is used. The regular marker is also used for all other waypoints.

The requestRemovingWaypointMarkers method allows to create an NMRouteVisualizerRequest instance configured so that the new request, in addition to the previously configured actions, will remove all the waypoint markers from map.

ROUTE VISUALIZER BINDING

NMRouteVisualizer class conforms to the NMRouteVisualizerRequestListener protocol which allows to bind it to a source of route visualizer requests. The only source of route visualizer requests in Navmii SDK is NMRouteNavigator class, which is able to render the route being navigated. To achieve such a behaviour you need to connect the route visualizer (routeVisualizer property of NMSdk) to the route navigator (routeNavigator property of NMSdk) using addRouteVisualizerRequestListener: method of NMRouteNavigatorYou are also able to implement your own route visualizer request source if you need to.

...