rememberTerrainState

inline fun rememberTerrainState(rasterDemSourceState: RasterDemSourceState, key: String? = null, crossinline init: TerrainState.() -> Unit = {}): TerrainState

Create and rememberSaveable a TerrainState using TerrainState.Saver. init will be called when the TerrainState is first created to configure its initial state.

This function does not automatically update the TerrainState if rasterDemSourceState is updated. To update state properties imperatively, use LaunchedEffect:

val terrain = rememberTerrainState(rasterDemSourceState)
LaunchedEffect(exaggeration) {
terrain.exaggeration = DoubleValue(exaggeration)
}

Parameters

rasterDemSourceState

Mandatory RasterDemSourceState to which terrain will be added.

key

An optional key to be used as a key for the saved value. If not provided we use the automatically generated by the Compose runtime which is unique for the every exact code location in the composition tree.

init

A function initialise this TerrainState.