use of com.mapbox.services.android.navigation.v5.location.MockLocationEngine 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();
}
use of com.mapbox.services.android.navigation.v5.location.MockLocationEngine in project mapbox-navigation-android by mapbox.
the class LocationViewModel method activateMockLocationEngine.
/**
* Activates a new {@link MockLocationEngine} with the given
* {@link DirectionsRoute}.
*
* @param route to be mocked
*/
private void activateMockLocationEngine(DirectionsRoute route) {
LocationEngine locationEngine = new MockLocationEngine(1000, 30, false);
((MockLocationEngine) locationEngine).setRoute(route);
locationEngine.activate();
this.locationEngine.setValue(locationEngine);
}
use of com.mapbox.services.android.navigation.v5.location.MockLocationEngine in project mapbox-navigation-android by mapbox.
the class MockNavigationActivity method newOrigin.
private void newOrigin() {
if (mapboxMap != null) {
LatLng latLng = Utils.getRandomLatLng(new double[] { -77.1825, 38.7825, -76.9790, 39.0157 });
((MockLocationEngine) locationEngine).setLastLocation(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12));
mapboxMap.setMyLocationEnabled(true);
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
}
}
use of com.mapbox.services.android.navigation.v5.location.MockLocationEngine in project mapbox-navigation-android by mapbox.
the class RerouteActivity method onMapReady.
@SuppressLint("MissingPermission")
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
mapboxMap.setOnMapClickListener(this);
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);
// Setup the mockLocationEngine
mockLocationEngine = new MockLocationEngine(1000, 30, false);
mockLocationEngine.addLocationEngineListener(this);
navigation.setLocationEngine(mockLocationEngine);
// Acquire the navigation route
getRoute(origin, destination, null);
}
Aggregations