@itwin/core-frontend 5.0.0-dev.32 → 5.0.0-dev.34
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/AccuDraw.js +1 -1
- package/lib/cjs/AccuDraw.js.map +1 -1
- package/lib/cjs/ApproximateTerrainHeights.js +1 -1
- package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
- package/lib/cjs/BackgroundMapGeometry.js +5 -5
- package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
- package/lib/cjs/DrawingViewState.js +9 -9
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/GraphicalEditingScope.js +4 -4
- package/lib/cjs/GraphicalEditingScope.js.map +1 -1
- package/lib/cjs/IModelApp.js +61 -63
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.js +10 -10
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/IModelRoutingContext.js +1 -1
- package/lib/cjs/IModelRoutingContext.js.map +1 -1
- package/lib/cjs/IpcApp.js +2 -2
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/LocalhostIpcApp.js +1 -1
- package/lib/cjs/LocalhostIpcApp.js.map +1 -1
- package/lib/cjs/NativeApp.js +15 -17
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/NativeAppLogger.js +1 -1
- package/lib/cjs/NativeAppLogger.js.map +1 -1
- package/lib/cjs/NoRenderApp.js +1 -1
- package/lib/cjs/NoRenderApp.js.map +1 -1
- package/lib/cjs/SelectionSet.js +148 -156
- package/lib/cjs/SelectionSet.js.map +1 -1
- package/lib/cjs/Sprites.js +1 -1
- package/lib/cjs/Sprites.js.map +1 -1
- package/lib/cjs/ViewCreator2d.js +3 -3
- package/lib/cjs/ViewCreator2d.js.map +1 -1
- package/lib/cjs/ViewGlobalLocation.js +5 -5
- package/lib/cjs/ViewGlobalLocation.js.map +1 -1
- package/lib/cjs/ViewState.js +2 -2
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/ViewingSpace.js +9 -9
- package/lib/cjs/ViewingSpace.js.map +1 -1
- package/lib/cjs/Viewport.js +41 -41
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/common/internal/render/DisplayParams.js +1 -1
- package/lib/cjs/common/internal/render/DisplayParams.js.map +1 -1
- package/lib/cjs/common/internal/render/GraphicDescriptionBuilderImpl.js +1 -1
- package/lib/cjs/common/internal/render/GraphicDescriptionBuilderImpl.js.map +1 -1
- package/lib/cjs/common/internal/render/GraphicDescriptionContextImpl.js +1 -1
- package/lib/cjs/common/internal/render/GraphicDescriptionContextImpl.js.map +1 -1
- package/lib/cjs/internal/render/PrimitiveBuilder.js +1 -1
- package/lib/cjs/internal/render/PrimitiveBuilder.js.map +1 -1
- package/lib/cjs/internal/render/RenderInstancesParamsImpl.js +1 -1
- package/lib/cjs/internal/render/RenderInstancesParamsImpl.js.map +1 -1
- package/lib/cjs/render/MockRender.js +3 -3
- package/lib/cjs/render/MockRender.js.map +1 -1
- package/lib/cjs/render/webgl/BackgroundMapDrape.js +1 -1
- package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
- package/lib/cjs/render/webgl/BatchState.js +1 -1
- package/lib/cjs/render/webgl/BatchState.js.map +1 -1
- package/lib/cjs/render/webgl/ColorInfo.js +2 -2
- package/lib/cjs/render/webgl/ColorInfo.js.map +1 -1
- package/lib/cjs/render/webgl/Diagnostics.js +4 -4
- package/lib/cjs/render/webgl/Diagnostics.js.map +1 -1
- package/lib/cjs/render/webgl/DrawCommand.js +4 -4
- package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
- package/lib/cjs/render/webgl/IModelFrameLifecycle.js +4 -4
- package/lib/cjs/render/webgl/IModelFrameLifecycle.js.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.js +3 -3
- package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/Material.js +4 -4
- package/lib/cjs/render/webgl/Material.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarTextureProjection.js +1 -1
- package/lib/cjs/render/webgl/PlanarTextureProjection.js.map +1 -1
- package/lib/cjs/render/webgl/RenderState.js +1 -1
- package/lib/cjs/render/webgl/RenderState.js.map +1 -1
- package/lib/cjs/render/webgl/Target.js +1 -1
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/render/webgl/Technique.js +39 -39
- package/lib/cjs/render/webgl/Technique.js.map +1 -1
- package/lib/cjs/render/webgl/TechniqueFlags.js +1 -1
- package/lib/cjs/render/webgl/TechniqueFlags.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.js +3 -3
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/tile/CesiumAssetProvider.js +1 -1
- package/lib/cjs/tile/CesiumAssetProvider.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.js +6 -6
- package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +2 -2
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +7 -7
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapTile.js +8 -8
- package/lib/cjs/tile/map/MapTile.js.map +1 -1
- package/lib/cjs/tile/map/MapTileAvailability.js +1 -1
- package/lib/cjs/tile/map/MapTileAvailability.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +9 -9
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.js +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +2 -2
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tools/AccuDrawTool.js +21 -21
- package/lib/cjs/tools/AccuDrawTool.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +32 -32
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/cjs/tools/EditManipulator.js +2 -2
- package/lib/cjs/tools/EditManipulator.js.map +1 -1
- package/lib/cjs/tools/IdleTool.js +2 -2
- package/lib/cjs/tools/IdleTool.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +34 -34
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/cjs/tools/SelectTool.js +5 -5
- package/lib/cjs/tools/SelectTool.js.map +1 -1
- package/lib/cjs/tools/Tool.js +10 -10
- package/lib/cjs/tools/Tool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +19 -19
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ToolAssistance.js +19 -19
- package/lib/cjs/tools/ToolAssistance.js.map +1 -1
- package/lib/cjs/tools/ToolSettings.js +63 -63
- package/lib/cjs/tools/ToolSettings.js.map +1 -1
- package/lib/cjs/tools/ViewTool.js +37 -37
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/AccuDraw.js +1 -1
- package/lib/esm/AccuDraw.js.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.js +1 -1
- package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
- package/lib/esm/BackgroundMapGeometry.js +5 -5
- package/lib/esm/BackgroundMapGeometry.js.map +1 -1
- package/lib/esm/DrawingViewState.js +9 -9
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/GraphicalEditingScope.js +4 -4
- package/lib/esm/GraphicalEditingScope.js.map +1 -1
- package/lib/esm/IModelApp.js +61 -63
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.js +10 -10
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/IModelRoutingContext.js +1 -1
- package/lib/esm/IModelRoutingContext.js.map +1 -1
- package/lib/esm/IpcApp.js +2 -2
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/LocalhostIpcApp.js +1 -1
- package/lib/esm/LocalhostIpcApp.js.map +1 -1
- package/lib/esm/NativeApp.js +15 -17
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/NativeAppLogger.js +1 -1
- package/lib/esm/NativeAppLogger.js.map +1 -1
- package/lib/esm/NoRenderApp.js +1 -1
- package/lib/esm/NoRenderApp.js.map +1 -1
- package/lib/esm/SelectionSet.js +148 -156
- package/lib/esm/SelectionSet.js.map +1 -1
- package/lib/esm/Sprites.js +1 -1
- package/lib/esm/Sprites.js.map +1 -1
- package/lib/esm/ViewCreator2d.js +3 -3
- package/lib/esm/ViewCreator2d.js.map +1 -1
- package/lib/esm/ViewGlobalLocation.js +5 -5
- package/lib/esm/ViewGlobalLocation.js.map +1 -1
- package/lib/esm/ViewState.js +2 -2
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/ViewingSpace.js +9 -9
- package/lib/esm/ViewingSpace.js.map +1 -1
- package/lib/esm/Viewport.js +41 -41
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/common/internal/render/DisplayParams.js +1 -1
- package/lib/esm/common/internal/render/DisplayParams.js.map +1 -1
- package/lib/esm/common/internal/render/GraphicDescriptionBuilderImpl.js +1 -1
- package/lib/esm/common/internal/render/GraphicDescriptionBuilderImpl.js.map +1 -1
- package/lib/esm/common/internal/render/GraphicDescriptionContextImpl.js +1 -1
- package/lib/esm/common/internal/render/GraphicDescriptionContextImpl.js.map +1 -1
- package/lib/esm/internal/render/PrimitiveBuilder.js +1 -1
- package/lib/esm/internal/render/PrimitiveBuilder.js.map +1 -1
- package/lib/esm/internal/render/RenderInstancesParamsImpl.js +1 -1
- package/lib/esm/internal/render/RenderInstancesParamsImpl.js.map +1 -1
- package/lib/esm/render/MockRender.js +3 -3
- package/lib/esm/render/MockRender.js.map +1 -1
- package/lib/esm/render/webgl/BackgroundMapDrape.js +1 -1
- package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
- package/lib/esm/render/webgl/BatchState.js +1 -1
- package/lib/esm/render/webgl/BatchState.js.map +1 -1
- package/lib/esm/render/webgl/ColorInfo.js +2 -2
- package/lib/esm/render/webgl/ColorInfo.js.map +1 -1
- package/lib/esm/render/webgl/Diagnostics.js +4 -4
- package/lib/esm/render/webgl/Diagnostics.js.map +1 -1
- package/lib/esm/render/webgl/DrawCommand.js +4 -4
- package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
- package/lib/esm/render/webgl/IModelFrameLifecycle.js +4 -4
- package/lib/esm/render/webgl/IModelFrameLifecycle.js.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.js +3 -3
- package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/esm/render/webgl/Material.js +4 -4
- package/lib/esm/render/webgl/Material.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/PlanarTextureProjection.js +1 -1
- package/lib/esm/render/webgl/PlanarTextureProjection.js.map +1 -1
- package/lib/esm/render/webgl/RenderState.js +1 -1
- package/lib/esm/render/webgl/RenderState.js.map +1 -1
- package/lib/esm/render/webgl/Target.js +1 -1
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/render/webgl/Technique.js +39 -39
- package/lib/esm/render/webgl/Technique.js.map +1 -1
- package/lib/esm/render/webgl/TechniqueFlags.js +1 -1
- package/lib/esm/render/webgl/TechniqueFlags.js.map +1 -1
- package/lib/esm/render/webgl/Texture.js +3 -3
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/tile/CesiumAssetProvider.js +1 -1
- package/lib/esm/tile/CesiumAssetProvider.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.js +6 -6
- package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +2 -2
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +7 -7
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapTile.js +8 -8
- package/lib/esm/tile/map/MapTile.js.map +1 -1
- package/lib/esm/tile/map/MapTileAvailability.js +1 -1
- package/lib/esm/tile/map/MapTileAvailability.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +9 -9
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTilingScheme.js +1 -1
- package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +2 -2
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tools/AccuDrawTool.js +21 -21
- package/lib/esm/tools/AccuDrawTool.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +32 -32
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/EditManipulator.js +2 -2
- package/lib/esm/tools/EditManipulator.js.map +1 -1
- package/lib/esm/tools/IdleTool.js +2 -2
- package/lib/esm/tools/IdleTool.js.map +1 -1
- package/lib/esm/tools/MeasureTool.js +34 -34
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/esm/tools/SelectTool.js +5 -5
- package/lib/esm/tools/SelectTool.js.map +1 -1
- package/lib/esm/tools/Tool.js +10 -10
- package/lib/esm/tools/Tool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +19 -19
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ToolAssistance.js +19 -19
- package/lib/esm/tools/ToolAssistance.js.map +1 -1
- package/lib/esm/tools/ToolSettings.js +63 -63
- package/lib/esm/tools/ToolSettings.js.map +1 -1
- package/lib/esm/tools/ViewTool.js +37 -37
- package/lib/esm/tools/ViewTool.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 +18 -18
package/lib/esm/SelectionSet.js
CHANGED
|
@@ -2,18 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
6
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
8
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9
|
-
};
|
|
10
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
-
};
|
|
16
|
-
var _HiliteSet_instances, _HiliteSet_mode, _HiliteSet_selectionChangesListener, _HiliteSet_changing, _HiliteSet_onChanged, _HiliteSet_change, _HiliteSet_processSelectionSetEvent, _SelectionSet_instances, _SelectionSet_selection, _SelectionSet_sendChangedEvent, _SelectionSet_add, _SelectionSet_remove;
|
|
17
5
|
/** @packageDocumentation
|
|
18
6
|
* @module SelectionSet
|
|
19
7
|
*/
|
|
@@ -78,6 +66,9 @@ class HilitedIds extends Id64.Uint32Set {
|
|
|
78
66
|
* @extensions
|
|
79
67
|
*/
|
|
80
68
|
export class HiliteSet {
|
|
69
|
+
#mode;
|
|
70
|
+
#selectionChangesListener;
|
|
71
|
+
#changing;
|
|
81
72
|
/** Controls how the sets of hilited [[models]] and [[subcategories]] interact with one another.
|
|
82
73
|
* By default they are treated as a union: a [Feature]($common) is hilited if either its model **or** its subcategory is hilited.
|
|
83
74
|
* This can be changed to an intersection such that a [Feature]($common) is hilited only if both its model **and** subcategory are hilited.
|
|
@@ -85,30 +76,28 @@ export class HiliteSet {
|
|
|
85
76
|
* [[elements]] is always hilited regardless of its model or subcategories.
|
|
86
77
|
*/
|
|
87
78
|
get modelSubCategoryMode() {
|
|
88
|
-
return
|
|
79
|
+
return this.#mode;
|
|
89
80
|
}
|
|
90
81
|
set modelSubCategoryMode(mode) {
|
|
91
|
-
if (mode ===
|
|
82
|
+
if (mode === this.#mode) {
|
|
92
83
|
return;
|
|
93
84
|
}
|
|
94
85
|
this.onModelSubCategoryModeChanged.raiseEvent(mode);
|
|
95
|
-
|
|
86
|
+
this.#mode = mode;
|
|
96
87
|
}
|
|
97
88
|
/** Construct a HiliteSet
|
|
98
89
|
* @param iModel The iModel containing the entities to be hilited.
|
|
99
90
|
* @param syncWithSelectionSet If true, the hilite set contents will be synchronized with those in the `iModel`'s [[SelectionSet]].
|
|
100
91
|
*/
|
|
101
92
|
constructor(iModel, syncWithSelectionSet = true) {
|
|
102
|
-
_HiliteSet_instances.add(this);
|
|
103
93
|
this.iModel = iModel;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
_HiliteSet_changing.set(this, false);
|
|
94
|
+
this.#mode = "union";
|
|
95
|
+
this.#changing = false;
|
|
107
96
|
/** Event raised just before changing the value of [[modelSubCategoryMode]]. */
|
|
108
97
|
this.onModelSubCategoryModeChanged = new BeEvent();
|
|
109
|
-
this.elements = new HilitedIds((func) =>
|
|
110
|
-
this.subcategories = new HilitedIds((func) =>
|
|
111
|
-
this.models = new HilitedIds((func) =>
|
|
98
|
+
this.elements = new HilitedIds((func) => this.#change(func));
|
|
99
|
+
this.subcategories = new HilitedIds((func) => this.#change(func));
|
|
100
|
+
this.models = new HilitedIds((func) => this.#change(func));
|
|
112
101
|
this.wantSyncWithSelectionSet = syncWithSelectionSet;
|
|
113
102
|
}
|
|
114
103
|
/** Control whether the hilite set will be synchronized with the contents of the [[SelectionSet]].
|
|
@@ -117,7 +106,7 @@ export class HiliteSet {
|
|
|
117
106
|
* 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.
|
|
118
107
|
*/
|
|
119
108
|
get wantSyncWithSelectionSet() {
|
|
120
|
-
return !!
|
|
109
|
+
return !!this.#selectionChangesListener;
|
|
121
110
|
}
|
|
122
111
|
set wantSyncWithSelectionSet(want) {
|
|
123
112
|
if (want === this.wantSyncWithSelectionSet) {
|
|
@@ -125,17 +114,47 @@ export class HiliteSet {
|
|
|
125
114
|
}
|
|
126
115
|
if (want) {
|
|
127
116
|
const set = this.iModel.selectionSet;
|
|
128
|
-
|
|
117
|
+
this.#selectionChangesListener = set.onChanged.addListener((ev) => this.#processSelectionSetEvent(ev));
|
|
129
118
|
this.add(set.active);
|
|
130
119
|
}
|
|
131
120
|
else {
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
this.#selectionChangesListener();
|
|
122
|
+
this.#selectionChangesListener = undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
#onChanged() {
|
|
126
|
+
if (!this.#changing) {
|
|
127
|
+
IModelApp.viewManager.onSelectionSetChanged(this.iModel);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
#change(func) {
|
|
131
|
+
const changing = this.#changing;
|
|
132
|
+
this.#changing = true;
|
|
133
|
+
try {
|
|
134
|
+
func();
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
this.#changing = changing;
|
|
138
|
+
}
|
|
139
|
+
this.#onChanged();
|
|
140
|
+
}
|
|
141
|
+
#processSelectionSetEvent(ev) {
|
|
142
|
+
switch (ev.type) {
|
|
143
|
+
case SelectionSetEventType.Add:
|
|
144
|
+
return this.add(ev.additions);
|
|
145
|
+
case SelectionSetEventType.Replace:
|
|
146
|
+
return this.#change(() => {
|
|
147
|
+
this.add(ev.additions);
|
|
148
|
+
this.remove(ev.removals);
|
|
149
|
+
});
|
|
150
|
+
case SelectionSetEventType.Remove:
|
|
151
|
+
case SelectionSetEventType.Clear:
|
|
152
|
+
return this.remove(ev.removals);
|
|
134
153
|
}
|
|
135
154
|
}
|
|
136
155
|
/** Adds a collection of geometric element, model and subcategory ids to this hilite set. */
|
|
137
156
|
add(additions) {
|
|
138
|
-
|
|
157
|
+
this.#change(() => {
|
|
139
158
|
additions.elements && this.elements.addIds(additions.elements);
|
|
140
159
|
additions.models && this.models.addIds(additions.models);
|
|
141
160
|
additions.subcategories && this.subcategories.addIds(additions.subcategories);
|
|
@@ -143,7 +162,7 @@ export class HiliteSet {
|
|
|
143
162
|
}
|
|
144
163
|
/** Removes a collection of geometric element, model and subcategory ids from this hilite set. */
|
|
145
164
|
remove(removals) {
|
|
146
|
-
|
|
165
|
+
this.#change(() => {
|
|
147
166
|
removals.elements && this.elements.deleteIds(removals.elements);
|
|
148
167
|
removals.models && this.models.deleteIds(removals.models);
|
|
149
168
|
removals.subcategories && this.subcategories.deleteIds(removals.subcategories);
|
|
@@ -151,14 +170,14 @@ export class HiliteSet {
|
|
|
151
170
|
}
|
|
152
171
|
/** Replaces ids currently in the hilite set with the given collection. */
|
|
153
172
|
replace(ids) {
|
|
154
|
-
|
|
173
|
+
this.#change(() => {
|
|
155
174
|
this.clear();
|
|
156
175
|
this.add(ids);
|
|
157
176
|
});
|
|
158
177
|
}
|
|
159
178
|
/** Remove all elements from the hilited set. */
|
|
160
179
|
clear() {
|
|
161
|
-
|
|
180
|
+
this.#change(() => {
|
|
162
181
|
this.elements.clear();
|
|
163
182
|
this.models.clear();
|
|
164
183
|
this.subcategories.clear();
|
|
@@ -182,34 +201,6 @@ export class HiliteSet {
|
|
|
182
201
|
}
|
|
183
202
|
}
|
|
184
203
|
}
|
|
185
|
-
_HiliteSet_mode = new WeakMap(), _HiliteSet_selectionChangesListener = new WeakMap(), _HiliteSet_changing = new WeakMap(), _HiliteSet_instances = new WeakSet(), _HiliteSet_onChanged = function _HiliteSet_onChanged() {
|
|
186
|
-
if (!__classPrivateFieldGet(this, _HiliteSet_changing, "f")) {
|
|
187
|
-
IModelApp.viewManager.onSelectionSetChanged(this.iModel);
|
|
188
|
-
}
|
|
189
|
-
}, _HiliteSet_change = function _HiliteSet_change(func) {
|
|
190
|
-
const changing = __classPrivateFieldGet(this, _HiliteSet_changing, "f");
|
|
191
|
-
__classPrivateFieldSet(this, _HiliteSet_changing, true, "f");
|
|
192
|
-
try {
|
|
193
|
-
func();
|
|
194
|
-
}
|
|
195
|
-
finally {
|
|
196
|
-
__classPrivateFieldSet(this, _HiliteSet_changing, changing, "f");
|
|
197
|
-
}
|
|
198
|
-
__classPrivateFieldGet(this, _HiliteSet_instances, "m", _HiliteSet_onChanged).call(this);
|
|
199
|
-
}, _HiliteSet_processSelectionSetEvent = function _HiliteSet_processSelectionSetEvent(ev) {
|
|
200
|
-
switch (ev.type) {
|
|
201
|
-
case SelectionSetEventType.Add:
|
|
202
|
-
return this.add(ev.additions);
|
|
203
|
-
case SelectionSetEventType.Replace:
|
|
204
|
-
return __classPrivateFieldGet(this, _HiliteSet_instances, "m", _HiliteSet_change).call(this, () => {
|
|
205
|
-
this.add(ev.additions);
|
|
206
|
-
this.remove(ev.removals);
|
|
207
|
-
});
|
|
208
|
-
case SelectionSetEventType.Remove:
|
|
209
|
-
case SelectionSetEventType.Clear:
|
|
210
|
-
return this.remove(ev.removals);
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
204
|
/** A set of *currently selected* geometric elements, models and subcategories for an `IModelConnection`.
|
|
214
205
|
* Generally, selected elements are displayed with a customizable hilite effect within a [[Viewport]], see [[HiliteSet]].
|
|
215
206
|
* @see [Hilite.Settings]($common) for customization of the hilite effect.
|
|
@@ -217,41 +208,44 @@ _HiliteSet_mode = new WeakMap(), _HiliteSet_selectionChangesListener = new WeakM
|
|
|
217
208
|
* @extensions
|
|
218
209
|
*/
|
|
219
210
|
export class SelectionSet {
|
|
211
|
+
#selection;
|
|
220
212
|
/** The IDs of the selected elements.
|
|
221
213
|
* @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].
|
|
222
214
|
*/
|
|
223
215
|
get elements() {
|
|
224
|
-
return
|
|
216
|
+
return this.#selection.elements;
|
|
225
217
|
}
|
|
226
218
|
/** The IDs of the selected models.
|
|
227
219
|
* @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].
|
|
228
220
|
*/
|
|
229
221
|
get models() {
|
|
230
|
-
return
|
|
222
|
+
return this.#selection.models;
|
|
231
223
|
}
|
|
232
224
|
/** The IDs of the selected subcategories.
|
|
233
225
|
* @note Do not modify this set directly. Instead, use methods like [[SelectionSet.add]].
|
|
234
226
|
*/
|
|
235
227
|
get subcategories() {
|
|
236
|
-
return
|
|
228
|
+
return this.#selection.subcategories;
|
|
237
229
|
}
|
|
238
230
|
/** Get the active selection as a collection of geometric element, model and subcategory ids.
|
|
239
231
|
* @note Do not modify the sets in returned collection directly. Instead, use methods like [[SelectionSet.add]].
|
|
240
232
|
*/
|
|
241
233
|
get active() {
|
|
242
|
-
return { ...
|
|
234
|
+
return { ...this.#selection };
|
|
243
235
|
}
|
|
244
236
|
constructor(iModel) {
|
|
245
|
-
_SelectionSet_instances.add(this);
|
|
246
237
|
this.iModel = iModel;
|
|
247
|
-
_SelectionSet_selection.set(this, void 0);
|
|
248
238
|
/** Called whenever ids are added or removed from this `SelectionSet` */
|
|
249
239
|
this.onChanged = new BeEvent();
|
|
250
|
-
|
|
240
|
+
this.#selection = {
|
|
251
241
|
elements: new Set(),
|
|
252
242
|
models: new Set(),
|
|
253
243
|
subcategories: new Set(),
|
|
254
|
-
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
#sendChangedEvent(ev) {
|
|
247
|
+
IModelApp.viewManager.onSelectionSetChanged(this.iModel);
|
|
248
|
+
this.onChanged.raiseEvent(ev);
|
|
255
249
|
}
|
|
256
250
|
/** Get the number of entries in this selection set. */
|
|
257
251
|
get size() {
|
|
@@ -282,13 +276,13 @@ export class SelectionSet {
|
|
|
282
276
|
if (!this.isActive) {
|
|
283
277
|
return;
|
|
284
278
|
}
|
|
285
|
-
const removals =
|
|
286
|
-
|
|
279
|
+
const removals = this.#selection;
|
|
280
|
+
this.#selection = {
|
|
287
281
|
elements: new Set(),
|
|
288
282
|
models: new Set(),
|
|
289
283
|
subcategories: new Set(),
|
|
290
|
-
}
|
|
291
|
-
|
|
284
|
+
};
|
|
285
|
+
this.#sendChangedEvent({ set: this, type: SelectionSetEventType.Clear, removals, removed: removals.elements });
|
|
292
286
|
}
|
|
293
287
|
/**
|
|
294
288
|
* Add one or more Ids to the current selection set.
|
|
@@ -296,7 +290,42 @@ export class SelectionSet {
|
|
|
296
290
|
* @returns true if any elements were added.
|
|
297
291
|
*/
|
|
298
292
|
add(adds) {
|
|
299
|
-
return !!
|
|
293
|
+
return !!this.#add(adds);
|
|
294
|
+
}
|
|
295
|
+
#add(adds, sendEvent = true) {
|
|
296
|
+
const oldSize = this.size;
|
|
297
|
+
const additions = {};
|
|
298
|
+
forEachSelectableType({
|
|
299
|
+
ids: adds,
|
|
300
|
+
elements: (elementIds) => addIds({
|
|
301
|
+
target: this.#selection.elements,
|
|
302
|
+
ids: elementIds,
|
|
303
|
+
onAdd: (id) => (additions.elements ??= []).push(id),
|
|
304
|
+
}),
|
|
305
|
+
models: (modelIds) => addIds({
|
|
306
|
+
target: this.#selection.models,
|
|
307
|
+
ids: modelIds,
|
|
308
|
+
onAdd: (id) => (additions.models ??= []).push(id),
|
|
309
|
+
}),
|
|
310
|
+
subcategories: (subcategoryIds) => addIds({
|
|
311
|
+
target: this.#selection.subcategories,
|
|
312
|
+
ids: subcategoryIds,
|
|
313
|
+
onAdd: (id) => (additions.subcategories ??= []).push(id),
|
|
314
|
+
}),
|
|
315
|
+
});
|
|
316
|
+
const changed = oldSize !== this.size;
|
|
317
|
+
if (!changed) {
|
|
318
|
+
return undefined;
|
|
319
|
+
}
|
|
320
|
+
if (sendEvent) {
|
|
321
|
+
this.#sendChangedEvent({
|
|
322
|
+
type: SelectionSetEventType.Add,
|
|
323
|
+
set: this,
|
|
324
|
+
additions,
|
|
325
|
+
added: additions.elements ?? [],
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return additions;
|
|
300
329
|
}
|
|
301
330
|
/**
|
|
302
331
|
* Remove one or more Ids from the current selection set.
|
|
@@ -304,19 +333,54 @@ export class SelectionSet {
|
|
|
304
333
|
* @returns true if any elements were removed.
|
|
305
334
|
*/
|
|
306
335
|
remove(removes) {
|
|
307
|
-
return !!
|
|
336
|
+
return !!this.#remove(removes);
|
|
337
|
+
}
|
|
338
|
+
#remove(removes, sendEvent = true) {
|
|
339
|
+
const oldSize = this.size;
|
|
340
|
+
const removals = {};
|
|
341
|
+
forEachSelectableType({
|
|
342
|
+
ids: removes,
|
|
343
|
+
elements: (elementIds) => removeIds({
|
|
344
|
+
target: this.#selection.elements,
|
|
345
|
+
ids: elementIds,
|
|
346
|
+
onRemove: (id) => (removals.elements ??= []).push(id),
|
|
347
|
+
}),
|
|
348
|
+
models: (modelIds) => removeIds({
|
|
349
|
+
target: this.#selection.models,
|
|
350
|
+
ids: modelIds,
|
|
351
|
+
onRemove: (id) => (removals.models ??= []).push(id),
|
|
352
|
+
}),
|
|
353
|
+
subcategories: (subcategoryIds) => removeIds({
|
|
354
|
+
target: this.#selection.subcategories,
|
|
355
|
+
ids: subcategoryIds,
|
|
356
|
+
onRemove: (id) => (removals.subcategories ??= []).push(id),
|
|
357
|
+
}),
|
|
358
|
+
});
|
|
359
|
+
const changed = oldSize !== this.size;
|
|
360
|
+
if (!changed) {
|
|
361
|
+
return undefined;
|
|
362
|
+
}
|
|
363
|
+
if (sendEvent) {
|
|
364
|
+
this.#sendChangedEvent({
|
|
365
|
+
type: SelectionSetEventType.Remove,
|
|
366
|
+
set: this,
|
|
367
|
+
removals,
|
|
368
|
+
removed: removals.elements ?? [],
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
return removals;
|
|
308
372
|
}
|
|
309
373
|
/**
|
|
310
374
|
* Add one set of Ids, and remove another set of Ids. Any Ids that are in both sets are removed.
|
|
311
375
|
* @returns True if any Ids were either added or removed.
|
|
312
376
|
*/
|
|
313
377
|
addAndRemove(adds, removes) {
|
|
314
|
-
const additions =
|
|
315
|
-
const removals =
|
|
378
|
+
const additions = this.#add(adds, false);
|
|
379
|
+
const removals = this.#remove(removes, false);
|
|
316
380
|
const addedElements = additions?.elements ?? [];
|
|
317
381
|
const removedElements = removals?.elements ?? [];
|
|
318
382
|
if (additions && removals) {
|
|
319
|
-
|
|
383
|
+
this.#sendChangedEvent({
|
|
320
384
|
type: SelectionSetEventType.Replace,
|
|
321
385
|
set: this,
|
|
322
386
|
additions,
|
|
@@ -326,7 +390,7 @@ export class SelectionSet {
|
|
|
326
390
|
});
|
|
327
391
|
}
|
|
328
392
|
else if (additions) {
|
|
329
|
-
|
|
393
|
+
this.#sendChangedEvent({
|
|
330
394
|
type: SelectionSetEventType.Add,
|
|
331
395
|
set: this,
|
|
332
396
|
additions,
|
|
@@ -334,7 +398,7 @@ export class SelectionSet {
|
|
|
334
398
|
});
|
|
335
399
|
}
|
|
336
400
|
else if (removals) {
|
|
337
|
-
|
|
401
|
+
this.#sendChangedEvent({
|
|
338
402
|
type: SelectionSetEventType.Remove,
|
|
339
403
|
set: this,
|
|
340
404
|
removals,
|
|
@@ -369,20 +433,20 @@ export class SelectionSet {
|
|
|
369
433
|
}
|
|
370
434
|
/** Change selection set to be the supplied set of Ids. */
|
|
371
435
|
replace(ids) {
|
|
372
|
-
if (areEqual(
|
|
436
|
+
if (areEqual(this.#selection, ids)) {
|
|
373
437
|
return false;
|
|
374
438
|
}
|
|
375
|
-
const previousSelection =
|
|
376
|
-
|
|
439
|
+
const previousSelection = this.#selection;
|
|
440
|
+
this.#selection = {
|
|
377
441
|
elements: new Set(),
|
|
378
442
|
models: new Set(),
|
|
379
443
|
subcategories: new Set(),
|
|
380
|
-
}
|
|
381
|
-
|
|
444
|
+
};
|
|
445
|
+
this.#add(ids, false);
|
|
382
446
|
const additions = {};
|
|
383
447
|
const removals = {};
|
|
384
448
|
forEachSelectableType({
|
|
385
|
-
ids:
|
|
449
|
+
ids: this.#selection,
|
|
386
450
|
elements: (elementIds) => {
|
|
387
451
|
removeIds({
|
|
388
452
|
target: previousSelection.elements,
|
|
@@ -414,7 +478,7 @@ export class SelectionSet {
|
|
|
414
478
|
}
|
|
415
479
|
},
|
|
416
480
|
});
|
|
417
|
-
|
|
481
|
+
this.#sendChangedEvent({
|
|
418
482
|
type: SelectionSetEventType.Replace,
|
|
419
483
|
set: this,
|
|
420
484
|
additions,
|
|
@@ -425,78 +489,6 @@ export class SelectionSet {
|
|
|
425
489
|
return true;
|
|
426
490
|
}
|
|
427
491
|
}
|
|
428
|
-
_SelectionSet_selection = new WeakMap(), _SelectionSet_instances = new WeakSet(), _SelectionSet_sendChangedEvent = function _SelectionSet_sendChangedEvent(ev) {
|
|
429
|
-
IModelApp.viewManager.onSelectionSetChanged(this.iModel);
|
|
430
|
-
this.onChanged.raiseEvent(ev);
|
|
431
|
-
}, _SelectionSet_add = function _SelectionSet_add(adds, sendEvent = true) {
|
|
432
|
-
const oldSize = this.size;
|
|
433
|
-
const additions = {};
|
|
434
|
-
forEachSelectableType({
|
|
435
|
-
ids: adds,
|
|
436
|
-
elements: (elementIds) => addIds({
|
|
437
|
-
target: __classPrivateFieldGet(this, _SelectionSet_selection, "f").elements,
|
|
438
|
-
ids: elementIds,
|
|
439
|
-
onAdd: (id) => (additions.elements ??= []).push(id),
|
|
440
|
-
}),
|
|
441
|
-
models: (modelIds) => addIds({
|
|
442
|
-
target: __classPrivateFieldGet(this, _SelectionSet_selection, "f").models,
|
|
443
|
-
ids: modelIds,
|
|
444
|
-
onAdd: (id) => (additions.models ??= []).push(id),
|
|
445
|
-
}),
|
|
446
|
-
subcategories: (subcategoryIds) => addIds({
|
|
447
|
-
target: __classPrivateFieldGet(this, _SelectionSet_selection, "f").subcategories,
|
|
448
|
-
ids: subcategoryIds,
|
|
449
|
-
onAdd: (id) => (additions.subcategories ??= []).push(id),
|
|
450
|
-
}),
|
|
451
|
-
});
|
|
452
|
-
const changed = oldSize !== this.size;
|
|
453
|
-
if (!changed) {
|
|
454
|
-
return undefined;
|
|
455
|
-
}
|
|
456
|
-
if (sendEvent) {
|
|
457
|
-
__classPrivateFieldGet(this, _SelectionSet_instances, "m", _SelectionSet_sendChangedEvent).call(this, {
|
|
458
|
-
type: SelectionSetEventType.Add,
|
|
459
|
-
set: this,
|
|
460
|
-
additions,
|
|
461
|
-
added: additions.elements ?? [],
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
return additions;
|
|
465
|
-
}, _SelectionSet_remove = function _SelectionSet_remove(removes, sendEvent = true) {
|
|
466
|
-
const oldSize = this.size;
|
|
467
|
-
const removals = {};
|
|
468
|
-
forEachSelectableType({
|
|
469
|
-
ids: removes,
|
|
470
|
-
elements: (elementIds) => removeIds({
|
|
471
|
-
target: __classPrivateFieldGet(this, _SelectionSet_selection, "f").elements,
|
|
472
|
-
ids: elementIds,
|
|
473
|
-
onRemove: (id) => (removals.elements ??= []).push(id),
|
|
474
|
-
}),
|
|
475
|
-
models: (modelIds) => removeIds({
|
|
476
|
-
target: __classPrivateFieldGet(this, _SelectionSet_selection, "f").models,
|
|
477
|
-
ids: modelIds,
|
|
478
|
-
onRemove: (id) => (removals.models ??= []).push(id),
|
|
479
|
-
}),
|
|
480
|
-
subcategories: (subcategoryIds) => removeIds({
|
|
481
|
-
target: __classPrivateFieldGet(this, _SelectionSet_selection, "f").subcategories,
|
|
482
|
-
ids: subcategoryIds,
|
|
483
|
-
onRemove: (id) => (removals.subcategories ??= []).push(id),
|
|
484
|
-
}),
|
|
485
|
-
});
|
|
486
|
-
const changed = oldSize !== this.size;
|
|
487
|
-
if (!changed) {
|
|
488
|
-
return undefined;
|
|
489
|
-
}
|
|
490
|
-
if (sendEvent) {
|
|
491
|
-
__classPrivateFieldGet(this, _SelectionSet_instances, "m", _SelectionSet_sendChangedEvent).call(this, {
|
|
492
|
-
type: SelectionSetEventType.Remove,
|
|
493
|
-
set: this,
|
|
494
|
-
removals,
|
|
495
|
-
removed: removals.elements ?? [],
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
return removals;
|
|
499
|
-
};
|
|
500
492
|
function forEachSelectableType({ ids, elements, models, subcategories, }) {
|
|
501
493
|
if (typeof ids === "string" || Array.isArray(ids) || ids instanceof Set) {
|
|
502
494
|
elements(ids);
|