message: WIP loading of child tiles.
diff: @@ -50,6 +50,7 @@ export class Tile {
  public readonly zoomFactor?: number;
  private readonly _childIds: string[];
  private _childrenLastUsed: BeTimePoint;
  + private _childrenLoadStatus: TileTree.LoadStatus;
  private _children?: Tile[];
  private readonly _contentRange?: ElementAlignedBox3d;
  private _graphic?: RenderGraphic;
  @@ -75,6 +76,9 @@ export class Tile {
  // ###TODO: Back-end is not setting maximumSize in json!
  if (undefined === this.maximumSize)
  this.maximumSize = this.hasGraphics ? 512 : 0;
  +
  + // ###TODO: Loading children currently causes stack overflow in DgnPlatform...this._childrenLoadStatus = this.hasChildren ? TileTree.LoadStatus.NotLoaded : TileTree.LoadStatus.Loaded;
  + this._childrenLoadStatus = TileTree.LoadStatus.Loaded;
  }
  private loadGraphics(blob?: Uint8Array): void {
  @@ -120,7 +124,7 @@ export class Tile {
  public get hasGraphics(): boolean { return undefined !== this.graphics; }
  public get hasZoomFactor(): boolean { return undefined !== this.zoomFactor; }
  public get children(): Tile[] | undefined { return this._children; }
  - // ###TODO public loadChildren()
  + public get iModel(): IModelConnection { return this.root.iModel; }
  public get hasContentRange(): boolean { return undefined !== this._contentRange; }
  public isRegionCulled(args: Tile.DrawArgs): boolean { return this.isCulled(this.range, args); }
  @@ -213,7 +217,7 @@ export class Tile {
  }
  }
  - // ###TODO: load children
  + this.loadChildren(); // NB: asynchronous
  const children = canSkipThisTile ? this.children : undefined;
  if (undefined !== children) {
  this._childrenLastUsed = args.now;
  @@ -260,6 +264,7 @@ export class Tile {
  child.setAbandoned();
  children.length = 0;
  + this._childrenLoadStatus = TileTree.LoadStatus.NotLoaded;
  }
  }
  @@ -274,6 +279,23 @@ export class Tile {
  const isCulled = isOutside || isClipped;
  return this._doCulling && isCulled;
  }
  +
  + private loadChildren(): TileTree.LoadStatus {
  + if (TileTree.LoadStatus.NotLoaded === this._childrenLoadStatus) {
  + this._childrenLoadStatus = TileTree.LoadStatus.Loading;
  + const childIds: TileId[] = this._childIds.map((childId: string) => new TileId(this.root.id, childId));
  + this.iModel.tiles.getTileProps(childIds).then((props: TileProps[]) => {
  + this._children = [];
  + this._childrenLoadStatus = TileTree.LoadStatus.Loaded;
  + if (undefined !== props) {
  + for (const prop of props)
  + this._children.push(new Tile(Tile.Params.fromJSON(prop, this.root, this)));
  + }
  + }).catch((_err) => { this._childrenLoadStatus = TileTree.LoadStatus.NotFound; });
  + }
  +
  + return this._childrenLoadStatus;
  + }
  }
  export namespace Tile {
  