MapboxStyleManager

open class MapboxStyleManager @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP_PREFIX]) constructor(val styleManager: StyleManager, val pixelRatio: Float, val mapLoadingErrorDelegate: MapLoadingErrorDelegate)

Wrapper class for StyleManager allowing to expose style related methods for MapboxMap.

Constructors

Link copied to clipboard
fun MapboxStyleManager(styleManager: StyleManager, pixelRatio: Float, mapLoadingErrorDelegate: MapLoadingErrorDelegate)

Functions

Link copied to clipboard
open fun addGeoJSONSourceFeatures(sourceId: String, dataId: String, features: List<Feature>): Expected<String, None>

Add additional features to a GeoJSON style source.

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 id was already added, it gets replaced by the new image.

Link copied to clipboard
Link copied to clipboard

Adds a new style layer.

Link copied to clipboard

Adds a custom geometry to be used in the style. To add the data, implement the CustomGeometrySourceOptions.Builder.fetchTile@CallSuper @MainThread open function callback in the options and call setStyleCustomGeometrySourceTileData

Link copied to clipboard
Link copied to clipboard

Note! This is an experimental feature. It can be changed or removed in future versions.

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

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.

Link copied to clipboard
open fun addStyleImportFromJSON(importId: String, json: String, config: HashMap<String, Value>?, importPosition: ImportPosition?): Expected<String, None>

Adds new import to current style, loaded from a JSON string.

Link copied to clipboard
open fun addStyleImportFromURI(importId: String, uri: String, config: HashMap<String, Value>?, importPosition: ImportPosition?): Expected<String, None>

Adds new import to current style, loaded from an URI.

Link copied to clipboard

Adds a new style layer.

Link copied to clipboard

Adds a model to be used in the style. This API can also be used for updating a model. If the model for a given modelId was already added, it gets replaced by the new model.

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

Adds a new style source. Note: When adding a geojson source, this method does not synchronously parse the GeoJSON data. The events API shall be used to make sure the provided GeoJSON data is valid. In case the GeoJSON is valid, a MapLoaded event will be propagated. In case of errors, a MapLoadingError event will be propagated instead.

Link copied to clipboard
open fun getFeaturesets(): List<FeaturesetDescriptor>

Returns the available featuresets in the currently loaded style.

Link copied to clipboard

Gets the value of a style atmosphere property.

Link copied to clipboard

Get the glyph URL of the current style in use.

Link copied to clipboard

Get an image from the style.

Link copied to clipboard

Gets the value of style import config.

Link copied to clipboard

Returns the existing style imports.

Link copied to clipboard

Gets style import schema.

Link copied to clipboard

Gets style layer properties.

Link copied to clipboard

Gets the value of style layer property.

Link copied to clipboard

Gets the value of the style light property.

Link copied to clipboard

Gets added lights to the style.

Link copied to clipboard

Gets the value of a style projection property.

Link copied to clipboard

Gets the value of a style rain property.

Link copied to clipboard

Gets the value of a style snow property.

Link copied to clipboard

Gets style source properties.

Link copied to clipboard

Gets the value of style source property.

Link copied to clipboard

Gets the value of a style terrain property.

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, fallback-ing to an immediate transition otherwise. Transition options can be overridden via setStyleTransition, but the options are reset once a new style has been loaded.

Link copied to clipboard

Checks whether an image exists.

Link copied to clipboard

Checks whether a model exists.

Invalidate region for provided custom geometry source.

Link copied to clipboard

Invalidate tile for provided custom geometry source.

Link copied to clipboard

Checks if a style layer is persistent.

Link copied to clipboard

Check if the style is completely loaded.

Link copied to clipboard
open fun moveStyleImport(importId: String, importPosition: ImportPosition?): Expected<String, None>

Moves import to position before another import, specified with beforeId. Order of imported styles corresponds to order of their layers.

Link copied to clipboard

Moves an existing style layer

Link copied to clipboard

Remove features from a GeoJSON style source.

Link copied to clipboard

Removes an image from the style.

Link copied to clipboard

Removes an existing style import.

Link copied to clipboard

Removes an existing style layer.

Link copied to clipboard

Removes a model from the style.

Link copied to clipboard

Removes an existing style source.

Link copied to clipboard

Removes an existing style source without checking if it's being used by any other component.

Link copied to clipboard

Sets the style global atmosphere properties.

Link copied to clipboard

Sets a value to the the style atmosphere property.

Link copied to clipboard

Set tile data of a custom geometry.

Link copied to clipboard

Note! This is an experimental feature. It can be changed or removed in future versions.

Link copied to clipboard

Set geojson source data. Call may take significant time for parsing and marshalling depending on the data size.

