Search in sources :

Example 26 with Feature

use of com.mapbox.services.commons.geojson.Feature in project mapbox-navigation-android by mapbox.

the class NavigationMapRoute method addTrafficToSource.

/**
 * If the {@link DirectionsRoute} request contains congestion information via annotations, breakup
 * the source into pieces so data-driven styling can be used to change the route colors
 * accordingly.
 */
private FeatureCollection addTrafficToSource(DirectionsRoute route, int index) {
    final List<Feature> features = new ArrayList<>();
    LineString originalGeometry = LineString.fromPolyline(route.geometry(), Constants.PRECISION_6);
    buildRouteFeatureFromGeometry(index, features, originalGeometry);
    routeLineStrings.put(originalGeometry, route);
    LineString lineString = LineString.fromPolyline(route.geometry(), Constants.PRECISION_6);
    buildTrafficFeaturesFromRoute(route, index, features, lineString);
    return FeatureCollection.fromFeatures(features);
}
Also used : LineString(com.mapbox.services.commons.geojson.LineString) ArrayList(java.util.ArrayList) Feature(com.mapbox.services.commons.geojson.Feature)

Aggregations

Feature (com.mapbox.services.commons.geojson.Feature)26 ArrayList (java.util.ArrayList)13 BusStop (cl.smartcities.isci.transportinspector.backend.BusStop)8 BusStopMarker (cl.smartcities.isci.transportinspector.map.model.busStop.BusStopMarker)7 Bitmap (android.graphics.Bitmap)4 NonNull (android.support.annotation.NonNull)4 View (android.view.View)4 BusMarker (cl.smartcities.isci.transportinspector.map.model.bus.BusMarker)4 ServerSentBus (cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)4 BusStopIconsBuilder (cl.smartcities.isci.transportinspector.map.model.busStop.BusStopIconsBuilder)3 IconBuilder (cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder)3 GenerateViewIconTask (cl.smartcities.isci.transportinspector.map.tasks.GenerateViewIconTask)3 PolylineOptions (com.mapbox.mapboxsdk.annotations.PolylineOptions)3 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)3 PointF (android.graphics.PointF)2 FavoriteHelper (cl.smartcities.isci.transportinspector.database.FavoriteHelper)2 BusClickHandler (cl.smartcities.isci.transportinspector.map.model.bus.BusClickHandler)2 BusStopClickHandler (cl.smartcities.isci.transportinspector.map.model.busStop.BusStopClickHandler)2 MultiLayerOnMapClickListener (cl.smartcities.isci.transportinspector.map.utils.MultiLayerOnMapClickListener)2 PeriodicRequestHandler (cl.smartcities.isci.transportinspector.periodicRequest.PeriodicRequestHandler)2