This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] #2805 - CameraUpdate and animateCamera() API
- Loading branch information
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.mapbox.mapboxsdk.camera; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
|
||
public final class CameraUpdate { | ||
|
||
/** | ||
* Direction that the camera is pointing in, in degrees clockwise from north. | ||
*/ | ||
private final float bearing; | ||
|
||
/** | ||
* The location that the camera is pointing at. | ||
*/ | ||
private final LatLng target; | ||
|
||
/** | ||
* The angle, in degrees, of the camera angle from the nadir (directly facing the Earth). See tilt(float) for details of restrictions on the range of values. | ||
*/ | ||
private final float tilt; | ||
|
||
/** | ||
* Zoom level near the center of the screen. See zoom(float) for the definition of the camera's zoom level. | ||
*/ | ||
private final float zoom; | ||
|
||
/** | ||
* Package Private Constructor to only be used CameraUpdateFactory | ||
* @param bearing Final Bearing | ||
* @param target Final Target | ||
* @param tilt Final Tilt | ||
* @param zoom Final Zoom | ||
*/ | ||
CameraUpdate(float bearing, LatLng target, float tilt, float zoom) { | ||
this.bearing = bearing; | ||
this.target = target; | ||
this.tilt = tilt; | ||
this.zoom = zoom; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...oid/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.mapbox.mapboxsdk.camera; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CameraUpdateFactory { | ||
|
||
/** | ||
* Returns a CameraUpdate that moves the camera to a specified CameraPosition. | ||
* @param cameraPosition Camera Position to change to | ||
* @return CameraUpdate Final Camera Position data | ||
*/ | ||
public static CameraUpdate newCameraPosition (@NonNull CameraPosition cameraPosition) { | ||
return new CameraUpdate(cameraPosition.bearing, cameraPosition.target, cameraPosition.tilt, cameraPosition.zoom); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters