@itwin/core-frontend 5.0.0-dev.22 → 5.0.0-dev.23
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/lib/cjs/GraphicalEditingScope.js +1 -1
- package/lib/cjs/GraphicalEditingScope.js.map +1 -1
- package/lib/cjs/SelectionSet.d.ts +84 -35
- package/lib/cjs/SelectionSet.d.ts.map +1 -1
- package/lib/cjs/SelectionSet.js +430 -166
- package/lib/cjs/SelectionSet.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +8 -8
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/cjs/tools/ElementSetTool.d.ts.map +1 -1
- package/lib/cjs/tools/ElementSetTool.js +11 -4
- package/lib/cjs/tools/ElementSetTool.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +3 -3
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/cjs/tools/SelectTool.js +2 -2
- package/lib/cjs/tools/SelectTool.js.map +1 -1
- package/lib/esm/GraphicalEditingScope.js +1 -1
- package/lib/esm/GraphicalEditingScope.js.map +1 -1
- package/lib/esm/SelectionSet.d.ts +84 -35
- package/lib/esm/SelectionSet.d.ts.map +1 -1
- package/lib/esm/SelectionSet.js +429 -165
- package/lib/esm/SelectionSet.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +8 -8
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/ElementSetTool.d.ts.map +1 -1
- package/lib/esm/tools/ElementSetTool.js +11 -4
- package/lib/esm/tools/ElementSetTool.js.map +1 -1
- package/lib/esm/tools/MeasureTool.js +3 -3
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/esm/tools/SelectTool.js +2 -2
- package/lib/esm/tools/SelectTool.js.map +1 -1
- package/lib/public/locales/en/CoreTools.json +1 -0
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +17 -17
|
@@ -168,7 +168,7 @@ class GraphicalEditingScope extends BriefcaseTxns_1.BriefcaseNotificationHandler
|
|
|
168
168
|
}
|
|
169
169
|
if (deletedIds) {
|
|
170
170
|
this.iModel.selectionSet.remove(deletedIds);
|
|
171
|
-
this.iModel.hilited.
|
|
171
|
+
this.iModel.hilited.remove({ elements: deletedIds });
|
|
172
172
|
}
|
|
173
173
|
this.onGeometryChanges.raiseEvent(changes, this);
|
|
174
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicalEditingScope.js","sourceRoot":"","sources":["../../src/GraphicalEditingScope.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+I;AAE/I,oDAE4B;AAC5B,mDAA+D;AAE/D,qCAAkC;AAElC,MAAM,YAAa,SAAQ,0BAAkC;IAI3D,YAAmB,YAAwB,EAAE,KAAc;QACzD,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAA,6BAAc,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,8BAAe,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,qBAAsB,SAAQ,4CAA4B;IACrE,IAAW,oBAAoB,KAAK,OAAO,4BAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IA8BzE;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAA2B;QACnD,IAAI,MAAM,CAAC,YAAY;YACrB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QAEvF,gIAAgI;QAChI,MAAM,KAAK,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC;YACH,MAAM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AAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;;AA3JH,sDA4JC;AAjJC;;GAEG;AACoB,6BAAO,GAAG,IAAI,sBAAO,EAA0C,AAAxD,CAAyD","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 IModelConnection\r\n */\r\n\r\nimport { assert, BeEvent, compareStrings, DbOpcode, DuplicatePolicy, GuidString, Id64Set, Id64String, SortedArray } from \"@itwin/core-bentley\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport {\r\n EditingScopeNotifications, ElementGeometryChange, ipcAppChannels, ModelGeometryChanges, ModelGeometryChangesProps, RemoveFunction,\r\n} from \"@itwin/core-common\";\r\nimport { BriefcaseNotificationHandler } from \"./BriefcaseTxns\";\r\nimport { BriefcaseConnection } from \"./BriefcaseConnection\";\r\nimport { IpcApp } from \"./IpcApp\";\r\n\r\nclass ModelChanges extends SortedArray<ElementGeometryChange> {\r\n public geometryGuid: GuidString;\r\n public readonly range: Range3d;\r\n\r\n public constructor(geometryGuid: GuidString, range: Range3d) {\r\n super((lhs, rhs) => compareStrings(lhs.id, rhs.id), DuplicatePolicy.Replace);\r\n this.geometryGuid = geometryGuid;\r\n this.range = range;\r\n }\r\n}\r\n\r\n/** Represents a period of time within an [interactive editing]($docs/learning/InteractiveEditing.md) session during which the\r\n * geometry of elements being displayed in one or more [[Viewport]]s is being modified. Outside of such a scope, whenever the\r\n * geometry within a [GeometricModel]($backend) changes new [[Tile]]s must be generated to reflect those changes in a viewport.\r\n * Regenerating entire tiles each time individual elements change can be time-consuming, which may introduce an unacceptable delay\r\n * between making a modification and seeing its result on the screen.\r\n *\r\n * Within the context of a graphical editing scope, no new tiles are generated. Instead, the geometry for any deleted or modified elements\r\n * is hidden in the tile graphics, and additional temporary graphics are displayed for any newly-inserted or modified elements. Only when the\r\n * scope exits are new tiles produced.\r\n *\r\n * The application decides when to enter and exit a graphical editing scope. A single interactive editing session may involve any number of\r\n * editing scopes. Typically, applications will enter a new editing scope (after first exiting a previous scope, if one exists):\r\n * - When switching from a non-graphical workflow to one that involves editing geometry; or\r\n * - When changing which geometric model is being edited; or\r\n * - After performing an operation that creates or modifies a \"large\" number (perhaps hundreds?) of elements.\r\n *\r\n * An application should typically exit any graphical editing scope before:\r\n * - Pulling changesets; or\r\n * - Switching from a graphical editing workflow to some non-graphical workflow.\r\n *\r\n * Graphical editing scopes are only supported for [[BriefcaseConnection]]s opened in read-write mode that contain version 1.0.11 or newer of the BisCore schema.\r\n * @see [[BriefcaseConnection.enterEditingScope]] to create a scope for a briefcase.\r\n * @see [[BriefcaseConnection.editingScope]] to obtain a briefcase's current scope.\r\n * @see [[exit]] to terminate a scope.\r\n * @public\r\n */\r\nexport class GraphicalEditingScope extends BriefcaseNotificationHandler implements EditingScopeNotifications {\r\n public get briefcaseChannelName() { return ipcAppChannels.editingScope; }\r\n\r\n /** Maps model Id to accumulated changes to geometric elements within the associated model. */\r\n private readonly _geometryChanges = new Map<Id64String, ModelChanges>();\r\n private _disposed = false;\r\n private _cleanup?: RemoveFunction;\r\n\r\n /** The connection to the iModel being edited. */\r\n public readonly iModel: BriefcaseConnection;\r\n\r\n /** Event raised when a new scope is created for any [[BriefcaseConnection]].\r\n * @see [[onExiting]] and [[onExited]] for complementary events.\r\n */\r\n public static readonly onEnter = new BeEvent<(scope: GraphicalEditingScope) => void>();\r\n\r\n /** Event raised when this scope is about to exit.\r\n * @see [[onEnter]] for the complementary event.\r\n * @see [[onExited]] for an event raised after the scope exits.\r\n */\r\n public readonly onExiting = new BeEvent<(scope: GraphicalEditingScope) => void>();\r\n\r\n /** Event raised when this scope has exited.\r\n * @see [[onEnter]] for the complementary event.\r\n * @see [[onExiting]] for an event raised just before the scope is exited.\r\n */\r\n public readonly onExited = new BeEvent<(scope: GraphicalEditingScope) => void>();\r\n\r\n /** Event raised after geometric changes are written to the iModel. */\r\n public readonly onGeometryChanges = new BeEvent<(changes: Iterable<ModelGeometryChanges>, scope: GraphicalEditingScope) => void>();\r\n\r\n /** Don't call this directly - use BriefcaseConnection.enterEditingScope.\r\n * @internal\r\n */\r\n public static async enter(imodel: BriefcaseConnection): Promise<GraphicalEditingScope> {\r\n if (imodel.editingScope)\r\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\r\n\r\n // Register the scope synchronously, in case enter() is called again for same iModel while awaiting asynchronous initialization.\r\n const scope = new GraphicalEditingScope(imodel);\r\n try {\r\n const scopeStarted = await IpcApp.appFunctionIpc.toggleGraphicalEditingScope(imodel.key, true);\r\n assert(scopeStarted); // If it didn't, the backend threw an error.\r\n } catch (e) {\r\n scope.dispose();\r\n throw e;\r\n }\r\n\r\n this.onEnter.raiseEvent(scope);\r\n\r\n return scope;\r\n }\r\n\r\n /** Exits this editing scope. The associated [[BriefcaseConnection]]'s `editingScope` will be reset to `undefined`.\r\n * @throws Error if the scope could not be exited, e.g., if it has already been exited.\r\n * @see [[BriefcaseConnection.enterEditingScope]] to enter an editing scope.\r\n */\r\n public async exit(): Promise<void> {\r\n if (this._disposed || this.iModel.editingScope !== this)\r\n throw new Error(\"Cannot exit editing scope after it is disconnected from the iModel\");\r\n\r\n this._disposed = true;\r\n try {\r\n this.onExiting.raiseEvent(this);\r\n } finally {\r\n const scopeExited = await IpcApp.appFunctionIpc.toggleGraphicalEditingScope(this.iModel.key, false);\r\n assert(!scopeExited);\r\n try {\r\n this.onExited.raiseEvent(this);\r\n } finally {\r\n this.dispose();\r\n }\r\n }\r\n }\r\n\r\n /** Obtain all geometric changes to elements within the specified model accumulated within this scope. */\r\n public getGeometryChangesForModel(modelId: Id64String): Iterable<ElementGeometryChange> | undefined {\r\n return this._geometryChanges.get(modelId);\r\n }\r\n\r\n /** Obtain all geometric changes to models accumulated within this scope. */\r\n public getGeometryChanges(): Iterable<ModelGeometryChanges> {\r\n return { [Symbol.iterator]: () => this.geometryChangeIterator() };\r\n }\r\n\r\n /** @internal */\r\n public get isDisposed() {\r\n return this._disposed;\r\n }\r\n\r\n private * geometryChangeIterator(): Iterator<ModelGeometryChanges> {\r\n for (const [key, value] of this._geometryChanges) {\r\n yield {\r\n id: key,\r\n geometryGuid: value.geometryGuid,\r\n range: value.range,\r\n elements: value,\r\n };\r\n }\r\n }\r\n\r\n private constructor(iModel: BriefcaseConnection) {\r\n super(iModel.key);\r\n this.iModel = iModel;\r\n this._cleanup = this.registerImpl();\r\n }\r\n\r\n private dispose(): void {\r\n this._disposed = true;\r\n\r\n this.onExiting.clear();\r\n this.onGeometryChanges.clear();\r\n this.onExited.clear();\r\n\r\n this._geometryChanges.clear();\r\n\r\n if (this._cleanup) {\r\n this._cleanup();\r\n this._cleanup = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public notifyGeometryChanged(props: ModelGeometryChangesProps[]) {\r\n const changes = ModelGeometryChanges.iterable(props);\r\n const modelIds: Id64String[] = [];\r\n let deletedIds: Id64Set | undefined;\r\n\r\n for (const modelChanges of changes) {\r\n // ###TODO do we care about the model range?\r\n let list = this._geometryChanges.get(modelChanges.id);\r\n modelIds.push(modelChanges.id);\r\n for (const elementChange of modelChanges.elements) {\r\n if (!list) {\r\n this._geometryChanges.set(modelChanges.id, list = new ModelChanges(modelChanges.geometryGuid, modelChanges.range));\r\n } else {\r\n list.geometryGuid = modelChanges.geometryGuid;\r\n modelChanges.range.clone(list.range);\r\n }\r\n\r\n list.insert(elementChange);\r\n if (DbOpcode.Delete === elementChange.type) {\r\n if (undefined === deletedIds)\r\n deletedIds = new Set<Id64String>();\r\n deletedIds.add(elementChange.id);\r\n }\r\n }\r\n }\r\n\r\n if (deletedIds) {\r\n this.iModel.selectionSet.remove(deletedIds);\r\n this.iModel.hilited.setHilite(deletedIds, false);\r\n }\r\n\r\n this.onGeometryChanges.raiseEvent(changes, this);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GraphicalEditingScope.js","sourceRoot":"","sources":["../../src/GraphicalEditingScope.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+I;AAE/I,oDAE4B;AAC5B,mDAA+D;AAE/D,qCAAkC;AAElC,MAAM,YAAa,SAAQ,0BAAkC;IAI3D,YAAmB,YAAwB,EAAE,KAAc;QACzD,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAA,6BAAc,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,8BAAe,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,qBAAsB,SAAQ,4CAA4B;IACrE,IAAW,oBAAoB,KAAK,OAAO,4BAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IA8BzE;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAA2B;QACnD,IAAI,MAAM,CAAC,YAAY;YACrB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QAEvF,gIAAgI;QAChI,MAAM,KAAK,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,eAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC/F,IAAA,qBAAM,EAAC,YAAY,CAAC,CAAC,CAAC,4CAA4C;QAC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,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;;AA3JH,sDA4JC;AAjJC;;GAEG;AACoB,6BAAO,GAAG,IAAI,sBAAO,EAA0C,AAAxD,CAAyD","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 IModelConnection\r\n */\r\n\r\nimport { assert, BeEvent, compareStrings, DbOpcode, DuplicatePolicy, GuidString, Id64Set, Id64String, SortedArray } from \"@itwin/core-bentley\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport {\r\n EditingScopeNotifications, ElementGeometryChange, ipcAppChannels, ModelGeometryChanges, ModelGeometryChangesProps, RemoveFunction,\r\n} from \"@itwin/core-common\";\r\nimport { BriefcaseNotificationHandler } from \"./BriefcaseTxns\";\r\nimport { BriefcaseConnection } from \"./BriefcaseConnection\";\r\nimport { IpcApp } from \"./IpcApp\";\r\n\r\nclass ModelChanges extends SortedArray<ElementGeometryChange> {\r\n public geometryGuid: GuidString;\r\n public readonly range: Range3d;\r\n\r\n public constructor(geometryGuid: GuidString, range: Range3d) {\r\n super((lhs, rhs) => compareStrings(lhs.id, rhs.id), DuplicatePolicy.Replace);\r\n this.geometryGuid = geometryGuid;\r\n this.range = range;\r\n }\r\n}\r\n\r\n/** Represents a period of time within an [interactive editing]($docs/learning/InteractiveEditing.md) session during which the\r\n * geometry of elements being displayed in one or more [[Viewport]]s is being modified. Outside of such a scope, whenever the\r\n * geometry within a [GeometricModel]($backend) changes new [[Tile]]s must be generated to reflect those changes in a viewport.\r\n * Regenerating entire tiles each time individual elements change can be time-consuming, which may introduce an unacceptable delay\r\n * between making a modification and seeing its result on the screen.\r\n *\r\n * Within the context of a graphical editing scope, no new tiles are generated. Instead, the geometry for any deleted or modified elements\r\n * is hidden in the tile graphics, and additional temporary graphics are displayed for any newly-inserted or modified elements. Only when the\r\n * scope exits are new tiles produced.\r\n *\r\n * The application decides when to enter and exit a graphical editing scope. A single interactive editing session may involve any number of\r\n * editing scopes. Typically, applications will enter a new editing scope (after first exiting a previous scope, if one exists):\r\n * - When switching from a non-graphical workflow to one that involves editing geometry; or\r\n * - When changing which geometric model is being edited; or\r\n * - After performing an operation that creates or modifies a \"large\" number (perhaps hundreds?) of elements.\r\n *\r\n * An application should typically exit any graphical editing scope before:\r\n * - Pulling changesets; or\r\n * - Switching from a graphical editing workflow to some non-graphical workflow.\r\n *\r\n * Graphical editing scopes are only supported for [[BriefcaseConnection]]s opened in read-write mode that contain version 1.0.11 or newer of the BisCore schema.\r\n * @see [[BriefcaseConnection.enterEditingScope]] to create a scope for a briefcase.\r\n * @see [[BriefcaseConnection.editingScope]] to obtain a briefcase's current scope.\r\n * @see [[exit]] to terminate a scope.\r\n * @public\r\n */\r\nexport class GraphicalEditingScope extends BriefcaseNotificationHandler implements EditingScopeNotifications {\r\n public get briefcaseChannelName() { return ipcAppChannels.editingScope; }\r\n\r\n /** Maps model Id to accumulated changes to geometric elements within the associated model. */\r\n private readonly _geometryChanges = new Map<Id64String, ModelChanges>();\r\n private _disposed = false;\r\n private _cleanup?: RemoveFunction;\r\n\r\n /** The connection to the iModel being edited. */\r\n public readonly iModel: BriefcaseConnection;\r\n\r\n /** Event raised when a new scope is created for any [[BriefcaseConnection]].\r\n * @see [[onExiting]] and [[onExited]] for complementary events.\r\n */\r\n public static readonly onEnter = new BeEvent<(scope: GraphicalEditingScope) => void>();\r\n\r\n /** Event raised when this scope is about to exit.\r\n * @see [[onEnter]] for the complementary event.\r\n * @see [[onExited]] for an event raised after the scope exits.\r\n */\r\n public readonly onExiting = new BeEvent<(scope: GraphicalEditingScope) => void>();\r\n\r\n /** Event raised when this scope has exited.\r\n * @see [[onEnter]] for the complementary event.\r\n * @see [[onExiting]] for an event raised just before the scope is exited.\r\n */\r\n public readonly onExited = new BeEvent<(scope: GraphicalEditingScope) => void>();\r\n\r\n /** Event raised after geometric changes are written to the iModel. */\r\n public readonly onGeometryChanges = new BeEvent<(changes: Iterable<ModelGeometryChanges>, scope: GraphicalEditingScope) => void>();\r\n\r\n /** Don't call this directly - use BriefcaseConnection.enterEditingScope.\r\n * @internal\r\n */\r\n public static async enter(imodel: BriefcaseConnection): Promise<GraphicalEditingScope> {\r\n if (imodel.editingScope)\r\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\r\n\r\n // Register the scope synchronously, in case enter() is called again for same iModel while awaiting asynchronous initialization.\r\n const scope = new GraphicalEditingScope(imodel);\r\n try {\r\n const scopeStarted = await IpcApp.appFunctionIpc.toggleGraphicalEditingScope(imodel.key, true);\r\n assert(scopeStarted); // If it didn't, the backend threw an error.\r\n } catch (e) {\r\n scope.dispose();\r\n throw e;\r\n }\r\n\r\n this.onEnter.raiseEvent(scope);\r\n\r\n return scope;\r\n }\r\n\r\n /** Exits this editing scope. The associated [[BriefcaseConnection]]'s `editingScope` will be reset to `undefined`.\r\n * @throws Error if the scope could not be exited, e.g., if it has already been exited.\r\n * @see [[BriefcaseConnection.enterEditingScope]] to enter an editing scope.\r\n */\r\n public async exit(): Promise<void> {\r\n if (this._disposed || this.iModel.editingScope !== this)\r\n throw new Error(\"Cannot exit editing scope after it is disconnected from the iModel\");\r\n\r\n this._disposed = true;\r\n try {\r\n this.onExiting.raiseEvent(this);\r\n } finally {\r\n const scopeExited = await IpcApp.appFunctionIpc.toggleGraphicalEditingScope(this.iModel.key, false);\r\n assert(!scopeExited);\r\n try {\r\n this.onExited.raiseEvent(this);\r\n } finally {\r\n this.dispose();\r\n }\r\n }\r\n }\r\n\r\n /** Obtain all geometric changes to elements within the specified model accumulated within this scope. */\r\n public getGeometryChangesForModel(modelId: Id64String): Iterable<ElementGeometryChange> | undefined {\r\n return this._geometryChanges.get(modelId);\r\n }\r\n\r\n /** Obtain all geometric changes to models accumulated within this scope. */\r\n public getGeometryChanges(): Iterable<ModelGeometryChanges> {\r\n return { [Symbol.iterator]: () => this.geometryChangeIterator() };\r\n }\r\n\r\n /** @internal */\r\n public get isDisposed() {\r\n return this._disposed;\r\n }\r\n\r\n private * geometryChangeIterator(): Iterator<ModelGeometryChanges> {\r\n for (const [key, value] of this._geometryChanges) {\r\n yield {\r\n id: key,\r\n geometryGuid: value.geometryGuid,\r\n range: value.range,\r\n elements: value,\r\n };\r\n }\r\n }\r\n\r\n private constructor(iModel: BriefcaseConnection) {\r\n super(iModel.key);\r\n this.iModel = iModel;\r\n this._cleanup = this.registerImpl();\r\n }\r\n\r\n private dispose(): void {\r\n this._disposed = true;\r\n\r\n this.onExiting.clear();\r\n this.onGeometryChanges.clear();\r\n this.onExited.clear();\r\n\r\n this._geometryChanges.clear();\r\n\r\n if (this._cleanup) {\r\n this._cleanup();\r\n this._cleanup = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public notifyGeometryChanged(props: ModelGeometryChangesProps[]) {\r\n const changes = ModelGeometryChanges.iterable(props);\r\n const modelIds: Id64String[] = [];\r\n let deletedIds: Id64Set | undefined;\r\n\r\n for (const modelChanges of changes) {\r\n // ###TODO do we care about the model range?\r\n let list = this._geometryChanges.get(modelChanges.id);\r\n modelIds.push(modelChanges.id);\r\n for (const elementChange of modelChanges.elements) {\r\n if (!list) {\r\n this._geometryChanges.set(modelChanges.id, list = new ModelChanges(modelChanges.geometryGuid, modelChanges.range));\r\n } else {\r\n list.geometryGuid = modelChanges.geometryGuid;\r\n modelChanges.range.clone(list.range);\r\n }\r\n\r\n list.insert(elementChange);\r\n if (DbOpcode.Delete === elementChange.type) {\r\n if (undefined === deletedIds)\r\n deletedIds = new Set<Id64String>();\r\n deletedIds.add(elementChange.id);\r\n }\r\n }\r\n }\r\n\r\n if (deletedIds) {\r\n this.iModel.selectionSet.remove(deletedIds);\r\n this.iModel.hilited.remove({ elements: deletedIds });\r\n }\r\n\r\n this.onGeometryChanges.raiseEvent(changes, this);\r\n }\r\n}\r\n"]}
|
|
@@ -8,48 +8,68 @@ import { IModelConnection } from "./IModelConnection";
|
|
|
8
8
|
* @extensions
|
|
9
9
|
*/
|
|
10
10
|
export declare enum SelectionSetEventType {
|
|
11
|
-
/**
|
|
11
|
+
/** Ids have been added to the set. */
|
|
12
12
|
Add = 0,
|
|
13
|
-
/**
|
|
13
|
+
/** Ids have been removed from the set. */
|
|
14
14
|
Remove = 1,
|
|
15
|
-
/** Some
|
|
15
|
+
/** Some ids have been added to the set and others have been removed. */
|
|
16
16
|
Replace = 2,
|
|
17
|
-
/** All
|
|
17
|
+
/** All ids have been removed from the set. */
|
|
18
18
|
Clear = 3
|
|
19
19
|
}
|
|
20
|
-
/** Passed to [[SelectionSet.onChanged]] event listeners when
|
|
20
|
+
/** Passed to [[SelectionSet.onChanged]] event listeners when ids are added to the selection set.
|
|
21
21
|
* @public
|
|
22
22
|
* @extensions
|
|
23
23
|
*/
|
|
24
24
|
export interface SelectAddEvent {
|
|
25
25
|
type: SelectionSetEventType.Add;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The Ids of the elements added to the set.
|
|
28
|
+
* @deprecated in 5.0. Use the [[additions]] attribute instead.
|
|
29
|
+
*/
|
|
27
30
|
added: Id64Arg;
|
|
31
|
+
/** A collection of geometric element, model and subcategory ids that have been added to selection set. */
|
|
32
|
+
additions: SelectableIds;
|
|
28
33
|
/** The affected SelectionSet. */
|
|
29
34
|
set: SelectionSet;
|
|
30
35
|
}
|
|
31
|
-
/** Passed to [[SelectionSet.onChanged]] event listeners when
|
|
36
|
+
/** Passed to [[SelectionSet.onChanged]] event listeners when ids are removed from the selection set.
|
|
32
37
|
* @public
|
|
33
38
|
* @extensions
|
|
34
39
|
*/
|
|
35
40
|
export interface SelectRemoveEvent {
|
|
36
41
|
/** The type of operation that produced this event. */
|
|
37
42
|
type: SelectionSetEventType.Remove | SelectionSetEventType.Clear;
|
|
38
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The element Ids removed from the set.
|
|
45
|
+
* @deprecated in 5.0. Use the [[removals]] attribute instead.
|
|
46
|
+
*/
|
|
39
47
|
removed: Id64Arg;
|
|
48
|
+
/** A collection of geometric element, model and subcategory ids that have been removed from selection set. */
|
|
49
|
+
removals: SelectableIds;
|
|
40
50
|
/** The affected SelectionSet. */
|
|
41
51
|
set: SelectionSet;
|
|
42
52
|
}
|
|
43
|
-
/** Passed to [[SelectionSet.onChanged]] event listeners when
|
|
53
|
+
/** Passed to [[SelectionSet.onChanged]] event listeners when ids are simultaneously added to and removed from the selection set.
|
|
44
54
|
* @public
|
|
45
55
|
* @extensions
|
|
46
56
|
*/
|
|
47
57
|
export interface SelectReplaceEvent {
|
|
48
58
|
type: SelectionSetEventType.Replace;
|
|
49
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The element Ids added to the set.
|
|
61
|
+
* @deprecated in 5.0. Use the [[additions]] attribute instead.
|
|
62
|
+
*/
|
|
50
63
|
added: Id64Arg;
|
|
51
|
-
/**
|
|
64
|
+
/** A collection of geometric element, model and subcategory ids that have been added to selection set. */
|
|
65
|
+
additions: SelectableIds;
|
|
66
|
+
/**
|
|
67
|
+
* The element Ids removed from the set.
|
|
68
|
+
* @deprecated in 5.0. Use the [[removals]] attribute instead.
|
|
69
|
+
*/
|
|
52
70
|
removed: Id64Arg;
|
|
71
|
+
/** A collection of geometric element, model and subcategory ids that have been removed from selection set. */
|
|
72
|
+
removals: SelectableIds;
|
|
53
73
|
/** The affected SelectionSet. */
|
|
54
74
|
set: SelectionSet;
|
|
55
75
|
}
|
|
@@ -58,10 +78,10 @@ export interface SelectReplaceEvent {
|
|
|
58
78
|
* ```ts
|
|
59
79
|
* processSelectionSetEvent(ev: SelectionSetEvent): void {
|
|
60
80
|
* if (SelectionSetEventType.Add === ev.type || SelectionSetEventType.Replace === ev.type)
|
|
61
|
-
* console.log("Added " + ev.
|
|
81
|
+
* console.log("Added " + (ev.additions.elements?.size ?? 0) + " elements");
|
|
62
82
|
*
|
|
63
83
|
* if (SelectionSetEventType.Add !== ev.type)
|
|
64
|
-
* console.log("Removed " + ev.
|
|
84
|
+
* console.log("Removed " + (ev.removals.elements?.size ?? 0) + " elements");
|
|
65
85
|
* }
|
|
66
86
|
* ```
|
|
67
87
|
* @public
|
|
@@ -95,9 +115,10 @@ export type ModelSubCategoryHiliteMode = "union" | "intersection";
|
|
|
95
115
|
* @extensions
|
|
96
116
|
*/
|
|
97
117
|
export declare class HiliteSet {
|
|
118
|
+
#private;
|
|
98
119
|
iModel: IModelConnection;
|
|
99
|
-
|
|
100
|
-
|
|
120
|
+
/** The set of hilited elements. */
|
|
121
|
+
readonly elements: Id64.Uint32Set;
|
|
101
122
|
/** The set of hilited subcategories.
|
|
102
123
|
* @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[models]].
|
|
103
124
|
* @see [[IModelConnection.Categories]] to obtain the set of subcategories associated with one or more [Category]($backend)'s.
|
|
@@ -107,8 +128,6 @@ export declare class HiliteSet {
|
|
|
107
128
|
* @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[subcategories]].
|
|
108
129
|
*/
|
|
109
130
|
readonly models: Id64.Uint32Set;
|
|
110
|
-
/** The set of hilited elements. */
|
|
111
|
-
get elements(): Id64.Uint32Set;
|
|
112
131
|
/** Controls how the sets of hilited [[models]] and [[subcategories]] interact with one another.
|
|
113
132
|
* By default they are treated as a union: a [Feature]($common) is hilited if either its model **or** its subcategory is hilited.
|
|
114
133
|
* This can be changed to an intersection such that a [Feature]($common) is hilited only if both its model **and** subcategory are hilited.
|
|
@@ -121,16 +140,22 @@ export declare class HiliteSet {
|
|
|
121
140
|
readonly onModelSubCategoryModeChanged: BeEvent<(newMode: ModelSubCategoryHiliteMode) => void>;
|
|
122
141
|
/** Construct a HiliteSet
|
|
123
142
|
* @param iModel The iModel containing the entities to be hilited.
|
|
124
|
-
* @param syncWithSelectionSet If true, the
|
|
143
|
+
* @param syncWithSelectionSet If true, the hilite set contents will be synchronized with those in the `iModel`'s [[SelectionSet]].
|
|
125
144
|
*/
|
|
126
145
|
constructor(iModel: IModelConnection, syncWithSelectionSet?: boolean);
|
|
127
|
-
/** Control whether the
|
|
146
|
+
/** Control whether the hilite set will be synchronized with the contents of the [[SelectionSet]].
|
|
128
147
|
* By default they are synchronized. Applications that override this take responsibility for managing the set of hilited entities.
|
|
129
148
|
* When turning synchronization off, the contents of the HiliteSet will remain unchanged.
|
|
130
149
|
* When turning synchronization on, the current contents of the HiliteSet will be preserved, and the contents of the selection set will be added to them.
|
|
131
150
|
*/
|
|
132
151
|
get wantSyncWithSelectionSet(): boolean;
|
|
133
152
|
set wantSyncWithSelectionSet(want: boolean);
|
|
153
|
+
/** Adds a collection of geometric element, model and subcategory ids to this hilite set. */
|
|
154
|
+
add(additions: SelectableIds): void;
|
|
155
|
+
/** Removes a collection of geometric element, model and subcategory ids from this hilite set. */
|
|
156
|
+
remove(removals: SelectableIds): void;
|
|
157
|
+
/** Replaces ids currently in the hilite set with the given collection. */
|
|
158
|
+
replace(ids: SelectableIds): void;
|
|
134
159
|
/** Remove all elements from the hilited set. */
|
|
135
160
|
clear(): void;
|
|
136
161
|
/** Returns true if nothing is hilited. */
|
|
@@ -138,36 +163,52 @@ export declare class HiliteSet {
|
|
|
138
163
|
/** Toggle the hilited state of one or more elements.
|
|
139
164
|
* @param arg the ID(s) of the elements whose state is to be toggled.
|
|
140
165
|
* @param onOff True to add the elements to the hilited set, false to remove them.
|
|
166
|
+
* @deprecated in 5.0. Use [[add]], [[remove]], [[replace]] instead.
|
|
141
167
|
*/
|
|
142
168
|
setHilite(arg: Id64Arg, onOff: boolean): void;
|
|
143
169
|
}
|
|
144
|
-
/** A set of *currently selected* elements for an IModelConnection
|
|
145
|
-
*
|
|
170
|
+
/** A set of *currently selected* geometric elements, models and subcategories for an `IModelConnection`.
|
|
171
|
+
* Generally, selected elements are displayed with a customizable hilite effect within a [[Viewport]], see [[HiliteSet]].
|
|
146
172
|
* @see [Hilite.Settings]($common) for customization of the hilite effect.
|
|
147
173
|
* @public
|
|
148
174
|
* @extensions
|
|
149
175
|
*/
|
|
150
176
|
export declare class SelectionSet {
|
|
177
|
+
#private;
|
|
151
178
|
iModel: IModelConnection;
|
|
152
|
-
private _elements;
|
|
153
179
|
/** The IDs of the selected elements.
|
|
154
180
|
* @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].
|
|
155
181
|
*/
|
|
156
|
-
get elements(): Set<
|
|
157
|
-
/**
|
|
182
|
+
get elements(): Set<Id64String>;
|
|
183
|
+
/** The IDs of the selected models.
|
|
184
|
+
* @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].
|
|
185
|
+
*/
|
|
186
|
+
get models(): Set<Id64String>;
|
|
187
|
+
/** The IDs of the selected subcategories.
|
|
188
|
+
* @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].
|
|
189
|
+
*/
|
|
190
|
+
get subcategories(): Set<Id64String>;
|
|
191
|
+
/** Get the active selection as a collection of geometric element, model and subcategory ids.
|
|
192
|
+
* @note Do not modify the sets in returned collection directly. Instead, use methods like [[SelectionSet.add]].
|
|
193
|
+
*/
|
|
194
|
+
get active(): {
|
|
195
|
+
[P in keyof SelectableIds]-?: Set<Id64String>;
|
|
196
|
+
};
|
|
197
|
+
/** Called whenever ids are added or removed from this `SelectionSet` */
|
|
158
198
|
readonly onChanged: BeEvent<(ev: SelectionSetEvent) => void>;
|
|
159
199
|
constructor(iModel: IModelConnection);
|
|
160
|
-
private sendChangedEvent;
|
|
161
200
|
/** Get the number of entries in this selection set. */
|
|
162
201
|
get size(): number;
|
|
163
|
-
/** Check whether there are any
|
|
202
|
+
/** Check whether there are any ids in this selection set. */
|
|
164
203
|
get isActive(): boolean;
|
|
165
|
-
/** Return true if elemId is in this SelectionSet
|
|
204
|
+
/** Return true if elemId is in this `SelectionSet`.
|
|
166
205
|
* @see [[isSelected]]
|
|
206
|
+
* @deprecated in 5.0. Use `SelectionSet.elements.has(elemId)` instead.
|
|
167
207
|
*/
|
|
168
208
|
has(elemId?: string): boolean;
|
|
169
209
|
/** Query whether an Id is in the selection set.
|
|
170
210
|
* @see [[has]]
|
|
211
|
+
* @deprecated in 5.0. Use `SelectionSet.elements.has(elemId)` instead.
|
|
171
212
|
*/
|
|
172
213
|
isSelected(elemId?: Id64String): boolean;
|
|
173
214
|
/** Clear current selection set.
|
|
@@ -179,23 +220,31 @@ export declare class SelectionSet {
|
|
|
179
220
|
* @param elem The set of Ids to add.
|
|
180
221
|
* @returns true if any elements were added.
|
|
181
222
|
*/
|
|
182
|
-
add(
|
|
183
|
-
private _add;
|
|
223
|
+
add(adds: Id64Arg | SelectableIds): boolean;
|
|
184
224
|
/**
|
|
185
225
|
* Remove one or more Ids from the current selection set.
|
|
186
226
|
* @param elem The set of Ids to remove.
|
|
187
227
|
* @returns true if any elements were removed.
|
|
188
228
|
*/
|
|
189
|
-
remove(
|
|
190
|
-
private _remove;
|
|
229
|
+
remove(removes: Id64Arg | SelectableIds): boolean;
|
|
191
230
|
/**
|
|
192
231
|
* Add one set of Ids, and remove another set of Ids. Any Ids that are in both sets are removed.
|
|
193
232
|
* @returns True if any Ids were either added or removed.
|
|
194
233
|
*/
|
|
195
|
-
addAndRemove(adds: Id64Arg, removes: Id64Arg): boolean;
|
|
196
|
-
/** Invert the state of a set of Ids in the SelectionSet */
|
|
197
|
-
invert(
|
|
234
|
+
addAndRemove(adds: Id64Arg | SelectableIds, removes: Id64Arg | SelectableIds): boolean;
|
|
235
|
+
/** Invert the state of a set of Ids in the `SelectionSet` */
|
|
236
|
+
invert(ids: Id64Arg | SelectableIds): boolean;
|
|
198
237
|
/** Change selection set to be the supplied set of Ids. */
|
|
199
|
-
replace(
|
|
238
|
+
replace(ids: Id64Arg | SelectableIds): boolean;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* A collection of geometric element, model and subcategory ids that can be added to
|
|
242
|
+
* a [[SelectionSet]] or [[HiliteSet]].
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
export interface SelectableIds {
|
|
246
|
+
elements?: Id64Arg;
|
|
247
|
+
models?: Id64Arg;
|
|
248
|
+
subcategories?: Id64Arg;
|
|
200
249
|
}
|
|
201
250
|
//# sourceMappingURL=SelectionSet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionSet.d.ts","sourceRoot":"","sources":["../../src/SelectionSet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectionSet.d.ts","sourceRoot":"","sources":["../../src/SelectionSet.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAsB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,sCAAsC;IACtC,GAAG,IAAA;IACH,0CAA0C;IAC1C,MAAM,IAAA;IACN,wEAAwE;IACxE,OAAO,IAAA;IACP,8CAA8C;IAC9C,KAAK,IAAA;CACN;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,qBAAqB,CAAC,GAAG,CAAC;IAChC;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,0GAA0G;IAC1G,SAAS,EAAE,aAAa,CAAC;IACzB,iCAAiC;IACjC,GAAG,EAAE,YAAY,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,IAAI,EAAE,qBAAqB,CAAC,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC;IACjE;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,8GAA8G;IAC9G,QAAQ,EAAE,aAAa,CAAC;IACxB,iCAAiC;IACjC,GAAG,EAAE,YAAY,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,qBAAqB,CAA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