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 NMRouteVisualizerRequestBuilder class which should be used to create immutable NMRouteVisualizerRequest instances configured to render 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

NMRouteVisualizerRequestBuilder class has the setRoutePolylineFromRoute: method which allows to render the active route polyline on map. The route parameter is an instance of NMRoute class which is used to get polyline to render. Active route polyline is rendered with route color. Traffic is displayed on route polyline if the route contains it.

...

The clearRoutePolyline and clearAlternativeRoutePolylines methods allow to remove the active and the alternative route polylines respectively.

VISUALIZING WAYPOINT MARKERS

NMRouteVisualizerRequestBuilder has the setWaypointMarkersAtCoordinates: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 clearWaypointMarkers method allows to clear waypoint markers on map.

ROUTE VISUALIZER BINDING

NMRouteVisualizer class conforms to the NMRouteVisualizerRequestListener protocol which allows to bind it to route visualizer request source. The only source of route visualizer request in Navmii SDK is NMRouteNavigator class which automatically renders route being navigated on map. You are able to implement your own route visualizer request source if you need to.

...