StyleManagerInterface(androidJvm)

Interface for managing style of the `map`.

interface StyleManagerInterface(androidJvm) : ObservableInterface

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.

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

abstract 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()

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

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

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

abstract 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).

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

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

Get an `image` from the style.

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

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

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

Gets style layer properties.

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

Gets the value of style layer property.

abstract fun getStyleLayerProperty(layerId: String, property: String): StylePropertyValue
getStyleLayers
Link copied to clipboard

Returns the existing style layers.

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

Gets the value of a style light property.

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

Gets style source properties.

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

Gets the value of style source property.

abstract fun getStyleSourceProperty(sourceId: String, property: String): StylePropertyValue
getStyleSources
Link copied to clipboard

Returns the existing style sources.

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

Gets the value of a style terrain property.

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

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

Get the URI of the current style in use.

abstract fun getStyleURI(): String

Invalidate region for provided custom geometry source.

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

Invalidate tile for provided custom geometry source.

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

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

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

Moves an existing style layer

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

Removes an image from the style.

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

Removes an existing style layer.

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

Removes an existing style source.

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

Set tile data of a custom geometry.

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

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

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

Sets a value to a style layer property.

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

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

Sets a value to the the style light property.

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

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

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

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

Sets a value to the the style terrain property.

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

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

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

Checks whether a given style layer exists.

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

Checks whether a given style source exists.

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

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

Unsubscribes an `observer` from all events.

abstract fun unsubscribe(observer: Observer)

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

abstract 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).

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

Inheritors

StyleInterface
Link copied to clipboard
CameraManagerInterface
Link copied to clipboard
StyleManager
Link copied to clipboard

Extensions

getLayer
Link copied to clipboard

Extension function to get a Layer provided by the Style Extension by layer id.

fun StyleManagerInterface.getLayer(layerId: String): Layer?
getLayerAs
Link copied to clipboard

Tries to cast the Layer to T.

inline fun <T : Layer> StyleManagerInterface.getLayerAs(layerId: String): T?
getSource
Link copied to clipboard

Extension function to get a Source provided by the Style Extension by source id.

fun StyleManagerInterface.getSource(sourceId: String): Source?
getSourceAs
Link copied to clipboard

Tries to cast the Source to T.

inline fun <T : Source> StyleManagerInterface.getSourceAs(sourceId: String): T?