UNPKG

@itwin/core-frontend

Version:
57 lines 2.14 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Tiles */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DisclosedTileTreeSet = void 0; const core_bentley_1 = require("@itwin/core-bentley"); /** A set of [[TileTree]]s disclosed by a set of objects implementing [[TileTreeDiscloser]], used to collect references to tile trees in use by those objects. * @public * @extensions */ class DisclosedTileTreeSet { _processed = new Set(); _trees; /** Construct a new set. * @param comparator If supplied, a comparison function used to determine the order of iteration of the set; otherwise, iteration will proceed in insertion order. */ constructor(comparator) { this._trees = comparator ? new core_bentley_1.OrderedSet(comparator) : new Set(); } /** Returns true if the specified tree has been [[add]]ed to the set. */ has(tree) { return this._trees.has(tree); } /** Adds the specified tree to the set. */ add(tree) { this._trees.add(tree); } /** Iterates all trees in the set. * @note Do not [[add]] to the set during iteration. */ [Symbol.iterator]() { return this._trees[Symbol.iterator](); } /** The number of trees in the set. */ get size() { return this._trees.size; } /** Add all tile trees referenced by `discloser` to the set. */ disclose(discloser) { if (this._processed.has(discloser)) return; this._processed.add(discloser); discloser.discloseTileTrees(this); } /** Clear the contents of this set. */ clear() { this._processed.clear(); this._trees.clear(); } } exports.DisclosedTileTreeSet = DisclosedTileTreeSet; //# sourceMappingURL=DisclosedTileTreeSet.js.map