@itwin/core-common 4.4.0-dev.21 → 4.4.0-dev.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -173,6 +173,11 @@ export interface RenderFeatureTable {
173
173
  populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void;
174
174
  /** @alpha */
175
175
  getAnimationNodeId(featureIndex: number): number;
176
+ /** Get the Id of the model associated with the feature at the specified index.
177
+ * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].
178
+ * This is more efficient than [[getFeature]] for callers who are only interested in the model Id.
179
+ */
180
+ getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
176
181
  }
177
182
  /**
178
183
  * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,
@@ -207,6 +212,7 @@ export declare class PackedFeatureTable implements RenderFeatureTable {
207
212
  getAnimationNodeId(featureIndex: number): number;
208
213
  /** @internal */
209
214
  getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature;
215
+ getModelIdPair(_featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
210
216
  /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */
211
217
  findElementId(featureIndex: number): Id64String | undefined;
212
218
  /** Return true if this table contains exactly 1 feature. */
@@ -269,6 +275,7 @@ export declare class MultiModelPackedFeatureTable implements RenderFeatureTable
269
275
  getFeature(featureIndex: number, result: ModelFeature): ModelFeature;
270
276
  findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined;
271
277
  getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
278
+ getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
272
279
  findElementId(featureIndex: number): Id64String | undefined;
273
280
  iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex>;
274
281
  iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>;
@@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cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU;IAK3E,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIzD,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;IAiB5E,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;IAM1E,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAIhD,wBAAwB,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAGvF"}
@@ -307,6 +307,11 @@ class PackedFeatureTable {
307
307
  result.modelId.upper = this.batchModelIdPair.upper;
308
308
  return result;
309
309
  }
310
+ getModelIdPair(_featureIndex, out) {
311
+ out.lower = this.batchModelIdPair.lower;
312
+ out.upper = this.batchModelIdPair.upper;
313
+ return out;
314
+ }
310
315
  /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */
311
316
  findElementId(featureIndex) {
312
317
  if (featureIndex >= this.numFeatures)
@@ -462,6 +467,10 @@ class MultiModelPackedFeatureTable {
462
467
  getElementIdPair(featureIndex, out) {
463
468
  return this._features.getElementIdPair(featureIndex, out);
464
469
  }
470
+ getModelIdPair(featureIndex, out) {
471
+ this._models.getModelIdPair(featureIndex, out);
472
+ return out;
473
+ }
465
474
  findElementId(featureIndex) {
466
475
  return this._features.findElementId(featureIndex);
467
476
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureTable.js","sourceRoot":"","sources":["../../src/FeatureTable.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,qDAAiD;AAEjD;;;;;;;;GAQG;AACH,MAAa,OAAO;IAKlB,YAAmB,YAAwB,mBAAI,CAAC,OAAO,EAAE,gBAA4B,mBAAI,CAAC,OAAO,E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C,EAAE,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,EAAE;YAC1E,IAAI,YAAY,GAAG,UAAU,CAAC,gBAAgB;gBAC5C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;YAElD,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACtD,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC;YAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC;YAC1C,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC;YAC5B,MAAM,MAAM,CAAC;SACd;IACH,CAAC;IAEM,QAAQ,CAAC,MAA8B;QAC5C,OAAO;YACL,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC/C,CAAC;IACJ,CAAC;IAEM,kBAAkB,CAAC,YAAoB;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEM,wBAAwB,CAAC,aAA4B,EAAE,SAAiB;QAC7E,IAAI,CAAC,SAAS,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC7F,CAAC;CACF;AApFD,oEAoFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport {\r\n assert, compareNumbers, compareStrings, Id64, Id64String, IndexedValue, IndexMap, UintArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { GeometryClass } from \"./GeometryParams\";\r\n\r\n/** Describes a discrete entity within a batched [RenderGraphic]($frontend) that can be\r\n * grouped with other such entities in a [[FeatureTable]].\r\n * Features roughly correlate to elements: a [Tile]($frontend)'s graphics combines geometry from every\r\n * [GeometricElement]($backend) that intersects the tile's volume, so each element produces at least one feature.\r\n * However, an element's geometry stream can contain geometry belonging to multiple different combinations of [SubCategory]($backend) and\r\n * [[GeometryClass]], so an individual element may produce more than one feature.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class Feature {\r\n public readonly elementId: Id64String;\r\n public readonly subCategoryId: Id64String;\r\n public readonly geometryClass: GeometryClass;\r\n\r\n public constructor(elementId: Id64String = Id64.invalid, subCategoryId: Id64String = Id64.invalid, geometryClass: GeometryClass = GeometryClass.Primary) {\r\n this.elementId = elementId;\r\n this.subCategoryId = subCategoryId;\r\n this.geometryClass = geometryClass;\r\n }\r\n\r\n public get isDefined(): boolean { return !Id64.isInvalid(this.elementId) || !Id64.isInvalid(this.subCategoryId) || this.geometryClass !== GeometryClass.Primary; }\r\n public get isUndefined(): boolean { return !this.isDefined; }\r\n\r\n /** Returns true if this feature is equivalent to the supplied feature. */\r\n public equals(other: Feature): boolean { return 0 === this.compare(other); }\r\n\r\n /** Performs ordinal comparison of this feature with another.\r\n * @param rhs The feature to compare with.\r\n * @returns zero if the features are equivalent, a negative value if this feature compares as \"less than\" `rhs`, or a positive value if this feature compares \"greater than\" `rhs`.\r\n */\r\n public compare(rhs: Feature): number {\r\n if (this === rhs)\r\n return 0;\r\n\r\n let cmp = compareNumbers(this.geometryClass, rhs.geometryClass);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.elementId, rhs.elementId);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.subCategoryId, rhs.subCategoryId);\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n}\r\n\r\n/** A [[Feature]] with a modelId identifying the model containing the feature, obtained from a [[RenderFeatureTable]].\r\n * @public\r\n */\r\nexport interface ModelFeature {\r\n modelId: Id64String;\r\n elementId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n}\r\n\r\n/** @public */\r\nexport namespace ModelFeature {\r\n /** Create a ModelFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.findFeature]] and [[RenderFeatureTable.getFeature]].\r\n */\r\n export function create(): ModelFeature {\r\n return {\r\n modelId: Id64.invalid,\r\n elementId: Id64.invalid,\r\n subCategoryId: Id64.invalid,\r\n geometryClass: GeometryClass.Primary,\r\n };\r\n }\r\n\r\n /** Returns `true` if any of `feature`'s properties differ from the defaults (invalid Ids and [[GeometryClass.Primary]]). */\r\n export function isDefined(feature: ModelFeature): boolean {\r\n return !Id64.isInvalid(feature.modelId) || !Id64.isInvalid(feature.elementId) || !Id64.isInvalid(feature.subCategoryId) || feature.geometryClass !== GeometryClass.Primary;\r\n }\r\n\r\n /** @alpha */\r\n export function unpack(packed: PackedFeature, result: ModelFeature, unpackedModelId?: Id64String): ModelFeature {\r\n result.modelId = unpackedModelId ?? Id64.fromUint32PairObject(packed.modelId);\r\n result.elementId = Id64.fromUint32PairObject(packed.elementId);\r\n result.subCategoryId = Id64.fromUint32PairObject(packed.subCategoryId);\r\n result.geometryClass = packed.geometryClass;\r\n return result;\r\n }\r\n}\r\n\r\n/** Represents a [[Feature]] within a [[RenderFeatureTable]]. This representation is optimized for use on the GPU.\r\n * @public\r\n */\r\nexport interface PackedFeature {\r\n modelId: Id64.Uint32Pair;\r\n elementId: Id64.Uint32Pair;\r\n subCategoryId: Id64.Uint32Pair;\r\n geometryClass: GeometryClass;\r\n /** @alpha */\r\n animationNodeId: number;\r\n}\r\n\r\n/** Represents a [[PackedFeature]] obtained from a [[RenderFeatureTable]], including the index of that feature within the table.\r\n * @public\r\n */\r\nexport interface PackedFeatureWithIndex extends PackedFeature {\r\n index: number;\r\n}\r\n\r\n/** @public */\r\nexport namespace PackedFeature {\r\n /** Create a PackedFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.getPackedFeature]].\r\n */\r\n export function create(): PackedFeature {\r\n const pair = { upper: 0, lower: 0 };\r\n return {\r\n modelId: { ...pair },\r\n elementId: { ...pair },\r\n subCategoryId: { ...pair },\r\n geometryClass: GeometryClass.Primary,\r\n animationNodeId: 0,\r\n };\r\n }\r\n\r\n /** Create a PackedFeatureWithIndex of [[GeometryClass.Primary]] with all invalid Ids and an index of zero.\r\n * This is primarily useful for creating a reusable `output` argument for [[RenderFeatureTable.iterable]].\r\n */\r\n export function createWithIndex(): PackedFeatureWithIndex {\r\n const result = create() as PackedFeatureWithIndex;\r\n result.index = 0;\r\n return result;\r\n }\r\n}\r\n\r\n/** Describes the type of a 'batch' of graphics representing multiple [[Feature]]s.\r\n * The most commonly-encountered batches are Tiles, which can be of either Primary or\r\n * Classifier type.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum BatchType {\r\n /** This batch contains graphics derived from a model's visible geometry. */\r\n Primary,\r\n /**\r\n * This batch contains color volumes which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to the stencil buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n VolumeClassifier,\r\n /**\r\n * This batch contains planar graphics which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to a texture buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n PlanarClassifier,\r\n}\r\n\r\n/** Defines a look-up table for [[Feature]]s within a batched [RenderGraphic]($frontend). Consecutive 32-bit\r\n * indices are assigned to each unique Feature. Primitives within the RenderGraphic can\r\n * use per-vertex indices to specify the distribution of Features within the primitive. The appearance of individual\r\n * features can be customized using [[FeatureOverrides]]. Typically a [Tile]($frontend) will contain a feature table\r\n * identifying the elements whose geometry appears within that tile.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class FeatureTable extends IndexMap<Feature> {\r\n public readonly modelId: Id64String;\r\n public readonly type: BatchType;\r\n\r\n /** Construct an empty FeatureTable. */\r\n public constructor(maxFeatures: number, modelId: Id64String = Id64.invalid, type: BatchType = BatchType.Primary) {\r\n super((lhs, rhs) => lhs.compare(rhs), maxFeatures);\r\n this.modelId = modelId;\r\n this.type = type;\r\n }\r\n\r\n /** Returns the maximum number of [[Feature]]s this FeatureTable can contain. */\r\n public get maxFeatures(): number { return this._maximumSize; }\r\n /** @internal */\r\n public get anyDefined(): boolean { return this.length > 1 || (1 === this.length && this._array[0].value.isDefined); }\r\n /** Returns true if this FeatureTable contains exactly one [[Feature]]. */\r\n public get isUniform(): boolean { return 1 === this.length; }\r\n /** If this FeatureTable contains exactly one [[Feature]], returns that Feature; otherwise returns undefined. */\r\n public get uniform(): Feature | undefined { return 1 === this.length ? this._array[0].value : undefined; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.VolumeClassifier]] geometry. */\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.PlanarClassifier]] geometry. */\r\n public get isPlanarClassifier(): boolean { return BatchType.PlanarClassifier === this.type; }\r\n\r\n /** Returns the Feature corresponding to the specified index, or undefined if the index is not present. */\r\n public findFeature(index: number): Feature | undefined {\r\n for (const entry of this._array)\r\n if (entry.index === index)\r\n return entry.value;\r\n\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public insertWithIndex(feature: Feature, index: number): void {\r\n const bound = this.lowerBound(feature);\r\n assert(!bound.equal);\r\n assert(!this.isFull);\r\n const entry = new IndexedValue<Feature>(feature, index);\r\n this._array.splice(bound.index, 0, entry);\r\n }\r\n\r\n /** @internal */\r\n public getArray(): Array<IndexedValue<Feature>> { return this._array; }\r\n\r\n /** Convert this feature table to a representation that can be supplied to [RenderSystem.createBatch]($frontend). */\r\n public pack(): RenderFeatureTable {\r\n return PackedFeatureTable.pack(this);\r\n }\r\n}\r\n\r\n/** @alpha */\r\nexport type ComputeNodeId = (feature: PackedFeatureWithIndex) => number;\r\n\r\n/** Representation of a [[FeatureTable]] suitable for use with [RenderSystem.createBatch]($frontend).\r\n * The [[Feature]]s are represented as [[PackedFeature]]s. The feature table may contain features from multiple [Model]($backend)s.\r\n * @see [[FeatureTable.pack]] to produce a RenderFeatureTable.\r\n * @public\r\n */\r\nexport interface RenderFeatureTable {\r\n /** The \"model Id\" of the tile tree containing the tile from which this feature table originated.\r\n * It may be a transient Id if, for example, the tile tree represents a reality model or represents the geometry of multiple\r\n * persistent models batched together.\r\n */\r\n readonly batchModelId: Id64String;\r\n /** A split representation of [[batchModelId]], to avoid having to constantly having to parse the string. */\r\n readonly batchModelIdPair: Id64.Uint32Pair;\r\n /** The number of features in the table; equivalently, one more than the largest feature index. */\r\n readonly numFeatures: number;\r\n /** The number of bytes consumed by the feature table, strictly for diagnostic purposes. */\r\n readonly byteLength: number;\r\n readonly type: BatchType;\r\n /** @alpha */\r\n animationNodeIds?: UintArray;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getFeature(featureIndex: number, result: ModelFeature): ModelFeature;\r\n\r\n /** Find the feature at the specified index. Returns undefined if featureIndex >= [[numFeatures]]. */\r\n findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined;\r\n\r\n /** Find the Id of the element associated with the feature at the specified index. */\r\n findElementId(featureIndex: number): Id64String | undefined;\r\n\r\n /** Get the Id of the element associated with the feature at the specified index as a pair of 32-bit integers.\r\n * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].\r\n */\r\n getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature;\r\n\r\n /** Get an object that provides ordered iteration over all features.\r\n * @note The `output` object is reused (mutated in place) as the current value on each iteration.\r\n */\r\n iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>;\r\n\r\n /** @alpha */\r\n populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void;\r\n\r\n /** @alpha */\r\n getAnimationNodeId(featureIndex: number): number;\r\n}\r\n\r\nconst scratchPackedFeature = PackedFeature.create();\r\n\r\nfunction populateAnimationNodeIds(table: RenderFeatureTable, computeNodeId: ComputeNodeId, maxNodeId: number): UintArray | undefined {\r\n assert(maxNodeId > 0);\r\n\r\n let nodeIds;\r\n const outputFeature = PackedFeature.createWithIndex();\r\n for (const feature of table.iterable(outputFeature)) {\r\n const nodeId = computeNodeId(feature);\r\n assert(nodeId <= maxNodeId);\r\n if (0 !== nodeId) {\r\n if (!nodeIds) {\r\n const size = table.numFeatures;\r\n nodeIds = maxNodeId < 0x100 ? new Uint8Array(size) : (maxNodeId < 0x10000 ? new Uint16Array(size) : new Uint32Array(size));\r\n }\r\n\r\n nodeIds[feature.index] = nodeId;\r\n }\r\n }\r\n\r\n return nodeIds;\r\n}\r\n\r\n/**\r\n * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,\r\n * wherein each feature occupies 3 32-bit integers.\r\n * @internal\r\n */\r\nexport class PackedFeatureTable implements RenderFeatureTable {\r\n private readonly _data: Uint32Array;\r\n public readonly batchModelId: Id64String;\r\n public readonly batchModelIdPair: Id64.Uint32Pair;\r\n public readonly numFeatures: number;\r\n public readonly anyDefined: boolean;\r\n public readonly type: BatchType;\r\n public animationNodeIds?: UintArray;\r\n\r\n public get byteLength(): number { return this._data.byteLength; }\r\n\r\n /** Construct a PackedFeatureTable from the packed binary data.\r\n * This is used internally when deserializing Tiles in iMdl format.\r\n * @internal\r\n */\r\n public constructor(data: Uint32Array, modelId: Id64String, numFeatures: number, type: BatchType, animationNodeIds?: UintArray) {\r\n this._data = data;\r\n this.batchModelId = modelId;\r\n this.batchModelIdPair = Id64.getUint32Pair(modelId);\r\n this.numFeatures = numFeatures;\r\n this.type = type;\r\n this.animationNodeIds = animationNodeIds;\r\n\r\n switch (this.numFeatures) {\r\n case 0:\r\n this.anyDefined = false;\r\n break;\r\n case 1:\r\n this.anyDefined = ModelFeature.isDefined(this.getFeature(0, ModelFeature.create()));\r\n break;\r\n default:\r\n this.anyDefined = true;\r\n break;\r\n }\r\n\r\n assert(this._data.length >= this._subCategoriesOffset);\r\n assert(undefined === this.animationNodeIds || this.animationNodeIds.length === this.numFeatures);\r\n }\r\n\r\n /** Create a packed feature table from a [[FeatureTable]]. */\r\n public static pack(featureTable: FeatureTable): PackedFeatureTable {\r\n // We must determine how many subcategories we have ahead of time to compute the size of the Uint32Array, as\r\n // the array cannot be resized after it is created.\r\n // We are not too worried about this as FeatureTables created on the front-end will contain few if any features; those obtained from the\r\n // back-end arrive within tiles already in the packed format.\r\n const subcategories = new Map<string, number>();\r\n for (const iv of featureTable.getArray()) {\r\n const found = subcategories.get(iv.value.subCategoryId.toString());\r\n if (undefined === found)\r\n subcategories.set(iv.value.subCategoryId, subcategories.size);\r\n }\r\n\r\n // We need 3 32-bit integers per feature, plus 2 32-bit integers per subcategory.\r\n const subCategoriesOffset = 3 * featureTable.length;\r\n const nUint32s = subCategoriesOffset + 2 * subcategories.size;\r\n const uint32s = new Uint32Array(nUint32s);\r\n\r\n for (const iv of featureTable.getArray()) {\r\n const feature = iv.value;\r\n const index = iv.index * 3;\r\n\r\n let subCategoryIndex = subcategories.get(feature.subCategoryId)!;\r\n assert(undefined !== subCategoryIndex); // we inserted it above...\r\n subCategoryIndex |= (feature.geometryClass << 24);\r\n\r\n uint32s[index + 0] = Id64.getLowerUint32(feature.elementId);\r\n uint32s[index + 1] = Id64.getUpperUint32(feature.elementId);\r\n uint32s[index + 2] = subCategoryIndex;\r\n }\r\n\r\n subcategories.forEach((index: number, id: string, _map) => {\r\n const index32 = subCategoriesOffset + 2 * index;\r\n uint32s[index32 + 0] = Id64.getLowerUint32(id);\r\n uint32s[index32 + 1] = Id64.getUpperUint32(id);\r\n });\r\n\r\n return new PackedFeatureTable(uint32s, featureTable.modelId, featureTable.length, featureTable.type);\r\n }\r\n\r\n /** Retrieve the Feature associated with the specified index. */\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result, this.batchModelId);\r\n }\r\n\r\n /** Returns the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public getElementIdPair(featureIndex: number, out?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n out = out ?? { lower: 0, upper: 0 };\r\n assert(featureIndex < this.numFeatures);\r\n const offset = 3 * featureIndex;\r\n out.lower = this._data[offset];\r\n out.upper = this._data[offset + 1];\r\n return out;\r\n }\r\n\r\n /** @internal */\r\n public getSubCategoryIdPair(featureIndex: number): Id64.Uint32Pair {\r\n const index = 3 * featureIndex;\r\n let subCatIndex = this._data[index + 2];\r\n subCatIndex = (subCatIndex & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n return { lower: this._data[subCatIndex], upper: this._data[subCatIndex + 1] };\r\n }\r\n\r\n /** @internal */\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return undefined !== this.animationNodeIds && featureIndex < this.numFeatures ? this.animationNodeIds[featureIndex] : 0;\r\n }\r\n\r\n /** @internal */\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n assert(featureIndex < this.numFeatures);\r\n\r\n const index32 = 3 * featureIndex;\r\n result.elementId.lower = this._data[index32];\r\n result.elementId.upper = this._data[index32 + 1];\r\n\r\n const subCatIndexAndClass = this._data[index32 + 2];\r\n result.geometryClass = (subCatIndexAndClass >>> 24) & 0xff;\r\n\r\n let subCatIndex = (subCatIndexAndClass & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n result.subCategoryId.lower = this._data[subCatIndex];\r\n result.subCategoryId.upper = this._data[subCatIndex + 1];\r\n\r\n result.animationNodeId = this.getAnimationNodeId(featureIndex);\r\n result.modelId.lower = this.batchModelIdPair.lower;\r\n result.modelId.upper = this.batchModelIdPair.upper;\r\n\r\n return result;\r\n }\r\n\r\n /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n if (featureIndex >= this.numFeatures)\r\n return undefined;\r\n else\r\n return this.readId(3 * featureIndex);\r\n }\r\n\r\n /** Return true if this table contains exactly 1 feature. */\r\n public get isUniform(): boolean { return 1 === this.numFeatures; }\r\n\r\n /** If this table contains exactly 1 feature, return it. */\r\n public getUniform(result: ModelFeature): ModelFeature | undefined {\r\n return this.isUniform ? this.getFeature(0, result) : undefined;\r\n }\r\n\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isPlanarClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isClassifier(): boolean { return this.isVolumeClassifier || this.isPlanarClassifier; }\r\n\r\n /** Unpack the features into a [[FeatureTable]]. */\r\n public unpack(): FeatureTable {\r\n const table = new FeatureTable(this.numFeatures, this.batchModelId);\r\n const feature = ModelFeature.create();\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getFeature(i, feature);\r\n table.insertWithIndex(new Feature(feature.elementId, feature.subCategoryId, feature.geometryClass), i);\r\n }\r\n\r\n return table;\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n assert(undefined === this.animationNodeIds);\r\n this.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getPackedFeature(i, output);\r\n output.index = i;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n private get _subCategoriesOffset(): number { return this.numFeatures * 3; }\r\n\r\n private readId(offset32: number): Id64String {\r\n return Id64.fromUint32Pair(this._data[offset32], this._data[offset32 + 1]);\r\n }\r\n}\r\n\r\ninterface PackedFeatureModelEntry {\r\n lastFeatureIndex: number;\r\n idLower: number;\r\n idUpper: number;\r\n}\r\n\r\nconst scratchPackedFeatureModelEntry = { lastFeatureIndex: -1, idLower: -1, idUpper: -1 };\r\n\r\n/** A table of model Ids associated with a [[MultiModelPackedFeatureTable]].\r\n * The feature indices in the packed feature table are grouped together by model, such that the first N features belong to model 1, the next M features to model 2, and so on.\r\n * The model table itself consists of one entry per model, where each entry looks like:\r\n * indexOfLastFeatureInModel: u32\r\n * modelId: u64\r\n * The modelId associated with a feature can therefore be derived by finding the entry in the model table with the highest indexOfLastFeatureInModel no greater than the feature index.\r\n * This lookup can be optimized using binary search.\r\n * Moreover, while iterating the feature table in sequence, the model table can be iterated in parallel so that no per-feature lookup of model Id is required.\r\n * @internal\r\n */\r\nexport class PackedFeatureModelTable {\r\n private readonly _data: Uint32Array;\r\n\r\n public constructor(data: Uint32Array) {\r\n this._data = data;\r\n assert(this._data.length % 3 === 0);\r\n }\r\n\r\n /** The number of models in the table. */\r\n public get length(): number {\r\n return this._data.length / 3;\r\n }\r\n\r\n public get byteLength(): number {\r\n return this._data.byteLength;\r\n }\r\n\r\n private getLastFeatureIndex(modelIndex: number): number {\r\n return this._data[modelIndex * 3];\r\n }\r\n\r\n public getEntry(modelIndex: number, result: PackedFeatureModelEntry): PackedFeatureModelEntry {\r\n if (modelIndex >= this.length) {\r\n result.idLower = result.idUpper = 0;\r\n result.lastFeatureIndex = Number.MAX_SAFE_INTEGER;\r\n return result;\r\n }\r\n\r\n const index = modelIndex * 3;\r\n result.lastFeatureIndex = this._data[index + 0];\r\n result.idLower = this._data[index + 1];\r\n result.idUpper = this._data[index + 2];\r\n return result;\r\n }\r\n\r\n /** Get the Id of the model associated with the specified feature, or an invalid Id if the feature is not associated with any model. */\r\n public getModelIdPair(featureIndex: number, result?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n if (!result)\r\n result = { lower: 0, upper: 0 };\r\n else\r\n result.lower = result.upper = 0;\r\n\r\n let first = 0;\r\n const last = this.length;\r\n let count = last;\r\n while (count > 0) {\r\n const step = Math.floor(count / 2);\r\n const mid = first + step;\r\n const lastFeatureIndex = this.getLastFeatureIndex(mid);\r\n if (featureIndex > lastFeatureIndex) {\r\n first = mid + 1;\r\n count -= step + 1;\r\n } else {\r\n count = step;\r\n }\r\n }\r\n\r\n if (first < last) {\r\n result.lower = this._data[first * 3 + 1];\r\n result.upper = this._data[first * 3 + 2];\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/** A PackedFeatureTable with a PackedFeatureModelTable appended to it, capable of storing features belonging to more than one model.\r\n * @internal\r\n */\r\nexport class MultiModelPackedFeatureTable implements RenderFeatureTable {\r\n private readonly _features: PackedFeatureTable;\r\n private readonly _models: PackedFeatureModelTable;\r\n\r\n public constructor(features: PackedFeatureTable, models: PackedFeatureModelTable) {\r\n this._features = features;\r\n this._models = models;\r\n }\r\n\r\n public static create(data: Uint32Array, batchModelId: Id64String, numFeatures: number, type: BatchType, numSubCategories: number): MultiModelPackedFeatureTable {\r\n const modelTableOffset = 3 * numFeatures + 2 * numSubCategories;\r\n const featureData = data.subarray(0, modelTableOffset);\r\n const features = new PackedFeatureTable(featureData, batchModelId, numFeatures, type);\r\n\r\n const modelData = data.subarray(modelTableOffset);\r\n const models = new PackedFeatureModelTable(modelData);\r\n\r\n return new MultiModelPackedFeatureTable(features, models);\r\n }\r\n\r\n public get batchModelId() { return this._features.batchModelId; }\r\n public get batchModelIdPair() { return this._features.batchModelIdPair; }\r\n public get numFeatures() { return this._features.numFeatures; }\r\n public get type() { return this._features.type; }\r\n public get animationNodeIds(): UintArray | undefined { return this._features.animationNodeIds; }\r\n public set animationNodeIds(ids: UintArray | undefined) { this._features.animationNodeIds = ids; }\r\n\r\n public get byteLength() {\r\n return this._features.byteLength + this._models.byteLength;\r\n }\r\n\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n this._features.getPackedFeature(featureIndex, result);\r\n this._models.getModelIdPair(featureIndex, result.modelId);\r\n return result;\r\n }\r\n\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result);\r\n }\r\n\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n public getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n return this._features.getElementIdPair(featureIndex, out);\r\n }\r\n\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n return this._features.findElementId(featureIndex);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n // Rather than perform a binary search on the model table to find each feature's model Id, traverse the model table in parallel with the feature table.\r\n let modelIndex = 0;\r\n const modelEntry = this._models.getEntry(modelIndex, scratchPackedFeatureModelEntry);\r\n\r\n for (let featureIndex = 0; featureIndex < this.numFeatures; featureIndex++) {\r\n if (featureIndex > modelEntry.lastFeatureIndex)\r\n this._models.getEntry(++modelIndex, modelEntry);\r\n\r\n this._features.getPackedFeature(featureIndex, output);\r\n output.modelId.lower = modelEntry.idLower;\r\n output.modelId.upper = modelEntry.idUpper;\r\n output.index = featureIndex;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return this._features.getAnimationNodeId(featureIndex);\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n this._features.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FeatureTable.js","sourceRoot":"","sources":["../../src/FeatureTable.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,qDAAiD;AAEjD;;;;;;;;GAQG;AACH,MAAa,OAAO;IAKlB,YAAmB,YAAwB,mBAAI,CAAC,OAAO,EAAE,gBAA4B,mBAAI,CAAC,OAAO,EAAE,gBAA+B,8BAAa,CAAC,OAAO;QACrJ,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,IAAW,SAAS,KAAc,OAAO,CAAC,mBAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,8BAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAClK,IAAW,WAAW,KAAc,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAE7D,0EAA0E;IACnE,MAAM,CAAC,KAAc,IAAa,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5E;;;OAGG;IACI,OAAO,CAAC,GAAY;QACzB,IAAI,IAAI,KAAK,GAAG;YACd,OAAO,CAAC,CAAC;QAEX,IAAI,GAAG,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;QAChE,IAAI,CAAC,KAAK,GAAG,EAAE;YACb,GAAG,GA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MAAM,CAAC;SACd;IACH,CAAC;IAEM,QAAQ,CAAC,MAA8B;QAC5C,OAAO;YACL,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC/C,CAAC;IACJ,CAAC;IAEM,kBAAkB,CAAC,YAAoB;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEM,wBAAwB,CAAC,aAA4B,EAAE,SAAiB;QAC7E,IAAI,CAAC,SAAS,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC7F,CAAC;CACF;AAzFD,oEAyFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport {\r\n assert, compareNumbers, compareStrings, Id64, Id64String, IndexedValue, IndexMap, UintArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { GeometryClass } from \"./GeometryParams\";\r\n\r\n/** Describes a discrete entity within a batched [RenderGraphic]($frontend) that can be\r\n * grouped with other such entities in a [[FeatureTable]].\r\n * Features roughly correlate to elements: a [Tile]($frontend)'s graphics combines geometry from every\r\n * [GeometricElement]($backend) that intersects the tile's volume, so each element produces at least one feature.\r\n * However, an element's geometry stream can contain geometry belonging to multiple different combinations of [SubCategory]($backend) and\r\n * [[GeometryClass]], so an individual element may produce more than one feature.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class Feature {\r\n public readonly elementId: Id64String;\r\n public readonly subCategoryId: Id64String;\r\n public readonly geometryClass: GeometryClass;\r\n\r\n public constructor(elementId: Id64String = Id64.invalid, subCategoryId: Id64String = Id64.invalid, geometryClass: GeometryClass = GeometryClass.Primary) {\r\n this.elementId = elementId;\r\n this.subCategoryId = subCategoryId;\r\n this.geometryClass = geometryClass;\r\n }\r\n\r\n public get isDefined(): boolean { return !Id64.isInvalid(this.elementId) || !Id64.isInvalid(this.subCategoryId) || this.geometryClass !== GeometryClass.Primary; }\r\n public get isUndefined(): boolean { return !this.isDefined; }\r\n\r\n /** Returns true if this feature is equivalent to the supplied feature. */\r\n public equals(other: Feature): boolean { return 0 === this.compare(other); }\r\n\r\n /** Performs ordinal comparison of this feature with another.\r\n * @param rhs The feature to compare with.\r\n * @returns zero if the features are equivalent, a negative value if this feature compares as \"less than\" `rhs`, or a positive value if this feature compares \"greater than\" `rhs`.\r\n */\r\n public compare(rhs: Feature): number {\r\n if (this === rhs)\r\n return 0;\r\n\r\n let cmp = compareNumbers(this.geometryClass, rhs.geometryClass);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.elementId, rhs.elementId);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.subCategoryId, rhs.subCategoryId);\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n}\r\n\r\n/** A [[Feature]] with a modelId identifying the model containing the feature, obtained from a [[RenderFeatureTable]].\r\n * @public\r\n */\r\nexport interface ModelFeature {\r\n modelId: Id64String;\r\n elementId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n}\r\n\r\n/** @public */\r\nexport namespace ModelFeature {\r\n /** Create a ModelFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.findFeature]] and [[RenderFeatureTable.getFeature]].\r\n */\r\n export function create(): ModelFeature {\r\n return {\r\n modelId: Id64.invalid,\r\n elementId: Id64.invalid,\r\n subCategoryId: Id64.invalid,\r\n geometryClass: GeometryClass.Primary,\r\n };\r\n }\r\n\r\n /** Returns `true` if any of `feature`'s properties differ from the defaults (invalid Ids and [[GeometryClass.Primary]]). */\r\n export function isDefined(feature: ModelFeature): boolean {\r\n return !Id64.isInvalid(feature.modelId) || !Id64.isInvalid(feature.elementId) || !Id64.isInvalid(feature.subCategoryId) || feature.geometryClass !== GeometryClass.Primary;\r\n }\r\n\r\n /** @alpha */\r\n export function unpack(packed: PackedFeature, result: ModelFeature, unpackedModelId?: Id64String): ModelFeature {\r\n result.modelId = unpackedModelId ?? Id64.fromUint32PairObject(packed.modelId);\r\n result.elementId = Id64.fromUint32PairObject(packed.elementId);\r\n result.subCategoryId = Id64.fromUint32PairObject(packed.subCategoryId);\r\n result.geometryClass = packed.geometryClass;\r\n return result;\r\n }\r\n}\r\n\r\n/** Represents a [[Feature]] within a [[RenderFeatureTable]]. This representation is optimized for use on the GPU.\r\n * @public\r\n */\r\nexport interface PackedFeature {\r\n modelId: Id64.Uint32Pair;\r\n elementId: Id64.Uint32Pair;\r\n subCategoryId: Id64.Uint32Pair;\r\n geometryClass: GeometryClass;\r\n /** @alpha */\r\n animationNodeId: number;\r\n}\r\n\r\n/** Represents a [[PackedFeature]] obtained from a [[RenderFeatureTable]], including the index of that feature within the table.\r\n * @public\r\n */\r\nexport interface PackedFeatureWithIndex extends PackedFeature {\r\n index: number;\r\n}\r\n\r\n/** @public */\r\nexport namespace PackedFeature {\r\n /** Create a PackedFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.getPackedFeature]].\r\n */\r\n export function create(): PackedFeature {\r\n const pair = { upper: 0, lower: 0 };\r\n return {\r\n modelId: { ...pair },\r\n elementId: { ...pair },\r\n subCategoryId: { ...pair },\r\n geometryClass: GeometryClass.Primary,\r\n animationNodeId: 0,\r\n };\r\n }\r\n\r\n /** Create a PackedFeatureWithIndex of [[GeometryClass.Primary]] with all invalid Ids and an index of zero.\r\n * This is primarily useful for creating a reusable `output` argument for [[RenderFeatureTable.iterable]].\r\n */\r\n export function createWithIndex(): PackedFeatureWithIndex {\r\n const result = create() as PackedFeatureWithIndex;\r\n result.index = 0;\r\n return result;\r\n }\r\n}\r\n\r\n/** Describes the type of a 'batch' of graphics representing multiple [[Feature]]s.\r\n * The most commonly-encountered batches are Tiles, which can be of either Primary or\r\n * Classifier type.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum BatchType {\r\n /** This batch contains graphics derived from a model's visible geometry. */\r\n Primary,\r\n /**\r\n * This batch contains color volumes which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to the stencil buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n VolumeClassifier,\r\n /**\r\n * This batch contains planar graphics which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to a texture buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n PlanarClassifier,\r\n}\r\n\r\n/** Defines a look-up table for [[Feature]]s within a batched [RenderGraphic]($frontend). Consecutive 32-bit\r\n * indices are assigned to each unique Feature. Primitives within the RenderGraphic can\r\n * use per-vertex indices to specify the distribution of Features within the primitive. The appearance of individual\r\n * features can be customized using [[FeatureOverrides]]. Typically a [Tile]($frontend) will contain a feature table\r\n * identifying the elements whose geometry appears within that tile.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class FeatureTable extends IndexMap<Feature> {\r\n public readonly modelId: Id64String;\r\n public readonly type: BatchType;\r\n\r\n /** Construct an empty FeatureTable. */\r\n public constructor(maxFeatures: number, modelId: Id64String = Id64.invalid, type: BatchType = BatchType.Primary) {\r\n super((lhs, rhs) => lhs.compare(rhs), maxFeatures);\r\n this.modelId = modelId;\r\n this.type = type;\r\n }\r\n\r\n /** Returns the maximum number of [[Feature]]s this FeatureTable can contain. */\r\n public get maxFeatures(): number { return this._maximumSize; }\r\n /** @internal */\r\n public get anyDefined(): boolean { return this.length > 1 || (1 === this.length && this._array[0].value.isDefined); }\r\n /** Returns true if this FeatureTable contains exactly one [[Feature]]. */\r\n public get isUniform(): boolean { return 1 === this.length; }\r\n /** If this FeatureTable contains exactly one [[Feature]], returns that Feature; otherwise returns undefined. */\r\n public get uniform(): Feature | undefined { return 1 === this.length ? this._array[0].value : undefined; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.VolumeClassifier]] geometry. */\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.PlanarClassifier]] geometry. */\r\n public get isPlanarClassifier(): boolean { return BatchType.PlanarClassifier === this.type; }\r\n\r\n /** Returns the Feature corresponding to the specified index, or undefined if the index is not present. */\r\n public findFeature(index: number): Feature | undefined {\r\n for (const entry of this._array)\r\n if (entry.index === index)\r\n return entry.value;\r\n\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public insertWithIndex(feature: Feature, index: number): void {\r\n const bound = this.lowerBound(feature);\r\n assert(!bound.equal);\r\n assert(!this.isFull);\r\n const entry = new IndexedValue<Feature>(feature, index);\r\n this._array.splice(bound.index, 0, entry);\r\n }\r\n\r\n /** @internal */\r\n public getArray(): Array<IndexedValue<Feature>> { return this._array; }\r\n\r\n /** Convert this feature table to a representation that can be supplied to [RenderSystem.createBatch]($frontend). */\r\n public pack(): RenderFeatureTable {\r\n return PackedFeatureTable.pack(this);\r\n }\r\n}\r\n\r\n/** @alpha */\r\nexport type ComputeNodeId = (feature: PackedFeatureWithIndex) => number;\r\n\r\n/** Representation of a [[FeatureTable]] suitable for use with [RenderSystem.createBatch]($frontend).\r\n * The [[Feature]]s are represented as [[PackedFeature]]s. The feature table may contain features from multiple [Model]($backend)s.\r\n * @see [[FeatureTable.pack]] to produce a RenderFeatureTable.\r\n * @public\r\n */\r\nexport interface RenderFeatureTable {\r\n /** The \"model Id\" of the tile tree containing the tile from which this feature table originated.\r\n * It may be a transient Id if, for example, the tile tree represents a reality model or represents the geometry of multiple\r\n * persistent models batched together.\r\n */\r\n readonly batchModelId: Id64String;\r\n /** A split representation of [[batchModelId]], to avoid having to constantly having to parse the string. */\r\n readonly batchModelIdPair: Id64.Uint32Pair;\r\n /** The number of features in the table; equivalently, one more than the largest feature index. */\r\n readonly numFeatures: number;\r\n /** The number of bytes consumed by the feature table, strictly for diagnostic purposes. */\r\n readonly byteLength: number;\r\n readonly type: BatchType;\r\n /** @alpha */\r\n animationNodeIds?: UintArray;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getFeature(featureIndex: number, result: ModelFeature): ModelFeature;\r\n\r\n /** Find the feature at the specified index. Returns undefined if featureIndex >= [[numFeatures]]. */\r\n findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined;\r\n\r\n /** Find the Id of the element associated with the feature at the specified index. */\r\n findElementId(featureIndex: number): Id64String | undefined;\r\n\r\n /** Get the Id of the element associated with the feature at the specified index as a pair of 32-bit integers.\r\n * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].\r\n */\r\n getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature;\r\n\r\n /** Get an object that provides ordered iteration over all features.\r\n * @note The `output` object is reused (mutated in place) as the current value on each iteration.\r\n */\r\n iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>;\r\n\r\n /** @alpha */\r\n populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void;\r\n\r\n /** @alpha */\r\n getAnimationNodeId(featureIndex: number): number;\r\n\r\n /** Get the Id of the model associated with the feature at the specified index.\r\n * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].\r\n * This is more efficient than [[getFeature]] for callers who are only interested in the model Id.\r\n */\r\n getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;\r\n}\r\n\r\nconst scratchPackedFeature = PackedFeature.create();\r\n\r\nfunction populateAnimationNodeIds(table: RenderFeatureTable, computeNodeId: ComputeNodeId, maxNodeId: number): UintArray | undefined {\r\n assert(maxNodeId > 0);\r\n\r\n let nodeIds;\r\n const outputFeature = PackedFeature.createWithIndex();\r\n for (const feature of table.iterable(outputFeature)) {\r\n const nodeId = computeNodeId(feature);\r\n assert(nodeId <= maxNodeId);\r\n if (0 !== nodeId) {\r\n if (!nodeIds) {\r\n const size = table.numFeatures;\r\n nodeIds = maxNodeId < 0x100 ? new Uint8Array(size) : (maxNodeId < 0x10000 ? new Uint16Array(size) : new Uint32Array(size));\r\n }\r\n\r\n nodeIds[feature.index] = nodeId;\r\n }\r\n }\r\n\r\n return nodeIds;\r\n}\r\n\r\n/**\r\n * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,\r\n * wherein each feature occupies 3 32-bit integers.\r\n * @internal\r\n */\r\nexport class PackedFeatureTable implements RenderFeatureTable {\r\n private readonly _data: Uint32Array;\r\n public readonly batchModelId: Id64String;\r\n public readonly batchModelIdPair: Id64.Uint32Pair;\r\n public readonly numFeatures: number;\r\n public readonly anyDefined: boolean;\r\n public readonly type: BatchType;\r\n public animationNodeIds?: UintArray;\r\n\r\n public get byteLength(): number { return this._data.byteLength; }\r\n\r\n /** Construct a PackedFeatureTable from the packed binary data.\r\n * This is used internally when deserializing Tiles in iMdl format.\r\n * @internal\r\n */\r\n public constructor(data: Uint32Array, modelId: Id64String, numFeatures: number, type: BatchType, animationNodeIds?: UintArray) {\r\n this._data = data;\r\n this.batchModelId = modelId;\r\n this.batchModelIdPair = Id64.getUint32Pair(modelId);\r\n this.numFeatures = numFeatures;\r\n this.type = type;\r\n this.animationNodeIds = animationNodeIds;\r\n\r\n switch (this.numFeatures) {\r\n case 0:\r\n this.anyDefined = false;\r\n break;\r\n case 1:\r\n this.anyDefined = ModelFeature.isDefined(this.getFeature(0, ModelFeature.create()));\r\n break;\r\n default:\r\n this.anyDefined = true;\r\n break;\r\n }\r\n\r\n assert(this._data.length >= this._subCategoriesOffset);\r\n assert(undefined === this.animationNodeIds || this.animationNodeIds.length === this.numFeatures);\r\n }\r\n\r\n /** Create a packed feature table from a [[FeatureTable]]. */\r\n public static pack(featureTable: FeatureTable): PackedFeatureTable {\r\n // We must determine how many subcategories we have ahead of time to compute the size of the Uint32Array, as\r\n // the array cannot be resized after it is created.\r\n // We are not too worried about this as FeatureTables created on the front-end will contain few if any features; those obtained from the\r\n // back-end arrive within tiles already in the packed format.\r\n const subcategories = new Map<string, number>();\r\n for (const iv of featureTable.getArray()) {\r\n const found = subcategories.get(iv.value.subCategoryId.toString());\r\n if (undefined === found)\r\n subcategories.set(iv.value.subCategoryId, subcategories.size);\r\n }\r\n\r\n // We need 3 32-bit integers per feature, plus 2 32-bit integers per subcategory.\r\n const subCategoriesOffset = 3 * featureTable.length;\r\n const nUint32s = subCategoriesOffset + 2 * subcategories.size;\r\n const uint32s = new Uint32Array(nUint32s);\r\n\r\n for (const iv of featureTable.getArray()) {\r\n const feature = iv.value;\r\n const index = iv.index * 3;\r\n\r\n let subCategoryIndex = subcategories.get(feature.subCategoryId)!;\r\n assert(undefined !== subCategoryIndex); // we inserted it above...\r\n subCategoryIndex |= (feature.geometryClass << 24);\r\n\r\n uint32s[index + 0] = Id64.getLowerUint32(feature.elementId);\r\n uint32s[index + 1] = Id64.getUpperUint32(feature.elementId);\r\n uint32s[index + 2] = subCategoryIndex;\r\n }\r\n\r\n subcategories.forEach((index: number, id: string, _map) => {\r\n const index32 = subCategoriesOffset + 2 * index;\r\n uint32s[index32 + 0] = Id64.getLowerUint32(id);\r\n uint32s[index32 + 1] = Id64.getUpperUint32(id);\r\n });\r\n\r\n return new PackedFeatureTable(uint32s, featureTable.modelId, featureTable.length, featureTable.type);\r\n }\r\n\r\n /** Retrieve the Feature associated with the specified index. */\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result, this.batchModelId);\r\n }\r\n\r\n /** Returns the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public getElementIdPair(featureIndex: number, out?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n out = out ?? { lower: 0, upper: 0 };\r\n assert(featureIndex < this.numFeatures);\r\n const offset = 3 * featureIndex;\r\n out.lower = this._data[offset];\r\n out.upper = this._data[offset + 1];\r\n return out;\r\n }\r\n\r\n /** @internal */\r\n public getSubCategoryIdPair(featureIndex: number): Id64.Uint32Pair {\r\n const index = 3 * featureIndex;\r\n let subCatIndex = this._data[index + 2];\r\n subCatIndex = (subCatIndex & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n return { lower: this._data[subCatIndex], upper: this._data[subCatIndex + 1] };\r\n }\r\n\r\n /** @internal */\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return undefined !== this.animationNodeIds && featureIndex < this.numFeatures ? this.animationNodeIds[featureIndex] : 0;\r\n }\r\n\r\n /** @internal */\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n assert(featureIndex < this.numFeatures);\r\n\r\n const index32 = 3 * featureIndex;\r\n result.elementId.lower = this._data[index32];\r\n result.elementId.upper = this._data[index32 + 1];\r\n\r\n const subCatIndexAndClass = this._data[index32 + 2];\r\n result.geometryClass = (subCatIndexAndClass >>> 24) & 0xff;\r\n\r\n let subCatIndex = (subCatIndexAndClass & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n result.subCategoryId.lower = this._data[subCatIndex];\r\n result.subCategoryId.upper = this._data[subCatIndex + 1];\r\n\r\n result.animationNodeId = this.getAnimationNodeId(featureIndex);\r\n result.modelId.lower = this.batchModelIdPair.lower;\r\n result.modelId.upper = this.batchModelIdPair.upper;\r\n\r\n return result;\r\n }\r\n\r\n public getModelIdPair(_featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n out.lower = this.batchModelIdPair.lower;\r\n out.upper = this.batchModelIdPair.upper;\r\n return out;\r\n }\r\n\r\n /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n if (featureIndex >= this.numFeatures)\r\n return undefined;\r\n else\r\n return this.readId(3 * featureIndex);\r\n }\r\n\r\n /** Return true if this table contains exactly 1 feature. */\r\n public get isUniform(): boolean { return 1 === this.numFeatures; }\r\n\r\n /** If this table contains exactly 1 feature, return it. */\r\n public getUniform(result: ModelFeature): ModelFeature | undefined {\r\n return this.isUniform ? this.getFeature(0, result) : undefined;\r\n }\r\n\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isPlanarClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isClassifier(): boolean { return this.isVolumeClassifier || this.isPlanarClassifier; }\r\n\r\n /** Unpack the features into a [[FeatureTable]]. */\r\n public unpack(): FeatureTable {\r\n const table = new FeatureTable(this.numFeatures, this.batchModelId);\r\n const feature = ModelFeature.create();\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getFeature(i, feature);\r\n table.insertWithIndex(new Feature(feature.elementId, feature.subCategoryId, feature.geometryClass), i);\r\n }\r\n\r\n return table;\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n assert(undefined === this.animationNodeIds);\r\n this.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getPackedFeature(i, output);\r\n output.index = i;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n private get _subCategoriesOffset(): number { return this.numFeatures * 3; }\r\n\r\n private readId(offset32: number): Id64String {\r\n return Id64.fromUint32Pair(this._data[offset32], this._data[offset32 + 1]);\r\n }\r\n}\r\n\r\ninterface PackedFeatureModelEntry {\r\n lastFeatureIndex: number;\r\n idLower: number;\r\n idUpper: number;\r\n}\r\n\r\nconst scratchPackedFeatureModelEntry = { lastFeatureIndex: -1, idLower: -1, idUpper: -1 };\r\n\r\n/** A table of model Ids associated with a [[MultiModelPackedFeatureTable]].\r\n * The feature indices in the packed feature table are grouped together by model, such that the first N features belong to model 1, the next M features to model 2, and so on.\r\n * The model table itself consists of one entry per model, where each entry looks like:\r\n * indexOfLastFeatureInModel: u32\r\n * modelId: u64\r\n * The modelId associated with a feature can therefore be derived by finding the entry in the model table with the highest indexOfLastFeatureInModel no greater than the feature index.\r\n * This lookup can be optimized using binary search.\r\n * Moreover, while iterating the feature table in sequence, the model table can be iterated in parallel so that no per-feature lookup of model Id is required.\r\n * @internal\r\n */\r\nexport class PackedFeatureModelTable {\r\n private readonly _data: Uint32Array;\r\n\r\n public constructor(data: Uint32Array) {\r\n this._data = data;\r\n assert(this._data.length % 3 === 0);\r\n }\r\n\r\n /** The number of models in the table. */\r\n public get length(): number {\r\n return this._data.length / 3;\r\n }\r\n\r\n public get byteLength(): number {\r\n return this._data.byteLength;\r\n }\r\n\r\n private getLastFeatureIndex(modelIndex: number): number {\r\n return this._data[modelIndex * 3];\r\n }\r\n\r\n public getEntry(modelIndex: number, result: PackedFeatureModelEntry): PackedFeatureModelEntry {\r\n if (modelIndex >= this.length) {\r\n result.idLower = result.idUpper = 0;\r\n result.lastFeatureIndex = Number.MAX_SAFE_INTEGER;\r\n return result;\r\n }\r\n\r\n const index = modelIndex * 3;\r\n result.lastFeatureIndex = this._data[index + 0];\r\n result.idLower = this._data[index + 1];\r\n result.idUpper = this._data[index + 2];\r\n return result;\r\n }\r\n\r\n /** Get the Id of the model associated with the specified feature, or an invalid Id if the feature is not associated with any model. */\r\n public getModelIdPair(featureIndex: number, result?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n if (!result)\r\n result = { lower: 0, upper: 0 };\r\n else\r\n result.lower = result.upper = 0;\r\n\r\n let first = 0;\r\n const last = this.length;\r\n let count = last;\r\n while (count > 0) {\r\n const step = Math.floor(count / 2);\r\n const mid = first + step;\r\n const lastFeatureIndex = this.getLastFeatureIndex(mid);\r\n if (featureIndex > lastFeatureIndex) {\r\n first = mid + 1;\r\n count -= step + 1;\r\n } else {\r\n count = step;\r\n }\r\n }\r\n\r\n if (first < last) {\r\n result.lower = this._data[first * 3 + 1];\r\n result.upper = this._data[first * 3 + 2];\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/** A PackedFeatureTable with a PackedFeatureModelTable appended to it, capable of storing features belonging to more than one model.\r\n * @internal\r\n */\r\nexport class MultiModelPackedFeatureTable implements RenderFeatureTable {\r\n private readonly _features: PackedFeatureTable;\r\n private readonly _models: PackedFeatureModelTable;\r\n\r\n public constructor(features: PackedFeatureTable, models: PackedFeatureModelTable) {\r\n this._features = features;\r\n this._models = models;\r\n }\r\n\r\n public static create(data: Uint32Array, batchModelId: Id64String, numFeatures: number, type: BatchType, numSubCategories: number): MultiModelPackedFeatureTable {\r\n const modelTableOffset = 3 * numFeatures + 2 * numSubCategories;\r\n const featureData = data.subarray(0, modelTableOffset);\r\n const features = new PackedFeatureTable(featureData, batchModelId, numFeatures, type);\r\n\r\n const modelData = data.subarray(modelTableOffset);\r\n const models = new PackedFeatureModelTable(modelData);\r\n\r\n return new MultiModelPackedFeatureTable(features, models);\r\n }\r\n\r\n public get batchModelId() { return this._features.batchModelId; }\r\n public get batchModelIdPair() { return this._features.batchModelIdPair; }\r\n public get numFeatures() { return this._features.numFeatures; }\r\n public get type() { return this._features.type; }\r\n public get animationNodeIds(): UintArray | undefined { return this._features.animationNodeIds; }\r\n public set animationNodeIds(ids: UintArray | undefined) { this._features.animationNodeIds = ids; }\r\n\r\n public get byteLength() {\r\n return this._features.byteLength + this._models.byteLength;\r\n }\r\n\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n this._features.getPackedFeature(featureIndex, result);\r\n this._models.getModelIdPair(featureIndex, result.modelId);\r\n return result;\r\n }\r\n\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result);\r\n }\r\n\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n public getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n return this._features.getElementIdPair(featureIndex, out);\r\n }\r\n\r\n public getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n this._models.getModelIdPair(featureIndex, out);\r\n return out;\r\n }\r\n\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n return this._features.findElementId(featureIndex);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n // Rather than perform a binary search on the model table to find each feature's model Id, traverse the model table in parallel with the feature table.\r\n let modelIndex = 0;\r\n const modelEntry = this._models.getEntry(modelIndex, scratchPackedFeatureModelEntry);\r\n\r\n for (let featureIndex = 0; featureIndex < this.numFeatures; featureIndex++) {\r\n if (featureIndex > modelEntry.lastFeatureIndex)\r\n this._models.getEntry(++modelIndex, modelEntry);\r\n\r\n this._features.getPackedFeature(featureIndex, output);\r\n output.modelId.lower = modelEntry.idLower;\r\n output.modelId.upper = modelEntry.idUpper;\r\n output.index = featureIndex;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return this._features.getAnimationNodeId(featureIndex);\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n this._features.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n}\r\n"]}
@@ -44,5 +44,7 @@ export declare class PlanProjectionSettings {
44
44
  * @returns A PlanProjectionSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
45
45
  */
46
46
  clone(changedProps?: PlanProjectionSettingsProps): PlanProjectionSettings;
47
+ /** Return true if these settings are equivalent to the specified settings. */
48
+ equals(other: PlanProjectionSettings): boolean;
47
49
  }
48
50
  //# sourceMappingURL=PlanProjectionSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanProjectionSettings.d.ts","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4JAA4J;IAC5J,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wJAAwJ;IACxJ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IACjC,oDAAoD;IACpD,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnC,uDAAuD;IACvD,SAAgB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtC,kDAAkD;IAClD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,iEAAiE;IACjE,SAAgB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAE1C,MAAM,IAAI,2BAA2B;WAS9B,QAAQ,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,GAAG,sBAAsB,GAAG,SAAS;IAU1G,gBAAgB;gBACG,KAAK,EAAE,2BAA2B;IAYrD;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,EAAE,2BAA2B,GAAG,sBAAsB;CAmBjF"}
1
+ {"version":3,"file":"PlanProjectionSettings.d.ts","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4JAA4J;IAC5J,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wJAAwJ;IACxJ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IACjC,oDAAoD;IACpD,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnC,uDAAuD;IACvD,SAAgB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtC,kDAAkD;IAClD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,iEAAiE;IACjE,SAAgB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAE1C,MAAM,IAAI,2BAA2B;WAS9B,QAAQ,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,GAAG,sBAAsB,GAAG,SAAS;IAU1G,gBAAgB;gBACG,KAAK,EAAE,2BAA2B;IAYrD;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,EAAE,2BAA2B,GAAG,sBAAsB;IAoBhF,8EAA8E;IACvE,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO;CAMtD"}
@@ -59,6 +59,12 @@ class PlanProjectionSettings {
59
59
  props.enforceDisplayPriority = changedProps.enforceDisplayPriority;
60
60
  return new PlanProjectionSettings(props);
61
61
  }
62
+ /** Return true if these settings are equivalent to the specified settings. */
63
+ equals(other) {
64
+ if (this === other)
65
+ return true;
66
+ return this.elevation === other.elevation && this.transparency === other.transparency && this.overlay === other.overlay && this.enforceDisplayPriority === other.enforceDisplayPriority;
67
+ }
62
68
  }
63
69
  exports.PlanProjectionSettings = PlanProjectionSettings;
64
70
  //# sourceMappingURL=PlanProjectionSettings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanProjectionSettings.js","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqBH;;;;;;GAMG;AACH,MAAa,sBAAsB;IAU1B,MAAM;QACX,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YACjD,sBAAsB,EAAE,IAAI,KAAK,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAChF,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAA8C;QACnE,IAAI,SAAS,KAAK,KAAK;YACrB,OAAO,SAAS,CAAC;QAEnB,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS,IAAI,SAAS,KAAK,KAAK,CAAC,YAAY,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,sBAAsB;YAChJ,OAAO,SAAS,CAAC;QAEnB,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB;IAChB,YAAmB,KAAkC;QACnD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,sBAAsB,GAAG,IAAI,KAAK,KAAK,CAAC,sBAAsB,CAAC;QAEpE,IAAI,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACtC,IAAI,SAAS,KAAK,YAAY;YAC5B,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAA0C;QACrD,IAAI,SAAS,KAAK,YAAY;YAC5B,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAgC,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,IAAI,SAAS,KAAK,YAAY,CAAC,SAAS;YACtC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;QAE3C,IAAI,SAAS,KAAK,YAAY,CAAC,YAAY;YACzC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC;QAEjD,IAAI,SAAS,KAAK,YAAY,CAAC,OAAO;YACpC,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;QAEvC,IAAI,SAAS,KAAK,YAAY,CAAC,sBAAsB;YACnD,KAAK,CAAC,sBAAsB,GAAG,YAAY,CAAC,sBAAsB,CAAC;QAErE,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF;AAjED,wDAiEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\n/** Wire format describing [[PlanProjectionSettings]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PlanProjectionSettingsProps {\r\n /** If defined, the absolute height in meters at which to display the model. */\r\n elevation?: number;\r\n /** If defined, specifies a uniform transparency applied to all of the geometry in the model, in the range 0.0 (fully opaque) to 1.0 (fully transparent). */\r\n transparency?: number;\r\n /** If defined and true, the model is displayed as an overlay in the view (without depth testing) so that it is always visible behind other geometry. */\r\n overlay?: boolean;\r\n /** If defined and true, subcategory display priority is used to specify the draw order of portions of the model. Geometry belonging to a subcategory with a higher priority\r\n * value is drawn on top of coincident geometry belonging to a subcategory with a lower priority value. The priorities can be modified at display time using\r\n * [FeatureSymbology.Overrides]($frontend). Note that subcategory \"layers\" cross model boundaries; that is, geometry belonging to the same subcategory in different models\r\n * are drawn as part of the same layer.\r\n */\r\n enforceDisplayPriority?: boolean;\r\n}\r\n\r\n/** Describes how to draw a plan projection model. A plan projection model is a [GeometricModel3d]($backend) whose geometry all lies in\r\n * a single XY plane, wherein the Z coordinate of the plane may be arbitrary or flexible. Multiple plan projection models can be combined into one view\r\n * and drawn as \"layers\" with relative priorities.\r\n * @see [[DisplayStyle3dSettings.setPlanProjectionSettings]] to define plan projection settings for a [DisplayStyle3dState]($frontend).\r\n * @see [GeometricModel3d.isPlanProjection]($backend).\r\n * @public\r\n */\r\nexport class PlanProjectionSettings {\r\n /** See [[PlanProjectionSettingsProps.elevation]] */\r\n public readonly elevation?: number;\r\n /** See [[PlanProjectionSettingsProps.transparency]] */\r\n public readonly transparency?: number;\r\n /** See [[PlanProjectionSettingsProps.overlay]] */\r\n public readonly overlay: boolean;\r\n /** See [[PlanProjectionSettingsProps.enforceDisplayPriority]] */\r\n public readonly enforceDisplayPriority?: boolean;\r\n\r\n public toJSON(): PlanProjectionSettingsProps {\r\n return {\r\n elevation: this.elevation,\r\n transparency: this.transparency,\r\n overlay: true === this.overlay ? true : undefined,\r\n enforceDisplayPriority: true === this.enforceDisplayPriority ? true : undefined,\r\n };\r\n }\r\n\r\n public static fromJSON(props: PlanProjectionSettingsProps | undefined): PlanProjectionSettings | undefined {\r\n if (undefined === props)\r\n return undefined;\r\n\r\n if (undefined === props.elevation && undefined === props.transparency && undefined === props.overlay && undefined === props.enforceDisplayPriority)\r\n return undefined;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n\r\n /** @internal */\r\n public constructor(props: PlanProjectionSettingsProps) {\r\n this.elevation = props.elevation;\r\n this.overlay = true === props.overlay;\r\n this.enforceDisplayPriority = true === props.enforceDisplayPriority;\r\n\r\n let transparency = props.transparency;\r\n if (undefined !== transparency)\r\n transparency = Math.max(0, Math.min(1, transparency));\r\n\r\n this.transparency = transparency;\r\n }\r\n\r\n /** Create a copy of this PlanProjectionSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A PlanProjectionSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: PlanProjectionSettingsProps): PlanProjectionSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props: PlanProjectionSettingsProps = this.toJSON();\r\n if (undefined !== changedProps.elevation)\r\n props.elevation = changedProps.elevation;\r\n\r\n if (undefined !== changedProps.transparency)\r\n props.transparency = changedProps.transparency;\r\n\r\n if (undefined !== changedProps.overlay)\r\n props.overlay = changedProps.overlay;\r\n\r\n if (undefined !== changedProps.enforceDisplayPriority)\r\n props.enforceDisplayPriority = changedProps.enforceDisplayPriority;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PlanProjectionSettings.js","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqBH;;;;;;GAMG;AACH,MAAa,sBAAsB;IAU1B,MAAM;QACX,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YACjD,sBAAsB,EAAE,IAAI,KAAK,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAChF,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAA8C;QACnE,IAAI,SAAS,KAAK,KAAK;YACrB,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,CAAC,sBAAsB,GAAG,YAAY,CAAC,sBAAsB,CAAC;QAErE,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,8EAA8E;IACvE,MAAM,CAAC,KAA6B;QACzC,IAAI,IAAI,KAAK,KAAK;YAChB,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,sBAAsB,KAAK,KAAK,CAAC,sBAAsB,CAAC;IAC1L,CAAC;CACF;AAzED,wDAyEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\n/** Wire format describing [[PlanProjectionSettings]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PlanProjectionSettingsProps {\r\n /** If defined, the absolute height in meters at which to display the model. */\r\n elevation?: number;\r\n /** If defined, specifies a uniform transparency applied to all of the geometry in the model, in the range 0.0 (fully opaque) to 1.0 (fully transparent). */\r\n transparency?: number;\r\n /** If defined and true, the model is displayed as an overlay in the view (without depth testing) so that it is always visible behind other geometry. */\r\n overlay?: boolean;\r\n /** If defined and true, subcategory display priority is used to specify the draw order of portions of the model. Geometry belonging to a subcategory with a higher priority\r\n * value is drawn on top of coincident geometry belonging to a subcategory with a lower priority value. The priorities can be modified at display time using\r\n * [FeatureSymbology.Overrides]($frontend). Note that subcategory \"layers\" cross model boundaries; that is, geometry belonging to the same subcategory in different models\r\n * are drawn as part of the same layer.\r\n */\r\n enforceDisplayPriority?: boolean;\r\n}\r\n\r\n/** Describes how to draw a plan projection model. A plan projection model is a [GeometricModel3d]($backend) whose geometry all lies in\r\n * a single XY plane, wherein the Z coordinate of the plane may be arbitrary or flexible. Multiple plan projection models can be combined into one view\r\n * and drawn as \"layers\" with relative priorities.\r\n * @see [[DisplayStyle3dSettings.setPlanProjectionSettings]] to define plan projection settings for a [DisplayStyle3dState]($frontend).\r\n * @see [GeometricModel3d.isPlanProjection]($backend).\r\n * @public\r\n */\r\nexport class PlanProjectionSettings {\r\n /** See [[PlanProjectionSettingsProps.elevation]] */\r\n public readonly elevation?: number;\r\n /** See [[PlanProjectionSettingsProps.transparency]] */\r\n public readonly transparency?: number;\r\n /** See [[PlanProjectionSettingsProps.overlay]] */\r\n public readonly overlay: boolean;\r\n /** See [[PlanProjectionSettingsProps.enforceDisplayPriority]] */\r\n public readonly enforceDisplayPriority?: boolean;\r\n\r\n public toJSON(): PlanProjectionSettingsProps {\r\n return {\r\n elevation: this.elevation,\r\n transparency: this.transparency,\r\n overlay: true === this.overlay ? true : undefined,\r\n enforceDisplayPriority: true === this.enforceDisplayPriority ? true : undefined,\r\n };\r\n }\r\n\r\n public static fromJSON(props: PlanProjectionSettingsProps | undefined): PlanProjectionSettings | undefined {\r\n if (undefined === props)\r\n return undefined;\r\n\r\n if (undefined === props.elevation && undefined === props.transparency && undefined === props.overlay && undefined === props.enforceDisplayPriority)\r\n return undefined;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n\r\n /** @internal */\r\n public constructor(props: PlanProjectionSettingsProps) {\r\n this.elevation = props.elevation;\r\n this.overlay = true === props.overlay;\r\n this.enforceDisplayPriority = true === props.enforceDisplayPriority;\r\n\r\n let transparency = props.transparency;\r\n if (undefined !== transparency)\r\n transparency = Math.max(0, Math.min(1, transparency));\r\n\r\n this.transparency = transparency;\r\n }\r\n\r\n /** Create a copy of this PlanProjectionSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A PlanProjectionSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: PlanProjectionSettingsProps): PlanProjectionSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props: PlanProjectionSettingsProps = this.toJSON();\r\n if (undefined !== changedProps.elevation)\r\n props.elevation = changedProps.elevation;\r\n\r\n if (undefined !== changedProps.transparency)\r\n props.transparency = changedProps.transparency;\r\n\r\n if (undefined !== changedProps.overlay)\r\n props.overlay = changedProps.overlay;\r\n\r\n if (undefined !== changedProps.enforceDisplayPriority)\r\n props.enforceDisplayPriority = changedProps.enforceDisplayPriority;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n\r\n /** Return true if these settings are equivalent to the specified settings. */\r\n public equals(other: PlanProjectionSettings): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.elevation === other.elevation && this.transparency === other.transparency && this.overlay === other.overlay && this.enforceDisplayPriority === other.enforceDisplayPriority;\r\n }\r\n}\r\n"]}
@@ -114,7 +114,7 @@ class RpcInvocation {
114
114
  // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.
115
115
  if (!(error instanceof RpcControl_1.RpcPendingResponse)) {
116
116
  core_bentley_1.Logger.logError(CommonLoggerCategory_1.CommonLoggerCategory.RpcInterfaceBackend, "Error in RPC operation", { error: core_bentley_1.BentleyError.getErrorProps(error) });
117
- core_bentley_1.Tracing.setAttributes({ error: true });
117
+ core_bentley_1.Tracing.recordException(error);
118
118
  }
119
119
  throw error;
120
120
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAA8J;AAC9J,qEAAkE;AAElE,mDAAgD;AAChD,qDAAkD;AAElD,yDAAsD;AACtD,iDAAoE;AACpE,6CAA0F;AAC1F,mDAAoE;AACpE,iDAA8C;AAC9C,+CAA+H;AAC/H,+CAAgE;AAqChE;;GAEG;AACH,MAAa,aAAa;IAwBxB,mCAAmC;IACnC,IA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MAAM,CAAC,OAAO,CAAC;YACjD,MAAM,MAAM,GAAqB,EAAE,oBAAoB,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;YAC9F,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,2BAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,6BAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;AAD/D,sCAAa","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelRpcProps } from \"../../IModel\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { SessionProps } from \"../../SessionProps\";\r\nimport { RpcConfiguration } from \"./RpcConfiguration\";\r\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\r\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\r\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\r\nimport { RpcOperation } from \"./RpcOperation\";\r\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\r\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** The properties of an RpcActivity.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RpcActivity extends SessionProps {\r\n /** Used for logging to correlate an Rpc activity between frontend and backend */\r\n readonly activityId: GuidString;\r\n\r\n /** access token for authorization */\r\n readonly accessToken: AccessToken;\r\n\r\n /** the name of the current rpc method */\r\n readonly rpcMethod?: string;\r\n\r\n readonly user?: string;\r\n}\r\n\r\n/** Serialized format for sending the request across the RPC layer\r\n * @public\r\n */\r\nexport interface SerializedRpcActivity {\r\n id: string;\r\n applicationId: string;\r\n applicationVersion: string;\r\n sessionId: string;\r\n authorization: string;\r\n user?: string;\r\n csrfToken?: { headerName: string, headerValue: string };\r\n}\r\n\r\n/** @internal */\r\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\r\n\r\n/** An RPC operation invocation in response to a request.\r\n * @internal\r\n */\r\nexport class RpcInvocation {\r\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\r\n private _threw: boolean = false;\r\n private _pending: boolean = false;\r\n private _notFound: boolean = false;\r\n private _noContent: boolean = false;\r\n private _timeIn: number = 0;\r\n private _timeOut: number = 0;\r\n\r\n /** The protocol for this invocation. */\r\n public readonly protocol: RpcProtocol;\r\n\r\n /** The received request. */\r\n public readonly request: SerializedRpcRequest;\r\n\r\n /** The operation of the request. */\r\n public readonly operation: RpcOperation = undefined as any;\r\n\r\n /** The implementation response. */\r\n public readonly result: Promise<any>;\r\n\r\n /** The fulfillment for this request. */\r\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\r\n\r\n /** The status for this request. */\r\n public get status(): RpcRequestStatus {\r\n return this._threw ? RpcRequestStatus.Rejected :\r\n this._pending ? RpcRequestStatus.Pending :\r\n this._notFound ? RpcRequestStatus.NotFound :\r\n this._noContent ? RpcRequestStatus.NoContent :\r\n RpcRequestStatus.Resolved;\r\n }\r\n\r\n /** The elapsed time for this invocation. */\r\n public get elapsed(): number {\r\n return this._timeOut - this._timeIn;\r\n }\r\n\r\n /**\r\n * The invocation for the current RPC operation.\r\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\r\n */\r\n public static current(rpcImpl: RpcInterface): RpcInvocation {\r\n return (rpcImpl as any)[CURRENT_INVOCATION];\r\n }\r\n\r\n /** Constructs an invocation. */\r\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\r\n this._timeIn = new Date().getTime();\r\n this.protocol = protocol;\r\n this.request = request;\r\n\r\n try {\r\n try {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n\r\n const backend = this.operation.interfaceVersion;\r\n const frontend = this.request.operation.interfaceVersion;\r\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\r\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\r\n }\r\n } catch (error) {\r\n if (this.handleUnknownOperation(error)) {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n\r\n this.result = this.resolve();\r\n } catch (error) {\r\n this.result = this.reject(error);\r\n }\r\n\r\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\r\n }\r\n\r\n private handleUnknownOperation(error: any): boolean {\r\n RpcControlChannel.ensureInitialized();\r\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\r\n }\r\n\r\n public static sanitizeForLog(activity?: RpcActivity) {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n return activity ? {\r\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\r\n } : undefined;\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n }\r\n\r\n private async resolve(): Promise<any> {\r\n const request = this.request;\r\n const activity: RpcActivity = {\r\n activityId: request.id,\r\n applicationId: request.applicationId,\r\n applicationVersion: request.applicationVersion,\r\n sessionId: request.sessionId,\r\n user: request.user,\r\n accessToken: request.authorization,\r\n rpcMethod: request.operation.operationName,\r\n };\r\n\r\n try {\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\r\n\r\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\r\n this.applyPolicies(parameters);\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\r\n (impl as any)[CURRENT_INVOCATION] = this;\r\n const op = this.lookupOperationFunction(impl);\r\n\r\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\r\n .catch(async (error) => {\r\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\r\n if (!(error instanceof RpcPendingResponse)) {\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\r\n Tracing.setAttributes({ error: true });\r\n }\r\n throw error;\r\n }));\r\n } catch (error: unknown) {\r\n return this.reject(error);\r\n }\r\n }\r\n\r\n private applyPolicies(parameters: any) {\r\n if (!parameters || !Array.isArray(parameters))\r\n return;\r\n\r\n for (let i = 0; i !== parameters.length; ++i) {\r\n const parameter = parameters[i];\r\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\r\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\r\n const inflated = this.protocol.inflateToken(parameter, this.request);\r\n parameters[i] = inflated;\r\n\r\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\r\n if (RpcConfiguration.throwOnTokenMismatch) {\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\r\n } else {\r\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\r\n return a.key === b.key &&\r\n a.iTwinId === b.iTwinId &&\r\n a.iModelId === b.iModelId &&\r\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\r\n }\r\n\r\n private async reject(error: any): Promise<any> {\r\n this._threw = true;\r\n return error;\r\n }\r\n\r\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\r\n const result = RpcMarshaling.serialize(this.protocol, value);\r\n return this.fulfill(result, value);\r\n }\r\n\r\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n if (!RpcConfiguration.developmentMode)\r\n reason.stack = undefined;\r\n\r\n const result = RpcMarshaling.serialize(this.protocol, reason);\r\n\r\n if (reason instanceof RpcPendingResponse) {\r\n this._pending = true;\r\n this._threw = false;\r\n result.objects = reason.message;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\r\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\r\n this._noContent = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\r\n } else if (reason instanceof RpcNotFoundResponse) {\r\n this._notFound = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\r\n } else {\r\n this._threw = true;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\r\n }\r\n\r\n return this.fulfill(result, reason);\r\n }\r\n\r\n private supportsNoContent() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\r\n }\r\n\r\n private supportsStatusCategory() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n if (!this.protocol.supportsStatusCategory) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\r\n }\r\n\r\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\r\n const fulfillment: RpcRequestFulfillment = {\r\n result,\r\n rawResult,\r\n status: this.protocol.getCode(this.status),\r\n id: this.request.id,\r\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\r\n allowCompression: this.operation?.policy.allowResponseCompression || false,\r\n };\r\n\r\n this.transformResponseStatus(fulfillment, rawResult);\r\n\r\n try {\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\r\n if (impl[CURRENT_INVOCATION] === this) {\r\n impl[CURRENT_INVOCATION] = undefined;\r\n }\r\n } catch (_err) { }\r\n\r\n return fulfillment;\r\n }\r\n\r\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\r\n const func = (implementation as any)[this.operation.operationName];\r\n if (!func || typeof (func) !== \"function\")\r\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\r\n\r\n return func;\r\n }\r\n\r\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\r\n if (!this.supportsStatusCategory()) {\r\n return;\r\n }\r\n\r\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\r\n if (this._pending) {\r\n managedStatus = \"pending\";\r\n } else if (this._notFound) {\r\n managedStatus = \"notFound\";\r\n } else if (this._noContent) {\r\n managedStatus = \"noContent\";\r\n }\r\n\r\n if (managedStatus) {\r\n const responseValue = fulfillment.result.objects;\r\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\r\n fulfillment.result.objects = JSON.stringify(status);\r\n status.responseValue = rawResult; // for ipc case\r\n fulfillment.rawResult = status;\r\n }\r\n\r\n if (rawResult instanceof BentleyError) {\r\n fulfillment.status = StatusCategory.for(rawResult).code;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAA8J;AAC9J,qEAAkE;AAElE,mDAAgD;AAChD,qDAAkD;AAElD,yDAAsD;AACtD,iDAAoE;AACpE,6CAA0F;AAC1F,mDAAoE;AACpE,iDAA8C;AAC9C,+CAA+H;AAC/H,+CAAgE;AAqChE;;GAEG;AACH,MAAa,aAAa;IAwBxB,mCAAmC;IACnC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,+BAAgB,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,+BAAgB,CAAC,OAAO,CAAC,CAAC;gBACxC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,+BAAgB,CAAC,QAAQ,CAAC,CAAC;oBAC1C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,+BAAgB,CAAC,SAAS,CAAC,CAAC;wBAC5C,+BAAgB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED,4CAA4C;IAC5C,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,OAAO,CAAC,OAAqB;QACzC,OAAQ,OAAe,CAAC,gCAAkB,CAAC,CA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AAI,OAAO,CAAC,IAAI,CAAC,KAAK,UAAU;YACvC,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,wBAAwB,cAAc,CAAC,WAAW,CAAC,IAAI,mCAAmC,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,CAAC,CAAC;QAEzK,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,uBAAuB,CAAC,WAAkC,EAAE,SAAc;QAChF,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE;YAClC,OAAO;SACR;QAED,IAAI,aAA+D,CAAC;QACpE,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,aAAa,GAAG,SAAS,CAAC;SAC3B;aAAM,IAAI,IAAI,CAAC,SAAS,EAAE;YACzB,aAAa,GAAG,UAAU,CAAC;SAC5B;aAAM,IAAI,IAAI,CAAC,UAAU,EAAE;YAC1B,aAAa,GAAG,WAAW,CAAC;SAC7B;QAED,IAAI,aAAa,EAAE;YACjB,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;YACjD,MAAM,MAAM,GAAqB,EAAE,oBAAoB,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;YAC9F,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,2BAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,6BAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;AAD/D,sCAAa","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelRpcProps } from \"../../IModel\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { SessionProps } from \"../../SessionProps\";\r\nimport { RpcConfiguration } from \"./RpcConfiguration\";\r\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\r\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\r\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\r\nimport { RpcOperation } from \"./RpcOperation\";\r\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\r\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** The properties of an RpcActivity.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RpcActivity extends SessionProps {\r\n /** Used for logging to correlate an Rpc activity between frontend and backend */\r\n readonly activityId: GuidString;\r\n\r\n /** access token for authorization */\r\n readonly accessToken: AccessToken;\r\n\r\n /** the name of the current rpc method */\r\n readonly rpcMethod?: string;\r\n\r\n readonly user?: string;\r\n}\r\n\r\n/** Serialized format for sending the request across the RPC layer\r\n * @public\r\n */\r\nexport interface SerializedRpcActivity {\r\n id: string;\r\n applicationId: string;\r\n applicationVersion: string;\r\n sessionId: string;\r\n authorization: string;\r\n user?: string;\r\n csrfToken?: { headerName: string, headerValue: string };\r\n}\r\n\r\n/** @internal */\r\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\r\n\r\n/** An RPC operation invocation in response to a request.\r\n * @internal\r\n */\r\nexport class RpcInvocation {\r\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\r\n private _threw: boolean = false;\r\n private _pending: boolean = false;\r\n private _notFound: boolean = false;\r\n private _noContent: boolean = false;\r\n private _timeIn: number = 0;\r\n private _timeOut: number = 0;\r\n\r\n /** The protocol for this invocation. */\r\n public readonly protocol: RpcProtocol;\r\n\r\n /** The received request. */\r\n public readonly request: SerializedRpcRequest;\r\n\r\n /** The operation of the request. */\r\n public readonly operation: RpcOperation = undefined as any;\r\n\r\n /** The implementation response. */\r\n public readonly result: Promise<any>;\r\n\r\n /** The fulfillment for this request. */\r\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\r\n\r\n /** The status for this request. */\r\n public get status(): RpcRequestStatus {\r\n return this._threw ? RpcRequestStatus.Rejected :\r\n this._pending ? RpcRequestStatus.Pending :\r\n this._notFound ? RpcRequestStatus.NotFound :\r\n this._noContent ? RpcRequestStatus.NoContent :\r\n RpcRequestStatus.Resolved;\r\n }\r\n\r\n /** The elapsed time for this invocation. */\r\n public get elapsed(): number {\r\n return this._timeOut - this._timeIn;\r\n }\r\n\r\n /**\r\n * The invocation for the current RPC operation.\r\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\r\n */\r\n public static current(rpcImpl: RpcInterface): RpcInvocation {\r\n return (rpcImpl as any)[CURRENT_INVOCATION];\r\n }\r\n\r\n /** Constructs an invocation. */\r\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\r\n this._timeIn = new Date().getTime();\r\n this.protocol = protocol;\r\n this.request = request;\r\n\r\n try {\r\n try {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n\r\n const backend = this.operation.interfaceVersion;\r\n const frontend = this.request.operation.interfaceVersion;\r\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\r\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\r\n }\r\n } catch (error) {\r\n if (this.handleUnknownOperation(error)) {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n\r\n this.result = this.resolve();\r\n } catch (error) {\r\n this.result = this.reject(error);\r\n }\r\n\r\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\r\n }\r\n\r\n private handleUnknownOperation(error: any): boolean {\r\n RpcControlChannel.ensureInitialized();\r\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\r\n }\r\n\r\n public static sanitizeForLog(activity?: RpcActivity) {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n return activity ? {\r\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\r\n } : undefined;\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n }\r\n\r\n private async resolve(): Promise<any> {\r\n const request = this.request;\r\n const activity: RpcActivity = {\r\n activityId: request.id,\r\n applicationId: request.applicationId,\r\n applicationVersion: request.applicationVersion,\r\n sessionId: request.sessionId,\r\n user: request.user,\r\n accessToken: request.authorization,\r\n rpcMethod: request.operation.operationName,\r\n };\r\n\r\n try {\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\r\n\r\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\r\n this.applyPolicies(parameters);\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\r\n (impl as any)[CURRENT_INVOCATION] = this;\r\n const op = this.lookupOperationFunction(impl);\r\n\r\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\r\n .catch(async (error) => {\r\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\r\n if (!(error instanceof RpcPendingResponse)) {\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\r\n Tracing.recordException(error);\r\n }\r\n throw error;\r\n }));\r\n } catch (error: unknown) {\r\n return this.reject(error);\r\n }\r\n }\r\n\r\n private applyPolicies(parameters: any) {\r\n if (!parameters || !Array.isArray(parameters))\r\n return;\r\n\r\n for (let i = 0; i !== parameters.length; ++i) {\r\n const parameter = parameters[i];\r\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\r\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\r\n const inflated = this.protocol.inflateToken(parameter, this.request);\r\n parameters[i] = inflated;\r\n\r\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\r\n if (RpcConfiguration.throwOnTokenMismatch) {\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\r\n } else {\r\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\r\n return a.key === b.key &&\r\n a.iTwinId === b.iTwinId &&\r\n a.iModelId === b.iModelId &&\r\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\r\n }\r\n\r\n private async reject(error: any): Promise<any> {\r\n this._threw = true;\r\n return error;\r\n }\r\n\r\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\r\n const result = RpcMarshaling.serialize(this.protocol, value);\r\n return this.fulfill(result, value);\r\n }\r\n\r\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n if (!RpcConfiguration.developmentMode)\r\n reason.stack = undefined;\r\n\r\n const result = RpcMarshaling.serialize(this.protocol, reason);\r\n\r\n if (reason instanceof RpcPendingResponse) {\r\n this._pending = true;\r\n this._threw = false;\r\n result.objects = reason.message;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\r\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\r\n this._noContent = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\r\n } else if (reason instanceof RpcNotFoundResponse) {\r\n this._notFound = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\r\n } else {\r\n this._threw = true;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\r\n }\r\n\r\n return this.fulfill(result, reason);\r\n }\r\n\r\n private supportsNoContent() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\r\n }\r\n\r\n private supportsStatusCategory() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n if (!this.protocol.supportsStatusCategory) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\r\n }\r\n\r\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\r\n const fulfillment: RpcRequestFulfillment = {\r\n result,\r\n rawResult,\r\n status: this.protocol.getCode(this.status),\r\n id: this.request.id,\r\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\r\n allowCompression: this.operation?.policy.allowResponseCompression || false,\r\n };\r\n\r\n this.transformResponseStatus(fulfillment, rawResult);\r\n\r\n try {\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\r\n if (impl[CURRENT_INVOCATION] === this) {\r\n impl[CURRENT_INVOCATION] = undefined;\r\n }\r\n } catch (_err) { }\r\n\r\n return fulfillment;\r\n }\r\n\r\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\r\n const func = (implementation as any)[this.operation.operationName];\r\n if (!func || typeof (func) !== \"function\")\r\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\r\n\r\n return func;\r\n }\r\n\r\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\r\n if (!this.supportsStatusCategory()) {\r\n return;\r\n }\r\n\r\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\r\n if (this._pending) {\r\n managedStatus = \"pending\";\r\n } else if (this._notFound) {\r\n managedStatus = \"notFound\";\r\n } else if (this._noContent) {\r\n managedStatus = \"noContent\";\r\n }\r\n\r\n if (managedStatus) {\r\n const responseValue = fulfillment.result.objects;\r\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\r\n fulfillment.result.objects = JSON.stringify(status);\r\n status.responseValue = rawResult; // for ipc case\r\n fulfillment.rawResult = status;\r\n }\r\n\r\n if (rawResult instanceof BentleyError) {\r\n fulfillment.status = StatusCategory.for(rawResult).code;\r\n }\r\n }\r\n}\r\n"]}
@@ -173,6 +173,11 @@ export interface RenderFeatureTable {
173
173
  populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void;
174
174
  /** @alpha */
175
175
  getAnimationNodeId(featureIndex: number): number;
176
+ /** Get the Id of the model associated with the feature at the specified index.
177
+ * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].
178
+ * This is more efficient than [[getFeature]] for callers who are only interested in the model Id.
179
+ */
180
+ getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
176
181
  }
177
182
  /**
178
183
  * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,
@@ -207,6 +212,7 @@ export declare class PackedFeatureTable implements RenderFeatureTable {
207
212
  getAnimationNodeId(featureIndex: number): number;
208
213
  /** @internal */
209
214
  getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature;
215
+ getModelIdPair(_featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
210
216
  /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */
211
217
  findElementId(featureIndex: number): Id64String | undefined;
212
218
  /** Return true if this table contains exactly 1 feature. */
@@ -269,6 +275,7 @@ export declare class MultiModelPackedFeatureTable implements RenderFeatureTable
269
275
  getFeature(featureIndex: number, result: ModelFeature): ModelFeature;
270
276
  findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined;
271
277
  getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
278
+ getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;
272
279
  findElementId(featureIndex: number): Id64String | undefined;
273
280
  iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex>;
274
281
  iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureTable.d.ts","sourceRoot":"","sources":["../../src/FeatureTable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACmC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAC5F,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,qBAAa,OAAO;IAClB,SAAgB,SAAS,EAAE,UAAU,CAAC;IACtC,SAAgB,aAAa,EAAE,UAAU,CAAC;IAC1C,SAAgB,aAAa,EAAE,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AE,SAAS,EAAE,MAAM,GAAG,IAAI;CAGvF"}
@@ -302,6 +302,11 @@ export class PackedFeatureTable {
302
302
  result.modelId.upper = this.batchModelIdPair.upper;
303
303
  return result;
304
304
  }
305
+ getModelIdPair(_featureIndex, out) {
306
+ out.lower = this.batchModelIdPair.lower;
307
+ out.upper = this.batchModelIdPair.upper;
308
+ return out;
309
+ }
305
310
  /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */
306
311
  findElementId(featureIndex) {
307
312
  if (featureIndex >= this.numFeatures)
@@ -455,6 +460,10 @@ export class MultiModelPackedFeatureTable {
455
460
  getElementIdPair(featureIndex, out) {
456
461
  return this._features.getElementIdPair(featureIndex, out);
457
462
  }
463
+ getModelIdPair(featureIndex, out) {
464
+ this._models.getModelIdPair(featureIndex, out);
465
+ return out;
466
+ }
458
467
  findElementId(featureIndex) {
459
468
  return this._features.findElementId(featureIndex);
460
469
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureTable.js","sourceRoot":"","sources":["../../src/FeatureTable.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAc,YAAY,EAAE,QAAQ,GACjF,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,OAAO,OAAO;IAKlB,YAAmB,YAAwB,IAAI,CAAC,OAAO,EAAE,gBAA4B,IAAI,CAAC,OAAO,EAAE,gBAA+B,aAAa,CAAC,OAAO;QACrJ,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,IAAW,SAAS,KAAc,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI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AM,MAAM,CAAC;SACd;IACH,CAAC;IAEM,QAAQ,CAAC,MAA8B;QAC5C,OAAO;YACL,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC/C,CAAC;IACJ,CAAC;IAEM,kBAAkB,CAAC,YAAoB;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEM,wBAAwB,CAAC,aAA4B,EAAE,SAAiB;QAC7E,IAAI,CAAC,SAAS,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC7F,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport {\r\n assert, compareNumbers, compareStrings, Id64, Id64String, IndexedValue, IndexMap, UintArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { GeometryClass } from \"./GeometryParams\";\r\n\r\n/** Describes a discrete entity within a batched [RenderGraphic]($frontend) that can be\r\n * grouped with other such entities in a [[FeatureTable]].\r\n * Features roughly correlate to elements: a [Tile]($frontend)'s graphics combines geometry from every\r\n * [GeometricElement]($backend) that intersects the tile's volume, so each element produces at least one feature.\r\n * However, an element's geometry stream can contain geometry belonging to multiple different combinations of [SubCategory]($backend) and\r\n * [[GeometryClass]], so an individual element may produce more than one feature.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class Feature {\r\n public readonly elementId: Id64String;\r\n public readonly subCategoryId: Id64String;\r\n public readonly geometryClass: GeometryClass;\r\n\r\n public constructor(elementId: Id64String = Id64.invalid, subCategoryId: Id64String = Id64.invalid, geometryClass: GeometryClass = GeometryClass.Primary) {\r\n this.elementId = elementId;\r\n this.subCategoryId = subCategoryId;\r\n this.geometryClass = geometryClass;\r\n }\r\n\r\n public get isDefined(): boolean { return !Id64.isInvalid(this.elementId) || !Id64.isInvalid(this.subCategoryId) || this.geometryClass !== GeometryClass.Primary; }\r\n public get isUndefined(): boolean { return !this.isDefined; }\r\n\r\n /** Returns true if this feature is equivalent to the supplied feature. */\r\n public equals(other: Feature): boolean { return 0 === this.compare(other); }\r\n\r\n /** Performs ordinal comparison of this feature with another.\r\n * @param rhs The feature to compare with.\r\n * @returns zero if the features are equivalent, a negative value if this feature compares as \"less than\" `rhs`, or a positive value if this feature compares \"greater than\" `rhs`.\r\n */\r\n public compare(rhs: Feature): number {\r\n if (this === rhs)\r\n return 0;\r\n\r\n let cmp = compareNumbers(this.geometryClass, rhs.geometryClass);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.elementId, rhs.elementId);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.subCategoryId, rhs.subCategoryId);\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n}\r\n\r\n/** A [[Feature]] with a modelId identifying the model containing the feature, obtained from a [[RenderFeatureTable]].\r\n * @public\r\n */\r\nexport interface ModelFeature {\r\n modelId: Id64String;\r\n elementId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n}\r\n\r\n/** @public */\r\nexport namespace ModelFeature {\r\n /** Create a ModelFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.findFeature]] and [[RenderFeatureTable.getFeature]].\r\n */\r\n export function create(): ModelFeature {\r\n return {\r\n modelId: Id64.invalid,\r\n elementId: Id64.invalid,\r\n subCategoryId: Id64.invalid,\r\n geometryClass: GeometryClass.Primary,\r\n };\r\n }\r\n\r\n /** Returns `true` if any of `feature`'s properties differ from the defaults (invalid Ids and [[GeometryClass.Primary]]). */\r\n export function isDefined(feature: ModelFeature): boolean {\r\n return !Id64.isInvalid(feature.modelId) || !Id64.isInvalid(feature.elementId) || !Id64.isInvalid(feature.subCategoryId) || feature.geometryClass !== GeometryClass.Primary;\r\n }\r\n\r\n /** @alpha */\r\n export function unpack(packed: PackedFeature, result: ModelFeature, unpackedModelId?: Id64String): ModelFeature {\r\n result.modelId = unpackedModelId ?? Id64.fromUint32PairObject(packed.modelId);\r\n result.elementId = Id64.fromUint32PairObject(packed.elementId);\r\n result.subCategoryId = Id64.fromUint32PairObject(packed.subCategoryId);\r\n result.geometryClass = packed.geometryClass;\r\n return result;\r\n }\r\n}\r\n\r\n/** Represents a [[Feature]] within a [[RenderFeatureTable]]. This representation is optimized for use on the GPU.\r\n * @public\r\n */\r\nexport interface PackedFeature {\r\n modelId: Id64.Uint32Pair;\r\n elementId: Id64.Uint32Pair;\r\n subCategoryId: Id64.Uint32Pair;\r\n geometryClass: GeometryClass;\r\n /** @alpha */\r\n animationNodeId: number;\r\n}\r\n\r\n/** Represents a [[PackedFeature]] obtained from a [[RenderFeatureTable]], including the index of that feature within the table.\r\n * @public\r\n */\r\nexport interface PackedFeatureWithIndex extends PackedFeature {\r\n index: number;\r\n}\r\n\r\n/** @public */\r\nexport namespace PackedFeature {\r\n /** Create a PackedFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.getPackedFeature]].\r\n */\r\n export function create(): PackedFeature {\r\n const pair = { upper: 0, lower: 0 };\r\n return {\r\n modelId: { ...pair },\r\n elementId: { ...pair },\r\n subCategoryId: { ...pair },\r\n geometryClass: GeometryClass.Primary,\r\n animationNodeId: 0,\r\n };\r\n }\r\n\r\n /** Create a PackedFeatureWithIndex of [[GeometryClass.Primary]] with all invalid Ids and an index of zero.\r\n * This is primarily useful for creating a reusable `output` argument for [[RenderFeatureTable.iterable]].\r\n */\r\n export function createWithIndex(): PackedFeatureWithIndex {\r\n const result = create() as PackedFeatureWithIndex;\r\n result.index = 0;\r\n return result;\r\n }\r\n}\r\n\r\n/** Describes the type of a 'batch' of graphics representing multiple [[Feature]]s.\r\n * The most commonly-encountered batches are Tiles, which can be of either Primary or\r\n * Classifier type.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum BatchType {\r\n /** This batch contains graphics derived from a model's visible geometry. */\r\n Primary,\r\n /**\r\n * This batch contains color volumes which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to the stencil buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n VolumeClassifier,\r\n /**\r\n * This batch contains planar graphics which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to a texture buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n PlanarClassifier,\r\n}\r\n\r\n/** Defines a look-up table for [[Feature]]s within a batched [RenderGraphic]($frontend). Consecutive 32-bit\r\n * indices are assigned to each unique Feature. Primitives within the RenderGraphic can\r\n * use per-vertex indices to specify the distribution of Features within the primitive. The appearance of individual\r\n * features can be customized using [[FeatureOverrides]]. Typically a [Tile]($frontend) will contain a feature table\r\n * identifying the elements whose geometry appears within that tile.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class FeatureTable extends IndexMap<Feature> {\r\n public readonly modelId: Id64String;\r\n public readonly type: BatchType;\r\n\r\n /** Construct an empty FeatureTable. */\r\n public constructor(maxFeatures: number, modelId: Id64String = Id64.invalid, type: BatchType = BatchType.Primary) {\r\n super((lhs, rhs) => lhs.compare(rhs), maxFeatures);\r\n this.modelId = modelId;\r\n this.type = type;\r\n }\r\n\r\n /** Returns the maximum number of [[Feature]]s this FeatureTable can contain. */\r\n public get maxFeatures(): number { return this._maximumSize; }\r\n /** @internal */\r\n public get anyDefined(): boolean { return this.length > 1 || (1 === this.length && this._array[0].value.isDefined); }\r\n /** Returns true if this FeatureTable contains exactly one [[Feature]]. */\r\n public get isUniform(): boolean { return 1 === this.length; }\r\n /** If this FeatureTable contains exactly one [[Feature]], returns that Feature; otherwise returns undefined. */\r\n public get uniform(): Feature | undefined { return 1 === this.length ? this._array[0].value : undefined; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.VolumeClassifier]] geometry. */\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.PlanarClassifier]] geometry. */\r\n public get isPlanarClassifier(): boolean { return BatchType.PlanarClassifier === this.type; }\r\n\r\n /** Returns the Feature corresponding to the specified index, or undefined if the index is not present. */\r\n public findFeature(index: number): Feature | undefined {\r\n for (const entry of this._array)\r\n if (entry.index === index)\r\n return entry.value;\r\n\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public insertWithIndex(feature: Feature, index: number): void {\r\n const bound = this.lowerBound(feature);\r\n assert(!bound.equal);\r\n assert(!this.isFull);\r\n const entry = new IndexedValue<Feature>(feature, index);\r\n this._array.splice(bound.index, 0, entry);\r\n }\r\n\r\n /** @internal */\r\n public getArray(): Array<IndexedValue<Feature>> { return this._array; }\r\n\r\n /** Convert this feature table to a representation that can be supplied to [RenderSystem.createBatch]($frontend). */\r\n public pack(): RenderFeatureTable {\r\n return PackedFeatureTable.pack(this);\r\n }\r\n}\r\n\r\n/** @alpha */\r\nexport type ComputeNodeId = (feature: PackedFeatureWithIndex) => number;\r\n\r\n/** Representation of a [[FeatureTable]] suitable for use with [RenderSystem.createBatch]($frontend).\r\n * The [[Feature]]s are represented as [[PackedFeature]]s. The feature table may contain features from multiple [Model]($backend)s.\r\n * @see [[FeatureTable.pack]] to produce a RenderFeatureTable.\r\n * @public\r\n */\r\nexport interface RenderFeatureTable {\r\n /** The \"model Id\" of the tile tree containing the tile from which this feature table originated.\r\n * It may be a transient Id if, for example, the tile tree represents a reality model or represents the geometry of multiple\r\n * persistent models batched together.\r\n */\r\n readonly batchModelId: Id64String;\r\n /** A split representation of [[batchModelId]], to avoid having to constantly having to parse the string. */\r\n readonly batchModelIdPair: Id64.Uint32Pair;\r\n /** The number of features in the table; equivalently, one more than the largest feature index. */\r\n readonly numFeatures: number;\r\n /** The number of bytes consumed by the feature table, strictly for diagnostic purposes. */\r\n readonly byteLength: number;\r\n readonly type: BatchType;\r\n /** @alpha */\r\n animationNodeIds?: UintArray;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getFeature(featureIndex: number, result: ModelFeature): ModelFeature;\r\n\r\n /** Find the feature at the specified index. Returns undefined if featureIndex >= [[numFeatures]]. */\r\n findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined;\r\n\r\n /** Find the Id of the element associated with the feature at the specified index. */\r\n findElementId(featureIndex: number): Id64String | undefined;\r\n\r\n /** Get the Id of the element associated with the feature at the specified index as a pair of 32-bit integers.\r\n * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].\r\n */\r\n getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature;\r\n\r\n /** Get an object that provides ordered iteration over all features.\r\n * @note The `output` object is reused (mutated in place) as the current value on each iteration.\r\n */\r\n iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>;\r\n\r\n /** @alpha */\r\n populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void;\r\n\r\n /** @alpha */\r\n getAnimationNodeId(featureIndex: number): number;\r\n}\r\n\r\nconst scratchPackedFeature = PackedFeature.create();\r\n\r\nfunction populateAnimationNodeIds(table: RenderFeatureTable, computeNodeId: ComputeNodeId, maxNodeId: number): UintArray | undefined {\r\n assert(maxNodeId > 0);\r\n\r\n let nodeIds;\r\n const outputFeature = PackedFeature.createWithIndex();\r\n for (const feature of table.iterable(outputFeature)) {\r\n const nodeId = computeNodeId(feature);\r\n assert(nodeId <= maxNodeId);\r\n if (0 !== nodeId) {\r\n if (!nodeIds) {\r\n const size = table.numFeatures;\r\n nodeIds = maxNodeId < 0x100 ? new Uint8Array(size) : (maxNodeId < 0x10000 ? new Uint16Array(size) : new Uint32Array(size));\r\n }\r\n\r\n nodeIds[feature.index] = nodeId;\r\n }\r\n }\r\n\r\n return nodeIds;\r\n}\r\n\r\n/**\r\n * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,\r\n * wherein each feature occupies 3 32-bit integers.\r\n * @internal\r\n */\r\nexport class PackedFeatureTable implements RenderFeatureTable {\r\n private readonly _data: Uint32Array;\r\n public readonly batchModelId: Id64String;\r\n public readonly batchModelIdPair: Id64.Uint32Pair;\r\n public readonly numFeatures: number;\r\n public readonly anyDefined: boolean;\r\n public readonly type: BatchType;\r\n public animationNodeIds?: UintArray;\r\n\r\n public get byteLength(): number { return this._data.byteLength; }\r\n\r\n /** Construct a PackedFeatureTable from the packed binary data.\r\n * This is used internally when deserializing Tiles in iMdl format.\r\n * @internal\r\n */\r\n public constructor(data: Uint32Array, modelId: Id64String, numFeatures: number, type: BatchType, animationNodeIds?: UintArray) {\r\n this._data = data;\r\n this.batchModelId = modelId;\r\n this.batchModelIdPair = Id64.getUint32Pair(modelId);\r\n this.numFeatures = numFeatures;\r\n this.type = type;\r\n this.animationNodeIds = animationNodeIds;\r\n\r\n switch (this.numFeatures) {\r\n case 0:\r\n this.anyDefined = false;\r\n break;\r\n case 1:\r\n this.anyDefined = ModelFeature.isDefined(this.getFeature(0, ModelFeature.create()));\r\n break;\r\n default:\r\n this.anyDefined = true;\r\n break;\r\n }\r\n\r\n assert(this._data.length >= this._subCategoriesOffset);\r\n assert(undefined === this.animationNodeIds || this.animationNodeIds.length === this.numFeatures);\r\n }\r\n\r\n /** Create a packed feature table from a [[FeatureTable]]. */\r\n public static pack(featureTable: FeatureTable): PackedFeatureTable {\r\n // We must determine how many subcategories we have ahead of time to compute the size of the Uint32Array, as\r\n // the array cannot be resized after it is created.\r\n // We are not too worried about this as FeatureTables created on the front-end will contain few if any features; those obtained from the\r\n // back-end arrive within tiles already in the packed format.\r\n const subcategories = new Map<string, number>();\r\n for (const iv of featureTable.getArray()) {\r\n const found = subcategories.get(iv.value.subCategoryId.toString());\r\n if (undefined === found)\r\n subcategories.set(iv.value.subCategoryId, subcategories.size);\r\n }\r\n\r\n // We need 3 32-bit integers per feature, plus 2 32-bit integers per subcategory.\r\n const subCategoriesOffset = 3 * featureTable.length;\r\n const nUint32s = subCategoriesOffset + 2 * subcategories.size;\r\n const uint32s = new Uint32Array(nUint32s);\r\n\r\n for (const iv of featureTable.getArray()) {\r\n const feature = iv.value;\r\n const index = iv.index * 3;\r\n\r\n let subCategoryIndex = subcategories.get(feature.subCategoryId)!;\r\n assert(undefined !== subCategoryIndex); // we inserted it above...\r\n subCategoryIndex |= (feature.geometryClass << 24);\r\n\r\n uint32s[index + 0] = Id64.getLowerUint32(feature.elementId);\r\n uint32s[index + 1] = Id64.getUpperUint32(feature.elementId);\r\n uint32s[index + 2] = subCategoryIndex;\r\n }\r\n\r\n subcategories.forEach((index: number, id: string, _map) => {\r\n const index32 = subCategoriesOffset + 2 * index;\r\n uint32s[index32 + 0] = Id64.getLowerUint32(id);\r\n uint32s[index32 + 1] = Id64.getUpperUint32(id);\r\n });\r\n\r\n return new PackedFeatureTable(uint32s, featureTable.modelId, featureTable.length, featureTable.type);\r\n }\r\n\r\n /** Retrieve the Feature associated with the specified index. */\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result, this.batchModelId);\r\n }\r\n\r\n /** Returns the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public getElementIdPair(featureIndex: number, out?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n out = out ?? { lower: 0, upper: 0 };\r\n assert(featureIndex < this.numFeatures);\r\n const offset = 3 * featureIndex;\r\n out.lower = this._data[offset];\r\n out.upper = this._data[offset + 1];\r\n return out;\r\n }\r\n\r\n /** @internal */\r\n public getSubCategoryIdPair(featureIndex: number): Id64.Uint32Pair {\r\n const index = 3 * featureIndex;\r\n let subCatIndex = this._data[index + 2];\r\n subCatIndex = (subCatIndex & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n return { lower: this._data[subCatIndex], upper: this._data[subCatIndex + 1] };\r\n }\r\n\r\n /** @internal */\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return undefined !== this.animationNodeIds && featureIndex < this.numFeatures ? this.animationNodeIds[featureIndex] : 0;\r\n }\r\n\r\n /** @internal */\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n assert(featureIndex < this.numFeatures);\r\n\r\n const index32 = 3 * featureIndex;\r\n result.elementId.lower = this._data[index32];\r\n result.elementId.upper = this._data[index32 + 1];\r\n\r\n const subCatIndexAndClass = this._data[index32 + 2];\r\n result.geometryClass = (subCatIndexAndClass >>> 24) & 0xff;\r\n\r\n let subCatIndex = (subCatIndexAndClass & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n result.subCategoryId.lower = this._data[subCatIndex];\r\n result.subCategoryId.upper = this._data[subCatIndex + 1];\r\n\r\n result.animationNodeId = this.getAnimationNodeId(featureIndex);\r\n result.modelId.lower = this.batchModelIdPair.lower;\r\n result.modelId.upper = this.batchModelIdPair.upper;\r\n\r\n return result;\r\n }\r\n\r\n /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n if (featureIndex >= this.numFeatures)\r\n return undefined;\r\n else\r\n return this.readId(3 * featureIndex);\r\n }\r\n\r\n /** Return true if this table contains exactly 1 feature. */\r\n public get isUniform(): boolean { return 1 === this.numFeatures; }\r\n\r\n /** If this table contains exactly 1 feature, return it. */\r\n public getUniform(result: ModelFeature): ModelFeature | undefined {\r\n return this.isUniform ? this.getFeature(0, result) : undefined;\r\n }\r\n\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isPlanarClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isClassifier(): boolean { return this.isVolumeClassifier || this.isPlanarClassifier; }\r\n\r\n /** Unpack the features into a [[FeatureTable]]. */\r\n public unpack(): FeatureTable {\r\n const table = new FeatureTable(this.numFeatures, this.batchModelId);\r\n const feature = ModelFeature.create();\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getFeature(i, feature);\r\n table.insertWithIndex(new Feature(feature.elementId, feature.subCategoryId, feature.geometryClass), i);\r\n }\r\n\r\n return table;\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n assert(undefined === this.animationNodeIds);\r\n this.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getPackedFeature(i, output);\r\n output.index = i;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n private get _subCategoriesOffset(): number { return this.numFeatures * 3; }\r\n\r\n private readId(offset32: number): Id64String {\r\n return Id64.fromUint32Pair(this._data[offset32], this._data[offset32 + 1]);\r\n }\r\n}\r\n\r\ninterface PackedFeatureModelEntry {\r\n lastFeatureIndex: number;\r\n idLower: number;\r\n idUpper: number;\r\n}\r\n\r\nconst scratchPackedFeatureModelEntry = { lastFeatureIndex: -1, idLower: -1, idUpper: -1 };\r\n\r\n/** A table of model Ids associated with a [[MultiModelPackedFeatureTable]].\r\n * The feature indices in the packed feature table are grouped together by model, such that the first N features belong to model 1, the next M features to model 2, and so on.\r\n * The model table itself consists of one entry per model, where each entry looks like:\r\n * indexOfLastFeatureInModel: u32\r\n * modelId: u64\r\n * The modelId associated with a feature can therefore be derived by finding the entry in the model table with the highest indexOfLastFeatureInModel no greater than the feature index.\r\n * This lookup can be optimized using binary search.\r\n * Moreover, while iterating the feature table in sequence, the model table can be iterated in parallel so that no per-feature lookup of model Id is required.\r\n * @internal\r\n */\r\nexport class PackedFeatureModelTable {\r\n private readonly _data: Uint32Array;\r\n\r\n public constructor(data: Uint32Array) {\r\n this._data = data;\r\n assert(this._data.length % 3 === 0);\r\n }\r\n\r\n /** The number of models in the table. */\r\n public get length(): number {\r\n return this._data.length / 3;\r\n }\r\n\r\n public get byteLength(): number {\r\n return this._data.byteLength;\r\n }\r\n\r\n private getLastFeatureIndex(modelIndex: number): number {\r\n return this._data[modelIndex * 3];\r\n }\r\n\r\n public getEntry(modelIndex: number, result: PackedFeatureModelEntry): PackedFeatureModelEntry {\r\n if (modelIndex >= this.length) {\r\n result.idLower = result.idUpper = 0;\r\n result.lastFeatureIndex = Number.MAX_SAFE_INTEGER;\r\n return result;\r\n }\r\n\r\n const index = modelIndex * 3;\r\n result.lastFeatureIndex = this._data[index + 0];\r\n result.idLower = this._data[index + 1];\r\n result.idUpper = this._data[index + 2];\r\n return result;\r\n }\r\n\r\n /** Get the Id of the model associated with the specified feature, or an invalid Id if the feature is not associated with any model. */\r\n public getModelIdPair(featureIndex: number, result?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n if (!result)\r\n result = { lower: 0, upper: 0 };\r\n else\r\n result.lower = result.upper = 0;\r\n\r\n let first = 0;\r\n const last = this.length;\r\n let count = last;\r\n while (count > 0) {\r\n const step = Math.floor(count / 2);\r\n const mid = first + step;\r\n const lastFeatureIndex = this.getLastFeatureIndex(mid);\r\n if (featureIndex > lastFeatureIndex) {\r\n first = mid + 1;\r\n count -= step + 1;\r\n } else {\r\n count = step;\r\n }\r\n }\r\n\r\n if (first < last) {\r\n result.lower = this._data[first * 3 + 1];\r\n result.upper = this._data[first * 3 + 2];\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/** A PackedFeatureTable with a PackedFeatureModelTable appended to it, capable of storing features belonging to more than one model.\r\n * @internal\r\n */\r\nexport class MultiModelPackedFeatureTable implements RenderFeatureTable {\r\n private readonly _features: PackedFeatureTable;\r\n private readonly _models: PackedFeatureModelTable;\r\n\r\n public constructor(features: PackedFeatureTable, models: PackedFeatureModelTable) {\r\n this._features = features;\r\n this._models = models;\r\n }\r\n\r\n public static create(data: Uint32Array, batchModelId: Id64String, numFeatures: number, type: BatchType, numSubCategories: number): MultiModelPackedFeatureTable {\r\n const modelTableOffset = 3 * numFeatures + 2 * numSubCategories;\r\n const featureData = data.subarray(0, modelTableOffset);\r\n const features = new PackedFeatureTable(featureData, batchModelId, numFeatures, type);\r\n\r\n const modelData = data.subarray(modelTableOffset);\r\n const models = new PackedFeatureModelTable(modelData);\r\n\r\n return new MultiModelPackedFeatureTable(features, models);\r\n }\r\n\r\n public get batchModelId() { return this._features.batchModelId; }\r\n public get batchModelIdPair() { return this._features.batchModelIdPair; }\r\n public get numFeatures() { return this._features.numFeatures; }\r\n public get type() { return this._features.type; }\r\n public get animationNodeIds(): UintArray | undefined { return this._features.animationNodeIds; }\r\n public set animationNodeIds(ids: UintArray | undefined) { this._features.animationNodeIds = ids; }\r\n\r\n public get byteLength() {\r\n return this._features.byteLength + this._models.byteLength;\r\n }\r\n\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n this._features.getPackedFeature(featureIndex, result);\r\n this._models.getModelIdPair(featureIndex, result.modelId);\r\n return result;\r\n }\r\n\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result);\r\n }\r\n\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n public getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n return this._features.getElementIdPair(featureIndex, out);\r\n }\r\n\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n return this._features.findElementId(featureIndex);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n // Rather than perform a binary search on the model table to find each feature's model Id, traverse the model table in parallel with the feature table.\r\n let modelIndex = 0;\r\n const modelEntry = this._models.getEntry(modelIndex, scratchPackedFeatureModelEntry);\r\n\r\n for (let featureIndex = 0; featureIndex < this.numFeatures; featureIndex++) {\r\n if (featureIndex > modelEntry.lastFeatureIndex)\r\n this._models.getEntry(++modelIndex, modelEntry);\r\n\r\n this._features.getPackedFeature(featureIndex, output);\r\n output.modelId.lower = modelEntry.idLower;\r\n output.modelId.upper = modelEntry.idUpper;\r\n output.index = featureIndex;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return this._features.getAnimationNodeId(featureIndex);\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n this._features.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FeatureTable.js","sourceRoot":"","sources":["../../src/FeatureTable.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAc,YAAY,EAAE,QAAQ,GACjF,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,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Aa,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;IAEM,CAAE,QAAQ,CAAC,MAA8B;QAC9C,uJAAuJ;QACvJ,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;QAErF,KAAK,IAAI,YAAY,GAAG,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,EAAE;YAC1E,IAAI,YAAY,GAAG,UAAU,CAAC,gBAAgB;gBAC5C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;YAElD,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACtD,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC;YAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC;YAC1C,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC;YAC5B,MAAM,MAAM,CAAC;SACd;IACH,CAAC;IAEM,QAAQ,CAAC,MAA8B;QAC5C,OAAO;YACL,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SAC/C,CAAC;IACJ,CAAC;IAEM,kBAAkB,CAAC,YAAoB;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEM,wBAAwB,CAAC,aAA4B,EAAE,SAAiB;QAC7E,IAAI,CAAC,SAAS,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC7F,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport {\r\n assert, compareNumbers, compareStrings, Id64, Id64String, IndexedValue, IndexMap, UintArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { GeometryClass } from \"./GeometryParams\";\r\n\r\n/** Describes a discrete entity within a batched [RenderGraphic]($frontend) that can be\r\n * grouped with other such entities in a [[FeatureTable]].\r\n * Features roughly correlate to elements: a [Tile]($frontend)'s graphics combines geometry from every\r\n * [GeometricElement]($backend) that intersects the tile's volume, so each element produces at least one feature.\r\n * However, an element's geometry stream can contain geometry belonging to multiple different combinations of [SubCategory]($backend) and\r\n * [[GeometryClass]], so an individual element may produce more than one feature.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class Feature {\r\n public readonly elementId: Id64String;\r\n public readonly subCategoryId: Id64String;\r\n public readonly geometryClass: GeometryClass;\r\n\r\n public constructor(elementId: Id64String = Id64.invalid, subCategoryId: Id64String = Id64.invalid, geometryClass: GeometryClass = GeometryClass.Primary) {\r\n this.elementId = elementId;\r\n this.subCategoryId = subCategoryId;\r\n this.geometryClass = geometryClass;\r\n }\r\n\r\n public get isDefined(): boolean { return !Id64.isInvalid(this.elementId) || !Id64.isInvalid(this.subCategoryId) || this.geometryClass !== GeometryClass.Primary; }\r\n public get isUndefined(): boolean { return !this.isDefined; }\r\n\r\n /** Returns true if this feature is equivalent to the supplied feature. */\r\n public equals(other: Feature): boolean { return 0 === this.compare(other); }\r\n\r\n /** Performs ordinal comparison of this feature with another.\r\n * @param rhs The feature to compare with.\r\n * @returns zero if the features are equivalent, a negative value if this feature compares as \"less than\" `rhs`, or a positive value if this feature compares \"greater than\" `rhs`.\r\n */\r\n public compare(rhs: Feature): number {\r\n if (this === rhs)\r\n return 0;\r\n\r\n let cmp = compareNumbers(this.geometryClass, rhs.geometryClass);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.elementId, rhs.elementId);\r\n if (0 === cmp) {\r\n cmp = compareStrings(this.subCategoryId, rhs.subCategoryId);\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n}\r\n\r\n/** A [[Feature]] with a modelId identifying the model containing the feature, obtained from a [[RenderFeatureTable]].\r\n * @public\r\n */\r\nexport interface ModelFeature {\r\n modelId: Id64String;\r\n elementId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n}\r\n\r\n/** @public */\r\nexport namespace ModelFeature {\r\n /** Create a ModelFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.findFeature]] and [[RenderFeatureTable.getFeature]].\r\n */\r\n export function create(): ModelFeature {\r\n return {\r\n modelId: Id64.invalid,\r\n elementId: Id64.invalid,\r\n subCategoryId: Id64.invalid,\r\n geometryClass: GeometryClass.Primary,\r\n };\r\n }\r\n\r\n /** Returns `true` if any of `feature`'s properties differ from the defaults (invalid Ids and [[GeometryClass.Primary]]). */\r\n export function isDefined(feature: ModelFeature): boolean {\r\n return !Id64.isInvalid(feature.modelId) || !Id64.isInvalid(feature.elementId) || !Id64.isInvalid(feature.subCategoryId) || feature.geometryClass !== GeometryClass.Primary;\r\n }\r\n\r\n /** @alpha */\r\n export function unpack(packed: PackedFeature, result: ModelFeature, unpackedModelId?: Id64String): ModelFeature {\r\n result.modelId = unpackedModelId ?? Id64.fromUint32PairObject(packed.modelId);\r\n result.elementId = Id64.fromUint32PairObject(packed.elementId);\r\n result.subCategoryId = Id64.fromUint32PairObject(packed.subCategoryId);\r\n result.geometryClass = packed.geometryClass;\r\n return result;\r\n }\r\n}\r\n\r\n/** Represents a [[Feature]] within a [[RenderFeatureTable]]. This representation is optimized for use on the GPU.\r\n * @public\r\n */\r\nexport interface PackedFeature {\r\n modelId: Id64.Uint32Pair;\r\n elementId: Id64.Uint32Pair;\r\n subCategoryId: Id64.Uint32Pair;\r\n geometryClass: GeometryClass;\r\n /** @alpha */\r\n animationNodeId: number;\r\n}\r\n\r\n/** Represents a [[PackedFeature]] obtained from a [[RenderFeatureTable]], including the index of that feature within the table.\r\n * @public\r\n */\r\nexport interface PackedFeatureWithIndex extends PackedFeature {\r\n index: number;\r\n}\r\n\r\n/** @public */\r\nexport namespace PackedFeature {\r\n /** Create a PackedFeature of [[GeometryClass.Primary]] with all invalid Ids.\r\n * This is primarily useful for creating a `result` argument for [[RenderFeatureTable.getPackedFeature]].\r\n */\r\n export function create(): PackedFeature {\r\n const pair = { upper: 0, lower: 0 };\r\n return {\r\n modelId: { ...pair },\r\n elementId: { ...pair },\r\n subCategoryId: { ...pair },\r\n geometryClass: GeometryClass.Primary,\r\n animationNodeId: 0,\r\n };\r\n }\r\n\r\n /** Create a PackedFeatureWithIndex of [[GeometryClass.Primary]] with all invalid Ids and an index of zero.\r\n * This is primarily useful for creating a reusable `output` argument for [[RenderFeatureTable.iterable]].\r\n */\r\n export function createWithIndex(): PackedFeatureWithIndex {\r\n const result = create() as PackedFeatureWithIndex;\r\n result.index = 0;\r\n return result;\r\n }\r\n}\r\n\r\n/** Describes the type of a 'batch' of graphics representing multiple [[Feature]]s.\r\n * The most commonly-encountered batches are Tiles, which can be of either Primary or\r\n * Classifier type.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum BatchType {\r\n /** This batch contains graphics derived from a model's visible geometry. */\r\n Primary,\r\n /**\r\n * This batch contains color volumes which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to the stencil buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n VolumeClassifier,\r\n /**\r\n * This batch contains planar graphics which are used to classify a model's visible geometry.\r\n * The graphics themselves are not rendered to the screen; instead they are rendered to a texture buffer\r\n * to resymbolize the primary geometry.\r\n */\r\n PlanarClassifier,\r\n}\r\n\r\n/** Defines a look-up table for [[Feature]]s within a batched [RenderGraphic]($frontend). Consecutive 32-bit\r\n * indices are assigned to each unique Feature. Primitives within the RenderGraphic can\r\n * use per-vertex indices to specify the distribution of Features within the primitive. The appearance of individual\r\n * features can be customized using [[FeatureOverrides]]. Typically a [Tile]($frontend) will contain a feature table\r\n * identifying the elements whose geometry appears within that tile.\r\n * @see [[FeatureOverrides]] for customizing the appearance of individual features.\r\n * @public\r\n */\r\nexport class FeatureTable extends IndexMap<Feature> {\r\n public readonly modelId: Id64String;\r\n public readonly type: BatchType;\r\n\r\n /** Construct an empty FeatureTable. */\r\n public constructor(maxFeatures: number, modelId: Id64String = Id64.invalid, type: BatchType = BatchType.Primary) {\r\n super((lhs, rhs) => lhs.compare(rhs), maxFeatures);\r\n this.modelId = modelId;\r\n this.type = type;\r\n }\r\n\r\n /** Returns the maximum number of [[Feature]]s this FeatureTable can contain. */\r\n public get maxFeatures(): number { return this._maximumSize; }\r\n /** @internal */\r\n public get anyDefined(): boolean { return this.length > 1 || (1 === this.length && this._array[0].value.isDefined); }\r\n /** Returns true if this FeatureTable contains exactly one [[Feature]]. */\r\n public get isUniform(): boolean { return 1 === this.length; }\r\n /** If this FeatureTable contains exactly one [[Feature]], returns that Feature; otherwise returns undefined. */\r\n public get uniform(): Feature | undefined { return 1 === this.length ? this._array[0].value : undefined; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.VolumeClassifier]] geometry. */\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n /** Returns true if this FeatureTable is associated with [[BatchType.PlanarClassifier]] geometry. */\r\n public get isPlanarClassifier(): boolean { return BatchType.PlanarClassifier === this.type; }\r\n\r\n /** Returns the Feature corresponding to the specified index, or undefined if the index is not present. */\r\n public findFeature(index: number): Feature | undefined {\r\n for (const entry of this._array)\r\n if (entry.index === index)\r\n return entry.value;\r\n\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public insertWithIndex(feature: Feature, index: number): void {\r\n const bound = this.lowerBound(feature);\r\n assert(!bound.equal);\r\n assert(!this.isFull);\r\n const entry = new IndexedValue<Feature>(feature, index);\r\n this._array.splice(bound.index, 0, entry);\r\n }\r\n\r\n /** @internal */\r\n public getArray(): Array<IndexedValue<Feature>> { return this._array; }\r\n\r\n /** Convert this feature table to a representation that can be supplied to [RenderSystem.createBatch]($frontend). */\r\n public pack(): RenderFeatureTable {\r\n return PackedFeatureTable.pack(this);\r\n }\r\n}\r\n\r\n/** @alpha */\r\nexport type ComputeNodeId = (feature: PackedFeatureWithIndex) => number;\r\n\r\n/** Representation of a [[FeatureTable]] suitable for use with [RenderSystem.createBatch]($frontend).\r\n * The [[Feature]]s are represented as [[PackedFeature]]s. The feature table may contain features from multiple [Model]($backend)s.\r\n * @see [[FeatureTable.pack]] to produce a RenderFeatureTable.\r\n * @public\r\n */\r\nexport interface RenderFeatureTable {\r\n /** The \"model Id\" of the tile tree containing the tile from which this feature table originated.\r\n * It may be a transient Id if, for example, the tile tree represents a reality model or represents the geometry of multiple\r\n * persistent models batched together.\r\n */\r\n readonly batchModelId: Id64String;\r\n /** A split representation of [[batchModelId]], to avoid having to constantly having to parse the string. */\r\n readonly batchModelIdPair: Id64.Uint32Pair;\r\n /** The number of features in the table; equivalently, one more than the largest feature index. */\r\n readonly numFeatures: number;\r\n /** The number of bytes consumed by the feature table, strictly for diagnostic purposes. */\r\n readonly byteLength: number;\r\n readonly type: BatchType;\r\n /** @alpha */\r\n animationNodeIds?: UintArray;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getFeature(featureIndex: number, result: ModelFeature): ModelFeature;\r\n\r\n /** Find the feature at the specified index. Returns undefined if featureIndex >= [[numFeatures]]. */\r\n findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined;\r\n\r\n /** Find the Id of the element associated with the feature at the specified index. */\r\n findElementId(featureIndex: number): Id64String | undefined;\r\n\r\n /** Get the Id of the element associated with the feature at the specified index as a pair of 32-bit integers.\r\n * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].\r\n */\r\n getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;\r\n\r\n /** Get the feature at the specified index. The caller is responsible for validating featureIndex less than numFeatures. */\r\n getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature;\r\n\r\n /** Get an object that provides ordered iteration over all features.\r\n * @note The `output` object is reused (mutated in place) as the current value on each iteration.\r\n */\r\n iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>;\r\n\r\n /** @alpha */\r\n populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void;\r\n\r\n /** @alpha */\r\n getAnimationNodeId(featureIndex: number): number;\r\n\r\n /** Get the Id of the model associated with the feature at the specified index.\r\n * The caller is responsible for validating that `featureIndex` is less than [[numFeatures]].\r\n * This is more efficient than [[getFeature]] for callers who are only interested in the model Id.\r\n */\r\n getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair;\r\n}\r\n\r\nconst scratchPackedFeature = PackedFeature.create();\r\n\r\nfunction populateAnimationNodeIds(table: RenderFeatureTable, computeNodeId: ComputeNodeId, maxNodeId: number): UintArray | undefined {\r\n assert(maxNodeId > 0);\r\n\r\n let nodeIds;\r\n const outputFeature = PackedFeature.createWithIndex();\r\n for (const feature of table.iterable(outputFeature)) {\r\n const nodeId = computeNodeId(feature);\r\n assert(nodeId <= maxNodeId);\r\n if (0 !== nodeId) {\r\n if (!nodeIds) {\r\n const size = table.numFeatures;\r\n nodeIds = maxNodeId < 0x100 ? new Uint8Array(size) : (maxNodeId < 0x10000 ? new Uint16Array(size) : new Uint32Array(size));\r\n }\r\n\r\n nodeIds[feature.index] = nodeId;\r\n }\r\n }\r\n\r\n return nodeIds;\r\n}\r\n\r\n/**\r\n * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,\r\n * wherein each feature occupies 3 32-bit integers.\r\n * @internal\r\n */\r\nexport class PackedFeatureTable implements RenderFeatureTable {\r\n private readonly _data: Uint32Array;\r\n public readonly batchModelId: Id64String;\r\n public readonly batchModelIdPair: Id64.Uint32Pair;\r\n public readonly numFeatures: number;\r\n public readonly anyDefined: boolean;\r\n public readonly type: BatchType;\r\n public animationNodeIds?: UintArray;\r\n\r\n public get byteLength(): number { return this._data.byteLength; }\r\n\r\n /** Construct a PackedFeatureTable from the packed binary data.\r\n * This is used internally when deserializing Tiles in iMdl format.\r\n * @internal\r\n */\r\n public constructor(data: Uint32Array, modelId: Id64String, numFeatures: number, type: BatchType, animationNodeIds?: UintArray) {\r\n this._data = data;\r\n this.batchModelId = modelId;\r\n this.batchModelIdPair = Id64.getUint32Pair(modelId);\r\n this.numFeatures = numFeatures;\r\n this.type = type;\r\n this.animationNodeIds = animationNodeIds;\r\n\r\n switch (this.numFeatures) {\r\n case 0:\r\n this.anyDefined = false;\r\n break;\r\n case 1:\r\n this.anyDefined = ModelFeature.isDefined(this.getFeature(0, ModelFeature.create()));\r\n break;\r\n default:\r\n this.anyDefined = true;\r\n break;\r\n }\r\n\r\n assert(this._data.length >= this._subCategoriesOffset);\r\n assert(undefined === this.animationNodeIds || this.animationNodeIds.length === this.numFeatures);\r\n }\r\n\r\n /** Create a packed feature table from a [[FeatureTable]]. */\r\n public static pack(featureTable: FeatureTable): PackedFeatureTable {\r\n // We must determine how many subcategories we have ahead of time to compute the size of the Uint32Array, as\r\n // the array cannot be resized after it is created.\r\n // We are not too worried about this as FeatureTables created on the front-end will contain few if any features; those obtained from the\r\n // back-end arrive within tiles already in the packed format.\r\n const subcategories = new Map<string, number>();\r\n for (const iv of featureTable.getArray()) {\r\n const found = subcategories.get(iv.value.subCategoryId.toString());\r\n if (undefined === found)\r\n subcategories.set(iv.value.subCategoryId, subcategories.size);\r\n }\r\n\r\n // We need 3 32-bit integers per feature, plus 2 32-bit integers per subcategory.\r\n const subCategoriesOffset = 3 * featureTable.length;\r\n const nUint32s = subCategoriesOffset + 2 * subcategories.size;\r\n const uint32s = new Uint32Array(nUint32s);\r\n\r\n for (const iv of featureTable.getArray()) {\r\n const feature = iv.value;\r\n const index = iv.index * 3;\r\n\r\n let subCategoryIndex = subcategories.get(feature.subCategoryId)!;\r\n assert(undefined !== subCategoryIndex); // we inserted it above...\r\n subCategoryIndex |= (feature.geometryClass << 24);\r\n\r\n uint32s[index + 0] = Id64.getLowerUint32(feature.elementId);\r\n uint32s[index + 1] = Id64.getUpperUint32(feature.elementId);\r\n uint32s[index + 2] = subCategoryIndex;\r\n }\r\n\r\n subcategories.forEach((index: number, id: string, _map) => {\r\n const index32 = subCategoriesOffset + 2 * index;\r\n uint32s[index32 + 0] = Id64.getLowerUint32(id);\r\n uint32s[index32 + 1] = Id64.getUpperUint32(id);\r\n });\r\n\r\n return new PackedFeatureTable(uint32s, featureTable.modelId, featureTable.length, featureTable.type);\r\n }\r\n\r\n /** Retrieve the Feature associated with the specified index. */\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result, this.batchModelId);\r\n }\r\n\r\n /** Returns the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public getElementIdPair(featureIndex: number, out?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n out = out ?? { lower: 0, upper: 0 };\r\n assert(featureIndex < this.numFeatures);\r\n const offset = 3 * featureIndex;\r\n out.lower = this._data[offset];\r\n out.upper = this._data[offset + 1];\r\n return out;\r\n }\r\n\r\n /** @internal */\r\n public getSubCategoryIdPair(featureIndex: number): Id64.Uint32Pair {\r\n const index = 3 * featureIndex;\r\n let subCatIndex = this._data[index + 2];\r\n subCatIndex = (subCatIndex & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n return { lower: this._data[subCatIndex], upper: this._data[subCatIndex + 1] };\r\n }\r\n\r\n /** @internal */\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return undefined !== this.animationNodeIds && featureIndex < this.numFeatures ? this.animationNodeIds[featureIndex] : 0;\r\n }\r\n\r\n /** @internal */\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n assert(featureIndex < this.numFeatures);\r\n\r\n const index32 = 3 * featureIndex;\r\n result.elementId.lower = this._data[index32];\r\n result.elementId.upper = this._data[index32 + 1];\r\n\r\n const subCatIndexAndClass = this._data[index32 + 2];\r\n result.geometryClass = (subCatIndexAndClass >>> 24) & 0xff;\r\n\r\n let subCatIndex = (subCatIndexAndClass & 0x00ffffff) >>> 0;\r\n subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;\r\n result.subCategoryId.lower = this._data[subCatIndex];\r\n result.subCategoryId.upper = this._data[subCatIndex + 1];\r\n\r\n result.animationNodeId = this.getAnimationNodeId(featureIndex);\r\n result.modelId.lower = this.batchModelIdPair.lower;\r\n result.modelId.upper = this.batchModelIdPair.upper;\r\n\r\n return result;\r\n }\r\n\r\n public getModelIdPair(_featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n out.lower = this.batchModelIdPair.lower;\r\n out.upper = this.batchModelIdPair.upper;\r\n return out;\r\n }\r\n\r\n /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n if (featureIndex >= this.numFeatures)\r\n return undefined;\r\n else\r\n return this.readId(3 * featureIndex);\r\n }\r\n\r\n /** Return true if this table contains exactly 1 feature. */\r\n public get isUniform(): boolean { return 1 === this.numFeatures; }\r\n\r\n /** If this table contains exactly 1 feature, return it. */\r\n public getUniform(result: ModelFeature): ModelFeature | undefined {\r\n return this.isUniform ? this.getFeature(0, result) : undefined;\r\n }\r\n\r\n public get isVolumeClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isPlanarClassifier(): boolean { return BatchType.VolumeClassifier === this.type; }\r\n public get isClassifier(): boolean { return this.isVolumeClassifier || this.isPlanarClassifier; }\r\n\r\n /** Unpack the features into a [[FeatureTable]]. */\r\n public unpack(): FeatureTable {\r\n const table = new FeatureTable(this.numFeatures, this.batchModelId);\r\n const feature = ModelFeature.create();\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getFeature(i, feature);\r\n table.insertWithIndex(new Feature(feature.elementId, feature.subCategoryId, feature.geometryClass), i);\r\n }\r\n\r\n return table;\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n assert(undefined === this.animationNodeIds);\r\n this.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n for (let i = 0; i < this.numFeatures; i++) {\r\n this.getPackedFeature(i, output);\r\n output.index = i;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n private get _subCategoriesOffset(): number { return this.numFeatures * 3; }\r\n\r\n private readId(offset32: number): Id64String {\r\n return Id64.fromUint32Pair(this._data[offset32], this._data[offset32 + 1]);\r\n }\r\n}\r\n\r\ninterface PackedFeatureModelEntry {\r\n lastFeatureIndex: number;\r\n idLower: number;\r\n idUpper: number;\r\n}\r\n\r\nconst scratchPackedFeatureModelEntry = { lastFeatureIndex: -1, idLower: -1, idUpper: -1 };\r\n\r\n/** A table of model Ids associated with a [[MultiModelPackedFeatureTable]].\r\n * The feature indices in the packed feature table are grouped together by model, such that the first N features belong to model 1, the next M features to model 2, and so on.\r\n * The model table itself consists of one entry per model, where each entry looks like:\r\n * indexOfLastFeatureInModel: u32\r\n * modelId: u64\r\n * The modelId associated with a feature can therefore be derived by finding the entry in the model table with the highest indexOfLastFeatureInModel no greater than the feature index.\r\n * This lookup can be optimized using binary search.\r\n * Moreover, while iterating the feature table in sequence, the model table can be iterated in parallel so that no per-feature lookup of model Id is required.\r\n * @internal\r\n */\r\nexport class PackedFeatureModelTable {\r\n private readonly _data: Uint32Array;\r\n\r\n public constructor(data: Uint32Array) {\r\n this._data = data;\r\n assert(this._data.length % 3 === 0);\r\n }\r\n\r\n /** The number of models in the table. */\r\n public get length(): number {\r\n return this._data.length / 3;\r\n }\r\n\r\n public get byteLength(): number {\r\n return this._data.byteLength;\r\n }\r\n\r\n private getLastFeatureIndex(modelIndex: number): number {\r\n return this._data[modelIndex * 3];\r\n }\r\n\r\n public getEntry(modelIndex: number, result: PackedFeatureModelEntry): PackedFeatureModelEntry {\r\n if (modelIndex >= this.length) {\r\n result.idLower = result.idUpper = 0;\r\n result.lastFeatureIndex = Number.MAX_SAFE_INTEGER;\r\n return result;\r\n }\r\n\r\n const index = modelIndex * 3;\r\n result.lastFeatureIndex = this._data[index + 0];\r\n result.idLower = this._data[index + 1];\r\n result.idUpper = this._data[index + 2];\r\n return result;\r\n }\r\n\r\n /** Get the Id of the model associated with the specified feature, or an invalid Id if the feature is not associated with any model. */\r\n public getModelIdPair(featureIndex: number, result?: Id64.Uint32Pair): Id64.Uint32Pair {\r\n if (!result)\r\n result = { lower: 0, upper: 0 };\r\n else\r\n result.lower = result.upper = 0;\r\n\r\n let first = 0;\r\n const last = this.length;\r\n let count = last;\r\n while (count > 0) {\r\n const step = Math.floor(count / 2);\r\n const mid = first + step;\r\n const lastFeatureIndex = this.getLastFeatureIndex(mid);\r\n if (featureIndex > lastFeatureIndex) {\r\n first = mid + 1;\r\n count -= step + 1;\r\n } else {\r\n count = step;\r\n }\r\n }\r\n\r\n if (first < last) {\r\n result.lower = this._data[first * 3 + 1];\r\n result.upper = this._data[first * 3 + 2];\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\n/** A PackedFeatureTable with a PackedFeatureModelTable appended to it, capable of storing features belonging to more than one model.\r\n * @internal\r\n */\r\nexport class MultiModelPackedFeatureTable implements RenderFeatureTable {\r\n private readonly _features: PackedFeatureTable;\r\n private readonly _models: PackedFeatureModelTable;\r\n\r\n public constructor(features: PackedFeatureTable, models: PackedFeatureModelTable) {\r\n this._features = features;\r\n this._models = models;\r\n }\r\n\r\n public static create(data: Uint32Array, batchModelId: Id64String, numFeatures: number, type: BatchType, numSubCategories: number): MultiModelPackedFeatureTable {\r\n const modelTableOffset = 3 * numFeatures + 2 * numSubCategories;\r\n const featureData = data.subarray(0, modelTableOffset);\r\n const features = new PackedFeatureTable(featureData, batchModelId, numFeatures, type);\r\n\r\n const modelData = data.subarray(modelTableOffset);\r\n const models = new PackedFeatureModelTable(modelData);\r\n\r\n return new MultiModelPackedFeatureTable(features, models);\r\n }\r\n\r\n public get batchModelId() { return this._features.batchModelId; }\r\n public get batchModelIdPair() { return this._features.batchModelIdPair; }\r\n public get numFeatures() { return this._features.numFeatures; }\r\n public get type() { return this._features.type; }\r\n public get animationNodeIds(): UintArray | undefined { return this._features.animationNodeIds; }\r\n public set animationNodeIds(ids: UintArray | undefined) { this._features.animationNodeIds = ids; }\r\n\r\n public get byteLength() {\r\n return this._features.byteLength + this._models.byteLength;\r\n }\r\n\r\n public getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature {\r\n this._features.getPackedFeature(featureIndex, result);\r\n this._models.getModelIdPair(featureIndex, result.modelId);\r\n return result;\r\n }\r\n\r\n public getFeature(featureIndex: number, result: ModelFeature): ModelFeature {\r\n const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);\r\n return ModelFeature.unpack(packed, result);\r\n }\r\n\r\n public findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined {\r\n return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;\r\n }\r\n\r\n public getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n return this._features.getElementIdPair(featureIndex, out);\r\n }\r\n\r\n public getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair {\r\n this._models.getModelIdPair(featureIndex, out);\r\n return out;\r\n }\r\n\r\n public findElementId(featureIndex: number): Id64String | undefined {\r\n return this._features.findElementId(featureIndex);\r\n }\r\n\r\n public * iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex> {\r\n // Rather than perform a binary search on the model table to find each feature's model Id, traverse the model table in parallel with the feature table.\r\n let modelIndex = 0;\r\n const modelEntry = this._models.getEntry(modelIndex, scratchPackedFeatureModelEntry);\r\n\r\n for (let featureIndex = 0; featureIndex < this.numFeatures; featureIndex++) {\r\n if (featureIndex > modelEntry.lastFeatureIndex)\r\n this._models.getEntry(++modelIndex, modelEntry);\r\n\r\n this._features.getPackedFeature(featureIndex, output);\r\n output.modelId.lower = modelEntry.idLower;\r\n output.modelId.upper = modelEntry.idUpper;\r\n output.index = featureIndex;\r\n yield output;\r\n }\r\n }\r\n\r\n public iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex> {\r\n return {\r\n [Symbol.iterator]: () => this.iterator(output),\r\n };\r\n }\r\n\r\n public getAnimationNodeId(featureIndex: number): number {\r\n return this._features.getAnimationNodeId(featureIndex);\r\n }\r\n\r\n public populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void {\r\n this._features.animationNodeIds = populateAnimationNodeIds(this, computeNodeId, maxNodeId);\r\n }\r\n}\r\n"]}
@@ -44,5 +44,7 @@ export declare class PlanProjectionSettings {
44
44
  * @returns A PlanProjectionSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.
45
45
  */
46
46
  clone(changedProps?: PlanProjectionSettingsProps): PlanProjectionSettings;
47
+ /** Return true if these settings are equivalent to the specified settings. */
48
+ equals(other: PlanProjectionSettings): boolean;
47
49
  }
48
50
  //# sourceMappingURL=PlanProjectionSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanProjectionSettings.d.ts","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,MAAM,W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CAAC;IACtC,kDAAkD;IAClD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,iEAAiE;IACjE,SAAgB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAE1C,MAAM,IAAI,2BAA2B;WAS9B,QAAQ,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,GAAG,sBAAsB,GAAG,SAAS;IAU1G,gBAAgB;gBACG,KAAK,EAAE,2BAA2B;IAYrD;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,EAAE,2BAA2B,GAAG,sBAAsB;IAoBhF,8EAA8E;IACvE,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO;CAMtD"}
@@ -56,5 +56,11 @@ export class PlanProjectionSettings {
56
56
  props.enforceDisplayPriority = changedProps.enforceDisplayPriority;
57
57
  return new PlanProjectionSettings(props);
58
58
  }
59
+ /** Return true if these settings are equivalent to the specified settings. */
60
+ equals(other) {
61
+ if (this === other)
62
+ return true;
63
+ return this.elevation === other.elevation && this.transparency === other.transparency && this.overlay === other.overlay && this.enforceDisplayPriority === other.enforceDisplayPriority;
64
+ }
59
65
  }
60
66
  //# sourceMappingURL=PlanProjectionSettings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanProjectionSettings.js","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAqBH;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IAU1B,MAAM;QACX,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YACjD,sBAAsB,EAAE,IAAI,KAAK,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAChF,CAAC;IACJ,CAAC;IAEM,MA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AO,CAAC;QAEvC,IAAI,SAAS,KAAK,YAAY,CAAC,sBAAsB;YACnD,KAAK,CAAC,sBAAsB,GAAG,YAAY,CAAC,sBAAsB,CAAC;QAErE,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\n/** Wire format describing [[PlanProjectionSettings]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PlanProjectionSettingsProps {\r\n /** If defined, the absolute height in meters at which to display the model. */\r\n elevation?: number;\r\n /** If defined, specifies a uniform transparency applied to all of the geometry in the model, in the range 0.0 (fully opaque) to 1.0 (fully transparent). */\r\n transparency?: number;\r\n /** If defined and true, the model is displayed as an overlay in the view (without depth testing) so that it is always visible behind other geometry. */\r\n overlay?: boolean;\r\n /** If defined and true, subcategory display priority is used to specify the draw order of portions of the model. Geometry belonging to a subcategory with a higher priority\r\n * value is drawn on top of coincident geometry belonging to a subcategory with a lower priority value. The priorities can be modified at display time using\r\n * [FeatureSymbology.Overrides]($frontend). Note that subcategory \"layers\" cross model boundaries; that is, geometry belonging to the same subcategory in different models\r\n * are drawn as part of the same layer.\r\n */\r\n enforceDisplayPriority?: boolean;\r\n}\r\n\r\n/** Describes how to draw a plan projection model. A plan projection model is a [GeometricModel3d]($backend) whose geometry all lies in\r\n * a single XY plane, wherein the Z coordinate of the plane may be arbitrary or flexible. Multiple plan projection models can be combined into one view\r\n * and drawn as \"layers\" with relative priorities.\r\n * @see [[DisplayStyle3dSettings.setPlanProjectionSettings]] to define plan projection settings for a [DisplayStyle3dState]($frontend).\r\n * @see [GeometricModel3d.isPlanProjection]($backend).\r\n * @public\r\n */\r\nexport class PlanProjectionSettings {\r\n /** See [[PlanProjectionSettingsProps.elevation]] */\r\n public readonly elevation?: number;\r\n /** See [[PlanProjectionSettingsProps.transparency]] */\r\n public readonly transparency?: number;\r\n /** See [[PlanProjectionSettingsProps.overlay]] */\r\n public readonly overlay: boolean;\r\n /** See [[PlanProjectionSettingsProps.enforceDisplayPriority]] */\r\n public readonly enforceDisplayPriority?: boolean;\r\n\r\n public toJSON(): PlanProjectionSettingsProps {\r\n return {\r\n elevation: this.elevation,\r\n transparency: this.transparency,\r\n overlay: true === this.overlay ? true : undefined,\r\n enforceDisplayPriority: true === this.enforceDisplayPriority ? true : undefined,\r\n };\r\n }\r\n\r\n public static fromJSON(props: PlanProjectionSettingsProps | undefined): PlanProjectionSettings | undefined {\r\n if (undefined === props)\r\n return undefined;\r\n\r\n if (undefined === props.elevation && undefined === props.transparency && undefined === props.overlay && undefined === props.enforceDisplayPriority)\r\n return undefined;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n\r\n /** @internal */\r\n public constructor(props: PlanProjectionSettingsProps) {\r\n this.elevation = props.elevation;\r\n this.overlay = true === props.overlay;\r\n this.enforceDisplayPriority = true === props.enforceDisplayPriority;\r\n\r\n let transparency = props.transparency;\r\n if (undefined !== transparency)\r\n transparency = Math.max(0, Math.min(1, transparency));\r\n\r\n this.transparency = transparency;\r\n }\r\n\r\n /** Create a copy of this PlanProjectionSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A PlanProjectionSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: PlanProjectionSettingsProps): PlanProjectionSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props: PlanProjectionSettingsProps = this.toJSON();\r\n if (undefined !== changedProps.elevation)\r\n props.elevation = changedProps.elevation;\r\n\r\n if (undefined !== changedProps.transparency)\r\n props.transparency = changedProps.transparency;\r\n\r\n if (undefined !== changedProps.overlay)\r\n props.overlay = changedProps.overlay;\r\n\r\n if (undefined !== changedProps.enforceDisplayPriority)\r\n props.enforceDisplayPriority = changedProps.enforceDisplayPriority;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PlanProjectionSettings.js","sourceRoot":"","sources":["../../src/PlanProjectionSettings.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAqBH;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IAU1B,MAAM;QACX,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YACjD,sBAAsB,EAAE,IAAI,KAAK,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAChF,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAA8C;QACnE,IAAI,SAAS,KAAK,KAAK;YACrB,OAAO,SAAS,CAAC;QAEnB,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS,IAAI,SAAS,KAAK,KAAK,CAAC,YAAY,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,sBAAsB;YAChJ,OAAO,SAAS,CAAC;QAEnB,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB;IAChB,YAAmB,KAAkC;QACnD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,sBAAsB,GAAG,IAAI,KAAK,KAAK,CAAC,sBAAsB,CAAC;QAEpE,IAAI,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACtC,IAAI,SAAS,KAAK,YAAY;YAC5B,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAA0C;QACrD,IAAI,SAAS,KAAK,YAAY;YAC5B,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAgC,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,IAAI,SAAS,KAAK,YAAY,CAAC,SAAS;YACtC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;QAE3C,IAAI,SAAS,KAAK,YAAY,CAAC,YAAY;YACzC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC;QAEjD,IAAI,SAAS,KAAK,YAAY,CAAC,OAAO;YACpC,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;QAEvC,IAAI,SAAS,KAAK,YAAY,CAAC,sBAAsB;YACnD,KAAK,CAAC,sBAAsB,GAAG,YAAY,CAAC,sBAAsB,CAAC;QAErE,OAAO,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,8EAA8E;IACvE,MAAM,CAAC,KAA6B;QACzC,IAAI,IAAI,KAAK,KAAK;YAChB,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,sBAAsB,KAAK,KAAK,CAAC,sBAAsB,CAAC;IAC1L,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module DisplayStyles\r\n */\r\n\r\n/** Wire format describing [[PlanProjectionSettings]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PlanProjectionSettingsProps {\r\n /** If defined, the absolute height in meters at which to display the model. */\r\n elevation?: number;\r\n /** If defined, specifies a uniform transparency applied to all of the geometry in the model, in the range 0.0 (fully opaque) to 1.0 (fully transparent). */\r\n transparency?: number;\r\n /** If defined and true, the model is displayed as an overlay in the view (without depth testing) so that it is always visible behind other geometry. */\r\n overlay?: boolean;\r\n /** If defined and true, subcategory display priority is used to specify the draw order of portions of the model. Geometry belonging to a subcategory with a higher priority\r\n * value is drawn on top of coincident geometry belonging to a subcategory with a lower priority value. The priorities can be modified at display time using\r\n * [FeatureSymbology.Overrides]($frontend). Note that subcategory \"layers\" cross model boundaries; that is, geometry belonging to the same subcategory in different models\r\n * are drawn as part of the same layer.\r\n */\r\n enforceDisplayPriority?: boolean;\r\n}\r\n\r\n/** Describes how to draw a plan projection model. A plan projection model is a [GeometricModel3d]($backend) whose geometry all lies in\r\n * a single XY plane, wherein the Z coordinate of the plane may be arbitrary or flexible. Multiple plan projection models can be combined into one view\r\n * and drawn as \"layers\" with relative priorities.\r\n * @see [[DisplayStyle3dSettings.setPlanProjectionSettings]] to define plan projection settings for a [DisplayStyle3dState]($frontend).\r\n * @see [GeometricModel3d.isPlanProjection]($backend).\r\n * @public\r\n */\r\nexport class PlanProjectionSettings {\r\n /** See [[PlanProjectionSettingsProps.elevation]] */\r\n public readonly elevation?: number;\r\n /** See [[PlanProjectionSettingsProps.transparency]] */\r\n public readonly transparency?: number;\r\n /** See [[PlanProjectionSettingsProps.overlay]] */\r\n public readonly overlay: boolean;\r\n /** See [[PlanProjectionSettingsProps.enforceDisplayPriority]] */\r\n public readonly enforceDisplayPriority?: boolean;\r\n\r\n public toJSON(): PlanProjectionSettingsProps {\r\n return {\r\n elevation: this.elevation,\r\n transparency: this.transparency,\r\n overlay: true === this.overlay ? true : undefined,\r\n enforceDisplayPriority: true === this.enforceDisplayPriority ? true : undefined,\r\n };\r\n }\r\n\r\n public static fromJSON(props: PlanProjectionSettingsProps | undefined): PlanProjectionSettings | undefined {\r\n if (undefined === props)\r\n return undefined;\r\n\r\n if (undefined === props.elevation && undefined === props.transparency && undefined === props.overlay && undefined === props.enforceDisplayPriority)\r\n return undefined;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n\r\n /** @internal */\r\n public constructor(props: PlanProjectionSettingsProps) {\r\n this.elevation = props.elevation;\r\n this.overlay = true === props.overlay;\r\n this.enforceDisplayPriority = true === props.enforceDisplayPriority;\r\n\r\n let transparency = props.transparency;\r\n if (undefined !== transparency)\r\n transparency = Math.max(0, Math.min(1, transparency));\r\n\r\n this.transparency = transparency;\r\n }\r\n\r\n /** Create a copy of this PlanProjectionSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A PlanProjectionSettings with all of its properties set to match those of `this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: PlanProjectionSettingsProps): PlanProjectionSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props: PlanProjectionSettingsProps = this.toJSON();\r\n if (undefined !== changedProps.elevation)\r\n props.elevation = changedProps.elevation;\r\n\r\n if (undefined !== changedProps.transparency)\r\n props.transparency = changedProps.transparency;\r\n\r\n if (undefined !== changedProps.overlay)\r\n props.overlay = changedProps.overlay;\r\n\r\n if (undefined !== changedProps.enforceDisplayPriority)\r\n props.enforceDisplayPriority = changedProps.enforceDisplayPriority;\r\n\r\n return new PlanProjectionSettings(props);\r\n }\r\n\r\n /** Return true if these settings are equivalent to the specified settings. */\r\n public equals(other: PlanProjectionSettings): boolean {\r\n if (this === other)\r\n return true;\r\n\r\n return this.elevation === other.elevation && this.transparency === other.transparency && this.overlay === other.overlay && this.enforceDisplayPriority === other.enforceDisplayPriority;\r\n }\r\n}\r\n"]}
@@ -111,7 +111,7 @@ class RpcInvocation {
111
111
  // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.
112
112
  if (!(error instanceof RpcPendingResponse)) {
113
113
  Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, "Error in RPC operation", { error: BentleyError.getErrorProps(error) });
114
- Tracing.setAttributes({ error: true });
114
+ Tracing.recordException(error);
115
115
  }
116
116
  throw error;
117
117
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH,OAAO,EAAe,YAAY,EAAE,aAAa,EAAc,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9J,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAsB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAoB,WAAW,EAAE,kBAAkB,EAA+C,MAAM,eAAe,CAAC;AAC/H,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAqChE;;GAEG;AACH,MAAa,aAAa;IAwBxB,mCAAmC;IACnC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,QAA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CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,YAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;SAD/D,aAAa","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelRpcProps } from \"../../IModel\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { SessionProps } from \"../../SessionProps\";\r\nimport { RpcConfiguration } from \"./RpcConfiguration\";\r\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\r\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\r\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\r\nimport { RpcOperation } from \"./RpcOperation\";\r\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\r\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** The properties of an RpcActivity.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RpcActivity extends SessionProps {\r\n /** Used for logging to correlate an Rpc activity between frontend and backend */\r\n readonly activityId: GuidString;\r\n\r\n /** access token for authorization */\r\n readonly accessToken: AccessToken;\r\n\r\n /** the name of the current rpc method */\r\n readonly rpcMethod?: string;\r\n\r\n readonly user?: string;\r\n}\r\n\r\n/** Serialized format for sending the request across the RPC layer\r\n * @public\r\n */\r\nexport interface SerializedRpcActivity {\r\n id: string;\r\n applicationId: string;\r\n applicationVersion: string;\r\n sessionId: string;\r\n authorization: string;\r\n user?: string;\r\n csrfToken?: { headerName: string, headerValue: string };\r\n}\r\n\r\n/** @internal */\r\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\r\n\r\n/** An RPC operation invocation in response to a request.\r\n * @internal\r\n */\r\nexport class RpcInvocation {\r\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\r\n private _threw: boolean = false;\r\n private _pending: boolean = false;\r\n private _notFound: boolean = false;\r\n private _noContent: boolean = false;\r\n private _timeIn: number = 0;\r\n private _timeOut: number = 0;\r\n\r\n /** The protocol for this invocation. */\r\n public readonly protocol: RpcProtocol;\r\n\r\n /** The received request. */\r\n public readonly request: SerializedRpcRequest;\r\n\r\n /** The operation of the request. */\r\n public readonly operation: RpcOperation = undefined as any;\r\n\r\n /** The implementation response. */\r\n public readonly result: Promise<any>;\r\n\r\n /** The fulfillment for this request. */\r\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\r\n\r\n /** The status for this request. */\r\n public get status(): RpcRequestStatus {\r\n return this._threw ? RpcRequestStatus.Rejected :\r\n this._pending ? RpcRequestStatus.Pending :\r\n this._notFound ? RpcRequestStatus.NotFound :\r\n this._noContent ? RpcRequestStatus.NoContent :\r\n RpcRequestStatus.Resolved;\r\n }\r\n\r\n /** The elapsed time for this invocation. */\r\n public get elapsed(): number {\r\n return this._timeOut - this._timeIn;\r\n }\r\n\r\n /**\r\n * The invocation for the current RPC operation.\r\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\r\n */\r\n public static current(rpcImpl: RpcInterface): RpcInvocation {\r\n return (rpcImpl as any)[CURRENT_INVOCATION];\r\n }\r\n\r\n /** Constructs an invocation. */\r\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\r\n this._timeIn = new Date().getTime();\r\n this.protocol = protocol;\r\n this.request = request;\r\n\r\n try {\r\n try {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n\r\n const backend = this.operation.interfaceVersion;\r\n const frontend = this.request.operation.interfaceVersion;\r\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\r\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\r\n }\r\n } catch (error) {\r\n if (this.handleUnknownOperation(error)) {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n\r\n this.result = this.resolve();\r\n } catch (error) {\r\n this.result = this.reject(error);\r\n }\r\n\r\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\r\n }\r\n\r\n private handleUnknownOperation(error: any): boolean {\r\n RpcControlChannel.ensureInitialized();\r\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\r\n }\r\n\r\n public static sanitizeForLog(activity?: RpcActivity) {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n return activity ? {\r\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\r\n } : undefined;\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n }\r\n\r\n private async resolve(): Promise<any> {\r\n const request = this.request;\r\n const activity: RpcActivity = {\r\n activityId: request.id,\r\n applicationId: request.applicationId,\r\n applicationVersion: request.applicationVersion,\r\n sessionId: request.sessionId,\r\n user: request.user,\r\n accessToken: request.authorization,\r\n rpcMethod: request.operation.operationName,\r\n };\r\n\r\n try {\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\r\n\r\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\r\n this.applyPolicies(parameters);\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\r\n (impl as any)[CURRENT_INVOCATION] = this;\r\n const op = this.lookupOperationFunction(impl);\r\n\r\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\r\n .catch(async (error) => {\r\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\r\n if (!(error instanceof RpcPendingResponse)) {\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\r\n Tracing.setAttributes({ error: true });\r\n }\r\n throw error;\r\n }));\r\n } catch (error: unknown) {\r\n return this.reject(error);\r\n }\r\n }\r\n\r\n private applyPolicies(parameters: any) {\r\n if (!parameters || !Array.isArray(parameters))\r\n return;\r\n\r\n for (let i = 0; i !== parameters.length; ++i) {\r\n const parameter = parameters[i];\r\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\r\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\r\n const inflated = this.protocol.inflateToken(parameter, this.request);\r\n parameters[i] = inflated;\r\n\r\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\r\n if (RpcConfiguration.throwOnTokenMismatch) {\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\r\n } else {\r\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\r\n return a.key === b.key &&\r\n a.iTwinId === b.iTwinId &&\r\n a.iModelId === b.iModelId &&\r\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\r\n }\r\n\r\n private async reject(error: any): Promise<any> {\r\n this._threw = true;\r\n return error;\r\n }\r\n\r\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\r\n const result = RpcMarshaling.serialize(this.protocol, value);\r\n return this.fulfill(result, value);\r\n }\r\n\r\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n if (!RpcConfiguration.developmentMode)\r\n reason.stack = undefined;\r\n\r\n const result = RpcMarshaling.serialize(this.protocol, reason);\r\n\r\n if (reason instanceof RpcPendingResponse) {\r\n this._pending = true;\r\n this._threw = false;\r\n result.objects = reason.message;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\r\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\r\n this._noContent = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\r\n } else if (reason instanceof RpcNotFoundResponse) {\r\n this._notFound = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\r\n } else {\r\n this._threw = true;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\r\n }\r\n\r\n return this.fulfill(result, reason);\r\n }\r\n\r\n private supportsNoContent() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\r\n }\r\n\r\n private supportsStatusCategory() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n if (!this.protocol.supportsStatusCategory) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\r\n }\r\n\r\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\r\n const fulfillment: RpcRequestFulfillment = {\r\n result,\r\n rawResult,\r\n status: this.protocol.getCode(this.status),\r\n id: this.request.id,\r\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\r\n allowCompression: this.operation?.policy.allowResponseCompression || false,\r\n };\r\n\r\n this.transformResponseStatus(fulfillment, rawResult);\r\n\r\n try {\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\r\n if (impl[CURRENT_INVOCATION] === this) {\r\n impl[CURRENT_INVOCATION] = undefined;\r\n }\r\n } catch (_err) { }\r\n\r\n return fulfillment;\r\n }\r\n\r\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\r\n const func = (implementation as any)[this.operation.operationName];\r\n if (!func || typeof (func) !== \"function\")\r\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\r\n\r\n return func;\r\n }\r\n\r\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\r\n if (!this.supportsStatusCategory()) {\r\n return;\r\n }\r\n\r\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\r\n if (this._pending) {\r\n managedStatus = \"pending\";\r\n } else if (this._notFound) {\r\n managedStatus = \"notFound\";\r\n } else if (this._noContent) {\r\n managedStatus = \"noContent\";\r\n }\r\n\r\n if (managedStatus) {\r\n const responseValue = fulfillment.result.objects;\r\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\r\n fulfillment.result.objects = JSON.stringify(status);\r\n status.responseValue = rawResult; // for ipc case\r\n fulfillment.rawResult = status;\r\n }\r\n\r\n if (rawResult instanceof BentleyError) {\r\n fulfillment.status = StatusCategory.for(rawResult).code;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH,OAAO,EAAe,YAAY,EAAE,aAAa,EAAc,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9J,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAsB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAoB,WAAW,EAAE,kBAAkB,EAA+C,MAAM,eAAe,CAAC;AAC/H,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAqChE;;GAEG;AACH,MAAa,aAAa;IAwBxB,mCAAmC;IACnC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC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,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,YAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;SAD/D,aAAa","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelRpcProps } from \"../../IModel\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterface } from \"../../RpcInterface\";\r\nimport { SessionProps } from \"../../SessionProps\";\r\nimport { RpcConfiguration } from \"./RpcConfiguration\";\r\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\r\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\r\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\r\nimport { RpcOperation } from \"./RpcOperation\";\r\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\r\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** The properties of an RpcActivity.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RpcActivity extends SessionProps {\r\n /** Used for logging to correlate an Rpc activity between frontend and backend */\r\n readonly activityId: GuidString;\r\n\r\n /** access token for authorization */\r\n readonly accessToken: AccessToken;\r\n\r\n /** the name of the current rpc method */\r\n readonly rpcMethod?: string;\r\n\r\n readonly user?: string;\r\n}\r\n\r\n/** Serialized format for sending the request across the RPC layer\r\n * @public\r\n */\r\nexport interface SerializedRpcActivity {\r\n id: string;\r\n applicationId: string;\r\n applicationVersion: string;\r\n sessionId: string;\r\n authorization: string;\r\n user?: string;\r\n csrfToken?: { headerName: string, headerValue: string };\r\n}\r\n\r\n/** @internal */\r\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\r\n\r\n/** An RPC operation invocation in response to a request.\r\n * @internal\r\n */\r\nexport class RpcInvocation {\r\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\r\n private _threw: boolean = false;\r\n private _pending: boolean = false;\r\n private _notFound: boolean = false;\r\n private _noContent: boolean = false;\r\n private _timeIn: number = 0;\r\n private _timeOut: number = 0;\r\n\r\n /** The protocol for this invocation. */\r\n public readonly protocol: RpcProtocol;\r\n\r\n /** The received request. */\r\n public readonly request: SerializedRpcRequest;\r\n\r\n /** The operation of the request. */\r\n public readonly operation: RpcOperation = undefined as any;\r\n\r\n /** The implementation response. */\r\n public readonly result: Promise<any>;\r\n\r\n /** The fulfillment for this request. */\r\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\r\n\r\n /** The status for this request. */\r\n public get status(): RpcRequestStatus {\r\n return this._threw ? RpcRequestStatus.Rejected :\r\n this._pending ? RpcRequestStatus.Pending :\r\n this._notFound ? RpcRequestStatus.NotFound :\r\n this._noContent ? RpcRequestStatus.NoContent :\r\n RpcRequestStatus.Resolved;\r\n }\r\n\r\n /** The elapsed time for this invocation. */\r\n public get elapsed(): number {\r\n return this._timeOut - this._timeIn;\r\n }\r\n\r\n /**\r\n * The invocation for the current RPC operation.\r\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\r\n */\r\n public static current(rpcImpl: RpcInterface): RpcInvocation {\r\n return (rpcImpl as any)[CURRENT_INVOCATION];\r\n }\r\n\r\n /** Constructs an invocation. */\r\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\r\n this._timeIn = new Date().getTime();\r\n this.protocol = protocol;\r\n this.request = request;\r\n\r\n try {\r\n try {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n\r\n const backend = this.operation.interfaceVersion;\r\n const frontend = this.request.operation.interfaceVersion;\r\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\r\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\r\n }\r\n } catch (error) {\r\n if (this.handleUnknownOperation(error)) {\r\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\r\n } else {\r\n throw error;\r\n }\r\n }\r\n\r\n this.result = this.resolve();\r\n } catch (error) {\r\n this.result = this.reject(error);\r\n }\r\n\r\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\r\n }\r\n\r\n private handleUnknownOperation(error: any): boolean {\r\n RpcControlChannel.ensureInitialized();\r\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\r\n }\r\n\r\n public static sanitizeForLog(activity?: RpcActivity) {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n return activity ? {\r\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\r\n } : undefined;\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n }\r\n\r\n private async resolve(): Promise<any> {\r\n const request = this.request;\r\n const activity: RpcActivity = {\r\n activityId: request.id,\r\n applicationId: request.applicationId,\r\n applicationVersion: request.applicationVersion,\r\n sessionId: request.sessionId,\r\n user: request.user,\r\n accessToken: request.authorization,\r\n rpcMethod: request.operation.operationName,\r\n };\r\n\r\n try {\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\r\n\r\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\r\n this.applyPolicies(parameters);\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\r\n (impl as any)[CURRENT_INVOCATION] = this;\r\n const op = this.lookupOperationFunction(impl);\r\n\r\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\r\n .catch(async (error) => {\r\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\r\n if (!(error instanceof RpcPendingResponse)) {\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\r\n Tracing.recordException(error);\r\n }\r\n throw error;\r\n }));\r\n } catch (error: unknown) {\r\n return this.reject(error);\r\n }\r\n }\r\n\r\n private applyPolicies(parameters: any) {\r\n if (!parameters || !Array.isArray(parameters))\r\n return;\r\n\r\n for (let i = 0; i !== parameters.length; ++i) {\r\n const parameter = parameters[i];\r\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\r\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\r\n const inflated = this.protocol.inflateToken(parameter, this.request);\r\n parameters[i] = inflated;\r\n\r\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\r\n if (RpcConfiguration.throwOnTokenMismatch) {\r\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\r\n } else {\r\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\r\n return a.key === b.key &&\r\n a.iTwinId === b.iTwinId &&\r\n a.iModelId === b.iModelId &&\r\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\r\n }\r\n\r\n private async reject(error: any): Promise<any> {\r\n this._threw = true;\r\n return error;\r\n }\r\n\r\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\r\n const result = RpcMarshaling.serialize(this.protocol, value);\r\n return this.fulfill(result, value);\r\n }\r\n\r\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\r\n this._timeOut = new Date().getTime();\r\n if (!RpcConfiguration.developmentMode)\r\n reason.stack = undefined;\r\n\r\n const result = RpcMarshaling.serialize(this.protocol, reason);\r\n\r\n if (reason instanceof RpcPendingResponse) {\r\n this._pending = true;\r\n this._threw = false;\r\n result.objects = reason.message;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\r\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\r\n this._noContent = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\r\n } else if (reason instanceof RpcNotFoundResponse) {\r\n this._notFound = true;\r\n this._threw = false;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\r\n } else {\r\n this._threw = true;\r\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\r\n }\r\n\r\n return this.fulfill(result, reason);\r\n }\r\n\r\n private supportsNoContent() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\r\n }\r\n\r\n private supportsStatusCategory() {\r\n if (!this.request.protocolVersion) {\r\n return false;\r\n }\r\n\r\n if (!this.protocol.supportsStatusCategory) {\r\n return false;\r\n }\r\n\r\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\r\n }\r\n\r\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\r\n const fulfillment: RpcRequestFulfillment = {\r\n result,\r\n rawResult,\r\n status: this.protocol.getCode(this.status),\r\n id: this.request.id,\r\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\r\n allowCompression: this.operation?.policy.allowResponseCompression || false,\r\n };\r\n\r\n this.transformResponseStatus(fulfillment, rawResult);\r\n\r\n try {\r\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\r\n if (impl[CURRENT_INVOCATION] === this) {\r\n impl[CURRENT_INVOCATION] = undefined;\r\n }\r\n } catch (_err) { }\r\n\r\n return fulfillment;\r\n }\r\n\r\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\r\n const func = (implementation as any)[this.operation.operationName];\r\n if (!func || typeof (func) !== \"function\")\r\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\r\n\r\n return func;\r\n }\r\n\r\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\r\n if (!this.supportsStatusCategory()) {\r\n return;\r\n }\r\n\r\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\r\n if (this._pending) {\r\n managedStatus = \"pending\";\r\n } else if (this._notFound) {\r\n managedStatus = \"notFound\";\r\n } else if (this._noContent) {\r\n managedStatus = \"noContent\";\r\n }\r\n\r\n if (managedStatus) {\r\n const responseValue = fulfillment.result.objects;\r\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\r\n fulfillment.result.objects = JSON.stringify(status);\r\n status.responseValue = rawResult; // for ipc case\r\n fulfillment.rawResult = status;\r\n }\r\n\r\n if (rawResult instanceof BentleyError) {\r\n fulfillment.status = StatusCategory.for(rawResult).code;\r\n }\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-common",
3
- "version": "4.4.0-dev.21",
3
+ "version": "4.4.0-dev.25",
4
4
  "description": "iTwin.js components common to frontend and backend",
5
5
  "main": "lib/cjs/core-common.js",
6
6
  "module": "lib/esm/core-common.js",
@@ -27,8 +27,8 @@
27
27
  "js-base64": "^3.6.1"
28
28
  },
29
29
  "peerDependencies": {
30
- "@itwin/core-bentley": "^4.4.0-dev.21",
31
- "@itwin/core-geometry": "^4.4.0-dev.21"
30
+ "@itwin/core-bentley": "^4.4.0-dev.25",
31
+ "@itwin/core-geometry": "^4.4.0-dev.25"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@itwin/eslint-plugin": "4.0.0-dev.44",
@@ -42,9 +42,9 @@
42
42
  "nyc": "^15.1.0",
43
43
  "rimraf": "^3.0.2",
44
44
  "typescript": "~5.0.2",
45
- "@itwin/build-tools": "4.4.0-dev.21",
46
- "@itwin/core-bentley": "4.4.0-dev.21",
47
- "@itwin/core-geometry": "4.4.0-dev.21"
45
+ "@itwin/build-tools": "4.4.0-dev.25",
46
+ "@itwin/core-bentley": "4.4.0-dev.25",
47
+ "@itwin/core-geometry": "4.4.0-dev.25"
48
48
  },
49
49
  "nyc": {
50
50
  "extends": "./node_modules/@itwin/build-tools/.nycrc",
@@ -59,6 +59,7 @@
59
59
  "extract-api": "betools extract-api --entry=core-common && npm run extract-extension-api",
60
60
  "extract-extension-api": "eslint -c extraction.eslint.config.js \"./src/**/*.ts\" 1>&2",
61
61
  "lint": "eslint -f visualstudio \"./src/**/*.ts\" 1>&2",
62
+ "lint-fix": "eslint --fix -f visualstudio \"./src/**/*.ts\" 1>&2",
62
63
  "test": "mocha",
63
64
  "cover": "nyc npm -s test"
64
65
  }