Link copied to clipboard

Load the style glyphs from a provided URL.

Link copied to clipboard

Sets style import config. This method can be used to perform batch update for a style import configurations.

Link copied to clipboard

Sets a value to a style import config.

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. Modification of a layer id and/or a layer type (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#type) is not allowed.

Link copied to clipboard

Sets a value to a style layer property.

Link copied to clipboard

Sets a value to the light property.

Link copied to clipboard

Sets lights to the style.

Link copied to clipboard

Sets the map's projection. If called with NULL, the map will reset to Mercator.

Link copied to clipboard

Sets a value to the the style projection property.

Link copied to clipboard

Experimental. Sets the style global rain properties.

Link copied to clipboard

Experimental. Sets the style global rain property.

Link copied to clipboard

Experimental. Sets the style global snow properties.

Link copied to clipboard

Experimental. Sets the style global snow property.

Link copied to clipboard

Sets style source properties.

Link copied to clipboard

Sets a value to a style source property. Note: When setting the "data" property of a geojson source, this method does not synchronously parse the GeoJSON data. The events API shall be used to make sure the provided GeoJSON data is valid. In case the GeoJSON is valid, a MapLoaded event will be propagated. In case of errors, a MapLoadingError event will be propagated instead.

Link copied to clipboard

Sets the style global terrain properties.

Link copied to clipboard

Sets a value to the the style terrain property.

Link copied to clipboard

Overrides the map style's transition options with user-provided options.

Link copied to clipboard

Checks whether a given style layer exists.

Link copied to clipboard

Checks whether a given style source exists.

Link copied to clipboard
open fun updateGeoJSONSourceFeatures(sourceId: String, dataId: String, features: List<Feature>): Expected<String, None>

Update existing features in a GeoJSON style source.

Link copied to clipboard

Updates the image of an image style source.

Link copied to clipboard

Updates an existing import in the style. The function replaces the content of the import, with the content loaded from the provided data value. The configuration values of the import are merged with the configuration provided in the update.

Link copied to clipboard

Updates an existing import in the style. The function replaces the content of the import, with the content loaded from the provided URI. The configuration values of the import are merged with the configuration provided in the update.

Properties

Link copied to clipboard

Current pixel ratio.

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:

Link copied to clipboard

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

Link copied to clipboard

Returns the existing style layers.

Link copied to clipboard

Native style manager instance.

Link copied to clipboard

Returns the ordered slot identifiers of current style and its imports.

Link copied to clipboard

Returns the existing style sources.

Link copied to clipboard

Get the URI of the current style in use.

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard

Extension function to add an image provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add 9-patch image provided by the Style Extension to the Style.

fun MapboxStyleManager.addImage9Patch(imageId: String, bitmap: Bitmap, scale: Float = pixelRatio, sdf: Boolean = false): Expected<String, None>

Adds an 9-patch image to be used in the style. X-stretches, Y-stretches and padding will be calculated from Bitmap.getNinePatchChunk.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a model provided by the Style Extension to the Style.

Link copied to clipboard

Add layer to the style persistently.

Link copied to clipboard

Extension function to add a Source provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to get the atmosphere provided by the Style Extension.

Link copied to clipboard

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

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

Tries to cast the Layer to T.

Link copied to clipboard

Extension function to get 3D Light that has been applied to the style.

Link copied to clipboard

Extension function to get the projection provided by the Style Extension.

Link copied to clipboard

Extension function to get the Rain provided by the Style Extension.

Link copied to clipboard

Extension function to get the Snow provided by the Style Extension.

Link copied to clipboard

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

Link copied to clipboard
inline fun <T : Source> MapboxStyleManager.getSourceAs(sourceId: String): T?

Tries to cast the Source to T.

Link copied to clipboard

Extension function to get the terrain provided by the Style Extension.

Link copied to clipboard

Extension function to localize style labels

Link copied to clipboard

Removes atmosphere from style if it was set.

Link copied to clipboard

Removes rain from style if it was set.

Link copied to clipboard

Removes snow from style if it was set.

Link copied to clipboard

Removes terrain from style if it was set.

Link copied to clipboard

Extension function to set the Atmosphere provided by the Style Extension to the Style.

Link copied to clipboard
fun MapboxStyleManager.setLight(ambientLight: AmbientLight, directionalLight: DirectionalLight)

Extension function to add dynamic light to the Style. dynamic light is built from AmbientLight and DirectionalLight.

Extension function to add the FlatLight to the Style.

Link copied to clipboard

Extension function to add list of lights.

Link copied to clipboard

Extension function to set the Projection provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to set the Rain provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to set the Snow provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to set the Terrain provided by the Style Extension to the Style.