BatchTableProperties Interface

Provides access to per-feature properties within a RealityTileTree. A RealityTileTree may refer to a tileset in one of the 3D Tiles 1.0. Tiles within such tilesets may include a batch table describing subcomponents ("features") within the tile. For example, a tileset representing a building may encode each door, window, and wall as separate features. The batch table may additionally contain metadata in JSON format describing each feature.

During tile decoding, iTwin.js assigns unique, transient Id64Strings to each unique feature within the tileset. When interacting with tileset features (e.g., via a SelectionSet or HitDetail), the features are identified by these transient Ids. The tile tree's BatchTableProperties maintains the mapping between the transient Ids and the per-feature properties.

The following example illustrates one way to obtain the properties of a specific feature within a reality model's batch table:


/** Given a viewport that is displaying one or more context reality models and the Id of a feature within one of those models' batch tables,
 * return the JSON properties associated with that feature.
 * @beta
 */
export function getBatchTableFeatureProperties(featureId: Id64String, viewport: Viewport): Record<string, any> | undefined {
  // Iterate the viewport's context reality models to find the one to which the specified feature belongs.
  for (const model of viewport.displayStyle.realityModels) {
    const tree = model.treeRef.treeOwner.tileTree;

    // Only RealityTileTrees have batch tables, hence the `instanceof` check.
    const batchTableProperties = tree instanceof RealityTileTree ? tree.batchTableProperties : undefined;
    const featureProperties = batchTableProperties?.getFeatureProperties(featureId);
    if (featureProperties)
      return featureProperties;
  }

  // The specified feature was not found in any context reality model's batch table.
  return undefined;
}

@see RealityTileTree.batchTableProperties to obtain the batch table properties for a TileTree.

Methods

Name Description
entries(): Iterable<{ id: string, properties: Record<string, any> }> Obtain an iterator over all of the features in the batch table and their properties.  
getFeatureProperties(id: string): undefined | Record<string, any> Obtain the JSON properties associated with the specified transient Id.  

Defined in

Last Updated: 16 April, 2024