CameraManager(androidJvm)

Interface for managing camera.

open class CameraManager(androidJvm) : StyleManager, CameraManagerInterface

Functions

addPersistentStyleCustomLayer
Link copied to clipboard

Adds a new [style custom layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers). Note: This is an experimental API and is a subject to change. Whenever a new style is being parsed and currently used style has persistent layers, an engine will try to do following: - keep the persistent layer at its relative position - keep the source used by a persistent layer - keep images added through `addStyleImage` method In cases when a new style has the same layer, source or image resource, style's resources would be used instead and `MapLoadingError` event will be emitted.

open fun addPersistentStyleCustomLayer(layerId: String, layerHost: CustomLayerHost, layerPosition: LayerPosition): Expected<String, None>
addPersistentStyleLayer
Link copied to clipboard

Adds a new [style layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers). Note: This is an experimental API and is a subject to change. Whenever a new style is being parsed and currently used style has persistent layers, an engine will try to do following: - keep the persistent layer at its relative position - keep the source used by a persistent layer - keep images added through `addStyleImage` method In cases when a new style has the same layer, source or image resource, style's resources would be used instead and `MapLoadingError` event will be emitted.

open fun addPersistentStyleLayer(properties: Value, layerPosition: LayerPosition): Expected<String, None>
addStyleCustomGeometrySource
Link copied to clipboard

Adds a custom geometry to be used in the style. To add the data, implement the fetchTileFunction callback in the options and call setStyleCustomGeometrySourceTileData()

open fun addStyleCustomGeometrySource(sourceId: String, options: CustomGeometrySourceOptions): Expected<String, None>
addStyleCustomLayer
Link copied to clipboard

Adds a new [style custom layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers). Runtime style layers are valid until they are either removed or a new style is loaded.

open fun addStyleCustomLayer(layerId: String, layerHost: CustomLayerHost, layerPosition: LayerPosition): Expected<String, None>
addStyleImage
Link copied to clipboard

