@itwin/core-frontend 3.3.0-dev.52 → 3.3.0-dev.55

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.
Files changed (45) hide show
  1. package/lib/cjs/IModelConnection.d.ts +42 -2
  2. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  3. package/lib/cjs/IModelConnection.js +27 -1
  4. package/lib/cjs/IModelConnection.js.map +1 -1
  5. package/lib/cjs/SelectionSet.d.ts +30 -4
  6. package/lib/cjs/SelectionSet.d.ts.map +1 -1
  7. package/lib/cjs/SelectionSet.js +26 -2
  8. package/lib/cjs/SelectionSet.js.map +1 -1
  9. package/lib/cjs/SubCategoriesCache.d.ts +3 -0
  10. package/lib/cjs/SubCategoriesCache.d.ts.map +1 -1
  11. package/lib/cjs/SubCategoriesCache.js +34 -0
  12. package/lib/cjs/SubCategoriesCache.js.map +1 -1
  13. package/lib/cjs/render/webgl/DrawCommand.js +1 -1
  14. package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
  15. package/lib/cjs/render/webgl/FeatureOverrides.d.ts +4 -1
  16. package/lib/cjs/render/webgl/FeatureOverrides.d.ts.map +1 -1
  17. package/lib/cjs/render/webgl/FeatureOverrides.js +56 -26
  18. package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
  19. package/lib/cjs/render/webgl/Target.d.ts +2 -1
  20. package/lib/cjs/render/webgl/Target.d.ts.map +1 -1
  21. package/lib/cjs/render/webgl/Target.js +1 -0
  22. package/lib/cjs/render/webgl/Target.js.map +1 -1
  23. package/lib/esm/IModelConnection.d.ts +42 -2
  24. package/lib/esm/IModelConnection.d.ts.map +1 -1
  25. package/lib/esm/IModelConnection.js +27 -1
  26. package/lib/esm/IModelConnection.js.map +1 -1
  27. package/lib/esm/SelectionSet.d.ts +30 -4
  28. package/lib/esm/SelectionSet.d.ts.map +1 -1
  29. package/lib/esm/SelectionSet.js +26 -2
  30. package/lib/esm/SelectionSet.js.map +1 -1
  31. package/lib/esm/SubCategoriesCache.d.ts +3 -0
  32. package/lib/esm/SubCategoriesCache.d.ts.map +1 -1
  33. package/lib/esm/SubCategoriesCache.js +34 -0
  34. package/lib/esm/SubCategoriesCache.js.map +1 -1
  35. package/lib/esm/render/webgl/DrawCommand.js +1 -1
  36. package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
  37. package/lib/esm/render/webgl/FeatureOverrides.d.ts +4 -1
  38. package/lib/esm/render/webgl/FeatureOverrides.d.ts.map +1 -1
  39. package/lib/esm/render/webgl/FeatureOverrides.js +56 -26
  40. package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
  41. package/lib/esm/render/webgl/Target.d.ts +2 -1
  42. package/lib/esm/render/webgl/Target.d.ts.map +1 -1
  43. package/lib/esm/render/webgl/Target.js +1 -0
  44. package/lib/esm/render/webgl/Target.js.map +1 -1
  45. package/package.json +20 -20
