@itwin/core-frontend 5.9.0-dev.9 → 5.9.0
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.
- package/CHANGELOG.md +32 -1
- package/lib/cjs/BriefcaseConnection.d.ts +2 -2
- package/lib/cjs/BriefcaseConnection.js +2 -2
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/PerModelCategoryVisibility.d.ts.map +1 -1
- package/lib/cjs/PerModelCategoryVisibility.js +83 -81
- package/lib/cjs/PerModelCategoryVisibility.js.map +1 -1
- package/lib/cjs/SpatialViewState.d.ts.map +1 -1
- package/lib/cjs/SpatialViewState.js +3 -1
- package/lib/cjs/SpatialViewState.js.map +1 -1
- package/lib/cjs/ViewState.d.ts +32 -0
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +41 -4
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/FrustumUniforms.js.map +1 -1
- package/lib/cjs/internal/render/webgl/RenderCommands.js.map +1 -1
- package/lib/cjs/quantity-formatting/AlternateUnitLabels.d.ts +8 -0
- package/lib/cjs/quantity-formatting/AlternateUnitLabels.d.ts.map +1 -0
- package/lib/cjs/quantity-formatting/AlternateUnitLabels.js +26 -0
- package/lib/cjs/quantity-formatting/AlternateUnitLabels.js.map +1 -0
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +119 -22
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +271 -65
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.d.ts +1 -1
- package/lib/cjs/tools/PrimitiveTool.js +1 -1
- package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts +16 -1
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +52 -5
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ToolSettings.d.ts +4 -0
- package/lib/cjs/tools/ToolSettings.d.ts.map +1 -1
- package/lib/cjs/tools/ToolSettings.js +4 -0
- package/lib/cjs/tools/ToolSettings.js.map +1 -1
- package/lib/esm/BriefcaseConnection.d.ts +2 -2
- package/lib/esm/BriefcaseConnection.js +2 -2
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/PerModelCategoryVisibility.d.ts.map +1 -1
- package/lib/esm/PerModelCategoryVisibility.js +84 -82
- package/lib/esm/PerModelCategoryVisibility.js.map +1 -1
- package/lib/esm/SpatialViewState.d.ts.map +1 -1
- package/lib/esm/SpatialViewState.js +3 -1
- package/lib/esm/SpatialViewState.js.map +1 -1
- package/lib/esm/ViewState.d.ts +32 -0
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +42 -5
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/FrustumUniforms.js.map +1 -1
- package/lib/esm/internal/render/webgl/RenderCommands.js.map +1 -1
- package/lib/esm/quantity-formatting/AlternateUnitLabels.d.ts +8 -0
- package/lib/esm/quantity-formatting/AlternateUnitLabels.d.ts.map +1 -0
- package/lib/esm/quantity-formatting/AlternateUnitLabels.js +23 -0
- package/lib/esm/quantity-formatting/AlternateUnitLabels.js.map +1 -0
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +119 -22
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +269 -63
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tools/PrimitiveTool.d.ts +1 -1
- package/lib/esm/tools/PrimitiveTool.js +1 -1
- package/lib/esm/tools/PrimitiveTool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts +16 -1
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +52 -5
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ToolSettings.d.ts +4 -0
- package/lib/esm/tools/ToolSettings.d.ts.map +1 -1
- package/lib/esm/tools/ToolSettings.js +4 -0
- package/lib/esm/tools/ToolSettings.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -20
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts +0 -38
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts.map +0 -1
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.js +0 -160
- package/lib/cjs/quantity-formatting/BasicUnitsProvider.js.map +0 -1
- package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts +0 -38
- package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts.map +0 -1
- package/lib/esm/quantity-formatting/BasicUnitsProvider.js +0 -155
- package/lib/esm/quantity-formatting/BasicUnitsProvider.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
# Change Log - @itwin/core-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 04 May 2026 16:32:08 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.9.0
|
|
6
|
+
Mon, 04 May 2026 16:32:08 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- Quantity Formatter: readiness events, serialized reload queue, multi-system caching, composite-keyed registry, FormatSpecHandle, listener leak fix.
|
|
11
|
+
|
|
12
|
+
### Updates
|
|
13
|
+
|
|
14
|
+
- Improved `PerModelCategoryVisibility` performance in some cases more than 10x.
|
|
15
|
+
- QuantityFormatter now defaults to BasicUnitsProvider from @itwin/core-quantity, which provides a comprehensive unit set generated from the BIS units-schema package, replacing the previous limited internal provider.
|
|
16
|
+
- Add new ViewState.getRealityModelTreeRefs method
|
|
17
|
+
- added EditTxn apis
|
|
18
|
+
- Added async versions of Txn reverse and reinstate operations, and added support for abandoning locks when reversing Txns.
|
|
19
|
+
- Fix event listener leak in LayerTileTreeReferenceHandler
|
|
20
|
+
|
|
21
|
+
## 5.8.4
|
|
22
|
+
Thu, 23 Apr 2026 18:05:14 GMT
|
|
23
|
+
|
|
24
|
+
_Version update only_
|
|
25
|
+
|
|
26
|
+
## 5.8.3
|
|
27
|
+
Thu, 23 Apr 2026 14:52:42 GMT
|
|
28
|
+
|
|
29
|
+
_Version update only_
|
|
30
|
+
|
|
31
|
+
## 5.8.2
|
|
32
|
+
Thu, 16 Apr 2026 11:05:01 GMT
|
|
33
|
+
|
|
34
|
+
_Version update only_
|
|
4
35
|
|
|
5
36
|
## 5.8.1
|
|
6
37
|
Fri, 10 Apr 2026 13:02:00 GMT
|
|
@@ -144,11 +144,11 @@ export declare class BriefcaseConnection extends IModelConnection {
|
|
|
144
144
|
hasPendingTxns(): Promise<boolean>;
|
|
145
145
|
/** Commit pending changes to this briefcase.
|
|
146
146
|
* @param description Optional description of the changes.
|
|
147
|
-
* @deprecated Use methods on EditCommand instead.
|
|
147
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
|
|
148
148
|
*/
|
|
149
149
|
saveChanges(description?: string): Promise<void>;
|
|
150
150
|
/** Abandon pending changes to this briefcase.
|
|
151
|
-
* @deprecated Use methods on EditCommand instead.
|
|
151
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
|
|
152
152
|
*/
|
|
153
153
|
abandonChanges(): Promise<void>;
|
|
154
154
|
/** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase
|
|
@@ -248,13 +248,13 @@ class BriefcaseConnection extends IModelConnection_1.IModelConnection {
|
|
|
248
248
|
}
|
|
249
249
|
/** Commit pending changes to this briefcase.
|
|
250
250
|
* @param description Optional description of the changes.
|
|
251
|
-
* @deprecated Use methods on EditCommand instead.
|
|
251
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
|
|
252
252
|
*/
|
|
253
253
|
async saveChanges(description) {
|
|
254
254
|
await IpcApp_1.IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
255
255
|
}
|
|
256
256
|
/** Abandon pending changes to this briefcase.
|
|
257
|
-
* @deprecated Use methods on EditCommand instead.
|
|
257
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.
|
|
258
258
|
*/
|
|
259
259
|
async abandonChanges() {
|
|
260
260
|
await IpcApp_1.IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAwI;AACxI,oDAG4B;AAC5B,mDAAgD;AAChD,mEAAgE;AAChE,2CAAwC;AACxC,yDAAsD;AACtD,qCAAkC;AAClC,8CAAqE;AACrE,yCAAsC;AA8CtC;;;GAGG;AACH,MAAM,kBAAkB;IACd,aAAa,CAAyB;IAC7B,UAAU,CAAsB;IAChC,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,SAAS,GAAmB,EAAE,CAAC;IAEhD,YAAmB,SAA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AAe,EAAE,CAAC;QACvB,OAAO,eAAM,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,wBAAwB;QACnC,OAAO,eAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACa,sBAAsB,GAAG,IAAI,sBAAO,EAA0C,CAAC;CAChG;AApMD,kDAoMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64Set, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, LockState, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/**\n * Provides access to lock information in the iModel.\n * @see [[BriefcaseConnection.locks]]\n * @alpha\n */\nexport interface LockService {\n /** Get all elements with exclusive locks owned by other briefcases. */\n getExclusiveForeignLocks(): Promise<Id64Set>;\n /** Get all elements with shared locks owned by other briefcases. */\n getSharedForeignLocks(): Promise<Id64Set>;\n /** Check whether it's possible to acquire a lock for the element. */\n checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;\n}\n\n/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].\n * @alpha\n */\nexport type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n private _locks?: LockService;\n\n /** The ID of the briefcase.\n * @beta\n */\n public readonly briefcaseId?: number;\n\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n /** Information about locks held on this iModel.\n * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.\n * @alpha\n */\n public get locks(): LockService | undefined { return this._locks; }\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.briefcaseId = props.briefcaseId;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n\n this.categories.cache.attachToBriefcase(this);\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).\n * @alpha\n */\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>\n\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n if (lockServiceFactory)\n connection._locks = await lockServiceFactory(connection);\n\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n * @deprecated Use methods on EditCommand instead.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Abandon pending changes to this briefcase.\n * @deprecated Use methods on EditCommand instead.\n */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAwI;AACxI,oDAG4B;AAC5B,mDAAgD;AAChD,mEAAgE;AAChE,2CAAwC;AACxC,yDAAsD;AACtD,qCAAkC;A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AAE,OAAO,EAAE,aAAa,CAAC,CAAC;QAC7F,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,WAAW,CAAC,WAAmB;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,eAAM,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,wBAAwB;QACnC,OAAO,eAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACa,sBAAsB,GAAG,IAAI,sBAAO,EAA0C,CAAC;CAChG;AApMD,kDAoMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64Set, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps, ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, LockState, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/**\n * Provides access to lock information in the iModel.\n * @see [[BriefcaseConnection.locks]]\n * @alpha\n */\nexport interface LockService {\n /** Get all elements with exclusive locks owned by other briefcases. */\n getExclusiveForeignLocks(): Promise<Id64Set>;\n /** Get all elements with shared locks owned by other briefcases. */\n getSharedForeignLocks(): Promise<Id64Set>;\n /** Check whether it's possible to acquire a lock for the element. */\n checkElementLockAvailability(elementId: Id64String, lock: LockState): Promise<boolean>;\n}\n\n/** Function for creating a [[LockService]] for a [[BriefcaseConnection]].\n * @alpha\n */\nexport type LockServiceFactory = (iModel: BriefcaseConnection) => Promise<LockService>;\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n private _locks?: LockService;\n\n /** The ID of the briefcase.\n * @beta\n */\n public readonly briefcaseId?: number;\n\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n /** Information about locks held on this iModel.\n * @note This is intended to be used by tools and other UI elements, to provide information about the current lock state. Implementations are expected to cache lock information and so may not reflect changes to locks immediately.\n * @alpha\n */\n public get locks(): LockService | undefined { return this._locks; }\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId ?? Guid.empty; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: BriefcaseConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.briefcaseId = props.briefcaseId;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n\n this.categories.cache.attachToBriefcase(this);\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection>;\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend).\n * @alpha\n */\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection>\n\n public static async openFile(briefcaseProps: OpenBriefcaseProps, lockServiceFactory?: LockServiceFactory): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n if (lockServiceFactory)\n connection._locks = await lockServiceFactory(connection);\n\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Abandon pending changes to this briefcase.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use methods on EditCommand instead.\n */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key); // eslint-disable-line @typescript-eslint/no-deprecated\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerModelCategoryVisibility.d.ts","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"PerModelCategoryVisibility.d.ts","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;GAQG;AACH,yBAAiB,0BAA0B,CAAC;IAC1C,uEAAuE;IACvE,KAAY,QAAQ;QAClB,wIAAwI;QACxI,IAAI,IAAA;QACJ,gDAAgD;QAChD,IAAI,IAAA;QACJ,kDAAkD;QAClD,IAAI,IAAA;KACL;IAED,uFAAuF;IACvF,UAAiB,aAAa;QAC5B,2EAA2E;QAC3E,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;QAC7B,gFAAgF;QAChF,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;QAChC,mEAAmE;QACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B;IAED;;OAEG;IACH,UAAiB,SAAS;QACxB,uFAAuF;QACvF,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC;QACnE,mFAAmF;QACnF,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAC/E;;WAEG;QACH,YAAY,CAAC,0BAA0B,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5F,oGAAoG;QACpG,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QACzC,wDAAwD;QACxD,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAC;QACjD,mFAAmF;QACnF,YAAY,CAAC,EAAE,EAAE,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;KAC1F;IAED;;;MAGE;IACF,UAAiB,KAAK;QACpB,wDAAwD;QACxD,OAAO,EAAE,MAAM,CAAC;QAChB,uGAAuG;QACvG,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAClC,gEAAgE;QAChE,WAAW,EAAE,0BAA0B,CAAC,QAAQ,CAAC;KAClD;IAED,SAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,0BAA0B,CAAC,SAAS,CAExF;CACF"}
|
|
@@ -35,41 +35,77 @@ var PerModelCategoryVisibility;
|
|
|
35
35
|
}
|
|
36
36
|
PerModelCategoryVisibility.createOverrides = createOverrides;
|
|
37
37
|
})(PerModelCategoryVisibility || (exports.PerModelCategoryVisibility = PerModelCategoryVisibility = {}));
|
|
38
|
-
class PerModelCategoryVisibilityOverride {
|
|
39
|
-
modelId;
|
|
40
|
-
categoryId;
|
|
41
|
-
visible;
|
|
42
|
-
constructor(modelId, categoryId, visible) {
|
|
43
|
-
this.modelId = modelId;
|
|
44
|
-
this.categoryId = categoryId;
|
|
45
|
-
this.visible = visible;
|
|
46
|
-
}
|
|
47
|
-
reset(modelId, categoryId, visible) {
|
|
48
|
-
this.modelId = modelId;
|
|
49
|
-
this.categoryId = categoryId;
|
|
50
|
-
this.visible = visible;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function compareCategoryOverrides(lhs, rhs) {
|
|
54
|
-
const cmp = (0, core_bentley_1.compareStrings)(lhs.modelId, rhs.modelId);
|
|
55
|
-
return 0 === cmp ? (0, core_bentley_1.compareStrings)(lhs.categoryId, rhs.categoryId) : cmp;
|
|
56
|
-
}
|
|
57
38
|
/** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */
|
|
58
|
-
class PerModelCategoryVisibilityOverrides
|
|
59
|
-
|
|
39
|
+
class PerModelCategoryVisibilityOverrides {
|
|
40
|
+
_map = new Map();
|
|
41
|
+
/** Flat set of all override entries, providing O(1) iteration via [Symbol.iterator]. Kept in sync with `_map`. */
|
|
42
|
+
_set = new Set();
|
|
60
43
|
_vp;
|
|
61
44
|
constructor(vp) {
|
|
62
|
-
super(compareCategoryOverrides);
|
|
63
45
|
this._vp = vp;
|
|
64
46
|
}
|
|
47
|
+
[Symbol.iterator]() {
|
|
48
|
+
return this._set[Symbol.iterator]();
|
|
49
|
+
}
|
|
65
50
|
getOverride(modelId, categoryId) {
|
|
66
|
-
this.
|
|
67
|
-
const ovr = this.findEqual(this._scratch);
|
|
51
|
+
const ovr = this._map.get(modelId)?.get(categoryId);
|
|
68
52
|
if (undefined !== ovr)
|
|
69
53
|
return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;
|
|
70
54
|
else
|
|
71
55
|
return PerModelCategoryVisibility.Override.None;
|
|
72
56
|
}
|
|
57
|
+
getModelEntry({ modelId, override }) {
|
|
58
|
+
let modelEntry = this._map.get(modelId);
|
|
59
|
+
if (modelEntry) {
|
|
60
|
+
return modelEntry;
|
|
61
|
+
}
|
|
62
|
+
if (override === PerModelCategoryVisibility.Override.None) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
modelEntry = new Map();
|
|
66
|
+
this._map.set(modelId, modelEntry);
|
|
67
|
+
return modelEntry;
|
|
68
|
+
}
|
|
69
|
+
addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override }) {
|
|
70
|
+
const overrideEntry = modelEntry.get(categoryId);
|
|
71
|
+
if (override === PerModelCategoryVisibility.Override.None) {
|
|
72
|
+
if (overrideEntry === undefined) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
this._set.delete(overrideEntry);
|
|
76
|
+
modelEntry.delete(categoryId);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
const visible = override === PerModelCategoryVisibility.Override.Show;
|
|
80
|
+
if (overrideEntry === undefined) {
|
|
81
|
+
const ovr = { modelId, categoryId, visible };
|
|
82
|
+
modelEntry.set(categoryId, ovr);
|
|
83
|
+
this._set.add(ovr);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (overrideEntry.visible !== visible) {
|
|
87
|
+
overrideEntry.visible = visible;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
applyOverride(modelId, categoryIds, override, catIdsToLoad) {
|
|
93
|
+
const modelEntry = this.getModelEntry({ modelId, override });
|
|
94
|
+
let changed = false;
|
|
95
|
+
if (!modelEntry)
|
|
96
|
+
return changed;
|
|
97
|
+
for (const categoryId of categoryIds) {
|
|
98
|
+
if (this.addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override })) {
|
|
99
|
+
changed = true;
|
|
100
|
+
if (catIdsToLoad && override !== PerModelCategoryVisibility.Override.None)
|
|
101
|
+
catIdsToLoad.push(categoryId);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (modelEntry.size === 0) {
|
|
105
|
+
this._map.delete(modelId);
|
|
106
|
+
}
|
|
107
|
+
return changed;
|
|
108
|
+
}
|
|
73
109
|
/**
|
|
74
110
|
* set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.
|
|
75
111
|
* @see [[PerModelCategoryVisibility]]
|
|
@@ -84,19 +120,11 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
84
120
|
const catIdsToLoad = [];
|
|
85
121
|
const iModelToUse = iModel ? iModel : this._vp.iModel;
|
|
86
122
|
for (const override of perModelCategoryVisibility) {
|
|
87
|
-
const modelId = override.modelId;
|
|
88
123
|
// The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate
|
|
89
124
|
// over each individual character of that string, which is not the desired behavior.
|
|
90
125
|
const categoryIds = typeof override.categoryIds === "string" ? [override.categoryIds] : override.categoryIds;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (this.findAndUpdateOverrideInArray(modelId, categoryId, visOverride)) {
|
|
94
|
-
anyChanged = true;
|
|
95
|
-
if (PerModelCategoryVisibility.Override.None !== visOverride) {
|
|
96
|
-
catIdsToLoad.push(categoryId);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
126
|
+
if (this.applyOverride(override.modelId, categoryIds, override.visOverride, catIdsToLoad))
|
|
127
|
+
anyChanged = true;
|
|
100
128
|
}
|
|
101
129
|
if (anyChanged) {
|
|
102
130
|
this._vp.setViewedCategoriesPerModelChanged();
|
|
@@ -104,44 +132,17 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
104
132
|
this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());
|
|
105
133
|
}
|
|
106
134
|
}
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
/** Find and update the override in the array of overrides. If override not found, adds it to the array.
|
|
110
|
-
* If the array was changed, returns true. */
|
|
111
|
-
findAndUpdateOverrideInArray(modelId, categoryId, override) {
|
|
112
|
-
const ovr = this._scratch;
|
|
113
|
-
ovr.reset(modelId, categoryId, false);
|
|
114
|
-
let changed = false;
|
|
115
|
-
const index = this.indexOf(ovr);
|
|
116
|
-
if (-1 === index) {
|
|
117
|
-
if (PerModelCategoryVisibility.Override.None !== override) {
|
|
118
|
-
this.insert(new PerModelCategoryVisibilityOverride(modelId, categoryId, PerModelCategoryVisibility.Override.Show === override));
|
|
119
|
-
changed = true;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
if (PerModelCategoryVisibility.Override.None === override) {
|
|
124
|
-
this._array.splice(index, 1);
|
|
125
|
-
changed = true;
|
|
126
|
-
}
|
|
127
|
-
else if (this._array[index].visible !== (PerModelCategoryVisibility.Override.Show === override)) {
|
|
128
|
-
this._array[index].visible = (PerModelCategoryVisibility.Override.Show === override);
|
|
129
|
-
changed = true;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return changed;
|
|
133
135
|
}
|
|
134
136
|
setOverride(modelIds, categoryIds, override) {
|
|
137
|
+
const categoryIdIterable = core_bentley_1.Id64.iterable(categoryIds);
|
|
135
138
|
let changed = false;
|
|
136
139
|
for (const modelId of core_bentley_1.Id64.iterable(modelIds)) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
changed = true;
|
|
140
|
-
}
|
|
140
|
+
if (this.applyOverride(modelId, categoryIdIterable, override))
|
|
141
|
+
changed = true;
|
|
141
142
|
}
|
|
142
143
|
if (changed) {
|
|
143
144
|
this._vp.setViewedCategoriesPerModelChanged();
|
|
144
|
-
if (PerModelCategoryVisibility.Override.None
|
|
145
|
+
if (override !== PerModelCategoryVisibility.Override.None) {
|
|
145
146
|
// Ensure subcategories loaded.
|
|
146
147
|
this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());
|
|
147
148
|
}
|
|
@@ -149,30 +150,32 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
149
150
|
}
|
|
150
151
|
clearOverrides(modelIds) {
|
|
151
152
|
if (undefined === modelIds) {
|
|
152
|
-
if (
|
|
153
|
-
this.clear();
|
|
153
|
+
if (this._map.size > 0) {
|
|
154
|
+
this._map.clear();
|
|
155
|
+
this._set.clear();
|
|
154
156
|
this._vp.setViewedCategoriesPerModelChanged();
|
|
155
157
|
}
|
|
156
158
|
return;
|
|
157
159
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
160
|
+
let changed = false;
|
|
161
|
+
for (const modelId of core_bentley_1.Id64.iterable(modelIds)) {
|
|
162
|
+
const modelEntry = this._map.get(modelId);
|
|
163
|
+
if (!modelEntry) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
changed = true;
|
|
167
|
+
for (const overrideEntry of modelEntry.values()) {
|
|
168
|
+
this._set.delete(overrideEntry);
|
|
168
169
|
}
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
this._map.delete(modelId);
|
|
171
|
+
}
|
|
172
|
+
if (changed) {
|
|
173
|
+
this._vp.setViewedCategoriesPerModelChanged();
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
addOverrides(fs, ovrs) {
|
|
174
177
|
const cache = this._vp.iModel.subcategories;
|
|
175
|
-
for (const ovr of this.
|
|
178
|
+
for (const ovr of this._set) {
|
|
176
179
|
const subcats = cache.getSubCategories(ovr.categoryId);
|
|
177
180
|
if (undefined === subcats)
|
|
178
181
|
continue;
|
|
@@ -182,7 +185,6 @@ class PerModelCategoryVisibilityOverrides extends core_bentley_1.SortedArray {
|
|
|
182
185
|
/* if (!this._vp.view.viewsModel(ovr.modelId))
|
|
183
186
|
continue; */
|
|
184
187
|
// ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.
|
|
185
|
-
// (Array is sorted first by modelId).
|
|
186
188
|
// Also avoid computing if no effective overrides.
|
|
187
189
|
const modelLo = core_bentley_1.Id64.getLowerUint32(ovr.modelId);
|
|
188
190
|
const modelHi = core_bentley_1.Id64.getUpperUint32(ovr.modelId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerModelCategoryVisibility.js","sourceRoot":"","sources":["../../src/PerModel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AK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACvD,IAAI,SAAS,KAAK,OAAO;gBACvB,SAAS;YAEX,4HAA4H;YAC5H,4HAA4H;YAC5H,gCAAgC;YAChC;0BACc;YAEd,sFAAsF;YACtF,sCAAsC;YACtC,kDAAkD;YAClD,MAAM,OAAO,GAAG,mBAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,OAAO,GAAG,mBAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAEjD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,mBAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC7C,MAAM,QAAQ,GAAG,mBAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC7C,MAAM,GAAG,GAAG,EAAE,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACxD,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;oBACxB,oEAAoE;oBACpE,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBACvC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;wBACxB,KAAK,GAAG,IAAI,mBAAI,CAAC,SAAS,EAAE,CAAC;wBAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;oBACpC,CAAC;oBAED,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { compareStrings, Id64, Id64Arg, Id64String, SortedArray } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\nimport { Viewport } from \"./Viewport\";\n\n/** Per-model category visibility permits the visibility of categories within a [[Viewport]] displaying a [[SpatialViewState]] to be overridden in\n * the context of individual [[GeometricModelState]]s.\n * If a category's visibility is overridden for a given model, then elements belonging to that category within that model will be displayed or hidden regardless of the category's inclusion in the Viewport's [[CategorySelectorState]].\n * The override affects geometry on all subcategories belonging to the overridden category. That is, if the category is overridden to be visible, then geometry on all subcategories of the category\n * will be visible, regardless of any [SubCategoryOverride]($common)s applied by the view's [[DisplayStyleState]].\n * @see [[Viewport.perModelCategoryVisibility]] to define the per-model category visibility for a viewport.\n * @public\n * @extensions\n */\nexport namespace PerModelCategoryVisibility {\n /** Describes whether and how a category's visibility is overridden. */\n export enum Override {\n /** The category's visibility is not overridden; its visibility is wholly controlled by the [[Viewport]]'s [[CategorySelectorState]]. */\n None,\n /** The category is overridden to be visible. */\n Show,\n /** The category is overridden to be invisible. */\n Hide,\n }\n\n /** Describes one visibility override in a [[PerModelCategoryVisibility.Overrides]]. */\n export interface OverrideEntry {\n /** The Id of the [[GeometricModelState]] in which the override applies. */\n readonly modelId: Id64String;\n /** The Id of the [SpatialCategory]($backend) whose visibility is overridden. */\n readonly categoryId: Id64String;\n /** Whether the category is visible in the context of the model. */\n readonly visible: boolean;\n }\n\n /** Describes a set of per-model category visibility overrides. Changes to these overrides invoke the [[Viewport.onViewedCategoriesPerModelChanged]] event.\n * @see [[Viewport.perModelCategoryVisibility]].\n */\n export interface Overrides {\n /** Returns the override state of the specified category within the specified model. */\n getOverride(modelId: Id64String, categoryId: Id64String): Override;\n /** Changes the override state of one or more categories for one or more models. */\n setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: Override): void;\n /** Changes multiple overrides, given an array of overrides *\n * @beta\n */\n setOverrides(perModelCategoryVisibility: Props[], iModel?: IModelConnection): Promise<void>;\n /** Removes all overrides for the specified models, or for all models if `modelIds` is undefined. */\n clearOverrides(modelIds?: Id64Arg): void;\n /** An iterator over all of the visibility overrides. */\n [Symbol.iterator]: () => Iterator<OverrideEntry>;\n /** Populate the symbology overrides based on the per-model category visibility. */\n addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void;\n }\n\n /** Describes a set of [[PerModelCategoryVisibility.Overrides]].\n * @see [[PerModelCategoryVisibility.Overrides.setOverrides]].\n * @beta\n */\n export interface Props {\n /** The id of the model to which the overrides apply. */\n modelId: string;\n /** The ids of the categories whose visibility are to be overridden within the context of the model. */\n categoryIds: Iterable<Id64String>;\n /** The visibility to be applied to the specified categories. */\n visOverride: PerModelCategoryVisibility.Override;\n }\n\n export function createOverrides(viewport: Viewport): PerModelCategoryVisibility.Overrides {\n return new PerModelCategoryVisibilityOverrides(viewport);\n }\n}\n\nclass PerModelCategoryVisibilityOverride {\n public modelId: Id64String;\n public categoryId: Id64String;\n public visible: boolean;\n\n public constructor(modelId: Id64String, categoryId: Id64String, visible: boolean) {\n this.modelId = modelId;\n this.categoryId = categoryId;\n this.visible = visible;\n }\n\n public reset(modelId: Id64String, categoryId: Id64String, visible: boolean): void {\n this.modelId = modelId;\n this.categoryId = categoryId;\n this.visible = visible;\n }\n}\n\nfunction compareCategoryOverrides(lhs: PerModelCategoryVisibilityOverride, rhs: PerModelCategoryVisibilityOverride): number {\n const cmp = compareStrings(lhs.modelId, rhs.modelId);\n return 0 === cmp ? compareStrings(lhs.categoryId, rhs.categoryId) : cmp;\n}\n\n/** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */\nclass PerModelCategoryVisibilityOverrides extends SortedArray<PerModelCategoryVisibilityOverride> implements PerModelCategoryVisibility.Overrides {\n private readonly _scratch = new PerModelCategoryVisibilityOverride(\"0\", \"0\", false);\n private readonly _vp: Viewport;\n\n public constructor(vp: Viewport) {\n super(compareCategoryOverrides);\n this._vp = vp;\n }\n\n public getOverride(modelId: Id64String, categoryId: Id64String): PerModelCategoryVisibility.Override {\n this._scratch.reset(modelId, categoryId, false);\n const ovr = this.findEqual(this._scratch);\n if (undefined !== ovr)\n return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;\n else\n return PerModelCategoryVisibility.Override.None;\n }\n\n /**\n * set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.\n * @see [[PerModelCategoryVisibility]]\n * @param perModelCategoryVisibility array of model category visibility overrides @see [[PerModelCategoryVisibility.Props]]\n * @param iModel Optional param iModel. If no iModel is provided, then the iModel associated with the viewport (used to construct this class) is used.\n * This optional iModel param is useful for apps which may show multiple iModels at once. Passing in an iModel ensures that the subcategories cache for the provided iModel\n * is populated as opposed to the iModel associated with the viewport which may or may not be an empty iModel.\n * @returns a promise that resolves once the overrides have been applied.\n */\n public async setOverrides(perModelCategoryVisibility: PerModelCategoryVisibility.Props[], iModel?: IModelConnection): Promise<void> {\n let anyChanged = false;\n const catIdsToLoad: string[] = [];\n const iModelToUse = iModel ? iModel : this._vp.iModel;\n for (const override of perModelCategoryVisibility) {\n const modelId = override.modelId;\n // The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate\n // over each individual character of that string, which is not the desired behavior.\n const categoryIds = typeof override.categoryIds === \"string\" ? [override.categoryIds] : override.categoryIds;\n const visOverride = override.visOverride;\n for (const categoryId of categoryIds) {\n if (this.findAndUpdateOverrideInArray(modelId, categoryId, visOverride)) {\n anyChanged = true;\n if (PerModelCategoryVisibility.Override.None !== visOverride) {\n catIdsToLoad.push(categoryId);\n }\n }\n }\n }\n if (anyChanged) {\n this._vp.setViewedCategoriesPerModelChanged();\n if (catIdsToLoad.length !== 0) {\n this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n return;\n }\n\n /** Find and update the override in the array of overrides. If override not found, adds it to the array.\n * If the array was changed, returns true. */\n private findAndUpdateOverrideInArray(modelId: Id64String, categoryId: Id64String, override: PerModelCategoryVisibility.Override): boolean {\n const ovr = this._scratch;\n ovr.reset(modelId, categoryId, false);\n let changed = false;\n const index = this.indexOf(ovr);\n if (-1 === index) {\n if (PerModelCategoryVisibility.Override.None !== override) {\n this.insert(new PerModelCategoryVisibilityOverride(modelId, categoryId, PerModelCategoryVisibility.Override.Show === override));\n changed = true;\n }\n } else {\n if (PerModelCategoryVisibility.Override.None === override) {\n this._array.splice(index, 1);\n changed = true;\n } else if (this._array[index].visible !== (PerModelCategoryVisibility.Override.Show === override)) {\n this._array[index].visible = (PerModelCategoryVisibility.Override.Show === override);\n changed = true;\n }\n }\n return changed;\n }\n\n public setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: PerModelCategoryVisibility.Override): void {\n let changed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n for (const categoryId of Id64.iterable(categoryIds)) {\n if (this.findAndUpdateOverrideInArray(modelId, categoryId, override))\n changed = true;\n }\n }\n\n if (changed) {\n this._vp.setViewedCategoriesPerModelChanged();\n\n if (PerModelCategoryVisibility.Override.None !== override) {\n // Ensure subcategories loaded.\n this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n }\n\n public clearOverrides(modelIds?: Id64Arg): void {\n if (undefined === modelIds) {\n if (0 < this.length) {\n this.clear();\n this._vp.setViewedCategoriesPerModelChanged();\n }\n\n return;\n }\n\n for (let i = 0; i < this.length;) {\n const ovr = this._array[i];\n let removed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n if (modelId === ovr.modelId) {\n this._array.splice(i, 1);\n this._vp.setViewedCategoriesPerModelChanged();\n removed = true;\n break;\n }\n }\n\n if (!removed)\n ++i;\n }\n }\n\n public addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void {\n const cache = this._vp.iModel.subcategories;\n\n for (const ovr of this._array) {\n const subcats = cache.getSubCategories(ovr.categoryId);\n if (undefined === subcats)\n continue;\n\n // It's pointless to override for models which aren't displayed...except if we do this, and then someone enables that model,\n // we would need to regenerate our symbology overrides in response. Preferably people wouldn't bother overriding models that\n // they don't want us to draw...\n /* if (!this._vp.view.viewsModel(ovr.modelId))\n continue; */\n\n // ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.\n // (Array is sorted first by modelId).\n // Also avoid computing if no effective overrides.\n const modelLo = Id64.getLowerUint32(ovr.modelId);\n const modelHi = Id64.getUpperUint32(ovr.modelId);\n\n for (const subcat of subcats) {\n const subcatLo = Id64.getLowerUint32(subcat);\n const subcatHi = Id64.getUpperUint32(subcat);\n const vis = fs.isSubCategoryVisible(subcatLo, subcatHi);\n if (vis !== ovr.visible) {\n // Only care if visibility differs from that defined for entire view\n let entry = ovrs.get(modelLo, modelHi);\n if (undefined === entry) {\n entry = new Id64.Uint32Set();\n ovrs.set(modelLo, modelHi, entry);\n }\n\n entry.add(subcatLo, subcatHi);\n }\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PerModelCategoryVisibility.js","sourceRoot":"","sources":["../../src/PerModelCategoryVisibility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgE;AAKhE;;;;;;;;GAQG;AACH,IAAiB,0BAA0B,CAyD1C;AAzDD,WAAiB,0BAA0B;IACzC,uEAAuE;IACvE,IAAY,QAOX;IAPD,WAAY,QAAQ;QAClB,wIAAwI;QACxI,uCAAI,CAAA;QACJ,gDAAgD;QAChD,uCAAI,CAAA;QACJ,kDAAkD;QAClD,uCAAI,CAAA;IACN,CAAC,EAPW,QAAQ,GAAR,mCAAQ,KAAR,mCAAQ,QAOnB;IA6CD,SAAgB,eAAe,CAAC,QAAkB;QAChD,OAAO,IAAI,mCAAmC,CAA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AAO,CAAC,CAAC;YAEjD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,mBAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC7C,MAAM,QAAQ,GAAG,mBAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBAC7C,MAAM,GAAG,GAAG,EAAE,CAAC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACxD,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;oBACxB,oEAAoE;oBACpE,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBACvC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;wBACxB,KAAK,GAAG,IAAI,mBAAI,CAAC,SAAS,EAAE,CAAC;wBAC7B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;oBACpC,CAAC;oBAED,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { Id64, Id64Arg, Id64String } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\nimport { Viewport } from \"./Viewport\";\n\n/** Per-model category visibility permits the visibility of categories within a [[Viewport]] displaying a [[SpatialViewState]] to be overridden in\n * the context of individual [[GeometricModelState]]s.\n * If a category's visibility is overridden for a given model, then elements belonging to that category within that model will be displayed or hidden regardless of the category's inclusion in the Viewport's [[CategorySelectorState]].\n * The override affects geometry on all subcategories belonging to the overridden category. That is, if the category is overridden to be visible, then geometry on all subcategories of the category\n * will be visible, regardless of any [SubCategoryOverride]($common)s applied by the view's [[DisplayStyleState]].\n * @see [[Viewport.perModelCategoryVisibility]] to define the per-model category visibility for a viewport.\n * @public\n * @extensions\n */\nexport namespace PerModelCategoryVisibility {\n /** Describes whether and how a category's visibility is overridden. */\n export enum Override {\n /** The category's visibility is not overridden; its visibility is wholly controlled by the [[Viewport]]'s [[CategorySelectorState]]. */\n None,\n /** The category is overridden to be visible. */\n Show,\n /** The category is overridden to be invisible. */\n Hide,\n }\n\n /** Describes one visibility override in a [[PerModelCategoryVisibility.Overrides]]. */\n export interface OverrideEntry {\n /** The Id of the [[GeometricModelState]] in which the override applies. */\n readonly modelId: Id64String;\n /** The Id of the [SpatialCategory]($backend) whose visibility is overridden. */\n readonly categoryId: Id64String;\n /** Whether the category is visible in the context of the model. */\n readonly visible: boolean;\n }\n\n /** Describes a set of per-model category visibility overrides. Changes to these overrides invoke the [[Viewport.onViewedCategoriesPerModelChanged]] event.\n * @see [[Viewport.perModelCategoryVisibility]].\n */\n export interface Overrides {\n /** Returns the override state of the specified category within the specified model. */\n getOverride(modelId: Id64String, categoryId: Id64String): Override;\n /** Changes the override state of one or more categories for one or more models. */\n setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: Override): void;\n /** Changes multiple overrides, given an array of overrides *\n * @beta\n */\n setOverrides(perModelCategoryVisibility: Props[], iModel?: IModelConnection): Promise<void>;\n /** Removes all overrides for the specified models, or for all models if `modelIds` is undefined. */\n clearOverrides(modelIds?: Id64Arg): void;\n /** An iterator over all of the visibility overrides. */\n [Symbol.iterator]: () => Iterator<OverrideEntry>;\n /** Populate the symbology overrides based on the per-model category visibility. */\n addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void;\n }\n\n /** Describes a set of [[PerModelCategoryVisibility.Overrides]].\n * @see [[PerModelCategoryVisibility.Overrides.setOverrides]].\n * @beta\n */\n export interface Props {\n /** The id of the model to which the overrides apply. */\n modelId: string;\n /** The ids of the categories whose visibility are to be overridden within the context of the model. */\n categoryIds: Iterable<Id64String>;\n /** The visibility to be applied to the specified categories. */\n visOverride: PerModelCategoryVisibility.Override;\n }\n\n export function createOverrides(viewport: Viewport): PerModelCategoryVisibility.Overrides {\n return new PerModelCategoryVisibilityOverrides(viewport);\n }\n}\ntype Writeable<T extends object> = { -readonly [P in keyof T]: T[P] };\ntype WriteableOverrideEntry = Writeable<PerModelCategoryVisibility.OverrideEntry>;\n\ntype ModelEntry = Map<Id64String, WriteableOverrideEntry>;\n\n/** The Viewport-specific implementation of PerModelCategoryVisibility.Overrides. */\nclass PerModelCategoryVisibilityOverrides implements PerModelCategoryVisibility.Overrides {\n private readonly _map = new Map<Id64String, ModelEntry>();\n /** Flat set of all override entries, providing O(1) iteration via [Symbol.iterator]. Kept in sync with `_map`. */\n private readonly _set = new Set<WriteableOverrideEntry>();\n private readonly _vp: Viewport;\n\n public constructor(vp: Viewport) {\n this._vp = vp;\n }\n\n\n public [Symbol.iterator](): Iterator<PerModelCategoryVisibility.OverrideEntry> {\n return this._set[Symbol.iterator]();\n }\n\n public getOverride(modelId: Id64String, categoryId: Id64String): PerModelCategoryVisibility.Override {\n const ovr = this._map.get(modelId)?.get(categoryId);\n if (undefined !== ovr)\n return ovr.visible ? PerModelCategoryVisibility.Override.Show : PerModelCategoryVisibility.Override.Hide;\n else\n return PerModelCategoryVisibility.Override.None;\n }\n\n private getModelEntry({ modelId, override }: { modelId: Id64String; override: PerModelCategoryVisibility.Override }): ModelEntry | undefined {\n let modelEntry = this._map.get(modelId);\n if (modelEntry) {\n return modelEntry;\n }\n if (override === PerModelCategoryVisibility.Override.None) {\n return undefined;\n }\n modelEntry = new Map<Id64String, WriteableOverrideEntry>();\n this._map.set(modelId, modelEntry);\n return modelEntry;\n }\n\n private addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override }: { modelEntry: ModelEntry; categoryId: Id64String; modelId: Id64String; override: PerModelCategoryVisibility.Override }): boolean {\n const overrideEntry = modelEntry.get(categoryId);\n if (override === PerModelCategoryVisibility.Override.None) {\n if (overrideEntry === undefined) {\n return false;\n }\n\n this._set.delete(overrideEntry);\n modelEntry.delete(categoryId);\n return true;\n }\n const visible = override === PerModelCategoryVisibility.Override.Show;\n if (overrideEntry === undefined) {\n const ovr: WriteableOverrideEntry = { modelId, categoryId, visible };\n modelEntry.set(categoryId, ovr);\n this._set.add(ovr);\n return true;\n }\n if (overrideEntry.visible !== visible) {\n overrideEntry.visible = visible;\n return true;\n }\n return false;\n }\n\n private applyOverride(modelId: Id64String, categoryIds: Iterable<Id64String>, override: PerModelCategoryVisibility.Override, catIdsToLoad?: string[]): boolean {\n const modelEntry = this.getModelEntry({ modelId, override });\n let changed = false;\n if (!modelEntry)\n return changed;\n\n for (const categoryId of categoryIds) {\n if (this.addOrRemoveOverrideEntry({ modelEntry, categoryId, modelId, override })) {\n changed = true;\n if (catIdsToLoad && override !== PerModelCategoryVisibility.Override.None)\n catIdsToLoad.push(categoryId);\n }\n }\n if (modelEntry.size === 0) {\n this._map.delete(modelId);\n }\n return changed;\n }\n\n /**\n * set the overrides for multiple perModelCategoryVisibility props, loading categoryIds from the iModel if necessary.\n * @see [[PerModelCategoryVisibility]]\n * @param perModelCategoryVisibility array of model category visibility overrides @see [[PerModelCategoryVisibility.Props]]\n * @param iModel Optional param iModel. If no iModel is provided, then the iModel associated with the viewport (used to construct this class) is used.\n * This optional iModel param is useful for apps which may show multiple iModels at once. Passing in an iModel ensures that the subcategories cache for the provided iModel\n * is populated as opposed to the iModel associated with the viewport which may or may not be an empty iModel.\n * @returns a promise that resolves once the overrides have been applied.\n */\n public async setOverrides(perModelCategoryVisibility: PerModelCategoryVisibility.Props[], iModel?: IModelConnection): Promise<void> {\n let anyChanged = false;\n const catIdsToLoad: string[] = [];\n const iModelToUse = iModel ? iModel : this._vp.iModel;\n for (const override of perModelCategoryVisibility) {\n // The caller may pass a single categoryId as a string, if we don't convert this to an array we will iterate\n // over each individual character of that string, which is not the desired behavior.\n const categoryIds = typeof override.categoryIds === \"string\" ? [override.categoryIds] : override.categoryIds;\n if (this.applyOverride(override.modelId, categoryIds, override.visOverride, catIdsToLoad))\n anyChanged = true;\n }\n if (anyChanged) {\n this._vp.setViewedCategoriesPerModelChanged();\n if (catIdsToLoad.length !== 0) {\n this._vp.subcategories.push(iModelToUse.subcategories, catIdsToLoad, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n }\n\n public setOverride(modelIds: Id64Arg, categoryIds: Id64Arg, override: PerModelCategoryVisibility.Override): void {\n const categoryIdIterable = Id64.iterable(categoryIds);\n let changed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n if (this.applyOverride(modelId, categoryIdIterable, override))\n changed = true;\n }\n\n if (changed) {\n this._vp.setViewedCategoriesPerModelChanged();\n\n if (override !== PerModelCategoryVisibility.Override.None) {\n // Ensure subcategories loaded.\n this._vp.subcategories.push(this._vp.iModel.subcategories, categoryIds, () => this._vp.setViewedCategoriesPerModelChanged());\n }\n }\n }\n\n public clearOverrides(modelIds?: Id64Arg): void {\n if (undefined === modelIds) {\n if (this._map.size > 0) {\n this._map.clear();\n this._set.clear();\n this._vp.setViewedCategoriesPerModelChanged();\n }\n return;\n }\n\n let changed = false;\n for (const modelId of Id64.iterable(modelIds)) {\n const modelEntry = this._map.get(modelId);\n if (!modelEntry) {\n continue;\n }\n changed = true;\n for (const overrideEntry of modelEntry.values()) {\n this._set.delete(overrideEntry);\n }\n this._map.delete(modelId);\n }\n if (changed) {\n this._vp.setViewedCategoriesPerModelChanged();\n }\n }\n\n public addOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map<Id64.Uint32Set>): void {\n const cache = this._vp.iModel.subcategories;\n\n for (const ovr of this._set) {\n const subcats = cache.getSubCategories(ovr.categoryId);\n if (undefined === subcats)\n continue;\n\n // It's pointless to override for models which aren't displayed...except if we do this, and then someone enables that model,\n // we would need to regenerate our symbology overrides in response. Preferably people wouldn't bother overriding models that\n // they don't want us to draw...\n /* if (!this._vp.view.viewsModel(ovr.modelId))\n continue; */\n\n // ###TODO: Avoid recomputing upper and lower portions of modelId if modelId repeated.\n // Also avoid computing if no effective overrides.\n const modelLo = Id64.getLowerUint32(ovr.modelId);\n const modelHi = Id64.getUpperUint32(ovr.modelId);\n\n for (const subcat of subcats) {\n const subcatLo = Id64.getLowerUint32(subcat);\n const subcatHi = Id64.getUpperUint32(subcat);\n const vis = fs.isSubCategoryVisible(subcatLo, subcatHi);\n if (vis !== ovr.visible) {\n // Only care if visibility differs from that defined for entire view\n let entry = ovrs.get(modelLo, modelHi);\n if (undefined === entry) {\n entry = new Id64.Uint32Set();\n ovrs.set(modelLo, modelHi, entry);\n }\n\n entry.add(subcatLo, subcatHi);\n }\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpatialViewState.d.ts","sourceRoot":"","sources":["../../src/SpatialViewState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAoC,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACjH,OAAO,EAAY,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/J,OAAO,EAA8B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAyB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,O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|
134
|
-
val.
|
|
134
|
+
val.modelSelector = { id: this.modelSelector.id };
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
136
|
+
val.modelSelectorId = this.modelSelector.id; // for backward compatibility
|
|
135
137
|
return val;
|
|
136
138
|
}
|
|
137
139
|
/** @internal */
|