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 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);
成员(属性)
-
默认值:
Color.WHITE
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.
Cesium3DTileset#vectorKeepDecodedPositions
is false
or the feature is not a polyline in a vector tile.
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
Scene#pick
have a primitive
property. This returns
the tileset containing the feature.
-
默认值:
true
readonly tileset : Cesium3DTileset
方法
- Batch table (structural metadata) property by semantic
- Batch table (structural metadata) property by property ID
- Content metadata property by semantic
- Content metadata property by property
- Tile metadata property by semantic
- Tile metadata property by property ID
- Subtree metadata property by semantic
- Subtree metadata property by property ID
- Group metadata property by semantic
- Group metadata property by property ID
- Tileset metadata property by semantic
- Tileset metadata property by property ID
- 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
参数名称 | 类型 | 描述信息 |
---|---|---|
content |
Cesium3DTileContent | The content for accessing the metadata |
batchId |
number | The batch ID (or feature ID) of the feature to get a property for |
name |
string | The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
name |
string | The case-sensitive name of the property. |
返回值:
undefined
if the feature does not have this property.
使用示例:
// 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)}`);
}
参考:
参数名称 | 类型 | 描述信息 |
---|---|---|
results |
Array.<string> | 可选 An array into which to store the results. |
返回值:
参数名称 | 类型 | 描述信息 |
---|---|---|
name |
string | The case-sensitive name of the property. |
返回值:
If a property with the given name doesn't exist, it is created.
参数名称 | 类型 | 描述信息 |
---|---|---|
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.
使用示例s:
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');
}