@cognite/reveal-components 1.0.0 → 1.0.2

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 (153) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/poi-markers/poi-create-cursor.js +4 -0
  3. package/dist/common/i18n/en/reveal-components.js +183 -178
  4. package/dist/data-providers/Fdm3dDataProvider.d.ts +3 -3
  5. package/dist/data-providers/FdmSDK.d.ts +8 -0
  6. package/dist/data-providers/FdmSDK.js +34 -21
  7. package/dist/data-providers/assets/createClassicAssetsCache.d.ts +7 -0
  8. package/dist/data-providers/assets/createClassicAssetsCache.js +18 -0
  9. package/dist/data-providers/assets/createDmsDescribableNodesCache.d.ts +23 -0
  10. package/dist/data-providers/assets/createDmsDescribableNodesCache.js +19 -0
  11. package/dist/data-providers/cache/PointCloudAnnotationCache.js +10 -10
  12. package/dist/data-providers/cache/RevisionFdmNodeCache.d.ts +3 -2
  13. package/dist/data-providers/cache/RevisionFdmNodeCache.js +65 -39
  14. package/dist/data-providers/cache/annotationModelUtils.js +8 -6
  15. package/dist/data-providers/cache/cad/CadInstanceMappingsCache.d.ts +5 -2
  16. package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +9 -6
  17. package/dist/data-providers/cache/cad/FdmCadNodeCache.d.ts +3 -1
  18. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.d.ts +5 -0
  19. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.js +8 -3
  20. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.d.ts +3 -3
  21. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.js +11 -11
  22. package/dist/data-providers/core-dm-provider/filterNodesByMappedTo3d.js +13 -13
  23. package/dist/data-providers/core-dm-provider/getCadConnectionsForInstances.js +18 -18
  24. package/dist/data-providers/core-dm-provider/getCadConnectionsForRevisions.js +11 -11
  25. package/dist/data-providers/core-dm-provider/getCadModelsForInstance.js +3 -3
  26. package/dist/data-providers/core-dm-provider/getDMSModels.js +6 -6
  27. package/dist/data-providers/core-dm-provider/getEdgeConnected3dInstances.js +8 -8
  28. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.d.ts +2 -3
  29. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.js +19 -19
  30. package/dist/data-providers/core-dm-provider/listMappedFdmNodes.js +14 -14
  31. package/dist/data-providers/index.d.ts +2 -1
  32. package/dist/data-providers/index.js +2 -0
  33. package/dist/data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.d.ts +3 -3
  34. package/dist/data-providers/legacy-fdm-provider/fdmEdgesToCadConnections.js +3 -3
  35. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.d.ts +3 -3
  36. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.js +1 -1
  37. package/dist/data-providers/network/cad/searchClassicAssetsForCadModels.js +5 -5
  38. package/dist/data-providers/network/cad/searchHybridDmAssetsForCadModels.js +3 -3
  39. package/dist/data-providers/network/common/getDMAssetsForAnnotationReference.js +3 -3
  40. package/dist/data-providers/utils/getDMSModelRevisionRefs.js +3 -3
  41. package/dist/domains/annotation360/image360SceneCollectionTransform.d.ts +18 -0
  42. package/dist/domains/annotation360/image360SceneCollectionTransform.js +37 -0
  43. package/dist/domains/index.d.ts +4 -2
  44. package/dist/domains/index.js +3 -1
  45. package/dist/domains/pointsOfInterest/PointsOfInterestTool.d.ts +5 -0
  46. package/dist/domains/pointsOfInterest/PointsOfInterestTool.js +36 -17
  47. package/dist/domains/reveal/RevealDomainObjectUtils.d.ts +1 -0
  48. package/dist/domains/reveal/RevealDomainObjectUtils.js +1 -1
  49. package/dist/domains/reveal/cad/CadDomainObject.d.ts +18 -1
  50. package/dist/domains/reveal/cad/CadDomainObject.js +31 -15
  51. package/dist/foundation/renderTarget/CdfCaches.d.ts +9 -1
  52. package/dist/foundation/renderTarget/CdfCaches.js +24 -14
  53. package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.d.ts +3 -1
  54. package/dist/foundation/treeNodes/cad-tree-node/cad-lazy-loader.js +33 -22
  55. package/dist/foundation/treeNodes/cad-tree-node/cad-node-update-styling.js +6 -6
  56. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.d.ts +1 -0
  57. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.js +4 -1
  58. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +2 -5
  59. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.d.ts +14 -0
  60. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js +23 -0
  61. package/dist/ui/components/InstanceLabel/InstanceLabel.js +18 -30
  62. package/dist/ui/components/Reveal3DResources/Reveal3DResources.js +20 -20
  63. package/dist/ui/components/RevealCanvas/SDKProvider.js +6 -6
  64. package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.d.ts +3 -0
  65. package/dist/ui/components/RevealCanvas/UsageMetricsTrackerContext.js +6 -0
  66. package/dist/ui/components/RevealCanvas/ViewerContext.d.ts +2 -0
  67. package/dist/ui/components/RevealCanvas/ViewerContext.js +5 -5
  68. package/dist/ui/components/RevealContext/RevealContext.js +6 -6
  69. package/dist/ui/components/RevealToolbar/AssetContextualizedButton.js +1 -1
  70. package/dist/ui/components/RuleBasedOutputs/hooks/useGetDMConnectionWithNodeFromHybridMappingsQuery.js +11 -11
  71. package/dist/ui/components/Widget/RevealWidget.context.d.ts +2 -1
  72. package/dist/ui/components/Widget/RevealWidget.context.js +1 -1
  73. package/dist/ui/components/Widget/RevealWidget.d.ts +11 -2
  74. package/dist/ui/components/Widget/RevealWidget.js +35 -20
  75. package/dist/ui/components/Widget/RevealWidgetCameraController.d.ts +3 -1
  76. package/dist/ui/components/Widget/RevealWidgetCameraController.js +12 -10
  77. package/dist/ui/components/Widget/RevealWidgetController.d.ts +3 -1
  78. package/dist/ui/components/Widget/RevealWidgetController.js +40 -33
  79. package/dist/ui/components/Widget/index.d.ts +1 -1
  80. package/dist/ui/components/Widget/styling/applyPointCloudInstanceStyling.js +5 -5
  81. package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.d.ts +21 -0
  82. package/dist/ui/components/Widget/useRevealWidgetMetricsTracking.js +33 -0
  83. package/dist/ui/components/commandBased/Factories/DefaultIcons.js +31 -31
  84. package/dist/ui/components/commandBased/buttons/DropdownButton.d.ts +2 -0
  85. package/dist/ui/components/commandBased/buttons/DropdownButton.js +67 -48
  86. package/dist/ui/components/commandBased/pointsOfInterest/PoiCommentSection.js +6 -6
  87. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.d.ts +16 -0
  88. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.js +6 -0
  89. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.d.ts +15 -0
  90. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.d.ts +5 -0
  91. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.js +14 -0
  92. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.js +105 -0
  93. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.d.ts +13 -2
  94. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.function.js +17 -9
  95. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +27 -13
  96. package/dist/ui/components/commandBased/treeView/TreeView/components/tree-view-info.js +2 -2
  97. package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +34 -33
  98. package/dist/ui/components/commandBased/treeView/TreeView/tree-view-node.js +1 -0
  99. package/dist/ui/components/commandBased/treeView/TreeView/tree-view-props.d.ts +1 -0
  100. package/dist/ui/components/commandBased/treeView/TreeView/tree-view.js +27 -25
  101. package/dist/ui/components/i18n/I18n.js +3 -3
  102. package/dist/ui/components/index.d.ts +1 -1
  103. package/dist/ui/hooks/network/fetchLinkFromRelationshipsByTimeseries.js +4 -4
  104. package/dist/ui/hooks/network/getImage360CollectionsForDmInstance.js +7 -7
  105. package/dist/ui/hooks/network/getTimeseriesLatestDatapoints.js +3 -3
  106. package/dist/ui/hooks/pointClouds/fetchAnnotationsForModel.js +4 -4
  107. package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingForIntersection.js +11 -11
  108. package/dist/ui/hooks/pointClouds/usePointCloudAnnotationMappingsForAssetInstances.js +4 -4
  109. package/dist/ui/hooks/scenes/use3dScenes.js +4 -4
  110. package/dist/ui/query/core-dm/usePointCloudDMVolumeMappingForIntersection.js +9 -9
  111. package/dist/ui/query/core-dm/usePointCloudDMVolumes.js +10 -10
  112. package/dist/ui/query/index.d.ts +1 -0
  113. package/dist/ui/query/index.js +17 -16
  114. package/dist/ui/query/useAll3dDirectConnectionsWithProperties.js +6 -6
  115. package/dist/ui/query/useAssetsAndTimeseriesLinkageDataQuery.js +24 -24
  116. package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.d.ts +3 -2
  117. package/dist/ui/query/useAssetsAndTimeseriesLinkages.context.js +4 -4
  118. package/dist/ui/query/useAssetsAndTimeseriesLinkages.js +13 -13
  119. package/dist/ui/query/useAssetsByIdsQuery.js +10 -11
  120. package/dist/ui/query/useCadNode3DInfo.d.ts +8 -0
  121. package/dist/ui/query/useCadNode3DInfo.js +24 -0
  122. package/dist/ui/query/useFetchClassicAssetsByIds.js +5 -5
  123. package/dist/ui/query/useFilterOnClassicAssetsInScene.js +6 -6
  124. package/dist/ui/query/useHybridMappingsForAssetInstances.js +9 -9
  125. package/dist/ui/query/useInstanceNames.d.ts +11 -0
  126. package/dist/ui/query/useInstanceNames.js +17 -0
  127. package/dist/ui/query/useInstancesByIdsQuery.context.d.ts +3 -5
  128. package/dist/ui/query/useInstancesByIdsQuery.context.js +4 -8
  129. package/dist/ui/query/useInstancesByIdsQuery.d.ts +9 -6
  130. package/dist/ui/query/useInstancesByIdsQuery.js +14 -23
  131. package/dist/ui/query/useNamedDmInstancesByIds.d.ts +12 -0
  132. package/dist/utilities/cache/ReadonlyEntityCache.d.ts +4 -0
  133. package/dist/utilities/cache/ReadonlyEntityCache.js +27 -0
  134. package/dist/utilities/createMixpanelUsageMetricsTracker.d.ts +23 -0
  135. package/dist/utilities/createMixpanelUsageMetricsTracker.js +23 -0
  136. package/dist/utilities/externalIndex.d.ts +2 -0
  137. package/dist/utilities/externalIndex.js +3 -1
  138. package/dist/utilities/getInstancesFromClick.js +9 -9
  139. package/dist/utilities/index.d.ts +2 -1
  140. package/dist/utilities/index.js +12 -9
  141. package/dist/utilities/queryKeys.d.ts +2 -0
  142. package/dist/utilities/queryKeys.js +7 -0
  143. package/dist/utilities/signal/useCombinedUpdateSignal.d.ts +9 -0
  144. package/dist/utilities/signal/useCombinedUpdateSignal.js +14 -0
  145. package/dist/utilities/signal/useMemoWithUpdateSignal.d.ts +3 -0
  146. package/dist/utilities/signal/useMemoWithUpdateSignal.js +13 -0
  147. package/dist/utilities/usageMetricsTracker.d.ts +4 -0
  148. package/dist/utilities/usageMetricsTracker.js +4 -0
  149. package/package.json +7 -3
  150. package/dist/ui/hooks/network/getAssetsByIds.d.ts +0 -2
  151. package/dist/ui/hooks/network/getAssetsByIds.js +0 -4
  152. package/dist/ui/query/useDmsInstanceByIdsQuery.d.ts +0 -3
  153. package/dist/ui/query/useDmsInstanceByIdsQuery.js +0 -18
