com.mapbox.mapboxsdk.camera.CameraUpdateFactory Java Examples
The following examples show how to use
com.mapbox.mapboxsdk.camera.CameraUpdateFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyLocationMapActivity.java From AirMapSDK-Android with Apache License 2.0 | 6 votes |
private void zoomTo(Location location, boolean force) { // only zoom to user's location once if (!hasLoadedMyLocation || force) { // move map camera int duration = getMapView().getMap().getCameraPosition().zoom < 10 ? 2500 : 1000; getMapView().getMap().animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13), duration); // stop location requests locationComponent.getLocationEngine().removeLocationUpdates(new LocationEngineCallback<LocationEngineResult>() { @Override public void onSuccess(LocationEngineResult result) {} @Override public void onFailure(@NonNull Exception exception) {} }); hasLoadedMyLocation = true; // save location to prefs PreferenceManager.getDefaultSharedPreferences(this) .edit() .putFloat(AirMapConstants.LAST_LOCATION_LATITUDE, (float) location.getLatitude()) .putFloat(AirMapConstants.LAST_LOCATION_LONGITUDE, (float) location.getLongitude()) .apply(); } }
Example #2
Source File: MainActivity.java From WhereAreTheEyes with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void recenterCamera(View view) { mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { Location loc = gps.getLocation(); if( loc == null ) return; CameraPosition position = new CameraPosition.Builder() .target(new LatLng(loc.getLatitude(), loc.getLongitude())) .zoom(17) .bearing(0) .build(); mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), 3000); } }); }
Example #3
Source File: MainActivity.java From WhereAreTheEyes with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void recenterMap() { final Location l = gps.getLocation(); // This shouldn't normally happen, but does on the Android emulator. // It only occurs if recenterMap is called before we receive our first // gps ping. We normally receive a ping within a second or two of app // launch, but *not* if the emulator only pings on demand. if( l == null ) return; mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { // We'll maintain zoom level and tilt, just want to change position CameraPosition old = mapboxMap.getCameraPosition(); CameraPosition pos = new CameraPosition.Builder() .target(new LatLng(l.getLatitude(), l.getLongitude())) .zoom(old.zoom) .tilt(old.tilt) .build(); mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(pos)); } }); }
Example #4
Source File: PlacePickerActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Bind the device location Floating Action Button to this activity's UI and move the * map camera if the button's clicked. */ private void addUserLocationButton() { userLocationButton.show(); userLocationButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mapboxMap.getLocationComponent().getLastKnownLocation() != null) { Location lastKnownLocation = mapboxMap.getLocationComponent().getLastKnownLocation(); mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder() .target(new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude())) .zoom(17.5) .build() ),1400); } else { Toast.makeText(PlacePickerActivity.this, getString(R.string.mapbox_plugins_place_picker_user_location_not_found), Toast.LENGTH_SHORT).show(); } } }); }
Example #5
Source File: RegionSelectionFragment.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void onMapReady(final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { RegionSelectionFragment.this.style = style; mapboxMap.addOnCameraIdleListener(RegionSelectionFragment.this); if (options != null) { if (options.startingBounds() != null) { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(options.startingBounds(), 0)); } else if (options.statingCameraPosition() != null) { mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(options.statingCameraPosition())); } } } }); }
Example #6
Source File: LocalizationPlugin.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * You can pass in a {@link MapLocale} directly into this method which uses the country bounds * defined in it to represent the language found on the map. * * @param mapLocale the {@link MapLocale} object which contains the desired map bounds * @param padding camera padding * @since 0.1.0 */ public void setCameraToLocaleCountry(MapLocale mapLocale, int padding) { LatLngBounds bounds = mapLocale.getCountryBounds(); if (bounds == null) { throw new NullPointerException("Expected a LatLngBounds object but received null instead. Mak" + "e sure your MapLocale instance also has a country bounding box defined."); } mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding)); }
Example #7
Source File: AirMapMapView.java From AirMapSDK-Android with Apache License 2.0 | 5 votes |
private void zoomToFeatureIfNecessary(Feature featureClicked) { LatLngBounds cameraBounds = getMap().getProjection().getVisibleRegion().latLngBounds; LatLngBounds.Builder advisoryLatLngsBuilder = new LatLngBounds.Builder(); boolean zoom = false; Geometry geometry = featureClicked.geometry(); List<Point> points = new ArrayList<>(); if (geometry instanceof Polygon) { points.addAll(((Polygon) geometry).outer().coordinates()); } else if (geometry instanceof MultiPolygon) { List<Polygon> polygons = ((MultiPolygon) geometry).polygons(); for (Polygon polygon : polygons) { points.addAll(polygon.outer().coordinates()); } } for (Point position : points) { LatLng latLng = new LatLng(position.latitude(), position.longitude()); advisoryLatLngsBuilder.include(latLng); if (!cameraBounds.contains(latLng)) { Timber.d("Camera position doesn't contain point"); zoom = true; } } if (zoom) { int padding = Utils.dpToPixels(getContext(), 72).intValue(); getMap().moveCamera(CameraUpdateFactory.newLatLngBounds(advisoryLatLngsBuilder.build(), padding)); } }
Example #8
Source File: Container.java From AirMapSDK-Android with Apache License 2.0 | 5 votes |
public final void zoomTo(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) { try { Analytics.logDebug("latlngbound", getLatLngBoundsForZoom().toString()); map.animateCamera(CameraUpdateFactory.newLatLngBounds(getLatLngBoundsForZoom(), paddingLeft, paddingTop, paddingRight, paddingBottom), 200); } catch (Error err) { Analytics.logDebug("Container padding", paddingLeft + ", " + paddingTop + " , " + paddingRight + ", " + paddingBottom); Analytics.logDebug("Map padding", Arrays.toString(map.getPadding())); Analytics.report(new Exception("Latitude/Longitude must not be NaN: " + getLatLngBoundsForZoom().toString(), err)); Timber.e(err); } }
Example #9
Source File: PlacePickerActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 5 votes |
private void adjustCameraBasedOnOptions() { if (options != null) { if (options.startingBounds() != null) { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(options.startingBounds(), 0)); } else if (options.statingCameraPosition() != null) { mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(options.statingCameraPosition())); } } }
Example #10
Source File: BulkSymbolActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 5 votes |
private void initMap(MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.moveCamera( CameraUpdateFactory.newLatLngZoom( new LatLng(38.87031, -77.00897), 10 ) ); mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); symbolManager = new SymbolManager(mapView, mapboxMap, style); symbolManager.setIconAllowOverlap(true); loadData(0); }); }
Example #11
Source File: CompassView.java From mapwize-ui-android with MIT License | 5 votes |
public void setMapboxMap(@NonNull MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; this.mapboxMap.addOnCameraIdleListener(this); this.mapboxMap.addOnCameraMoveListener(this); this.setOnClickListener(view -> { if (onCompassClickListener != null) { onCompassClickListener.onClick(this); } this.mapboxMap.animateCamera(CameraUpdateFactory.bearingTo(0.0), 300); this.postDelayed(this, 300); }); this.onCameraMove(); }
Example #12
Source File: NavigationCamera.java From graphhopper-navigation-android with MIT License | 5 votes |
@NonNull private CameraUpdate buildOverviewCameraUpdate(int[] padding, List<Point> routePoints) { final LatLngBounds routeBounds = convertRoutePointsToLatLngBounds(routePoints); return CameraUpdateFactory.newLatLngBounds( routeBounds, padding[0], padding[1], padding[2], padding[3] ); }
Example #13
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
private void moveCameraOverhead() { if (lastLocation == null) { return; } CameraPosition cameraPosition = buildCameraPositionFrom(lastLocation, DEFAULT_BEARING); navigationMap.retrieveMap().animateCamera( CameraUpdateFactory.newCameraPosition(cameraPosition), TWO_SECONDS_IN_MILLISECONDS ); }
Example #14
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
private void moveCameraToInclude(Point destination) { LatLng origin = new LatLng(lastLocation); LatLngBounds bounds = new LatLngBounds.Builder() .include(origin) .include(new LatLng(destination.latitude(), destination.longitude())) .build(); Resources resources = getResources(); int routeCameraPadding = (int) resources.getDimension(R.dimen.component_navigation_route_camera_padding); int[] padding = {routeCameraPadding, routeCameraPadding, routeCameraPadding, routeCameraPadding}; CameraPosition cameraPosition = navigationMap.retrieveMap().getCameraForLatLngBounds(bounds, padding); navigationMap.retrieveMap().animateCamera( CameraUpdateFactory.newCameraPosition(cameraPosition), TWO_SECONDS_IN_MILLISECONDS ); }
Example #15
Source File: RerouteActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
@Override public void onProgressChange(Location location, RouteProgress routeProgress) { if (tracking) { locationLayerPlugin.forceLocationUpdate(location); CameraPosition cameraPosition = new CameraPosition.Builder() .zoom(15) .target(new LatLng(location.getLatitude(), location.getLongitude())) .bearing(location.getBearing()) .build(); mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 2000); } instructionView.update(routeProgress); }
Example #16
Source File: MockNavigationActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
private void newOrigin() { if (mapboxMap != null) { LatLng latLng = Utils.getRandomLatLng(new double[] {-77.1825, 38.7825, -76.9790, 39.0157}); ((ReplayRouteLocationEngine) locationEngine).assignLastLocation( Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()) ); mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12)); } }
Example #17
Source File: NavigationLauncherActivity.java From graphhopper-navigation-android with MIT License | 4 votes |
private void animateCamera(LatLng point) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_CAMERA_ZOOM), CAMERA_ANIMATION_DURATION); }
Example #18
Source File: MyLocationMapActivity.java From AirMapSDK-Android with Apache License 2.0 | 4 votes |
private void setupMapLoadListener() { mapLoadListener = new AirMapMapView.OnMapLoadListener() { @Override public void onMapLoaded() { if (hasLoadedMyLocation) { return; } // use saved location is there is one float savedLatitude = PreferenceManager.getDefaultSharedPreferences(MyLocationMapActivity.this) .getFloat(AirMapConstants.LAST_LOCATION_LATITUDE, 0); float savedLongitude = PreferenceManager.getDefaultSharedPreferences(MyLocationMapActivity.this) .getFloat(AirMapConstants.LAST_LOCATION_LONGITUDE, 0); if (savedLatitude != 0 && savedLongitude != 0) { getMapView().getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(savedLatitude, savedLongitude), 13)); } setupLocationEngine(getMapView().getMap()); } @Override public void onMapFailed(AirMapMapView.MapFailure failure) { switch (failure) { case INACCURATE_DATE_TIME_FAILURE: // record issue in firebase & logs Analytics.report(new Exception("Mapbox map failed to load due to invalid date/time")); Timber.e("Mapbox map failed to load due to invalid date/time"); // ask user to enable "Automatic Date/Time" new AlertDialog.Builder(MyLocationMapActivity.this) .setTitle(R.string.error_loading_map_title) .setMessage(R.string.error_loading_map_message) .setPositiveButton(R.string.error_loading_map_button, (dialog, which) -> { // open settings and kill this activity startActivity(new Intent(Settings.ACTION_DATE_SETTINGS)); finish(); }) .setNegativeButton(android.R.string.cancel, null) .show(); break; case NETWORK_CONNECTION_FAILURE: // record issue in firebase & logs String log = Utils.getMapboxLogs(); Analytics.report(new Exception("Mapbox map failed to load due to no network connection: " + log)); Timber.e("Mapbox map failed to load due to no network connection"); // check if dialog is already showing if (isMapFailureDialogShowing) { return; } // ask user to turn on wifi/LTE new AlertDialog.Builder(MyLocationMapActivity.this) .setTitle(R.string.error_loading_map_title) .setMessage(R.string.error_loading_map_network_message) .setPositiveButton(R.string.error_loading_map_network_button, (dialog, which) -> { isMapFailureDialogShowing = false; // open settings and kill this activity startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); finish(); }) .setNegativeButton(android.R.string.cancel, null) .setOnDismissListener(dialogInterface -> isMapFailureDialogShowing = false) .show(); isMapFailureDialogShowing = true; break; case UNKNOWN_FAILURE: default: // record issue in firebase & logs String logs = Utils.getMapboxLogs(); Analytics.report(new Exception("Mapbox map failed to load due to unknown reason: " + logs)); Timber.e("Mapbox map failed to load due to unknown reason: %s", logs); //TODO: show generic error to user? break; } } }; if (getMapView() != null) { getMapView().addOnMapLoadListener(mapLoadListener); } }
Example #19
Source File: NavigationCamera.java From graphhopper-navigation-android with MIT License | 4 votes |
@NonNull private CameraUpdate buildResetCameraUpdate() { CameraPosition resetPosition = new CameraPosition.Builder().tilt(0).bearing(0).build(); return CameraUpdateFactory.newCameraPosition(resetPosition); }
Example #20
Source File: DualNavigationMapActivity.java From graphhopper-navigation-android with MIT License | 4 votes |
private void animateCamera(LatLng point) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_CAMERA_ZOOM), CAMERA_ANIMATION_DURATION); }
Example #21
Source File: LineActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2)); lineManager = new LineManager(mapView, mapboxMap, style); lineManager.addClickListener(line -> { Toast.makeText(LineActivity.this, String.format("Line clicked %s", line.getId()), Toast.LENGTH_SHORT ).show(); return false; }); lineManager.addLongClickListener(line -> { Toast.makeText(LineActivity.this, String.format("Line long clicked %s", line.getId()), Toast.LENGTH_SHORT ).show(); return false; }); // create a fixed line List<LatLng> latLngs = new ArrayList<>(); latLngs.add(new LatLng(-2.178992, -4.375974)); latLngs.add(new LatLng(-4.107888, -7.639772)); latLngs.add(new LatLng(2.798737, -11.439207)); LineOptions lineOptions = new LineOptions() .withLatLngs(latLngs) .withLineColor(ColorUtils.colorToRgbaString(Color.RED)) .withLineWidth(5.0f); lineManager.create(lineOptions); // random add lines across the globe List<List<LatLng>> lists = new ArrayList<>(); for (int i = 0; i < 100; i++) { lists.add(createRandomLatLngs()); } List<LineOptions> lineOptionsList = new ArrayList<>(); for (List<LatLng> list : lists) { int color = Color.argb(255, random.nextInt(256), random.nextInt(256), random.nextInt(256)); lineOptionsList.add(new LineOptions().withLatLngs(list).withLineColor(ColorUtils.colorToRgbaString(color))); } lineManager.create(lineOptionsList); try { lineManager.create(Utils.INSTANCE.loadStringFromAssets(this, "annotations.json")); } catch (IOException e) { throw new RuntimeException("Unable to parse annotations.json"); } })); }
Example #22
Source File: DynamicSymbolChangeActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.setTag(false); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { DynamicSymbolChangeActivity.this.mapboxMap = mapboxMap; LatLng target = new LatLng(51.506675, -0.128699); mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder() .bearing(90) .tilt(40) .zoom(10) .target(target) .build() )); mapboxMap.setStyle(new Style.Builder() .fromUri(Style.MAPBOX_STREETS) .withImage(ID_ICON_1, generateBitmap(R.drawable.mapbox_ic_place), true) .withImage(ID_ICON_2, generateBitmap(R.drawable.mapbox_ic_offline), true) , style -> { symbolManager = new SymbolManager(mapView, mapboxMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); // Create Symbol SymbolOptions SymbolOptions = new SymbolOptions() .withLatLng(LAT_LNG_CHELSEA) .withIconImage(ID_ICON_1); symbol = symbolManager.create(SymbolOptions); }); }); FloatingActionButton fab = findViewById(R.id.fabStyles); fab.setVisibility(MapView.VISIBLE); fab.setOnClickListener(view -> { if (mapboxMap != null) { updateSymbol(); } }); }
Example #23
Source File: FillActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2)); fillManager = new FillManager(mapView, mapboxMap, style); fillManager.addClickListener(fill -> { Toast.makeText(FillActivity.this, String.format("Fill clicked %s with title: %s", fill.getId(), getTitleFromFill(fill)), Toast.LENGTH_SHORT ).show(); return false; }); fillManager.addLongClickListener(fill -> { Toast.makeText(FillActivity.this, String.format("Fill long clicked %s with title: %s", fill.getId(), getTitleFromFill(fill)), Toast.LENGTH_SHORT ).show(); return false; }); // create a fixed fill List<LatLng> innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng(-10.733102, -3.363937)); innerLatLngs.add(new LatLng(-19.716317, 1.754703)); innerLatLngs.add(new LatLng(-21.085074, -15.747196)); innerLatLngs.add(new LatLng(-10.733102, -3.363937)); List<List<LatLng>> latLngs = new ArrayList<>(); latLngs.add(innerLatLngs); FillOptions fillOptions = new FillOptions() .withLatLngs(latLngs) .withData(new JsonPrimitive("Foobar")) .withFillColor(ColorUtils.colorToRgbaString(Color.RED)); fillManager.create(fillOptions); // random add fills across the globe List<FillOptions> fillOptionsList = new ArrayList<>(); for (int i = 0; i < 3; i++) { int color = Color.argb(255, random.nextInt(256), random.nextInt(256), random.nextInt(256)); fillOptionsList.add(new FillOptions() .withLatLngs(createRandomLatLngs()) .withFillColor(ColorUtils.colorToRgbaString(color)) ); } fillManager.create(fillOptionsList); try { fillManager.create(FeatureCollection.fromJson(Utils.INSTANCE.loadStringFromAssets(this, "annotations.json"))); } catch (IOException e) { throw new RuntimeException("Unable to parse annotations.json"); } })); }
Example #24
Source File: LineChangeActivity.java From mapbox-plugins-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { mapboxMap.moveCamera( CameraUpdateFactory.newLatLngZoom( new LatLng(47.798202, 7.573781), 4) ); mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); lineManager = new LineManager(mapView, mapboxMap, style); lines = lineManager.create(getAllPolylines()); lineManager.addClickListener(line -> { Toast.makeText( LineChangeActivity.this, "Clicked: " + line.getId(), Toast.LENGTH_SHORT).show(); return false; }); LineManager dottedLineManger = new LineManager(mapView, mapboxMap, style); dottedLineManger.create(new LineOptions() .withLinePattern("airfield-11") .withLineWidth(5.0f) .withGeometry(LineString.fromLngLats(new ArrayList<Point>() {{ add(Point.fromLngLat(9.997167, 53.547476)); add(Point.fromLngLat(12.587986, 55.675313)); }}))); }); }); View fab = findViewById(R.id.fabStyles); fab.setVisibility(View.VISIBLE); fab.setOnClickListener(view -> { if (lineManager != null) { if (lines.size() == 1) { // test for removing annotation lineManager.delete(lines.get(0)); } else { // test for removing annotations lineManager.delete(lines); } } lines.clear(); lines.add(lineManager.create(getRandomLine())); }); }
Example #25
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 4 votes |
private void moveCameraTo(Location location) { CameraPosition cameraPosition = buildCameraPositionFrom(location, location.getBearing()); navigationMap.retrieveMap().animateCamera( CameraUpdateFactory.newCameraPosition(cameraPosition), TWO_SECONDS_IN_MILLISECONDS ); }
Example #26
Source File: NavigationLauncherActivity.java From graphhopper-navigation-example with Apache License 2.0 | 4 votes |
private void animateCamera(LatLng point) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_CAMERA_ZOOM), CAMERA_ANIMATION_DURATION); }
Example #27
Source File: NavigationLauncherActivity.java From graphhopper-navigation-example with Apache License 2.0 | 4 votes |
private void animateCameraBbox(LatLngBounds bounds, int animationTime, int[] padding) { CameraPosition position = mapboxMap.getCameraForLatLngBounds(bounds, padding); mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), animationTime); }
Example #28
Source File: NavigationLauncherActivity.java From graphhopper-navigation-android with MIT License | 4 votes |
private void animateCameraBbox(LatLngBounds bounds, int animationTime, int[] padding) { CameraPosition position = mapboxMap.getCameraForLatLngBounds(bounds, padding); mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), animationTime); }
Example #29
Source File: NavigationCamera.java From graphhopper-navigation-android with MIT License | 2 votes |
/** * Will ease the {@link MapboxMap} to the given {@link CameraPosition} with the given duration. * * @param position to which the camera should animate */ private void easeMapCameraPosition(CameraPosition position) { mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(position), obtainLocationUpdateDuration(), false, null); }
Example #30
Source File: NavigationCamera.java From graphhopper-navigation-android with MIT License | 2 votes |
/** * Will animate the {@link MapboxMap} to the given {@link CameraPosition} with the given duration. * * @param position to which the camera should animate * @param callback that will fire if the animation is cancelled or finished */ private void updateMapCameraPosition(CameraPosition position, MapboxMap.CancelableCallback callback) { mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), 1000, callback); }