@itwin/core-frontend
Version:
iTwin.js frontend components
82 lines • 2.78 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 WebGL
*/
import { Id64 } from "@itwin/core-bentley";
import { Graphic } from "./Graphic";
class GraphicWrapper extends Graphic {
graphic;
constructor(graphic) {
super();
this.graphic = graphic;
}
dispose() {
this.graphic[Symbol.dispose]();
}
get isDisposed() {
return this.graphic.isDisposed;
}
get isPickable() {
return this.graphic.isPickable;
}
collectStatistics(stats) {
this.graphic.collectStatistics(stats);
}
unionRange(range) {
this.graphic.unionRange(range);
}
}
/** Within a single tile, contains graphics belonging to a single layer.
* The same layer may appear in multiple tiles, both within the same tile tree and in other tile trees.
* Within a single tile tree, all Layers are contained within the same LayerContainer.
* @internal
*/
export class Layer extends GraphicWrapper {
layerId;
_idLo;
_idHi;
constructor(graphic, layerId) {
super(graphic);
this.layerId = layerId;
const pair = Id64.getUint32Pair(layerId);
this._idLo = pair.lower;
this._idHi = pair.upper;
}
getPriority(target) {
return target.currentFeatureSymbologyOverrides.getSubCategoryPriority(this._idLo, this._idHi);
}
addCommands(commands) {
commands.addLayerCommands(this);
}
addHiliteCommands(commands, pass) {
commands.addHiliteLayerCommands(this.graphic, pass);
}
}
/** Contains a GraphicBranch that can contain Layers, for a single model / tile-tree.
* All geometry within the container has the same Z.
* @internal
*/
export class LayerContainer extends GraphicWrapper {
renderPass;
elevation;
constructor(graphic, drawAsOverlay, transparency, elevation) {
super(graphic);
this.elevation = elevation;
if (drawAsOverlay)
this.renderPass = 11 /* RenderPass.OverlayLayers */;
else if (transparency > 0)
this.renderPass = 7 /* RenderPass.TranslucentLayers */;
else
this.renderPass = 1 /* RenderPass.OpaqueLayers */; // ###TODO: What about layers containing naturally-transparent geometry?
}
addCommands(commands) {
commands.processLayers(this);
}
addHiliteCommands(commands, pass) {
commands.addHiliteLayerCommands(this.graphic, pass);
}
}
//# sourceMappingURL=Layer.js.map