Style

open class Style

The proxy object for current map style.

To create new instances of this object, create a new instance using a Builder and load the style with MapLibreMap. This object is returned from getStyle once the style has been loaded by underlying map.

Types

Link copied to clipboard
open class Builder
Builder for composing a style object.
Link copied to clipboard
interface OnStyleLoaded
Callback to be invoked when a style has finished loading.

Functions

Link copied to clipboard
open fun addImage(@NonNull name: String, @NonNull image: Bitmap)
open fun addImage(@NonNull name: String, @NonNull bitmap: Bitmap, sdf: Boolean)
open fun addImage(@NonNull name: String, @NonNull image: Bitmap, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
open fun addImage(@NonNull name: String, @NonNull bitmap: Bitmap, sdf: Boolean, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
Adds an image to be used in the map's style
open fun addImage(@NonNull name: String, @NonNull drawable: Drawable)
open fun addImage(@NonNull name: String, @NonNull drawable: Drawable, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
Adds an drawable to be converted into a bitmap to be used in the map's style
Link copied to clipboard
open fun addImageAsync(@NonNull name: String, @NonNull image: Bitmap)
open fun addImageAsync(@NonNull name: String, @NonNull bitmap: Bitmap, sdf: Boolean)
open fun addImageAsync(@NonNull name: String, @NonNull image: Bitmap, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
open fun addImageAsync(@NonNull name: String, @NonNull bitmap: Bitmap, sdf: Boolean, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
Adds an image asynchronously, to be used in the map's style.
open fun addImageAsync(@NonNull name: String, @NonNull drawable: Drawable)
open fun addImageAsync(@NonNull name: String, @NonNull drawable: Drawable, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
Adds an drawable asynchronously, to be converted into a bitmap to be used in the map's style.
Link copied to clipboard
open fun addImages(@NonNull images: HashMap<String, Bitmap>)
open fun addImages(@NonNull images: HashMap<String, Bitmap>, sdf: Boolean)
open fun addImages(@NonNull images: HashMap<String, Bitmap>, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
open fun addImages(@NonNull images: HashMap<String, Bitmap>, sdf: Boolean, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
Adds images to be used in the map's style.
Link copied to clipboard
open fun addImagesAsync(@NonNull images: HashMap<String, Bitmap>, sdf: Boolean)
open fun addImagesAsync(@NonNull images: HashMap<String, Bitmap>, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
open fun addImagesAsync(@NonNull images: HashMap<String, Bitmap>, sdf: Boolean, @NonNull stretchX: List<ImageStretches>, @NonNull stretchY: List<ImageStretches>, @Nullable content: ImageContent)
Adds images asynchronously, to be used in the map's style.
Link copied to clipboard
open fun addLayer(@NonNull layer: Layer)
Adds the layer to the map.
Link copied to clipboard
open fun addLayerAbove(@NonNull layer: Layer, @NonNull above: String)
Adds the layer to the map.
Link copied to clipboard
open fun addLayerAt(@NonNull layer: Layer, @IntRange(from = 0) index: Int)
Adds the layer to the map at the specified index.
Link copied to clipboard
open fun addLayerBelow(@NonNull layer: Layer, @NonNull below: String)
Adds the layer to the map.
Link copied to clipboard
open fun addSource(@NonNull source: Source)
Adds the source to the map.
Link copied to clipboard
Get an image from the map's style using an id.
Link copied to clipboard
open fun getJson(): String
Returns the current style json.
Link copied to clipboard
Get the layer by id
Link copied to clipboard
open fun <T : Layer?> getLayerAs(@NonNull layerId: String): T
Tries to cast the Layer to T, throws ClassCastException if it's another type.
Link copied to clipboard
Retrieve all the layers in the style
Link copied to clipboard
open fun getLight(): Light
Get the light source used to change lighting conditions on extruded fill layers.
Link copied to clipboard
Get predefined style by name
Link copied to clipboard
Get predefined styles
Link copied to clipboard
Retrieve a source by id
Link copied to clipboard
open fun <T : Source?> getSourceAs(@NonNull sourceId: String): T
Tries to cast the Source to T, throws ClassCastException if it's another type.
Link copied to clipboard
Retrieve all the sources in the style
Link copied to clipboard
Get the transition options for style changes.
Link copied to clipboard
open fun getUri(): String
Returns the current style uri.
Link copied to clipboard
open fun getUrl(): String
Returns the current style url.
Link copied to clipboard
Returns true if the style is fully loaded.
Link copied to clipboard
open fun removeImage(@NonNull name: String)
Removes an image from the map's style.
Link copied to clipboard
open fun removeLayer(@NonNull layerId: String): Boolean
open fun removeLayer(@NonNull layer: Layer): Boolean
Removes the layer.
Link copied to clipboard
open fun removeLayerAt(@IntRange(from = 0) index: Int): Boolean
Removes the layer.
Link copied to clipboard
open fun removeSource(@NonNull sourceId: String): Boolean
Removes the source from the style.
open fun removeSource(@NonNull source: Source): Boolean
Removes the source, preserving the reference for re-use
Link copied to clipboard
open fun setTransition(@NonNull transitionOptions: TransitionOptions)
Set the transition options for style changes.
Link copied to clipboard
open fun toImage(imageWrapper: Style.Builder.ImageWrapper): Image