ModelFeature

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
sealed interface ConstructorOptions

Properties

Link copied to clipboard

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

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

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
fun getProperty(name: String): Any

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

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

Returns an array of property IDs for the feature.

Link copied to clipboard

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

Returns whether the feature contains this property.

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

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