ModelFeature

open external class ModelFeature(source)

A feature of a Model.

Provides access to a feature's properties stored in the model's feature table.

Modifications to a ModelFeature object have the lifetime of the model.

Do not construct this directly. Access it through picking using Scene.pick.

// On mouse over, display all the properties for a feature in the console log.
handler.setInputAction(function(movement) {
const feature = scene.pick(movement.endPosition);
if (feature instanceof ModelFeature) {
console.log(feature);
}
}, ScreenSpaceEventType.MOUSE_MOVE);

See also

Types

Link copied to clipboard
external interface ConstructorOptions

Properties

Link copied to clipboard
external var color: Color

Gets or sets the highlight color multiplied with the feature's color. When this is white, the feature's color is not changed. This is set for all features when a style's color is evaluated.

Link copied to clipboard
external val featureId: Int

Get the feature ID associated with this feature. For 3D Tiles 1.0, the batch ID is returned. For EXT_mesh_features, this is the feature ID from the selected feature ID set.

Link copied to clipboard
external var show: Boolean

Gets or sets if the feature will be shown. This is set for all features when a style's show is evaluated.

Functions

Link copied to clipboard
external fun getProperty(name: String): JsAny

Returns a copy of the value of the feature's property with the given name.

Link copied to clipboard
external fun getPropertyIds(results: ReadonlyArray<JsString>? = definedExternally): ReadonlyArray<JsString>

Returns an array of property IDs for the feature.

Link copied to clipboard
external fun getPropertyInherited(name: String): JsAny

Returns a copy of the feature's property with the given name, examining all the metadata from the EXT_structural_metadata and legacy EXT_feature_metadata glTF extensions. Metadata is checked against name from most specific to most general and the first match is returned. Metadata is checked in this order:

Link copied to clipboard
external fun hasProperty(name: String): Boolean

Returns whether the feature contains this property.

Link copied to clipboard
external fun setProperty(name: String, value: JsAny): Boolean

Sets the value of the feature's property with the given name.