@itwin/core-frontend 4.0.0-dev.11 → 4.0.0-dev.17
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/IModelConnection.d.ts +1 -1
- package/lib/cjs/IModelConnection.js +1 -1
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/NoRenderApp.d.ts +11 -4
- package/lib/cjs/NoRenderApp.d.ts.map +1 -1
- package/lib/cjs/NoRenderApp.js +13 -6
- package/lib/cjs/NoRenderApp.js.map +1 -1
- package/lib/cjs/SelectionSet.d.ts +0 -1
- package/lib/cjs/SelectionSet.d.ts.map +1 -1
- package/lib/cjs/SelectionSet.js +0 -1
- package/lib/cjs/SelectionSet.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +1 -1
- package/lib/esm/IModelConnection.js +1 -1
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/NoRenderApp.d.ts +11 -4
- package/lib/esm/NoRenderApp.d.ts.map +1 -1
- package/lib/esm/NoRenderApp.js +11 -4
- package/lib/esm/NoRenderApp.js.map +1 -1
- package/lib/esm/SelectionSet.d.ts +0 -1
- package/lib/esm/SelectionSet.d.ts.map +1 -1
- package/lib/esm/SelectionSet.js +0 -1
- package/lib/esm/SelectionSet.js.map +1 -1
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionSet.js","sourceRoot":"","sources":["../../src/SelectionSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;;GAGG;AACH,MAAM,CAAN,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B,2CAA2C;IAC3C,+DAAG,CAAA;IACH,+CAA+C;IAC/C,qEAAM,CAAA;IACN,6EAA6E;IAC7E,uEA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CAAC;aACtB;SACF;QAED,IAAI,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,qBAAqB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,GAAgB,EAAE,GAAY;IAC9C,wDAAwD;IACxD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE1B,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAC/B,OAAO,KAAK,CAAC;IAEf,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;IAEjB,OAAO,IAAI,CAAC;AACd,CAAC","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 SelectionSet\r\n */\r\nimport { BeEvent, Id64, Id64Arg, Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** Identifies the type of changes made to the [[SelectionSet]] to produce a [[SelectionSetEvent]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SelectionSetEventType {\r\n /** Elements have been added to the set. */\r\n Add,\r\n /** Elements have been removed from the set. */\r\n Remove,\r\n /** Some elements have been added to the set and others have been removed. */\r\n Replace,\r\n /** All elements are about to be removed from the set. */\r\n Clear,\r\n}\r\n\r\n/** Passed to [[SelectionSet.onChanged]] event listeners when elements are added to the selection set.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SelectAddEvent {\r\n type: SelectionSetEventType.Add;\r\n /** The Ids of the elements added to the set. */\r\n added: Id64Arg;\r\n /** The affected SelectionSet. */\r\n set: SelectionSet;\r\n}\r\n\r\n/** Passed to [[SelectionSet.onChanged]] event listeners when elements are removed from the selection set.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SelectRemoveEvent {\r\n /** The type of operation that produced this event. */\r\n type: SelectionSetEventType.Remove | SelectionSetEventType.Clear;\r\n /** The element Ids removed from the set. */\r\n removed: Id64Arg;\r\n /** The affected SelectionSet. */\r\n set: SelectionSet;\r\n}\r\n\r\n/** Passed to [[SelectionSet.onChanged]] event listeners when elements are simultaneously added to and removed from the selection set.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SelectReplaceEvent {\r\n type: SelectionSetEventType.Replace;\r\n /** The element Ids added to the set. */\r\n added: Id64Arg;\r\n /** The element Ids removed from the set. */\r\n removed: Id64Arg;\r\n /** The affected SelectionSet. */\r\n set: SelectionSet;\r\n}\r\n\r\n/** Payload sent to [[SelectionSet.onChanged]] event listeners to describe how the contents of the set have changed.\r\n * The `type` property of the event serves as a type assertion. For example, the following code will output the added and/or removed Ids:\r\n * ```ts\r\n * processSelectionSetEvent(ev: SelectionSetEvent): void {\r\n * if (SelectionSetEventType.Add === ev.type || SelectionSetEventType.Replace === ev.type)\r\n * console.log(\"Added \" + ev.added.size + \" elements\");\r\n *\r\n * if (SelectionSetEventType.Add !== ev.type)\r\n * console.log(\"Removed \" + ev.removed.size + \" elements\");\r\n * }\r\n * ```\r\n * @public\r\n * @extensions\r\n */\r\nexport type SelectionSetEvent = SelectAddEvent | SelectRemoveEvent | SelectReplaceEvent;\r\n\r\n/** Tracks a set of hilited entities. When the set changes, notifies ViewManager so that symbology overrides can be updated in active Viewports.\r\n * @internal\r\n */\r\nclass HilitedIds extends Id64.Uint32Set {\r\n protected _iModel: IModelConnection;\r\n protected _changing = false;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n super();\r\n this._iModel = iModel;\r\n }\r\n\r\n public override add(low: number, high: number) {\r\n super.add(low, high);\r\n this.onChanged();\r\n }\r\n\r\n public override delete(low: number, high: number) {\r\n super.delete(low, high);\r\n this.onChanged();\r\n }\r\n\r\n public override clear() {\r\n super.clear();\r\n this.onChanged();\r\n }\r\n\r\n public override addIds(ids: Id64Arg) {\r\n this.change(() => super.addIds(ids));\r\n }\r\n\r\n public override deleteIds(ids: Id64Arg) {\r\n this.change(() => super.deleteIds(ids));\r\n }\r\n\r\n protected onChanged() {\r\n if (!this._changing)\r\n IModelApp.viewManager.onSelectionSetChanged(this._iModel);\r\n }\r\n\r\n protected change(func: () => void) {\r\n const changing = this._changing;\r\n this._changing = false;\r\n func();\r\n this._changing = changing;\r\n this.onChanged();\r\n }\r\n}\r\n\r\n/** Keeps the set of hilited elements in sync with the selection set.\r\n * @internal\r\n */\r\nclass HilitedElementIds extends HilitedIds {\r\n private _removeListener?: () => void;\r\n\r\n public constructor(iModel: IModelConnection, syncWithSelectionSet = true) {\r\n super(iModel);\r\n this.wantSyncWithSelectionSet = syncWithSelectionSet;\r\n }\r\n\r\n public get wantSyncWithSelectionSet(): boolean { return undefined !== this._removeListener; }\r\n public set wantSyncWithSelectionSet(want: boolean) {\r\n if (want === this.wantSyncWithSelectionSet)\r\n return;\r\n\r\n if (want) {\r\n const set = this._iModel.selectionSet;\r\n this._removeListener = set.onChanged.addListener((ev) => this.change(() => this.processSelectionSetEvent(ev)));\r\n this.processSelectionSetEvent({\r\n set,\r\n type: SelectionSetEventType.Add,\r\n added: set.elements,\r\n });\r\n } else {\r\n this._removeListener!();\r\n this._removeListener = undefined;\r\n }\r\n }\r\n\r\n private processSelectionSetEvent(ev: SelectionSetEvent): void {\r\n if (SelectionSetEventType.Add !== ev.type)\r\n this.deleteIds(ev.removed);\r\n\r\n if (ev.type === SelectionSetEventType.Add || ev.type === SelectionSetEventType.Replace)\r\n this.addIds(ev.added);\r\n }\r\n}\r\n\r\n/** Describes how the sets of hilited models and subcategories in a [[HiliteSet]] interact.\r\n * - \"union\" indicates a [Feature]($common) will be hilited if either its model **or** its subcategory is present in the HiliteSet.\r\n * - \"intersection\" indicates a [Feature]($common) will be hilited only if both its model **and** its subcategory are present in the HiliteSet.\r\n *\r\n * @see [[HiliteSet.modelSubCategoryMode]] to change the mode for a HiliteSet.\r\n * @public\r\n */\r\nexport type ModelSubCategoryHiliteMode = \"union\" | \"intersection\";\r\n\r\n/** A set of *hilited* elements for an [[IModelConnection]], by element id.\r\n * Hilited elements are displayed with a customizable hilite effect within a [[Viewport]].\r\n * The set exposes 3 types of elements in 3 separate collections: [GeometricElement]($backend), [GeometricModel]($backend), and [SubCategory]($backend).\r\n * The [[models]] and [[subcategories]] can be hilited independently or as an intersection of the two sets, as specified by [[modelSubCategoryMode]].\r\n *\r\n * Technically, the hilite effect is applied to [Feature]($common)s, not [Element]($backend)s. An element's geometry stream can contain multiple\r\n * features belonging to different subcategories.\r\n *\r\n * Because Javascript lacks efficient support for 64-bit integers, the Ids are stored as pairs of 32-bit integers via [Id64.Uint32Set]($bentley).\r\n *\r\n * @note Typically, elements are hilited by virtue of their presence in the IModelConnection's [[SelectionSet]]. The HiliteSet allows additional\r\n * elements to be displayed with the hilite effect without adding them to the [[SelectionSet]]. If you add elements to the HiliteSet directly, you\r\n * are also responsible for removing them as appropriate.\r\n * @see [[IModelConnection.hilited]] for the HiliteSet associated with an iModel.\r\n * @see [Hilite.Settings]($common) for customization of the hilite effect.\r\n * @public\r\n * @extensions\r\n */\r\nexport class HiliteSet {\r\n private readonly _elements: HilitedElementIds;\r\n private _mode: ModelSubCategoryHiliteMode = \"union\";\r\n\r\n /** The set of hilited subcategories.\r\n * @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[models]].\r\n * @see [[IModelConnection.Categories]] to obtain the set of subcategories associated with one or more [Category]($backend)'s.\r\n */\r\n public readonly subcategories: Id64.Uint32Set;\r\n\r\n /** The set of hilited [[GeometricModelState]]s.\r\n * @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[subcategories]].\r\n */\r\n public readonly models: Id64.Uint32Set;\r\n\r\n /** The set of hilited elements. */\r\n public get elements(): Id64.Uint32Set { return this._elements; }\r\n\r\n /** Controls how the sets of hilited [[models]] and [[subcategories]] interact with one another.\r\n * By default they are treated as a union: a [Feature]($common) is hilited if either its model **or** its subcategory is hilited.\r\n * This can be changed to an intersection such that a [Feature]($common) is hilited only if both its model **and** subcategory are hilited.\r\n * @note The sets of hilited models and subcategories are independent of the set of hilited [[elements]] - an element whose Id is present in\r\n * [[elements]] is always hilited regardless of its model or subcategories.\r\n */\r\n public get modelSubCategoryMode(): ModelSubCategoryHiliteMode {\r\n return this._mode;\r\n }\r\n public set modelSubCategoryMode(mode: ModelSubCategoryHiliteMode) {\r\n if (mode === this._mode)\r\n return;\r\n\r\n this.onModelSubCategoryModeChanged.raiseEvent(mode);\r\n this._mode = mode;\r\n }\r\n\r\n /** Event raised just before changing the value of [[modelSubCategoryMode]]. */\r\n public readonly onModelSubCategoryModeChanged = new BeEvent<(newMode: ModelSubCategoryHiliteMode) => void>();\r\n\r\n /** Construct a HiliteSet\r\n * @param iModel The iModel containing the entities to be hilited.\r\n * @param syncWithSelectionSet If true, the contents of the `elements` set will be synchronized with those in the `iModel`'s [[SelectionSet]].\r\n * @internal\r\n */\r\n public constructor(public iModel: IModelConnection, syncWithSelectionSet = true) {\r\n this._elements = new HilitedElementIds(iModel, syncWithSelectionSet);\r\n this.subcategories = new HilitedIds(iModel);\r\n this.models = new HilitedIds(iModel);\r\n }\r\n\r\n /** Control whether the hilited elements will be synchronized with the contents of the [[SelectionSet]].\r\n * By default they are synchronized. Applications that override this take responsibility for managing the set of hilited entities.\r\n * When turning synchronization off, the contents of the HiliteSet will remain unchanged.\r\n * 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.\r\n */\r\n public get wantSyncWithSelectionSet(): boolean { return this._elements.wantSyncWithSelectionSet; }\r\n public set wantSyncWithSelectionSet(want: boolean) { this._elements.wantSyncWithSelectionSet = want; }\r\n\r\n /** Remove all elements from the hilited set. */\r\n public clear() {\r\n this.elements.clear();\r\n this.subcategories.clear();\r\n this.models.clear();\r\n }\r\n\r\n /** Returns true if nothing is hilited. */\r\n public get isEmpty(): boolean { return this.elements.isEmpty && this.subcategories.isEmpty && this.models.isEmpty; }\r\n\r\n /** Toggle the hilited state of one or more elements.\r\n * @param arg the ID(s) of the elements whose state is to be toggled.\r\n * @param onOff True to add the elements to the hilited set, false to remove them.\r\n */\r\n public setHilite(arg: Id64Arg, onOff: boolean): void {\r\n const oldSize = this.elements.size;\r\n\r\n for (const id of Id64.iterable(arg)) {\r\n if (onOff)\r\n this.elements.addId(id);\r\n else\r\n this.elements.deleteId(id);\r\n }\r\n\r\n if (oldSize !== this.elements.size)\r\n IModelApp.viewManager.onSelectionSetChanged(this.iModel);\r\n }\r\n}\r\n\r\n/** A set of *currently selected* elements for an IModelConnection.\r\n * Selected elements are displayed with a customizable hilite effect within a [[Viewport]].\r\n * @see [Hilite.Settings]($common) for customization of the hilite effect.\r\n * @public\r\n * @extensions\r\n */\r\nexport class SelectionSet {\r\n private _elements = new Set<string>();\r\n\r\n /** The IDs of the selected elements.\r\n * @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].\r\n */\r\n public get elements(): Set<string> { return this._elements; }\r\n\r\n /** Called whenever elements are added or removed from this SelectionSet */\r\n public readonly onChanged = new BeEvent<(ev: SelectionSetEvent) => void>();\r\n\r\n public constructor(public iModel: IModelConnection) { }\r\n\r\n private sendChangedEvent(ev: SelectionSetEvent) {\r\n IModelApp.viewManager.onSelectionSetChanged(this.iModel);\r\n this.onChanged.raiseEvent(ev);\r\n }\r\n\r\n /** Get the number of entries in this selection set. */\r\n public get size() { return this.elements.size; }\r\n\r\n /** Check whether there are any selected elements. */\r\n public get isActive() { return this.size !== 0; }\r\n\r\n /** Return true if elemId is in this SelectionSet.\r\n * @see [[isSelected]]\r\n */\r\n public has(elemId?: string) { return !!elemId && this.elements.has(elemId); }\r\n\r\n /** Query whether an Id is in the selection set.\r\n * @see [[has]]\r\n */\r\n public isSelected(elemId?: Id64String): boolean { return !!elemId && this.elements.has(elemId); }\r\n\r\n /** Clear current selection set.\r\n * @note raises the [[onChanged]] event with [[SelectionSetEventType.Clear]].\r\n */\r\n public emptyAll(): void {\r\n if (!this.isActive)\r\n return;\r\n\r\n const removed = this._elements;\r\n this._elements = new Set<string>();\r\n this.sendChangedEvent({ set: this, type: SelectionSetEventType.Clear, removed });\r\n }\r\n\r\n /**\r\n * Add one or more Ids to the current selection set.\r\n * @param elem The set of Ids to add.\r\n * @returns true if any elements were added.\r\n */\r\n public add(elem: Id64Arg): boolean {\r\n return this._add(elem);\r\n }\r\n\r\n private _add(elem: Id64Arg, sendEvent = true): boolean {\r\n const oldSize = this.elements.size;\r\n for (const id of Id64.iterable(elem))\r\n this.elements.add(id);\r\n\r\n const changed = oldSize !== this.elements.size;\r\n if (sendEvent && changed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Add, set: this, added: elem });\r\n\r\n return changed;\r\n }\r\n\r\n /**\r\n * Remove one or more Ids from the current selection set.\r\n * @param elem The set of Ids to remove.\r\n * @returns true if any elements were removed.\r\n */\r\n public remove(elem: Id64Arg): boolean {\r\n return this._remove(elem);\r\n }\r\n\r\n private _remove(elem: Id64Arg, sendEvent = true): boolean {\r\n const oldSize = this.elements.size;\r\n for (const id of Id64.iterable(elem))\r\n this.elements.delete(id);\r\n\r\n const changed = oldSize !== this.elements.size;\r\n if (sendEvent && changed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Remove, set: this, removed: elem });\r\n\r\n return changed;\r\n }\r\n\r\n /**\r\n * Add one set of Ids, and remove another set of Ids. Any Ids that are in both sets are removed.\r\n * @returns True if any Ids were either added or removed.\r\n */\r\n public addAndRemove(adds: Id64Arg, removes: Id64Arg): boolean {\r\n const added = this._add(adds, false);\r\n const removed = this._remove(removes, false);\r\n\r\n if (added && removed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Replace, set: this, added: adds, removed: removes });\r\n else if (added)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Add, set: this, added: adds });\r\n else if (removed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Remove, set: this, removed: removes });\r\n\r\n return (added || removed);\r\n }\r\n\r\n /** Invert the state of a set of Ids in the SelectionSet */\r\n public invert(elem: Id64Arg): boolean {\r\n const elementsToAdd = new Set<string>();\r\n const elementsToRemove = new Set<string>();\r\n for (const id of Id64.iterable(elem)) {\r\n if (this.elements.has(id))\r\n elementsToRemove.add(id);\r\n else\r\n elementsToAdd.add(id);\r\n }\r\n\r\n return this.addAndRemove(elementsToAdd, elementsToRemove);\r\n }\r\n\r\n /** Change selection set to be the supplied set of Ids. */\r\n public replace(elem: Id64Arg): void {\r\n if (areEqual(this.elements, elem))\r\n return;\r\n\r\n const removed = this._elements;\r\n this._elements = new Set<string>();\r\n this._add(elem, false);\r\n\r\n if (0 < removed.size) {\r\n for (const id of Id64.iterable(elem)) {\r\n if (removed.has(id))\r\n removed.delete(id);\r\n }\r\n }\r\n\r\n this.sendChangedEvent({ type: SelectionSetEventType.Replace, set: this, added: elem, removed });\r\n }\r\n}\r\n\r\nfunction areEqual(lhs: Set<string>, rhs: Id64Arg): boolean {\r\n // Size is unreliable if input can contain duplicates...\r\n if (Array.isArray(rhs))\r\n rhs = Id64.toIdSet(rhs);\r\n\r\n if (lhs.size !== Id64.sizeOf(rhs))\r\n return false;\r\n\r\n for (const id of Id64.iterable(rhs))\r\n if (!lhs.has(id))\r\n return false;\r\n\r\n return true;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionSet.js","sourceRoot":"","sources":["../../src/SelectionSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,aA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pB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACpC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;oBACjB,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;aACtB;SACF;QAED,IAAI,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,qBAAqB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,GAAgB,EAAE,GAAY;IAC9C,wDAAwD;IACxD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE1B,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAC/B,OAAO,KAAK,CAAC;IAEf,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;IAEjB,OAAO,IAAI,CAAC;AACd,CAAC","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 SelectionSet\r\n */\r\nimport { BeEvent, Id64, Id64Arg, Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** Identifies the type of changes made to the [[SelectionSet]] to produce a [[SelectionSetEvent]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum SelectionSetEventType {\r\n /** Elements have been added to the set. */\r\n Add,\r\n /** Elements have been removed from the set. */\r\n Remove,\r\n /** Some elements have been added to the set and others have been removed. */\r\n Replace,\r\n /** All elements are about to be removed from the set. */\r\n Clear,\r\n}\r\n\r\n/** Passed to [[SelectionSet.onChanged]] event listeners when elements are added to the selection set.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SelectAddEvent {\r\n type: SelectionSetEventType.Add;\r\n /** The Ids of the elements added to the set. */\r\n added: Id64Arg;\r\n /** The affected SelectionSet. */\r\n set: SelectionSet;\r\n}\r\n\r\n/** Passed to [[SelectionSet.onChanged]] event listeners when elements are removed from the selection set.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SelectRemoveEvent {\r\n /** The type of operation that produced this event. */\r\n type: SelectionSetEventType.Remove | SelectionSetEventType.Clear;\r\n /** The element Ids removed from the set. */\r\n removed: Id64Arg;\r\n /** The affected SelectionSet. */\r\n set: SelectionSet;\r\n}\r\n\r\n/** Passed to [[SelectionSet.onChanged]] event listeners when elements are simultaneously added to and removed from the selection set.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface SelectReplaceEvent {\r\n type: SelectionSetEventType.Replace;\r\n /** The element Ids added to the set. */\r\n added: Id64Arg;\r\n /** The element Ids removed from the set. */\r\n removed: Id64Arg;\r\n /** The affected SelectionSet. */\r\n set: SelectionSet;\r\n}\r\n\r\n/** Payload sent to [[SelectionSet.onChanged]] event listeners to describe how the contents of the set have changed.\r\n * The `type` property of the event serves as a type assertion. For example, the following code will output the added and/or removed Ids:\r\n * ```ts\r\n * processSelectionSetEvent(ev: SelectionSetEvent): void {\r\n * if (SelectionSetEventType.Add === ev.type || SelectionSetEventType.Replace === ev.type)\r\n * console.log(\"Added \" + ev.added.size + \" elements\");\r\n *\r\n * if (SelectionSetEventType.Add !== ev.type)\r\n * console.log(\"Removed \" + ev.removed.size + \" elements\");\r\n * }\r\n * ```\r\n * @public\r\n * @extensions\r\n */\r\nexport type SelectionSetEvent = SelectAddEvent | SelectRemoveEvent | SelectReplaceEvent;\r\n\r\n/** Tracks a set of hilited entities. When the set changes, notifies ViewManager so that symbology overrides can be updated in active Viewports.\r\n * @internal\r\n */\r\nclass HilitedIds extends Id64.Uint32Set {\r\n protected _iModel: IModelConnection;\r\n protected _changing = false;\r\n\r\n public constructor(iModel: IModelConnection) {\r\n super();\r\n this._iModel = iModel;\r\n }\r\n\r\n public override add(low: number, high: number) {\r\n super.add(low, high);\r\n this.onChanged();\r\n }\r\n\r\n public override delete(low: number, high: number) {\r\n super.delete(low, high);\r\n this.onChanged();\r\n }\r\n\r\n public override clear() {\r\n super.clear();\r\n this.onChanged();\r\n }\r\n\r\n public override addIds(ids: Id64Arg) {\r\n this.change(() => super.addIds(ids));\r\n }\r\n\r\n public override deleteIds(ids: Id64Arg) {\r\n this.change(() => super.deleteIds(ids));\r\n }\r\n\r\n protected onChanged() {\r\n if (!this._changing)\r\n IModelApp.viewManager.onSelectionSetChanged(this._iModel);\r\n }\r\n\r\n protected change(func: () => void) {\r\n const changing = this._changing;\r\n this._changing = false;\r\n func();\r\n this._changing = changing;\r\n this.onChanged();\r\n }\r\n}\r\n\r\n/** Keeps the set of hilited elements in sync with the selection set.\r\n * @internal\r\n */\r\nclass HilitedElementIds extends HilitedIds {\r\n private _removeListener?: () => void;\r\n\r\n public constructor(iModel: IModelConnection, syncWithSelectionSet = true) {\r\n super(iModel);\r\n this.wantSyncWithSelectionSet = syncWithSelectionSet;\r\n }\r\n\r\n public get wantSyncWithSelectionSet(): boolean { return undefined !== this._removeListener; }\r\n public set wantSyncWithSelectionSet(want: boolean) {\r\n if (want === this.wantSyncWithSelectionSet)\r\n return;\r\n\r\n if (want) {\r\n const set = this._iModel.selectionSet;\r\n this._removeListener = set.onChanged.addListener((ev) => this.change(() => this.processSelectionSetEvent(ev)));\r\n this.processSelectionSetEvent({\r\n set,\r\n type: SelectionSetEventType.Add,\r\n added: set.elements,\r\n });\r\n } else {\r\n this._removeListener!();\r\n this._removeListener = undefined;\r\n }\r\n }\r\n\r\n private processSelectionSetEvent(ev: SelectionSetEvent): void {\r\n if (SelectionSetEventType.Add !== ev.type)\r\n this.deleteIds(ev.removed);\r\n\r\n if (ev.type === SelectionSetEventType.Add || ev.type === SelectionSetEventType.Replace)\r\n this.addIds(ev.added);\r\n }\r\n}\r\n\r\n/** Describes how the sets of hilited models and subcategories in a [[HiliteSet]] interact.\r\n * - \"union\" indicates a [Feature]($common) will be hilited if either its model **or** its subcategory is present in the HiliteSet.\r\n * - \"intersection\" indicates a [Feature]($common) will be hilited only if both its model **and** its subcategory are present in the HiliteSet.\r\n *\r\n * @see [[HiliteSet.modelSubCategoryMode]] to change the mode for a HiliteSet.\r\n * @public\r\n */\r\nexport type ModelSubCategoryHiliteMode = \"union\" | \"intersection\";\r\n\r\n/** A set of *hilited* elements for an [[IModelConnection]], by element id.\r\n * Hilited elements are displayed with a customizable hilite effect within a [[Viewport]].\r\n * The set exposes 3 types of elements in 3 separate collections: [GeometricElement]($backend), [GeometricModel]($backend), and [SubCategory]($backend).\r\n * The [[models]] and [[subcategories]] can be hilited independently or as an intersection of the two sets, as specified by [[modelSubCategoryMode]].\r\n *\r\n * Technically, the hilite effect is applied to [Feature]($common)s, not [Element]($backend)s. An element's geometry stream can contain multiple\r\n * features belonging to different subcategories.\r\n *\r\n * Because Javascript lacks efficient support for 64-bit integers, the Ids are stored as pairs of 32-bit integers via [Id64.Uint32Set]($bentley).\r\n *\r\n * @note Typically, elements are hilited by virtue of their presence in the IModelConnection's [[SelectionSet]]. The HiliteSet allows additional\r\n * elements to be displayed with the hilite effect without adding them to the [[SelectionSet]]. If you add elements to the HiliteSet directly, you\r\n * are also responsible for removing them as appropriate.\r\n * @see [[IModelConnection.hilited]] for the HiliteSet associated with an iModel.\r\n * @see [Hilite.Settings]($common) for customization of the hilite effect.\r\n * @public\r\n * @extensions\r\n */\r\nexport class HiliteSet {\r\n private readonly _elements: HilitedElementIds;\r\n private _mode: ModelSubCategoryHiliteMode = \"union\";\r\n\r\n /** The set of hilited subcategories.\r\n * @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[models]].\r\n * @see [[IModelConnection.Categories]] to obtain the set of subcategories associated with one or more [Category]($backend)'s.\r\n */\r\n public readonly subcategories: Id64.Uint32Set;\r\n\r\n /** The set of hilited [[GeometricModelState]]s.\r\n * @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[subcategories]].\r\n */\r\n public readonly models: Id64.Uint32Set;\r\n\r\n /** The set of hilited elements. */\r\n public get elements(): Id64.Uint32Set { return this._elements; }\r\n\r\n /** Controls how the sets of hilited [[models]] and [[subcategories]] interact with one another.\r\n * By default they are treated as a union: a [Feature]($common) is hilited if either its model **or** its subcategory is hilited.\r\n * This can be changed to an intersection such that a [Feature]($common) is hilited only if both its model **and** subcategory are hilited.\r\n * @note The sets of hilited models and subcategories are independent of the set of hilited [[elements]] - an element whose Id is present in\r\n * [[elements]] is always hilited regardless of its model or subcategories.\r\n */\r\n public get modelSubCategoryMode(): ModelSubCategoryHiliteMode {\r\n return this._mode;\r\n }\r\n public set modelSubCategoryMode(mode: ModelSubCategoryHiliteMode) {\r\n if (mode === this._mode)\r\n return;\r\n\r\n this.onModelSubCategoryModeChanged.raiseEvent(mode);\r\n this._mode = mode;\r\n }\r\n\r\n /** Event raised just before changing the value of [[modelSubCategoryMode]]. */\r\n public readonly onModelSubCategoryModeChanged = new BeEvent<(newMode: ModelSubCategoryHiliteMode) => void>();\r\n\r\n /** Construct a HiliteSet\r\n * @param iModel The iModel containing the entities to be hilited.\r\n * @param syncWithSelectionSet If true, the contents of the `elements` set will be synchronized with those in the `iModel`'s [[SelectionSet]].\r\n */\r\n public constructor(public iModel: IModelConnection, syncWithSelectionSet = true) {\r\n this._elements = new HilitedElementIds(iModel, syncWithSelectionSet);\r\n this.subcategories = new HilitedIds(iModel);\r\n this.models = new HilitedIds(iModel);\r\n }\r\n\r\n /** Control whether the hilited elements will be synchronized with the contents of the [[SelectionSet]].\r\n * By default they are synchronized. Applications that override this take responsibility for managing the set of hilited entities.\r\n * When turning synchronization off, the contents of the HiliteSet will remain unchanged.\r\n * 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.\r\n */\r\n public get wantSyncWithSelectionSet(): boolean { return this._elements.wantSyncWithSelectionSet; }\r\n public set wantSyncWithSelectionSet(want: boolean) { this._elements.wantSyncWithSelectionSet = want; }\r\n\r\n /** Remove all elements from the hilited set. */\r\n public clear() {\r\n this.elements.clear();\r\n this.subcategories.clear();\r\n this.models.clear();\r\n }\r\n\r\n /** Returns true if nothing is hilited. */\r\n public get isEmpty(): boolean { return this.elements.isEmpty && this.subcategories.isEmpty && this.models.isEmpty; }\r\n\r\n /** Toggle the hilited state of one or more elements.\r\n * @param arg the ID(s) of the elements whose state is to be toggled.\r\n * @param onOff True to add the elements to the hilited set, false to remove them.\r\n */\r\n public setHilite(arg: Id64Arg, onOff: boolean): void {\r\n const oldSize = this.elements.size;\r\n\r\n for (const id of Id64.iterable(arg)) {\r\n if (onOff)\r\n this.elements.addId(id);\r\n else\r\n this.elements.deleteId(id);\r\n }\r\n\r\n if (oldSize !== this.elements.size)\r\n IModelApp.viewManager.onSelectionSetChanged(this.iModel);\r\n }\r\n}\r\n\r\n/** A set of *currently selected* elements for an IModelConnection.\r\n * Selected elements are displayed with a customizable hilite effect within a [[Viewport]].\r\n * @see [Hilite.Settings]($common) for customization of the hilite effect.\r\n * @public\r\n * @extensions\r\n */\r\nexport class SelectionSet {\r\n private _elements = new Set<string>();\r\n\r\n /** The IDs of the selected elements.\r\n * @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].\r\n */\r\n public get elements(): Set<string> { return this._elements; }\r\n\r\n /** Called whenever elements are added or removed from this SelectionSet */\r\n public readonly onChanged = new BeEvent<(ev: SelectionSetEvent) => void>();\r\n\r\n public constructor(public iModel: IModelConnection) { }\r\n\r\n private sendChangedEvent(ev: SelectionSetEvent) {\r\n IModelApp.viewManager.onSelectionSetChanged(this.iModel);\r\n this.onChanged.raiseEvent(ev);\r\n }\r\n\r\n /** Get the number of entries in this selection set. */\r\n public get size() { return this.elements.size; }\r\n\r\n /** Check whether there are any selected elements. */\r\n public get isActive() { return this.size !== 0; }\r\n\r\n /** Return true if elemId is in this SelectionSet.\r\n * @see [[isSelected]]\r\n */\r\n public has(elemId?: string) { return !!elemId && this.elements.has(elemId); }\r\n\r\n /** Query whether an Id is in the selection set.\r\n * @see [[has]]\r\n */\r\n public isSelected(elemId?: Id64String): boolean { return !!elemId && this.elements.has(elemId); }\r\n\r\n /** Clear current selection set.\r\n * @note raises the [[onChanged]] event with [[SelectionSetEventType.Clear]].\r\n */\r\n public emptyAll(): void {\r\n if (!this.isActive)\r\n return;\r\n\r\n const removed = this._elements;\r\n this._elements = new Set<string>();\r\n this.sendChangedEvent({ set: this, type: SelectionSetEventType.Clear, removed });\r\n }\r\n\r\n /**\r\n * Add one or more Ids to the current selection set.\r\n * @param elem The set of Ids to add.\r\n * @returns true if any elements were added.\r\n */\r\n public add(elem: Id64Arg): boolean {\r\n return this._add(elem);\r\n }\r\n\r\n private _add(elem: Id64Arg, sendEvent = true): boolean {\r\n const oldSize = this.elements.size;\r\n for (const id of Id64.iterable(elem))\r\n this.elements.add(id);\r\n\r\n const changed = oldSize !== this.elements.size;\r\n if (sendEvent && changed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Add, set: this, added: elem });\r\n\r\n return changed;\r\n }\r\n\r\n /**\r\n * Remove one or more Ids from the current selection set.\r\n * @param elem The set of Ids to remove.\r\n * @returns true if any elements were removed.\r\n */\r\n public remove(elem: Id64Arg): boolean {\r\n return this._remove(elem);\r\n }\r\n\r\n private _remove(elem: Id64Arg, sendEvent = true): boolean {\r\n const oldSize = this.elements.size;\r\n for (const id of Id64.iterable(elem))\r\n this.elements.delete(id);\r\n\r\n const changed = oldSize !== this.elements.size;\r\n if (sendEvent && changed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Remove, set: this, removed: elem });\r\n\r\n return changed;\r\n }\r\n\r\n /**\r\n * Add one set of Ids, and remove another set of Ids. Any Ids that are in both sets are removed.\r\n * @returns True if any Ids were either added or removed.\r\n */\r\n public addAndRemove(adds: Id64Arg, removes: Id64Arg): boolean {\r\n const added = this._add(adds, false);\r\n const removed = this._remove(removes, false);\r\n\r\n if (added && removed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Replace, set: this, added: adds, removed: removes });\r\n else if (added)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Add, set: this, added: adds });\r\n else if (removed)\r\n this.sendChangedEvent({ type: SelectionSetEventType.Remove, set: this, removed: removes });\r\n\r\n return (added || removed);\r\n }\r\n\r\n /** Invert the state of a set of Ids in the SelectionSet */\r\n public invert(elem: Id64Arg): boolean {\r\n const elementsToAdd = new Set<string>();\r\n const elementsToRemove = new Set<string>();\r\n for (const id of Id64.iterable(elem)) {\r\n if (this.elements.has(id))\r\n elementsToRemove.add(id);\r\n else\r\n elementsToAdd.add(id);\r\n }\r\n\r\n return this.addAndRemove(elementsToAdd, elementsToRemove);\r\n }\r\n\r\n /** Change selection set to be the supplied set of Ids. */\r\n public replace(elem: Id64Arg): void {\r\n if (areEqual(this.elements, elem))\r\n return;\r\n\r\n const removed = this._elements;\r\n this._elements = new Set<string>();\r\n this._add(elem, false);\r\n\r\n if (0 < removed.size) {\r\n for (const id of Id64.iterable(elem)) {\r\n if (removed.has(id))\r\n removed.delete(id);\r\n }\r\n }\r\n\r\n this.sendChangedEvent({ type: SelectionSetEventType.Replace, set: this, added: elem, removed });\r\n }\r\n}\r\n\r\nfunction areEqual(lhs: Set<string>, rhs: Id64Arg): boolean {\r\n // Size is unreliable if input can contain duplicates...\r\n if (Array.isArray(rhs))\r\n rhs = Id64.toIdSet(rhs);\r\n\r\n if (lhs.size !== Id64.sizeOf(rhs))\r\n return false;\r\n\r\n for (const id of Id64.iterable(rhs))\r\n if (!lhs.has(id))\r\n return false;\r\n\r\n return true;\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-frontend",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.17",
|
|
4
4
|
"description": "iTwin.js frontend components",
|
|
5
5
|
"main": "lib/cjs/core-frontend.js",
|
|
6
6
|
"module": "lib/esm/core-frontend.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@itwin/appui-abstract": "^4.0.0-dev.8",
|
|
26
|
-
"@itwin/core-bentley": "^4.0.0-dev.
|
|
27
|
-
"@itwin/core-common": "^4.0.0-dev.
|
|
28
|
-
"@itwin/core-geometry": "^4.0.0-dev.
|
|
29
|
-
"@itwin/core-orbitgt": "^4.0.0-dev.
|
|
30
|
-
"@itwin/core-quantity": "^4.0.0-dev.
|
|
26
|
+
"@itwin/core-bentley": "^4.0.0-dev.17",
|
|
27
|
+
"@itwin/core-common": "^4.0.0-dev.17",
|
|
28
|
+
"@itwin/core-geometry": "^4.0.0-dev.17",
|
|
29
|
+
"@itwin/core-orbitgt": "^4.0.0-dev.17",
|
|
30
|
+
"@itwin/core-quantity": "^4.0.0-dev.17"
|
|
31
31
|
},
|
|
32
32
|
"//devDependencies": [
|
|
33
33
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@itwin/appui-abstract": "4.0.0-dev.8",
|
|
38
|
-
"@itwin/build-tools": "4.0.0-dev.
|
|
39
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
40
|
-
"@itwin/core-common": "4.0.0-dev.
|
|
41
|
-
"@itwin/core-geometry": "4.0.0-dev.
|
|
42
|
-
"@itwin/core-orbitgt": "4.0.0-dev.
|
|
43
|
-
"@itwin/core-quantity": "4.0.0-dev.
|
|
44
|
-
"@itwin/certa": "4.0.0-dev.
|
|
45
|
-
"@itwin/eslint-plugin": "4.0.0-dev.
|
|
46
|
-
"@itwin/webgl-compatibility": "4.0.0-dev.
|
|
38
|
+
"@itwin/build-tools": "4.0.0-dev.17",
|
|
39
|
+
"@itwin/core-bentley": "4.0.0-dev.17",
|
|
40
|
+
"@itwin/core-common": "4.0.0-dev.17",
|
|
41
|
+
"@itwin/core-geometry": "4.0.0-dev.17",
|
|
42
|
+
"@itwin/core-orbitgt": "4.0.0-dev.17",
|
|
43
|
+
"@itwin/core-quantity": "4.0.0-dev.17",
|
|
44
|
+
"@itwin/certa": "4.0.0-dev.17",
|
|
45
|
+
"@itwin/eslint-plugin": "4.0.0-dev.17",
|
|
46
|
+
"@itwin/webgl-compatibility": "4.0.0-dev.17",
|
|
47
47
|
"@types/chai": "4.3.1",
|
|
48
48
|
"@types/chai-as-promised": "^7",
|
|
49
49
|
"@types/deep-assign": "^0.1.0",
|
|
50
50
|
"@types/lodash": "^4.14.0",
|
|
51
51
|
"@types/mocha": "^8.2.2",
|
|
52
|
-
"@types/node": "18.11.5",
|
|
52
|
+
"@types/node": "^18.11.5",
|
|
53
53
|
"@types/qs": "^6.5.0",
|
|
54
54
|
"@types/semver": "7.3.10",
|
|
55
55
|
"@types/superagent": "^4.1.14",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@itwin/object-storage-azure": "
|
|
78
|
-
"@itwin/cloud-agnostic-core": "
|
|
79
|
-
"@itwin/object-storage-core": "
|
|
80
|
-
"@itwin/core-i18n": "4.0.0-dev.
|
|
81
|
-
"@itwin/core-telemetry": "4.0.0-dev.
|
|
82
|
-
"@itwin/webgl-compatibility": "4.0.0-dev.
|
|
77
|
+
"@itwin/object-storage-azure": "^1.5.0",
|
|
78
|
+
"@itwin/cloud-agnostic-core": "^1.5.0",
|
|
79
|
+
"@itwin/object-storage-core": "^1.5.0",
|
|
80
|
+
"@itwin/core-i18n": "4.0.0-dev.17",
|
|
81
|
+
"@itwin/core-telemetry": "4.0.0-dev.17",
|
|
82
|
+
"@itwin/webgl-compatibility": "4.0.0-dev.17",
|
|
83
83
|
"@loaders.gl/core": "^3.1.6",
|
|
84
84
|
"@loaders.gl/draco": "^3.1.6",
|
|
85
85
|
"deep-assign": "^2.0.0",
|