setFeatureState

open override fun setFeatureState(sourceId: String, sourceLayerId: String?, featureId: String, state: Value, callback: FeatureStateOperationCallback): Cancelable

Updates the state object of a feature within a style source.

Update entries in the state object of a given feature within a style source. Only properties of the state object will be updated. A property in the feature state object that is not listed in state will retain its previous value. The properties must be paint properties, layout properties are not supported.

Note that updates to feature state are asynchronous, so changes made by this method might not be immediately visible using getStateFeature. And the corresponding source needs to be in use to ensure the feature data it contains can be successfully updated.

Return

A cancelable object that could be used to cancel the pending operation.

Parameters

sourceId

The style source identifier.

sourceLayerId

The style source layer identifier (for multi-layer sources such as vector sources).

featureId

The feature identifier of the feature whose state should be updated.

state

The state object with properties to update with their respective new values.

callback

The feature state operation callback called when the operation completes or ends.


fun setFeatureState(sourceId: String, featureId: String, state: Value, callback: FeatureStateOperationCallback): Cancelable

Updates the state object of a feature within a style source.

Update entries in the state object of a given feature within a style source. Only properties of the state object will be updated. A property in the feature state object that is not listed in state will retain its previous value. The properties must be paint properties, layout properties are not supported.

Note that updates to feature state are asynchronous, so changes made by this method might not be immediately visible using getStateFeature. And the corresponding source needs to be in use to ensure the feature data it contains can be successfully updated.

Return

A cancelable object that could be used to cancel the pending operation.

Parameters

sourceId

The style source identifier.

featureId

The feature identifier of the feature whose state should be updated.

state

The state object with properties to update with their respective new values.

callback

The feature state operation callback called when the operation completes or ends.


fun <FS : FeatureState> setFeatureState(featuresetFeature: FeaturesetFeature<FS>, state: FS, callback: FeatureStateOperationCallback = FeatureStateOperationCallback { }): Cancelable

Sets the state map for given featuresetFeature coming from an interaction callback asynchronously.

Return

A Cancelable object that could be used to cancel the pending query.

Parameters

featuresetFeature

the featureset feature coming from an interaction callback.

state

describes the new state of the map for given featuresetFeature.

callback

The optional QueryFeatureStateCallback called when the query completes.


fun <FS : FeatureState> setFeatureState(descriptor: TypedFeaturesetDescriptor<FS, *>, id: FeaturesetFeatureId, state: FS, callback: FeatureStateOperationCallback = FeatureStateOperationCallback { }): Cancelable

Sets the state map of a feature within a style source asynchronously.

This API should be used with caution as Feature defined by the FeaturesetFeatureId.featureId only might not be compatible with provided FeaturesetFeatureId.featureNamespace and descriptor and thus API behaviour might be unexpected. It is safer to use overloaded getFeatureState taking FeaturesetFeature.

Return

A Cancelable object that could be used to cancel the pending query.

Parameters

descriptor

TypedFeaturesetDescriptor object representing either a featureset or a single layer.

id

identifier holding feature id and feature namespace.

state

describes the new state of the map for given feature.

callback

The optional QueryFeatureStateCallback called when the query completes.