@thatopen/components 2.0.11 → 2.0.13

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 (50) hide show
  1. package/dist/core/Clipper/index.d.ts +1 -1
  2. package/dist/core/Clipper/src/simple-plane.d.ts +16 -16
  3. package/dist/core/Components/index.d.ts +2 -2
  4. package/dist/core/Cullers/index.d.ts +3 -3
  5. package/dist/core/Cullers/src/culler-renderer.d.ts +1 -1
  6. package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +6 -6
  7. package/dist/core/Disposer/index.d.ts +1 -1
  8. package/dist/core/Grids/index.d.ts +10 -9
  9. package/dist/core/Grids/src/simple-grid.d.ts +16 -4
  10. package/dist/core/MiniMap/index.d.ts +20 -19
  11. package/dist/core/MiniMap/src/index.d.ts +16 -16
  12. package/dist/core/OrthoPerspectiveCamera/index.d.ts +8 -8
  13. package/dist/core/Raycasters/index.d.ts +2 -1
  14. package/dist/core/Raycasters/src/mouse.d.ts +1 -4
  15. package/dist/core/Raycasters/src/simple-raycaster.d.ts +9 -11
  16. package/dist/core/Types/src/base-camera.d.ts +1 -1
  17. package/dist/core/Types/src/base-renderer.d.ts +19 -19
  18. package/dist/core/Types/src/base-scene.d.ts +3 -3
  19. package/dist/core/Worlds/index.d.ts +15 -15
  20. package/dist/core/Worlds/src/simple-camera.d.ts +1 -1
  21. package/dist/core/Worlds/src/simple-scene.d.ts +3 -3
  22. package/dist/fragments/BoundingBoxer/index.d.ts +151 -1
  23. package/dist/fragments/Classifier/index.d.ts +133 -0
  24. package/dist/fragments/Exploder/index.d.ts +39 -2
  25. package/dist/fragments/FragmentsManager/index.d.ts +45 -6
  26. package/dist/fragments/Hider/index.d.ts +28 -0
  27. package/dist/fragments/IfcGeometryTiler/index.d.ts +62 -4
  28. package/dist/fragments/IfcGeometryTiler/src/base-types.d.ts +14 -0
  29. package/dist/fragments/IfcGeometryTiler/src/index.d.ts +0 -1
  30. package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +11 -5
  31. package/dist/fragments/IfcLoader/index.d.ts +89 -4
  32. package/dist/fragments/IfcLoader/src/ifc-fragment-settings.d.ts +14 -0
  33. package/dist/fragments/IfcPropertiesTiler/index.d.ts +44 -4
  34. package/dist/fragments/IfcPropertiesTiler/src/index.d.ts +1 -0
  35. package/dist/fragments/IfcPropertiesTiler/src/streaming-settings.d.ts +11 -0
  36. package/dist/ifc/IfcJsonExporter/index.d.ts +7 -2
  37. package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +3 -0
  38. package/dist/ifc/IfcJsonExporter/src/index.d.ts +1 -0
  39. package/dist/ifc/IfcPropertiesManager/index.d.ts +195 -11
  40. package/dist/ifc/IfcRelationsIndexer/index.d.ts +20 -11
  41. package/dist/ifc/Utils/ifc-category-map.d.ts +3 -0
  42. package/dist/ifc/Utils/ifc-elements-map.d.ts +8 -0
  43. package/dist/index.cjs +5 -5
  44. package/dist/index.mjs +3564 -2892
  45. package/dist/measurement/MeasurementUtils/index.d.ts +76 -0
  46. package/dist/measurement/index.d.ts +1 -1
  47. package/dist/namespace.d.ts +2095 -1239
  48. package/package.json +1 -1
  49. package/dist/fragments/IfcGeometryTiler/src/fragment-props-stream-converter.d.ts +0 -27
  50. package/dist/measurement/Utils/index.d.ts +0 -24
