@cognite/reveal 4.28.6-dev.20260105 → 4.28.6-dev.20260107

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.
@@ -2,15 +2,66 @@
2
2
  * Copyright 2023 Cognite AS
3
3
  */
4
4
  import { Node, PointOctant, PointOctree } from 'sparse-octree';
5
- import { Box3, Matrix4 } from 'three';
5
+ import { Box3, Matrix4, Vector3 } from 'three';
6
6
  import { Overlay3DIcon } from './Overlay3DIcon';
7
7
  import { DefaultOverlay3DContentType } from './OverlayCollection';
8
8
  export declare class IconOctree<ContentType = DefaultOverlay3DContentType> extends PointOctree<Overlay3DIcon<ContentType>> {
9
9
  private readonly _nodeCenters;
10
+ private readonly _distanceBoxChecker;
10
11
  static getMinimalOctreeBoundsFromIcons<ContentType>(icons: Overlay3DIcon<ContentType>[]): Box3;
11
12
  constructor(icons: Overlay3DIcon<ContentType>[], bounds: Box3, maxLeafSize: number);
12
13
  getNodeIcon(node: Node): Overlay3DIcon | undefined;
14
+ /**
15
+ * Get all icons from a node's subtree recursively
16
+ * @param node - The octree node to get icons from
17
+ * @returns Array of Overlay3DIcons contained in the node's subtree
18
+ */
19
+ getAllIconsFromNode(node: Node): Overlay3DIcon<ContentType>[];
20
+ /**
21
+ * Check if a node or any of its descendants exists in the given set
22
+ * @param node - The octree node to check
23
+ * @param nodeSet - Set of nodes to check against
24
+ * @returns True if the node or any descendant is in the set, false otherwise
25
+ */
26
+ hasDescendantInSet(node: Node, nodeSet: Set<Node>): boolean;
27
+ /**
28
+ * Get LOD nodes based on projected screen area.
29
+ * Nodes with projected area above the threshold are expanded,
30
+ * while those below are selected as LOD representatives.
31
+ * @param areaThreshold - Screen area threshold (0 to 1) for LOD selection
32
+ * @param projection - View projection matrix
33
+ * @param minimumLevel - Minimum octree level to expand to (default: 0)
34
+ * @returns Set of PointOctant nodes selected for LOD based on screen area
35
+ */
13
36
  getLODByScreenArea(areaThreshold: number, projection: Matrix4, minimumLevel?: number): Set<PointOctant<Overlay3DIcon>>;
37
+ /**
38
+ * Get LOD nodes based purely on camera distance.
39
+ * This provides consistent behavior regardless of view angle.
40
+ *
41
+ * @param cameraPosition - Camera position in model space
42
+ * @param distanceThreshold - Distance from camera within which all icons are shown (no clustering)
43
+ * @param clusteringLevel - The octree level at which to cluster far icons (higher = finer clusters)
44
+ * @returns Set of PointOctant nodes selected for LOD based on distance
45
+ */
46
+ getLODByDistance(cameraPosition: Vector3 | undefined, distanceThreshold: number, clusteringLevel?: number): Set<PointOctant<Overlay3DIcon>>;
47
+ /**
48
+ * Get all icons from a node's subtree that are within the given distance from a point.
49
+ * Also returns the representative icon if no close icons are found (for clustering).
50
+ *
51
+ * @param node - The octree node to get icons from
52
+ * @param cameraPosition - Camera position for distance calculation
53
+ * @param distanceThreshold - Distance threshold for "close" icons
54
+ * @returns Object containing close icons and whether to show representative
55
+ */
56
+ getIconsFromClusteredNode(node: Node, cameraPosition: Vector3, distanceThreshold: number): Overlay3DIcon<ContentType | DefaultOverlay3DContentType>[];
57
+ /**
58
+ * Check if any icon in the node's subtree is within the given distance from a point
59
+ * @param node - The octree node to check
60
+ * @param point - The point to measure distance from
61
+ * @param distance - Distance threshold
62
+ * @returns True if any icon is within distance, false otherwise
63
+ */
64
+ private isNodeWithinDistance;
14
65
  private populateNodeCenters;
15
66
  private filterEmptyLeaves;
16
67
  private hasChildren;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.28.6-dev.20260105",
3
+ "version": "4.28.6-dev.20260107",
4
4
  "description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
5
5
  "homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
6
6
  "repository": {