@itwin/core-frontend
Version:
iTwin.js frontend components
55 lines • 2.5 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* 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.LayerTileTreeHandler = void 0;
const internal_1 = require("../../tile/internal");
/** @internal */
class LayerTileTreeHandler {
_layerSettings = new Map();
_imageryTreeState = new Map();
_modelIdToIndex = new Map();
layerClassifiers = new Map();
_ref;
get imageryTreeState() { return this._imageryTreeState; }
get layerSettings() { return this._layerSettings; }
get modelIdToIndex() { return this._modelIdToIndex; }
get layerImageryTrees() { return this._ref.layerImageryTrees; }
constructor(ref) {
this._ref = ref;
}
/** Add a new imagery tile tree / map-layer settings pair and initialize the imagery tile tree state.
* @internal
*/
addImageryLayer(tree, settings, index, baseImageryLayer) {
this._ref.layerImageryTrees.push({ tree, settings, baseImageryLayer });
this._layerSettings.set(tree.modelId, settings);
if (!this._imageryTreeState.has(tree.modelId))
this._imageryTreeState.set(tree.modelId, new internal_1.ImageryTileTreeState());
this._modelIdToIndex.set(tree.modelId, index);
}
/** @internal */
addModelLayer(layerTreeRef, context) {
const tileTreeClassName = this._ref.rootTile.tree.constructor.name;
const classifier = context.addPlanarClassifier(`MapLayer ${tileTreeClassName}-${this._ref.modelId}-${layerTreeRef.layerIndex}`, layerTreeRef);
if (classifier)
this.layerClassifiers.set(layerTreeRef.layerIndex, classifier);
}
/** @internal */
clearLayers() {
this._ref.rootTile.clearLayers();
}
/** @internal */
collectClassifierGraphics(args, selectedTiles) {
this.layerClassifiers.forEach((layerClassifier) => {
layerClassifier.collectGraphics(args.context, { modelId: this._ref.modelId, tiles: selectedTiles, location: args.location, isPointCloud: this._ref.isPointCloud });
});
}
}
exports.LayerTileTreeHandler = LayerTileTreeHandler;
//# sourceMappingURL=LayerTileTreeHandler.js.map
;