@@ -1,13 +1,13 @@
1
1
  declare namespace OBC {
2
2
  import { Component, Disposable, Event } from "../Types";
3
3
  /**
4
- * The entry point of the Components library. It can create and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
4
+ * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
5
5
  */
6
6
  export declare class Components implements Disposable {
7
7
  /**
8
8
  * The version of the @thatopen/components library.
9
9
  */
10
- static readonly release = "2.0.11";
10
+ static readonly release = "2.0.12";
11
11
  /** {@link Disposable.onDisposed} */
12
12
  readonly onDisposed: Event<void>;
13
13
  /**
@@ -79,7 +79,7 @@ import * as THREE from "three";
79
79
  import { Components } from "../Components";
80
80
  import { Component } from "../Types";
81
81
  /**
82
- * A tool to safely remove meshes and geometries from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
82
+ * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
83
83
  */
84
84
  export declare class Disposer extends Component {
85
85
  private _disposedComponents;
@@ -124,7 +124,7 @@ import { Component, Disposable, World, Event } from "../Types";
124
124
  import { SimpleRaycaster } from "./src";
125
125
  import { Components } from "../Components";
126
126
  /**
127
- * A component that manages raycasters for different worlds. It uses a Map to store raycasters for each world, and automatically disposes them when the world is disposed.
127
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
128
128
  */
129
129
  export declare class Raycasters extends Component implements Disposable {
130
130
  /**
@@ -162,11 +162,60 @@ export declare class Raycasters extends Component implements Disposable {
162
162
  /** {@link Disposable.dispose} */
163
163
  dispose(): void;
164
164
  }
165
+ import { Component, Disposable, World, Event } from "../Types";
166
+ import { GridConfig, SimpleGrid } from "./src";
167
+ import { Components } from "../Components";
168
+ /**
169
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
170
+ */
171
+ export declare class Grids extends Component implements Disposable {
172
+ /**
173
+ * A unique identifier for the component.
174
+ * This UUID is used to register the component within the Components system.
175
+ */
176
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
177
+ /**
178
+ * A map of world UUIDs to their corresponding grid instances.
179
+ */
180
+ list: Map<string, SimpleGrid>;
181
+ /**
182
+ * The default configuration for grid creation.
183
+ */
184
+ config: Required<GridConfig>;
185
+ /** {@link Disposable.onDisposed} */
186
+ readonly onDisposed: Event<unknown>;
187
+ /** {@link Component.enabled} */
188
+ enabled: boolean;
189
+ constructor(components: Components);
190
+ /**
191
+ * Creates a new grid for the given world.
192
+ * Throws an error if a grid already exists for the world.
193
+ *
194
+ * @param world - The world to create the grid for.
195
+ * @returns The newly created grid.
196
+ *
197
+ * @throws Will throw an error if a grid already exists for the given world.
198
+ */
199
+ create(world: World): SimpleGrid;
200
+ /**
201
+ * Deletes the grid associated with the given world.
202
+ * If a grid does not exist for the given world, this method does nothing.
203
+ *
204
+ * @param world - The world for which to delete the grid.
205
+ *
206
+ * @remarks
207
+ * This method will dispose of the grid and remove it from the internal list.
208
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
209
+ */
210
+ delete(world: World): void;
211
+ /** {@link Disposable.dispose} */
212
+ dispose(): void;
213
+ }
165
214
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
166
215
  import { Components } from "../Components";
167
216
  import { SimpleWorld } from "./src";
168
217
  /**
169
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds.
218
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
170
219
  */
171
220
  export declare class Worlds extends Component implements Updateable, Disposable {
172
221
  /**
@@ -209,70 +258,69 @@ export declare class Worlds extends Component implements Updateable, Disposable
209
258
  */
210
259
  create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
211
260
  /**
212
- * Deletes a world from the list of worlds.
213
- *
214
- * @param {World} world - The world to be deleted.
215
- *
216
- * @throws {Error} - Throws an error if the provided world is not found in the list.
217
- *
218
- * @returns {void}
219
- */
261
+ * Deletes a world from the list of worlds.
262
+ *
263
+ * @param {World} world - The world to be deleted.
264
+ *
265
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
266
+ *
267
+ * @returns {void}
268
+ */
220
269
  delete(world: World): void;
221
270
  /**
222
- * Disposes of the Worlds component and all its managed worlds.
223
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
224
- * and triggers the onDisposed event.
225
- *
226
- * @returns {void}
227
- */
271
+ * Disposes of the Worlds component and all its managed worlds.
272
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
273
+ * and triggers the onDisposed event.
274
+ *
275
+ * @returns {void}
276
+ */
228
277
  dispose(): void;
229
278
  /** {@link Updateable.update} */
230
279
  update(delta?: number): void | Promise<void>;
231
280
  }
232
- import { Component, Disposable, World, Event } from "../Types";
233
- import { GridConfig, SimpleGrid } from "./src";
234
281
  import { Components } from "../Components";
282
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
283
+ import { Component, Event, Disposable, World } from "../Types";
235
284
  /**
236
- * A component that manages and provides access to multiple grid instances. Each grid is associated with a unique world.
285
+ * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
237
286
  */
238
- export declare class Grids extends Component implements Disposable {
287
+ export declare class Cullers extends Component implements Disposable {
239
288
  /**
240
289
  * A unique identifier for the component.
241
290
  * This UUID is used to register the component within the Components system.
242
291
  */
243
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
292
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
244
293
  /**
245
- * A map of world UUIDs to their corresponding grid instances.
294
+ * An event that is triggered when the Cullers component is disposed.
246
295
  */
247
- list: Map<string, SimpleGrid>;
296
+ readonly onDisposed: Event<unknown>;
297
+ private _enabled;
248
298
  /**
249
- * The default configuration for grid creation.
299
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
250
300
  */
251
- config: Required<GridConfig>;
252
- /** {@link Disposable.onDisposed} */
253
- readonly onDisposed: Event<unknown>;
301
+ list: Map<string, MeshCullerRenderer>;
254
302
  /** {@link Component.enabled} */
255
- enabled: boolean;
303
+ get enabled(): boolean;
304
+ /** {@link Component.enabled} */
305
+ set enabled(value: boolean);
256
306
  constructor(components: Components);
257
307
  /**
258
- * Creates a new grid for the given world.
259
- * Throws an error if a grid already exists for the world.
260
- *
261
- * @param world - The world to create the grid for.
262
- * @returns The newly created grid.
263
- *
264
- * @throws Will throw an error if a grid already exists for the given world.
265
- */
266
- create(world: World): SimpleGrid;
308
+ * Creates a new MeshCullerRenderer for the given world.
309
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
310
+ *
311
+ * @param world - The world for which to create the MeshCullerRenderer.
312
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
313
+ *
314
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
315
+ */
316
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
267
317
  /**
268
- * Deletes the grid associated with the given world.
269
- * If a grid does not exist for the given world, this method does nothing.
318
+ * Deletes the MeshCullerRenderer associated with the given world.
319
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
270
320
  *
271
- * @param world - The world for which to delete the grid.
321
+ * @param world - The world for which to delete the MeshCullerRenderer.
272
322
  *
273
- * @remarks
274
- * This method will dispose of the grid and remove it from the internal list.
275
- * If the world is disposed before calling this method, the grid will be automatically deleted.
323
+ * @returns {void}
276
324
  */
277
325
  delete(world: World): void;
278
326
  /** {@link Disposable.dispose} */
@@ -283,7 +331,7 @@ import { Component, Createable, Disposable, Event, Hideable, World } from "../Ty
283
331
  import { SimplePlane } from "./src";
284
332
  import { Components } from "../Components";
285
333
  /**
286
- * A lightweight component to easily create and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
334
+ * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
287
335
  *
288
336
  * @param components - the instance of {@link Components} used.
289
337
  * E.g. {@link SimplePlane}.
@@ -405,72 +453,59 @@ export declare class Clipper extends Component implements Createable, Disposable
405
453
  private _onStartDragging;
406
454
  private _onEndDragging;
407
455
  }
408
- import * as THREE from "three";
409
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
410
- center: THREE.Vector3;
411
- halfSizes: THREE.Vector3;
412
- rotation: THREE.Matrix3;
413
- transformation: THREE.Matrix4;
414
- };
415
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
416
- import * as THREE from "three";
417
- export declare class MaterialsUtils {
418
- static isTransparent(material: THREE.Material): boolean;
419
- }
456
+ import { MiniMap } from "./src";
457
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
420
458
  import { Components } from "../Components";
421
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
422
- import { Component, Event, Disposable, World } from "../Types";
423
459
  /**
424
- * A component that manages and provides culling functionality for meshes in a 3D scene.
460
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
425
461
  */
426
- export declare class Cullers extends Component implements Disposable {
462
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
427
463
  /**
428
464
  * A unique identifier for the component.
429
465
  * This UUID is used to register the component within the Components system.
430
466
  */
431
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
432
- /**
433
- * An event that is triggered when the Cullers component is disposed.
434
- */
467
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
468
+ /** {@link Updateable.onAfterUpdate} */
469
+ readonly onAfterUpdate: Event<unknown>;
470
+ /** {@link Updateable.onBeforeUpdate} */
471
+ readonly onBeforeUpdate: Event<unknown>;
472
+ /** {@link Disposable.onDisposed} */
435
473
  readonly onDisposed: Event<unknown>;
436
- private _enabled;
474
+ /** {@link Component.enabled} */
475
+ enabled: boolean;
437
476
  /**
438
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
477
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
439
478
  */
440
- list: Map<string, MeshCullerRenderer>;
441
- /** {@link Component.enabled} */
442
- get enabled(): boolean;
443
- /** {@link Component.enabled} */
444
- set enabled(value: boolean);
479
+ list: Map<string, MiniMap>;
445
480
  constructor(components: Components);
446
481
  /**
447
- * Creates a new MeshCullerRenderer for the given world.
448
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
449
- *
450
- * @param world - The world for which to create the MeshCullerRenderer.
451
- * @param config - Optional configuration settings for the MeshCullerRenderer.
482
+ * Creates a new {@link MiniMap} instance associated with the given world.
483
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
452
484
  *
453
- * @returns The newly created or existing MeshCullerRenderer for the given world.
485
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
486
+ * @returns The newly created {@link MiniMap} instance.
487
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
454
488
  */
455
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
489
+ create(world: World): MiniMap;
456
490
  /**
457
- * Deletes the MeshCullerRenderer associated with the given world.
458
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
459
- *
460
- * @param world - The world for which to delete the MeshCullerRenderer.
491
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
492
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
461
493
  *
494
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
462
495
  * @returns {void}
463
496
  */
464
- delete(world: World): void;
497
+ delete(id: string): void;
465
498
  /** {@link Disposable.dispose} */
466
499
  dispose(): void;
500
+ /** {@link Updateable.update} */
501
+ update(): void;
467
502
  }
468
503
  import * as THREE from "three";
469
504
  import { Components } from "../Components";
470
505
  import { SimpleCamera } from "..";
471
506
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
472
507
  /**
473
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to easily control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes.
508
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
474
509
  */
475
510
  export declare class OrthoPerspectiveCamera extends SimpleCamera {
476
511
  /**
@@ -493,13 +528,13 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
493
528
  protected _mode: NavigationMode | null;
494
529
  private previousSize;
495
530
  /**
496
- * Getter for the current navigation mode.
497
- * Throws an error if the mode is not found or the camera is not initialized.
498
- *
499
- * @returns {NavigationMode} The current navigation mode.
500
- *
501
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
502
- */
531
+ * Getter for the current navigation mode.
532
+ * Throws an error if the mode is not found or the camera is not initialized.
533
+ *
534
+ * @returns {NavigationMode} The current navigation mode.
535
+ *
536
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
537
+ */
503
538
  get mode(): NavigationMode;
504
539
  constructor(components: Components);
505
540
  /** {@link Disposable.dispose} */
@@ -529,467 +564,549 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
529
564
  private newOrthoCamera;
530
565
  private setOrthoPerspCameraAspect;
531
566
  }
532
- import { MiniMap } from "./src";
533
- import { Component, Updateable, World, Event, Disposable } from "../Types";
534
- import { Components } from "../Components";
567
+ import * as THREE from "three";
568
+ import * as FRAGS from "@thatopen/fragments";
569
+ import { FragmentsGroup } from "@thatopen/fragments";
570
+ import { Component, Components, Disposable, Event } from "../../core";
535
571
  /**
536
- * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID.
572
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
537
573
  */
538
- export declare class MiniMaps extends Component implements Updateable, Disposable {
539
- /**
540
- * A unique identifier for the component.
541
- * This UUID is used to register the component within the Components system.
542
- */
543
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
544
- /** {@link Updateable.onAfterUpdate} */
545
- readonly onAfterUpdate: Event<unknown>;
546
- /** {@link Updateable.onBeforeUpdate} */
547
- readonly onBeforeUpdate: Event<unknown>;
548
- /** {@link Disposable.onDisposed} */
549
- readonly onDisposed: Event<unknown>;
574
+ export declare class BoundingBoxer extends Component implements Disposable {
575
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
550
576
  /** {@link Component.enabled} */
551
577
  enabled: boolean;
552
- /**
553
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
554
- */
555
- list: Map<string, MiniMap>;
578
+ /** {@link Disposable.onDisposed} */
579
+ readonly onDisposed: Event<unknown>;
580
+ private _absoluteMin;
581
+ private _absoluteMax;
582
+ private _meshes;
556
583
  constructor(components: Components);
557
584
  /**
558
- * Creates a new {@link MiniMap} instance associated with the given world.
559
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
560
- *
561
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
562
- * @returns The newly created {@link MiniMap} instance.
563
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
564
- */
565
- create(world: World): MiniMap;
585
+ * A static method to calculate the dimensions of a given bounding box.
586
+ *
587
+ * @param bbox - The bounding box to calculate the dimensions for.
588
+ * @returns An object containing the width, height, depth, and center of the bounding box.
589
+ */
590
+ static getDimensions(bbox: THREE.Box3): {
591
+ width: number;
592
+ height: number;
593
+ depth: number;
594
+ center: THREE.Vector3;
595
+ };
566
596
  /**
567
- * Deletes a {@link MiniMap} instance associated with the given world ID.
568
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
569
- *
570
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
571
- * @returns {void}
572
- */
573
- delete(id: string): void;
597
+ * A static method to create a new bounding box boundary.
598
+ *
599
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
600
+ * @returns A new THREE.Vector3 representing the boundary.
601
+ *
602
+ * @remarks
603
+ * This method is used to create a new boundary for calculating bounding boxes.
604
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
605
+ * depending on the value of the 'positive' parameter.
606
+ *
607
+ * @example
608
+ * '''typescript
609
+ * const positiveBound = BoundingBoxer.newBound(true);
610
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
611
+ *
612
+ * const negativeBound = BoundingBoxer.newBound(false);
613
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
614
+ * '''
615
+ */
616
+ static newBound(positive: boolean): THREE.Vector3;
617
+ /**
618
+ * A static method to calculate the bounding box of a set of points.
619
+ *
620
+ * @param points - An array of THREE.Vector3 representing the points.
621
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
622
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
623
+ * @returns A THREE.Box3 representing the bounding box of the given points.
624
+ *
625
+ * @remarks
626
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
627
+ * If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
628
+ *
629
+ * @example
630
+ * '''typescript
631
+ * const points = [
632
+ * new THREE.Vector3(1, 2, 3),
633
+ * new THREE.Vector3(4, 5, 6),
634
+ * new THREE.Vector3(7, 8, 9),
635
+ * ];
636
+ *
637
+ * const bbox = BoundingBoxer.getBounds(points);
638
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
639
+ * '''
640
+ */
641
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
574
642
  /** {@link Disposable.dispose} */
575
643
  dispose(): void;
576
- /** {@link Updateable.update} */
577
- update(): void;
644
+ /**
645
+ * Returns the bounding box of the calculated fragments.
646
+ *
647
+ * @returns A new THREE.Box3 instance representing the bounding box.
648
+ *
649
+ * @remarks
650
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
651
+ * The returned box represents the bounding box of the calculated fragments.
652
+ *
653
+ * @example
654
+ * '''typescript
655
+ * const boundingBox = boundingBoxer.get();
656
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
657
+ * '''
658
+ */
659
+ get(): THREE.Box3;
660
+ /**
661
+ * Calculates and returns a sphere that encompasses the entire bounding box.
662
+ *
663
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
664
+ *
665
+ * @remarks
666
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
667
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
668
+ * The radius is calculated as the distance from the center to the minimum bound.
669
+ *
670
+ * @example
671
+ * '''typescript
672
+ * const boundingBoxer = components.get(BoundingBoxer);
673
+ * boundingBoxer.add(fragmentsGroup);
674
+ * const boundingSphere = boundingBoxer.getSphere();
675
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
676
+ * '''
677
+ */
678
+ getSphere(): THREE.Sphere;
679
+ /**
680
+ * Returns a THREE.Mesh instance representing the bounding box.
681
+ *
682
+ * @returns A new THREE.Mesh instance representing the bounding box.
683
+ *
684
+ * @remarks
685
+ * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
686
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
687
+ * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
688
+ * The position of the mesh is set to the center of the bounding box.
689
+ *
690
+ * @example
691
+ * '''typescript
692
+ * const boundingBoxer = components.get(BoundingBoxer);
693
+ * boundingBoxer.add(fragmentsGroup);
694
+ * const boundingBoxMesh = boundingBoxer.getMesh();
695
+ * scene.add(boundingBoxMesh);
696
+ * '''
697
+ */
698
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
699
+ /**
700
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
701
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
702
+ *
703
+ * @remarks
704
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
705
+ * It ensures that the bounding box calculations are accurate and up-to-date.
706
+ *
707
+ * @example
708
+ * '''typescript
709
+ * const boundingBoxer = components.get(BoundingBoxer);
710
+ * boundingBoxer.add(fragmentsGroup);
711
+ * // ...
712
+ * boundingBoxer.reset();
713
+ * '''
714
+ */
715
+ reset(): void;
716
+ /**
717
+ * Adds a FragmentsGroup to the BoundingBoxer.
718
+ *
719
+ * @param group - The FragmentsGroup to add.
720
+ *
721
+ * @remarks
722
+ * This method iterates through each fragment in the provided FragmentsGroup,
723
+ * and calls the 'addMesh' method for each fragment's mesh.
724
+ *
725
+ * @example
726
+ * '''typescript
727
+ * const boundingBoxer = components.get(BoundingBoxer);
728
+ * boundingBoxer.add(fragmentsGroup);
729
+ * '''
730
+ */
731
+ add(group: FragmentsGroup): void;
732
+ /**
733
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
734
+ *
735
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
736
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
737
+ *
738
+ * @remarks
739
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
740
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
741
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
742
+ *
743
+ * @example
744
+ * '''typescript
745
+ * const boundingBoxer = components.get(BoundingBoxer);
746
+ * boundingBoxer.addMesh(mesh);
747
+ * '''
748
+ */
749
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
750
+ private static getFragmentBounds;
578
751
  }
579
752
  import * as THREE from "three";
580
- import { Component, Components } from "../../core";
581
- export interface MeasureEdge {
582
- distance: number;
583
- points: THREE.Vector3[];
753
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
754
+ center: THREE.Vector3;
755
+ halfSizes: THREE.Vector3;
756
+ rotation: THREE.Matrix3;
757
+ transformation: THREE.Matrix4;
758
+ };
759
+ import * as THREE from "three";
760
+ export declare class MaterialsUtils {
761
+ static isTransparent(material: THREE.Material): boolean;
584
762
  }
585
- export declare class MeasurementUtils extends Component {
763
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
764
+ export declare class UUID {
765
+ private static _pattern;
766
+ private static _lut;
767
+ static create(): string;
768
+ static validate(uuid: string): void;
769
+ }
770
+ import * as THREE from "three";
771
+ import { Component, Components, Event, World } from "../core";
772
+ export interface VertexPickerConfig {
773
+ showOnlyVertex: boolean;
774
+ snapDistance: number;
775
+ previewElement: HTMLElement;
776
+ }
777
+ export declare class VertexPicker extends Component {
778
+ onVertexFound: Event<THREE.Vector3>;
779
+ onVertexLost: Event<THREE.Vector3>;
780
+ components: Components;
781
+ private _pickedPoint;
782
+ private _config;
783
+ private _enabled;
784
+ private _workingPlane;
785
+ set enabled(value: boolean);
786
+ get enabled(): boolean;
787
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
788
+ set workingPlane(plane: THREE.Plane | null);
789
+ get workingPlane(): THREE.Plane | null;
790
+ set config(value: Partial<VertexPickerConfig>);
791
+ get config(): Partial<VertexPickerConfig>;
792
+ dispose(): void;
793
+ get(world: World): THREE.Vector3 | null;
794
+ private getClosestVertex;
795
+ private getVertices;
796
+ private getVertex;
797
+ }
798
+ import * as FRAGS from "@thatopen/fragments";
799
+ import { Components, Component } from "../../core";
800
+ /**
801
+ * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
802
+ */
803
+ export declare class Hider extends Component {
804
+ /**
805
+ * A unique identifier for the component.
806
+ * This UUID is used to register the component within the Components system.
807
+ */
808
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
809
+ /** {@link Component.enabled} */
586
810
  enabled: boolean;
587
- static uuid: string;
588
811
  constructor(components: Components);
589
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
590
- edges: MeasureEdge[];
591
- indices: Set<number>;
592
- } | null;
593
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
594
- private getFaceData;
595
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
596
- p1: THREE.Vector3;
597
- p2: THREE.Vector3;
598
- p3: THREE.Vector3;
599
- faceNormal: THREE.Vector3;
600
- };
601
- private round;
812
+ /**
813
+ * Sets the visibility of fragments within the 3D scene.
814
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
815
+ * If 'items' is provided, only the specified fragments will be affected.
816
+ *
817
+ * @param visible - The visibility state to set for the fragments.
818
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
819
+ * If not provided, all fragments will be affected.
820
+ *
821
+ * @returns {void}
822
+ */
823
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
824
+ /**
825
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
826
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
827
+ *
828
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
829
+ * If not provided, all fragments will be isolated.
830
+ *
831
+ * @returns {void}
832
+ */
833
+ isolate(items: FRAGS.FragmentIdMap): void;
834
+ private updateCulledVisibility;
602
835
  }
603
- import * as WEBIFC from "web-ifc";
604
- import * as FRAG from "@thatopen/fragments";
605
- import { Component, Components } from "../../core";
836
+ import { Component, Disposable, Event, Components } from "../../core";
606
837
  /**
607
- * Object to export all the properties from an IFC to a JS object.
838
+ * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
608
839
  */
609
- export declare class IfcJsonExporter extends Component {
610
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
840
+ export declare class Exploder extends Component implements Disposable {
841
+ /**
842
+ * A unique identifier for the component.
843
+ * This UUID is used to register the component within the Components system.
844
+ */
845
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
846
+ /** {@link Disposable.onDisposed} */
847
+ readonly onDisposed: Event<unknown>;
611
848
  /** {@link Component.enabled} */
612
849
  enabled: boolean;
850
+ /**
851
+ * The height of the explosion animation.
852
+ * This property determines the vertical distance by which fragments are moved during the explosion.
853
+ * Default value is 10.
854
+ */
855
+ height: number;
856
+ /**
857
+ * The group name used for the explosion animation.
858
+ * This property specifies the group of fragments that will be affected by the explosion.
859
+ * Default value is "storeys".
860
+ */
861
+ groupName: string;
862
+ /**
863
+ * A set of strings representing the exploded items.
864
+ * This set is used to keep track of which items have been exploded.
865
+ */
866
+ list: Set<string>;
613
867
  constructor(components: Components);
868
+ /** {@link Disposable.dispose} */
869
+ dispose(): void;
614
870
  /**
615
- * Exports all the properties of an IFC into an array of JS objects.
616
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
617
- * @param modelID ID of the IFC model whose properties to extract.
618
- * @param indirect whether to get the indirect relationships as well.
619
- * @param recursiveSpatial whether to get the properties of spatial items recursively
620
- * to make the location data available (e.g. absolute position of building).
871
+ * Sets the explosion state of the fragments.
872
+ *
873
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
874
+ *
875
+ * @remarks
876
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
877
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
878
+ * If 'active' is false, the fragments are moved back to their original position.
879
+ *
880
+ * The method also keeps track of the exploded items using the 'list' set.
881
+ *
882
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
621
883
  */
622
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
884
+ set(active: boolean): void;
623
885
  }
624
- import * as WEBIFC from "web-ifc";
625
- import { FragmentsGroup } from "@thatopen/fragments";
626
- import { Disposable, Event, Component, Components } from "../../core";
627
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
886
+ import * as THREE from "three";
887
+ import * as FRAGS from "@thatopen/fragments";
888
+ import { Disposable, Component, Event, Components } from "../../core";
628
889
  /**
629
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations.
890
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
630
891
  */
631
- export declare class IfcRelationsIndexer extends Component implements Disposable {
632
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
633
- /** {@link Disposable.onDisposed} */
634
- readonly onDisposed: Event<string>;
892
+ export interface Classification {
893
+ /**
894
+ * A system within the classification.
895
+ * The key is the system name, and the value is an object representing the classes within the system.
896
+ */
897
+ [system: string]: {
898
+ /**
899
+ * A class within the system.
900
+ * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
901
+ */
902
+ [className: string]: FRAGS.FragmentIdMap;
903
+ };
904
+ }
905
+ /**
906
+ * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
907
+ */
908
+ export declare class Classifier extends Component implements Disposable {
909
+ /**
910
+ * A unique identifier for the component.
911
+ * This UUID is used to register the component within the Components system.
912
+ */
913
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
914
+ /** {@link Component.enabled} */
635
915
  enabled: boolean;
636
- readonly onRelationsIndexed: Event<{
637
- modelID: string;
638
- relationsMap: RelationsMap;
639
- }>;
640
- private _relToAttributesMap;
641
- private _inverseAttributes;
642
- private _ifcRels;
643
916
  /**
644
- * Holds the relationship mappings for each model processed by the indexer.
645
- * The structure is a map where each key is a model's UUID, and the value is another map.
646
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
647
- * representing a specific relation type, and the value is an array of expressIDs of entities
648
- * that are related through that relation type. This structure allows for efficient querying
649
- * of entity relationships within a model.
917
+ * A map representing the classification systems.
918
+ * The key is the system name, and the value is an object representing the classes within the system.
650
919
  */
651
- readonly relationMaps: ModelsRelationMap;
920
+ list: Classification;
921
+ /** {@link Disposable.onDisposed} */
922
+ readonly onDisposed: Event<unknown>;
652
923
  constructor(components: Components);
653
924
  private onFragmentsDisposed;
654
- private indexRelations;
925
+ /** {@link Disposable.dispose} */
926
+ dispose(): void;
655
927
  /**
656
- * Adds a relation map to the model's relations map.
657
- *
658
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
659
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
928
+ * Removes a fragment from the classification based on its unique identifier (guid).
929
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
660
930
  *
661
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
931
+ * @param guid - The unique identifier of the fragment to be removed.
662
932
  */
663
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
933
+ remove(guid: string): void;
664
934
  /**
665
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
666
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
667
- * and maps them in a structured way to facilitate quick access to related entities.
935
+ * Finds and returns fragments based on the provided filter criteria.
936
+ * If no filter is provided, it returns all fragments.
668
937
  *
669
- * The process involves querying the model for each relation type associated with the inverse attributes
670
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
671
- * and contains a nested map where each key is an entity's expressID and its value is another map.
672
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
673
- * of entities that are related through that attribute.
938
+ * @param filter - An optional object containing filter criteria.
939
+ * The keys of the object represent the classification system names,
940
+ * and the values are arrays of class names to match.
674
941
  *
675
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
676
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
677
- * representation of the relations indexed by entity expressIDs and relation types.
678
- * @throws An error if the model does not have properties loaded.
942
+ * @returns A map of fragment GUIDs to their respective express IDs,
943
+ * where the express IDs are filtered based on the provided filter criteria.
944
+ *
945
+ * @throws Will throw an error if the fragments map is malformed.
679
946
  */
680
- process(model: FragmentsGroup): Promise<RelationsMap>;
947
+ find(filter?: {
948
+ [name: string]: string[];
949
+ }): FRAGS.FragmentIdMap;
681
950
  /**
682
- * Processes a given model from a WebIfc API to index its IFC entities relations.
951
+ * Classifies fragments based on their modelID.
952
+ *
953
+ * @param modelID - The unique identifier of the model to classify fragments by.
954
+ * @param group - The FragmentsGroup containing the fragments to be classified.
955
+ *
956
+ * @remarks
957
+ * This method iterates through the fragments in the provided group,
958
+ * and classifies them based on their modelID.
959
+ * The classification is stored in the 'list.models' property,
960
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
683
961
  *
684
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
685
- * @param modelID - The unique identifier of the model within the WebIfc API.
686
- * @returns A promise that resolves to the relations map for the processed model.
687
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
688
962
  */
689
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
963
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
690
964
  /**
691
- * Retrieves the relations of a specific entity within a model based on the given relation name.
692
- * This method searches the indexed relation maps for the specified model and entity,
693
- * returning the IDs of related entities if a match is found.
965
+ * Classifies fragments based on their PredefinedType property.
694
966
  *
695
- * @param model The 'FragmentsGroup' model containing the entity.
696
- * @param expressID The unique identifier of the entity within the model.
697
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
698
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
699
- * or the specified relation name is not indexed.
967
+ * @param group - The FragmentsGroup containing the fragments to be classified.
968
+ *
969
+ * @remarks
970
+ * This method iterates through the properties of the fragments in the provided group,
971
+ * and classifies them based on their PredefinedType property.
972
+ * The classification is stored in the 'list.predefinedTypes' property,
973
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
974
+ *
975
+ * @throws Will throw an error if the fragment ID is not found.
700
976
  */
701
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
977
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
702
978
  /**
703
- * Serializes the relations of a given relation map into a JSON string.
704
- * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
705
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
706
- * The resulting object is then serialized into a JSON string.
979
+ * Classifies fragments based on their entity type.
707
980
  *
708
- * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
709
- * @returns A JSON string representing the serialized relations of the given relation map.
981
+ * @param group - The FragmentsGroup containing the fragments to be classified.
982
+ *
983
+ * @remarks
984
+ * This method iterates through the relations of the fragments in the provided group,
985
+ * and classifies them based on their entity type.
986
+ * The classification is stored in the 'list.entities' property,
987
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
988
+ *
989
+ * @throws Will throw an error if the fragment ID is not found.
710
990
  */
711
- serializeRelations(relationMap: RelationsMap): string;
991
+ byEntity(group: FRAGS.FragmentsGroup): void;
712
992
  /**
713
- * Serializes the relations of a specific model into a JSON string.
714
- * This method iterates through the relations indexed for the given model,
715
- * organizing them into a structured object where each key is an expressID of an entity,
716
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
717
- * The resulting object is then serialized into a JSON string.
993
+ * Classifies fragments based on a specific IFC relationship.
718
994
  *
719
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
720
- * @returns A JSON string representing the serialized relations of the specified model.
721
- * If the model has no indexed relations, 'null' is returned.
995
+ * @param group - The FragmentsGroup containing the fragments to be classified.
996
+ * @param ifcRel - The IFC relationship number to classify fragments by.
997
+ * @param systemName - The name of the classification system to store the classification.
998
+ *
999
+ * @remarks
1000
+ * This method iterates through the relations of the fragments in the provided group,
1001
+ * and classifies them based on the specified IFC relationship.
1002
+ * The classification is stored in the 'list' property under the specified system name,
1003
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1004
+ *
1005
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
722
1006
  */
723
- serializeModelRelations(model: FragmentsGroup): string | null;
1007
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
724
1008
  /**
725
- * Serializes all relations of every model processed by the indexer into a JSON string.
726
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
727
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
728
- * and its value is another object mapping entity expressIDs to their related entities, categorized
729
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1009
+ * Classifies fragments based on their spatial structure in the IFC model.
730
1010
  *
731
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
732
- * If no relations have been indexed, an empty object is returned as a JSON string.
1011
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1012
+ *
1013
+ * @remarks
1014
+ * This method iterates through the relations of the fragments in the provided group,
1015
+ * and classifies them based on their spatial structure in the IFC model.
1016
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1017
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1018
+ *
1019
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
733
1020
  */
734
- serializeAllRelations(): string;
1021
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
735
1022
  /**
736
- * Converts a JSON string representing relations between entities into a structured map.
737
- * This method parses the JSON string to reconstruct the relations map that indexes
738
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
739
- * and the values are maps where each key is a relation type ID and its value is an array
740
- * of express IDs of entities related through that relation type.
1023
+ * Sets the color of the specified fragments.
741
1024
  *
742
- * @param json The JSON string to be parsed into the relations map.
743
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
744
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
745
- * is an array of express IDs (as numbers) of entities related through that relation type.
1025
+ * @param items - A map of fragment IDs to their respective express IDs.
1026
+ * @param color - The color to set for the fragments.
1027
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1028
+ *
1029
+ * @remarks
1030
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1031
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1032
+ *
1033
+ * @throws Will throw an error if the fragment with the specified ID is not found.
746
1034
  */
747
- getRelationsMapFromJSON(json: string): RelationsMap;
1035
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
748
1036
  /**
749
- * Disposes the component, cleaning up resources and detaching event listeners.
750
- * This ensures that the component is properly cleaned up and does not leave behind any
751
- * references that could prevent garbage collection.
752
- */
753
- dispose(): void;
754
- }
755
- export type { InverseAttribute, RelationsMap } from "./src/types";
756
- import * as WEBIFC from "web-ifc";
757
- import { FragmentsGroup } from "@thatopen/fragments";
758
- import { Component, Disposable, Event, Components } from "../../core";
759
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
760
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
761
- type NumericPropTypes = "IfcInteger" | "IfcReal";
762
- interface ChangeMap {
763
- [modelID: string]: Set<number>;
764
- }
765
- interface AttributeListener {
766
- [modelID: string]: {
767
- [expressID: number]: {
768
- [attributeName: string]: Event<String | Boolean | Number>;
769
- };
770
- };
771
- }
772
- export declare class IfcPropertiesManager extends Component implements Disposable {
773
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
774
- /** {@link Disposable.onDisposed} */
775
- readonly onDisposed: Event<string>;
776
- readonly onRequestFile: Event<unknown>;
777
- ifcToExport: ArrayBuffer | null;
778
- readonly onElementToPset: Event<{
779
- model: FragmentsGroup;
780
- psetID: number;
781
- elementID: number;
782
- }>;
783
- readonly onPropToPset: Event<{
784
- model: FragmentsGroup;
785
- psetID: number;
786
- propID: number;
787
- }>;
788
- readonly onPsetRemoved: Event<{
789
- model: FragmentsGroup;
790
- psetID: number;
791
- }>;
792
- readonly onDataChanged: Event<{
793
- model: FragmentsGroup;
794
- expressID: number;
795
- }>;
796
- wasm: {
797
- path: string;
798
- absolute: boolean;
799
- };
800
- enabled: boolean;
801
- attributeListeners: AttributeListener;
802
- selectedModel?: FragmentsGroup;
803
- changeMap: ChangeMap;
804
- constructor(components: Components);
805
- dispose(): void;
806
- private increaseMaxID;
807
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
808
- private newGUID;
809
- private getOwnerHistory;
810
- private registerChange;
811
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
812
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
813
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
814
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
815
- }>;
816
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
817
- private newSingleProperty;
818
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
819
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
820
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
821
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
822
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
823
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
824
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
825
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
826
- }
827
- export {};
828
- export declare class UUID {
829
- private static _pattern;
830
- private static _lut;
831
- static create(): string;
832
- static validate(uuid: string): void;
833
- }
834
- import * as THREE from "three";
835
- import { Component, Components, Event, World } from "../core";
836
- export interface VertexPickerConfig {
837
- showOnlyVertex: boolean;
838
- snapDistance: number;
839
- previewElement: HTMLElement;
840
- }
841
- export declare class VertexPicker extends Component {
842
- onVertexFound: Event<THREE.Vector3>;
843
- onVertexLost: Event<THREE.Vector3>;
844
- components: Components;
845
- private _pickedPoint;
846
- private _config;
847
- private _enabled;
848
- private _workingPlane;
849
- set enabled(value: boolean);
850
- get enabled(): boolean;
851
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
852
- set workingPlane(plane: THREE.Plane | null);
853
- get workingPlane(): THREE.Plane | null;
854
- set config(value: Partial<VertexPickerConfig>);
855
- get config(): Partial<VertexPickerConfig>;
856
- dispose(): void;
857
- get(world: World): THREE.Vector3 | null;
858
- private getClosestVertex;
859
- private getVertices;
860
- private getVertex;
861
- }
862
- import * as WEBIFC from "web-ifc";
863
- export interface IfcItemsCategories {
864
- [itemID: number]: number;
865
- }
866
- export declare class IfcCategories {
867
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
868
- }
869
- export declare const IfcElements: {
870
- [key: number]: string;
871
- };
872
- import * as THREE from "three";
873
- import * as FRAGS from "@thatopen/fragments";
874
- import { FragmentsGroup } from "@thatopen/fragments";
875
- import { Component, Components, Disposable, Event } from "../../core";
876
- /**
877
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
878
- */
879
- export declare class BoundingBoxer extends Component implements Disposable {
880
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
881
- /** {@link Component.enabled} */
882
- enabled: boolean;
883
- /** {@link Disposable.onDisposed} */
884
- readonly onDisposed: Event<unknown>;
885
- private _absoluteMin;
886
- private _absoluteMax;
887
- private _meshes;
888
- constructor(components: Components);
889
- static getDimensions(bbox: THREE.Box3): {
890
- width: number;
891
- height: number;
892
- depth: number;
893
- center: THREE.Vector3;
894
- };
895
- static newBound(positive: boolean): THREE.Vector3;
896
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
897
- /** {@link Disposable.dispose} */
898
- dispose(): void;
899
- get(): THREE.Box3;
900
- getSphere(): THREE.Sphere;
901
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
902
- reset(): void;
903
- add(group: FragmentsGroup): void;
904
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
905
- private static getFragmentBounds;
906
- }
907
- import { Component, Disposable, Event, Components } from "../../core";
908
- export declare class Exploder extends Component implements Disposable {
909
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
910
- enabled: boolean;
911
- height: number;
912
- groupName: string;
913
- /** {@link Disposable.onDisposed} */
914
- readonly onDisposed: Event<unknown>;
915
- list: Set<string>;
916
- constructor(components: Components);
917
- dispose(): void;
918
- set(active: boolean): void;
919
- }
920
- import * as THREE from "three";
921
- import * as FRAGS from "@thatopen/fragments";
922
- import { Disposable, Component, Event, Components } from "../../core";
923
- export interface Classification {
924
- [system: string]: {
925
- [className: string]: FRAGS.FragmentIdMap;
926
- };
927
- }
928
- export declare class Classifier extends Component implements Disposable {
929
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
930
- /** {@link Component.enabled} */
931
- enabled: boolean;
932
- list: Classification;
933
- /** {@link Disposable.onDisposed} */
934
- readonly onDisposed: Event<unknown>;
935
- constructor(components: Components);
936
- private onFragmentsDisposed;
937
- dispose(): void;
938
- remove(guid: string): void;
939
- find(filter?: {
940
- [name: string]: string[];
941
- }): FRAGS.FragmentIdMap;
942
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
943
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
944
- byEntity(group: FRAGS.FragmentsGroup): void;
945
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
946
- bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
947
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1037
+ * Resets the color of the specified fragments to their original color.
1038
+ *
1039
+ * @param items - A map of fragment IDs to their respective express IDs.
1040
+ *
1041
+ * @remarks
1042
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1043
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1044
+ *
1045
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1046
+ */
948
1047
  resetColor(items: FRAGS.FragmentIdMap): void;
949
1048
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
950
1049
  }
951
- import * as FRAGS from "@thatopen/fragments";
952
- import { Components, Component } from "../../core";
953
- export declare class Hider extends Component {
954
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
955
- enabled: boolean;
956
- constructor(components: Components);
957
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
958
- isolate(items: FRAGS.FragmentIdMap): void;
959
- private updateCulledVisibility;
960
- }
961
1050
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
962
1051
  import * as THREE from "three";
963
1052
  import * as FRAGS from "@thatopen/fragments";
964
1053
  import { Component, Components, Event, Disposable } from "../../core";
965
1054
  import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
966
1055
  /**
967
- * Object that can efficiently load binary files that contain [fragment geometry](https://github.com/ThatOpen/engine_fragment).
1056
+ * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
968
1057
  */
969
1058
  export declare class FragmentsManager extends Component implements Disposable {
1059
+ /**
1060
+ * A unique identifier for the component.
1061
+ * This UUID is used to register the component within the Components system.
1062
+ */
970
1063
  static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
971
1064
  /** {@link Disposable.onDisposed} */
972
1065
  readonly onDisposed: Event<unknown>;
1066
+ /**
1067
+ * Event triggered when fragments are loaded.
1068
+ */
973
1069
  readonly onFragmentsLoaded: Event<FragmentsGroup>;
1070
+ /**
1071
+ * Event triggered when fragments are disposed.
1072
+ */
974
1073
  readonly onFragmentsDisposed: Event<{
975
1074
  groupID: string;
976
1075
  fragmentIDs: string[];
977
1076
  }>;
978
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
1077
+ /**
1078
+ * Map containing all loaded fragments.
1079
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1080
+ */
979
1081
  readonly list: Map<string, Fragment>;
1082
+ /**
1083
+ * Map containing all loaded fragment groups.
1084
+ * The key is the group's unique identifier, and the value is the group itself.
1085
+ */
980
1086
  readonly groups: Map<string, FragmentsGroup>;
1087
+ baseCoordinationModel: string;
981
1088
  /** {@link Component.enabled} */
982
1089
  enabled: boolean;
983
- baseCoordinationModel: string;
984
1090
  private _loader;
985
- /** The list of meshes of the created fragments. */
1091
+ /**
1092
+ * Getter for the meshes of all fragments in the FragmentsManager.
1093
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1094
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1095
+ */
986
1096
  get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
987
1097
  constructor(components: Components);
988
1098
  /** {@link Disposable.dispose} */
989
1099
  dispose(): void;
1100
+ /**
1101
+ * Dispose of a specific fragment group.
1102
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1103
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1104
+ *
1105
+ * @param group - The fragment group to be disposed.
1106
+ */
990
1107
  disposeGroup(group: FragmentsGroup): void;
991
1108
  /**
992
- * Loads a binar file that contain fragment geometry.
1109
+ * Loads a binary file that contain fragment geometry.
993
1110
  * @param data - The binary data to load.
994
1111
  * @param config - Optional configuration for loading.
995
1112
  * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
@@ -1003,7 +1120,7 @@ export declare class FragmentsManager extends Component implements Disposable {
1003
1120
  relationsMap: RelationsMap;
1004
1121
  }>): FragmentsGroup;
1005
1122
  /**
1006
- * Export the specified fragments.
1123
+ * Export the specified fragmentsgroup to binary data.
1007
1124
  * @param group - the fragments group to be exported.
1008
1125
  * @returns the exported data as binary buffer.
1009
1126
  */
@@ -1029,21 +1146,53 @@ export declare class FragmentsManager extends Component implements Disposable {
1029
1146
  modelIdToFragmentIdMap(modelIdMap: {
1030
1147
  [modelID: string]: Set<number>;
1031
1148
  }): FRAGS.FragmentIdMap;
1149
+ /**
1150
+ * Applies coordinate transformation to the provided models.
1151
+ * If no models are provided, all groups are used.
1152
+ * The first model in the list becomes the base model for coordinate transformation.
1153
+ * All other models are then transformed to match the base model's coordinate system.
1154
+ *
1155
+ * @param models - The models to apply coordinate transformation to.
1156
+ * If not provided, all groups are used.
1157
+ *
1158
+ * @returns {void}
1159
+ */
1032
1160
  coordinate(models?: FragmentsGroup[]): void;
1033
1161
  }
1034
1162
  import * as WEBIFC from "web-ifc";
1035
1163
  import * as FRAGS from "@thatopen/fragments";
1036
1164
  import { IfcFragmentSettings } from "./src";
1037
1165
  import { Component, Components, Event, Disposable } from "../../core";
1166
+ /**
1167
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1168
+ */
1038
1169
  export declare class IfcLoader extends Component implements Disposable {
1170
+ /**
1171
+ * A unique identifier for the component.
1172
+ * This UUID is used to register the component within the Components system.
1173
+ */
1039
1174
  static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1040
- readonly onIfcStartedLoading: Event<void>;
1041
- readonly onSetup: Event<void>;
1042
1175
  /** {@link Disposable.onDisposed} */
1043
1176
  readonly onDisposed: Event<string>;
1177
+ /**
1178
+ * An event triggered when the IFC file starts loading.
1179
+ */
1180
+ readonly onIfcStartedLoading: Event<void>;
1181
+ /**
1182
+ * An event triggered when the setup process is completed.
1183
+ */
1184
+ readonly onSetup: Event<void>;
1185
+ /**
1186
+ * The settings for the IfcLoader.
1187
+ * It includes options for excluding categories, setting WASM paths, and more.
1188
+ */
1044
1189
  settings: IfcFragmentSettings;
1045
- enabled: boolean;
1190
+ /**
1191
+ * The instance of the Web-IFC library used for handling IFC data.
1192
+ */
1046
1193
  webIfc: WEBIFC.IfcAPI;
1194
+ /** {@link Component.enabled} */
1195
+ enabled: boolean;
1047
1196
  private _material;
1048
1197
  private _spatialTree;
1049
1198
  private _metaData;
@@ -1052,12 +1201,75 @@ export declare class IfcLoader extends Component implements Disposable {
1052
1201
  private _visitedFragments;
1053
1202
  private _materialT;
1054
1203
  constructor(components: Components);
1204
+ /** {@link Disposable.dispose} */
1055
1205
  dispose(): void;
1206
+ /**
1207
+ * Sets up the IfcLoader component with the provided configuration.
1208
+ *
1209
+ * @param config - Optional configuration settings for the IfcLoader.
1210
+ * If not provided, the existing settings will be used.
1211
+ *
1212
+ * @returns A Promise that resolves when the setup process is completed.
1213
+ *
1214
+ * @remarks
1215
+ * If the 'autoSetWasm' option is enabled in the configuration,
1216
+ * the method will automatically set the WASM paths for the Web-IFC library.
1217
+ *
1218
+ * @example
1219
+ * '''typescript
1220
+ * const ifcLoader = new IfcLoader(components);
1221
+ * await ifcLoader.setup({ autoSetWasm: true });
1222
+ * '''
1223
+ */
1056
1224
  setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1057
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1058
- readIfcFile(data: Uint8Array): Promise<number>;
1059
- private getAllGeometries;
1225
+ /**
1226
+ * Loads an IFC file and processes it for 3D visualization.
1227
+ *
1228
+ * @param data - The Uint8Array containing the IFC file data.
1229
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1230
+ *
1231
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1232
+ *
1233
+ * @example
1234
+ * '''typescript
1235
+ * const ifcLoader = components.get(IfcLoader);
1236
+ * const group = await ifcLoader.load(ifcData);
1237
+ * '''
1238
+ */
1239
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1240
+ /**
1241
+ * Reads an IFC file and initializes the Web-IFC library.
1242
+ *
1243
+ * @param data - The Uint8Array containing the IFC file data.
1244
+ *
1245
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
1246
+ *
1247
+ * @remarks
1248
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1249
+ * It also opens the IFC model using the provided data and settings.
1250
+ *
1251
+ * @example
1252
+ * '''typescript
1253
+ * const ifcLoader = components.get(IfcLoader);
1254
+ * await ifcLoader.readIfcFile(ifcData);
1255
+ * '''
1256
+ */
1257
+ readIfcFile(data: Uint8Array): Promise<number>;
1258
+ /**
1259
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
1260
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1261
+ *
1262
+ * @remarks
1263
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1264
+ *
1265
+ * @example
1266
+ * '''typescript
1267
+ * const ifcLoader = components.get(IfcLoader);
1268
+ * ifcLoader.cleanUp();
1269
+ * '''
1270
+ */
1060
1271
  cleanUp(): void;
1272
+ private getAllGeometries;
1061
1273
  private getMesh;
1062
1274
  private getGeometry;
1063
1275
  private autoSetWasm;
@@ -1065,19 +1277,49 @@ export declare class IfcLoader extends Component implements Disposable {
1065
1277
  import * as WEBIFC from "web-ifc";
1066
1278
  import { Components, Disposable, Event, Component } from "../../core";
1067
1279
  import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1280
+ /**
1281
+ * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1282
+ */
1068
1283
  export declare class IfcGeometryTiler extends Component implements Disposable {
1284
+ /**
1285
+ * A unique identifier for the component.
1286
+ * This UUID is used to register the component within the Components system.
1287
+ */
1069
1288
  static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1070
- onGeometryStreamed: Event<{
1289
+ /**
1290
+ * Event triggered when geometry is streamed.
1291
+ * Contains the streamed geometry data and its buffer.
1292
+ */
1293
+ readonly onGeometryStreamed: Event<{
1071
1294
  buffer: Uint8Array;
1072
1295
  data: StreamedGeometries;
1073
1296
  }>;
1074
- onAssetStreamed: Event<StreamedAsset[]>;
1075
- onProgress: Event<number>;
1076
- onIfcLoaded: Event<Uint8Array>;
1297
+ /**
1298
+ * Event triggered when assets are streamed.
1299
+ * Contains the streamed assets.
1300
+ */
1301
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
1302
+ /**
1303
+ * Event triggered to indicate the progress of the streaming process.
1304
+ * Contains the progress percentage.
1305
+ */
1306
+ readonly onProgress: Event<number>;
1307
+ /**
1308
+ * Event triggered when the IFC file is loaded.
1309
+ * Contains the loaded IFC file data.
1310
+ */
1311
+ readonly onIfcLoaded: Event<Uint8Array>;
1077
1312
  /** {@link Disposable.onDisposed} */
1078
1313
  readonly onDisposed: Event<unknown>;
1314
+ /**
1315
+ * Settings for the IfcGeometryTiler.
1316
+ */
1079
1317
  settings: IfcStreamingSettings;
1318
+ /** {@link Component.enabled} */
1080
1319
  enabled: boolean;
1320
+ /**
1321
+ * The WebIFC API instance used for IFC file processing.
1322
+ */
1081
1323
  webIfc: WEBIFC.IfcAPI;
1082
1324
  private _spatialTree;
1083
1325
  private _metaData;
@@ -1090,8 +1332,36 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
1090
1332
  private _assets;
1091
1333
  private _meshesWithHoles;
1092
1334
  constructor(components: Components);
1335
+ /** {@link Disposable.dispose} */
1093
1336
  dispose(): void;
1337
+ /**
1338
+ * This method streams the IFC file from a given buffer.
1339
+ *
1340
+ * @param data - The Uint8Array containing the IFC file data.
1341
+ * @returns A Promise that resolves when the streaming process is complete.
1342
+ *
1343
+ * @remarks
1344
+ * This method cleans up any resources after the streaming process is complete.
1345
+ *
1346
+ * @example
1347
+ * '''typescript
1348
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
1349
+ * const rawBuffer = await response.arrayBuffer();
1350
+ * const ifcBuffer = new Uint8Array(rawBuffer);
1351
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1352
+ * '''
1353
+ */
1094
1354
  streamFromBuffer(data: Uint8Array): Promise<void>;
1355
+ /**
1356
+ * This method streams the IFC file from a given callback.
1357
+ *
1358
+ * @param loadCallback - The callback function that will be used to load the IFC file.
1359
+ * @returns A Promise that resolves when the streaming process is complete.
1360
+ *
1361
+ * @remarks
1362
+ * This method cleans up any resources after the streaming process is complete.
1363
+ *
1364
+ */
1095
1365
  streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1096
1366
  private readIfcFile;
1097
1367
  private streamIfcFile;
@@ -1104,213 +1374,782 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
1104
1374
  }
1105
1375
  import * as WEBIFC from "web-ifc";
1106
1376
  import { AsyncEvent, Component, Disposable, Event } from "../../core";
1107
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
1377
+ import { PropertiesStreamingSettings } from "./src";
1378
+ /**
1379
+ * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1380
+ */
1108
1381
  export declare class IfcPropertiesTiler extends Component implements Disposable {
1382
+ /**
1383
+ * A unique identifier for the component.
1384
+ * This UUID is used to register the component within the Components system.
1385
+ */
1109
1386
  static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1110
- onPropertiesStreamed: AsyncEvent<{
1387
+ /**
1388
+ * An event that is triggered when properties are streamed from the IFC file.
1389
+ * The event provides the type of the IFC entity and the corresponding data.
1390
+ */
1391
+ readonly onPropertiesStreamed: AsyncEvent<{
1111
1392
  type: number;
1112
1393
  data: {
1113
1394
  [id: number]: any;
1114
1395
  };
1115
1396
  }>;
1116
- onProgress: AsyncEvent<number>;
1117
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1397
+ /**
1398
+ * An event that is triggered to indicate the progress of the streaming process.
1399
+ * The event provides a number between 0 and 1 representing the progress percentage.
1400
+ */
1401
+ readonly onProgress: AsyncEvent<number>;
1402
+ /**
1403
+ * An event that is triggered when indices are streamed from the IFC file.
1404
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1405
+ */
1406
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1118
1407
  /** {@link Disposable.onDisposed} */
1119
1408
  readonly onDisposed: Event<string>;
1409
+ /** {@link Component.enabled} */
1120
1410
  enabled: boolean;
1411
+ /**
1412
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1413
+ */
1121
1414
  settings: PropertiesStreamingSettings;
1415
+ /**
1416
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1417
+ */
1122
1418
  webIfc: WEBIFC.IfcAPI;
1419
+ /** {@link Disposable.dispose} */
1123
1420
  dispose(): Promise<void>;
1421
+ /**
1422
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1423
+ *
1424
+ * @param data - The Uint8Array containing the IFC file data.
1425
+ * @returns A Promise that resolves when the streaming process is complete.
1426
+ */
1124
1427
  streamFromBuffer(data: Uint8Array): Promise<void>;
1428
+ /**
1429
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1430
+ *
1431
+ * @param loadCallback - A callback function that loads the IFC file data.
1432
+ * @returns A Promise that resolves when the streaming process is complete.
1433
+ */
1125
1434
  streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1126
1435
  private readIfcFile;
1127
1436
  private streamIfcFile;
1128
1437
  private streamAllProperties;
1129
1438
  private cleanUp;
1130
1439
  }
1131
- export declare const IfcCategoryMap: {
1132
- [key: number]: string;
1133
- };
1134
- import * as FRAGS from "@thatopen/fragments";
1135
- export declare class IfcPropertiesUtils {
1136
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
1137
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
1138
- [attribute: string]: any;
1139
- } | null>;
1140
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
1141
- [relatingID: number]: number[];
1142
- }>;
1143
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
1144
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
1145
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
1146
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
1147
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1148
- key: string | null;
1149
- name: string | null;
1150
- }>;
1151
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1152
- key: string | null;
1153
- value: number | null;
1154
- }>;
1155
- static isRel(expressID: number): boolean;
1156
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1157
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1158
- }
1159
- export declare const GeometryTypes: Set<number>;
1160
1440
  import * as THREE from "three";
1161
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
1441
+ import { Component, Components } from "../../core";
1162
1442
  /**
1163
- * A class representing a 2D minimap in a 3D world.
1443
+ * Represents an edge measurement result.
1164
1444
  */
1165
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
1166
- /** {@link Disposable.onDisposed} */
1167
- readonly onDisposed: Event<unknown>;
1168
- /** {@link Updateable.onAfterUpdate} */
1169
- readonly onAfterUpdate: Event<unknown>;
1170
- /** {@link Updateable.onBeforeUpdate} */
1171
- readonly onBeforeUpdate: Event<unknown>;
1172
- /** {@link Resizeable.onResize} */
1173
- readonly onResize: Event<THREE.Vector2>;
1445
+ export interface MeasureEdge {
1174
1446
  /**
1175
- * The front offset of the minimap.
1176
- * It determines how much the minimap's view is offset from the camera's view.
1177
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1447
+ * The distance between the two points of the edge.
1178
1448
  */
1179
- frontOffset: number;
1449
+ distance: number;
1180
1450
  /**
1181
- * The override material for the minimap.
1182
- * It is used to render the depth information of the world onto the minimap.
1451
+ * The two points that define the edge.
1183
1452
  */
1184
- overrideMaterial: THREE.MeshDepthMaterial;
1453
+ points: THREE.Vector3[];
1454
+ }
1455
+ /**
1456
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1457
+ */
1458
+ export declare class MeasurementUtils extends Component {
1185
1459
  /**
1186
- * The background color of the minimap.
1187
- * It is used to set the background color of the minimap's renderer.
1460
+ * A unique identifier for the component.
1461
+ * This UUID is used to register the component within the Components system.
1188
1462
  */
1189
- backgroundColor: THREE.Color;
1463
+ static uuid: string;
1464
+ /** {@link Component.enabled} */
1465
+ enabled: boolean;
1466
+ constructor(components: Components);
1190
1467
  /**
1191
- * The WebGL renderer for the minimap.
1192
- * It is used to render the minimap onto the screen.
1468
+ * Utility method to calculate the distance from a point to a line segment.
1469
+ *
1470
+ * @param point - The point from which to calculate the distance.
1471
+ * @param lineStart - The start point of the line segment.
1472
+ * @param lineEnd - The end point of the line segment.
1473
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
1474
+ * @returns The distance from the point to the line segment.
1193
1475
  */
1194
- renderer: THREE.WebGLRenderer;
1476
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1195
1477
  /**
1196
- * A flag indicating whether the minimap is enabled.
1197
- * If disabled, the minimap will not update or render.
1478
+ * Method to get the face of a mesh that contains a given triangle index.
1479
+ * It also returns the edges of the found face and their indices.
1480
+ *
1481
+ * @param mesh - The mesh to get the face from. It must be indexed.
1482
+ * @param triangleIndex - The index of the triangle within the mesh.
1483
+ * @param instance - The instance of the mesh (optional).
1484
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1198
1485
  */
1199
- enabled: boolean;
1486
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1487
+ edges: MeasureEdge[];
1488
+ indices: Set<number>;
1489
+ } | null;
1200
1490
  /**
1201
- * The world in which the minimap is displayed.
1202
- * It provides access to the 3D scene, camera, and other relevant world elements.
1491
+ * Method to get the vertices and normal of a mesh face at a given index.
1492
+ * It also applies instance transformation if provided.
1493
+ *
1494
+ * @param mesh - The mesh to get the face from. It must be indexed.
1495
+ * @param faceIndex - The index of the face within the mesh.
1496
+ * @param instance - The instance of the mesh (optional).
1497
+ * @returns An object containing the vertices and normal of the face.
1498
+ * @throws Will throw an error if the geometry is not indexed.
1203
1499
  */
1204
- world: World;
1205
- private _lockRotation;
1206
- private _camera;
1207
- private _plane;
1208
- private _size;
1209
- private _tempVector1;
1210
- private _tempVector2;
1211
- private _tempTarget;
1212
- private readonly down;
1213
- /**
1214
- * Gets or sets whether the minimap rotation is locked.
1215
- * When rotation is locked, the minimap will always face the same direction as the camera.
1216
- */
1217
- get lockRotation(): boolean;
1218
- /**
1219
- * Sets whether the minimap rotation is locked.
1220
- * When rotation is locked, the minimap will always face the same direction as the camera.
1221
- * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
1222
- */
1223
- set lockRotation(active: boolean);
1224
- /**
1225
- * Gets the current zoom level of the minimap.
1226
- * The zoom level determines how much of the world is visible on the minimap.
1227
- * @returns The current zoom level of the minimap.
1228
- */
1229
- get zoom(): number;
1500
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1501
+ p1: THREE.Vector3;
1502
+ p2: THREE.Vector3;
1503
+ p3: THREE.Vector3;
1504
+ faceNormal: THREE.Vector3;
1505
+ };
1230
1506
  /**
1231
- * Sets the zoom level of the minimap.
1232
- * The zoom level determines how much of the world is visible on the minimap.
1233
- * @param value - The new zoom level of the minimap.
1234
- */
1235
- set zoom(value: number);
1236
- constructor(world: World);
1237
- /** {@link Disposable.dispose} */
1238
- dispose(): void;
1239
- /** Returns the camera used by the MiniMap */
1240
- get(): THREE.OrthographicCamera;
1241
- /** {@link Updateable.update} */
1242
- update(): void;
1243
- /** {@link Resizeable.getSize} */
1244
- getSize(): THREE.Vector2;
1245
- /** {@link Resizeable.resize} */
1246
- resize(size?: THREE.Vector2): void;
1247
- private updatePlanes;
1507
+ * Method to round the vector's components to a specified number of decimal places.
1508
+ * This is used to ensure numerical precision in edge detection.
1509
+ *
1510
+ * @param vector - The vector to round.
1511
+ * @returns The vector with rounded components.
1512
+ */
1513
+ round(vector: THREE.Vector3): void;
1514
+ private getFaceData;
1248
1515
  }
1249
- import { InverseAttribute } from "./types";
1250
- export declare const relToAttributesMap: Map<number, {
1251
- forRelating: InverseAttribute;
1252
- forRelated: InverseAttribute;
1253
- }>;
1254
1516
  import * as WEBIFC from "web-ifc";
1255
- import { IfcItemsCategories } from "../../../ifc";
1256
- export declare class SpatialStructure {
1257
- itemsByFloor: IfcItemsCategories;
1258
- private _units;
1259
- setUp(webIfc: WEBIFC.IfcAPI): void;
1260
- cleanUp(): void;
1261
- }
1517
+ import * as FRAG from "@thatopen/fragments";
1518
+ import { Component, Components } from "../../core";
1262
1519
  /**
1263
- * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
1520
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1264
1521
  */
1265
- export declare class Event<T> {
1522
+ export declare class IfcJsonExporter extends Component {
1266
1523
  /**
1267
- * Add a callback to this event instance.
1268
- * @param handler - the callback to be added to this event.
1524
+ * A unique identifier for the component.
1525
+ * This UUID is used to register the component within the Components system.
1269
1526
  */
1270
- add(handler: T extends void ? {
1271
- (): void;
1272
- } : {
1273
- (data: T): void;
1274
- }): void;
1527
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1528
+ /** {@link Component.enabled} */
1529
+ enabled: boolean;
1530
+ constructor(components: Components);
1275
1531
  /**
1276
- * Removes a callback from this event instance.
1277
- * @param handler - the callback to be removed from this event.
1532
+ * Exports all the properties of an IFC into an array of JS objects.
1533
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1534
+ * @param modelID ID of the IFC model whose properties to extract.
1535
+ * @param indirect whether to get the indirect relationships as well.
1536
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1537
+ * to make the location data available (e.g. absolute position of building).
1278
1538
  */
1279
- remove(handler: T extends void ? {
1280
- (): void;
1281
- } : {
1282
- (data: T): void;
1283
- }): void;
1284
- /** Triggers all the callbacks assigned to this event. */
1285
- trigger: (data?: T) => void;
1286
- /** Gets rid of all the suscribed events. */
1287
- reset(): void;
1288
- private handlers;
1539
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1289
1540
  }
1541
+ import * as WEBIFC from "web-ifc";
1542
+ import { FragmentsGroup } from "@thatopen/fragments";
1543
+ import { Disposable, Event, Component, Components } from "../../core";
1544
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1545
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1290
1546
  /**
1291
- * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
1547
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1292
1548
  */
1293
- export declare class AsyncEvent<T> {
1549
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1294
1550
  /**
1295
- * Add a callback to this event instance.
1296
- * @param handler - the callback to be added to this event.
1551
+ * A unique identifier for the component.
1552
+ * This UUID is used to register the component within the Components system.
1297
1553
  */
1298
- add(handler: T extends void ? {
1299
- (): Promise<void>;
1300
- } : {
1301
- (data: T): Promise<void>;
1554
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1555
+ /** {@link Disposable.onDisposed} */
1556
+ readonly onDisposed: Event<string>;
1557
+ /**
1558
+ * Event triggered when relations for a model have been indexed.
1559
+ * This event provides the model's UUID and the relations map generated for that model.
1560
+ *
1561
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
1562
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1563
+ * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1564
+ */
1565
+ readonly onRelationsIndexed: Event<{
1566
+ modelID: string;
1567
+ relationsMap: RelationsMap;
1568
+ }>;
1569
+ /**
1570
+ * Holds the relationship mappings for each model processed by the indexer.
1571
+ * The structure is a map where each key is a model's UUID, and the value is another map.
1572
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1573
+ * representing a specific relation type, and the value is an array of expressIDs of entities
1574
+ * that are related through that relation type. This structure allows for efficient querying
1575
+ * of entity relationships within a model.
1576
+ */
1577
+ readonly relationMaps: ModelsRelationMap;
1578
+ /** {@link Component.enabled} */
1579
+ enabled: boolean;
1580
+ private _relToAttributesMap;
1581
+ private _inverseAttributes;
1582
+ private _ifcRels;
1583
+ constructor(components: Components);
1584
+ private onFragmentsDisposed;
1585
+ private indexRelations;
1586
+ /**
1587
+ * Adds a relation map to the model's relations map.
1588
+ *
1589
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1590
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1591
+ *
1592
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1593
+ */
1594
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1595
+ /**
1596
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1597
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1598
+ * and maps them in a structured way to facilitate quick access to related entities.
1599
+ *
1600
+ * The process involves querying the model for each relation type associated with the inverse attributes
1601
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1602
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
1603
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1604
+ * of entities that are related through that attribute.
1605
+ *
1606
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1607
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1608
+ * representation of the relations indexed by entity expressIDs and relation types.
1609
+ * @throws An error if the model does not have properties loaded.
1610
+ */
1611
+ process(model: FragmentsGroup): Promise<RelationsMap>;
1612
+ /**
1613
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
1614
+ *
1615
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1616
+ * @param modelID - The unique identifier of the model within the WebIfc API.
1617
+ * @returns A promise that resolves to the relations map for the processed model.
1618
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1619
+ */
1620
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1621
+ /**
1622
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
1623
+ * This method searches the indexed relation maps for the specified model and entity,
1624
+ * returning the IDs of related entities if a match is found.
1625
+ *
1626
+ * @param model The 'FragmentsGroup' model containing the entity.
1627
+ * @param expressID The unique identifier of the entity within the model.
1628
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1629
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1630
+ * or the specified relation name is not indexed.
1631
+ */
1632
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1633
+ /**
1634
+ * Serializes the relations of a given relation map into a JSON string.
1635
+ * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
1636
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1637
+ * The resulting object is then serialized into a JSON string.
1638
+ *
1639
+ * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1640
+ * @returns A JSON string representing the serialized relations of the given relation map.
1641
+ */
1642
+ serializeRelations(relationMap: RelationsMap): string;
1643
+ /**
1644
+ * Serializes the relations of a specific model into a JSON string.
1645
+ * This method iterates through the relations indexed for the given model,
1646
+ * organizing them into a structured object where each key is an expressID of an entity,
1647
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1648
+ * The resulting object is then serialized into a JSON string.
1649
+ *
1650
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1651
+ * @returns A JSON string representing the serialized relations of the specified model.
1652
+ * If the model has no indexed relations, 'null' is returned.
1653
+ */
1654
+ serializeModelRelations(model: FragmentsGroup): string | null;
1655
+ /**
1656
+ * Serializes all relations of every model processed by the indexer into a JSON string.
1657
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1658
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1659
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
1660
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
1661
+ *
1662
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1663
+ * If no relations have been indexed, an empty object is returned as a JSON string.
1664
+ */
1665
+ serializeAllRelations(): string;
1666
+ /**
1667
+ * Converts a JSON string representing relations between entities into a structured map.
1668
+ * This method parses the JSON string to reconstruct the relations map that indexes
1669
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1670
+ * and the values are maps where each key is a relation type ID and its value is an array
1671
+ * of express IDs of entities related through that relation type.
1672
+ *
1673
+ * @param json The JSON string to be parsed into the relations map.
1674
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1675
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1676
+ * is an array of express IDs (as numbers) of entities related through that relation type.
1677
+ */
1678
+ getRelationsMapFromJSON(json: string): RelationsMap;
1679
+ /** {@link Disposable.dispose} */
1680
+ dispose(): void;
1681
+ }
1682
+ import * as WEBIFC from "web-ifc";
1683
+ import { FragmentsGroup } from "@thatopen/fragments";
1684
+ import { Component, Disposable, Event, Components } from "../../core";
1685
+ /**
1686
+ * Types for boolean properties in IFC schema.
1687
+ */
1688
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1689
+ /**
1690
+ * Types for string properties in IFC schema.
1691
+ */
1692
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1693
+ /**
1694
+ * Types for numeric properties in IFC schema.
1695
+ */
1696
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
1697
+ /**
1698
+ * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
1699
+ */
1700
+ export interface ChangeMap {
1701
+ [modelID: string]: Set<number>;
1702
+ }
1703
+ /**
1704
+ * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
1705
+ */
1706
+ export interface AttributeListener {
1707
+ [modelID: string]: {
1708
+ [expressID: number]: {
1709
+ [attributeName: string]: Event<String | Boolean | Number>;
1710
+ };
1711
+ };
1712
+ }
1713
+ /**
1714
+ * Component to manage and edit properties and Psets in IFC files.
1715
+ */
1716
+ export declare class IfcPropertiesManager extends Component implements Disposable {
1717
+ /**
1718
+ * A unique identifier for the component.
1719
+ * This UUID is used to register the component within the Components system.
1720
+ */
1721
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1722
+ /** {@link Disposable.onDisposed} */
1723
+ readonly onDisposed: Event<string>;
1724
+ /**
1725
+ * Event triggered when a file is requested for export.
1726
+ */
1727
+ readonly onRequestFile: Event<unknown>;
1728
+ /**
1729
+ * ArrayBuffer containing the IFC data to be exported.
1730
+ */
1731
+ ifcToExport: ArrayBuffer | null;
1732
+ /**
1733
+ * Event triggered when an element is added to a Pset.
1734
+ */
1735
+ readonly onElementToPset: Event<{
1736
+ model: FragmentsGroup;
1737
+ psetID: number;
1738
+ elementID: number;
1739
+ }>;
1740
+ /**
1741
+ * Event triggered when a property is added to a Pset.
1742
+ */
1743
+ readonly onPropToPset: Event<{
1744
+ model: FragmentsGroup;
1745
+ psetID: number;
1746
+ propID: number;
1747
+ }>;
1748
+ /**
1749
+ * Event triggered when a Pset is removed.
1750
+ */
1751
+ readonly onPsetRemoved: Event<{
1752
+ model: FragmentsGroup;
1753
+ psetID: number;
1754
+ }>;
1755
+ /**
1756
+ * Event triggered when data in the model changes.
1757
+ */
1758
+ readonly onDataChanged: Event<{
1759
+ model: FragmentsGroup;
1760
+ expressID: number;
1761
+ }>;
1762
+ /**
1763
+ * Configuration for the WebAssembly module.
1764
+ */
1765
+ wasm: {
1766
+ path: string;
1767
+ absolute: boolean;
1768
+ };
1769
+ /** {@link Component.enabled} */
1770
+ enabled: boolean;
1771
+ /**
1772
+ * Map of attribute listeners.
1773
+ */
1774
+ attributeListeners: AttributeListener;
1775
+ /**
1776
+ * The currently selected model.
1777
+ */
1778
+ selectedModel?: FragmentsGroup;
1779
+ /**
1780
+ * Map of changed entities in the model.
1781
+ */
1782
+ changeMap: ChangeMap;
1783
+ constructor(components: Components);
1784
+ /** {@link Disposable.dispose} */
1785
+ dispose(): void;
1786
+ /**
1787
+ * Static method to retrieve the IFC schema from a given model.
1788
+ *
1789
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1790
+ * @throws Will throw an error if the IFC schema is not found in the model.
1791
+ * @returns The IFC schema associated with the given model.
1792
+ */
1793
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1794
+ /**
1795
+ * Method to set properties data in the model.
1796
+ *
1797
+ * @param model - The FragmentsGroup model in which to set the properties.
1798
+ * @param dataToSave - An array of objects representing the properties to be saved.
1799
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1800
+ * The rest of the properties will be set as the properties of the entity.
1801
+ *
1802
+ * @returns {Promise<void>} A promise that resolves when all the properties have been set.
1803
+ *
1804
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1805
+ */
1806
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1807
+ /**
1808
+ * Creates a new Property Set (Pset) in the given model.
1809
+ *
1810
+ * @param model - The FragmentsGroup model in which to create the Pset.
1811
+ * @param name - The name of the Pset.
1812
+ * @param description - (Optional) The description of the Pset.
1813
+ *
1814
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1815
+ *
1816
+ * @throws Will throw an error if the IFC schema is not found in the model.
1817
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1818
+ */
1819
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1820
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1821
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1822
+ }>;
1823
+ /**
1824
+ * Removes a Property Set (Pset) from the given model.
1825
+ *
1826
+ * @param model - The FragmentsGroup model from which to remove the Pset.
1827
+ * @param psetID - The express IDs of the Psets to be removed.
1828
+ *
1829
+ * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
1830
+ *
1831
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1832
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1833
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1834
+ */
1835
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1836
+ /**
1837
+ * Creates a new single-value property of type string in the given model.
1838
+ *
1839
+ * @param model - The FragmentsGroup model in which to create the property.
1840
+ * @param type - The type of the property value. Must be a string property type.
1841
+ * @param name - The name of the property.
1842
+ * @param value - The value of the property. Must be a string.
1843
+ *
1844
+ * @returns The newly created single-value property.
1845
+ *
1846
+ * @throws Will throw an error if the IFC schema is not found in the model.
1847
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1848
+ */
1849
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1850
+ /**
1851
+ * Creates a new single-value property of type numeric in the given model.
1852
+ *
1853
+ * @param model - The FragmentsGroup model in which to create the property.
1854
+ * @param type - The type of the property value. Must be a numeric property type.
1855
+ * @param name - The name of the property.
1856
+ * @param value - The value of the property. Must be a number.
1857
+ *
1858
+ * @returns The newly created single-value property.
1859
+ *
1860
+ * @throws Will throw an error if the IFC schema is not found in the model.
1861
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1862
+ */
1863
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1864
+ /**
1865
+ * Creates a new single-value property of type boolean in the given model.
1866
+ *
1867
+ * @param model - The FragmentsGroup model in which to create the property.
1868
+ * @param type - The type of the property value. Must be a boolean property type.
1869
+ * @param name - The name of the property.
1870
+ * @param value - The value of the property. Must be a boolean.
1871
+ *
1872
+ * @returns The newly created single-value property.
1873
+ *
1874
+ * @throws Will throw an error if the IFC schema is not found in the model.
1875
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1876
+ */
1877
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1878
+ /**
1879
+ * Removes a property from a Property Set (Pset) in the given model.
1880
+ *
1881
+ * @param model - The FragmentsGroup model from which to remove the property.
1882
+ * @param psetID - The express ID of the Pset from which to remove the property.
1883
+ * @param propID - The express ID of the property to be removed.
1884
+ *
1885
+ * @returns {Promise<void>} A promise that resolves when the property has been removed.
1886
+ *
1887
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1888
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1889
+ */
1890
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1891
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
1892
+ /**
1893
+ * Adds elements to a Property Set (Pset) in the given model.
1894
+ *
1895
+ * @param model - The FragmentsGroup model in which to add the elements.
1896
+ * @param psetID - The express ID of the Pset to which to add the elements.
1897
+ * @param elementID - The express IDs of the elements to be added.
1898
+ *
1899
+ * @returns {Promise<void>} A promise that resolves when all the elements have been added.
1900
+ *
1901
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1902
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1903
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1904
+ */
1905
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1906
+ /**
1907
+ * Saves the changes made to the model to a new IFC file.
1908
+ *
1909
+ * @param model - The FragmentsGroup model from which to save the changes.
1910
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1911
+ *
1912
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1913
+ *
1914
+ * @throws Will throw an error if any issues occur during the saving process.
1915
+ */
1916
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1917
+ /**
1918
+ * Sets an attribute listener for a specific attribute of an entity in the model.
1919
+ * The listener will trigger an event whenever the attribute's value changes.
1920
+ *
1921
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
1922
+ * @param expressID - The express ID of the entity for which to set the listener.
1923
+ * @param attributeName - The name of the attribute for which to set the listener.
1924
+ *
1925
+ * @returns The event that will be triggered when the attribute's value changes.
1926
+ *
1927
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
1928
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1929
+ * @throws Will throw an error if the attribute has a badly defined handle.
1930
+ */
1931
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1932
+ private increaseMaxID;
1933
+ private newGUID;
1934
+ private getOwnerHistory;
1935
+ private registerChange;
1936
+ private newSingleProperty;
1937
+ }
1938
+ import * as WEBIFC from "web-ifc";
1939
+ import { IfcItemsCategories } from "../../../ifc";
1940
+ export declare class SpatialStructure {
1941
+ itemsByFloor: IfcItemsCategories;
1942
+ private _units;
1943
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1944
+ cleanUp(): void;
1945
+ }
1946
+ import * as THREE from "three";
1947
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
1948
+ /**
1949
+ * A class representing a 2D minimap of a 3D world.
1950
+ */
1951
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1952
+ /** {@link Disposable.onDisposed} */
1953
+ readonly onDisposed: Event<unknown>;
1954
+ /** {@link Updateable.onAfterUpdate} */
1955
+ readonly onAfterUpdate: Event<unknown>;
1956
+ /** {@link Updateable.onBeforeUpdate} */
1957
+ readonly onBeforeUpdate: Event<unknown>;
1958
+ /** {@link Resizeable.onResize} */
1959
+ readonly onResize: Event<THREE.Vector2>;
1960
+ /**
1961
+ * The front offset of the minimap.
1962
+ * It determines how much the minimap's view is offset from the camera's view.
1963
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1964
+ */
1965
+ frontOffset: number;
1966
+ /**
1967
+ * The override material for the minimap.
1968
+ * It is used to render the depth information of the world onto the minimap.
1969
+ */
1970
+ overrideMaterial: THREE.MeshDepthMaterial;
1971
+ /**
1972
+ * The background color of the minimap.
1973
+ * It is used to set the background color of the minimap's renderer.
1974
+ */
1975
+ backgroundColor: THREE.Color;
1976
+ /**
1977
+ * The WebGL renderer for the minimap.
1978
+ * It is used to render the minimap onto the screen.
1979
+ */
1980
+ renderer: THREE.WebGLRenderer;
1981
+ /**
1982
+ * A flag indicating whether the minimap is enabled.
1983
+ * If disabled, the minimap will not update or render.
1984
+ */
1985
+ enabled: boolean;
1986
+ /**
1987
+ * The world in which the minimap is displayed.
1988
+ * It provides access to the 3D scene, camera, and other relevant world elements.
1989
+ */
1990
+ world: World;
1991
+ private _lockRotation;
1992
+ private _camera;
1993
+ private _plane;
1994
+ private _size;
1995
+ private _tempVector1;
1996
+ private _tempVector2;
1997
+ private _tempTarget;
1998
+ private readonly down;
1999
+ /**
2000
+ * Gets or sets whether the minimap rotation is locked.
2001
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2002
+ */
2003
+ get lockRotation(): boolean;
2004
+ /**
2005
+ * Sets whether the minimap rotation is locked.
2006
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2007
+ * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2008
+ */
2009
+ set lockRotation(active: boolean);
2010
+ /**
2011
+ * Gets the current zoom level of the minimap.
2012
+ * The zoom level determines how much of the world is visible on the minimap.
2013
+ * @returns The current zoom level of the minimap.
2014
+ */
2015
+ get zoom(): number;
2016
+ /**
2017
+ * Sets the zoom level of the minimap.
2018
+ * The zoom level determines how much of the world is visible on the minimap.
2019
+ * @param value - The new zoom level of the minimap.
2020
+ */
2021
+ set zoom(value: number);
2022
+ constructor(world: World);
2023
+ /** {@link Disposable.dispose} */
2024
+ dispose(): void;
2025
+ /** Returns the camera used by the MiniMap */
2026
+ get(): THREE.OrthographicCamera;
2027
+ /** {@link Updateable.update} */
2028
+ update(): void;
2029
+ /** {@link Resizeable.getSize} */
2030
+ getSize(): THREE.Vector2;
2031
+ /** {@link Resizeable.resize} */
2032
+ resize(size?: THREE.Vector2): void;
2033
+ private updatePlanes;
2034
+ }
2035
+ import * as WEBIFC from "web-ifc";
2036
+ /** Configuration of the IFC-fragment conversion. */
2037
+ export declare class IfcFragmentSettings {
2038
+ /** Whether to extract the IFC properties into a JSON. */
2039
+ includeProperties: boolean;
2040
+ /**
2041
+ * Generate the geometry for categories that are not included by default,
2042
+ * like IFCSPACE.
2043
+ */
2044
+ optionalCategories: number[];
2045
+ /** Whether to use the coordination data coming from the IFC files. */
2046
+ coordinate: boolean;
2047
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2048
+ wasm: {
2049
+ path: string;
2050
+ absolute: boolean;
2051
+ logLevel?: WEBIFC.LogLevel;
2052
+ };
2053
+ /** List of categories that won't be converted to fragments. */
2054
+ excludedCategories: Set<number>;
2055
+ /** Whether to save the absolute location of all IFC items. */
2056
+ saveLocations: boolean;
2057
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2058
+ webIfc: WEBIFC.LoaderSettings;
2059
+ /**
2060
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2061
+ * If set to true, the path will be set to the default path of the WASM file.
2062
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2063
+ * Default value is true.
2064
+ */
2065
+ autoSetWasm: boolean;
2066
+ /**
2067
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2068
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2069
+ * If set to null, the default file location handler will be used.
2070
+ *
2071
+ * @param url - The URL of the file to locate.
2072
+ * @returns The absolute path of the file.
2073
+ */
2074
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2075
+ }
2076
+ /**
2077
+ * A Set of unique numbers representing different types of IFC geometries.
2078
+ */
2079
+ export declare const GeometryTypes: Set<number>;
2080
+ import * as WEBIFC from "web-ifc";
2081
+ export interface IfcItemsCategories {
2082
+ [itemID: number]: number;
2083
+ }
2084
+ export declare class IfcCategories {
2085
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2086
+ }
2087
+ /**
2088
+ * A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
2089
+ *
2090
+ * @remarks
2091
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2092
+ * It is useful for identifying and processing different types of IFC elements in a project.
2093
+ *
2094
+ */
2095
+ export declare const IfcElements: {
2096
+ [key: number]: string;
2097
+ };
2098
+ /**
2099
+ * A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
2100
+ */
2101
+ export declare const IfcCategoryMap: {
2102
+ [key: number]: string;
2103
+ };
2104
+ import * as FRAGS from "@thatopen/fragments";
2105
+ export declare class IfcPropertiesUtils {
2106
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2107
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2108
+ [attribute: string]: any;
2109
+ } | null>;
2110
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2111
+ [relatingID: number]: number[];
2112
+ }>;
2113
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2114
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2115
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2116
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2117
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2118
+ key: string | null;
2119
+ name: string | null;
2120
+ }>;
2121
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2122
+ key: string | null;
2123
+ value: number | null;
2124
+ }>;
2125
+ static isRel(expressID: number): boolean;
2126
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2127
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2128
+ }
2129
+ /**
2130
+ * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2131
+ */
2132
+ export declare class Event<T> {
2133
+ /**
2134
+ * Add a callback to this event instance.
2135
+ * @param handler - the callback to be added to this event.
2136
+ */
2137
+ add(handler: T extends void ? {
2138
+ (): void;
2139
+ } : {
2140
+ (data: T): void;
1302
2141
  }): void;
1303
2142
  /**
1304
2143
  * Removes a callback from this event instance.
1305
2144
  * @param handler - the callback to be removed from this event.
1306
2145
  */
1307
2146
  remove(handler: T extends void ? {
1308
- (): Promise<void>;
2147
+ (): void;
1309
2148
  } : {
1310
- (data: T): Promise<void>;
2149
+ (data: T): void;
1311
2150
  }): void;
1312
2151
  /** Triggers all the callbacks assigned to this event. */
1313
- trigger: (data?: T) => Promise<void>;
2152
+ trigger: (data?: T) => void;
1314
2153
  /** Gets rid of all the suscribed events. */
1315
2154
  reset(): void;
1316
2155
  private handlers;
@@ -1429,31 +2268,87 @@ import { Base } from "./base";
1429
2268
  */
1430
2269
  export declare abstract class Component extends Base {
1431
2270
  /**
1432
- * Whether this component is active or not. The behaviour can vary depending
1433
- * on the type of component. E.g. a disabled dimension tool will stop creating
1434
- * dimensions, while a disabled camera will stop moving. A disabled component
1435
- * will not be updated automatically each frame.
2271
+ * Whether this component is active or not. The behaviour can vary depending
2272
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2273
+ * dimensions, while a disabled camera will stop moving. A disabled component
2274
+ * will not be updated automatically each frame.
2275
+ */
2276
+ abstract enabled: boolean;
2277
+ }
2278
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2279
+ import { Components } from "../../Components";
2280
+ /**
2281
+ * Base class of the library. Useful for finding out the interfaces something implements.
2282
+ */
2283
+ export declare abstract class Base {
2284
+ components: Components;
2285
+ constructor(components: Components);
2286
+ /** Whether is component is {@link Disposable}. */
2287
+ isDisposeable: () => this is Disposable;
2288
+ /** Whether is component is {@link Resizeable}. */
2289
+ isResizeable: () => this is Resizeable;
2290
+ /** Whether is component is {@link Updateable}. */
2291
+ isUpdateable: () => this is Updateable;
2292
+ /** Whether is component is {@link Hideable}. */
2293
+ isHideable: () => this is Hideable;
2294
+ /** Whether is component is {@link Configurable}. */
2295
+ isConfigurable: () => this is Configurable<any>;
2296
+ }
2297
+ /**
2298
+ * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2299
+ */
2300
+ export declare class AsyncEvent<T> {
2301
+ /**
2302
+ * Add a callback to this event instance.
2303
+ * @param handler - the callback to be added to this event.
2304
+ */
2305
+ add(handler: T extends void ? {
2306
+ (): Promise<void>;
2307
+ } : {
2308
+ (data: T): Promise<void>;
2309
+ }): void;
2310
+ /**
2311
+ * Removes a callback from this event instance.
2312
+ * @param handler - the callback to be removed from this event.
2313
+ */
2314
+ remove(handler: T extends void ? {
2315
+ (): Promise<void>;
2316
+ } : {
2317
+ (data: T): Promise<void>;
2318
+ }): void;
2319
+ /** Triggers all the callbacks assigned to this event. */
2320
+ trigger: (data?: T) => Promise<void>;
2321
+ /** Gets rid of all the suscribed events. */
2322
+ reset(): void;
2323
+ private handlers;
2324
+ }
2325
+ import * as THREE from "three";
2326
+ import CameraControls from "camera-controls";
2327
+ import { BaseWorldItem } from "./base-world-item";
2328
+ import { CameraControllable } from "./interfaces";
2329
+ /**
2330
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2331
+ */
2332
+ export declare abstract class BaseCamera extends BaseWorldItem {
2333
+ /**
2334
+ * Whether the camera is enabled or not.
2335
+ */
2336
+ abstract enabled: boolean;
2337
+ /**
2338
+ * The Three.js camera instance.
2339
+ */
2340
+ abstract three: THREE.Camera;
2341
+ /**
2342
+ * Optional CameraControls instance for controlling the camera.
2343
+ * This property is only available if the camera is controllable.
1436
2344
  */
1437
- abstract enabled: boolean;
1438
- }
1439
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1440
- import { Components } from "../../Components";
1441
- /**
1442
- * Base class of the library. Useful for finding out the interfaces something implements.
1443
- */
1444
- export declare abstract class Base {
1445
- components: Components;
1446
- constructor(components: Components);
1447
- /** Whether is component is {@link Disposable}. */
1448
- isDisposeable: () => this is Disposable;
1449
- /** Whether is component is {@link Resizeable}. */
1450
- isResizeable: () => this is Resizeable;
1451
- /** Whether is component is {@link Updateable}. */
1452
- isUpdateable: () => this is Updateable;
1453
- /** Whether is component is {@link Hideable}. */
1454
- isHideable: () => this is Hideable;
1455
- /** Whether is component is {@link Configurable}. */
1456
- isConfigurable: () => this is Configurable<any>;
2345
+ abstract controls?: CameraControls;
2346
+ /**
2347
+ * Checks whether the instance is {@link CameraControllable}.
2348
+ *
2349
+ * @returns True if the instance is controllable, false otherwise.
2350
+ */
2351
+ hasCameraControls: () => this is CameraControllable;
1457
2352
  }
1458
2353
  import { Base } from "./base";
1459
2354
  import { World } from "./world";
@@ -1478,33 +2373,30 @@ export declare abstract class BaseWorldItem extends Base {
1478
2373
  currentWorld: World | null;
1479
2374
  protected constructor(components: Components);
1480
2375
  }
2376
+ import { InverseAttribute } from "./types";
2377
+ export declare const relToAttributesMap: Map<number, {
2378
+ forRelating: InverseAttribute;
2379
+ forRelated: InverseAttribute;
2380
+ }>;
1481
2381
  import * as THREE from "three";
1482
- import CameraControls from "camera-controls";
2382
+ import { Disposable } from "./interfaces";
2383
+ import { Event } from "./event";
2384
+ import { Components } from "../../Components";
1483
2385
  import { BaseWorldItem } from "./base-world-item";
1484
- import { CameraControllable } from "./interfaces";
1485
2386
  /**
1486
- * Abstract class representing a camera in the 3D world. All cameras should use this class as a base.
2387
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
1487
2388
  */
1488
- export declare abstract class BaseCamera extends BaseWorldItem {
1489
- /**
1490
- * Whether the camera is enabled or not.
1491
- */
1492
- abstract enabled: boolean;
1493
- /**
1494
- * The Three.js camera instance.
1495
- */
1496
- abstract three: THREE.Camera;
1497
- /**
1498
- * Optional CameraControls instance for controlling the camera.
1499
- * This property is only available if the camera is controllable.
1500
- */
1501
- abstract controls?: CameraControls;
2389
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2390
+ /** {@link Disposable.onDisposed} */
2391
+ readonly onDisposed: Event<unknown>;
1502
2392
  /**
1503
- * Checks whether the instance is {@link CameraControllable}.
1504
- *
1505
- * @returns True if the instance is controllable, false otherwise.
2393
+ * Abstract property representing the three.js object associated with this scene.
2394
+ * It should be implemented by subclasses.
1506
2395
  */
1507
- hasCameraControls: () => this is CameraControllable;
2396
+ abstract three: THREE.Object3D;
2397
+ protected constructor(components: Components);
2398
+ /** {@link Disposable.dispose} */
2399
+ dispose(): void;
1508
2400
  }
1509
2401
  import * as THREE from "three";
1510
2402
  import { Vector2 } from "three";
@@ -1548,50 +2440,30 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1548
2440
  */
1549
2441
  clippingPlanes: THREE.Plane[];
1550
2442
  /**
1551
- * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
1552
- *
1553
- * @remarks
1554
- * This method is typically called when there is a change to the list of clipping planes
1555
- * used by the active renderer.
1556
- */
2443
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
2444
+ *
2445
+ * @remarks
2446
+ * This method is typically called when there is a change to the list of clipping planes
2447
+ * used by the active renderer.
2448
+ */
1557
2449
  updateClippingPlanes(): void;
1558
2450
  /**
1559
- * Sets or removes a clipping plane from the renderer.
1560
- *
1561
- * @param active - A boolean indicating whether the clipping plane should be active or not.
1562
- * @param plane - The clipping plane to be added or removed.
1563
- * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
1564
- *
1565
- * @remarks
1566
- * This method adds or removes a clipping plane from the 'clippingPlanes' array.
1567
- * If 'active' is 'true' and the plane is not already in the array, it is added.
1568
- * If 'active' is 'false' and the plane is in the array, it is removed.
1569
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
1570
- * excluding any planes marked as local.
1571
- */
2451
+ * Sets or removes a clipping plane from the renderer.
2452
+ *
2453
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
2454
+ * @param plane - The clipping plane to be added or removed.
2455
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
2456
+ *
2457
+ * @remarks
2458
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2459
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
2460
+ * If 'active' is 'false' and the plane is in the array, it is removed.
2461
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2462
+ * excluding any planes marked as local.
2463
+ */
1572
2464
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1573
2465
  }
1574
2466
  import * as THREE from "three";
1575
- import { Disposable } from "./interfaces";
1576
- import { Event } from "./event";
1577
- import { Components } from "../../Components";
1578
- import { BaseWorldItem } from "./base-world-item";
1579
- /**
1580
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
1581
- */
1582
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1583
- /** {@link Disposable.onDisposed} */
1584
- readonly onDisposed: Event<unknown>;
1585
- /**
1586
- * Abstract property representing the three.js object associated with this scene.
1587
- * It should be implemented by subclasses.
1588
- */
1589
- abstract three: THREE.Object3D;
1590
- protected constructor(components: Components);
1591
- /** {@link Disposable.dispose} */
1592
- dispose(): void;
1593
- }
1594
- import * as THREE from "three";
1595
2467
  import { BaseScene } from "./base-scene";
1596
2468
  import { BaseCamera } from "./base-camera";
1597
2469
  import { BaseRenderer } from "./base-renderer";
@@ -1625,11 +2497,167 @@ export interface World extends Disposable, Updateable {
1625
2497
  */
1626
2498
  isDisposing: boolean;
1627
2499
  }
2500
+ import { NavigationMode } from "./types";
2501
+ import { OrthoPerspectiveCamera } from "../index";
2502
+ /**
2503
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2504
+ */
2505
+ export declare class OrbitMode implements NavigationMode {
2506
+ camera: OrthoPerspectiveCamera;
2507
+ /** {@link NavigationMode.enabled} */
2508
+ enabled: boolean;
2509
+ /** {@link NavigationMode.id} */
2510
+ readonly id = "Orbit";
2511
+ constructor(camera: OrthoPerspectiveCamera);
2512
+ /** {@link NavigationMode.set} */
2513
+ set(active: boolean): void;
2514
+ private activateOrbitControls;
2515
+ }
2516
+ import { NavigationMode } from "./types";
2517
+ import { OrthoPerspectiveCamera } from "../index";
2518
+ /**
2519
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2520
+ */
2521
+ export declare class FirstPersonMode implements NavigationMode {
2522
+ private camera;
2523
+ /** {@link NavigationMode.enabled} */
2524
+ enabled: boolean;
2525
+ /** {@link NavigationMode.id} */
2526
+ readonly id = "FirstPerson";
2527
+ constructor(camera: OrthoPerspectiveCamera);
2528
+ /** {@link NavigationMode.set} */
2529
+ set(active: boolean): void;
2530
+ private setupFirstPersonCamera;
2531
+ }
2532
+ import * as THREE from "three";
2533
+ import { Hideable, Event, World, Disposable } from "../../Types";
2534
+ import { Components } from "../../Components";
2535
+ /**
2536
+ * Configuration interface for the {@link SimpleGrid} class.
2537
+ */
2538
+ export interface GridConfig {
2539
+ /**
2540
+ * The color of the grid lines.
2541
+ */
2542
+ color: THREE.Color;
2543
+ /**
2544
+ * The size of the primary grid lines.
2545
+ */
2546
+ size1: number;
2547
+ /**
2548
+ * The size of the secondary grid lines.
2549
+ */
2550
+ size2: number;
2551
+ /**
2552
+ * The distance at which the grid lines start to fade away.
2553
+ */
2554
+ distance: number;
2555
+ }
2556
+ /**
2557
+ * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
2558
+ */
2559
+ export declare class SimpleGrid implements Hideable, Disposable {
2560
+ /** {@link Disposable.onDisposed} */
2561
+ readonly onDisposed: Event<unknown>;
2562
+ /** The world instance to which this Raycaster belongs. */
2563
+ world: World;
2564
+ /** The components instance to which this grid belongs. */
2565
+ components: Components;
2566
+ /** {@link Hideable.visible} */
2567
+ get visible(): boolean;
2568
+ /** {@link Hideable.visible} */
2569
+ set visible(visible: boolean);
2570
+ /** The material of the grid. */
2571
+ get material(): THREE.ShaderMaterial;
2572
+ /**
2573
+ * Whether the grid should fade away with distance. Recommended to be true for
2574
+ * perspective cameras and false for orthographic cameras.
2575
+ */
2576
+ get fade(): boolean;
2577
+ /**
2578
+ * Whether the grid should fade away with distance. Recommended to be true for
2579
+ * perspective cameras and false for orthographic cameras.
2580
+ */
2581
+ set fade(active: boolean);
2582
+ /** The Three.js mesh that contains the infinite grid. */
2583
+ readonly three: THREE.Mesh;
2584
+ private _fade;
2585
+ constructor(components: Components, world: World, config: GridConfig);
2586
+ /** {@link Disposable.dispose} */
2587
+ dispose(): void;
2588
+ private setupEvents;
2589
+ private updateZoom;
2590
+ }
2591
+ import { NavigationMode } from "./types";
2592
+ import { OrthoPerspectiveCamera } from "../index";
2593
+ /**
2594
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2595
+ */
2596
+ export declare class PlanMode implements NavigationMode {
2597
+ private camera;
2598
+ /** {@link NavigationMode.enabled} */
2599
+ enabled: boolean;
2600
+ /** {@link NavigationMode.id} */
2601
+ readonly id = "Plan";
2602
+ private mouseAction1?;
2603
+ private mouseAction2?;
2604
+ private mouseInitialized;
2605
+ private readonly defaultAzimuthSpeed;
2606
+ private readonly defaultPolarSpeed;
2607
+ constructor(camera: OrthoPerspectiveCamera);
2608
+ /** {@link NavigationMode.set} */
2609
+ set(active: boolean): void;
2610
+ }
2611
+ import * as THREE from "three";
2612
+ import { CameraProjection } from "./types";
2613
+ import { Event } from "../../Types";
2614
+ import { OrthoPerspectiveCamera } from "../index";
2615
+ /**
2616
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2617
+ */
2618
+ export declare class ProjectionManager {
2619
+ /**
2620
+ * Event that fires when the {@link CameraProjection} changes.
2621
+ */
2622
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
2623
+ /**
2624
+ * Current projection mode of the camera.
2625
+ * Default is "Perspective".
2626
+ */
2627
+ current: CameraProjection;
2628
+ /**
2629
+ * The camera controlled by this ProjectionManager.
2630
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
2631
+ */
2632
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2633
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
2634
+ matchOrthoDistanceEnabled: boolean;
2635
+ private _component;
2636
+ private _previousDistance;
2637
+ constructor(camera: OrthoPerspectiveCamera);
2638
+ /**
2639
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2640
+ *
2641
+ * @param projection - the new projection to set. If it is the current projection,
2642
+ * it will have no effect.
2643
+ */
2644
+ set(projection: CameraProjection): Promise<void>;
2645
+ /**
2646
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
2647
+ * and vice versa.
2648
+ */
2649
+ toggle(): Promise<void>;
2650
+ private setOrthoCamera;
2651
+ private getPerspectiveDims;
2652
+ private setupOrthoCamera;
2653
+ private getDistance;
2654
+ private setPerspectiveCamera;
2655
+ }
1628
2656
  import * as THREE from "three";
1629
2657
  import { Components } from "../../Components";
1630
2658
  import { AsyncEvent, Event, World } from "../../Types";
1631
2659
  /**
1632
- * Interface for settings to configure the CullerRenderer.
2660
+ * Settings to configure the CullerRenderer.
1633
2661
  */
1634
2662
  export interface CullerRendererSettings {
1635
2663
  /**
@@ -1716,12 +2744,38 @@ export declare class CullerRenderer {
1716
2744
  protected decreaseColor(): void;
1717
2745
  private applySettings;
1718
2746
  }
2747
+ /**
2748
+ * The projection system of the camera.
2749
+ */
2750
+ export type CameraProjection = "Perspective" | "Orthographic";
2751
+ /**
2752
+ * The extensible list of supported navigation modes.
2753
+ */
2754
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
2755
+ /**
2756
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
2757
+ */
2758
+ export interface NavigationMode {
2759
+ /** The unique ID of this navigation mode. */
2760
+ id: NavModeID;
2761
+ /**
2762
+ * Enable or disable this navigation mode.
2763
+ * When a new navigation mode is enabled, the previous navigation mode
2764
+ * must be disabled.
2765
+ *
2766
+ * @param active - whether to enable or disable this mode.
2767
+ * @param options - any additional data required to enable or disable it.
2768
+ * */
2769
+ set: (active: boolean, options?: any) => void;
2770
+ /** Whether this navigation mode is active or not. */
2771
+ enabled: boolean;
2772
+ }
1719
2773
  import * as THREE from "three";
1720
2774
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1721
2775
  import { Components } from "../../Components";
1722
2776
  import { Event, World, Disposable } from "../../Types";
1723
2777
  /**
1724
- * A renderer to determine a mesh visibility on screen.
2778
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
1725
2779
  */
1726
2780
  export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
1727
2781
  /**
@@ -1763,42 +2817,90 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
1763
2817
  */
1764
2818
  add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1765
2819
  /**
1766
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
1767
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
1768
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
1769
- * @returns {void}
1770
- */
2820
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2821
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2822
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2823
+ * @returns {void}
2824
+ */
1771
2825
  remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1772
2826
  private handleWorkerMessage;
1773
2827
  private getAvailableMaterial;
1774
2828
  }
1775
2829
  export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1776
- import * as WEBIFC from "web-ifc";
1777
- /** Configuration of the IFC-fragment conversion. */
1778
- export declare class IfcFragmentSettings {
1779
- /** Whether to extract the IFC properties into a JSON. */
1780
- includeProperties: boolean;
2830
+ import * as THREE from "three";
2831
+ import { Disposable, Event } from "../../Types";
2832
+ /**
2833
+ * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
2834
+ */
2835
+ export declare class Mouse implements Disposable {
2836
+ dom: HTMLCanvasElement;
2837
+ private _event?;
2838
+ private _position;
2839
+ /** {@link Disposable.onDisposed} */
2840
+ readonly onDisposed: Event<unknown>;
2841
+ constructor(dom: HTMLCanvasElement);
1781
2842
  /**
1782
- * Generate the geometry for categories that are not included by default,
1783
- * like IFCSPACE.
2843
+ * The real position of the mouse of the Three.js canvas.
1784
2844
  */
1785
- optionalCategories: number[];
1786
- /** Whether to use the coordination data coming from the IFC files. */
1787
- coordinate: boolean;
1788
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1789
- wasm: {
1790
- path: string;
1791
- absolute: boolean;
1792
- logLevel?: WEBIFC.LogLevel;
1793
- };
1794
- /** List of categories that won't be converted to fragments. */
1795
- excludedCategories: Set<number>;
1796
- /** Whether to save the absolute location of all IFC items. */
1797
- saveLocations: boolean;
1798
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1799
- webIfc: WEBIFC.LoaderSettings;
1800
- autoSetWasm: boolean;
1801
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2845
+ get position(): THREE.Vector2;
2846
+ /** {@link Disposable.dispose} */
2847
+ dispose(): void;
2848
+ private getPositionY;
2849
+ private getPositionX;
2850
+ private updateMouseInfo;
2851
+ private setupEvents;
2852
+ }
2853
+ import * as THREE from "three";
2854
+ import { Components } from "../../Components";
2855
+ import { Event, World, Disposable } from "../../Types";
2856
+ import { Mouse } from "./mouse";
2857
+ /**
2858
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2859
+ */
2860
+ export declare class SimpleRaycaster implements Disposable {
2861
+ /** {@link Component.enabled} */
2862
+ enabled: boolean;
2863
+ /** The components instance to which this Raycaster belongs. */
2864
+ components: Components;
2865
+ /** {@link Disposable.onDisposed} */
2866
+ readonly onDisposed: Event<unknown>;
2867
+ /** The position of the mouse in the screen. */
2868
+ readonly mouse: Mouse;
2869
+ /**
2870
+ * A reference to the Three.js Raycaster instance.
2871
+ * This is used for raycasting operations.
2872
+ */
2873
+ readonly three: THREE.Raycaster;
2874
+ /**
2875
+ * A reference to the world instance to which this Raycaster belongs.
2876
+ * This is used to access the camera and meshes.
2877
+ */
2878
+ world: World;
2879
+ constructor(components: Components, world: World);
2880
+ /** {@link Disposable.dispose} */
2881
+ dispose(): void;
2882
+ /**
2883
+ * Throws a ray from the camera to the mouse or touch event point and returns
2884
+ * the first item found. This also takes into account the clipping planes
2885
+ * used by the renderer.
2886
+ *
2887
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2888
+ * to query. If not provided, it will query all the meshes stored in
2889
+ * {@link Components.meshes}.
2890
+ */
2891
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2892
+ /**
2893
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2894
+ * This method also takes into account the clipping planes used by the renderer.
2895
+ *
2896
+ * @param origin - The origin of the ray.
2897
+ * @param direction - The direction of the ray.
2898
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2899
+ * @returns The first intersection found or 'null' if no intersection was found.
2900
+ */
2901
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
2902
+ private intersect;
2903
+ private filterClippingPlanes;
1802
2904
  }
1803
2905
  import * as THREE from "three";
1804
2906
  import * as WEBIFC from "web-ifc";
@@ -1821,45 +2923,6 @@ export declare class IfcMetadataReader {
1821
2923
  getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
1822
2924
  }
1823
2925
  import * as THREE from "three";
1824
- import { BaseScene, Configurable, Event } from "../../Types";
1825
- import { Components } from "../../Components";
1826
- /**
1827
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
1828
- */
1829
- export interface SimpleSceneConfig {
1830
- directionalLight: {
1831
- color: THREE.Color;
1832
- intensity: number;
1833
- position: THREE.Vector3;
1834
- };
1835
- ambientLight: {
1836
- color: THREE.Color;
1837
- intensity: number;
1838
- };
1839
- }
1840
- /**
1841
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
1842
- */
1843
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1844
- /** {@link Configurable.isSetup} */
1845
- isSetup: boolean;
1846
- /**
1847
- * The underlying Three.js scene object.
1848
- * It is used to define the 3D space containing objects, lights, and cameras.
1849
- */
1850
- three: THREE.Scene;
1851
- /** {@link Configurable.onSetup} */
1852
- readonly onSetup: Event<SimpleScene>;
1853
- /**
1854
- * Configuration interface for the {@link SimpleScene}.
1855
- * Defines properties for directional and ambient lights.
1856
- */
1857
- config: Required<SimpleSceneConfig>;
1858
- constructor(components: Components);
1859
- /** {@link Configurable.setup} */
1860
- setup(config?: Partial<SimpleSceneConfig>): void;
1861
- }
1862
- import * as THREE from "three";
1863
2926
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
1864
2927
  /**
1865
2928
  * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
@@ -1929,529 +2992,282 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
1929
2992
  /**
1930
2993
  * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
1931
2994
  * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
1932
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
1933
- * @param renderer - The new renderer to be set or null to remove the current renderer.
1934
- */
1935
- set renderer(renderer: S | null);
1936
- /** {@link Updateable.update} */
1937
- update(delta?: number): void;
1938
- /** {@link Disposable.dispose} */
1939
- dispose(disposeResources?: boolean): void;
1940
- }
1941
- import * as THREE from "three";
1942
- import CameraControls from "camera-controls";
1943
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1944
- import { Components } from "../../Components";
1945
- /**
1946
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to easily control the camera in 2D and 3D. Check out it's API to find out what features it offers.
1947
- */
1948
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1949
- /** {@link Updateable.onBeforeUpdate} */
1950
- readonly onBeforeUpdate: Event<SimpleCamera>;
1951
- /** {@link Updateable.onAfterUpdate} */
1952
- readonly onAfterUpdate: Event<SimpleCamera>;
1953
- /**
1954
- * Event that is triggered when the aspect of the camera has been updated.
1955
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
1956
- */
1957
- readonly onAspectUpdated: Event<unknown>;
1958
- /** {@link Disposable.onDisposed} */
1959
- readonly onDisposed: Event<string>;
1960
- /**
1961
- * A three.js PerspectiveCamera or OrthographicCamera instance.
1962
- * This camera is used for rendering the scene.
1963
- */
1964
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1965
- private _allControls;
1966
- /**
1967
- * The object that controls the camera. An instance of
1968
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1969
- * Transforming the camera directly will have no effect: you need to use this
1970
- * object to move, rotate, look at objects, etc.
1971
- */
1972
- get controls(): CameraControls;
1973
- /**
1974
- * Getter for the enabled state of the camera controls.
1975
- * If the current world is null, it returns false.
1976
- * Otherwise, it returns the enabled state of the camera controls.
1977
- *
1978
- * @returns {boolean} The enabled state of the camera controls.
1979
- */
1980
- get enabled(): boolean;
1981
- /**
1982
- * Setter for the enabled state of the camera controls.
1983
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
1984
- *
1985
- * @param {boolean} enabled - The new enabled state of the camera controls.
1986
- */
1987
- set enabled(enabled: boolean);
1988
- constructor(components: Components);
1989
- /** {@link Disposable.dispose} */
1990
- dispose(): void;
1991
- /** {@link Updateable.update} */
1992
- update(_delta: number): void;
1993
- /**
1994
- * Updates the aspect of the camera to match the size of the
1995
- * {@link Components.renderer}.
1996
- */
1997
- updateAspect: () => void;
1998
- private setupCamera;
1999
- private newCameraControls;
2000
- private setupEvents;
2001
- private static getSubsetOfThree;
2002
- }
2003
- import * as THREE from "three";
2004
- import { BaseRenderer, Event } from "../../Types";
2005
- import { Components } from "../../Components";
2006
- /**
2007
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2008
- */
2009
- export declare class SimpleRenderer extends BaseRenderer {
2010
- /**
2011
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2012
- * Default is 'true'.
2013
- */
2014
- enabled: boolean;
2015
- /**
2016
- * The HTML container of the THREE.js canvas where the scene is rendered.
2017
- */
2018
- container: HTMLElement;
2019
- /**
2020
- * The THREE.js WebGLRenderer instance.
2021
- */
2022
- three: THREE.WebGLRenderer;
2023
- protected _canvas: HTMLCanvasElement;
2024
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2025
- protected _resizeObserver: ResizeObserver | null;
2026
- protected onContainerUpdated: Event<unknown>;
2027
- private _resizing;
2028
- /**
2029
- * Constructor for the SimpleRenderer class.
2030
- *
2031
- * @param components - The components instance.
2032
- * @param container - The HTML container where the THREE.js canvas will be rendered.
2033
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2034
- */
2035
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2036
- /** {@link Updateable.update} */
2037
- update(): void;
2038
- /** {@link Disposable.dispose} */
2039
- dispose(): void;
2040
- /** {@link Resizeable.getSize}. */
2041
- getSize(): THREE.Vector2;
2042
- /** {@link Resizeable.resize} */
2043
- resize: (size?: THREE.Vector2) => void;
2044
- /**
2045
- * Sets up and manages the event listeners for the renderer.
2046
- *
2047
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2048
- *
2049
- * @throws Will throw an error if the renderer does not have an HTML container.
2995
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2996
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
2050
2997
  */
2051
- setupEvents(active: boolean): void;
2052
- private resizeEvent;
2053
- private setupRenderer;
2054
- private onContextLost;
2055
- private onContextBack;
2998
+ set renderer(renderer: S | null);
2999
+ /** {@link Updateable.update} */
3000
+ update(delta?: number): void;
3001
+ /** {@link Disposable.dispose} */
3002
+ dispose(disposeResources?: boolean): void;
2056
3003
  }
