Appearance
KBE3D / KBCore / Cesium / VoxelCell
类: VoxelCell
A cell from a VoxelPrimitive. <p> Provides access to properties associated with one cell of a voxel primitive. </p> <p> Do not construct this directly. Access it through picking using Scene#pickVoxel. </p>
示例
ts
// 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);参数
The voxel primitive containing the cell
参数
The index of the tile
参数
The index of the sample within the tile, containing metadata for this cell
属性
primitive
readonlyprimitive:VoxelPrimitive
All objects returned by Scene#pick have a <code>primitive</code> property. This returns the VoxelPrimitive containing the cell.
sampleIndex
readonlysampleIndex:number
Get the sample index of the cell.
tileIndex
readonlytileIndex:number
Get the index of the tile containing the cell.
orientedBoundingBox
readonlyorientedBoundingBox:OrientedBoundingBox
Get a copy of the oriented bounding box containing the cell.
方法
hasProperty()
hasProperty(
name:string):boolean
Returns <code>true</code> if the feature contains this property.
参数
name
string
The case-sensitive name of the property.
返回
boolean
Whether the feature contains this property.
getNames()
getNames():
string[]
Returns an array of metadata property names for the feature.
返回
string[]
The IDs of the feature's properties.
getProperty()
getProperty(
name:string):any
Returns a copy of the value of the metadata in the cell with the given name.
参数
name
string
The case-sensitive name of the property.
返回
any
The value of the property or undefined if the feature does not have this property.
示例
ts
// 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)}`);
}构造函数
构造函数
new VoxelCell(
primitive:VoxelPrimitive,tileIndex:number,sampleIndex:number):VoxelCell
参数
primitive
tileIndex
number
sampleIndex
number
返回
VoxelCell
