StyleManager(androidJvm)

Interface for managing style of the `map`.

open class StyleManager(androidJvm) : Observable, StyleManagerInterface

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>
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>
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>
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

CameraManager
Link copied to clipboard