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.
示例: 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
-
默认值: Default Value:
Color.WHITE
实验性 Experimental
此功能使用的是 3D Tiles 规范的一部分,该规范不是最终版本,并且可能会在没有 Cesium 的标准弃用政策的情况下进行更改。 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.
Cesium3DTileset#vectorKeepDecodedPositions 为 false 或该要素不是矢量切片中的折线。 is false or the feature is not a polyline in a vector tile.
实验性 Experimental
此功能使用的是 3D Tiles 规范的一部分,该规范不是最终版本,并且可能会在没有 Cesium 的标准弃用政策的情况下进行更改。 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
Scene#pick 有一个 have a primitive 财产。这将返回包含该要素的图块集。 property. This returns the tileset containing the feature.
-
默认值: Default Value:
true
readonly tileset : Cesium3DTileset
方法 Methods
- 按语义划分的批处理表(结构元数据)属性 Batch table (structural metadata) property by semantic
- 按属性 ID 划分的批处理表(结构元数据)属性 Batch table (structural metadata) property by property ID
- 按语义划分的内容元数据属性 Content metadata property by semantic
- 按属性划分的内容元数据属性 Content metadata property by property
- 按语义平铺元数据属性 Tile metadata property by semantic
- 按属性 ID 平铺元数据属性 Tile metadata property by property ID
- 按语义划分的子树元数据属性 Subtree metadata property by semantic
- 按属性 ID 划分的子树元数据属性 Subtree metadata property by property ID
- 按语义对元数据属性进行分组 Group metadata property by semantic
- 按属性 ID 对元数据属性进行分组 Group metadata property by property ID
- 按语义划分的图块集元数据属性 Tileset metadata property by semantic
- 按属性 ID 划分的图块集元数据属性 Tileset metadata property by property ID
- 否则,返回未定义 Otherwise, return undefined
有关 3D Tiles Next 详细信息,请参阅 For 3D Tiles Next details, see the 3DTILES_metadata Extension 对于 3D Tiles,以及 for 3D Tiles, as well as the EXT_structural_metadata Extension 对于 glTF。对于旧版 glTF 扩展,请参阅 for glTF. For the legacy glTF extension, see EXT_feature_metadata Extension
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
content |
Cesium3DTileContent | 用于访问元数据的内容 The content for accessing the metadata |
batchId |
number | 要获取其属性的要素的批次 ID(或要素 ID) The batch ID (or feature ID) of the feature to get a property for |
name |
string | 功能的语义或属性 ID。在元数据的每个粒度中,在属性 ID 之前检查语义。 The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata. |
返回: Returns:
undefined 如果该功能没有此属性。 if the feature does not have this property.
实验性 Experimental
此功能使用的是 3D Tiles 规范的一部分,该规范不是最终版本,并且可能会在没有 Cesium 的标准弃用政策的情况下进行更改。 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.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
name |
string | 属性的名称区分大小写。 The case-sensitive name of the property. |
返回: Returns:
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:
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
results |
Array.<string> | 可选 optional 用于存储结果的数组。 An array into which to store the results. |
返回: Returns:
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
name |
string | 属性的名称区分大小写。 The case-sensitive name of the property. |
返回: Returns:
如果具有给定名称的属性不存在,则会创建该属性。 If a property with the given name doesn't exist, it is created.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
name |
string | 属性的名称区分大小写。 The case-sensitive name of the property. |
value |
* | 将复制的属性的值。 The value of the property that will be copied. |
抛出: 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');
}
