Search in sources :

Example 11 with RouteLeg

use of com.mapbox.api.directions.v5.models.RouteLeg in project mapbox-navigation-android by mapbox.

the class NavigationMapRoute method waypointFeatureCollection.

/**
 * The routes also display an icon for each waypoint in the route, we use symbol layers for this.
 */
private static FeatureCollection waypointFeatureCollection(DirectionsRoute route) {
    final List<Feature> waypointFeatures = new ArrayList<>();
    for (RouteLeg leg : route.legs()) {
        waypointFeatures.add(getPointFromLineString(leg, 0));
        waypointFeatures.add(getPointFromLineString(leg, leg.steps().size() - 1));
    }
    return FeatureCollection.fromFeatures(waypointFeatures);
}
Also used : ArrayList(java.util.ArrayList) RouteLeg(com.mapbox.api.directions.v5.models.RouteLeg) Feature(com.mapbox.services.commons.geojson.Feature)

Aggregations

RouteLeg (com.mapbox.api.directions.v5.models.RouteLeg)10 LegStep (com.mapbox.api.directions.v5.models.LegStep)3 BaseTest (com.mapbox.services.android.navigation.v5.BaseTest)2 Feature (com.mapbox.services.commons.geojson.Feature)2 Test (org.junit.Test)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 DirectionsResponse (com.mapbox.api.directions.v5.models.DirectionsResponse)1 DirectionsRoute (com.mapbox.api.directions.v5.models.DirectionsRoute)1 StepManeuver (com.mapbox.api.directions.v5.models.StepManeuver)1 RouteProgress (com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress)1 LineString (com.mapbox.services.commons.geojson.LineString)1 Point (com.mapbox.services.commons.geojson.Point)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1