@@ -68,13 +68,27 @@ export interface SelectReplaceEvent {
68
68
  * @extensions
69
69
  */
70
70
  export declare type SelectionSetEvent = SelectAddEvent | SelectRemoveEvent | SelectReplaceEvent;
71
+ /** Describes how the sets of hilited models and subcategories in a [[HiliteSet]] interact.
72
+ * - "union" indicates a [Feature]($common) will be hilited if either its model **or** its subcategory is present in the HiliteSet.
73
+ * - "intersection" indicates a [Feature]($common) will be hilited only if both its model **and** its subcategory are present in the HiliteSet.
74
+ *
75
+ * @see [[HiliteSet.modelSubCategoryMode]] to change the mode for a HiliteSet.
76
+ * @public
77
+ */
78
+ export declare type ModelSubCategoryHiliteMode = "union" | "intersection";
71
79
  /** A set of *hilited* elements for an [[IModelConnection]], by element id.
72
80
  * Hilited elements are displayed with a customizable hilite effect within a [[Viewport]].
73
- * The set exposes 3 types of elements in 3 separate collections: geometric elements, subcategories, and geometric models.
81
+ * The set exposes 3 types of elements in 3 separate collections: [GeometricElement]($backend), [GeometricModel]($backend), and [SubCategory]($backend).
82
+ * The [[models]] and [[subcategories]] can be hilited independently or as an intersection of the two sets, as specified by [[modelSubCategoryMode]].
83
+ *
84
+ * Technically, the hilite effect is applied to [Feature]($common)s, not [Element]($backend)s. An element's geometry stream can contain multiple
85
+ * features belonging to different subcategories.
86
+ *
87
+ * Because Javascript lacks efficient support for 64-bit integers, the Ids are stored as pairs of 32-bit integers via [Id64.Uint32Set]($bentley).
88
+ *
74
89
  * @note Typically, elements are hilited by virtue of their presence in the IModelConnection's [[SelectionSet]]. The HiliteSet allows additional
75
90
  * elements to be displayed with the hilite effect without adding them to the [[SelectionSet]]. If you add elements to the HiliteSet directly, you
76
91
  * are also responsible for removing them as appropriate.
77
- * @note Support for subcategories and geometric models in the HiliteSet is currently `beta`.
78
92
  * @see [[IModelConnection.hilited]] for the HiliteSet associated with an iModel.
79
93
  * @see [Hilite.Settings]($common) for customization of the hilite effect.
80
94
  * @public
@@ -83,16 +97,28 @@ export declare type SelectionSetEvent = SelectAddEvent | SelectRemoveEvent | Sel
83
97
  export declare class HiliteSet {
84
98
  iModel: IModelConnection;
85
99
  private readonly _elements;
100
+ private _mode;
86
101
  /** The set of hilited subcategories.
87
- * @beta
102
+ * @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[models]].
103
+ * @see [[IModelConnection.Categories]] to obtain the set of subcategories associated with one or more [Category]($backend)'s.
88
104
  */
89
105
  readonly subcategories: Id64.Uint32Set;
90
106
  /** The set of hilited [[GeometricModelState]]s.
91
- * @beta
107
+ * @see [[modelSubCategoryMode]] to control how this set interacts with the set of hilited [[subcategories]].
92
108
  */
93
109
  readonly models: Id64.Uint32Set;
94
110
  /** The set of hilited elements. */
95
111
  get elements(): Id64.Uint32Set;
112
+ /** Controls how the sets of hilited [[models]] and [[subcategories]] interact with one another.
113
+ * By default they are treated as a union: a [Feature]($common) is hilited if either its model **or** its subcategory is hilited.
114
+ * This can be changed to an intersection such that a [Feature]($common) is hilited only if both its model **and** subcategory are hilited.
115
+ * @note The sets of hilited models and subcategories are independent of the set of hilited [[elements]] - an element whose Id is present in
116
+ * [[elements]] is always hilited regardless of its model or subcategories.
117
+ */
118
+ get modelSubCategoryMode(): ModelSubCategoryHiliteMode;
119
+ set modelSubCategoryMode(mode: ModelSubCategoryHiliteMode);
120
+ /** Event raised just before changing the value of [[modelSubCategoryMode]]. */
121
+ readonly onModelSubCategoryModeChanged: BeEvent<(newMode: ModelSubCategoryHiliteMode) => void>;
96
122
  /** Construct a HiliteSet
97
123
  * @param iModel The iModel containing the entities to be hilited.
98
124
  * @param syncWithSelectionSet If true, the contents of the `elements` set will be synchronized with those in the `iModel`'s [[SelectionSet]].
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionSet.d.ts","sourceRoot":"","sources":["../../src/SelectionSet.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,2CAA2C;IAC3C,GAAG,IAAA;IACH,+CAA+C;IAC/C,MAAM,IAAA;IACN,6EAA6E;IAC7E,OAAO,IAAA;IACP,yDAAyD;IACzD,KAAK,IAAA;CACN;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,qBAAqB,CAAC,GAAG,CAAC;IAChC,gDAAgD;IAChD,KAAK,EAAE,OAAO,CAAC;IACf,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,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,GAAG,EAAE,YAAY,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,qBAAqB,CAAC,OAAO,CAAC;I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OAAO,EAAqD;IAEtG,gDAAgD;IACzC,KAAK;IAMZ,0CAA0C;IAC1C,IAAW,OAAO,IAAI,OAAO,CAAuF;IAEpH;;;OAGG;IACI,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAUrD;AAED;;;;;GAKG;AACH,qBAAa,YAAY;IAWG,MAAM,EAAE,gBAAgB;IAVlD,OAAO,CAAC,SAAS,CAAqB;IAEtC;;OAEG;IACH,IAAW,QAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,CAA2B;IAE7D,2EAA2E;IAC3E,SAAgB,SAAS,eAAoB,iBAAiB,KAAK,IAAI,EAAI;gBAEjD,MAAM,EAAE,gBAAgB;IAElD,OAAO,CAAC,gBAAgB;IAKxB,uDAAuD;IACvD,IAAW,IAAI,WAAiC;IAEhD,qDAAqD;IACrD,IAAW,QAAQ,YAA8B;IAEjD;;OAEG;IACI,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM;IAE1B;;OAEG;IACI,UAAU,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO;IAE/C;;OAEG;IACI,QAAQ,IAAI,IAAI;IASvB;;;;OAIG;IACI,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAIlC,OAAO,CAAC,IAAI;IAYZ;;;;OAIG;IACI,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAIrC,OAAO,CAAC,OAAO;IAYf;;;OAGG;IACI,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IAc7D,2DAA2D;IACpD,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAarC,0DAA0D;IACnD,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;CAiBpC"}
@@ -96,11 +96,17 @@ class HilitedElementIds extends HilitedIds {
96
96
  }
97
97
  /** A set of *hilited* elements for an [[IModelConnection]], by element id.
98
98
  * Hilited elements are displayed with a customizable hilite effect within a [[Viewport]].
99
- * The set exposes 3 types of elements in 3 separate collections: geometric elements, subcategories, and geometric models.
99
+ * The set exposes 3 types of elements in 3 separate collections: [GeometricElement]($backend), [GeometricModel]($backend), and [SubCategory]($backend).
100
+ * The [[models]] and [[subcategories]] can be hilited independently or as an intersection of the two sets, as specified by [[modelSubCategoryMode]].
101
+ *
102
+ * Technically, the hilite effect is applied to [Feature]($common)s, not [Element]($backend)s. An element's geometry stream can contain multiple
103
+ * features belonging to different subcategories.
104
+ *
105
+ * Because Javascript lacks efficient support for 64-bit integers, the Ids are stored as pairs of 32-bit integers via [Id64.Uint32Set]($bentley).
106
+ *
100
107
  * @note Typically, elements are hilited by virtue of their presence in the IModelConnection's [[SelectionSet]]. The HiliteSet allows additional
101
108
  * elements to be displayed with the hilite effect without adding them to the [[SelectionSet]]. If you add elements to the HiliteSet directly, you
102
109
  * are also responsible for removing them as appropriate.
103
- * @note Support for subcategories and geometric models in the HiliteSet is currently `beta`.
104
110
  * @see [[IModelConnection.hilited]] for the HiliteSet associated with an iModel.
105
111
  * @see [Hilite.Settings]($common) for customization of the hilite effect.
106
112
  * @public
@@ -114,12 +120,30 @@ export class HiliteSet {
114
120
  */
115
121
  constructor(iModel, syncWithSelectionSet = true) {
116
122
  this.iModel = iModel;
123
+ this._mode = "union";
124
+ /** Event raised just before changing the value of [[modelSubCategoryMode]]. */
125
+ this.onModelSubCategoryModeChanged = new BeEvent();
117
126
  this._elements = new HilitedElementIds(iModel, syncWithSelectionSet);
118
127
  this.subcategories = new HilitedIds(iModel);
119
128
  this.models = new HilitedIds(iModel);
120
129
  }
121
130
  /** The set of hilited elements. */
122
131
  get elements() { return this._elements; }
132
+ /** Controls how the sets of hilited [[models]] and [[subcategories]] interact with one another.
133
+ * By default they are treated as a union: a [Feature]($common) is hilited if either its model **or** its subcategory is hilited.
134
+ * This can be changed to an intersection such that a [Feature]($common) is hilited only if both its model **and** subcategory are hilited.
135
+ * @note The sets of hilited models and subcategories are independent of the set of hilited [[elements]] - an element whose Id is present in
136
+ * [[elements]] is always hilited regardless of its model or subcategories.
137
+ */
138
+ get modelSubCategoryMode() {
139
+ return this._mode;
140
+ }
141
+ set modelSubCategoryMode(mode) {
142
+ if (mode === this._mode)
143
+ return;
144
+ this.onModelSubCategoryModeChanged.raiseEvent(mode);
145
+ this._mode = mode;
146
+ }
123
147
  /** Control whether the hilited elements will be synchronized with the contents of the [[SelectionSet]].
124
148
  * By default they are synchronized. Applications that override this take responsibility for managing the set of hilited entities.
125
149
  * When turning synchronization off, the contents of the HiliteSet will remain unchanged.
@@ -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,uEAAO,CAAA;IACP,yDAAyD;IACzD,mEAAK,CAAA;AACP,CAAC,EATW,qBAAqB,KAArB,qBAAqB,QAShC;AAyDD;;GAEG;AACH,MAAM,UAAW,SAAQ,IAAI,CAAC,SAAS;IAIrC,YAAmB,MAAwB;QACzC,KAAK,EAAE,CAAC;QAHA,cAAS,GAAG,KAAK,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEe,GAAG,CAAC,GAAW,EAAE,IAAY;QAC3C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAEe,MAAM,CAAC,GAAW,EAAE,IAAY;QAC9C,KAAK,CAAC,MAAM,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K,CAAC,CAAC;QAEvB,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE;YACpB,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/** 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: geometric elements, subcategories, and geometric models.\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 * @note Support for subcategories and geometric models in the HiliteSet is currently `beta`.\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\r\n /** The set of hilited subcategories.\r\n * @beta\r\n */\r\n public readonly subcategories: Id64.Uint32Set;\r\n /** The set of hilited [[GeometricModelState]]s.\r\n * @beta\r\n */\r\n public readonly models: Id64.Uint32Set;\r\n /** The set of hilited elements. */\r\n public get elements(): Id64.Uint32Set { return this._elements; }\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 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 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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G,OAAO,CAAC,IAAI,EAAE;YACpB,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 * @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 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 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"]}
@@ -50,6 +50,9 @@ export declare class SubCategoriesCache {
50
50
  private static createSubCategoryAppearance;
51
51
  private processResults;
52
52
  private add;
53
+ getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>>;
54
+ getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>>;
55
+ private mapSubCategoryInfos;
53
56
  }
54
57
  /** This namespace and the types within it are exported strictly for use in tests.
55
58
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoriesCache.d.ts","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAkB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9J,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,2BAA2B;IAC3B,MAAM,IAAI,IAAI,CAAC;CAChB;AAID;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4C;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,uBAAuB,CAAsB;gBAElC,MAAM,EAAE,gBAAgB;IAE3C,wIAAwI;IACjI,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAEhE,wHAAwH;IACjH,wBAAwB,CAAC,aAAa,EAAE,UAAU,GAAG,qBAAqB,GAAG,SAAS;IAE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EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,SAAM;QAW3F,MAAM;QAEA,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;KA4BrD;IAED,KAAY,SAAS,GAAG,MAAM,IAAI,CAAC;IAEnC,MAAa,UAAU;QACrB,SAAgB,WAAW,EAAE,OAAO,CAAC;QACrC,SAAgB,KAAK,EAAE,SAAS,EAAE,CAAC;oBAEhB,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;KAIzD;IAED;;;;;OAKG;IACH,MAAa,KAAK;QAEhB,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;QAChC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;QAC7B,SAAS,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;QAC1C,SAAS,CAAC,SAAS,UAAS;QAE5B;;WAEG;QACI,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;QASnF,+CAA+C;QACxC,OAAO,IAAI,IAAI;QAWtB,IAAW,OAAO,IAAI,OAAO,CAE5B;QAED,OAAO,CAAC,WAAW;QAgBnB,OAAO,CAAC,cAAc;QAoCtB,OAAO,CAAC,QAAQ;KAgBjB;CACF"}
@@ -102,6 +102,40 @@ export class SubCategoriesCache {
102
102
  set.add(subCategoryId);
103
103
  this._appearances.set(subCategoryId, appearance);
104
104
  }
105
+ async getCategoryInfo(inputCategoryIds) {
106
+ // Eliminate duplicates...
107
+ const categoryIds = new Set(typeof inputCategoryIds === "string" ? [inputCategoryIds] : inputCategoryIds);
108
+ const req = this.load(categoryIds);
109
+ if (req)
110
+ await req.promise;
111
+ const map = new Map();
112
+ for (const categoryId of categoryIds) {
113
+ const subCategoryIds = this._byCategoryId.get(categoryId);
114
+ if (!subCategoryIds)
115
+ continue;
116
+ const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);
117
+ map.set(categoryId, { id: categoryId, subCategories });
118
+ }
119
+ return map;
120
+ }
121
+ async getSubCategoryInfo(categoryId, inputSubCategoryIds) {
122
+ // Eliminate duplicates...
123
+ const subCategoryIds = new Set(typeof inputSubCategoryIds === "string" ? [inputSubCategoryIds] : inputSubCategoryIds);
124
+ const req = this.load(categoryId);
125
+ if (req)
126
+ await req.promise;
127
+ return this.mapSubCategoryInfos(categoryId, subCategoryIds);
128
+ }
129
+ mapSubCategoryInfos(categoryId, subCategoryIds) {
130
+ const map = new Map();
131
+ for (const id of subCategoryIds) {
132
+ const appearance = this._appearances.get(id);
133
+ assert(undefined !== appearance);
134
+ if (appearance)
135
+ map.set(id, { id, categoryId, appearance });
136
+ }
137
+ return map;
138
+ }
105
139
  }
106
140
  /** This namespace and the types within it are exported strictly for use in tests.
107
141
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAgC,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAA+D,cAAc,EAAE,qBAAqB,EAAwB,MAAM,oBAAoB,CAAC;AAkB9J,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAM7B,YAAmB,MAAwB;QAL1B,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC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AI,CAAC,WAAW,CAAC,CAAC;oBAC7C,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,EAAE;wBAC/B,yBAAyB;wBACzB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;4BAC3B,IAAI,EAAE,CAAC;qBACV;yBAAM;wBACL,kFAAkF;wBAClF,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;qBAClC;iBACF;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAEO,QAAQ,CAAC,WAAoB,EAAE,IAAe;YACpD,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpC,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;YAEpC,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,EAAE;gBAC5B,2DAA2D;gBAC3D,sJAAsJ;gBACtJ,iIAAiI;gBACjI,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;aACpE;iBAAM;gBACL,mGAAmG;gBACnG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;oBACjD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;aAC1C;QACH,CAAC;KACF;IAvGY,wBAAK,QAuGjB,CAAA;AACH,CAAC,EAlLgB,kBAAkB,KAAlB,kBAAkB,QAkLlC","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\r\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String } from \"@itwin/core-bentley\";\r\nimport { HydrateViewStateRequestProps, HydrateViewStateResponseProps, QueryRowFormat, SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A cancelable paginated request for subcategory information.\r\n * @see SubCategoriesCache\r\n * @internal\r\n */\r\nexport interface SubCategoriesRequest {\r\n /** The Ids of any categories which were requested but were not yet loaded. */\r\n readonly missingCategoryIds: Id64Set;\r\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\r\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\r\n */\r\n readonly promise: Promise<boolean>;\r\n /** Cancels the request. */\r\n cancel(): void;\r\n}\r\n\r\nconst invalidCategoryIdEntry = new Set<string>();\r\n\r\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\r\n * @internal\r\n */\r\nexport class SubCategoriesCache {\r\n private readonly _byCategoryId = new Map<string, Id64Set>();\r\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\r\n private readonly _imodel: IModelConnection;\r\n private _missingAtTimeOfPreload: Id64Set | undefined;\r\n\r\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\r\n\r\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\r\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\r\n\r\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\r\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\r\n\r\n /** Request that the subcategory information for all of the specified categories is loaded.\r\n * If all such information has already been loaded, returns undefined.\r\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\r\n * containing the corresponding promise and the set of categories still to be loaded.\r\n */\r\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\r\n const missing = this.getMissing(categoryIds);\r\n if (undefined === missing)\r\n return undefined;\r\n\r\n const request = new SubCategoriesCache.Request(missing, this._imodel);\r\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\r\n if (undefined !== result)\r\n this.processResults(result, missing);\r\n\r\n return !request.wasCanceled;\r\n });\r\n\r\n return {\r\n missingCategoryIds: missing,\r\n promise,\r\n cancel: () => request.cancel(),\r\n };\r\n }\r\n\r\n /**\r\n * Populates the notLoadedCategoryIds property of the HydrateViewStateRequestProps.\r\n * notLoadedCategoryIds is a subset of categoryIds, filtering out any ids which already have an entry in the cache.\r\n */\r\n public preload(options: HydrateViewStateRequestProps, categoryIds: Id64Arg): void {\r\n const missing = this.getMissing(categoryIds);\r\n\r\n if (undefined === missing)\r\n return;\r\n this._missingAtTimeOfPreload = missing;\r\n options.notLoadedCategoryIds = CompressedId64Set.sortAndCompress(missing);\r\n }\r\n\r\n /**\r\n * Populates the SubCategoriesCache using the categoryIdsResult of the HydrateViewStateResponseProps\r\n */\r\n public postload(options: HydrateViewStateResponseProps): void {\r\n if (options.categoryIdsResult === undefined)\r\n return;\r\n // missingAtTimeOfPreload shouldn't be undefined if options.categoryIdsResult is defined... but just to be safe we'll check\r\n const missing = this._missingAtTimeOfPreload === undefined ? new Set<string>() : this._missingAtTimeOfPreload;\r\n this.processResults(options.categoryIdsResult, missing);\r\n // clear missing\r\n this._missingAtTimeOfPreload = undefined;\r\n }\r\n\r\n /** Given categoryIds, return which of these are not cached. */\r\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\r\n let missing: Id64Set | undefined;\r\n for (const catId of Id64.iterable(categoryIds)) {\r\n if (undefined === this._byCategoryId.get(catId)) {\r\n if (undefined === missing)\r\n missing = new Set<string>();\r\n\r\n missing.add(catId);\r\n }\r\n }\r\n return missing;\r\n }\r\n\r\n public clear(): void {\r\n this._byCategoryId.clear();\r\n this._appearances.clear();\r\n }\r\n\r\n public onIModelConnectionClose(): void {\r\n this.clear();\r\n }\r\n\r\n private static createSubCategoryAppearance(json?: any) {\r\n let props: SubCategoryAppearance.Props | undefined;\r\n if (\"string\" === typeof json && 0 < json.length)\r\n props = JSON.parse(json);\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set): void {\r\n for (const row of result)\r\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance));\r\n\r\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\r\n for (const id of missing)\r\n if (undefined === this._byCategoryId.get(id))\r\n this._byCategoryId.set(id, invalidCategoryIdEntry);\r\n }\r\n\r\n private add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance) {\r\n let set = this._byCategoryId.get(categoryId);\r\n if (undefined === set)\r\n this._byCategoryId.set(categoryId, set = new Set<string>());\r\n\r\n set.add(subCategoryId);\r\n this._appearances.set(subCategoryId, appearance);\r\n }\r\n}\r\n\r\n/** This namespace and the types within it are exported strictly for use in tests.\r\n * @internal\r\n */\r\nexport namespace SubCategoriesCache { // eslint-disable-line no-redeclare\r\n\r\n export type Result = SubCategoryResultRow[];\r\n\r\n export class Request {\r\n private readonly _imodel: IModelConnection;\r\n private readonly _ecsql: string[] = [];\r\n private readonly _result: Result = [];\r\n private _canceled = false;\r\n private _curECSqlIndex = 0;\r\n\r\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\r\n\r\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 200) {\r\n this._imodel = imodel;\r\n\r\n const catIds = [...categoryIds];\r\n while (catIds.length !== 0) {\r\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\r\n const where = catIds.splice(0, end).join(\",\");\r\n this._ecsql.push(`SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`);\r\n }\r\n }\r\n\r\n public cancel() { this._canceled = true; }\r\n\r\n public async dispatch(): Promise<Result | undefined> {\r\n if (this.wasCanceled || this._curECSqlIndex >= this._ecsql.length) // handle case of empty category Id set...\r\n return undefined;\r\n\r\n try {\r\n const ecsql = this._ecsql[this._curECSqlIndex];\r\n for await (const row of this._imodel.query(ecsql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\r\n this._result.push(row as SubCategoryResultRow);\r\n if (this.wasCanceled)\r\n return undefined;\r\n }\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n\r\n // Finished with current ECSql query. Dispatch the next if one exists.\r\n if (++this._curECSqlIndex < this._ecsql.length) {\r\n if (this.wasCanceled)\r\n return undefined;\r\n else\r\n return this.dispatch();\r\n }\r\n\r\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\r\n return this._result;\r\n }\r\n }\r\n\r\n export type QueueFunc = () => void;\r\n\r\n export class QueueEntry {\r\n public readonly categoryIds: Id64Set;\r\n public readonly funcs: QueueFunc[];\r\n\r\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\r\n this.categoryIds = categoryIds;\r\n this.funcs = [func];\r\n }\r\n }\r\n\r\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\r\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\r\n * opportunity to reduce the number of backend requests by batching consecutive requests.\r\n * Chiefly used by [[Viewport]].\r\n * @internal\r\n */\r\n export class Queue {\r\n /* NB: Members marked protected for use in tests only. */\r\n protected _current?: QueueEntry;\r\n protected _next?: QueueEntry;\r\n protected _request?: SubCategoriesRequest;\r\n protected _disposed = false;\r\n\r\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\r\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\r\n */\r\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n if (this._disposed)\r\n return;\r\n else if (undefined === this._current)\r\n this.pushCurrent(cache, categoryIds, func);\r\n else\r\n this.pushNext(categoryIds, func);\r\n }\r\n\r\n /** Cancel all requests and empty the queue. */\r\n public dispose(): void {\r\n if (undefined !== this._request) {\r\n assert(undefined !== this._current);\r\n this._request.cancel();\r\n this._request = undefined;\r\n }\r\n\r\n this._current = this._next = undefined;\r\n this._disposed = true;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return undefined === this._current && undefined === this._next;\r\n }\r\n\r\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined === this._next);\r\n assert(undefined === this._current);\r\n assert(undefined === this._request);\r\n\r\n this._request = cache.load(categoryIds);\r\n if (undefined === this._request) {\r\n // All requested categories are already loaded.\r\n func();\r\n return;\r\n } else {\r\n // We need to load the requested categories before invoking the function.\r\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\r\n }\r\n }\r\n\r\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\r\n assert(undefined !== this._request);\r\n assert(undefined === this._current);\r\n assert(undefined === this._next);\r\n\r\n this._current = entry;\r\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (this._disposed)\r\n return;\r\n\r\n // Invoke all the functions which were awaiting this set of categories.\r\n assert(undefined !== this._current);\r\n if (completed)\r\n for (const func of this._current.funcs)\r\n func();\r\n\r\n this._request = undefined;\r\n this._current = undefined;\r\n\r\n // If we have more requests, process them.\r\n const next = this._next;\r\n this._next = undefined;\r\n if (undefined !== next) {\r\n this._request = cache.load(next.categoryIds);\r\n if (undefined === this._request) {\r\n // All categories loaded.\r\n for (const func of next.funcs)\r\n func();\r\n } else {\r\n // We need to load the requested categories before invoking the pending functions.\r\n this.processCurrent(cache, next);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined !== this._current);\r\n assert(undefined !== this._request);\r\n\r\n if (undefined === this._next) {\r\n // We have a request currently in process and none pending.\r\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\r\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\r\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\r\n } else {\r\n // We have a request currently in process, and one or more pending. Append this one to the pending.\r\n this._next.funcs.push(func);\r\n for (const categoryId of Id64.iterable(categoryIds))\r\n this._next.categoryIds.add(categoryId);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SubCategoriesCache.js","sourceRoot":"","sources":["../../src/SubCategoriesCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAgC,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAA+D,cAAc,EAAE,qBAAqB,EAAwB,MAAM,oBAAoB,CAAC;AAkB9J,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAM7B,YAAmB,MAAwB;QAL1B,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAAC,CAAC;IAEvE,wIAAwI;IACjI,gBAAgB,CAAC,UAAkB,IAAyB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/G,wHAAwH;IACjH,wBAAwB,CAAC,aAAyB,IAAuC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzJ;;;;OAIG;IACI,IAAI,CAAC,WA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AuGjB,CAAA;AACH,CAAC,EAjLgB,kBAAkB,KAAlB,kBAAkB,QAiLlC","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\r\nimport { assert, CompressedId64Set, Id64, Id64Arg, Id64Set, Id64String } from \"@itwin/core-bentley\";\r\nimport { HydrateViewStateRequestProps, HydrateViewStateResponseProps, QueryRowFormat, SubCategoryAppearance, SubCategoryResultRow } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** A cancelable paginated request for subcategory information.\r\n * @see SubCategoriesCache\r\n * @internal\r\n */\r\nexport interface SubCategoriesRequest {\r\n /** The Ids of any categories which were requested but were not yet loaded. */\r\n readonly missingCategoryIds: Id64Set;\r\n /** A promise which resolves to true when all of the requested categories have been loaded, or to false if not all categories were loaded.\r\n * Categories may fail to load if the request is explicitly canceled or if the IModelConnection is closed before all categories are loaded.\r\n */\r\n readonly promise: Promise<boolean>;\r\n /** Cancels the request. */\r\n cancel(): void;\r\n}\r\n\r\nconst invalidCategoryIdEntry = new Set<string>();\r\n\r\n/** A cache of information about the subcategories contained within an [[IModelConnection]]. It is populated on demand.\r\n * @internal\r\n */\r\nexport class SubCategoriesCache {\r\n private readonly _byCategoryId = new Map<string, Id64Set>();\r\n private readonly _appearances = new Map<string, SubCategoryAppearance>();\r\n private readonly _imodel: IModelConnection;\r\n private _missingAtTimeOfPreload: Id64Set | undefined;\r\n\r\n public constructor(imodel: IModelConnection) { this._imodel = imodel; }\r\n\r\n /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */\r\n public getSubCategories(categoryId: string): Id64Set | undefined { return this._byCategoryId.get(categoryId); }\r\n\r\n /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */\r\n public getSubCategoryAppearance(subCategoryId: Id64String): SubCategoryAppearance | undefined { return this._appearances.get(subCategoryId.toString()); }\r\n\r\n /** Request that the subcategory information for all of the specified categories is loaded.\r\n * If all such information has already been loaded, returns undefined.\r\n * Otherwise, dispatches an asynchronous request to load those categories which are not already loaded and returns a cancellable request object\r\n * containing the corresponding promise and the set of categories still to be loaded.\r\n */\r\n public load(categoryIds: Id64Arg): SubCategoriesRequest | undefined {\r\n const missing = this.getMissing(categoryIds);\r\n if (undefined === missing)\r\n return undefined;\r\n\r\n const request = new SubCategoriesCache.Request(missing, this._imodel);\r\n const promise = request.dispatch().then((result?: SubCategoriesCache.Result) => {\r\n if (undefined !== result)\r\n this.processResults(result, missing);\r\n\r\n return !request.wasCanceled;\r\n });\r\n\r\n return {\r\n missingCategoryIds: missing,\r\n promise,\r\n cancel: () => request.cancel(),\r\n };\r\n }\r\n\r\n /**\r\n * Populates the notLoadedCategoryIds property of the HydrateViewStateRequestProps.\r\n * notLoadedCategoryIds is a subset of categoryIds, filtering out any ids which already have an entry in the cache.\r\n */\r\n public preload(options: HydrateViewStateRequestProps, categoryIds: Id64Arg): void {\r\n const missing = this.getMissing(categoryIds);\r\n\r\n if (undefined === missing)\r\n return;\r\n\r\n this._missingAtTimeOfPreload = missing;\r\n options.notLoadedCategoryIds = CompressedId64Set.sortAndCompress(missing);\r\n }\r\n\r\n /**\r\n * Populates the SubCategoriesCache using the categoryIdsResult of the HydrateViewStateResponseProps\r\n */\r\n public postload(options: HydrateViewStateResponseProps): void {\r\n if (options.categoryIdsResult === undefined)\r\n return;\r\n\r\n // missingAtTimeOfPreload shouldn't be undefined if options.categoryIdsResult is defined... but just to be safe we'll check\r\n const missing = this._missingAtTimeOfPreload === undefined ? new Set<string>() : this._missingAtTimeOfPreload;\r\n this.processResults(options.categoryIdsResult, missing);\r\n\r\n // clear missing\r\n this._missingAtTimeOfPreload = undefined;\r\n }\r\n\r\n /** Given categoryIds, return which of these are not cached. */\r\n private getMissing(categoryIds: Id64Arg): Id64Set | undefined {\r\n let missing: Id64Set | undefined;\r\n for (const catId of Id64.iterable(categoryIds)) {\r\n if (undefined === this._byCategoryId.get(catId)) {\r\n if (undefined === missing)\r\n missing = new Set<string>();\r\n\r\n missing.add(catId);\r\n }\r\n }\r\n\r\n return missing;\r\n }\r\n\r\n public clear(): void {\r\n this._byCategoryId.clear();\r\n this._appearances.clear();\r\n }\r\n\r\n public onIModelConnectionClose(): void {\r\n this.clear();\r\n }\r\n\r\n private static createSubCategoryAppearance(json?: any) {\r\n let props: SubCategoryAppearance.Props | undefined;\r\n if (\"string\" === typeof json && 0 < json.length)\r\n props = JSON.parse(json);\r\n\r\n return new SubCategoryAppearance(props);\r\n }\r\n\r\n private processResults(result: SubCategoriesCache.Result, missing: Id64Set): void {\r\n for (const row of result)\r\n this.add(row.parentId, row.id, SubCategoriesCache.createSubCategoryAppearance(row.appearance));\r\n\r\n // Ensure that any category Ids which returned no results (e.g., non-existent category, invalid Id, etc) are still recorded so they are not repeatedly re-requested\r\n for (const id of missing)\r\n if (undefined === this._byCategoryId.get(id))\r\n this._byCategoryId.set(id, invalidCategoryIdEntry);\r\n }\r\n\r\n private add(categoryId: string, subCategoryId: string, appearance: SubCategoryAppearance) {\r\n let set = this._byCategoryId.get(categoryId);\r\n if (undefined === set)\r\n this._byCategoryId.set(categoryId, set = new Set<string>());\r\n\r\n set.add(subCategoryId);\r\n this._appearances.set(subCategoryId, appearance);\r\n }\r\n\r\n public async getCategoryInfo(inputCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.CategoryInfo>> {\r\n // Eliminate duplicates...\r\n const categoryIds = new Set<string>(typeof inputCategoryIds === \"string\" ? [inputCategoryIds] : inputCategoryIds);\r\n const req = this.load(categoryIds);\r\n if (req)\r\n await req.promise;\r\n\r\n const map = new Map<Id64String, IModelConnection.Categories.CategoryInfo>();\r\n for (const categoryId of categoryIds) {\r\n const subCategoryIds = this._byCategoryId.get(categoryId);\r\n if (!subCategoryIds)\r\n continue;\r\n\r\n const subCategories = this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n map.set(categoryId, { id: categoryId, subCategories });\r\n }\r\n\r\n return map;\r\n }\r\n\r\n public async getSubCategoryInfo(categoryId: Id64String, inputSubCategoryIds: Id64String | Iterable<Id64String>): Promise<Map<Id64String, IModelConnection.Categories.SubCategoryInfo>> {\r\n // Eliminate duplicates...\r\n const subCategoryIds = new Set<string>(typeof inputSubCategoryIds === \"string\" ? [inputSubCategoryIds] : inputSubCategoryIds);\r\n const req = this.load(categoryId);\r\n if (req)\r\n await req.promise;\r\n\r\n return this.mapSubCategoryInfos(categoryId, subCategoryIds);\r\n }\r\n\r\n private mapSubCategoryInfos(categoryId: Id64String, subCategoryIds: Set<Id64String>): Map<Id64String, IModelConnection.Categories.SubCategoryInfo> {\r\n const map = new Map<Id64String, IModelConnection.Categories.SubCategoryInfo>();\r\n for (const id of subCategoryIds) {\r\n const appearance = this._appearances.get(id);\r\n assert(undefined !== appearance);\r\n if (appearance)\r\n map.set(id, { id, categoryId, appearance });\r\n }\r\n\r\n return map;\r\n }\r\n}\r\n\r\n/** This namespace and the types within it are exported strictly for use in tests.\r\n * @internal\r\n */\r\nexport namespace SubCategoriesCache { // eslint-disable-line no-redeclare\r\n export type Result = SubCategoryResultRow[];\r\n\r\n export class Request {\r\n private readonly _imodel: IModelConnection;\r\n private readonly _ecsql: string[] = [];\r\n private readonly _result: Result = [];\r\n private _canceled = false;\r\n private _curECSqlIndex = 0;\r\n\r\n public get wasCanceled() { return this._canceled || this._imodel.isClosed; }\r\n\r\n public constructor(categoryIds: Set<string>, imodel: IModelConnection, maxCategoriesPerQuery = 200) {\r\n this._imodel = imodel;\r\n\r\n const catIds = [...categoryIds];\r\n while (catIds.length !== 0) {\r\n const end = (catIds.length > maxCategoriesPerQuery) ? maxCategoriesPerQuery : catIds.length;\r\n const where = catIds.splice(0, end).join(\",\");\r\n this._ecsql.push(`SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`);\r\n }\r\n }\r\n\r\n public cancel() { this._canceled = true; }\r\n\r\n public async dispatch(): Promise<Result | undefined> {\r\n if (this.wasCanceled || this._curECSqlIndex >= this._ecsql.length) // handle case of empty category Id set...\r\n return undefined;\r\n\r\n try {\r\n const ecsql = this._ecsql[this._curECSqlIndex];\r\n for await (const row of this._imodel.query(ecsql, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\r\n this._result.push(row as SubCategoryResultRow);\r\n if (this.wasCanceled)\r\n return undefined;\r\n }\r\n } catch {\r\n // ###TODO: detect cases in which retry is warranted\r\n // Note that currently, if we succeed in obtaining some pages of results and fail to retrieve another page, we will end up processing the\r\n // incomplete results. Since we're not retrying, that's the best we can do.\r\n }\r\n\r\n // Finished with current ECSql query. Dispatch the next if one exists.\r\n if (++this._curECSqlIndex < this._ecsql.length) {\r\n if (this.wasCanceled)\r\n return undefined;\r\n else\r\n return this.dispatch();\r\n }\r\n\r\n // Even if we were canceled, we've retrieved all the rows. Might as well process them to prevent another request for some of the same rows from being enqueued.\r\n return this._result;\r\n }\r\n }\r\n\r\n export type QueueFunc = () => void;\r\n\r\n export class QueueEntry {\r\n public readonly categoryIds: Id64Set;\r\n public readonly funcs: QueueFunc[];\r\n\r\n public constructor(categoryIds: Id64Set, func: QueueFunc) {\r\n this.categoryIds = categoryIds;\r\n this.funcs = [func];\r\n }\r\n }\r\n\r\n /** A \"queue\" of SubCategoriesRequests, which consists of between 0 and 2 entries. Each entry specifies the set of category IDs to be loaded and a list of functions to be executed\r\n * when loading is completed. This is used to enforce ordering of operations upon subcategories despite the need to asynchronously load them. It incidentally also provides an\r\n * opportunity to reduce the number of backend requests by batching consecutive requests.\r\n * Chiefly used by [[Viewport]].\r\n * @internal\r\n */\r\n export class Queue {\r\n /* NB: Members marked protected for use in tests only. */\r\n protected _current?: QueueEntry;\r\n protected _next?: QueueEntry;\r\n protected _request?: SubCategoriesRequest;\r\n protected _disposed = false;\r\n\r\n /** Push a request onto the queue. The requested categories will be loaded if necessary, and then\r\n * the supplied function will be invoked. Any previously-pushed requests are guaranteed to be processed before this one.\r\n */\r\n public push(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n if (this._disposed)\r\n return;\r\n else if (undefined === this._current)\r\n this.pushCurrent(cache, categoryIds, func);\r\n else\r\n this.pushNext(categoryIds, func);\r\n }\r\n\r\n /** Cancel all requests and empty the queue. */\r\n public dispose(): void {\r\n if (undefined !== this._request) {\r\n assert(undefined !== this._current);\r\n this._request.cancel();\r\n this._request = undefined;\r\n }\r\n\r\n this._current = this._next = undefined;\r\n this._disposed = true;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return undefined === this._current && undefined === this._next;\r\n }\r\n\r\n private pushCurrent(cache: SubCategoriesCache, categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined === this._next);\r\n assert(undefined === this._current);\r\n assert(undefined === this._request);\r\n\r\n this._request = cache.load(categoryIds);\r\n if (undefined === this._request) {\r\n // All requested categories are already loaded.\r\n func();\r\n return;\r\n } else {\r\n // We need to load the requested categories before invoking the function.\r\n this.processCurrent(cache, new QueueEntry(Id64.toIdSet(categoryIds, true), func));\r\n }\r\n }\r\n\r\n private processCurrent(cache: SubCategoriesCache, entry: QueueEntry): void {\r\n assert(undefined !== this._request);\r\n assert(undefined === this._current);\r\n assert(undefined === this._next);\r\n\r\n this._current = entry;\r\n this._request.promise.then((completed: boolean) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (this._disposed)\r\n return;\r\n\r\n // Invoke all the functions which were awaiting this set of categories.\r\n assert(undefined !== this._current);\r\n if (completed)\r\n for (const func of this._current.funcs)\r\n func();\r\n\r\n this._request = undefined;\r\n this._current = undefined;\r\n\r\n // If we have more requests, process them.\r\n const next = this._next;\r\n this._next = undefined;\r\n if (undefined !== next) {\r\n this._request = cache.load(next.categoryIds);\r\n if (undefined === this._request) {\r\n // All categories loaded.\r\n for (const func of next.funcs)\r\n func();\r\n } else {\r\n // We need to load the requested categories before invoking the pending functions.\r\n this.processCurrent(cache, next);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private pushNext(categoryIds: Id64Arg, func: QueueFunc): void {\r\n assert(undefined !== this._current);\r\n assert(undefined !== this._request);\r\n\r\n if (undefined === this._next) {\r\n // We have a request currently in process and none pending.\r\n // We could potentially determine that this request doesn't require any categories that are not already loaded or being loaded by the current request.\r\n // But we will find that out (synchronously) when current request completes, unless more requests come in. Probably not worth it.\r\n this._next = new QueueEntry(Id64.toIdSet(categoryIds, true), func);\r\n } else {\r\n // We have a request currently in process, and one or more pending. Append this one to the pending.\r\n this._next.funcs.push(func);\r\n for (const categoryId of Id64.iterable(categoryIds))\r\n this._next.categoryIds.add(categoryId);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -227,7 +227,7 @@ export function extractHilitedVolumeClassifierCommands(hilites, cmds) {
227
227
  if (undefined === surface || undefined === surface.mesh.uniformFeatureId)
228
228
  continue;
229
229
  const feature = batch.featureTable.getPackedFeature(surface.mesh.uniformFeatureId);
230
- if (undefined === feature || !isFeatureHilited(feature, hilites))
230
+ if (undefined === feature || !isFeatureHilited(feature, hilites, hilites.models.hasId(batch.featureTable.modelId)))
231
231
  continue;
232
232
  break;
233
233
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DrawCommand.js","sourceRoot":"","sources":["../../../../src/render/webgl/DrawCommand.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AAI/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAA+E,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG/H,yCAAyC;AAEzC,gBAAgB;AAChB,MAAM,OAAO,mBAAmB;IAAhC;QAEU,gBAAW,kBAA+B;IAgBpD,CAAC;IAdC,I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IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,gBAAgB;wBACtE,SAAS;oBAEX,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnF,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;wBAC9D,SAAS;oBAEX,MAAM;iBACP;SACJ;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAClB;IAED,OAAO,MAAM,CAAC;AAChB,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 WebGL\r\n */\r\n\r\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { BranchState } from \"./BranchState\";\r\nimport { CachedGeometry } from \"./CachedGeometry\";\r\nimport { ClipVolume } from \"./ClipVolume\";\r\nimport { isFeatureHilited } from \"./FeatureOverrides\";\r\nimport { Batch, Branch } from \"./Graphic\";\r\nimport { UniformHandle } from \"./UniformHandle\";\r\nimport { Primitive } from \"./Primitive\";\r\nimport { Pass, RenderOrder, RenderPass } from \"./RenderFlags\";\r\nimport { ShaderProgramExecutor } from \"./ShaderProgram\";\r\nimport { System } from \"./System\";\r\nimport { Hilites, Target } from \"./Target\";\r\nimport { IsAnimated, IsClassified, IsInstanced, IsShadowable, IsThematic, IsWiremesh, TechniqueFlags } from \"./TechniqueFlags\";\r\nimport { TechniqueId } from \"./TechniqueId\";\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n\r\n/** @internal */\r\nexport class ShaderProgramParams {\r\n private _target?: Target;\r\n private _renderPass: RenderPass = RenderPass.None;\r\n\r\n public get target(): Target { assert(undefined !== this._target); return this._target; }\r\n public get renderPass() { return this._renderPass; }\r\n\r\n public get projectionMatrix() { return this.target.uniforms.getProjectionMatrix32(this.isViewCoords); }\r\n public bindProjectionMatrix(uniform: UniformHandle) { this.target.uniforms.bindProjectionMatrix(uniform, this.isViewCoords); }\r\n\r\n public get isViewCoords() { return RenderPass.ViewOverlay === this.renderPass || RenderPass.Background === this.renderPass; }\r\n public get isOverlayPass() { return RenderPass.WorldOverlay === this.renderPass || RenderPass.ViewOverlay === this.renderPass; }\r\n public get context() { return System.instance.context; }\r\n\r\n public init(target: Target, pass: RenderPass = RenderPass.OpaqueGeneral) {\r\n this._renderPass = pass;\r\n this._target = target;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class DrawParams {\r\n private _programParams?: ShaderProgramParams;\r\n private _geometry?: CachedGeometry;\r\n\r\n public get geometry(): CachedGeometry { assert(undefined !== this._geometry); return this._geometry; }\r\n public get programParams(): ShaderProgramParams { assert(undefined !== this._programParams); return this._programParams; }\r\n\r\n public get target() { return this.programParams.target; }\r\n public get renderPass() { return this.programParams.renderPass; }\r\n public get projectionMatrix() { return this.programParams.projectionMatrix; }\r\n public get isViewCoords() { return this.programParams.isViewCoords; }\r\n public get isOverlayPass() { return this.programParams.isOverlayPass; }\r\n public get context() { return this.programParams.context; }\r\n\r\n public init(programParams: ShaderProgramParams, geometry: CachedGeometry) {\r\n this._programParams = programParams;\r\n this._geometry = geometry;\r\n }\r\n}\r\n\r\n/** Defines operation associated with pushing or popping a branch\r\n * @internal\r\n */\r\nexport const enum PushOrPop {\r\n Push,\r\n Pop,\r\n}\r\n\r\n/** Represents a command to be executed within a RenderPass. The most common command is\r\n * to draw a primitive; others involve state changes such as pushing/popping transforms\r\n * and symbology overrides, which require that commands be executed in order.\r\n * @internal\r\n */\r\nexport enum DrawOpCode {\r\n Primitive = \"drawPrimitive\", // eslint-disable-line @typescript-eslint/no-shadow\r\n PushBranch = \"pushBranch\",\r\n PopBranch = \"popBranch\",\r\n PushBatch = \"pushBatch\",\r\n PopBatch = \"popBatch\",\r\n PushState = \"pushState\",\r\n PushClip = \"pushClip\",\r\n PopClip = \"popClip\",\r\n}\r\n\r\n/** @internal */\r\nexport class PopBatchCommand {\r\n public readonly opcode = \"popBatch\";\r\n\r\n private constructor() { }\r\n\r\n public static instance = new PopBatchCommand();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.popBatch();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushBatchCommand {\r\n public readonly opcode = \"pushBatch\";\r\n\r\n public constructor(public readonly batch: Batch) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.pushBatch(this.batch);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushStateCommand {\r\n public readonly opcode = \"pushState\";\r\n\r\n public constructor(public readonly state: BranchState) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.pushState(this.state);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushBranchCommand {\r\n public readonly opcode = \"pushBranch\";\r\n\r\n public constructor(public readonly branch: Branch) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.pushBranch(this.branch);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PopBranchCommand {\r\n public readonly opcode = \"popBranch\";\r\n\r\n private constructor() { }\r\n\r\n public static instance = new PopBranchCommand();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.popBranch();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushClipCommand {\r\n public readonly opcode = \"pushClip\";\r\n\r\n public constructor(public readonly clip: ClipVolume) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.uniforms.branch.clipStack.push(this.clip);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PopClipCommand {\r\n public readonly opcode = \"popClip\";\r\n\r\n private constructor() { }\r\n\r\n public static instance = new PopClipCommand();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.uniforms.branch.clipStack.pop();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PrimitiveCommand {\r\n public readonly opcode = \"drawPrimitive\";\r\n\r\n public constructor(public readonly primitive: Primitive) { }\r\n\r\n private static readonly _scratchTechniqueFlags = new TechniqueFlags();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n if (exec.target.isGeometryOutsideActiveVolume(this.primitive.cachedGeometry))\r\n return;\r\n\r\n const techniqueId = this.primitive.techniqueId;\r\n if (TechniqueId.Invalid === techniqueId)\r\n return;\r\n\r\n const target = exec.target;\r\n const thematic = this.primitive.cachedGeometry.supportsThematicDisplay && target.wantThematicDisplay;\r\n const shadowable = (techniqueId === TechniqueId.Surface || techniqueId === TechniqueId.RealityMesh) && target.solarShadowMap.isReady && target.currentViewFlags.shadows && !thematic;\r\n const isShadowable = shadowable ? IsShadowable.Yes : IsShadowable.No;\r\n let isThematic = thematic ? IsThematic.Yes : IsThematic.No;\r\n const isClassified = (undefined !== target.currentPlanarClassifierOrDrape || undefined !== target.activeVolumeClassifierTexture) ? IsClassified.Yes : IsClassified.No;\r\n const isInstanced = this.primitive.isInstanced ? IsInstanced.Yes : IsInstanced.No;\r\n const isAnimated = this.primitive.hasAnimation ? IsAnimated.Yes : IsAnimated.No;\r\n\r\n // Point clouds do not support hillshade or slope mode for thematic display.\r\n if (isThematic && (undefined !== this.primitive.cachedGeometry.asPointCloud) && (target.uniforms.thematic.wantSlopeMode || target.uniforms.thematic.wantHillShadeMode))\r\n isThematic = IsThematic.No;\r\n\r\n const wiremesh = target.currentViewFlags.wiremesh && System.instance.isWebGL2 && (techniqueId === TechniqueId.Surface || techniqueId === TechniqueId.RealityMesh);\r\n const isWiremesh = wiremesh ? IsWiremesh.Yes : IsWiremesh.No;\r\n const flags = PrimitiveCommand._scratchTechniqueFlags;\r\n const posType = this.primitive.cachedGeometry.usesQuantizedPositions ? \"quantized\" : \"unquantized\";\r\n flags.init(target, exec.renderPass, isInstanced, isAnimated, isClassified, isShadowable, isThematic, isWiremesh, posType);\r\n\r\n const technique = target.techniques.getTechnique(techniqueId);\r\n const program = technique.getShader(flags);\r\n\r\n if (exec.setProgram(program))\r\n exec.target.compositor.drawPrimitive(this.primitive, exec, program.outputsToPick);\r\n }\r\n\r\n public get hasFeatures(): boolean { return this.primitive.hasFeatures; }\r\n public get renderOrder(): RenderOrder { return this.primitive.renderOrder; }\r\n\r\n public getPass(target: Target): Pass {\r\n return this.primitive.getPass(target);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type PushCommand = PushBranchCommand | PushBatchCommand | PushStateCommand | PushClipCommand;\r\n/** @internal */\r\nexport type PopCommand = PopBranchCommand | PopBatchCommand | PopClipCommand;\r\n/** @internal */\r\nexport type DrawCommand = PushCommand | PopCommand | PrimitiveCommand;\r\n\r\n/** For a single RenderPass, an ordered list of commands to be executed during that pass.\r\n * @internal\r\n */\r\nexport type DrawCommands = DrawCommand[];\r\n\r\n/** Extracts the commands for rendering the flashed classifier (if any) from the by-index set of volume classifier commands.\r\n * NB: Cmds will be sets of some pushes, a primitive, and then some pops (equal to number of pushes).\r\n * The primitive should be right in the middle of a set. We need to find the set which matches the flashID.\r\n * @internal\r\n */\r\nexport function extractFlashedVolumeClassifierCommands(flashedId: Id64String, cmds: DrawCommands, numCmdsPerClassifier: number): DrawCommands | undefined {\r\n if (!Id64.isValid(flashedId) || 0 === numCmdsPerClassifier)\r\n return undefined;\r\n\r\n const firstPrim = (numCmdsPerClassifier - 1) / 2;\r\n for (let i = firstPrim; i < cmds.length; i += numCmdsPerClassifier) {\r\n assert(\"drawPrimitive\" === cmds[i].opcode, \"Command list not configured as expected.\");\r\n const pc: PrimitiveCommand = cmds[i] as PrimitiveCommand;\r\n const surface = pc.primitive.cachedGeometry.asSurface;\r\n if (undefined !== surface && undefined !== surface.mesh.uniformFeatureId) {\r\n let j = i - 1;\r\n while (j >= 0 && \"pushBatch\" !== cmds[j].opcode) // Find batch for this primitive\r\n j--;\r\n if (j < 0) continue;\r\n const pushBatch = cmds[j] as PushBatchCommand;\r\n const elemId = pushBatch.batch.featureTable.findElementId(surface.mesh.uniformFeatureId);\r\n if (undefined !== elemId && elemId === flashedId) {\r\n return cmds.slice(i - firstPrim, i + firstPrim + 1);\r\n }\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function extractHilitedVolumeClassifierCommands(hilites: Hilites, cmds: DrawCommands): DrawCommands {\r\n // TODO: This could really be done at the time the HiliteClassification render pass commands are being generated\r\n // by just not putting the ones which are not hilited into the ClassificationHilite command list.\r\n const result: DrawCommand[] = [];\r\n\r\n let batch;\r\n for (const cmd of cmds) {\r\n switch (cmd.opcode) {\r\n case \"popBranch\":\r\n if (result.length > 0 && \"pushBranch\" === result[result.length - 1].opcode) {\r\n result.pop(); // remove empty push/pop pairs\r\n continue;\r\n }\r\n break;\r\n case \"popBatch\":\r\n batch = undefined;\r\n if (result.length > 0 && \"pushBatch\" === result[result.length - 1].opcode) {\r\n result.pop(); // remove empty push/pop pairs\r\n continue;\r\n }\r\n break;\r\n case \"pushBatch\":\r\n batch = cmd.batch;\r\n break;\r\n case \"drawPrimitive\":\r\n if (undefined !== batch) {\r\n // Skip any primitives that are not hilited.\r\n const surface = cmd.primitive.cachedGeometry.asSurface;\r\n if (undefined === surface || undefined === surface.mesh.uniformFeatureId)\r\n continue;\r\n\r\n const feature = batch.featureTable.getPackedFeature(surface.mesh.uniformFeatureId);\r\n if (undefined === feature || !isFeatureHilited(feature, hilites))\r\n continue;\r\n\r\n break;\r\n }\r\n }\r\n\r\n result.push(cmd);\r\n }\r\n\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"DrawCommand.js","sourceRoot":"","sources":["../../../../src/render/webgl/DrawCommand.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AAI/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,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YACR,KAAK,WAAW;gBACd,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;gBAClB,MAAM;YACR,KAAK,eAAe;gBAClB,IAAI,SAAS,KAAK,KAAK,EAAE;oBACvB,4CAA4C;oBAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC;oBACvD,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,gBAAgB;wBACtE,SAAS;oBAEX,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnF,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;wBAChH,SAAS;oBAEX,MAAM;iBACP;SACJ;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAClB;IAED,OAAO,MAAM,CAAC;AAChB,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 WebGL\r\n */\r\n\r\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { BranchState } from \"./BranchState\";\r\nimport { CachedGeometry } from \"./CachedGeometry\";\r\nimport { ClipVolume } from \"./ClipVolume\";\r\nimport { isFeatureHilited } from \"./FeatureOverrides\";\r\nimport { Batch, Branch } from \"./Graphic\";\r\nimport { UniformHandle } from \"./UniformHandle\";\r\nimport { Primitive } from \"./Primitive\";\r\nimport { Pass, RenderOrder, RenderPass } from \"./RenderFlags\";\r\nimport { ShaderProgramExecutor } from \"./ShaderProgram\";\r\nimport { System } from \"./System\";\r\nimport { Hilites, Target } from \"./Target\";\r\nimport { IsAnimated, IsClassified, IsInstanced, IsShadowable, IsThematic, IsWiremesh, TechniqueFlags } from \"./TechniqueFlags\";\r\nimport { TechniqueId } from \"./TechniqueId\";\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n\r\n/** @internal */\r\nexport class ShaderProgramParams {\r\n private _target?: Target;\r\n private _renderPass: RenderPass = RenderPass.None;\r\n\r\n public get target(): Target { assert(undefined !== this._target); return this._target; }\r\n public get renderPass() { return this._renderPass; }\r\n\r\n public get projectionMatrix() { return this.target.uniforms.getProjectionMatrix32(this.isViewCoords); }\r\n public bindProjectionMatrix(uniform: UniformHandle) { this.target.uniforms.bindProjectionMatrix(uniform, this.isViewCoords); }\r\n\r\n public get isViewCoords() { return RenderPass.ViewOverlay === this.renderPass || RenderPass.Background === this.renderPass; }\r\n public get isOverlayPass() { return RenderPass.WorldOverlay === this.renderPass || RenderPass.ViewOverlay === this.renderPass; }\r\n public get context() { return System.instance.context; }\r\n\r\n public init(target: Target, pass: RenderPass = RenderPass.OpaqueGeneral) {\r\n this._renderPass = pass;\r\n this._target = target;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class DrawParams {\r\n private _programParams?: ShaderProgramParams;\r\n private _geometry?: CachedGeometry;\r\n\r\n public get geometry(): CachedGeometry { assert(undefined !== this._geometry); return this._geometry; }\r\n public get programParams(): ShaderProgramParams { assert(undefined !== this._programParams); return this._programParams; }\r\n\r\n public get target() { return this.programParams.target; }\r\n public get renderPass() { return this.programParams.renderPass; }\r\n public get projectionMatrix() { return this.programParams.projectionMatrix; }\r\n public get isViewCoords() { return this.programParams.isViewCoords; }\r\n public get isOverlayPass() { return this.programParams.isOverlayPass; }\r\n public get context() { return this.programParams.context; }\r\n\r\n public init(programParams: ShaderProgramParams, geometry: CachedGeometry) {\r\n this._programParams = programParams;\r\n this._geometry = geometry;\r\n }\r\n}\r\n\r\n/** Defines operation associated with pushing or popping a branch\r\n * @internal\r\n */\r\nexport const enum PushOrPop {\r\n Push,\r\n Pop,\r\n}\r\n\r\n/** Represents a command to be executed within a RenderPass. The most common command is\r\n * to draw a primitive; others involve state changes such as pushing/popping transforms\r\n * and symbology overrides, which require that commands be executed in order.\r\n * @internal\r\n */\r\nexport enum DrawOpCode {\r\n Primitive = \"drawPrimitive\", // eslint-disable-line @typescript-eslint/no-shadow\r\n PushBranch = \"pushBranch\",\r\n PopBranch = \"popBranch\",\r\n PushBatch = \"pushBatch\",\r\n PopBatch = \"popBatch\",\r\n PushState = \"pushState\",\r\n PushClip = \"pushClip\",\r\n PopClip = \"popClip\",\r\n}\r\n\r\n/** @internal */\r\nexport class PopBatchCommand {\r\n public readonly opcode = \"popBatch\";\r\n\r\n private constructor() { }\r\n\r\n public static instance = new PopBatchCommand();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.popBatch();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushBatchCommand {\r\n public readonly opcode = \"pushBatch\";\r\n\r\n public constructor(public readonly batch: Batch) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.pushBatch(this.batch);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushStateCommand {\r\n public readonly opcode = \"pushState\";\r\n\r\n public constructor(public readonly state: BranchState) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.pushState(this.state);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushBranchCommand {\r\n public readonly opcode = \"pushBranch\";\r\n\r\n public constructor(public readonly branch: Branch) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.pushBranch(this.branch);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PopBranchCommand {\r\n public readonly opcode = \"popBranch\";\r\n\r\n private constructor() { }\r\n\r\n public static instance = new PopBranchCommand();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.popBranch();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PushClipCommand {\r\n public readonly opcode = \"pushClip\";\r\n\r\n public constructor(public readonly clip: ClipVolume) { }\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.uniforms.branch.clipStack.push(this.clip);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PopClipCommand {\r\n public readonly opcode = \"popClip\";\r\n\r\n private constructor() { }\r\n\r\n public static instance = new PopClipCommand();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n exec.target.uniforms.branch.clipStack.pop();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class PrimitiveCommand {\r\n public readonly opcode = \"drawPrimitive\";\r\n\r\n public constructor(public readonly primitive: Primitive) { }\r\n\r\n private static readonly _scratchTechniqueFlags = new TechniqueFlags();\r\n\r\n public execute(exec: ShaderProgramExecutor): void {\r\n if (exec.target.isGeometryOutsideActiveVolume(this.primitive.cachedGeometry))\r\n return;\r\n\r\n const techniqueId = this.primitive.techniqueId;\r\n if (TechniqueId.Invalid === techniqueId)\r\n return;\r\n\r\n const target = exec.target;\r\n const thematic = this.primitive.cachedGeometry.supportsThematicDisplay && target.wantThematicDisplay;\r\n const shadowable = (techniqueId === TechniqueId.Surface || techniqueId === TechniqueId.RealityMesh) && target.solarShadowMap.isReady && target.currentViewFlags.shadows && !thematic;\r\n const isShadowable = shadowable ? IsShadowable.Yes : IsShadowable.No;\r\n let isThematic = thematic ? IsThematic.Yes : IsThematic.No;\r\n const isClassified = (undefined !== target.currentPlanarClassifierOrDrape || undefined !== target.activeVolumeClassifierTexture) ? IsClassified.Yes : IsClassified.No;\r\n const isInstanced = this.primitive.isInstanced ? IsInstanced.Yes : IsInstanced.No;\r\n const isAnimated = this.primitive.hasAnimation ? IsAnimated.Yes : IsAnimated.No;\r\n\r\n // Point clouds do not support hillshade or slope mode for thematic display.\r\n if (isThematic && (undefined !== this.primitive.cachedGeometry.asPointCloud) && (target.uniforms.thematic.wantSlopeMode || target.uniforms.thematic.wantHillShadeMode))\r\n isThematic = IsThematic.No;\r\n\r\n const wiremesh = target.currentViewFlags.wiremesh && System.instance.isWebGL2 && (techniqueId === TechniqueId.Surface || techniqueId === TechniqueId.RealityMesh);\r\n const isWiremesh = wiremesh ? IsWiremesh.Yes : IsWiremesh.No;\r\n const flags = PrimitiveCommand._scratchTechniqueFlags;\r\n const posType = this.primitive.cachedGeometry.usesQuantizedPositions ? \"quantized\" : \"unquantized\";\r\n flags.init(target, exec.renderPass, isInstanced, isAnimated, isClassified, isShadowable, isThematic, isWiremesh, posType);\r\n\r\n const technique = target.techniques.getTechnique(techniqueId);\r\n const program = technique.getShader(flags);\r\n\r\n if (exec.setProgram(program))\r\n exec.target.compositor.drawPrimitive(this.primitive, exec, program.outputsToPick);\r\n }\r\n\r\n public get hasFeatures(): boolean { return this.primitive.hasFeatures; }\r\n public get renderOrder(): RenderOrder { return this.primitive.renderOrder; }\r\n\r\n public getPass(target: Target): Pass {\r\n return this.primitive.getPass(target);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type PushCommand = PushBranchCommand | PushBatchCommand | PushStateCommand | PushClipCommand;\r\n/** @internal */\r\nexport type PopCommand = PopBranchCommand | PopBatchCommand | PopClipCommand;\r\n/** @internal */\r\nexport type DrawCommand = PushCommand | PopCommand | PrimitiveCommand;\r\n\r\n/** For a single RenderPass, an ordered list of commands to be executed during that pass.\r\n * @internal\r\n */\r\nexport type DrawCommands = DrawCommand[];\r\n\r\n/** Extracts the commands for rendering the flashed classifier (if any) from the by-index set of volume classifier commands.\r\n * NB: Cmds will be sets of some pushes, a primitive, and then some pops (equal to number of pushes).\r\n * The primitive should be right in the middle of a set. We need to find the set which matches the flashID.\r\n * @internal\r\n */\r\nexport function extractFlashedVolumeClassifierCommands(flashedId: Id64String, cmds: DrawCommands, numCmdsPerClassifier: number): DrawCommands | undefined {\r\n if (!Id64.isValid(flashedId) || 0 === numCmdsPerClassifier)\r\n return undefined;\r\n\r\n const firstPrim = (numCmdsPerClassifier - 1) / 2;\r\n for (let i = firstPrim; i < cmds.length; i += numCmdsPerClassifier) {\r\n assert(\"drawPrimitive\" === cmds[i].opcode, \"Command list not configured as expected.\");\r\n const pc: PrimitiveCommand = cmds[i] as PrimitiveCommand;\r\n const surface = pc.primitive.cachedGeometry.asSurface;\r\n if (undefined !== surface && undefined !== surface.mesh.uniformFeatureId) {\r\n let j = i - 1;\r\n while (j >= 0 && \"pushBatch\" !== cmds[j].opcode) // Find batch for this primitive\r\n j--;\r\n if (j < 0) continue;\r\n const pushBatch = cmds[j] as PushBatchCommand;\r\n const elemId = pushBatch.batch.featureTable.findElementId(surface.mesh.uniformFeatureId);\r\n if (undefined !== elemId && elemId === flashedId) {\r\n return cmds.slice(i - firstPrim, i + firstPrim + 1);\r\n }\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function extractHilitedVolumeClassifierCommands(hilites: Hilites, cmds: DrawCommands): DrawCommands {\r\n // TODO: This could really be done at the time the HiliteClassification render pass commands are being generated\r\n // by just not putting the ones which are not hilited into the ClassificationHilite command list.\r\n const result: DrawCommand[] = [];\r\n\r\n let batch;\r\n for (const cmd of cmds) {\r\n switch (cmd.opcode) {\r\n case \"popBranch\":\r\n if (result.length > 0 && \"pushBranch\" === result[result.length - 1].opcode) {\r\n result.pop(); // remove empty push/pop pairs\r\n continue;\r\n }\r\n break;\r\n case \"popBatch\":\r\n batch = undefined;\r\n if (result.length > 0 && \"pushBatch\" === result[result.length - 1].opcode) {\r\n result.pop(); // remove empty push/pop pairs\r\n continue;\r\n }\r\n break;\r\n case \"pushBatch\":\r\n batch = cmd.batch;\r\n break;\r\n case \"drawPrimitive\":\r\n if (undefined !== batch) {\r\n // Skip any primitives that are not hilited.\r\n const surface = cmd.primitive.cachedGeometry.asSurface;\r\n if (undefined === surface || undefined === surface.mesh.uniformFeatureId)\r\n continue;\r\n\r\n const feature = batch.featureTable.getPackedFeature(surface.mesh.uniformFeatureId);\r\n if (undefined === feature || !isFeatureHilited(feature, hilites, hilites.models.hasId(batch.featureTable.modelId)))\r\n continue;\r\n\r\n break;\r\n }\r\n }\r\n\r\n result.push(cmd);\r\n }\r\n\r\n return result;\r\n}\r\n"]}
@@ -6,7 +6,7 @@ import { BatchOptions } from "../GraphicBuilder";
6
6
  import { WebGLDisposable } from "./Disposable";
