English中文

VoxelCell

new Cesium.VoxelCell(primitive, tileIndex, sampleIndex)

一个细胞来自 A cell from a VoxelPrimitive.

提供对与体素图元的一个单元关联的属性的访问。 Provides access to properties associated with one cell of a voxel primitive.

不要直接构建它。通过使用选择来访问它 Do not construct this directly. Access it through picking using Scene#pickVoxel.

名称 Name 类型 Type 说明 Description
primitive VoxelPrimitive 包含细胞的体素基元 The voxel primitive containing the cell
tileIndex number 瓷砖的索引 The index of the tile
sampleIndex number 图块内样本的索引,包含该单元格的元数据 The index of the sample within the tile, containing metadata for this cell
示例: Example:
// On left click, display all the properties for a voxel cell in the console log.
handler.setInputAction(function(movement) {
  const voxelCell = scene.pickVoxel(movement.position);
  if (voxelCell instanceof Cesium.VoxelCell) {
    const propertyIds = voxelCell.getPropertyIds();
    const length = propertyIds.length;
    for (let i = 0; i < length; ++i) {
      const propertyId = propertyIds[i];
      console.log(`{propertyId}: ${voxelCell.getProperty(propertyId)}`);
    }
  }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
实验性 Experimental

此功能不是最终版本,可能会在没有 Cesium 标准弃用政策的情况下进行更改。 This feature is not final and is subject to change without Cesium's standard deprecation policy.

成员 Members

获取包含单元格的定向边界框的副本。 Get a copy of the oriented bounding box containing the cell.
返回的所有对象 All objects returned by Scene#pick 有一个 have a primitive 财产。这将返回包含该单元的 VoxelPrimitive。 property. This returns the VoxelPrimitive containing the cell.

readonly sampleIndex : number

获取单元格的样本索引。 Get the sample index of the cell.

readonly tileIndex : number

获取包含单元格的图块的索引。 Get the index of the tile containing the cell.

方法 Methods

getNames()Array.<string>

返回该功能的元数据属性名称数组。 Returns an array of metadata property names for the feature.
返回: Returns:
要素属性的 ID。 The IDs of the feature's properties.

getProperty(name)*

返回具有给定名称的单元格中元数据值的副本。 Returns a copy of the value of the metadata in the cell with the given name.
名称 Name 类型 Type 说明 Description
name string 属性的名称区分大小写。 The case-sensitive name of the property.
返回: Returns:
财产的价值或 The value of the property or undefined 如果该功能没有此属性。 if the feature does not have this property.
示例: Example:
// Display all the properties for a voxel cell in the console log.
const names = voxelCell.getNames();
for (let i = 0; i < names.length; ++i) {
  const name = names[i];
  console.log(`{name}: ${voxelCell.getProperty(name)}`);
}

hasProperty(name)boolean

Returns true 如果该功能包含此属性。 if the feature contains this property.
名称 Name 类型 Type 说明 Description
name string 属性的名称区分大小写。 The case-sensitive name of the property.
返回: Returns:
该功能是否包含此属性。 Whether the feature contains this property.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.