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 - Initial CameraPosition API
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.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,53 @@ | ||
package com.mapbox.mapboxsdk.camera; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
|
||
public class CameraPosition { | ||
|
||
/** | ||
* Direction that the camera is pointing in, in degrees clockwise from north. | ||
*/ | ||
public final float bearing; | ||
|
||
/** | ||
* The location that the camera is pointing at. | ||
*/ | ||
public 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. | ||
*/ | ||
public final float tilt; | ||
|
||
/** | ||
* Zoom level near the center of the screen. See zoom(float) for the definition of the camera's zoom level. | ||
*/ | ||
public final float zoom; | ||
|
||
/** | ||
* | ||
* Constructs a CameraPosition. | ||
* @param target The target location to align with the center of the screen. | ||
* @param zoom Zoom level at target. See zoom(float) for details of restrictions. | ||
* @param tilt The camera angle, in degrees, from the nadir (directly down). See tilt(float) for details of restrictions. | ||
* @param bearing Direction that the camera is pointing in, in degrees clockwise from north. This value will be normalized to be within 0 degrees inclusive and 360 degrees exclusive. | ||
* @throws NullPointerException if target is null | ||
* @throws IllegalArgumentException if tilt is outside the range of 0 to 90 degrees inclusive. | ||
*/ | ||
public CameraPosition (LatLng target, float zoom, float tilt, float bearing) throws NullPointerException, IllegalArgumentException{ | ||
super(); | ||
if (target == null) { | ||
throw new NullPointerException("target is NULL"); | ||
} | ||
this.target = target; | ||
|
||
if (tilt < 0.0f || tilt > 90.0f) { | ||
throw new IllegalArgumentException("tilt is outside of 0 to 90 degrees range"); | ||
} | ||
this.tilt = tilt; | ||
|
||
this.bearing = bearing; | ||
this.zoom = zoom; | ||
} | ||
|
||
} |