Package com.mapbox.mapboxsdk.camera
Contains the Mapbox Maps Android Camera API classes.
Types
Name | Summary |
---|---|
CameraPosition | class CameraPosition : Parcelable Resembles the position, angle, zoom and tilt of the user’s viewpoint. |
CameraUpdate | interface CameraUpdate Interface definition for camera updates. |
CameraUpdateFactory | class CameraUpdateFactory Factory for creating CameraUpdate objects. |
CameraPosition
class CameraPosition : Parcelable
Resembles the position, angle, zoom and tilt of the user’s viewpoint.
Constructors
Name | Summary |
---|---|
CameraPosition | open fun CameraPosition(target: LatLng, zoom: Double, tilt: Double, bearing: Double, padding: Array |
Types
Name | Summary |
---|---|
Builder | class Builder Builder for composing CameraPosition objects. |
Functions
Name | Summary |
---|---|
describeContents | abstract fun describeContents(): Int open fun describeContents(): Int Describe the kinds of special objects contained in this Parcelable’smarshalled representation. |
equals | open fun equals(o: Any): Boolean Compares this CameraPosition object with another CameraPosition anddetermines if their target, zoom, tilt, and bearing match. |
hashCode | open fun hashCode(): Int Gives an integer which can be used as the bucket number for storing elements of the set/map.This bucket number is the address of the element inside the set/map. |
toString | open fun toString(): String Returns a String with the camera target, zoom, bearing and tilt. |
writeToParcel | abstract fun writeToParcel(p: Parcel, p1: Int) open fun writeToParcel(out: Parcel, flags: Int) Flatten this object in to a Parcel. |
Properties
Name | Summary |
---|---|
bearing | val bearing: DoubleDirection that the camera is pointing in, in degrees clockwise from north. |
CREATOR | val CREATOR: Parcelable.Creator<CameraPosition> |
DEFAULT | val DEFAULT: CameraPosition |
padding | val padding: Array |
target | val target: LatLngThe location that the camera is pointing at. |
tilt | val tilt: DoubleThe angle, in degrees, of the camera angle from the nadir (directly facing the Earth). |
zoom | val zoom: DoubleZoom level near the center of the screen. |
CREATOR
val CREATOR: Parcelable.Creator<CameraPosition>
DEFAULT
val DEFAULT: CameraPosition
bearing
val bearing: Double
Direction that the camera is pointing in, in degrees clockwise from north.
describeContents
open fun describeContents(): Int
Describe the kinds of special objects contained in this Parcelable’smarshalled representation.
Return
integer 0.
equals
open fun equals(o: Any): Boolean
Compares this CameraPosition object with another CameraPosition anddetermines if their target, zoom, tilt, and bearing match.
Return
True if target, zoom, tilt, and bearing match this CameraPosition object.Else, false.
Parameters
Name | Summary |
---|---|
o | Another CameraPosition to compare with this object. |
hashCode
open fun hashCode(): Int
Gives an integer which can be used as the bucket number for storing elements of the set/map.This bucket number is the address of the element inside the set/map. There’s no guaranteethat this hash value will be consistent between different Java implementations, or evenbetween different execution runs of the same program.
Return
integer value you can use for storing element.
padding
val padding: Array
Padding in pixels. Specified in left, top, right, bottom order.See padding for the definition of the camera’s padding.
target
The location that the camera is pointing at.
tilt
val tilt: Double
The angle, in degrees, of the camera angle from the nadir (directly facing the Earth).See tilt for details of restrictions on the range of values.
toString
open fun toString(): String
Returns a String with the camera target, zoom, bearing and tilt.
Return
A String with CameraPosition information.
writeToParcel
open fun writeToParcel(out: Parcel, flags: Int)
Flatten this object in to a Parcel.
Parameters
Name | Summary |
---|---|
out | The Parcel in which the object should be written. |
flags | Additional flags about how the object should be written. May be 0 orPARCELABLE_WRITE_RETURN_VALUE. |
zoom
val zoom: Double
Zoom level near the center of the screen. See zoom for the definition of the camera’szoom level.
Builder
class Builder
Builder for composing CameraPosition objects.
Constructors
Name | Summary |
---|---|
Builder | open fun Builder()Create an empty builder. |
Builder | open fun Builder(previous: CameraPosition)Create a builder with an existing CameraPosition data. |
Builder | open fun Builder(typedArray: TypedArray)Create a builder with an existing CameraPosition data. |
Builder | open fun Builder(update: CameraUpdateFactory.CameraPositionUpdate)Create a builder from an existing CameraPositionUpdate update. |
Builder | open fun Builder(update: CameraUpdateFactory.ZoomUpdate)Create builder from an existing CameraPositionUpdate update. |
Functions
Name | Summary |
---|---|
bearing | @NonNull() open fun bearing(bearing: Double): CameraPosition.Builder Sets the direction that the camera is pointing in, in degrees clockwise from north. |
build | open fun build(): CameraPosition Builds the CameraPosition. |
padding | @NonNull() open fun padding(padding: Array @NonNull() open fun [padding](#padding)(left: Double, top: Double, right: Double, bottom: Double): [CameraPosition.Builder](#cameraposition.builder) Padding in pixels that shifts the viewport by the specified amount.Applied padding is going to persist and impact following camera transformations. |
target | @NonNull() open fun target(location: LatLng): CameraPosition.Builder Sets the location where the camera is pointing at. |
tilt | @NonNull() open fun tilt(tilt: Double): CameraPosition.Builder Set the tilt of the camera in degreesvalue is clamped to MINIMUM_TILT and MAXIMUM_TILT. |
zoom | @NonNull() open fun zoom(zoom: Double): CameraPosition.Builder Set the zoom of the cameraZoom ranges from MINIMUM_ZOOM to MAXIMUM_ZOOM |
bearing
@NonNull()
open fun bearing(bearing: Double): CameraPosition.Builder
Sets the direction that the camera is pointing in, in degrees clockwise from north.
Return
this
Parameters
Name | Summary |
---|---|
bearing | Bearing |
build
open fun build(): CameraPosition
Builds the CameraPosition.
Return
CameraPosition
padding
@NonNull()
open fun padding(padding: Array
Padding in pixels that shifts the viewport by the specified amount.Applied padding is going to persist and impact following camera transformations.
Specified in left, top, right, bottom order.
Return
this
Parameters
Name | Summary |
---|---|
padding | Camera padding |
@NonNull()
open fun padding(left: Double, top: Double, right: Double, bottom: Double): CameraPosition.Builder
Padding in pixels that shifts the viewport by the specified amount.Applied padding is going to persist and impact following camera transformations.
Specified in left, top, right, bottom order.
Return
this
target
@NonNull()
open fun target(location: LatLng): CameraPosition.Builder
Sets the location where the camera is pointing at.
Return
this
Parameters
Name | Summary |
---|---|
location | target of the camera |
tilt
@NonNull()
open fun tilt(tilt: Double): CameraPosition.Builder
Set the tilt of the camera in degrees
value is clamped to MINIMUM_TILT and MAXIMUM_TILT.
Return
this
Parameters
Name | Summary |
---|---|
tilt | Tilt value of the camera |
zoom
@NonNull()
open fun zoom(zoom: Double): CameraPosition.Builder
Set the zoom of the camera
Zoom ranges from MINIMUM_ZOOM to MAXIMUM_ZOOM
Return
this
Parameters
Name | Summary |
---|---|
zoom | Zoom value of the camera |
CameraUpdate
interface CameraUpdate
Interface definition for camera updates.
Functions
Name | Summary |
---|---|
getCameraPosition | @Nullable() abstract fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition Get the camera position from the camera update. |
Inheritors
Name |
---|
CameraUpdateFactory |
CameraUpdateFactory |
CameraUpdateFactory |
CameraUpdateFactory |
getCameraPosition
@Nullable()
abstract fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition
Get the camera position from the camera update.
Return
the camera position from the implementing camera update
Parameters
Name | Summary |
---|---|
mapboxMap | Map object to build the position from |
CameraUpdateFactory
class CameraUpdateFactory
Factory for creating CameraUpdate objects.
Types
Name | Summary |
---|---|
CameraBoundsUpdate | class CameraBoundsUpdate : CameraUpdate |
CameraMoveUpdate | class CameraMoveUpdate : CameraUpdate |
CameraPositionUpdate | class CameraPositionUpdate : CameraUpdate |
ZoomUpdate | class ZoomUpdate : CameraUpdate |
Functions
Name | Summary |
---|---|
bearingTo | open fun bearingTo(bearing: Double): CameraUpdate Returns a CameraUpdate that moves the camera viewpoint to a particular bearing. |
newCameraPosition | open fun newCameraPosition(cameraPosition: CameraPosition): CameraUpdate Returns a CameraUpdate that moves the camera to a specified CameraPosition. |
newLatLng | open fun newLatLng(latLng: LatLng): CameraUpdate Returns a CameraUpdate that moves the center of the screen to a latitude and longitudespecified by a LatLng object. |
newLatLngBounds | open fun newLatLngBounds(bounds: LatLngBounds, padding: Int): CameraUpdate open fun newLatLngBounds(bounds: LatLngBounds, paddingLeft: Int, paddingTop: Int, paddingRight: Int, paddingBottom: Int): CameraUpdate Returns a CameraUpdate that transforms the camera such that the specifiedlatitude/longitude bounds are centered on screen at the greatest possible zoom level while maintainingcurrent camera position bearing and tilt values. open fun newLatLngBounds(bounds: LatLngBounds, bearing: Double, tilt: Double, padding: Int): CameraUpdate open fun newLatLngBounds(bounds: LatLngBounds, bearing: Double, tilt: Double, paddingLeft: Int, paddingTop: Int, paddingRight: Int, paddingBottom: Int): CameraUpdate Returns a CameraUpdate that transforms the camera such that the specifiedlatitude/longitude bounds are centered on screen at the greatest possible zoom level while usingprovided bearing and tilt values. |
newLatLngPadding | open fun newLatLngPadding(latLng: LatLng, left: Double, top: Double, right: Double, bottom: Double): CameraUpdate Returns a CameraUpdate that moves the center of the screen to a latitude and longitudespecified by a LatLng object, and moves to the given zoom level.Applied padding is going to persist and impact following camera transformations. |
newLatLngZoom | open fun newLatLngZoom(latLng: LatLng, zoom: Double): CameraUpdate Returns a CameraUpdate that moves the center of the screen to a latitude and longitudespecified by a LatLng object taking the specified padding into account. |
paddingTo | open fun paddingTo(padding: Array open fun [paddingTo](#paddingto)(left: Double, top: Double, right: Double, bottom: Double): [CameraUpdate](#cameraupdate) Returns a CameraUpdate that when animated changes the camera padding.Applied padding is going to persist and impact following camera transformations. |
tiltTo | open fun tiltTo(tilt: Double): CameraUpdate Returns a CameraUpdate that moves the camera viewpoint to a particular tilt. |
zoomBy | open fun zoomBy(amount: Double): CameraUpdate open fun zoomBy(amount: Double, focus: Point): CameraUpdate Returns a CameraUpdate that shifts the zoom level of the current camera viewpoint. |
zoomIn | open fun zoomIn(): CameraUpdate Returns a CameraUpdate that zooms in on the map by moving the viewpoint’s height closer tothe Earth’s surface. |
zoomOut | open fun zoomOut(): CameraUpdate Returns a CameraUpdate that zooms out on the map by moving the viewpoint’s height fartheraway from the Earth’s surface. |
zoomTo | open fun zoomTo(zoom: Double): CameraUpdate Returns a CameraUpdate that moves the camera viewpoint to a particular zoom level. |
bearingTo
open fun bearingTo(bearing: Double): CameraUpdate
Returns a CameraUpdate that moves the camera viewpoint to a particular bearing.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
bearing | Bearing to change to |
newCameraPosition
open fun newCameraPosition(cameraPosition: CameraPosition): CameraUpdate
Returns a CameraUpdate that moves the camera to a specified CameraPosition.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
cameraPosition | Camera Position to change to |
newLatLngBounds
open fun newLatLngBounds(bounds: LatLngBounds, padding: Int): CameraUpdate
Returns a CameraUpdate that transforms the camera such that the specifiedlatitude/longitude bounds are centered on screen at the greatest possible zoom level while maintainingcurrent camera position bearing and tilt values.
You can specify padding, in order to inset the bounding box from the map view’s edges.The padding will not persist and impact following camera transformations.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
bounds | Bounds to match Camera position with |
padding | Padding added to the bounds |
open fun newLatLngBounds(bounds: LatLngBounds, bearing: Double, tilt: Double, padding: Int): CameraUpdate
Returns a CameraUpdate that transforms the camera such that the specifiedlatitude/longitude bounds are centered on screen at the greatest possible zoom level while usingprovided bearing and tilt values.
You can specify padding, in order to inset the bounding box from the map view’s edges.The padding will not persist and impact following camera transformations.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
bounds | Bounds to match Camera position with |
bearing | Bearing to take in account when generating the bounds |
tilt | Tilt to take in account when generating the bounds |
padding | Padding added to the bounds |
open fun newLatLngBounds(bounds: LatLngBounds, paddingLeft: Int, paddingTop: Int, paddingRight: Int, paddingBottom: Int): CameraUpdate
Returns a CameraUpdate that transforms the camera such that the specifiedlatitude/longitude bounds are centered on screen at the greatest possible zoom level while maintainingcurrent camera position bearing and tilt values.
You can specify padding, in order to inset the bounding box from the map view’s edges.The padding will not persist and impact following camera transformations.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
bounds | Bounds to base the Camera position out of |
paddingLeft | Padding left of the bounds |
paddingTop | Padding top of the bounds |
paddingRight | Padding right of the bounds |
paddingBottom | Padding bottom of the bounds |
open fun newLatLngBounds(bounds: LatLngBounds, bearing: Double, tilt: Double, paddingLeft: Int, paddingTop: Int, paddingRight: Int, paddingBottom: Int): CameraUpdate
Returns a CameraUpdate that transforms the camera such that the specifiedlatitude/longitude bounds are centered on screen at the greatest possible zoom level while usingprovided bearing and tilt values.
You can specify padding, in order to inset the bounding box from the map view’s edges.The padding will not persist and impact following camera transformations.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
bounds | Bounds to base the Camera position out of |
bearing | Bearing to take in account when generating the bounds |
tilt | Tilt to take in account when generating the bounds |
paddingLeft | Padding left of the bounds |
paddingTop | Padding top of the bounds |
paddingRight | Padding right of the bounds |
paddingBottom | Padding bottom of the bounds |
newLatLngPadding
open fun newLatLngPadding(latLng: LatLng, left: Double, top: Double, right: Double, bottom: Double): CameraUpdate
Returns a CameraUpdate that moves the center of the screen to a latitude and longitudespecified by a LatLng object, and moves to the given zoom level.Applied padding is going to persist and impact following camera transformations.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
latLng | Target location to change to |
left | Left padding |
top | Top padding |
right | Right padding |
bottom | Bottom padding |
newLatLngZoom
open fun newLatLngZoom(latLng: LatLng, zoom: Double): CameraUpdate
Returns a CameraUpdate that moves the center of the screen to a latitude and longitudespecified by a LatLng object taking the specified padding into account.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
latLng | Target location to change to |
zoom | Zoom level to change to |
newLatLng
open fun newLatLng(latLng: LatLng): CameraUpdate
Returns a CameraUpdate that moves the center of the screen to a latitude and longitudespecified by a LatLng object. This centers the camera on the LatLng object.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
latLng | Target location to change to |
paddingTo
open fun paddingTo(padding: Array
Returns a CameraUpdate that when animated changes the camera padding.Applied padding is going to persist and impact following camera transformations.
Specified in left, top, right, bottom order.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
padding | Padding to change to |
open fun paddingTo(left: Double, top: Double, right: Double, bottom: Double): CameraUpdate
Returns a CameraUpdate that when animated changes the camera padding.Applied padding is going to persist and impact following camera transformations.
Specified in left, top, right, bottom order.
Return
CameraUpdate Final Camera Position
tiltTo
open fun tiltTo(tilt: Double): CameraUpdate
Returns a CameraUpdate that moves the camera viewpoint to a particular tilt.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
tilt | Tilt to change to |
zoomBy
open fun zoomBy(amount: Double, focus: Point): CameraUpdate
Returns a CameraUpdate that shifts the zoom level of the current camera viewpoint.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
amount | Amount of zoom level to change with |
focus | Focus point of zoom |
open fun zoomBy(amount: Double): CameraUpdate
Returns a CameraUpdate that shifts the zoom level of the current camera viewpoint.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
amount | Amount of zoom level to change with |
zoomIn
open fun zoomIn(): CameraUpdate
Returns a CameraUpdate that zooms in on the map by moving the viewpoint’s height closer tothe Earth’s surface. The zoom increment is 1.0.
Return
CameraUpdate Final Camera Position
zoomOut
open fun zoomOut(): CameraUpdate
Returns a CameraUpdate that zooms out on the map by moving the viewpoint’s height fartheraway from the Earth’s surface. The zoom increment is -1.0.
Return
CameraUpdate Final Camera Position
zoomTo
open fun zoomTo(zoom: Double): CameraUpdate
Returns a CameraUpdate that moves the camera viewpoint to a particular zoom level.
Return
CameraUpdate Final Camera Position
Parameters
Name | Summary |
---|---|
zoom | Zoom level to change to |
CameraBoundsUpdate
class CameraBoundsUpdate : CameraUpdate
Constructors
Name | Summary |
---|---|
CameraBoundsUpdate | open fun CameraBoundsUpdate(bounds: LatLngBounds, bearing: Double, tilt: Double, padding: Array |
CameraBoundsUpdate | open fun CameraBoundsUpdate(bounds: LatLngBounds, bearing: Double, tilt: Double, paddingLeft: Int, paddingTop: Int, paddingRight: Int, paddingBottom: Int) |
Functions
Name | Summary |
---|---|
equals | open fun equals(o: Any): Boolean |
getCameraPosition | open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition Get the camera position from the camera update. |
hashCode | open fun hashCode(): Int |
toString | open fun toString(): String |
Properties
Name | Summary |
---|---|
bounds | private val bounds: LatLngBounds |
padding | private val padding: Array |
bounds
private val bounds: LatLngBounds
equals
open fun equals(o: Any): Boolean
getCameraPosition
open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition
Get the camera position from the camera update.
Return
the camera position from the implementing camera update
Parameters
Name | Summary |
---|---|
mapboxMap | Map object to build the position from |
hashCode
open fun hashCode(): Int
padding
private val padding: Array
toString
open fun toString(): String
CameraMoveUpdate
class CameraMoveUpdate : CameraUpdate
Constructors
Name | Summary |
---|---|
CameraMoveUpdate | open fun CameraMoveUpdate(x: Float, y: Float) |
Functions
Name | Summary |
---|---|
equals | open fun equals(o: Any): Boolean |
getCameraPosition | open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition Get the camera position from the camera update. |
hashCode | open fun hashCode(): Int |
toString | open fun toString(): String |
equals
open fun equals(o: Any): Boolean
getCameraPosition
open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition
Get the camera position from the camera update.
Return
the camera position from the implementing camera update
Parameters
Name | Summary |
---|---|
mapboxMap | Map object to build the position from |
hashCode
open fun hashCode(): Int
toString
open fun toString(): String
CameraPositionUpdate
class CameraPositionUpdate : CameraUpdate
Constructors
Name | Summary |
---|---|
CameraPositionUpdate | open fun CameraPositionUpdate(bearing: Double, target: LatLng, tilt: Double, zoom: Double, padding: Array |
Functions
Name | Summary |
---|---|
equals | open fun equals(o: Any): Boolean |
getCameraPosition | open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition Get the camera position from the camera update. |
hashCode | open fun hashCode(): Int |
toString | open fun toString(): String |
Properties
Name | Summary |
---|---|
bearing | private val bearing: Double |
padding | private val padding: Array |
target | private val target: LatLng |
tilt | private val tilt: Double |
zoom | private val zoom: Double |
bearing
private val bearing: Double
equals
open fun equals(o: Any): Boolean
getCameraPosition
open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition
Get the camera position from the camera update.
Return
the camera position from the implementing camera update
Parameters
Name | Summary |
---|---|
mapboxMap | Map object to build the position from |
hashCode
open fun hashCode(): Int
padding
private val padding: Array
target
tilt
private val tilt: Double
toString
open fun toString(): String
zoom
private val zoom: Double
ZoomUpdate
class ZoomUpdate : CameraUpdate
Constructors
Name | Summary |
---|---|
ZoomUpdate | open fun ZoomUpdate(type: Int) |
ZoomUpdate | open fun ZoomUpdate(type: Int, zoom: Double) |
ZoomUpdate | open fun ZoomUpdate(zoom: Double, x: Float, y: Float) |
Types
Name | Summary |
---|---|
Type | @Retention(value = RetentionPolicy.SOURCE) annotation class Type |
Functions
Name | Summary |
---|---|
equals | open fun equals(o: Any): Boolean |
getCameraPosition | open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition Get the camera position from the camera update. |
hashCode | open fun hashCode(): Int |
toString | open fun toString(): String |
transformZoom | open fun transformZoom(currentZoom: Double): Double |
Properties
Name | Summary |
---|---|
type | private val type: Int |
x | private open val x: Float |
y | private open val y: Float |
zoom | private val zoom: Double |
ZOOM_BY | val ZOOM_BY: Int |
ZOOM_IN | val ZOOM_IN: Int |
ZOOM_OUT | val ZOOM_OUT: Int |
ZOOM_TO | val ZOOM_TO: Int |
ZOOM_TO_POINT | val ZOOM_TO_POINT: Int |
ZOOM_BY
val ZOOM_BY: Int
ZOOM_IN
val ZOOM_IN: Int
ZOOM_OUT
val ZOOM_OUT: Int
ZOOM_TO
val ZOOM_TO: Int
ZOOM_TO_POINT
val ZOOM_TO_POINT: Int
equals
open fun equals(o: Any): Boolean
getCameraPosition
open fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition
Get the camera position from the camera update.
Return
the camera position from the implementing camera update
Parameters
Name | Summary |
---|---|
mapboxMap | Map object to build the position from |
hashCode
open fun hashCode(): Int
toString
open fun toString(): String
transformZoom
open fun transformZoom(currentZoom: Double): Double
type
private val type: Int
x
private open val x: Float
y
private open val y: Float
zoom
private val zoom: Double
Type
@Retention(value = RetentionPolicy.SOURCE)
annotation class Type
Functions
Name | Summary |
---|---|
annotationType | abstract fun annotationType(): Class |
equals | abstract fun equals(p: Any): Boolean |
hashCode | abstract fun hashCode(): Int |
toString | abstract fun toString(): String |
Android SDK
API Reference
- Root
- attribution
- camera
- constants
- exceptions
- geometry
- http
- location
- location.engine
- location.modes
- location.permissions
- log
- maps
- maps.renderer
- maps.renderer.egl
- maps.renderer.glsurfaceview
- maps.renderer.textureview
- maps.widgets
- module.http
- module.loader
- net
- offline
- snapshotter
- storage
- style.expressions
- style.layers
- style.light
- style.sources
- style.types
- text
- utils