@cognite/reveal 2.2.2 → 2.3.0

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 (212) hide show
  1. package/core/cad.d.ts +4 -4
  2. package/core/index.d.ts +7 -7
  3. package/core/src/datamodels/base/SupportedModelTypes.d.ts +4 -4
  4. package/core/src/datamodels/base/index.d.ts +6 -6
  5. package/core/src/datamodels/base/types.d.ts +14 -14
  6. package/core/src/datamodels/cad/CadManager.d.ts +45 -45
  7. package/core/src/datamodels/cad/CadModelFactory.d.ts +7 -7
  8. package/core/src/datamodels/cad/CadModelSectorLoadStatistics.d.ts +38 -38
  9. package/core/src/datamodels/cad/createCadManager.d.ts +9 -9
  10. package/core/src/datamodels/cad/picking.d.ts +28 -28
  11. package/core/src/datamodels/cad/rendering/RenderAlreadyLoadedGeometryProvider.d.ts +10 -10
  12. package/core/src/datamodels/cad/sector/CadModelClipper.d.ts +10 -10
  13. package/core/src/datamodels/cad/styling/AssetNodeCollection.d.ts +38 -38
  14. package/core/src/datamodels/cad/styling/InvertedNodeCollection.d.ts +24 -24
  15. package/core/src/datamodels/cad/styling/NodeCollectionDeserializer.d.ts +26 -26
  16. package/core/src/datamodels/cad/styling/PopulateIndexSetFromPagedResponseHelper.d.ts +24 -24
  17. package/core/src/datamodels/cad/styling/PropertyFilterNodeCollection.d.ts +54 -54
  18. package/core/src/datamodels/cad/styling/SinglePropertyFilterNodeCollection.d.ts +50 -50
  19. package/core/src/datamodels/cad/styling/index.d.ts +8 -8
  20. package/core/src/datamodels/pointcloud/PointCloudFactory.d.ts +9 -9
  21. package/core/src/datamodels/pointcloud/PointCloudManager.d.ts +26 -26
  22. package/core/src/datamodels/pointcloud/PointCloudMetadata.d.ts +11 -11
  23. package/core/src/datamodels/pointcloud/PointCloudMetadataRepository.d.ts +13 -13
  24. package/core/src/datamodels/pointcloud/PointCloudNode.d.ts +62 -62
  25. package/core/src/datamodels/pointcloud/PotreeGroupWrapper.d.ts +39 -39
  26. package/core/src/datamodels/pointcloud/PotreeNodeWrapper.d.ts +38 -38
  27. package/core/src/datamodels/pointcloud/createPointCloudManager.d.ts +6 -6
  28. package/core/src/datamodels/pointcloud/index.d.ts +5 -5
  29. package/core/src/datamodels/pointcloud/picking.d.ts +29 -29
  30. package/core/src/datamodels/pointcloud/types.d.ts +114 -114
  31. package/core/src/index.d.ts +19 -19
  32. package/core/src/internals.d.ts +15 -15
  33. package/core/src/migration.d.ts +8 -8
  34. package/core/src/public/RevealManager.d.ts +64 -64
  35. package/core/src/public/createRevealManager.d.ts +23 -23
  36. package/core/src/public/migration/Cognite3DModel.d.ts +339 -339
  37. package/core/src/public/migration/Cognite3DViewer.d.ts +566 -611
  38. package/core/src/public/migration/CogniteModelBase.d.ts +17 -17
  39. package/core/src/public/migration/CognitePointCloudModel.d.ts +121 -121
  40. package/core/src/public/migration/NodeIdAndTreeIndexMaps.d.ts +4 -4
  41. package/core/src/public/migration/NotSupportedInMigrationWrapperError.d.ts +11 -11
  42. package/core/src/public/migration/RenderController.d.ts +4 -4
  43. package/core/src/public/migration/types.d.ts +290 -290
  44. package/core/src/public/types.d.ts +46 -46
  45. package/core/src/storage/RevealManagerHelper.d.ts +58 -58
  46. package/core/src/utilities/BoundingBoxClipper.d.ts +23 -23
  47. package/core/src/utilities/Spinner.d.ts +27 -27
  48. package/core/src/utilities/ViewStateHelper.d.ts +37 -33
  49. package/core/src/utilities/callActionWithIndicesAsync.d.ts +4 -4
  50. package/core/src/utilities/index.d.ts +8 -8
  51. package/core/src/utilities/reflection.d.ts +7 -7
  52. package/core/src/utilities/worldToViewport.d.ts +30 -30
  53. package/core/utilities.d.ts +4 -4
  54. package/extensions/datasource.d.ts +9 -9
  55. package/extensions/datasource.js +6 -6
  56. package/extensions/datasource.map +1 -1
  57. package/index.d.ts +9 -8
  58. package/index.js +101 -91
  59. package/index.map +1 -1
  60. package/package.json +2 -2
  61. package/packages/cad-geometry-loaders/index.d.ts +14 -14
  62. package/packages/cad-geometry-loaders/src/CadLoadingHints.d.ts +11 -11
  63. package/packages/cad-geometry-loaders/src/CadModelSectorBudget.d.ts +26 -26
  64. package/packages/cad-geometry-loaders/src/CadModelUpdateHandler.d.ts +44 -44
  65. package/packages/cad-geometry-loaders/src/sector/CachedRepository.d.ts +25 -25
  66. package/packages/cad-geometry-loaders/src/sector/ModelStateHandler.d.ts +12 -12
  67. package/packages/cad-geometry-loaders/src/sector/Repository.d.ts +9 -9
  68. package/packages/cad-geometry-loaders/src/sector/SectorLoader.d.ts +28 -28
  69. package/packages/cad-geometry-loaders/src/sector/SimpleAndDetailedToSector3D.d.ts +20 -20
  70. package/packages/cad-geometry-loaders/src/sector/culling/ByVisibilityGpuSectorCuller.d.ts +53 -53
  71. package/packages/cad-geometry-loaders/src/sector/culling/OccludingGeometryProvider.d.ts +6 -6
  72. package/packages/cad-geometry-loaders/src/sector/culling/OrderSectorsByVisibilityCoverage.d.ts +107 -107
  73. package/packages/cad-geometry-loaders/src/sector/culling/SectorCuller.d.ts +33 -33
  74. package/packages/cad-geometry-loaders/src/sector/culling/TakenSectorTree.d.ts +24 -24
  75. package/packages/cad-geometry-loaders/src/sector/culling/types.d.ts +71 -71
  76. package/packages/cad-geometry-loaders/src/sector/rxSectorUtilities.d.ts +12 -12
  77. package/packages/cad-geometry-loaders/src/sector/sectorUtilities.d.ts +20 -20
  78. package/packages/cad-geometry-loaders/src/utilities/PromiseUtils.d.ts +18 -18
  79. package/packages/cad-geometry-loaders/src/utilities/arrays.d.ts +5 -5
  80. package/packages/cad-geometry-loaders/src/utilities/groupMeshesByNumber.d.ts +8 -8
  81. package/packages/cad-geometry-loaders/src/utilities/rxOperations.d.ts +6 -6
  82. package/packages/cad-geometry-loaders/src/utilities/types.d.ts +25 -25
  83. package/packages/cad-parsers/index.d.ts +21 -21
  84. package/packages/cad-parsers/src/cad/CadSectorParser.d.ts +15 -15
  85. package/packages/cad-parsers/src/cad/LevelOfDetail.d.ts +8 -8
  86. package/packages/cad-parsers/src/cad/filterInstanceMesh.d.ts +6 -6
  87. package/packages/cad-parsers/src/cad/filterPrimitives.d.ts +9 -9
  88. package/packages/cad-parsers/src/cad/primitiveGeometries.d.ts +31 -31
  89. package/packages/cad-parsers/src/cad/triangleMeshes.d.ts +6 -6
  90. package/packages/cad-parsers/src/cad/types.d.ts +56 -56
  91. package/packages/cad-parsers/src/metadata/CadMetadataParser.d.ts +7 -7
  92. package/packages/cad-parsers/src/metadata/CadModelMetadata.d.ts +44 -44
  93. package/packages/cad-parsers/src/metadata/CadModelMetadataRepository.d.ts +16 -16
  94. package/packages/cad-parsers/src/metadata/MetadataRepository.d.ts +7 -7
  95. package/packages/cad-parsers/src/metadata/parsers/CadMetadataParserV8.d.ts +51 -51
  96. package/packages/cad-parsers/src/metadata/types.d.ts +41 -41
  97. package/packages/cad-parsers/src/sector/RootSectorNode.d.ts +12 -12
  98. package/packages/cad-parsers/src/sector/SectorNode.d.ts +21 -21
  99. package/packages/cad-parsers/src/utilities/SectorScene.d.ts +21 -21
  100. package/packages/cad-parsers/src/utilities/SectorSceneFactory.d.ts +9 -9
  101. package/packages/cad-parsers/src/utilities/computeBoundingBoxFromAttributes.d.ts +9 -9
  102. package/packages/cad-parsers/src/utilities/float32BufferToMatrix.d.ts +12 -12
  103. package/packages/cad-parsers/src/utilities/types.d.ts +48 -48
  104. package/packages/cad-styling/index.d.ts +9 -9
  105. package/packages/cad-styling/src/CombineNodeCollectionBase.d.ts +31 -31
  106. package/packages/cad-styling/src/IntersectionNodeCollection.d.ts +15 -15
  107. package/packages/cad-styling/src/NodeAppearance.d.ts +62 -62
  108. package/packages/cad-styling/src/NodeAppearanceProvider.d.ts +33 -33
  109. package/packages/cad-styling/src/NodeCollectionBase.d.ts +47 -47
  110. package/packages/cad-styling/src/TreeIndexNodeCollection.d.ts +23 -23
  111. package/packages/cad-styling/src/UnionNodeCollection.d.ts +15 -15
  112. package/packages/camera-manager/index.d.ts +6 -4
  113. package/packages/camera-manager/src/CameraManager.d.ts +85 -0
  114. package/packages/camera-manager/src/ComboControls.d.ts +102 -100
  115. package/packages/camera-manager/src/Keyboard.d.ts +17 -17
  116. package/packages/camera-manager/src/types.d.ts +64 -0
  117. package/packages/data-source/index.d.ts +6 -6
  118. package/packages/data-source/src/CdfDataSource.d.ts +19 -19
  119. package/packages/data-source/src/DataSource.d.ts +26 -26
  120. package/packages/data-source/src/LocalDataSource.d.ts +15 -15
  121. package/packages/logger/index.d.ts +5 -5
  122. package/packages/logger/src/Log.d.ts +5 -5
  123. package/packages/metrics/index.d.ts +5 -5
  124. package/packages/metrics/src/MetricsLogger.d.ts +21 -21
  125. package/packages/metrics/src/types.d.ts +7 -7
  126. package/packages/modeldata-api/index.d.ts +13 -13
  127. package/packages/modeldata-api/src/CdfModelDataProvider.d.ts +17 -15
  128. package/packages/modeldata-api/src/CdfModelIdentifier.d.ts +17 -17
  129. package/packages/modeldata-api/src/CdfModelMetadataProvider.d.ts +19 -19
  130. package/packages/modeldata-api/src/CdfModelOutputsProvider.d.ts +15 -15
  131. package/packages/modeldata-api/src/LocalModelDataProvider.d.ts +10 -10
  132. package/packages/modeldata-api/src/LocalModelIdentifier.d.ts +14 -14
  133. package/packages/modeldata-api/src/LocalModelMetadataProvider.d.ts +14 -14
  134. package/packages/modeldata-api/src/Model3DOutputList.d.ts +17 -17
  135. package/packages/modeldata-api/src/ModelIdentifier.d.ts +12 -12
  136. package/packages/modeldata-api/src/ModelMetadataProvider.d.ts +17 -17
  137. package/packages/modeldata-api/src/applyDefaultModelTransformation.d.ts +6 -6
  138. package/packages/modeldata-api/src/types.d.ts +41 -41
  139. package/packages/modeldata-api/src/utilities.d.ts +7 -7
  140. package/packages/nodes-api/index.d.ts +6 -6
  141. package/packages/nodes-api/src/NodesApiClient.d.ts +52 -52
  142. package/packages/nodes-api/src/NodesCdfClient.d.ts +24 -24
  143. package/packages/nodes-api/src/NodesLocalClient.d.ts +30 -30
  144. package/packages/nodes-api/src/types.d.ts +10 -10
  145. package/packages/rendering/index.d.ts +17 -17
  146. package/packages/rendering/src/CadMaterialManager.d.ts +37 -37
  147. package/packages/rendering/src/InstancedMeshManager.d.ts +20 -20
  148. package/packages/rendering/src/cameraconfig.d.ts +12 -12
  149. package/packages/rendering/src/rendering/EffectRenderManager.d.ts +99 -99
  150. package/packages/rendering/src/rendering/NodeAppearanceTextureBuilder.d.ts +51 -51
  151. package/packages/rendering/src/rendering/RenderMode.d.ts +15 -15
  152. package/packages/rendering/src/rendering/createSimpleGeometryMesh.d.ts +6 -6
  153. package/packages/rendering/src/rendering/matCapTextureData.d.ts +5 -5
  154. package/packages/rendering/src/rendering/materials.d.ts +23 -23
  155. package/packages/rendering/src/rendering/primitives.d.ts +12 -12
  156. package/packages/rendering/src/rendering/shaders.d.ts +101 -101
  157. package/packages/rendering/src/rendering/types.d.ts +76 -76
  158. package/packages/rendering/src/sector/CadNode.d.ts +54 -54
  159. package/packages/rendering/src/transform/NodeTransformProvider.d.ts +13 -13
  160. package/packages/rendering/src/transform/NodeTransformTextureBuilder.d.ts +23 -23
  161. package/packages/rendering/src/transform/TransformOverrideBuffer.d.ts +21 -21
  162. package/packages/rendering/src/utilities/types.d.ts +26 -26
  163. package/packages/tools/index.d.ts +15 -15
  164. package/packages/tools/src/AxisView/AxisViewTool.d.ts +32 -32
  165. package/packages/tools/src/AxisView/types.d.ts +98 -98
  166. package/packages/tools/src/Cognite3DViewerToolBase.d.ts +25 -25
  167. package/packages/tools/src/DebugCameraTool.d.ts +20 -20
  168. package/packages/tools/src/DebugLoadedSectorsTool.d.ts +23 -23
  169. package/packages/tools/src/ExplodedViewTool.d.ts +12 -12
  170. package/packages/tools/src/Geomap/Geomap.d.ts +17 -17
  171. package/packages/tools/src/Geomap/GeomapTool.d.ts +24 -24
  172. package/packages/tools/src/Geomap/MapConfig.d.ts +195 -195
  173. package/packages/tools/src/HtmlOverlay/BucketGrid2D.d.ts +28 -28
  174. package/packages/tools/src/HtmlOverlay/HtmlOverlayTool.d.ts +159 -159
  175. package/packages/tools/src/Timeline/Keyframe.d.ts +38 -38
  176. package/packages/tools/src/Timeline/TimelineTool.d.ts +79 -79
  177. package/packages/tools/src/Timeline/types.d.ts +13 -13
  178. package/packages/tools/src/types.d.ts +4 -4
  179. package/packages/utilities/index.d.ts +24 -24
  180. package/packages/utilities/src/CameraConfiguration.d.ts +10 -10
  181. package/packages/utilities/src/IndexSet.d.ts +1 -1
  182. package/packages/utilities/src/NumericRange.d.ts +22 -22
  183. package/packages/utilities/src/RandomColors.d.ts +34 -34
  184. package/packages/utilities/src/WebGLRendererStateHelper.d.ts +15 -15
  185. package/packages/utilities/src/assertNever.d.ts +7 -7
  186. package/packages/utilities/src/cache/MemoryRequestCache.d.ts +22 -22
  187. package/packages/utilities/src/cache/MostFrequentlyUsedCache.d.ts +19 -19
  188. package/packages/utilities/src/cache/RequestCache.d.ts +13 -13
  189. package/packages/utilities/src/datastructures/DynamicDefragmentedBuffer.d.ts +22 -22
  190. package/packages/utilities/src/determinePowerOfTwoDimensions.d.ts +11 -11
  191. package/packages/utilities/src/disposeAttributeArrayOnUpload.d.ts +17 -17
  192. package/packages/utilities/src/events/EventTrigger.d.ts +13 -13
  193. package/packages/utilities/src/events/InputHandler.d.ts +34 -0
  194. package/packages/utilities/src/events/clickOrTouchEventOffset.d.ts +13 -13
  195. package/packages/utilities/src/events/index.d.ts +6 -5
  196. package/packages/utilities/src/indexset/IndexSet.d.ts +26 -26
  197. package/packages/utilities/src/indexset/IntermediateIndexNode.d.ts +26 -26
  198. package/packages/utilities/src/indexset/LeafIndexNode.d.ts +16 -16
  199. package/packages/utilities/src/isMobileOrTablet.d.ts +4 -4
  200. package/packages/utilities/src/networking/isTheSameDomain.d.ts +11 -11
  201. package/packages/utilities/src/objectTraversal.d.ts +8 -8
  202. package/packages/utilities/src/packFloat.d.ts +6 -6
  203. package/packages/utilities/src/revealEnv.d.ts +10 -10
  204. package/packages/utilities/src/three/AutoDisposeGroup.d.ts +17 -17
  205. package/packages/utilities/src/three/BoundingBoxLOD.d.ts +27 -27
  206. package/packages/utilities/src/three/getBox3CornerPoints.d.ts +5 -5
  207. package/packages/utilities/src/transformCameraConfiguration.d.ts +6 -6
  208. package/packages/utilities/src/types.d.ts +10 -10
  209. package/packages/utilities/src/workers/WorkerPool.d.ts +14 -14
  210. package/tools.d.ts +7 -7
  211. package/tools.js +62 -58
  212. package/tools.map +1 -1