@@ -98,6 +98,8 @@ import { Image360AnnotationFolder as Ge } from "./annotation360/Image360Annotati
98
98
  import { Image360AnnotationSelectTool as Ke } from "./annotation360/Image360AnnotationSelectTool.js";
99
99
  import { Image360AnnotationCreateTool as qe } from "./annotation360/Image360AnnotationCreateTool.js";
100
100
  import { DeleteSelectedImage360AnnotationCommand as Je } from "./annotation360/DeleteSelectedImage360AnnotationCommand.js";
101
+ import { convertSceneAlignedImage360AnnotationGeometryToRawCdf as Ye } from "./annotation360/image360SceneCollectionTransform.js";
102
+ import { CoreDmInstanceMappingsSdk as Xe } from "../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js";
101
103
  he(), Te();
102
104
  //#endregion
103
- export { I as Annotation, L as AnnotationChangedDescription, R as AnnotationUtils, xe as AnnotationsCreateTool, z as AnnotationsDomainObject, j as AnnotationsRenderStyle, be as AnnotationsSelectTool, Ie as BaseBannerCommand, e as BaseCommand, ve as BaseCreator, N as BaseDragger, ye as BaseEditTool, r as BaseFilterCommand, i as BaseFilterItemCommand, n as BaseOptionCommand, ie as BaseRevealConfig, De as BaseSettingsCommand, Ee as BaseSliderCommand, ne as BaseTool, u as BaseView, me as CadDomainObject, de as CadLazyLoader, ue as CadTreeNode, g as ChangedDescription, a as Changes, fe as ClassicInstanceMappingsSdk, _ as ColorType, Q as CommandChanges, X as CommandsController, k as CommonRenderStyle, f as CopyToClipboardCommand, h as CycleLengthUnitsCommand, H as DEFAULT_POLYGON_OFFSET, ae as DefaultRevealConfig, m as DeleteDomainObjectCommand, Je as DeleteSelectedImage360AnnotationCommand, C as DomainObject, v as DomainObjectChange, p as DomainObjectCommand, D as DomainObjectTransaction, ke as FitViewCommand, o as FocusType, Se as FolderDomainObject, Le as GeneralBannerCommand, Oe as GroupCommand, B as GroupThreeView, qe as Image360AnnotationCreateTool, We as Image360AnnotationDomainObject, Ge as Image360AnnotationFolder, Ke as Image360AnnotationSelectTool, G as Image360CollectionDomainObject, He as Index2, _e as InstanceCommand, Ae as KeyboardSpeedCommand, re as NavigationTool, pe as NodesAndInstanceMappingsSdk, M as PanelInfo, K as PointCloudDomainObject, je as PointCloudFilterCommand, se as PointsOfInterestDomainObject, ce as PointsOfInterestView, y as PopupStyle, T as PrimitiveType, c as Quantity, P as Range1, F as Range3, O as RenderStyle, t as RenderTargetCommand, W as RevealDomainObject, oe as RevealRenderTarget, q as RevealSettingsController, J as RootDomainObject, Ve as SceneDomainObject, Be as SetAxisVisibleCommand, Me as SetPointColorTypeCommand, Ne as SetPointShapeCommand, Pe as SetPointSizeCommand, Fe as SetQualityCommand, Re as SetQualitySliderCommand, ze as SettingsCommand, we as ShowAllDomainObjectsCommand, Ce as ShowDomainObjectsOnTopCommand, A as Status, d as ThreeView, E as Transaction, le as TreeNode, V as TrianglesBuffers, ge as UndoCommand, te as UndoManager, l as UnitSystem, b as Views, s as VisibleState, w as VisualDomainObject, Ue as getGlobalMatrix, x as getNextColor, S as getNextColorByIndex, Y as getResizeCursor, $ as isCustomObjectIntersection, ee as isDomainObjectIntersection, Z as isPointsOfInterestIntersection, U as updatePolygonOffset };
105
+ export { I as Annotation, L as AnnotationChangedDescription, R as AnnotationUtils, xe as AnnotationsCreateTool, z as AnnotationsDomainObject, j as AnnotationsRenderStyle, be as AnnotationsSelectTool, Ie as BaseBannerCommand, e as BaseCommand, ve as BaseCreator, N as BaseDragger, ye as BaseEditTool, r as BaseFilterCommand, i as BaseFilterItemCommand, n as BaseOptionCommand, ie as BaseRevealConfig, De as BaseSettingsCommand, Ee as BaseSliderCommand, ne as BaseTool, u as BaseView, me as CadDomainObject, de as CadLazyLoader, ue as CadTreeNode, g as ChangedDescription, a as Changes, fe as ClassicInstanceMappingsSdk, _ as ColorType, Q as CommandChanges, X as CommandsController, k as CommonRenderStyle, f as CopyToClipboardCommand, Xe as CoreDmInstanceMappingsSdk, h as CycleLengthUnitsCommand, H as DEFAULT_POLYGON_OFFSET, ae as DefaultRevealConfig, m as DeleteDomainObjectCommand, Je as DeleteSelectedImage360AnnotationCommand, C as DomainObject, v as DomainObjectChange, p as DomainObjectCommand, D as DomainObjectTransaction, ke as FitViewCommand, o as FocusType, Se as FolderDomainObject, Le as GeneralBannerCommand, Oe as GroupCommand, B as GroupThreeView, qe as Image360AnnotationCreateTool, We as Image360AnnotationDomainObject, Ge as Image360AnnotationFolder, Ke as Image360AnnotationSelectTool, G as Image360CollectionDomainObject, He as Index2, _e as InstanceCommand, Ae as KeyboardSpeedCommand, re as NavigationTool, pe as NodesAndInstanceMappingsSdk, M as PanelInfo, K as PointCloudDomainObject, je as PointCloudFilterCommand, se as PointsOfInterestDomainObject, ce as PointsOfInterestView, y as PopupStyle, T as PrimitiveType, c as Quantity, P as Range1, F as Range3, O as RenderStyle, t as RenderTargetCommand, W as RevealDomainObject, oe as RevealRenderTarget, q as RevealSettingsController, J as RootDomainObject, Ve as SceneDomainObject, Be as SetAxisVisibleCommand, Me as SetPointColorTypeCommand, Ne as SetPointShapeCommand, Pe as SetPointSizeCommand, Fe as SetQualityCommand, Re as SetQualitySliderCommand, ze as SettingsCommand, we as ShowAllDomainObjectsCommand, Ce as ShowDomainObjectsOnTopCommand, A as Status, d as ThreeView, E as Transaction, le as TreeNode, V as TrianglesBuffers, ge as UndoCommand, te as UndoManager, l as UnitSystem, b as Views, s as VisibleState, w as VisualDomainObject, Ye as convertSceneAlignedImage360AnnotationGeometryToRawCdf, Ue as getGlobalMatrix, x as getNextColor, S as getNextColorByIndex, Y as getResizeCursor, $ as isCustomObjectIntersection, ee as isDomainObjectIntersection, Z as isPointsOfInterestIntersection, U as updatePolygonOffset };
@@ -14,6 +14,7 @@ export type PointsOfInterestToolDeps = {
14
14
  export declare const defaultPointsOfInterestToolDeps: PointsOfInterestToolDeps;
15
15
  export declare class PointsOfInterestTool<PoiIdType> extends BaseEditTool {
16
16
  private _isCreating;
17
+ private _createCursor;
17
18
  private _scene;
18
19
  /** Invalidates in-flight instance lookups for a cancelled/replaced draft. */
19
20
  private _pendingCreateRequestId;
@@ -29,6 +30,7 @@ export declare class PointsOfInterestTool<PoiIdType> extends BaseEditTool {
29
30
  get isEnabled(): boolean;
30
31
  onActivate(): void;
31
32
  onDeactivate(): void;
33
+ onHover(event: PointerEvent): void;
32
34
  onClick(event: PointerEvent): Promise<void>;
33
35
  get lastCreatedPointOfInterest(): Signal<PointOfInterest<PoiIdType> | undefined>;
34
36
  clearLastCreatedPointOfInterest(): void;
@@ -42,7 +44,10 @@ export declare class PointsOfInterestTool<PoiIdType> extends BaseEditTool {
42
44
  getOrCreatePointsOfInterestDomainObject(): PointsOfInterestDomainObject<PoiIdType>;
43
45
  get isCreating(): boolean;
44
46
  setIsCreating(value: boolean): void;
47
+ dispose(): void;
45
48
  setScene(scene: DmsUniqueIdentifier | undefined): void;
49
+ private appendCreateCursor;
50
+ private readonly removeCreateCursor;
46
51
  private setAssignedInstance;
47
52
  /**
48
53
  * Starts POI creation by adding a pending draft at the given position and
@@ -3,20 +3,22 @@ import { createInstanceStyleGroup as r } from "../../ui/components/Reveal3DResou
3
3
  import { PointsOfInterestDomainObject as i } from "./PointsOfInterestDomainObject.js";
4
4
  import { isImage360ClusterIntersection as a } from "../../foundation/utilities/misc/typeGuards.js";
5
5
  import { BaseEditTool as o } from "../../foundation/commands/BaseEditTool.js";
6
- import { getInstancesFromClick as s } from "../../utilities/getInstancesFromClick.js";
7
- import { PointsOfInterestAdsProvider as c } from "./ads/PointsOfInterestAdsProvider.js";
8
- import { signal as l } from "@cognite/signal-utils";
9
- import { DefaultNodeAppearance as u } from "@cognite/reveal";
6
+ import s from "../../assets/poi-markers/poi-create-cursor.js";
7
+ import { getInstancesFromClick as c } from "../../utilities/getInstancesFromClick.js";
8
+ import { PointsOfInterestAdsProvider as l } from "./ads/PointsOfInterestAdsProvider.js";
9
+ import { signal as u } from "@cognite/signal-utils";
10
+ import { DefaultNodeAppearance as d } from "@cognite/reveal";
10
11
  //#region libs/shared/reveal-components/src/domains/pointsOfInterest/PointsOfInterestTool.ts
11
- var d = Symbol("poi3d-assigned-instance-styling"), f = { getInstancesFromClick: s }, p = class extends o {
12
+ var f = Symbol("poi3d-assigned-instance-styling"), p = { getInstancesFromClick: c }, m = class extends o {
12
13
  _isCreating = !1;
14
+ _createCursor;
13
15
  _scene;
14
16
  _pendingCreateRequestId = 0;
15
- _lastCreatedPointOfInterest = l(void 0);
16
- _pendingAssociatedInstance = l(void 0);
17
- _isSaving = l(!1);
17
+ _lastCreatedPointOfInterest = u(void 0);
18
+ _pendingAssociatedInstance = u(void 0);
19
+ _isSaving = u(!1);
18
20
  _deps;
19
- constructor(e = f) {
21
+ constructor(e = p) {
20
22
  super(), this._deps = e;
21
23
  }
22
24
  get icon() {
@@ -35,12 +37,19 @@ var d = Symbol("poi3d-assigned-instance-styling"), f = { getInstancesFromClick:
35
37
  return !this.renderTarget.isInside360Image && this._scene !== void 0;
36
38
  }
37
39
  onActivate() {
38
- super.onActivate(), this.getOrCreatePointsOfInterestDomainObject().setVisible(!0, this.renderTarget), this.setIsCreating(!0), this.setCursor("copy");
40
+ super.onActivate(), this.getOrCreatePointsOfInterestDomainObject().setVisible(!0, this.renderTarget), this.setIsCreating(!0);
39
41
  }
40
42
  onDeactivate() {
41
43
  super.onDeactivate();
42
44
  let t = this.getPointsOfInterestDomainObject(), n = t?.selectedPointsOfInterest;
43
- n?.status !== e.PendingCreation && n?.status !== e.PendingEditing && t?.setSelectedPointOfInterest(void 0), this.setIsCreating(!1), this.setCursor("default"), this.setAssignedInstance(void 0);
45
+ n?.status !== e.PendingCreation && n?.status !== e.PendingEditing && t?.setSelectedPointOfInterest(void 0), this.setIsCreating(!1), this.setAssignedInstance(void 0);
46
+ }
47
+ onHover(e) {
48
+ if (!this._isCreating) {
49
+ super.onHover(e);
50
+ return;
51
+ }
52
+ this.renderTarget.cursor = "none", this._createCursor === void 0 && (this._createCursor = this.appendCreateCursor()), this._createCursor.style.left = `${e.clientX}px`, this._createCursor.style.top = `${e.clientY}px`;
44
53
  }
45
54
  async onClick(e) {
46
55
  if (this._isCreating) {
@@ -82,25 +91,35 @@ var d = Symbol("poi3d-assigned-instance-styling"), f = { getInstancesFromClick:
82
91
  getOrCreatePointsOfInterestDomainObject() {
83
92
  let e = this.getPointsOfInterestDomainObject();
84
93
  if (e !== void 0) return e;
85
- let t = new i(new c(this.root.sdk));
94
+ let t = new i(new l(this.root.sdk));
86
95
  return this.root.addChild(t), t;
87
96
  }
88
97
  get isCreating() {
89
98
  return this._isCreating;
90
99
  }
91
100
  setIsCreating(e) {
92
- this._isCreating = e, e ? this.renderTarget.setCrosshairCursor() : this.renderTarget.setNavigateCursor();
101
+ this._isCreating = e, e || (this.removeCreateCursor(), this.renderTarget.setNavigateCursor());
102
+ }
103
+ dispose() {
104
+ this.removeCreateCursor(), super.dispose();
93
105
  }
94
106
  setScene(e) {
95
107
  this._scene = e;
96
108
  }
109
+ appendCreateCursor() {
110
+ let e = new Image(48, 48);
111
+ return e.src = s, e.style.position = "fixed", e.style.margin = "-24px 0 0 -24px", e.style.pointerEvents = "none", document.body.append(e), this.renderTarget.domElement.addEventListener("pointerleave", this.removeCreateCursor), e;
112
+ }
113
+ removeCreateCursor = () => {
114
+ this._renderTarget?.domElement.removeEventListener("pointerleave", this.removeCreateCursor), this._createCursor?.remove(), this._createCursor = void 0;
115
+ };
97
116
  setAssignedInstance(e) {
98
117
  if (e === void 0) {
99
- this.renderTarget.instanceStylingController.setStylingGroup(d, void 0);
118
+ this.renderTarget.instanceStylingController.setStylingGroup(f, void 0);
100
119
  return;
101
120
  }
102
- let t = r([e], u.Highlighted);
103
- this.renderTarget.instanceStylingController.setStylingGroup(d, t);
121
+ let t = r([e], d.Highlighted);
122
+ this.renderTarget.instanceStylingController.setStylingGroup(f, t);
104
123
  }
105
124
  async beginCreatePointOfInterest(e, n) {
106
125
  if (this._scene === void 0 || this._isSaving()) return;
@@ -145,4 +164,4 @@ var d = Symbol("poi3d-assigned-instance-styling"), f = { getInstancesFromClick:
145
164
  }
146
165
  };
147
166
  //#endregion
148
- export { p as PointsOfInterestTool, f as defaultPointsOfInterestToolDeps };
167
+ export { m as PointsOfInterestTool, p as defaultPointsOfInterestToolDeps };
@@ -18,6 +18,7 @@ export declare class RevealDomainObjectUtils {
18
18
  static addCadDomainObject(renderTarget: RevealRenderTarget, identifier: AddModelOptions<DataSourceType>, options?: {
19
19
  parent?: DomainObject;
20
20
  defaultVisible?: boolean;
21
+ zoomOnNodeSelect?: boolean;
21
22
  }): Promise<CadDomainObject>;
22
23
  static addPointCloudDomainObject(renderTarget: RevealRenderTarget, identifier: AddModelOptions<DataSourceType>, options?: {
23
24
  parent?: DomainObject;
@@ -36,7 +36,7 @@ var f = class f {
36
36
  static async addCadDomainObject(e, t, r) {
37
37
  let a = await e.viewer.addCadModel(t);
38
38
  a.visible = r?.defaultVisible ?? !0;
39
- let o = new n(a);
39
+ let o = new n(a, { zoomOnNodeSelect: r?.zoomOnNodeSelect });
40
40
  s(r?.parent ?? e.root, i).addChild(o), o.setVisible(a.visible);
41
41
  try {
42
42
  o.name = await f.getName(e.root.sdk, a, e.root.fdmSdk);
@@ -10,13 +10,17 @@ export type StylingWithNodeCollection = {
10
10
  appearance: NodeAppearance;
11
11
  importance?: number;
12
12
  };
13
+ export type CadDomainObjectOptions = {
14
+ zoomOnNodeSelect?: boolean;
15
+ };
13
16
  export declare class CadDomainObject extends RevealDomainObject {
14
17
  private readonly _model;
15
18
  private readonly _collections;
19
+ private readonly _zoomOnNodeSelect;
16
20
  private _cadLazyLoader;
17
21
  private _cadRootLoadState;
18
22
  get model(): CogniteCadModel;
19
- constructor(model: CogniteCadModel);
23
+ constructor(model: CogniteCadModel, options?: CadDomainObjectOptions);
20
24
  get typeName(): TranslationInput;
21
25
  get icon(): IconName;
22
26
  get hasIconColor(): boolean;
@@ -31,6 +35,19 @@ export declare class CadDomainObject extends RevealDomainObject {
31
35
  getStyledNodeCollections(key: Symbol): StylingWithNodeCollection[] | undefined;
32
36
  addStyledNodeCollections(key: Symbol, value: StylingWithNodeCollection[]): void;
33
37
  removeStyledNodeCollections(key: Symbol): void;
38
+ /**
39
+ * Whether `collection` is still actually registered on the model.
40
+ * Makes sure other styled operation from 3D has not updated styling to the model
41
+ */
42
+ isCollectionAttached(collection: NodeCollection): boolean;
43
+ /**
44
+ * Guards against CogniteCadModel.unassignStyledNodeCollection from other operation
45
+ */
46
+ private unassignIfAttached;
47
+ /**
48
+ * Deselects any selected node in the CAD node tree and clears its highlight in the 3D view.
49
+ */
50
+ clearNodeSelection(): void;
34
51
  /**
35
52
  * Lazily creates the `CadLazyLoader` for model's CAD node hierarchy
36
53
  */
@@ -3,22 +3,25 @@ import { Changes as t } from "../../../foundation/domainObjectsHelpers/Changes.j
3
3
  import { VIEWER_TO_CDF_TRANSFORMATION as n } from "../../../foundation/renderTarget/convertCoordinates.js";
4
4
  import { RevealDomainObject as r } from "../RevealDomainObject.js";
5
5
  import { getViewer as i } from "../utils/getViewer.js";
6
- import { CadTreeNode as a } from "../../../foundation/treeNodes/cad-tree-node/cad-tree-node.js";
7
- import { CadLazyLoader as o } from "../../../foundation/treeNodes/cad-tree-node/cad-lazy-loader.js";
8
- import { CadTreeNodeViewAdapter as s } from "../../../foundation/treeNodes/cad-tree-node/cad-tree-node-view-adapter.js";
9
- import { ClassicInstanceMappingsSdk as c } from "../../../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js";
10
- import { NodesAndInstanceMappingsSdk as l } from "../../../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/nodes-and-instance-mappings-sdk.js";
6
+ import { clearSelection as a } from "../../../foundation/treeNodes/tree-node/tree-node-functions.js";
7
+ import { CadTreeNode as o } from "../../../foundation/treeNodes/cad-tree-node/cad-tree-node.js";
8
+ import { updateSelectedNodes as s } from "../../../foundation/treeNodes/cad-tree-node/cad-node-update-styling.js";
9
+ import { CadLazyLoader as c } from "../../../foundation/treeNodes/cad-tree-node/cad-lazy-loader.js";
10
+ import { CadTreeNodeViewAdapter as l } from "../../../foundation/treeNodes/cad-tree-node/cad-tree-node-view-adapter.js";
11
+ import { ClassicInstanceMappingsSdk as u } from "../../../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js";
12
+ import { NodesAndInstanceMappingsSdk as d } from "../../../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/nodes-and-instance-mappings-sdk.js";
11
13
  //#region libs/shared/reveal-components/src/domains/reveal/cad/CadDomainObject.ts
12
- var u = class extends r {
14
+ var f = class extends r {
13
15
  _model;
14
16
  _collections = /* @__PURE__ */ new Map();
17
+ _zoomOnNodeSelect;
15
18
  _cadLazyLoader;
16
19
  _cadRootLoadState = "idle";
17
20
  get model() {
18
21
  return this._model;
19
22
  }
20
- constructor(e) {
21
- super(), this._model = e;
23
+ constructor(e, t) {
24
+ super(), this._model = e, this._zoomOnNodeSelect = t?.zoomOnNodeSelect ?? !0;
22
25
  }
23
26
  get typeName() {
24
27
  return { untranslated: "CAD" };
@@ -46,7 +49,7 @@ var u = class extends r {
46
49
  this.loadCadRootOnce(t);
47
50
  return;
48
51
  }
49
- for (let e of n.getChildren(t)) e instanceof a && (yield new s(e, t));
52
+ for (let e of n.getChildren(t)) e instanceof o && (yield new l(e, t));
50
53
  }
51
54
  expandBoundingBox(e) {
52
55
  let t = this.model;
@@ -68,21 +71,34 @@ var u = class extends r {
68
71
  }
69
72
  addStyledNodeCollections(e, t) {
70
73
  let n = this.getStyledNodeCollections(e);
71
- n !== void 0 && n.forEach((e) => this.model.unassignStyledNodeCollection(e.collection)), this._collections.set(e, t), t.forEach((e) => this.model.assignStyledNodeCollection(e.collection, e.appearance, e.importance));
74
+ n !== void 0 && n.forEach((e) => this.unassignIfAttached(e.collection)), this._collections.set(e, t), t.forEach((e) => this.model.assignStyledNodeCollection(e.collection, e.appearance, e.importance));
72
75
  }
73
76
  removeStyledNodeCollections(e) {
74
77
  let t = this.getStyledNodeCollections(e);
75
- t !== void 0 && (t.forEach((e) => this.model.unassignStyledNodeCollection(e.collection)), this._collections.delete(e));
78
+ t !== void 0 && (t.forEach((e) => this.unassignIfAttached(e.collection)), this._collections.delete(e));
79
+ }
80
+ isCollectionAttached(e) {
81
+ return this.model.styledNodeCollections.some((t) => t.nodeCollection === e);
82
+ }
83
+ unassignIfAttached(e) {
84
+ this.isCollectionAttached(e) && this.model.unassignStyledNodeCollection(e);
85
+ }
86
+ clearNodeSelection() {
87
+ let e = this._cadLazyLoader?.root;
88
+ e !== void 0 && a(e) && s(this, e);
76
89
  }
77
90
  getCadLazyLoader() {
78
91
  if (this._cadLazyLoader !== void 0) return this._cadLazyLoader;
79
92
  let t = e(this)?.sdk;
80
93
  if (t === void 0) return;
81
- let n = new l(t, new c(t));
82
- return this._cadLazyLoader = new o(n, {
94
+ let n = new d(t, new u(t));
95
+ return this._cadLazyLoader = new c(n, {
83
96
  modelId: this._model.modelId,
84
97
  revisionId: this._model.revisionId
85
- }, { domainObject: this }), this._cadLazyLoader;
98
+ }, {
99
+ domainObject: this,
100
+ zoomOnSelect: this._zoomOnNodeSelect
101
+ }), this._cadLazyLoader;
86
102
  }
87
103
  loadCadRootOnce(e) {
88
104
  this._cadRootLoadState === "idle" && (this._cadRootLoadState = "loading", e.loadInitialRoot().catch((e) => {
@@ -93,4 +109,4 @@ var u = class extends r {
93
109
  }
94
110
  };
95
111
  //#endregion
96
- export { u as CadDomainObject };
112
+ export { f as CadDomainObject };
@@ -1,11 +1,15 @@
1
1
  import { Cognite3DViewer, DataSourceType } from '@cognite/reveal';
2
- import { CogniteClient } from '@cognite/sdk';
2
+ import { Asset, CogniteInstanceId, IdEither, CogniteClient } from '@cognite/sdk';
3
+ import { DmsDescribableNode } from '../../data-providers/assets/createDmsDescribableNodesCache';
4
+ import { FdmKey } from '../../data-providers/cache';
3
5
  import { CadInstanceMappingsCache } from '../../data-providers/cache/cad/CadInstanceMappingsCache';
4
6
  import { ClassicCadAssetMappingCache } from '../../data-providers/cache/cad/ClassicCadAssetMappingCache';
5
7
  import { FdmCadNodeCache } from '../../data-providers/cache/cad/FdmCadNodeCache';
6
8
  import { Image360AnnotationCache } from '../../data-providers/cache/Image360AnnotationCache';
7
9
  import { PointCloudAnnotationCache } from '../../data-providers/cache/PointCloudAnnotationCache';
8
10
  import { Fdm3dDataProvider } from '../../data-providers/Fdm3dDataProvider';
11
+ import { InstanceReferenceKey } from '../../utilities';
12
+ import { ReadonlyEntityCache } from '../../utilities/cache/ReadonlyEntityCache';
9
13
  import { LoadMetricsRecorder } from '../../utilities/loadMetricsParameters';
10
14
  import { TrackingDelegate } from '../utilities/types';
11
15
  export type CdfCachesOptions = {
@@ -20,6 +24,8 @@ export declare class CdfCaches {
20
24
  private readonly _fdmCadNodeCache;
21
25
  private readonly _pointCloudAnnotationCache;
22
26
  private readonly _image360AnnotationCache;
27
+ private readonly _classicAssetsCache;
28
+ private readonly _dmsDescribableNodeCache;
23
29
  private readonly _coreDmOnly;
24
30
  private readonly _cogniteClient;
25
31
  private readonly _fdm3dDataProvider;
@@ -31,5 +37,7 @@ export declare class CdfCaches {
31
37
  get image360Cache(): Image360AnnotationCache;
32
38
  get cogniteClient(): CogniteClient;
33
39
  get fdm3dDataProvider(): Fdm3dDataProvider | undefined;
40
+ get classicAssetsCache(): ReadonlyEntityCache<IdEither, Asset, InstanceReferenceKey>;
41
+ get dmsDescribableCache(): ReadonlyEntityCache<CogniteInstanceId, DmsDescribableNode, FdmKey>;
34
42
  get coreDmOnly(): boolean;
35
43
  }
@@ -1,27 +1,31 @@
1
1
  import { FdmSDK as e } from "../../data-providers/FdmSDK.js";
2
- import { createCadInstanceMappingsCache as t } from "../../data-providers/cache/cad/CadInstanceMappingsCacheImpl.js";
3
- import { createClassicCadAssetMappingCache as n } from "../../data-providers/cache/cad/ClassicCadAssetMappingCacheImpl.js";
4
- import { createFdmCadNodeCache as r } from "../../data-providers/cache/cad/FdmCadNodeCacheImpl.js";
5
- import { Image360AnnotationCache as i } from "../../data-providers/cache/Image360AnnotationCache.js";
6
- import { PointCloudAnnotationCache as a } from "../../data-providers/cache/PointCloudAnnotationCache.js";
7
- import { CoreDm3dFdm3dDataProvider as o } from "../../data-providers/core-dm-provider/CoreDm3dDataProvider.js";
8
- import { LegacyFdm3dDataProvider as s } from "../../data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.js";
2
+ import { createClassicAssetsCache as t } from "../../data-providers/assets/createClassicAssetsCache.js";
3
+ import { createDmsDescribableNodesCache as n } from "../../data-providers/assets/createDmsDescribableNodesCache.js";
4
+ import { createCadInstanceMappingsCache as r } from "../../data-providers/cache/cad/CadInstanceMappingsCacheImpl.js";
5
+ import { createClassicCadAssetMappingCache as i } from "../../data-providers/cache/cad/ClassicCadAssetMappingCacheImpl.js";
6
+ import { createFdmCadNodeCache as a } from "../../data-providers/cache/cad/FdmCadNodeCacheImpl.js";
7
+ import { Image360AnnotationCache as o } from "../../data-providers/cache/Image360AnnotationCache.js";
8
+ import { PointCloudAnnotationCache as s } from "../../data-providers/cache/PointCloudAnnotationCache.js";
9
+ import { CoreDm3dFdm3dDataProvider as c } from "../../data-providers/core-dm-provider/CoreDm3dDataProvider.js";
10
+ import { LegacyFdm3dDataProvider as l } from "../../data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.js";
9
11
  //#region libs/shared/reveal-components/src/foundation/renderTarget/CdfCaches.ts
10
- var c = class {
12
+ var u = class {
11
13
  _cadMappingsCache;
12
14
  _classicCadNodeCache;
13
15
  _fdmCadNodeCache;
14
16
  _pointCloudAnnotationCache;
15
17
  _image360AnnotationCache;
18
+ _classicAssetsCache;
19
+ _dmsDescribableNodeCache;
16
20
  _coreDmOnly;
17
21
  _cogniteClient;
18
22
  _fdm3dDataProvider;
19
- constructor(c, l, { coreDmOnly: u, enableLegacy3dFdm: d, trackingDelegate: f, featureDataLoadPerformanceMetrics: p }) {
20
- let m = new e(c, { featureDataLoadPerformanceMetrics: p }), h = (() => {
21
- if (u) return new o(m);
22
- if (d) return new s(m, c, { trackingDelegate: f });
23
+ constructor(u, d, { coreDmOnly: f, enableLegacy3dFdm: p, trackingDelegate: m, featureDataLoadPerformanceMetrics: h }) {
24
+ let g = new e(u, { featureDataLoadPerformanceMetrics: h }), _ = (() => {
25
+ if (f) return new c(g);
26
+ if (p) return new l(g, u, { trackingDelegate: m });
23
27
  })();
24
- this._classicCadNodeCache = n(c), this._pointCloudAnnotationCache = new a(c), this._image360AnnotationCache = new i(c, l), h !== void 0 && (this._fdmCadNodeCache = r(c, h)), this._cadMappingsCache = t(u ? void 0 : this._classicCadNodeCache, this._fdmCadNodeCache), this._cogniteClient = c, this._fdm3dDataProvider = h, this._coreDmOnly = u;
28
+ this._classicCadNodeCache = i(u), this._pointCloudAnnotationCache = new s(u), this._image360AnnotationCache = new o(u, d), _ !== void 0 && (this._fdmCadNodeCache = a(u, _)), this._cadMappingsCache = r(f ? void 0 : this._classicCadNodeCache, this._fdmCadNodeCache), this._cogniteClient = u, this._fdm3dDataProvider = _, this._coreDmOnly = f, this._classicAssetsCache = t(this._cogniteClient), this._dmsDescribableNodeCache = n(g);
25
29
  }
26
30
  get cadMappingsCache() {
27
31
  return this._cadMappingsCache;
@@ -44,9 +48,15 @@ var c = class {
44
48
  get fdm3dDataProvider() {
45
49
  return this._fdm3dDataProvider;
46
50
  }
51
+ get classicAssetsCache() {
52
+ return this._classicAssetsCache;
53
+ }
54
+ get dmsDescribableCache() {
55
+ return this._dmsDescribableNodeCache;
56
+ }
47
57
  get coreDmOnly() {
48
58
  return this._coreDmOnly;
49
59
  }
50
60
  };
51
61
  //#endregion
52
- export { c as CdfCaches };
62
+ export { u as CdfCaches };
@@ -8,6 +8,7 @@ export type CadLazyLoaderOptions = {
8
8
  showInstanceMappings?: boolean;
9
9
  listNodesLimit?: number;
10
10
  domainObject?: CadDomainObject;
11
+ zoomOnSelect?: boolean;
11
12
  };
12
13
  export declare class CadLazyLoader implements ILazyLoader {
13
14
  private readonly _sdk;
@@ -16,8 +17,9 @@ export declare class CadLazyLoader implements ILazyLoader {
16
17
  private readonly _listNodesLimit;
17
18
  private _showInstanceMappings;
18
19
  private readonly _domainObject;
20
+ private readonly _zoomOnSelect;
19
21
  get root(): CadTreeNode | undefined;
20
- constructor(sdk: INodesAndInstanceMappingsSdk, revisionId: RevisionId, { showInstanceMappings, listNodesLimit, domainObject, }?: CadLazyLoaderOptions);
22
+ constructor(sdk: INodesAndInstanceMappingsSdk, revisionId: RevisionId, { showInstanceMappings, listNodesLimit, domainObject, zoomOnSelect, }?: CadLazyLoaderOptions);
21
23
  get revisionId(): RevisionId;
22
24
  onNodeLoaded(child: TreeNodeType, parent?: TreeNodeType): void;
23
25
  loadInitialRoot(): Promise<TreeNodeType>;
@@ -1,21 +1,23 @@
1
1
  import { CheckboxState as e } from "../../utilities/types.js";
2
- import { concatenateMapValues as t } from "../../../utilities/map/concatenateMapValues.js";
3
- import { onSelectNode as n, onToggleNode as r } from "../tree-node/tree-node-functions.js";
4
- import { CadTreeNode as i } from "./cad-tree-node.js";
5
- import { updateHiddenNodes as a, updateSelectedNodes as o } from "./cad-node-update-styling.js";
2
+ import { getViewer as t } from "../../../domains/reveal/utils/getViewer.js";
3
+ import { concatenateMapValues as n } from "../../../utilities/map/concatenateMapValues.js";
4
+ import { onSelectNode as r, onToggleNode as i } from "../tree-node/tree-node-functions.js";
5
+ import { CadTreeNode as a } from "./cad-tree-node.js";
6
+ import { updateHiddenNodes as o, updateSelectedNodes as s } from "./cad-node-update-styling.js";
6
7
  //#region libs/shared/reveal-components/src/foundation/treeNodes/cad-tree-node/cad-lazy-loader.ts
7
- var s = class {
8
+ var c = class {
8
9
  _sdk;
9
10
  _revisionId;
10
11
  _root;
11
12
  _listNodesLimit;
12
13
  _showInstanceMappings;
13
14
  _domainObject;
15
+ _zoomOnSelect;
14
16
  get root() {
15
17
  return this._root;
16
18
  }
17
- constructor(e, t, { showInstanceMappings: n = !1, listNodesLimit: r = 100, domainObject: i } = {}) {
18
- this._sdk = e, this._revisionId = t, this._listNodesLimit = r, this._showInstanceMappings = n, this._domainObject = i;
19
+ constructor(e, t, { showInstanceMappings: n = !1, listNodesLimit: r = 100, domainObject: i, zoomOnSelect: a = !0 } = {}) {
20
+ this._sdk = e, this._revisionId = t, this._listNodesLimit = r, this._showInstanceMappings = n, this._domainObject = i, this._zoomOnSelect = a;
19
21
  }
20
22
  get revisionId() {
21
23
  return this._revisionId;
@@ -33,7 +35,7 @@ var s = class {
33
35
  return this._root = n, this._root;
34
36
  }
35
37
  async loadChildren(e) {
36
- if (!(e instanceof i)) throw Error("Parent node should be a CadTreeNode");
38
+ if (!(e instanceof a)) throw Error("Parent node should be a CadTreeNode");
37
39
  let t = await this._sdk.list3DNodes(this._revisionId.modelId, this._revisionId.revisionId, {
38
40
  depth: 1,
39
41
  limit: this._listNodesLimit,
@@ -48,9 +50,9 @@ var s = class {
48
50
  return r;
49
51
  }
50
52
  async loadSiblings(e) {
51
- if (!(e instanceof i)) throw Error("Sibling node should be a CadTreeNode");
53
+ if (!(e instanceof a)) throw Error("Sibling node should be a CadTreeNode");
52
54
  let t = e.parent;
53
- if (!(t instanceof i)) throw Error("Parent of sibling node should be a CadTreeNode");
55
+ if (!(t instanceof a)) throw Error("Parent of sibling node should be a CadTreeNode");
54
56
  let n = await this._sdk.list3DNodes(this._revisionId.modelId, this._revisionId.revisionId, {
55
57
  depth: 1,
56
58
  limit: this._listNodesLimit,
@@ -58,12 +60,12 @@ var s = class {
58
60
  cursor: e.loadSiblingCursor
59
61
  }), r = await this.getNodeIdToInstanceMappingMap(n.items);
60
62
  n.items = n.items.filter((e) => e.id !== t.nodeId);
61
- let a = n.items.map((e) => this.createCadTreeNode(e, r));
63
+ let i = n.items.map((e) => this.createCadTreeNode(e, r));
62
64
  if (n.nextCursor !== void 0) {
63
- let e = a[a.length - 1];
65
+ let e = i[i.length - 1];
64
66
  e.loadSiblingCursor = n.nextCursor;
65
67
  }
66
- return a;
68
+ return i;
67
69
  }
68
70
  async forceNodeInTree(e) {
69
71
  let t = this._root;
@@ -76,23 +78,23 @@ var s = class {
76
78
  }) : (n.expandAllAncestors(), n);
77
79
  }
78
80
  createCadTreeNode(e, t) {
79
- let s = new i(e, { instanceMappingOptions: this._showInstanceMappings ? {
81
+ let n = new a(e, { instanceMappingOptions: this._showInstanceMappings ? {
80
82
  instanceMappings: t?.get(e.id) ?? [],
81
83
  deleteInstanceMapping: (e) => this.deleteInstanceMapping(e)
82
84
  } : void 0 }), c = this._domainObject;
83
- return c !== void 0 && (s.onSelect = () => {
84
- n(s, !1, !1) && o(c, s.getRoot());
85
- }, s.toggleVisible = () => {
86
- r(s) && a(c, s.getRoot());
87
- }), s;
85
+ return c !== void 0 && (n.onSelect = () => {
86
+ r(n, !1, !1) && (s(c, n.getRoot()), this._zoomOnSelect && n.isSelected && l(c, n));
87
+ }, n.toggleVisible = () => {
88
+ i(n) && o(c, n.getRoot());
89
+ }), n;
88
90
  }
89
91
  deleteInstanceMapping(e) {
90
92
  return this._sdk.deleteInstanceMapping(this._revisionId.modelId, this._revisionId.revisionId, e);
91
93
  }
92
94
  async getNodeIdToInstanceMappingMap(e) {
93
95
  if (this._showInstanceMappings === !1) return;
94
- let n = await this._sdk.filterInstanceMappings(this._revisionId.modelId, this._revisionId.revisionId, e);
95
- return t(n.items.map((e) => [e.node.nodeId, e]));
96
+ let t = await this._sdk.filterInstanceMappings(this._revisionId.modelId, this._revisionId.revisionId, e);
97
+ return n(t.items.map((e) => [e.node.nodeId, e]));
96
98
  }
97
99
  async list3DNodeAncestors(e) {
98
100
  return (await this._sdk.list3DNodeAncestors(this._revisionId.modelId, this._revisionId.revisionId, e)).items;
@@ -113,5 +115,14 @@ var s = class {
113
115
  return r;
114
116
  }
115
117
  };
118
+ async function l(e, n) {
119
+ let r = t(e);
120
+ if (r !== void 0) try {
121
+ let t = await e.model.getBoundingBoxByNodeId(n.nodeId);
122
+ r.cameraManager.fitCameraToBoundingBox(t);
123
+ } catch (e) {
124
+ console.error(`Failed to get bounding box for node Id ${JSON.stringify(n.id)}: ${JSON.stringify(e)}`);
125
+ }
126
+ }
116
127
  //#endregion
117
- export { s as CadLazyLoader };
128
+ export { c as CadLazyLoader };
@@ -6,9 +6,9 @@ var o = Symbol("hiddenNodes"), s = Symbol("selectedNodes");
6
6
  function c(e, t) {
7
7
  let s = new r(), c = !1;
8
8
  for (let e of u(t)) c = !0, s.addRange(new i(e.treeIndex, e.subtreeSize));
9
- let l = e.getStyledNodeCollections(o);
10
- if (l !== void 0 && l.length > 0) {
11
- d(l[0].collection, s, c);
9
+ let l = e.getStyledNodeCollections(o)?.[0]?.collection;
10
+ if (l !== void 0 && e.isCollectionAttached(l)) {
11
+ d(l, s, c);
12
12
  return;
13
13
  }
14
14
  if (!c) return;
@@ -21,9 +21,9 @@ function c(e, t) {
21
21
  function l(e, o) {
22
22
  let c = new r(), l = !1;
23
23
  for (let e of o.getThisAndDescendantsByType(t)) e.isSelected && (l = !0, c.addRange(new i(e.treeIndex, e.subtreeSize)));
24
- let u = e.getStyledNodeCollections(s);
25
- if (u !== void 0 && u.length > 0) {
26
- d(u[0].collection, c, l);
24
+ let u = e.getStyledNodeCollections(s)?.[0]?.collection;
25
+ if (u !== void 0 && e.isCollectionAttached(u)) {
26
+ d(u, c, l);
27
27
  return;
28
28
  }
29
29
  if (!l) return;
@@ -32,6 +32,7 @@ export declare class CadTreeNode extends TreeNode {
32
32
  getRoot(): CadTreeNode;
33
33
  getInstanceMappings(): readonly Readonly<CadNodeMapping>[];
34
34
  addInstanceMapping(assetMapping: CadNodeMapping): void;
35
+ get canDelete(): boolean;
35
36
  deleteInstanceMapping(instanceMapping: CadNodeMapping): Promise<void>;
36
37
  /**
37
38
  * This function ensure same conversion of treeIndex to UniqueId
@@ -55,8 +55,11 @@ var n = class n extends t {
55
55
  addInstanceMapping(e) {
56
56
  this._instanceMappings = [...this._instanceMappings ?? [], e], this.update();
57
57
  }
58
+ get canDelete() {
59
+ return this._deleteInstanceMappingCallback !== void 0;
60
+ }
58
61
  async deleteInstanceMapping(t) {
59
- if (this._instanceMappings === void 0) return;
62
+ if (this._instanceMappings === void 0 || !this.canDelete) return;
60
63
  let n = e(t.instance), r = this._instanceMappings.find((r) => n === e(r.instance) && r.node.nodeId === t.node.nodeId);
61
64
  r !== void 0 && (this._instanceMappings = this._instanceMappings.filter((e) => e !== r), await this._deleteInstanceMappingCallback?.(t), this.update());
62
65
  }
@@ -1,6 +1,6 @@
1
1
  import { isClassicInstanceId as e } from "../../../../utilities/instanceIds/typeGuards.js";
2
- import { isDefined as t } from "../../../../utilities/isDefined.js";
3
2
  import "../../../../utilities/index.js";
3
+ import { isDefined as t } from "../../../../utilities/isDefined.js";
4
4
  //#region libs/shared/reveal-components/src/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.ts
5
5
  var n = class {
6
6
  _sdk;
@@ -26,10 +26,7 @@ var n = class {
26
26
  }).filter(t) };
27
27
  }
28
28
  async deleteInstanceMapping(t, n, r) {
29
- let i = e(r.instance) ? { assetId: r.instance } : {
30
- assetId: 0,
31
- assetInstanceId: r.instance
32
- };
29
+ let i = e(r.instance) ? { assetId: r.instance } : { assetInstanceId: r.instance };
33
30
  await this._sdk.assetMappings3D.delete(t, n, [{
34
31
  nodeId: r.node.nodeId,
35
32
  ...i
@@ -0,0 +1,14 @@
1
+ import { CadNodeMapping } from '../../../../data-providers';
2
+ import { CadInstanceMappingsCache, CdmCadNodeMapping } from '../../../../data-providers/cache/cad/CadInstanceMappingsCache';
3
+ import { SubsetOfNode3D } from '../cad-types';
4
+ import { IInstanceMappingsSdk } from './i-nodes-and-instance-mappings-sdk';
5
+ export type CoreDmInstanceMappingDeleteDelegate = (modelId: number, revisionId: number, mapping: CdmCadNodeMapping) => Promise<void>;
6
+ export declare class CoreDmInstanceMappingsSdk implements IInstanceMappingsSdk {
7
+ private _cadMappingsCache;
8
+ private _deleteAssetMapping;
9
+ constructor(_cadMappingsCache: CadInstanceMappingsCache, _deleteAssetMapping: CoreDmInstanceMappingDeleteDelegate);
10
+ filterInstanceMappings(modelId: number, revisionId: number, nodes: SubsetOfNode3D[]): Promise<{
11
+ items: CadNodeMapping[];
12
+ }>;
13
+ deleteInstanceMapping(modelId: number, revisionId: number, instanceMapping: CadNodeMapping): Promise<void>;
14
+ }
@@ -0,0 +1,23 @@
1
+ //#region libs/shared/reveal-components/src/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.ts
2
+ var e = class {
3
+ _cadMappingsCache;
4
+ _deleteAssetMapping;
5
+ constructor(e, t) {
6
+ this._cadMappingsCache = e, this._deleteAssetMapping = t;
7
+ }
8
+ async filterInstanceMappings(e, t, n) {
9
+ return { items: await this._cadMappingsCache.getMappingsForNodes({
10
+ modelId: e,
11
+ revisionId: t
12
+ }, n.map((e) => ({
13
+ ...e,
14
+ nodeId: e.id
15
+ }))) };
16
+ }
17
+ deleteInstanceMapping(e, t, n) {
18
+ if (n.sourceType !== "cdm") throw Error("Incompatible instance mapping type in CDM SDK: " + n.sourceType);
19
+ return this._deleteAssetMapping(e, t, n);
20
+ }
21
+ };
22
+ //#endregion
23
+ export { e as CoreDmInstanceMappingsSdk };