new Cesium.Cesium3DTileFeature()

A feature of a Cesium3DTileset.

提供对存储在瓷砖批量表中的特性的访问权限,以及 能够显示/隐藏一个特征并改变其亮度颜色 Cesium3DTileFeature#show and Cesium3DTileFeature#color, respectively.

对 NT 0 铯3 DTELEFature NT 1 对象的修改具有该瓷砖的寿命 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.

Example:
// 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 Cesium.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)}`);
        }
    }
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

Members

color : Color

获取或设置突出颜色与特征的颜色乘以. 何时 这是白色的, 特性的颜色没有改变 。 此设定为所有特性 当评价样式的颜色时.
Default Value: Color.WHITE

readonly featureId : number

获取与此功能相关的特性 ID 。 3D 梯子 1.0 批量ID已返回。 对于 EXT mesh features,这是来自 选中的特性 ID 设置.
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.

polylinePositions : Float64Array

Gets a typed array containing the ECEF positions of the polyline. Returns undefined if Cesium3DTileset#vectorKeepDecodedPositions is false 或特性不是向量瓦中的多线.
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.

readonly primitive : Cesium3DTileset

All objects returned by Scene#pick have a primitive property. This returns 包含该特性的平板.

show : boolean

如果显示特性, 则获取或设定 。 此设定为所有特性 当一个风格的节目被评价时.
Default Value: true

readonly tileset : Cesium3DTileset

获得包含特性的平板.

Methods

static Cesium.Cesium3DTileFeature.getPropertyInherited(content, batchId, name)*

返回带有指定名称的特性财产副本,检查所有 来自 3D 梯度 1.0 格式、 EXT structural 元数据及遗产的元数据 EXT feature metadata glTF 扩展名,以及显示于 平面图 JSON (3D tiles 1.1)或3DTILES metadata 3D tiles扩展. 元数据从最具体的名称到最普通的名称和 返回第一个匹配。 元数据按此顺序检查 :
  1. Batch table (structural metadata) property by semantic
  2. Batch table (structural metadata) property by property ID
  3. Content metadata property by semantic
  4. Content metadata property by property
  5. Tile metadata property by semantic
  6. Tile metadata property by property ID
  7. Subtree metadata property by semantic
  8. Subtree metadata property by property ID
  9. Group metadata property by semantic
  10. Group metadata property by property ID
  11. Tileset metadata property by semantic
  12. Tileset metadata property by property ID
  13. Otherwise, return undefined

For 3D Tiles Next details, see the 3DTILES_metadata Extension for 3D Tiles, as well as the EXT_structural_metadata Extension for glTF. For the legacy glTF extension, see EXT_feature_metadata Extension

Name Type Description
content Cesium3DTileContent 元数据访问内容
batchId number 特性的批量ID(或特征ID)以获取属性
name string 特征的语义或属性ID. 语义在元数据每个颗粒的属性标识前都要检查.
Returns:
The value of the property or undefined if the feature does not have this property.
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.

getProperty(name)*

返回带有指定名称的特性属性值的副本。 包括来自此特性的属性 在使用批次表等级时,分类和继承的分类.
Name Type Description
name string 财产的大小写名称.
Returns:
The value of the property or undefined if the feature does not have this property.
Example:
// Display all the properties for a feature in the console log.
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)}`);
}
See:

getPropertyIds(results)Array.<string>

返回特性的属性标识组。 包括来自此特性的属性 在使用批次表等级时,分类和继承的分类.
Name Type Description
results Array.<string> optional 存储结果的数组 .
Returns:
特征属性的ID.
See:

hasProperty(name)boolean

返回特性是否包含此属性 。 包括来自此特性的属性 在使用批次表等级时,分类和继承的分类.
Name Type Description
name string 财产的大小写名称.
Returns:
特性是否包含此属性 .
See:

setProperty(name, value)

设置特性属性与给定名称的值.

如果一个有给定名称的财产不存在,它就是创建的.

Name Type Description
name string 财产的大小写名称.
value * 将复制的属性的值 .
Throws:
  • DeveloperError : Inherited batch table hierarchy property is read only.
Examples:
const height = feature.getProperty('Height'); // e.g., the height of a building
const name = 'clicked';
if (feature.getProperty(name)) {
    console.log('already clicked');
} else {
    feature.setProperty(name, true);
    console.log('first click');
}
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.