StyleDescriptor

data class StyleDescriptor(val uri: Uri, val darkUri: Uri? = null, val layerMappingUri: Uri? = null, val darkLayerMappingUri: Uri? = null) : Parcelable

Represents all the necessary information to identify and load a style.

Supported Uris:

  • asset://... - specifies file located in apk assets directory.

  • http://... or https://... - specifies file located on web server.

  • file://... - specifies file located on file system. See java.io.File.toURI.

For easier uri building use com.tomtom.sdk.common.android.Uris.

For style file format see map style specification. Style Specification is a formal definition of all properties that define the map's appearance.

Layer mapping format

The layerMappingUri and darkLayerMappingUri must point to the mapping files. These files describe how to combine layers from the map style that is referenced by the uri and the internal SDK style. Each file must contain a JSON array with the following format:

Each array item is an object with two properties: secondary-layer, and either after-primary-layer or before-primary-layer.

  • secondary-layer specifies the ID of the SDK style layer to be inserted among map style layers.

  • after-primary-layer specifies after which map style layer the SDK style layer should be inserted.

  • before-primary-layer specifies before which map style layer the SDK style layer should be inserted.

During map drawing, the layer that comes first in the list is drawn first, then the next layer is drawn on top of it, and so on. So a layer that has the before-primary-layer property will be drawn below the corresponding map style layer, while one that is after-primary-layer will be drawn on top of map style layer.

The number and order of the items are arbitrary, but for each SDK style layer to be inserted there must be a corresponding map style layer ID specified.

If a map style layer ID is present in the layer mapping file, but doesn't exist in the map style file, an error is thrown stating that there is no such primary layer ID.

The JSON structure of the mapping file:

"mixed": [
/* Secondary layer with the given ID will be inserted after the primary layer with the given ID. */
{"secondary-layer" : "<secondary - layer - id>", "after-primary-layer" : "<primary - layer - id>"},
/* Secondary layer with the given ID will be inserted before the primary layer with the given ID. */
{"secondary-layer" : "<secondary - layer - id>", "before-primary-layer" : "<primary - layer - id>"},
...
]

To properly display a style, each the SDK style layer must be mapped to a map style layer. Here is the list of all the SDK style layers:

[
"skybox-schematic",
"skybox",
"route",
"lanegroup-shape",
"circle-shape",
"polygon-shape",
"polyline-shape",
"polar-cap",
"route-marker",
"route-instruction",
"marker",
"position-marker"
]

Constructors

Link copied to clipboard
constructor(uri: Uri, darkUri: Uri? = null, layerMappingUri: Uri? = null, darkLayerMappingUri: Uri? = null)

Properties

Link copied to clipboard

RFC 2396-compliant Uri to the layer mapping file used for the dark style variant. If not supplied, the default mapping file will be used.

Link copied to clipboard
val darkUri: Uri? = null

RFC 2396-compliant Uri to the dark version of the map style file.

Link copied to clipboard
val layerMappingUri: Uri? = null

RFC 2396-compliant Uri to the layer mapping file used for the main style. If not supplied, the default mapping file is used.

Link copied to clipboard
val uri: Uri

RFC 2396-compliant Uri to the main map style file.

Inherited functions

Link copied to clipboard
abstract fun describeContents(): Int
Link copied to clipboard
abstract fun writeToParcel(p0: Parcel, p1: Int)