Adds an image to be used in the style. This API can also be used for updating an image. If the image for a given `imageId` was already added, it gets replaced by the new image. The image can be used in [`icon-image`](https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-icon-image), [`fill-pattern`](https://www.mapbox.com/mapbox-gl-js/style-spec/#paint-fill-fill-pattern), [`line-pattern`](https://www.mapbox.com/mapbox-gl-js/style-spec/#paint-line-line-pattern) and [`text-field`](https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-text-field) properties.

open fun addStyleImage(imageId: String, scale: Float, image: Image, sdf: Boolean, stretchX: List<ImageStretches>, stretchY: List<ImageStretches>, content: ImageContent): Expected<String, None>
addStyleLayer
Link copied to clipboard

Adds a new [style layer](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers). Runtime style layers are valid until they are either removed or a new style is loaded.

open fun addStyleLayer(properties: Value, layerPosition: LayerPosition): Expected<String, None>
addStyleSource
Link copied to clipboard

Adds a new [style source](https://docs.mapbox.com/mapbox-gl-js/style-spec/#sources).

open fun addStyleSource(sourceId: String, properties: Value): Expected<String, None>
cameraForCoordinateBounds
Link copied to clipboard

Convenience method that returns the `camera options` object for given parameters.

open fun cameraForCoordinateBounds(bounds: CoordinateBounds, padding: EdgeInsets, bearing: Double, pitch: Double): CameraOptions
cameraForCoordinates
Link copied to clipboard

Convenience method that adjusts the provided `camera options` object for given parameters. Returns the provided `camera` options with zoom adjusted to fit `coordinates` into the `box`, so that `coordinates` on the left, top and right of the effective `camera` center at the principal point of the projection (defined by `padding`) fit into the `box`. Returns the provided `camera` options object unchanged upon an error. Note that this method may fail if the principal point of the projection is not inside the `box` or if there is no sufficient screen space, defined by principal point and the `box`, to fit the geometry.

open fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, box: ScreenBox): CameraOptions

Convenience method that returns the `camera options` object for given parameters.

open fun cameraForCoordinates(coordinates: List<Point>, padding: EdgeInsets, bearing: Double, pitch: Double): CameraOptions
cameraForGeometry
Link copied to clipboard

Convenience method that returns the `camera options` object for given parameters.

open fun cameraForGeometry(geometry: Geometry, padding: EdgeInsets, bearing: Double, pitch: Double): CameraOptions
coordinateBoundsForCamera
Link copied to clipboard

Returns the `coordinate bounds` for a given camera. Note that if the given `camera` shows the antimeridian, the returned wrapped `coordinate bounds` might not represent the minimum bounding box.

open fun coordinateBoundsForCamera(camera: CameraOptions): CoordinateBounds
coordinateBoundsZoomForCamera
Link copied to clipboard

Returns the `coordinate bounds` and the `zoom` for a given `camera`. Note that if the given `camera` shows the antimeridian, the returned wrapped `coordinate bounds` might not represent the minimum bounding box.

open fun coordinateBoundsZoomForCamera(camera: CameraOptions): CoordinateBoundsZoom
coordinateBoundsZoomForCameraUnwrapped
Link copied to clipboard

Returns the unwrapped `coordinate bounds` and `zoom` for a given `camera`. This method is particularly useful, if the `camera` shows the antimeridian.

open fun coordinateBoundsZoomForCameraUnwrapped(camera: CameraOptions): CoordinateBoundsZoom
coordinateForPixel
Link copied to clipboard

Calculates a geographical `coordinate` (i.e., longitude-latitude pair) that corresponds to a `screen coordinate`. The screen coordinate is in `platform pixels`relative to the top left corner of the map (not of the whole screen).

open fun coordinateForPixel(pixel: ScreenCoordinate): Point
coordinatesForPixels
Link copied to clipboard

Calculates geographical `coordinates` (i.e., longitude-latitude pairs) that correspond to `screen coordinates`. The screen coordinates are in `platform pixels` relative to the top left corner of the map (not of the whole screen).

open fun coordinatesForPixels(pixels: List<ScreenCoordinate>): List<Point>
dragEnd
Link copied to clipboard

Ends the ongoing drag gesture. This function should be called always after the user has ended a drag gesture initiated by `dragStart`.

open fun dragEnd()
dragStart
Link copied to clipboard

Prepares the drag gesture to use the provided screen coordinate as a pivot `point`. This function should be called each time when user starts a dragging action (e.g. by clicking on the map). The following dragging will be relative to the pivot.

open fun dragStart(point: ScreenCoordinate)
getBounds
Link copied to clipboard

Returns the `camera bounds` of the map.

open fun getBounds(): CameraBounds
getCameraState
Link copied to clipboard

Returns the current `camera state`.

open fun getCameraState(): CameraState
getDragCameraOptions
Link copied to clipboard

Calculates target point where camera should move after drag. The method should be called after `dragStart` and before `dragEnd`.

open fun getDragCameraOptions(fromPoint: ScreenCoordinate, toPoint: ScreenCoordinate): CameraOptions
getFreeCameraOptions
Link copied to clipboard

Gets the map's current free camera options. After mutation, it should be set back to the map.

open fun getFreeCameraOptions(): FreeCameraOptions
getMapProjection
Link copied to clipboard

Returns the currently active map projection and its properties as key-value pairs. Common properties shared by all map projections are: - "name" with possible values "mercator" or "globe".

open fun getMapProjection(): Value
getStyleDefaultCamera
Link copied to clipboard

Returns the map style's default camera, if any, or a default camera otherwise. The map style's default camera is defined as follows: - [center](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-center) - [zoom](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-zoom) - [bearing](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-bearing) - [pitch](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-pitch) The style default camera is re-evaluated when a new style is loaded.

open fun getStyleDefaultCamera(): CameraOptions
getStyleImage
Link copied to clipboard

Get an `image` from the style.

open fun getStyleImage(imageId: String): Image
getStyleJSON
Link copied to clipboard

Get the JSON serialization string of the current style in use.

open fun getStyleJSON(): String
getStyleLayerProperties
Link copied to clipboard

Gets style layer properties.

open fun getStyleLayerProperties(layerId: String): Expected<String, Value>
getStyleLayerProperty
Link copied to clipboard

Gets the value of style layer property.

open fun getStyleLayerProperty(layerId: String, property: String): StylePropertyValue
getStyleLayerPropertyDefaultValue
Link copied to clipboard

Gets the default value of style layer property

open fun getStyleLayerPropertyDefaultValue(layerType: String, property: String): StylePropertyValue
getStyleLayers
Link copied to clipboard

Returns the existing style layers.

open fun getStyleLayers(): List<StyleObjectInfo>
getStyleLightProperty
Link copied to clipboard

Gets the value of a style light property.

open fun getStyleLightProperty(property: String): StylePropertyValue
getStyleSourceProperties
Link copied to clipboard

Gets style source properties.

open fun getStyleSourceProperties(sourceId: String): Expected<String, Value>
getStyleSourceProperty
Link copied to clipboard

Gets the value of style source property.

open fun getStyleSourceProperty(sourceId: String, property: String): StylePropertyValue
getStyleSourcePropertyDefaultValue
Link copied to clipboard

Gets the default value of style source property.

open fun getStyleSourcePropertyDefaultValue(sourceType: String, property: String): StylePropertyValue
getStyleSources
Link copied to clipboard

Returns the existing style sources.

open fun getStyleSources(): List<StyleObjectInfo>
getStyleTerrainProperty
Link copied to clipboard

Gets the value of a style terrain property.

open fun getStyleTerrainProperty(property: String): StylePropertyValue
getStyleTransition
Link copied to clipboard

Returns the map style's transition options. By default, the style parser will attempt to read the style default transition options, if any, fallbacking to an immediate transition otherwise. Transition options can be overriden via `setStyleTransition`, but the options are reset once a new style has been loaded. The style transition is re-evaluated when a new style is loaded.

open fun getStyleTransition(): TransitionOptions
getStyleURI
Link copied to clipboard

Get the URI of the current style in use.

open fun getStyleURI(): String

Invalidate region for provided custom geometry source.

open fun invalidateStyleCustomGeometrySourceRegion(sourceId: String, bounds: CoordinateBounds): Expected<String, None>
invalidateStyleCustomGeometrySourceTile
Link copied to clipboard

Invalidate tile for provided custom geometry source.

open fun invalidateStyleCustomGeometrySourceTile(sourceId: String, tileId: CanonicalTileID): Expected<String, None>
isStyleLayerPersistent
Link copied to clipboard

Checks if a style layer is persistent. Note: This is an experimental API and is a subject to change.

open fun isStyleLayerPersistent(layerId: String): Expected<String, Boolean>
isStyleLoaded
Link copied to clipboard

Check if the style is completely loaded. Note: The style specified sprite would be marked as loaded even with sprite loading error (An error will be emitted via `MapLoadingError`). Sprite loading error is not fatal and we don't want it to block the map rendering, thus the function will still return `true` if style and sources are fully loaded.

open fun isStyleLoaded(): Boolean
moveStyleLayer
Link copied to clipboard

Moves an existing style layer

open fun moveStyleLayer(layerId: String, layerPosition: LayerPosition): Expected<String, None>
pixelForCoordinate
Link copied to clipboard

Calculates a `screen coordinate` that corresponds to a geographical coordinate (i.e., longitude-latitude pair). The `screen coordinate` is in `platform pixels` relative to the top left corner of the map (not of the whole screen).

open fun pixelForCoordinate(coordinate: Point): ScreenCoordinate
pixelsForCoordinates
Link copied to clipboard

Calculates `screen coordinates` that correspond to geographical `coordinates` (i.e., longitude-latitude pairs). The `screen coordinates` are in `platform pixels` relative to the top left corner of the map (not of the whole screen).

open fun pixelsForCoordinates(coordinates: List<Point>): List<ScreenCoordinate>
removeStyleImage
Link copied to clipboard

Removes an image from the style.

open fun removeStyleImage(imageId: String): Expected<String, None>
removeStyleLayer
Link copied to clipboard

Removes an existing style layer.

open fun removeStyleLayer(layerId: String): Expected<String, None>
removeStyleSource
Link copied to clipboard

Removes an existing style source.

open fun removeStyleSource(sourceId: String): Expected<String, None>
setBounds
Link copied to clipboard

Sets the `camera bounds options` of the map. The map will retain its current values for any details not passed via the camera bounds options arguments. When camera bounds options are set, the camera center is constrained by these bounds, as well as the minimum zoom level of the camera, to prevent out of bounds areas to be visible. Note that tilting or rotating the map, or setting stricter minimum and maximum zoom within `options` may still cause some out of bounds areas to become visible.

open fun setBounds(options: CameraBoundsOptions): Expected<String, None>
setCamera
Link copied to clipboard

Changes the map view by any combination of center, zoom, bearing, and pitch, without an animated transition. The map will retain its current values for any details not passed via the camera options argument. It is not guaranteed that the provided `camera options` will be set, the map may apply constraints resulting in a different `camera state`.

open fun setCamera(cameraOptions: CameraOptions)

Sets the map view with the free camera options. The `free camera options` provides more direct access to the underlying camera entity. For backwards compatibility the state set using this API must be representable with `camera options` as well. Parameters are clamped to a valid range or discarded as invalid if the conversion to the pitch and bearing presentation is ambiguous. For example orientation can be invalid if it leads to the camera being upside down or the quaternion has zero length.

open fun setCamera(freeCameraOptions: FreeCameraOptions)
setMapProjection
Link copied to clipboard

Updates the active map projection. The function expects a collection of common and projection specific properties. Common properties shared by all map projections are: - "name" with possible values "mercator" or "globe".

open fun setMapProjection(projection: Value): Expected<String, None>
setStyleCustomGeometrySourceTileData
Link copied to clipboard

Set tile data of a custom geometry.

open fun setStyleCustomGeometrySourceTileData(sourceId: String, tileId: CanonicalTileID, featureCollection: List<Feature>): Expected<String, None>
setStyleJSON
Link copied to clipboard

Load the style from a provided JSON string.

open fun setStyleJSON(json: String)
setStyleLayerProperties
Link copied to clipboard

Sets style layer properties. This method can be used to perform batch update for a style layer properties. The structure of a provided `properties` value must conform to a format for a corresponding [layer type](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/). Modification of a layer [id](https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#id) and/or a [layer type] (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#type) is not allowed.

open fun setStyleLayerProperties(layerId: String, properties: Value): Expected<String, None>
setStyleLayerProperty
Link copied to clipboard

Sets a value to a style layer property.

open fun setStyleLayerProperty(layerId: String, property: String, value: Value): Expected<String, None>
setStyleLight
Link copied to clipboard

Sets the style global [light](https://docs.mapbox.com/mapbox-gl-js/style-spec/#light) properties.

open fun setStyleLight(properties: Value): Expected<String, None>
setStyleLightProperty
Link copied to clipboard

Sets a value to the the style light property.

open fun setStyleLightProperty(property: String, value: Value): Expected<String, None>
setStyleSourceProperties
Link copied to clipboard

Sets style source properties. This method can be used to perform batch update for a style source properties. The structure of a provided `properties` value must conform to a format for a corresponding [source type](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/). Modification of a source [type](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#type) is not allowed.

open fun setStyleSourceProperties(sourceId: String, properties: Value): Expected<String, None>
setStyleSourceProperty
Link copied to clipboard

Sets a value to a style source property. Note: When setting the `data` property of a `geojson` source, this method never returns an error. In case of success, a `map-loaded` event will be propagated. In case of errors, a `map-loading-error` event will be propagated instead.

open fun setStyleSourceProperty(sourceId: String, property: String, value: Value): Expected<String, None>
setStyleTerrain
Link copied to clipboard

Sets the style global [terrain](https://docs.mapbox.com/mapbox-gl-js/style-spec/#terrain) properties.

open fun setStyleTerrain(properties: Value): Expected<String, None>
setStyleTerrainProperty
Link copied to clipboard

Sets a value to the the style terrain property.

open fun setStyleTerrainProperty(property: String, value: Value): Expected<String, None>
setStyleTransition
Link copied to clipboard

Overrides the map style's transition options with user-provided options. The style transition is re-evaluated when a new style is loaded.

open fun setStyleTransition(transitionOptions: TransitionOptions)
setStyleURI
Link copied to clipboard

Load style from provided URI. This is an asynchronous call. To check the result of this operation the user must register an observer observing `MapLoaded` or `MapLoadingError` events. In case of successful style load, `StyleLoaded` event will be also emitted.

open fun setStyleURI(uri: String)
styleLayerExists
Link copied to clipboard

Checks whether a given style layer exists.

open fun styleLayerExists(layerId: String): Boolean
styleSourceExists
Link copied to clipboard

Checks whether a given style source exists.

open fun styleSourceExists(sourceId: String): Boolean
subscribe
Link copied to clipboard

Subscribes an `observer` to a provided array of event types. The `observable` will hold a strong reference to an `observer` instance, therefore, in order to stop receiving notifications, caller must call `unsubscribe` with an `observer` instance used for an initial subscription.

open fun subscribe(observer: Observer, events: List<String>)
unsubscribe
Link copied to clipboard

Unsubscribes an `observer` from all events.

open fun unsubscribe(observer: Observer)

Unsubscribes an `observer` from a provided array of event types.

open fun unsubscribe(observer: Observer, events: List<String>)
updateStyleImageSourceImage
Link copied to clipboard

Updates the image of an [image style source](https://docs.mapbox.com/mapbox-gl-js/style-spec/#sources-image).

open fun updateStyleImageSourceImage(sourceId: String, image: Image): Expected<String, None>

Inheritors

Map
Link copied to clipboard
MapSnapshotter
Link copied to clipboard