2057
3004
  import * as THREE from "three";
2058
- import { Hideable, Event, World, Disposable } from "../../Types";
3005
+ import { BaseScene, Configurable, Event } from "../../Types";
2059
3006
  import { Components } from "../../Components";
2060
- export interface GridConfig {
2061
- color: THREE.Color;
2062
- size1: number;
2063
- size2: number;
2064
- distance: number;
3007
+ /**
3008
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3009
+ */
3010
+ export interface SimpleSceneConfig {
3011
+ directionalLight: {
3012
+ color: THREE.Color;
3013
+ intensity: number;
3014
+ position: THREE.Vector3;
3015
+ };
3016
+ ambientLight: {
3017
+ color: THREE.Color;
3018
+ intensity: number;
3019
+ };
2065
3020
  }
2066
3021
  /**
2067
- * An infinite grid. Created by
2068
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
2069
- * and translated to typescript by
2070
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3022
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2071
3023
  */
2072
- export declare class SimpleGrid implements Hideable, Disposable {
2073
- /** {@link Disposable.onDisposed} */
2074
- readonly onDisposed: Event<unknown>;
2075
- /** The world instance to which this Raycaster belongs. */
2076
- world: World;
2077
- /** The components instance to which this grid belongs. */
2078
- components: Components;
2079
- /** {@link Hideable.visible} */
2080
- get visible(): boolean;
2081
- /** {@link Hideable.visible} */
2082
- set visible(visible: boolean);
2083
- /** The material of the grid. */
2084
- get material(): THREE.ShaderMaterial;
3024
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3025
+ /** {@link Configurable.isSetup} */
3026
+ isSetup: boolean;
2085
3027
  /**
2086
- * Whether the grid should fade away with distance. Recommended to be true for
2087
- * perspective cameras and false for orthographic cameras.
3028
+ * The underlying Three.js scene object.
3029
+ * It is used to define the 3D space containing objects, lights, and cameras.
2088
3030
  */
2089
- get fade(): boolean;
3031
+ three: THREE.Scene;
3032
+ /** {@link Configurable.onSetup} */
3033
+ readonly onSetup: Event<SimpleScene>;
2090
3034
  /**
2091
- * Whether the grid should fade away with distance. Recommended to be true for
2092
- * perspective cameras and false for orthographic cameras.
3035
+ * Configuration interface for the {@link SimpleScene}.
3036
+ * Defines properties for directional and ambient lights.
2093
3037
  */
2094
- set fade(active: boolean);
2095
- /** The Three.js mesh that contains the infinite grid. */
2096
- readonly three: THREE.Mesh;
2097
- private _fade;
2098
- constructor(components: Components, world: World, config: GridConfig);
2099
- /** {@link Disposable.dispose} */
2100
- dispose(): void;
2101
- private setupEvents;
2102
- private updateZoom;
3038
+ config: Required<SimpleSceneConfig>;
3039
+ constructor(components: Components);
3040
+ /** {@link Configurable.setup} */
3041
+ setup(config?: Partial<SimpleSceneConfig>): void;
2103
3042
  }
2104
3043
  import * as THREE from "three";
2105
- import { Hideable, Disposable, Event, World } from "../../Types";
3044
+ import CameraControls from "camera-controls";
3045
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2106
3046
  import { Components } from "../../Components";
2107
3047
  /**
2108
- * Each of the planes created by the clipper.
3048
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
2109
3049
  */
2110
- export declare class SimplePlane implements Disposable, Hideable {
2111
- /** Event that fires when the user starts dragging a clipping plane. */
2112
- readonly onDraggingStarted: Event<unknown>;
2113
- /** Event that fires when the user stops dragging a clipping plane. */
2114
- readonly onDraggingEnded: Event<unknown>;
2115
- /** {@link Disposable.onDisposed} */
2116
- readonly onDisposed: Event<unknown>;
3050
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3051
+ /** {@link Updateable.onBeforeUpdate} */
3052
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3053
+ /** {@link Updateable.onAfterUpdate} */
3054
+ readonly onAfterUpdate: Event<SimpleCamera>;
2117
3055
  /**
2118
- * The normal vector of the clipping plane.
3056
+ * Event that is triggered when the aspect of the camera has been updated.
3057
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2119
3058
  */
2120
- readonly normal: THREE.Vector3;
3059
+ readonly onAspectUpdated: Event<unknown>;
3060
+ /** {@link Disposable.onDisposed} */
3061
+ readonly onDisposed: Event<string>;
2121
3062
  /**
2122
- * The origin point of the clipping plane.
3063
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3064
+ * This camera is used for rendering the scene.
2123
3065
  */
2124
- readonly origin: THREE.Vector3;
3066
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3067
+ private _allControls;
2125
3068
  /**
2126
- * The THREE.js Plane object representing the clipping plane.
3069
+ * The object that controls the camera. An instance of
3070
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3071
+ * Transforming the camera directly will have no effect: you need to use this
3072
+ * object to move, rotate, look at objects, etc.
2127
3073
  */
2128
- readonly three: THREE.Plane;
2129
- /** The components instance to which this plane belongs. */
2130
- components: Components;
2131
- /** The world instance to which this plane belongs. */
2132
- world: World;
2133
- protected readonly _helper: THREE.Object3D;
2134
- protected _visible: boolean;
2135
- protected _enabled: boolean;
2136
- private _controlsActive;
2137
- private readonly _arrowBoundBox;
2138
- private readonly _planeMesh;
2139
- private readonly _controls;
2140
- private readonly _hiddenMaterial;
3074
+ get controls(): CameraControls;
2141
3075
  /**
2142
- * Getter for the enabled state of the clipping plane.
2143
- * @returns {boolean} The current enabled state.
3076
+ * Getter for the enabled state of the camera controls.
3077
+ * If the current world is null, it returns false.
3078
+ * Otherwise, it returns the enabled state of the camera controls.
3079
+ *
3080
+ * @returns {boolean} The enabled state of the camera controls.
2144
3081
  */
2145
3082
  get enabled(): boolean;
2146
3083
  /**
2147
- * Setter for the enabled state of the clipping plane.
2148
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
2149
- * @param {boolean} state - The new enabled state.
3084
+ * Setter for the enabled state of the camera controls.
3085
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3086
+ *
3087
+ * @param {boolean} enabled - The new enabled state of the camera controls.
2150
3088
  */
2151
- set enabled(state: boolean);
2152
- /** {@link Hideable.visible } */
2153
- get visible(): boolean;
2154
- /** {@link Hideable.visible } */
2155
- set visible(state: boolean);
2156
- /** The meshes used for raycasting */
2157
- get meshes(): THREE.Mesh[];
2158
- /** The material of the clipping plane representation. */
2159
- get planeMaterial(): THREE.Material | THREE.Material[];
2160
- /** The material of the clipping plane representation. */
2161
- set planeMaterial(material: THREE.Material | THREE.Material[]);
2162
- /** The size of the clipping plane representation. */
2163
- get size(): number;
2164
- /** Sets the size of the clipping plane representation. */
2165
- set size(size: number);
2166
- /**
2167
- * Getter for the helper object of the clipping plane.
2168
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
2169
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
2170
- *
2171
- * @returns {THREE.Object3D} The helper object of the clipping plane.
2172
- */
2173
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
2174
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
2175
- /**
2176
- * Sets the clipping plane's normal and origin from the given normal and point.
2177
- * This method resets the clipping plane's state, updates the normal and origin,
2178
- * and positions the helper object accordingly.
2179
- *
2180
- * @param normal - The new normal vector for the clipping plane.
2181
- * @param point - The new origin point for the clipping plane.
2182
- *
2183
- * @returns {void}
2184
- */
2185
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
2186
- /** {@link Updateable.update} */
2187
- update: () => void;
3089
+ set enabled(enabled: boolean);
3090
+ constructor(components: Components);
2188
3091
  /** {@link Disposable.dispose} */
2189
3092
  dispose(): void;
2190
- private reset;
2191
- protected toggleControls(state: boolean): void;
2192
- private newTransformControls;
2193
- private initializeControls;
2194
- private createArrowBoundingBox;
2195
- private changeDrag;
2196
- private notifyDraggingChanged;
2197
- private preventCameraMovement;
2198
- private newHelper;
2199
- private static newPlaneMesh;
2200
- }
2201
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2202
- /** Configuration of the IFC-fragment streaming. */
2203
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
2204
- minGeometrySize: number;
2205
- minAssetsSize: number;
2206
- }
2207
- /** Configuration of the IFC-fragment streaming. */
2208
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2209
- propertiesSize: number;
2210
- }
2211
- export interface StreamedGeometries {
2212
- [id: number]: {
2213
- boundingBox: Float32Array;
2214
- hasHoles: boolean;
2215
- geometryFile?: string;
2216
- };
2217
- }
2218
- export interface StreamedAsset {
2219
- id: number;
2220
- geometries: {
2221
- geometryID: number;
2222
- transformation: number[];
2223
- color: number[];
2224
- }[];
2225
- }
2226
- import * as WEBIFC from "web-ifc";
2227
- import { AsyncEvent, Component, Disposable, Event } from "../../../core";
2228
- import { PropertiesStreamingSettings } from "./streaming-settings";
2229
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
2230
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
2231
- onPropertiesStreamed: AsyncEvent<{
2232
- type: number;
2233
- data: {
2234
- [id: number]: any;
2235
- };
2236
- }>;
2237
- onProgress: AsyncEvent<number>;
2238
- onIndicesStreamed: AsyncEvent<number[][]>;
2239
- /** {@link Disposable.onDisposed} */
2240
- readonly onDisposed: Event<string>;
2241
- enabled: boolean;
2242
- settings: PropertiesStreamingSettings;
2243
- webIfc: WEBIFC.IfcAPI;
2244
- dispose(): Promise<void>;
2245
- streamFromBuffer(data: Uint8Array): Promise<void>;
2246
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2247
- private readIfcFile;
2248
- private streamIfcFile;
2249
- private streamAllProperties;
2250
- private getIndices;
2251
- private cleanUp;
2252
- }
2253
- import { NavigationMode } from "./types";
2254
- import { OrthoPerspectiveCamera } from "../index";
2255
- /**
2256
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2257
- */
2258
- export declare class FirstPersonMode implements NavigationMode {
2259
- private camera;
2260
- /** {@link NavigationMode.enabled} */
2261
- enabled: boolean;
2262
- /** {@link NavigationMode.id} */
2263
- readonly id = "FirstPerson";
2264
- constructor(camera: OrthoPerspectiveCamera);
2265
- /** {@link NavigationMode.set} */
2266
- set(active: boolean): void;
2267
- private setupFirstPersonCamera;
2268
- }
2269
- import * as THREE from "three";
2270
- import { Disposable, Event } from "../../Types";
2271
- /**
2272
- * A helper to easily get the real position of the mouse in the Three.js canvas
2273
- * to work with tools like the
2274
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
2275
- * been transformed through CSS or doesn't occupy the whole screen.
2276
- */
2277
- export declare class Mouse implements Disposable {
2278
- dom: HTMLCanvasElement;
2279
- private _event?;
2280
- private _position;
2281
- /** {@link Disposable.onDisposed} */
2282
- readonly onDisposed: Event<unknown>;
2283
- constructor(dom: HTMLCanvasElement);
3093
+ /** {@link Updateable.update} */
3094
+ update(_delta: number): void;
2284
3095
  /**
2285
- * The real position of the mouse of the Three.js canvas.
3096
+ * Updates the aspect of the camera to match the size of the
3097
+ * {@link Components.renderer}.
2286
3098
  */
2287
- get position(): THREE.Vector2;
2288
- /** {@link Disposable.dispose} */
2289
- dispose(): void;
2290
- private getPositionY;
2291
- private getPositionX;
2292
- private updateMouseInfo;
3099
+ updateAspect: () => void;
3100
+ private setupCamera;
3101
+ private newCameraControls;
2293
3102
  private setupEvents;
3103
+ private static getSubsetOfThree;
2294
3104
  }