@@ -1,339 +1,339 @@
1
- /*!
2
- * Copyright 2021 Cognite AS
3
- */
4
- import * as THREE from 'three';
5
- import { CogniteInternalId } from '@cognite/sdk';
6
- import { CameraConfiguration } from './types';
7
- import { CogniteModelBase } from './CogniteModelBase';
8
- import { SupportedModelTypes } from '../types';
9
- import { WellKnownUnit } from './types';
10
- import { NumericRange } from '../../../../packages/utilities';
11
- import { NodeCollectionBase, NodeAppearance } from '../../../../packages/cad-styling';
12
- /**
13
- * Represents a single 3D CAD model loaded from CDF.
14
- * @noInheritDoc
15
- * @module @cognite/reveal
16
- */
17
- export declare class Cognite3DModel extends THREE.Object3D implements CogniteModelBase {
18
- readonly type: SupportedModelTypes;
19
- /**
20
- * Returns the unit the coordinates for the model is stored. Returns an empty string
21
- * if no unit has been stored.
22
- * Note that coordinates in Reveal always are converted to meters using {@see modelUnitToMetersFactor}.
23
- * @version New since 2.1
24
- */
25
- get modelUnit(): WellKnownUnit | '';
26
- /**
27
- * Returns the conversion factor that converts from model coordinates to meters. Note that this can
28
- * return undefined if the model has been stored in an unsupported unit.
29
- * @version New since 2.1
30
- */
31
- get modelUnitToMetersFactor(): number | undefined;
32
- /**
33
- * The CDF model ID of the model.
34
- */
35
- readonly modelId: number;
36
- /**
37
- * The CDF revision ID of the model.
38
- */
39
- readonly revisionId: number;
40
- private readonly cadModel;
41
- private readonly nodesApiClient;
42
- private readonly nodeIdAndTreeIndexMaps;
43
- private readonly _styledNodeCollections;
44
- /**
45
- * Sets the default appearance for nodes that are not styled using
46
- * {@link assignStyledNodeCollection}. Updating the default style can be an
47
- * expensive operation, so use with care.
48
- *
49
- * @param appearance Default node appearance.
50
- */
51
- setDefaultNodeAppearance(appearance: NodeAppearance): void;
52
- /**
53
- * Gets the default appearance for nodes that are not styled using
54
- * {@link assignStyledNodeCollection}.
55
- */
56
- getDefaultNodeAppearance(): NodeAppearance;
57
- /**
58
- * Returns all currently registered node collections and associated appearance.
59
- */
60
- get styledNodeCollections(): {
61
- nodeCollection: NodeCollectionBase;
62
- appearance: NodeAppearance;
63
- }[];
64
- /**
65
- * Customizes rendering style for a set of nodes, e.g. to highlight, hide
66
- * or color code a set of 3D objects. This allows for custom look and feel
67
- * of the 3D model which is useful to highlight certain parts or to
68
- * color code the 3D model based on information (e.g. coloring the 3D model
69
- * by construction status).
70
- *
71
- * The {@link NodeCollectionBase} can be updated dynamically and the rendered nodes will be
72
- * updated automatically as the styling changes. The appearance of the style nodes
73
- * cannot be changed.
74
- *
75
- * When nodes are in several styled sets, the style is combined in the order
76
- * the sets were added, i.e. styled sets added late can overwrite styled sets added
77
- * early.
78
- *
79
- * If the `nodeCollection` provided already has an assigned style, this style will
80
- * be replaced with style provided.
81
- *
82
- * @param nodeCollection Dynamic set of nodes to apply the provided appearance to.
83
- * @param appearance Appearance to style the provided set with.
84
- * @example
85
- * ```js
86
- * model.setDefaultNodeAppearance({ rendererGhosted: true });
87
- * const visibleNodes = new TreeIndexNodeCollection(someTreeIndices);
88
- * model.assignStyledNodeCollection(visibleSet, { rendererGhosted: false });
89
- * ```
90
- * @throws Error if node collection already has been assigned to the model.
91
- */
92
- assignStyledNodeCollection(nodeCollection: NodeCollectionBase, appearance: NodeAppearance): void;
93
- /**
94
- * Updates styled node collections with a new appearance.
95
- * @param nodeCollection A node collection previously assigned using {@link assignStyledNodeCollection}.
96
- * @param newAppearance New appearance for the nodes in the collection.
97
- * @throws Error if node collection hasn't previously been assigned using {@link assignStyledNodeCollection}.
98
- */
99
- updateStyledNodeCollection(nodeCollection: NodeCollectionBase, newAppearance: NodeAppearance): void;
100
- /**
101
- * Removes styling for previously added styled collection, resetting the style to the default (or
102
- * the style imposed by other styled collections).
103
- * @param nodeCollection Node collection previously added using {@link assignStyledNodeCollection}.
104
- * @throws Error if node collection isn't assigned to the model.
105
- */
106
- unassignStyledNodeCollection(nodeCollection: NodeCollectionBase): void;
107
- /**
108
- * Removes all styled collections, resetting the appearance of all nodes to the
109
- * default appearance.
110
- */
111
- removeAllStyledNodeCollections(): void;
112
- /**
113
- * Apply a transformation matrix to the tree indices given, changing
114
- * rotation, scale and/or position.
115
- *
116
- * Note that setting multiple transformations for the same
117
- * node isn't supported and might lead to undefined results.
118
- * @param treeIndices Tree indices of nodes to apply the transformation to.
119
- * @param transformMatrix Transformation to apply.
120
- */
121
- setNodeTransform(treeIndices: NumericRange, transformMatrix: THREE.Matrix4): void;
122
- /**
123
- * Resets the transformation for the nodes given.
124
- * @param treeIndices Tree indices of the nodes to reset transforms for.
125
- */
126
- resetNodeTransform(treeIndices: NumericRange): void;
127
- /**
128
- * Maps a position retrieved from the CDF API (e.g. 3D node information) to
129
- * coordinates in "ThreeJS model space". This is necessary because CDF has a right-handed
130
- * Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
131
- * @param p The CDF coordinate to transform.
132
- * @param out Optional preallocated buffer for storing the result. May be `p`.
133
- * @returns Transformed position.
134
- */
135
- mapFromCdfToModelCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
136
- /**
137
- * Maps from a 3D position in "ThreeJS model space" (e.g. a ray intersection coordinate)
138
- * to coordinates in "CDF space". This is necessary because CDF has a right-handed
139
- * Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
140
- * This function also accounts for transformation applied to the model.
141
- * @param p The ThreeJS coordinate to transform.
142
- * @param out Optional preallocated buffer for storing the result. May be `p`.
143
- * @returns Transformed position.
144
- */
145
- mapPositionFromModelToCdfCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
146
- /**
147
- * Maps from a 3D position in "ThreeJS model space" to coordinates in "CDF space".
148
- * This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
149
- * uses a right-hand Y-up coordinate system. This function also accounts for transformation
150
- * applied to the model.
151
- * @param box The box in ThreeJS/model coordinates.
152
- * @param out Optional preallocated buffer for storing the result. May be `box`.
153
- * @returns Transformed box.
154
- */
155
- mapBoxFromModelToCdfCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
156
- /**
157
- * Cleans up used resources.
158
- */
159
- dispose(): void;
160
- /**
161
- * Determines the range of tree indices for a given subtree.
162
- * @param treeIndex Index of the root of the subtree to get the index range for.
163
- */
164
- getSubtreeTreeIndices(treeIndex: number): Promise<NumericRange>;
165
- /**
166
- * Determines the tree index range of a subtree of an ancestor of the provided
167
- * node defined by a tree index.
168
- *
169
- * @param treeIndex Tree index of node to find ancestor tree index range for.
170
- * @param generation What "generation" to find. 0 is the node itself,
171
- * 1 means parent, 2 means grandparent etc. If the node doesn't have as many
172
- * ancestors, the root of the model is returned. This can be determined by checking
173
- * that the range returned includes 0.
174
- * @returns Tree index range of the subtree spanned by the ancestor at the
175
- * "generation" specified, or the root.
176
- */
177
- getAncestorTreeIndices(treeIndex: number, generation: number): Promise<NumericRange>;
178
- /**
179
- * Determines the full bounding box of the model.
180
- * @param outBbox Optional. Used to write result to.
181
- * @param restrictToMostGeometry Optional. When true, returned bounds are restricted to
182
- * where most of the geometry is located. This is useful for models that have junk geometry
183
- * located far from the "main" model. Added in version 1.3.0.
184
- * @returns Model bounding box.
185
- *
186
- * @example
187
- * ```js
188
- * const box = new THREE.Box3()
189
- * model.getModelBoundingBox(box);
190
- * // box now has the bounding box
191
- * ```
192
- * ```js
193
- * // the following code does the same
194
- * const box = model.getModelBoundingBox();
195
- * ```
196
- */
197
- getModelBoundingBox(outBbox?: THREE.Box3, restrictToMostGeometry?: boolean): THREE.Box3;
198
- /**
199
- * Retrieves the camera position and target stored for the model. Typically this
200
- * is used to store a good starting position for a model. Returns `undefined` if there
201
- * isn't any stored camera configuration for the model.
202
- */
203
- getCameraConfiguration(): CameraConfiguration | undefined;
204
- /**
205
- * Sets transformation matrix of the model. This overrides the current transformation.
206
- * @param matrix Transformation matrix.
207
- */
208
- setModelTransformation(matrix: THREE.Matrix4): void;
209
- /**
210
- * Gets transformation matrix of the model.
211
- * @param out Preallocated `THREE.Matrix4` (optional).
212
- */
213
- getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
214
- /**
215
- * Fetches a bounding box from the CDF by the nodeId.
216
- * @param nodeId
217
- * @param box Optional. Used to write result to.
218
- * @example
219
- * ```js
220
- * const box = new THREE.Box3()
221
- * const nodeId = 100500;
222
- * await model.getBoundingBoxByNodeId(nodeId, box);
223
- * // box now has the bounding box
224
- *```
225
- * ```js
226
- * // the following code does the same
227
- * const box = await model.getBoundingBoxByNodeId(nodeId);
228
- * ```
229
- */
230
- getBoundingBoxByNodeId(nodeId: number, box?: THREE.Box3): Promise<THREE.Box3>;
231
- /**
232
- * Determine the bounding box of the node identified by the tree index provided. Note that this
233
- * function uses the CDF API to look up the bounding box.
234
- * @param treeIndex Tree index of the node to find bounding box for.
235
- * @param box Optional preallocated container to hold the bounding box.
236
- * @example
237
- * ```js
238
- * const box = new THREE.Box3()
239
- * const treeIndex = 42;
240
- * await model.getBoundingBoxByTreeIndex(treeIndex, box);
241
- * // box now has the bounding box
242
- *```
243
- * ```js
244
- * // the following code does the same
245
- * const box = await model.getBoundingBoxByTreeIndex(treeIndex);
246
- * ```
247
- */
248
- getBoundingBoxByTreeIndex(treeIndex: number, box?: THREE.Box3): Promise<THREE.Box3>;
249
- /**
250
- * Iterates over all nodes in the model and applies the provided action to each node (identified by tree index).
251
- * The passed action is applied incrementally to avoid main thread blocking, meaning that the changes can be partially
252
- * applied until promise is resolved (iteration is done).
253
- * @param action Function that will be called with a treeIndex argument.
254
- * @returns Promise that is resolved once the iteration is done.
255
- * @example
256
- * ```js
257
- * const logIndex = (treeIndex) => console.log(treeIndex);
258
- * await model.iterateNodesByTreeIndex(logIndex); // 0, 1, 2, ...
259
- * ```
260
- */
261
- iterateNodesByTreeIndex(action: (treeIndex: number) => void): Promise<void>;
262
- /**
263
- * Returns the number of nodes in the model.
264
- */
265
- get nodeCount(): number;
266
- /**
267
- * Iterates over all nodes in a subtree of the model and applies the provided action to each node
268
- * (identified by tree index). The provided node is included in the visited set. The passed action
269
- * is applied incrementally to avoid main thread blocking, meaning that the changes can be partially
270
- * applied until promise is resolved (iteration is done).
271
- * @param treeIndex Tree index of the top parent of the subtree.
272
- * @param action Function that will be called with a treeIndex argument.
273
- * @returns Promise that is resolved once the iteration is done.
274
- * @example
275
- * ```js
276
- * // make a subtree to be gray
277
- * await model.iterateNodesByTreeIndex(treeIndex => {
278
- * model.setNodeColorByTreeIndex(treeIndex, 127, 127, 127);
279
- * });
280
- * ```
281
- */
282
- iterateSubtreeByTreeIndex(treeIndex: number, action: (treeIndex: number) => void): Promise<void>;
283
- /**
284
- * Set override transform of the node by tree index.
285
- * @param treeIndex
286
- * @param transform
287
- * @param applyToChildren
288
- */
289
- setNodeTransformByTreeIndex(treeIndex: number, transform: THREE.Matrix4, applyToChildren?: boolean): Promise<number>;
290
- /**
291
- * Remove override transform of the node by tree index.
292
- * @param treeIndex
293
- * @param applyToChildren
294
- */
295
- resetNodeTransformByTreeIndex(treeIndex: number, applyToChildren?: boolean): Promise<number>;
296
- /**
297
- * Maps a list of Node IDs to tree indices. This function is useful when you have
298
- * a list of nodes, e.g. from Asset Mappings, that you want to highlight, hide,
299
- * color etc in the viewer.
300
- *
301
- * @param nodeIds List of node IDs to map to tree indices.
302
- * @returns A list of tree indices corresponing to the elements in the input.
303
- * @throws If an invalid/non-existant node ID is provided the function throws an error.
304
- */
305
- mapNodeIdsToTreeIndices(nodeIds: CogniteInternalId[]): Promise<number[]>;
306
- /**
307
- * Maps a single node ID to tree index. This is useful when you e.g. have a
308
- * node ID from an asset mapping and want to highlight the given asset using
309
- * {@link mapNodeIdsToTreeIndices} is recommended for better performance when
310
- * mapping multiple IDs.
311
- *
312
- * @param nodeId A Node ID to map to a tree index.
313
- * @returns TreeIndex of the provided node.
314
- * @throws If an invalid/non-existant node ID is provided the function throws an error.
315
- */
316
- mapNodeIdToTreeIndex(nodeId: CogniteInternalId): Promise<number>;
317
- /**
318
- * Maps a list of tree indices to node IDs for use with the Cognite SDK.
319
- * This function is useful if you have a list of tree indices, e.g. from
320
- * {@link Cognite3DModel.iterateSubtreeByTreeIndex}, and want to perform
321
- * some operations on these nodes using the SDK.
322
- *
323
- * @param treeIndices Tree indices to map to node IDs.
324
- * @returns A list of node IDs corresponding to the elements of the input.
325
- * @throws If an invalid tree index is provided the function throws an error.
326
- */
327
- mapTreeIndicesToNodeIds(treeIndices: number[]): Promise<CogniteInternalId[]>;
328
- /**
329
- * Maps a single tree index to node ID for use with the API. If you have multiple
330
- * tree indices to map, {@link mapNodeIdsToTreeIndices} is recommended for better
331
- * performance.
332
- * @param treeIndex A tree index to map to a Node ID.
333
- * @returns TreeIndex of the provided node.
334
- * @throws If an invalid/non-existent node ID is provided the function throws an error.
335
- */
336
- mapTreeIndexToNodeId(treeIndex: number): Promise<CogniteInternalId>;
337
- /** @private */
338
- private determineTreeIndices;
339
- }
1
+ /*!
2
+ * Copyright 2021 Cognite AS
3
+ */
4
+ import * as THREE from 'three';
5
+ import { CogniteInternalId } from '@cognite/sdk';
6
+ import { CameraConfiguration } from './types';
7
+ import { CogniteModelBase } from './CogniteModelBase';
8
+ import { SupportedModelTypes } from '../types';
9
+ import { WellKnownUnit } from './types';
10
+ import { NumericRange } from '../../../../packages/utilities';
11
+ import { NodeCollectionBase, NodeAppearance } from '../../../../packages/cad-styling';
12
+ /**
13
+ * Represents a single 3D CAD model loaded from CDF.
14
+ * @noInheritDoc
15
+ * @module @cognite/reveal
16
+ */
17
+ export declare class Cognite3DModel extends THREE.Object3D implements CogniteModelBase {
18
+ readonly type: SupportedModelTypes;
19
+ /**
20
+ * Returns the unit the coordinates for the model is stored. Returns an empty string
21
+ * if no unit has been stored.
22
+ * Note that coordinates in Reveal always are converted to meters using {@see modelUnitToMetersFactor}.
23
+ * @version New since 2.1
24
+ */
25
+ get modelUnit(): WellKnownUnit | '';
26
+ /**
27
+ * Returns the conversion factor that converts from model coordinates to meters. Note that this can
28
+ * return undefined if the model has been stored in an unsupported unit.
29
+ * @version New since 2.1
30
+ */
31
+ get modelUnitToMetersFactor(): number | undefined;
32
+ /**
33
+ * The CDF model ID of the model.
34
+ */
35
+ readonly modelId: number;
36
+ /**
37
+ * The CDF revision ID of the model.
38
+ */
39
+ readonly revisionId: number;
40
+ private readonly cadModel;
41
+ private readonly nodesApiClient;
42
+ private readonly nodeIdAndTreeIndexMaps;
43
+ private readonly _styledNodeCollections;
44
+ /**
45
+ * Sets the default appearance for nodes that are not styled using
46
+ * {@link assignStyledNodeCollection}. Updating the default style can be an
47
+ * expensive operation, so use with care.
48
+ *
49
+ * @param appearance Default node appearance.
50
+ */
51
+ setDefaultNodeAppearance(appearance: NodeAppearance): void;
52
+ /**
53
+ * Gets the default appearance for nodes that are not styled using
54
+ * {@link assignStyledNodeCollection}.
55
+ */
56
+ getDefaultNodeAppearance(): NodeAppearance;
57
+ /**
58
+ * Returns all currently registered node collections and associated appearance.
59
+ */
60
+ get styledNodeCollections(): {
61
+ nodeCollection: NodeCollectionBase;
62
+ appearance: NodeAppearance;
63
+ }[];
64
+ /**
65
+ * Customizes rendering style for a set of nodes, e.g. to highlight, hide
66
+ * or color code a set of 3D objects. This allows for custom look and feel
67
+ * of the 3D model which is useful to highlight certain parts or to
68
+ * color code the 3D model based on information (e.g. coloring the 3D model
69
+ * by construction status).
70
+ *
71
+ * The {@link NodeCollectionBase} can be updated dynamically and the rendered nodes will be
72
+ * updated automatically as the styling changes. The appearance of the style nodes
73
+ * cannot be changed.
74
+ *
75
+ * When nodes are in several styled sets, the style is combined in the order
76
+ * the sets were added, i.e. styled sets added late can overwrite styled sets added
77
+ * early.
78
+ *
79
+ * If the `nodeCollection` provided already has an assigned style, this style will
80
+ * be replaced with style provided.
81
+ *
82
+ * @param nodeCollection Dynamic set of nodes to apply the provided appearance to.
83
+ * @param appearance Appearance to style the provided set with.
84
+ * @example
85
+ * ```js
86
+ * model.setDefaultNodeAppearance({ rendererGhosted: true });
87
+ * const visibleNodes = new TreeIndexNodeCollection(someTreeIndices);
88
+ * model.assignStyledNodeCollection(visibleSet, { rendererGhosted: false });
89
+ * ```
90
+ * @throws Error if node collection already has been assigned to the model.
91
+ */
92
+ assignStyledNodeCollection(nodeCollection: NodeCollectionBase, appearance: NodeAppearance): void;
93
+ /**
94
+ * Updates styled node collections with a new appearance.
95
+ * @param nodeCollection A node collection previously assigned using {@link assignStyledNodeCollection}.
96
+ * @param newAppearance New appearance for the nodes in the collection.
97
+ * @throws Error if node collection hasn't previously been assigned using {@link assignStyledNodeCollection}.
98
+ */
99
+ updateStyledNodeCollection(nodeCollection: NodeCollectionBase, newAppearance: NodeAppearance): void;
100
+ /**
101
+ * Removes styling for previously added styled collection, resetting the style to the default (or
102
+ * the style imposed by other styled collections).
103
+ * @param nodeCollection Node collection previously added using {@link assignStyledNodeCollection}.
104
+ * @throws Error if node collection isn't assigned to the model.
105
+ */
106
+ unassignStyledNodeCollection(nodeCollection: NodeCollectionBase): void;
107
+ /**
108
+ * Removes all styled collections, resetting the appearance of all nodes to the
109
+ * default appearance.
110
+ */
111
+ removeAllStyledNodeCollections(): void;
112
+ /**
113
+ * Apply a transformation matrix to the tree indices given, changing
114
+ * rotation, scale and/or position.
115
+ *
116
+ * Note that setting multiple transformations for the same
117
+ * node isn't supported and might lead to undefined results.
118
+ * @param treeIndices Tree indices of nodes to apply the transformation to.
119
+ * @param transformMatrix Transformation to apply.
120
+ */
121
+ setNodeTransform(treeIndices: NumericRange, transformMatrix: THREE.Matrix4): void;
122
+ /**
123
+ * Resets the transformation for the nodes given.
124
+ * @param treeIndices Tree indices of the nodes to reset transforms for.
125
+ */
126
+ resetNodeTransform(treeIndices: NumericRange): void;
127
+ /**
128
+ * Maps a position retrieved from the CDF API (e.g. 3D node information) to
129
+ * coordinates in "ThreeJS model space". This is necessary because CDF has a right-handed
130
+ * Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
131
+ * @param p The CDF coordinate to transform.
132
+ * @param out Optional preallocated buffer for storing the result. May be `p`.
133
+ * @returns Transformed position.
134
+ */
135
+ mapFromCdfToModelCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
136
+ /**
137
+ * Maps from a 3D position in "ThreeJS model space" (e.g. a ray intersection coordinate)
138
+ * to coordinates in "CDF space". This is necessary because CDF has a right-handed
139
+ * Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
140
+ * This function also accounts for transformation applied to the model.
141
+ * @param p The ThreeJS coordinate to transform.
142
+ * @param out Optional preallocated buffer for storing the result. May be `p`.
143
+ * @returns Transformed position.
144
+ */
145
+ mapPositionFromModelToCdfCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
146
+ /**
147
+ * Maps from a 3D position in "ThreeJS model space" to coordinates in "CDF space".
148
+ * This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
149
+ * uses a right-hand Y-up coordinate system. This function also accounts for transformation
150
+ * applied to the model.
151
+ * @param box The box in ThreeJS/model coordinates.
152
+ * @param out Optional preallocated buffer for storing the result. May be `box`.
153
+ * @returns Transformed box.
154
+ */
155
+ mapBoxFromModelToCdfCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
156
+ /**
157
+ * Cleans up used resources.
158
+ */
159
+ dispose(): void;
160
+ /**
161
+ * Determines the range of tree indices for a given subtree.
162
+ * @param treeIndex Index of the root of the subtree to get the index range for.
163
+ */
164
+ getSubtreeTreeIndices(treeIndex: number): Promise<NumericRange>;
165
+ /**
166
+ * Determines the tree index range of a subtree of an ancestor of the provided
167
+ * node defined by a tree index.
168
+ *
169
+ * @param treeIndex Tree index of node to find ancestor tree index range for.
170
+ * @param generation What "generation" to find. 0 is the node itself,
171
+ * 1 means parent, 2 means grandparent etc. If the node doesn't have as many
172
+ * ancestors, the root of the model is returned. This can be determined by checking
173
+ * that the range returned includes 0.
174
+ * @returns Tree index range of the subtree spanned by the ancestor at the
175
+ * "generation" specified, or the root.
176
+ */
177
+ getAncestorTreeIndices(treeIndex: number, generation: number): Promise<NumericRange>;
178
+ /**
179
+ * Determines the full bounding box of the model.
180
+ * @param outBbox Optional. Used to write result to.
181
+ * @param restrictToMostGeometry Optional. When true, returned bounds are restricted to
182
+ * where most of the geometry is located. This is useful for models that have junk geometry
183
+ * located far from the "main" model. Added in version 1.3.0.
184
+ * @returns Model bounding box.
185
+ *
186
+ * @example
187
+ * ```js
188
+ * const box = new THREE.Box3()
189
+ * model.getModelBoundingBox(box);
190
+ * // box now has the bounding box
191
+ * ```
192
+ * ```js
193
+ * // the following code does the same
194
+ * const box = model.getModelBoundingBox();
195
+ * ```
196
+ */
197
+ getModelBoundingBox(outBbox?: THREE.Box3, restrictToMostGeometry?: boolean): THREE.Box3;
198
+ /**
199
+ * Retrieves the camera position and target stored for the model. Typically this
200
+ * is used to store a good starting position for a model. Returns `undefined` if there
201
+ * isn't any stored camera configuration for the model.
202
+ */
203
+ getCameraConfiguration(): CameraConfiguration | undefined;
204
+ /**
205
+ * Sets transformation matrix of the model. This overrides the current transformation.
206
+ * @param matrix Transformation matrix.
207
+ */
208
+ setModelTransformation(matrix: THREE.Matrix4): void;
209
+ /**
210
+ * Gets transformation matrix of the model.
211
+ * @param out Preallocated `THREE.Matrix4` (optional).
212
+ */
213
+ getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
214
+ /**
215
+ * Fetches a bounding box from the CDF by the nodeId.
216
+ * @param nodeId
217
+ * @param box Optional. Used to write result to.
218
+ * @example
219
+ * ```js
220
+ * const box = new THREE.Box3()
221
+ * const nodeId = 100500;
222
+ * await model.getBoundingBoxByNodeId(nodeId, box);
223
+ * // box now has the bounding box
224
+ *```
225
+ * ```js
226
+ * // the following code does the same
227
+ * const box = await model.getBoundingBoxByNodeId(nodeId);
228
+ * ```
229
+ */
230
+ getBoundingBoxByNodeId(nodeId: number, box?: THREE.Box3): Promise<THREE.Box3>;
231
+ /**
232
+ * Determine the bounding box of the node identified by the tree index provided. Note that this
233
+ * function uses the CDF API to look up the bounding box.
234
+ * @param treeIndex Tree index of the node to find bounding box for.
235
+ * @param box Optional preallocated container to hold the bounding box.
236
+ * @example
237
+ * ```js
238
+ * const box = new THREE.Box3()
239
+ * const treeIndex = 42;
240
+ * await model.getBoundingBoxByTreeIndex(treeIndex, box);
241
+ * // box now has the bounding box
242
+ *```
243
+ * ```js
244
+ * // the following code does the same
245
+ * const box = await model.getBoundingBoxByTreeIndex(treeIndex);
246
+ * ```
247
+ */
248
+ getBoundingBoxByTreeIndex(treeIndex: number, box?: THREE.Box3): Promise<THREE.Box3>;
249
+ /**
250
+ * Iterates over all nodes in the model and applies the provided action to each node (identified by tree index).
251
+ * The passed action is applied incrementally to avoid main thread blocking, meaning that the changes can be partially
252
+ * applied until promise is resolved (iteration is done).
253
+ * @param action Function that will be called with a treeIndex argument.
254
+ * @returns Promise that is resolved once the iteration is done.
255
+ * @example
256
+ * ```js
257
+ * const logIndex = (treeIndex) => console.log(treeIndex);
258
+ * await model.iterateNodesByTreeIndex(logIndex); // 0, 1, 2, ...
259
+ * ```
260
+ */
261
+ iterateNodesByTreeIndex(action: (treeIndex: number) => void): Promise<void>;
262
+ /**
263
+ * Returns the number of nodes in the model.
264
+ */
265
+ get nodeCount(): number;
266
+ /**
267
+ * Iterates over all nodes in a subtree of the model and applies the provided action to each node
268
+ * (identified by tree index). The provided node is included in the visited set. The passed action
269
+ * is applied incrementally to avoid main thread blocking, meaning that the changes can be partially
270
+ * applied until promise is resolved (iteration is done).
271
+ * @param treeIndex Tree index of the top parent of the subtree.
272
+ * @param action Function that will be called with a treeIndex argument.
273
+ * @returns Promise that is resolved once the iteration is done.
274
+ * @example
275
+ * ```js
276
+ * // make a subtree to be gray
277
+ * await model.iterateNodesByTreeIndex(treeIndex => {
278
+ * model.setNodeColorByTreeIndex(treeIndex, 127, 127, 127);
279
+ * });
280
+ * ```
281
+ */
282
+ iterateSubtreeByTreeIndex(treeIndex: number, action: (treeIndex: number) => void): Promise<void>;
283
+ /**
284
+ * Set override transform of the node by tree index.
285
+ * @param treeIndex
286
+ * @param transform
287
+ * @param applyToChildren
288
+ */
289
+ setNodeTransformByTreeIndex(treeIndex: number, transform: THREE.Matrix4, applyToChildren?: boolean): Promise<number>;
290
+ /**
291
+ * Remove override transform of the node by tree index.
292
+ * @param treeIndex
293
+ * @param applyToChildren
294
+ */
295
+ resetNodeTransformByTreeIndex(treeIndex: number, applyToChildren?: boolean): Promise<number>;
296
+ /**
297
+ * Maps a list of Node IDs to tree indices. This function is useful when you have
298
+ * a list of nodes, e.g. from Asset Mappings, that you want to highlight, hide,
299
+ * color etc in the viewer.
300
+ *
301
+ * @param nodeIds List of node IDs to map to tree indices.
302
+ * @returns A list of tree indices corresponing to the elements in the input.
303
+ * @throws If an invalid/non-existant node ID is provided the function throws an error.
304
+ */
305
+ mapNodeIdsToTreeIndices(nodeIds: CogniteInternalId[]): Promise<number[]>;
306
+ /**
307
+ * Maps a single node ID to tree index. This is useful when you e.g. have a
308
+ * node ID from an asset mapping and want to highlight the given asset using
309
+ * {@link mapNodeIdsToTreeIndices} is recommended for better performance when
310
+ * mapping multiple IDs.
311
+ *
312
+ * @param nodeId A Node ID to map to a tree index.
313
+ * @returns TreeIndex of the provided node.
314
+ * @throws If an invalid/non-existant node ID is provided the function throws an error.
315
+ */
316
+ mapNodeIdToTreeIndex(nodeId: CogniteInternalId): Promise<number>;
317
+ /**
318
+ * Maps a list of tree indices to node IDs for use with the Cognite SDK.
319
+ * This function is useful if you have a list of tree indices, e.g. from
320
+ * {@link Cognite3DModel.iterateSubtreeByTreeIndex}, and want to perform
321
+ * some operations on these nodes using the SDK.
322
+ *
323
+ * @param treeIndices Tree indices to map to node IDs.
324
+ * @returns A list of node IDs corresponding to the elements of the input.
325
+ * @throws If an invalid tree index is provided the function throws an error.
326
+ */
327
+ mapTreeIndicesToNodeIds(treeIndices: number[]): Promise<CogniteInternalId[]>;
328
+ /**
329
+ * Maps a single tree index to node ID for use with the API. If you have multiple
330
+ * tree indices to map, {@link mapNodeIdsToTreeIndices} is recommended for better
331
+ * performance.
332
+ * @param treeIndex A tree index to map to a Node ID.
333
+ * @returns TreeIndex of the provided node.
334
+ * @throws If an invalid/non-existent node ID is provided the function throws an error.
335
+ */
336
+ mapTreeIndexToNodeId(treeIndex: number): Promise<CogniteInternalId>;
337
+ /** @private */
338
+ private determineTreeIndices;
339
+ }