7
7
  import { UniformHandle } from "./UniformHandle";
8
8
  import { Hilites, Target } from "./Target";
9
- export declare function isFeatureHilited(feature: PackedFeature, hilites: Hilites): boolean;
9
+ export declare function isFeatureHilited(feature: PackedFeature, hilites: Hilites, isModelHilited: boolean): boolean;
10
10
  /** @internal */
11
11
  export declare type FeatureOverridesCleanup = () => void;
12
12
  /** @internal */
@@ -32,6 +32,8 @@ export declare class FeatureOverrides implements WebGLDisposable {
32
32
  get anyViewIndependentTranslucent(): boolean;
33
33
  get anyOpaque(): boolean;
34
34
  get anyHilited(): boolean;
35
+ /** For tests. */
36
+ get lutData(): Uint8Array | undefined;
35
37
  get byteLength(): number;
36
38
  get isUniform(): boolean;
37
39
  get isUniformFlashed(): boolean;
@@ -41,6 +43,7 @@ export declare class FeatureOverrides implements WebGLDisposable {
41
43
  private _update;
42
44
  private buildLookupTable;
43
45
  private updateFlashedAndHilited;
46
+ private updateFlashed;
44
47
  private constructor();
45
48
  static createFromTarget(target: Target, options: BatchOptions, cleanup: FeatureOverridesCleanup | undefined): FeatureOverrides;
46
49
  get isDisposed(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureOverrides.d.ts","sourceRoot":"","sources":["../../../../src/render/webgl/FeatureOverrides.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAAE,OAAO,EAAE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