Search in sources :

Example 1 with NavigationMapRoute

use of com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute in project mapbox-navigation-android by mapbox.

the class MockNavigationActivity method onMapReady.

@Override
public void onMapReady(MapboxMap mapboxMap) {
    this.mapboxMap = mapboxMap;
    locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
    locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);
    navigationMapRoute = new NavigationMapRoute(navigation, mapView, mapboxMap);
    mapboxMap.addOnMapClickListener(this);
    Snackbar.make(mapView, "Tap map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show();
    locationEngine = new MockLocationEngine(1000, 50, true);
    mapboxMap.setLocationSource(locationEngine);
    newOrigin();
}
Also used : LocationLayerPlugin(com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin) NavigationMapRoute(com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute) MockLocationEngine(com.mapbox.services.android.navigation.v5.location.MockLocationEngine)

Example 2 with NavigationMapRoute

use of com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute in project mapbox-navigation-android by mapbox.

the class NavigationViewActivity method initMapRoute.

private void initMapRoute() {
    mapRoute = new NavigationMapRoute(mapView, mapboxMap);
    mapRoute.setOnRouteSelectionChangeListener(this);
}
Also used : NavigationMapRoute(com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute)

Example 3 with NavigationMapRoute

use of com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute in project mapbox-navigation-android by mapbox.

the class NavigationView method initRoute.

/**
 * Initializes the {@link NavigationMapRoute} to be used to draw the
 * route.
 */
private void initRoute() {
    int routeStyleRes = ThemeSwitcher.retrieveNavigationViewStyle(getContext(), R.attr.navigationViewRouteStyle);
    mapRoute = new NavigationMapRoute(null, mapView, map, routeStyleRes);
}
Also used : NavigationMapRoute(com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute) Point(com.mapbox.geojson.Point)

Example 4 with NavigationMapRoute

use of com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute in project mapbox-navigation-android by mapbox.

the class NavigationMapRouteActivity method onMapReady.

@Override
public void onMapReady(MapboxMap mapboxMap) {
    this.mapboxMap = mapboxMap;
    navigationMapRoute = new NavigationMapRoute(null, mapView, mapboxMap, "admin-3-4-boundaries-bg");
    Gson gson = new GsonBuilder().registerTypeAdapterFactory(DirectionsAdapterFactory.create()).create();
    DirectionsResponse response = gson.fromJson(loadJsonFromAsset(DIRECTIONS_RESPONSE), DirectionsResponse.class);
    navigationMapRoute.addRoute(response.routes().get(0));
    mapboxMap.setOnMapLongClickListener(this);
    navigationMapRoute.setOnRouteSelectionChangeListener(this);
}
Also used : NavigationMapRoute(com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute) GsonBuilder(com.google.gson.GsonBuilder) Gson(com.google.gson.Gson) DirectionsResponse(com.mapbox.api.directions.v5.models.DirectionsResponse)

Aggregations

NavigationMapRoute (com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute)4 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 DirectionsResponse (com.mapbox.api.directions.v5.models.DirectionsResponse)1 Point (com.mapbox.geojson.Point)1 LocationLayerPlugin (com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin)1 MockLocationEngine (com.mapbox.services.android.navigation.v5.location.MockLocationEngine)1