Cesium3DTileFeature

external class Cesium3DTileFeature(source)

A feature of a Cesium3DTileset.

Provides access to a feature's properties stored in the tile's batch table, as well as the ability to show/hide a feature and change its highlight color via Cesium3DTileFeature.show and Cesium3DTileFeature.color, respectively.

Modifications to a Cesium3DTileFeature object have the lifetime of the tile's content. If the tile's content is unloaded, e.g., due to it going out of view and needing to free space in the cache for visible tiles, listen to the Cesium3DTileset.tileUnload event to save any modifications. Also listen to the Cesium3DTileset.tileVisible event to reapply any modifications.

Do not construct this directly. Access it through Cesium3DTileContent.getFeature or 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 Cesium3DTileFeature) {
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
const propertyId = propertyIds[i];
console.log(`{propertyId}: ${feature.getProperty(propertyId)}`);
}
}
}, ScreenSpaceEventType.MOUSE_MOVE);

See also

Types

Link copied to clipboard
object Companion

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 a typed array containing the ECEF positions of the polyline. Returns undefined if Cesium3DTileset.vectorKeepDecodedPositions is false or the feature is not a polyline in a vector tile.

Link copied to clipboard

All objects returned by Scene.pick have a primitive property. This returns the tileset containing the feature.

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.

Link copied to clipboard

Gets the tileset containing the feature.

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. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.

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

Returns an array of property IDs for the feature. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.

Link copied to clipboard

Returns whether the feature contains this property. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.

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

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