2295
3105
  import * as THREE from "three";
3106
+ import { Hideable, Disposable, Event, World } from "../../Types";
2296
3107
  import { Components } from "../../Components";
2297
- import { Event, World, Disposable } from "../../Types";
2298
- import { Mouse } from "./mouse";
2299
3108
  /**
2300
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
2301
- * that allows to easily get items from the scene using the mouse and touch
2302
- * events.
3109
+ * Each of the clipping planes created by the clipper.
2303
3110
  */
2304
- export declare class SimpleRaycaster implements Disposable {
2305
- /** {@link Component.enabled} */
2306
- enabled: boolean;
2307
- /** The components instance to which this Raycaster belongs. */
2308
- components: Components;
3111
+ export declare class SimplePlane implements Disposable, Hideable {
3112
+ /** Event that fires when the user starts dragging a clipping plane. */
3113
+ readonly onDraggingStarted: Event<unknown>;
3114
+ /** Event that fires when the user stops dragging a clipping plane. */
3115
+ readonly onDraggingEnded: Event<unknown>;
2309
3116
  /** {@link Disposable.onDisposed} */
2310
3117
  readonly onDisposed: Event<unknown>;
2311
- /** The position of the mouse in the screen. */
2312
- readonly mouse: Mouse;
2313
3118
  /**
2314
- * A reference to the Three.js Raycaster instance.
2315
- * This is used for raycasting operations.
3119
+ * The normal vector of the clipping plane.
2316
3120
  */
2317
- readonly three: THREE.Raycaster;
3121
+ readonly normal: THREE.Vector3;
2318
3122
  /**
2319
- * A reference to the world instance to which this Raycaster belongs.
2320
- * This is used to access the camera and meshes.
3123
+ * The origin point of the clipping plane.
3124
+ */
3125
+ readonly origin: THREE.Vector3;
3126
+ /**
3127
+ * The THREE.js Plane object representing the clipping plane.
2321
3128
  */
3129
+ readonly three: THREE.Plane;
3130
+ /** The components instance to which this plane belongs. */
3131
+ components: Components;
3132
+ /** The world instance to which this plane belongs. */
2322
3133
  world: World;
2323
- constructor(components: Components, world: World);
2324
- /** {@link Disposable.dispose} */
2325
- dispose(): void;
3134
+ protected readonly _helper: THREE.Object3D;
3135
+ protected _visible: boolean;
3136
+ protected _enabled: boolean;
3137
+ private _controlsActive;
3138
+ private readonly _arrowBoundBox;
3139
+ private readonly _planeMesh;
3140
+ private readonly _controls;
3141
+ private readonly _hiddenMaterial;
2326
3142
  /**
2327
- * Throws a ray from the camera to the mouse or touch event point and returns
2328
- * the first item found. This also takes into account the clipping planes
2329
- * used by the renderer.
3143
+ * Getter for the enabled state of the clipping plane.
3144
+ * @returns {boolean} The current enabled state.
3145
+ */
3146
+ get enabled(): boolean;
3147
+ /**
3148
+ * Setter for the enabled state of the clipping plane.
3149
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3150
+ * @param {boolean} state - The new enabled state.
3151
+ */
3152
+ set enabled(state: boolean);
3153
+ /** {@link Hideable.visible } */
3154
+ get visible(): boolean;
3155
+ /** {@link Hideable.visible } */
3156
+ set visible(state: boolean);
3157
+ /** The meshes used for raycasting */
3158
+ get meshes(): THREE.Mesh[];
3159
+ /** The material of the clipping plane representation. */
3160
+ get planeMaterial(): THREE.Material | THREE.Material[];
3161
+ /** The material of the clipping plane representation. */
3162
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
3163
+ /** The size of the clipping plane representation. */
3164
+ get size(): number;
3165
+ /** Sets the size of the clipping plane representation. */
3166
+ set size(size: number);
3167
+ /**
3168
+ * Getter for the helper object of the clipping plane.
3169
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3170
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
2330
3171
  *
2331
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2332
- * to query. If not provided, it will query all the meshes stored in
2333
- * {@link Components.meshes}.
3172
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
2334
3173
  */
2335
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3174
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3175
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
2336
3176
  /**
2337
- * Casts a ray from a given origin in a given direction and returns the first item found.
2338
- * This method also takes into account the clipping planes used by the renderer.
2339
- *
2340
- * @param origin - The origin of the ray.
2341
- * @param direction - The direction of the ray.
2342
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2343
- * @returns The first intersection found or 'null' if no intersection was found.
2344
- */
2345
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
2346
- private intersect;
2347
- private filterClippingPlanes;
2348
- }
2349
- import { NavigationMode } from "./types";
2350
- import { OrthoPerspectiveCamera } from "../index";
2351
- /**
2352
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2353
- */
2354
- export declare class OrbitMode implements NavigationMode {
2355
- camera: OrthoPerspectiveCamera;
2356
- /** {@link NavigationMode.enabled} */
2357
- enabled: boolean;
2358
- /** {@link NavigationMode.id} */
2359
- readonly id = "Orbit";
2360
- constructor(camera: OrthoPerspectiveCamera);
2361
- /** {@link NavigationMode.set} */
2362
- set(active: boolean): void;
2363
- private activateOrbitControls;
2364
- }
2365
- import { NavigationMode } from "./types";
2366
- import { OrthoPerspectiveCamera } from "../index";
2367
- /**
2368
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2369
- */
2370
- export declare class PlanMode implements NavigationMode {
2371
- private camera;
2372
- /** {@link NavigationMode.enabled} */
2373
- enabled: boolean;
2374
- /** {@link NavigationMode.id} */
2375
- readonly id = "Plan";
2376
- private mouseAction1?;
2377
- private mouseAction2?;
2378
- private mouseInitialized;
2379
- private readonly defaultAzimuthSpeed;
2380
- private readonly defaultPolarSpeed;
2381
- constructor(camera: OrthoPerspectiveCamera);
2382
- /** {@link NavigationMode.set} */
2383
- set(active: boolean): void;
3177
+ * Sets the clipping plane's normal and origin from the given normal and point.
3178
+ * This method resets the clipping plane's state, updates the normal and origin,
3179
+ * and positions the helper object accordingly.
3180
+ *
3181
+ * @param normal - The new normal vector for the clipping plane.
3182
+ * @param point - The new origin point for the clipping plane.
3183
+ *
3184
+ * @returns {void}
3185
+ */
3186
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3187
+ /** {@link Updateable.update} */
3188
+ update: () => void;
3189
+ /** {@link Disposable.dispose} */
3190
+ dispose(): void;
3191
+ private reset;
3192
+ protected toggleControls(state: boolean): void;
3193
+ private newTransformControls;
3194
+ private initializeControls;
3195
+ private createArrowBoundingBox;
3196
+ private changeDrag;
3197
+ private notifyDraggingChanged;
3198
+ private preventCameraMovement;
3199
+ private newHelper;
3200
+ private static newPlaneMesh;
2384
3201
  }
2385
3202
  import * as THREE from "three";
2386
- import { CameraProjection } from "./types";
2387
- import { Event } from "../../Types";
2388
- import { OrthoPerspectiveCamera } from "../index";
3203
+ import { BaseRenderer, Event } from "../../Types";
3204
+ import { Components } from "../../Components";
2389
3205
  /**
2390
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3206
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2391
3207
  */
2392
- export declare class ProjectionManager {
3208
+ export declare class SimpleRenderer extends BaseRenderer {
2393
3209
  /**
2394
- * Event that fires when the {@link CameraProjection} changes.
3210
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3211
+ * Default is 'true'.
2395
3212
  */
2396
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3213
+ enabled: boolean;
2397
3214
  /**
2398
- * Current projection mode of the camera.
2399
- * Default is "Perspective".
3215
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2400
3216
  */
2401
- current: CameraProjection;
3217
+ container: HTMLElement;
2402
3218
  /**
2403
- * The camera controlled by this ProjectionManager.
2404
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3219
+ * The THREE.js WebGLRenderer instance.
2405
3220
  */
2406
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2407
- /** Match Ortho zoom with Perspective distance when changing projection mode */
2408
- matchOrthoDistanceEnabled: boolean;
2409
- private _component;
2410
- private _previousDistance;
2411
- constructor(camera: OrthoPerspectiveCamera);
3221
+ three: THREE.WebGLRenderer;
3222
+ protected _canvas: HTMLCanvasElement;
3223
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3224
+ protected _resizeObserver: ResizeObserver | null;
3225
+ protected onContainerUpdated: Event<unknown>;
3226
+ private _resizing;
2412
3227
  /**
2413
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3228
+ * Constructor for the SimpleRenderer class.
2414
3229
  *
2415
- * @param projection - the new projection to set. If it is the current projection,
2416
- * it will have no effect.
3230
+ * @param components - The components instance.
3231
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
3232
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2417
3233
  */
2418
- set(projection: CameraProjection): Promise<void>;
3234
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3235
+ /** {@link Updateable.update} */
3236
+ update(): void;
3237
+ /** {@link Disposable.dispose} */
3238
+ dispose(): void;
3239
+ /** {@link Resizeable.getSize}. */
3240
+ getSize(): THREE.Vector2;
3241
+ /** {@link Resizeable.resize} */
3242
+ resize: (size?: THREE.Vector2) => void;
2419
3243
  /**
2420
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
2421
- * and vice versa.
3244
+ * Sets up and manages the event listeners for the renderer.
3245
+ *
3246
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3247
+ *
3248
+ * @throws Will throw an error if the renderer does not have an HTML container.
2422
3249
  */
2423
- toggle(): Promise<void>;
2424
- private setOrthoCamera;
2425
- private getPerspectiveDims;
2426
- private setupOrthoCamera;
2427
- private getDistance;
2428
- private setPerspectiveCamera;
3250
+ setupEvents(active: boolean): void;
3251
+ private resizeEvent;
3252
+ private setupRenderer;
3253
+ private onContextLost;
3254
+ private onContextBack;
2429
3255
  }
3256
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2430
3257
  /**
2431
- * The projection system of the camera.
2432
- */
2433
- export type CameraProjection = "Perspective" | "Orthographic";
2434
- /**
2435
- * The extensible list of supported navigation modes.
2436
- */
2437
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
2438
- /**
2439
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3258
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
2440
3259
  */
2441
- export interface NavigationMode {
2442
- /** The unique ID of this navigation mode. */
2443
- id: NavModeID;
3260
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
2444
3261
  /**
2445
- * Enable or disable this navigation mode.
2446
- * When a new navigation mode is enabled, the previous navigation mode
2447
- * must be disabled.
2448
- *
2449
- * @param active - whether to enable or disable this mode.
2450
- * @param options - any additional data required to enable or disable it.
2451
- * */
2452
- set: (active: boolean, options?: any) => void;
2453
- /** Whether this navigation mode is active or not. */
2454
- enabled: boolean;
3262
+ * Minimum number of geometries to be streamed.
3263
+ * Defaults to 10 geometries.
3264
+ */
3265
+ minGeometrySize: number;
3266
+ /**
3267
+ * Minimum amount of assets to be streamed.
3268
+ * Defaults to 1000 assets.
3269
+ */
3270
+ minAssetsSize: number;
2455
3271
  }
2456
3272
  import * as WEBIFC from "web-ifc";
2457
3273
  import * as THREE from "three";
@@ -2487,6 +3303,46 @@ export type InverseAttributes = [
2487
3303
  "ContainsElements"
2488
3304
  ];
2489
3305
  export type InverseAttribute = InverseAttributes[number];
3306
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3307
+ /**
3308
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3309
+ */
3310
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3311
+ /**
3312
+ * Amount of properties to be streamed.
3313
+ * Defaults to 100 properties.
3314
+ */
3315
+ propertiesSize: number;
3316
+ }
3317
+ /**
3318
+ * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
3319
+ */
3320
+ export interface StreamedGeometries {
3321
+ [id: number]: {
3322
+ /** The bounding box of the geometry as a Float32Array. */
3323
+ boundingBox: Float32Array;
3324
+ /** A boolean indicating whether the geometry has holes. */
3325
+ hasHoles: boolean;
3326
+ /** An optional file path for the geometry data. */
3327
+ geometryFile?: string;
3328
+ };
3329
+ }
3330
+ /**
3331
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3332
+ */
3333
+ export interface StreamedAsset {
3334
+ /** The unique identifier of the asset. */
3335
+ id: number;
3336
+ /** An array of geometries associated with the asset. */
3337
+ geometries: {
3338
+ /** The unique identifier of the geometry. */
3339
+ geometryID: number;
3340
+ /** The transformation matrix of the geometry as a number array. */
3341
+ transformation: number[];
3342
+ /** The color of the geometry as a number array. */
3343
+ color: number[];
3344
+ }[];
3345
+ }
2490
3346
  import { BufferGeometry } from "three";
2491
3347
  import * as THREE from "three";
2492
3348
  export declare class TransformHelper {