@thatopen/components 2.1.14 → 2.1.15

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.
@@ -1,49 +1,4 @@
1
1
  declare namespace OBC {
2
- import * as THREE from "three";
3
- import { Components } from "../Components";
4
- import { Component } from "../Types";
5
- /**
6
- * 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).
7
- */
8
- export declare class Disposer extends Component {
9
- private _disposedComponents;
10
- /** {@link Component.enabled} */
11
- enabled: boolean;
12
- /**
13
- * A unique identifier for the component.
14
- * This UUID is used to register the component within the Components system.
15
- */
16
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
17
- constructor(components: Components);
18
- /**
19
- * Return the UUIDs of all disposed components.
20
- */
21
- get(): Set<string>;
22
- /**
23
- * Removes a mesh, its geometry and its materials from memory. If you are
24
- * using any of these in other parts of the application, make sure that you
25
- * remove them from the mesh before disposing it.
26
- *
27
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
- * to remove.
29
- *
30
- * @param materials - whether to dispose the materials of the mesh.
31
- *
32
- * @param recursive - whether to recursively dispose the children of the mesh.
33
- */
34
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
35
- /**
36
- * Disposes a geometry from memory.
37
- *
38
- * @param geometry - the
39
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
- * to remove.
41
- */
42
- disposeGeometry(geometry: THREE.BufferGeometry): void;
43
- private disposeGeometryAndMaterials;
44
- private disposeChildren;
45
- private static disposeMaterial;
46
- }
47
2
  import { Component, Disposable, World, Event } from "../Types";
48
3
  import { SimpleRaycaster } from "./src";
49
4
  import { Components } from "../Components";
@@ -94,7 +49,7 @@ export declare class Components implements Disposable {
94
49
  /**
95
50
  * The version of the @thatopen/components library.
96
51
  */
97
- static readonly release = "2.1.14";
52
+ static readonly release = "2.1.15";
98
53
  /** {@link Disposable.onDisposed} */
99
54
  readonly onDisposed: Event<void>;
100
55
  /**
@@ -162,6 +117,108 @@ export declare class Components implements Disposable {
162
117
  private update;
163
118
  private static setupBVH;
164
119
  }
120
+ import * as THREE from "three";
121
+ import { Components } from "../Components";
122
+ import { Component } from "../Types";
123
+ /**
124
+ * 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).
125
+ */
126
+ export declare class Disposer extends Component {
127
+ private _disposedComponents;
128
+ /** {@link Component.enabled} */
129
+ enabled: boolean;
130
+ /**
131
+ * A unique identifier for the component.
132
+ * This UUID is used to register the component within the Components system.
133
+ */
134
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
135
+ constructor(components: Components);
136
+ /**
137
+ * Return the UUIDs of all disposed components.
138
+ */
139
+ get(): Set<string>;
140
+ /**
141
+ * Removes a mesh, its geometry and its materials from memory. If you are
142
+ * using any of these in other parts of the application, make sure that you
143
+ * remove them from the mesh before disposing it.
144
+ *
145
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
146
+ * to remove.
147
+ *
148
+ * @param materials - whether to dispose the materials of the mesh.
149
+ *
150
+ * @param recursive - whether to recursively dispose the children of the mesh.
151
+ */
152
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
153
+ /**
154
+ * Disposes a geometry from memory.
155
+ *
156
+ * @param geometry - the
157
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
158
+ * to remove.
159
+ */
160
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
161
+ private disposeGeometryAndMaterials;
162
+ private disposeChildren;
163
+ private static disposeMaterial;
164
+ }
165
+ import * as THREE from "three";
166
+ import { Components } from "../Components";
167
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
168
+ import { Component, Event, Disposable, World } from "../Types";
169
+ /**
170
+ * 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).
171
+ */
172
+ export declare class Cullers extends Component implements Disposable {
173
+ /**
174
+ * A unique identifier for the component.
175
+ * This UUID is used to register the component within the Components system.
176
+ */
177
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
178
+ /**
179
+ * An event that is triggered when the Cullers component is disposed.
180
+ */
181
+ readonly onDisposed: Event<unknown>;
182
+ private _enabled;
183
+ /**
184
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
185
+ */
186
+ list: Map<string, MeshCullerRenderer>;
187
+ /** {@link Component.enabled} */
188
+ get enabled(): boolean;
189
+ /** {@link Component.enabled} */
190
+ set enabled(value: boolean);
191
+ constructor(components: Components);
192
+ /**
193
+ * Creates a new MeshCullerRenderer for the given world.
194
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
195
+ *
196
+ * @param world - The world for which to create the MeshCullerRenderer.
197
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
198
+ *
199
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
200
+ */
201
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
202
+ /**
203
+ * Deletes the MeshCullerRenderer associated with the given world.
204
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
205
+ *
206
+ * @param world - The world for which to delete the MeshCullerRenderer.
207
+ *
208
+ * @returns {void}
209
+ */
210
+ delete(world: World): void;
211
+ /** {@link Disposable.dispose} */
212
+ dispose(): void;
213
+ /**
214
+ * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
215
+ *
216
+ * @param meshes - The meshes to update.
217
+ *
218
+ * @returns {void}
219
+ */
220
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
221
+ }
165
222
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
166
223
  import { Components } from "../Components";
167
224
  import { SimpleWorld } from "./src";
@@ -360,62 +417,52 @@ export declare class Clipper extends Component implements Createable, Disposable
360
417
  private _onStartDragging;
361
418
  private _onEndDragging;
362
419
  }
363
- import * as THREE from "three";
420
+ import { MiniMap } from "./src";
421
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
364
422
  import { Components } from "../Components";
365
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
366
- import { Component, Event, Disposable, World } from "../Types";
367
423
  /**
368
- * 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).
424
+ * 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).
369
425
  */
370
- export declare class Cullers extends Component implements Disposable {
426
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
371
427
  /**
372
428
  * A unique identifier for the component.
373
429
  * This UUID is used to register the component within the Components system.
374
430
  */
375
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
376
- /**
377
- * An event that is triggered when the Cullers component is disposed.
378
- */
431
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
432
+ /** {@link Updateable.onAfterUpdate} */
433
+ readonly onAfterUpdate: Event<unknown>;
434
+ /** {@link Updateable.onBeforeUpdate} */
435
+ readonly onBeforeUpdate: Event<unknown>;
436
+ /** {@link Disposable.onDisposed} */
379
437
  readonly onDisposed: Event<unknown>;
380
- private _enabled;
438
+ /** {@link Component.enabled} */
439
+ enabled: boolean;
381
440
  /**
382
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
441
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
383
442
  */
384
- list: Map<string, MeshCullerRenderer>;
385
- /** {@link Component.enabled} */
386
- get enabled(): boolean;
387
- /** {@link Component.enabled} */
388
- set enabled(value: boolean);
443
+ list: Map<string, MiniMap>;
389
444
  constructor(components: Components);
390
445
  /**
391
- * Creates a new MeshCullerRenderer for the given world.
392
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
393
- *
394
- * @param world - The world for which to create the MeshCullerRenderer.
395
- * @param config - Optional configuration settings for the MeshCullerRenderer.
446
+ * Creates a new {@link MiniMap} instance associated with the given world.
447
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
396
448
  *
397
- * @returns The newly created or existing MeshCullerRenderer for the given world.
449
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
450
+ * @returns The newly created {@link MiniMap} instance.
451
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
398
452
  */
399
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
453
+ create(world: World): MiniMap;
400
454
  /**
401
- * Deletes the MeshCullerRenderer associated with the given world.
402
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
403
- *
404
- * @param world - The world for which to delete the MeshCullerRenderer.
455
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
456
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
405
457
  *
458
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
406
459
  * @returns {void}
407
460
  */
408
- delete(world: World): void;
461
+ delete(id: string): void;
409
462
  /** {@link Disposable.dispose} */
410
463
  dispose(): void;
411
- /**
412
- * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
413
- *
414
- * @param meshes - The meshes to update.
415
- *
416
- * @returns {void}
417
- */
418
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
464
+ /** {@link Updateable.update} */
465
+ update(): void;
419
466
  }
420
467
  import { Component, Disposable, World, Event } from "../Types";
421
468
  import { GridConfig, SimpleGrid } from "./src";
@@ -466,6 +513,31 @@ export declare class Grids extends Component implements Disposable {
466
513
  /** {@link Disposable.dispose} */
467
514
  dispose(): void;
468
515
  }
516
+ import * as WEBIFC from "web-ifc";
517
+ import * as FRAG from "@thatopen/fragments";
518
+ import { Component, Components } from "../../core";
519
+ /**
520
+ * 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).
521
+ */
522
+ export declare class IfcJsonExporter extends Component {
523
+ /**
524
+ * A unique identifier for the component.
525
+ * This UUID is used to register the component within the Components system.
526
+ */
527
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
528
+ /** {@link Component.enabled} */
529
+ enabled: boolean;
530
+ constructor(components: Components);
531
+ /**
532
+ * Exports all the properties of an IFC into an array of JS objects.
533
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
534
+ * @param modelID ID of the IFC model whose properties to extract.
535
+ * @param indirect whether to get the indirect relationships as well.
536
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
537
+ * to make the location data available (e.g. absolute position of building).
538
+ */
539
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
540
+ }
469
541
  import * as THREE from "three";
470
542
  import { Components } from "../Components";
471
543
  import { SimpleCamera } from "..";
@@ -530,52 +602,139 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
530
602
  private newOrthoCamera;
531
603
  private setOrthoPerspCameraAspect;
532
604
  }
533
- import { MiniMap } from "./src";
534
- import { Component, Updateable, World, Event, Disposable } from "../Types";
535
- import { Components } from "../Components";
605
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
606
+ import * as THREE from "three";
607
+ export declare class MaterialsUtils {
608
+ static isTransparent(material: THREE.Material): boolean;
609
+ }
610
+ import * as THREE from "three";
611
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
612
+ center: THREE.Vector3;
613
+ halfSizes: THREE.Vector3;
614
+ rotation: THREE.Matrix3;
615
+ transformation: THREE.Matrix4;
616
+ };
617
+ import * as THREE from "three";
618
+ import { Component, Components, Disposable, Event, World } from "../core";
536
619
  /**
537
- * 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).
620
+ * Configuration interface for the VertexPicker component.
538
621
  */
539
- export declare class MiniMaps extends Component implements Updateable, Disposable {
622
+ export interface VertexPickerConfig {
540
623
  /**
541
- * A unique identifier for the component.
542
- * This UUID is used to register the component within the Components system.
624
+ * If true, only vertices will be picked, not the closest point on the face.
543
625
  */
544
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
545
- /** {@link Updateable.onAfterUpdate} */
546
- readonly onAfterUpdate: Event<unknown>;
547
- /** {@link Updateable.onBeforeUpdate} */
548
- readonly onBeforeUpdate: Event<unknown>;
626
+ showOnlyVertex: boolean;
627
+ /**
628
+ * The maximum distance for snapping to a vertex.
629
+ */
630
+ snapDistance: number;
631
+ /**
632
+ * The HTML element to use for previewing the picked vertex.
633
+ */
634
+ previewElement: HTMLElement;
635
+ }
636
+ /**
637
+ * A class that provides functionality for picking vertices in a 3D scene.
638
+ */
639
+ export declare class VertexPicker extends Component implements Disposable {
549
640
  /** {@link Disposable.onDisposed} */
550
641
  readonly onDisposed: Event<unknown>;
551
- /** {@link Component.enabled} */
552
- enabled: boolean;
553
642
  /**
554
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
643
+ * An event that is triggered when a vertex is found.
644
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
555
645
  */
556
- list: Map<string, MiniMap>;
557
- constructor(components: Components);
646
+ readonly onVertexFound: Event<THREE.Vector3>;
558
647
  /**
559
- * Creates a new {@link MiniMap} instance associated with the given world.
560
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
648
+ * An event that is triggered when a vertex is lost.
649
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
650
+ */
651
+ readonly onVertexLost: Event<THREE.Vector3>;
652
+ /**
653
+ * An event that is triggered when the picker is enabled or disabled
654
+ */
655
+ readonly onEnabled: Event<boolean>;
656
+ /**
657
+ * A reference to the Components instance associated with this VertexPicker.
658
+ */
659
+ components: Components;
660
+ /**
661
+ * A reference to the working plane used for vertex picking.
662
+ * This plane is used to determine which vertices are considered valid for picking.
663
+ * If this value is null, all vertices are considered valid.
664
+ */
665
+ workingPlane: THREE.Plane | null;
666
+ private _pickedPoint;
667
+ private _config;
668
+ private _enabled;
669
+ /**
670
+ * Sets the enabled state of the VertexPicker.
671
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
672
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
561
673
  *
562
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
563
- * @returns The newly created {@link MiniMap} instance.
564
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
674
+ * @param value - The new enabled state.
565
675
  */
566
- create(world: World): MiniMap;
676
+ set enabled(value: boolean);
567
677
  /**
568
- * Deletes a {@link MiniMap} instance associated with the given world ID.
569
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
678
+ * Gets the current enabled state of the VertexPicker.
570
679
  *
571
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
572
- * @returns {void}
680
+ * @returns The current enabled state.
573
681
  */
574
- delete(id: string): void;
682
+ get enabled(): boolean;
683
+ /**
684
+ * Sets the configuration for the VertexPicker component.
685
+ *
686
+ * @param value - A Partial object containing the configuration properties to update.
687
+ * The properties not provided in the value object will retain their current values.
688
+ *
689
+ * @example
690
+ * '''typescript
691
+ * vertexPicker.config = {
692
+ * snapDistance: 0.5,
693
+ * showOnlyVertex: true,
694
+ * };
695
+ * '''
696
+ */
697
+ set config(value: Partial<VertexPickerConfig>);
698
+ /**
699
+ * Gets the current configuration for the VertexPicker component.
700
+ *
701
+ * @returns A copy of the current VertexPickerConfig object.
702
+ *
703
+ * @example
704
+ * '''typescript
705
+ * const currentConfig = vertexPicker.config;
706
+ * console.log(currentConfig.snapDistance); // Output: 0.25
707
+ * '''
708
+ */
709
+ get config(): Partial<VertexPickerConfig>;
710
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
575
711
  /** {@link Disposable.dispose} */
576
712
  dispose(): void;
577
- /** {@link Updateable.update} */
578
- update(): void;
713
+ /**
714
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
715
+ *
716
+ * @param world - The World instance to use for raycasting.
717
+ *
718
+ * @returns The current picked point, or null if no point is picked.
719
+ *
720
+ * @remarks
721
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
722
+ * If enabled, it performs raycasting to find the closest intersecting object.
723
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
724
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
725
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
726
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
727
+ */
728
+ get(world: World): THREE.Vector3 | null;
729
+ private getClosestVertex;
730
+ private getVertices;
731
+ private getVertex;
732
+ }
733
+ export declare class UUID {
734
+ private static _pattern;
735
+ private static _lut;
736
+ static create(): string;
737
+ static validate(uuid: string): void;
579
738
  }
580
739
  import * as WEBIFC from "web-ifc";
581
740
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -741,163 +900,262 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
741
900
  getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
742
901
  }
743
902
  import * as THREE from "three";
744
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
745
- center: THREE.Vector3;
746
- halfSizes: THREE.Vector3;
747
- rotation: THREE.Matrix3;
748
- transformation: THREE.Matrix4;
749
- };
750
- import * as THREE from "three";
751
- export declare class MaterialsUtils {
752
- static isTransparent(material: THREE.Material): boolean;
753
- }
754
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
755
- import * as THREE from "three";
756
- import { Component, Components, Disposable, Event, World } from "../core";
757
- /**
758
- * Configuration interface for the VertexPicker component.
759
- */
760
- export interface VertexPickerConfig {
761
- /**
762
- * If true, only vertices will be picked, not the closest point on the face.
763
- */
764
- showOnlyVertex: boolean;
765
- /**
766
- * The maximum distance for snapping to a vertex.
767
- */
768
- snapDistance: number;
769
- /**
770
- * The HTML element to use for previewing the picked vertex.
771
- */
772
- previewElement: HTMLElement;
773
- }
903
+ import * as FRAGS from "@thatopen/fragments";
904
+ import { FragmentsGroup } from "@thatopen/fragments";
905
+ import { Component, Components, Disposable, Event } from "../../core";
774
906
  /**
775
- * A class that provides functionality for picking vertices in a 3D scene.
907
+ * 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).
776
908
  */
777
- export declare class VertexPicker extends Component implements Disposable {
909
+ export declare class BoundingBoxer extends Component implements Disposable {
910
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
911
+ /** {@link Component.enabled} */
912
+ enabled: boolean;
778
913
  /** {@link Disposable.onDisposed} */
779
914
  readonly onDisposed: Event<unknown>;
915
+ private _absoluteMin;
916
+ private _absoluteMax;
917
+ private _meshes;
918
+ constructor(components: Components);
780
919
  /**
781
- * An event that is triggered when a vertex is found.
782
- * The event passes a THREE.Vector3 representing the position of the found vertex.
783
- */
784
- readonly onVertexFound: Event<THREE.Vector3>;
785
- /**
786
- * An event that is triggered when a vertex is lost.
787
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
788
- */
789
- readonly onVertexLost: Event<THREE.Vector3>;
790
- /**
791
- * An event that is triggered when the picker is enabled or disabled
792
- */
793
- readonly onEnabled: Event<boolean>;
794
- /**
795
- * A reference to the Components instance associated with this VertexPicker.
796
- */
797
- components: Components;
798
- /**
799
- * A reference to the working plane used for vertex picking.
800
- * This plane is used to determine which vertices are considered valid for picking.
801
- * If this value is null, all vertices are considered valid.
802
- */
803
- workingPlane: THREE.Plane | null;
804
- private _pickedPoint;
805
- private _config;
806
- private _enabled;
807
- /**
808
- * Sets the enabled state of the VertexPicker.
809
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
810
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
920
+ * A static method to calculate the dimensions of a given bounding box.
811
921
  *
812
- * @param value - The new enabled state.
922
+ * @param bbox - The bounding box to calculate the dimensions for.
923
+ * @returns An object containing the width, height, depth, and center of the bounding box.
813
924
  */
814
- set enabled(value: boolean);
925
+ static getDimensions(bbox: THREE.Box3): {
926
+ width: number;
927
+ height: number;
928
+ depth: number;
929
+ center: THREE.Vector3;
930
+ };
815
931
  /**
816
- * Gets the current enabled state of the VertexPicker.
932
+ * A static method to create a new bounding box boundary.
817
933
  *
818
- * @returns The current enabled state.
819
- */
820
- get enabled(): boolean;
821
- /**
822
- * Sets the configuration for the VertexPicker component.
934
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
935
+ * @returns A new THREE.Vector3 representing the boundary.
823
936
  *
824
- * @param value - A Partial object containing the configuration properties to update.
825
- * The properties not provided in the value object will retain their current values.
937
+ * @remarks
938
+ * This method is used to create a new boundary for calculating bounding boxes.
939
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
940
+ * depending on the value of the 'positive' parameter.
826
941
  *
827
942
  * @example
828
943
  * '''typescript
829
- * vertexPicker.config = {
830
- * snapDistance: 0.5,
831
- * showOnlyVertex: true,
832
- * };
944
+ * const positiveBound = BoundingBoxer.newBound(true);
945
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
946
+ *
947
+ * const negativeBound = BoundingBoxer.newBound(false);
948
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
833
949
  * '''
834
950
  */
835
- set config(value: Partial<VertexPickerConfig>);
951
+ static newBound(positive: boolean): THREE.Vector3;
836
952
  /**
837
- * Gets the current configuration for the VertexPicker component.
953
+ * A static method to calculate the bounding box of a set of points.
838
954
  *
839
- * @returns A copy of the current VertexPickerConfig object.
955
+ * @param points - An array of THREE.Vector3 representing the points.
956
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
957
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
958
+ * @returns A THREE.Box3 representing the bounding box of the given points.
959
+ *
960
+ * @remarks
961
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
962
+ * 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.
840
963
  *
841
964
  * @example
842
965
  * '''typescript
843
- * const currentConfig = vertexPicker.config;
844
- * console.log(currentConfig.snapDistance); // Output: 0.25
845
- * '''
846
- */
847
- get config(): Partial<VertexPickerConfig>;
848
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
849
- /** {@link Disposable.dispose} */
850
- dispose(): void;
851
- /**
852
- * Performs the vertex picking operation based on the current state of the VertexPicker.
966
+ * const points = [
967
+ * new THREE.Vector3(1, 2, 3),
968
+ * new THREE.Vector3(4, 5, 6),
969
+ * new THREE.Vector3(7, 8, 9),
970
+ * ];
853
971
  *
854
- * @param world - The World instance to use for raycasting.
972
+ * const bbox = BoundingBoxer.getBounds(points);
973
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
974
+ * '''
975
+ */
976
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
977
+ /** {@link Disposable.dispose} */
978
+ dispose(): void;
979
+ /**
980
+ * Returns the bounding box of the calculated fragments.
855
981
  *
856
- * @returns The current picked point, or null if no point is picked.
982
+ * @returns A new THREE.Box3 instance representing the bounding box.
857
983
  *
858
984
  * @remarks
859
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
860
- * If enabled, it performs raycasting to find the closest intersecting object.
861
- * It then determines the closest vertex or point on the face, based on the configuration settings.
862
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
863
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
864
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
985
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
986
+ * The returned box represents the bounding box of the calculated fragments.
987
+ *
988
+ * @example
989
+ * '''typescript
990
+ * const boundingBox = boundingBoxer.get();
991
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
992
+ * '''
865
993
  */
866
- get(world: World): THREE.Vector3 | null;
867
- private getClosestVertex;
868
- private getVertices;
869
- private getVertex;
870
- }
871
- export declare class UUID {
872
- private static _pattern;
873
- private static _lut;
874
- static create(): string;
875
- static validate(uuid: string): void;
994
+ get(): THREE.Box3;
995
+ /**
996
+ * Calculates and returns a sphere that encompasses the entire bounding box.
997
+ *
998
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
999
+ *
1000
+ * @remarks
1001
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
1002
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
1003
+ * The radius is calculated as the distance from the center to the minimum bound.
1004
+ *
1005
+ * @example
1006
+ * '''typescript
1007
+ * const boundingBoxer = components.get(BoundingBoxer);
1008
+ * boundingBoxer.add(fragmentsGroup);
1009
+ * const boundingSphere = boundingBoxer.getSphere();
1010
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
1011
+ * '''
1012
+ */
1013
+ getSphere(): THREE.Sphere;
1014
+ /**
1015
+ * Returns a THREE.Mesh instance representing the bounding box.
1016
+ *
1017
+ * @returns A new THREE.Mesh instance representing the bounding box.
1018
+ *
1019
+ * @remarks
1020
+ * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
1021
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
1022
+ * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
1023
+ * The position of the mesh is set to the center of the bounding box.
1024
+ *
1025
+ * @example
1026
+ * '''typescript
1027
+ * const boundingBoxer = components.get(BoundingBoxer);
1028
+ * boundingBoxer.add(fragmentsGroup);
1029
+ * const boundingBoxMesh = boundingBoxer.getMesh();
1030
+ * scene.add(boundingBoxMesh);
1031
+ * '''
1032
+ */
1033
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1034
+ /**
1035
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
1036
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
1037
+ *
1038
+ * @remarks
1039
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
1040
+ * It ensures that the bounding box calculations are accurate and up-to-date.
1041
+ *
1042
+ * @example
1043
+ * '''typescript
1044
+ * const boundingBoxer = components.get(BoundingBoxer);
1045
+ * boundingBoxer.add(fragmentsGroup);
1046
+ * // ...
1047
+ * boundingBoxer.reset();
1048
+ * '''
1049
+ */
1050
+ reset(): void;
1051
+ /**
1052
+ * Adds a FragmentsGroup to the BoundingBoxer.
1053
+ *
1054
+ * @param group - The FragmentsGroup to add.
1055
+ *
1056
+ * @remarks
1057
+ * This method iterates through each fragment in the provided FragmentsGroup,
1058
+ * and calls the 'addMesh' method for each fragment's mesh.
1059
+ *
1060
+ * @example
1061
+ * '''typescript
1062
+ * const boundingBoxer = components.get(BoundingBoxer);
1063
+ * boundingBoxer.add(fragmentsGroup);
1064
+ * '''
1065
+ */
1066
+ add(group: FragmentsGroup): void;
1067
+ /**
1068
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1069
+ *
1070
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1071
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
1072
+ *
1073
+ * @remarks
1074
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1075
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1076
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1077
+ *
1078
+ * @example
1079
+ * '''typescript
1080
+ * const boundingBoxer = components.get(BoundingBoxer);
1081
+ * boundingBoxer.addMesh(mesh);
1082
+ * '''
1083
+ */
1084
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1085
+ /**
1086
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
1087
+ *
1088
+ * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1089
+ * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
1090
+ *
1091
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
1092
+ *
1093
+ * @remarks
1094
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1095
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
1096
+ *
1097
+ * @example
1098
+ * '''typescript
1099
+ * const boundingBoxer = components.get(BoundingBoxer);
1100
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
1101
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1102
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1103
+ * };
1104
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1105
+ * '''
1106
+ */
1107
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1108
+ private static getFragmentBounds;
876
1109
  }
877
- import * as WEBIFC from "web-ifc";
878
- import * as FRAG from "@thatopen/fragments";
879
- import { Component, Components } from "../../core";
1110
+ import { Component, Disposable, Event, Components } from "../../core";
880
1111
  /**
881
- * 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).
1112
+ * 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).
882
1113
  */
883
- export declare class IfcJsonExporter extends Component {
1114
+ export declare class Exploder extends Component implements Disposable {
884
1115
  /**
885
1116
  * A unique identifier for the component.
886
1117
  * This UUID is used to register the component within the Components system.
887
1118
  */
888
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1119
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1120
+ /** {@link Disposable.onDisposed} */
1121
+ readonly onDisposed: Event<unknown>;
889
1122
  /** {@link Component.enabled} */
890
1123
  enabled: boolean;
1124
+ /**
1125
+ * The height of the explosion animation.
1126
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1127
+ * Default value is 10.
1128
+ */
1129
+ height: number;
1130
+ /**
1131
+ * The group name used for the explosion animation.
1132
+ * This property specifies the group of fragments that will be affected by the explosion.
1133
+ * Default value is "storeys".
1134
+ */
1135
+ groupName: string;
1136
+ /**
1137
+ * A set of strings representing the exploded items.
1138
+ * This set is used to keep track of which items have been exploded.
1139
+ */
1140
+ list: Set<string>;
891
1141
  constructor(components: Components);
1142
+ /** {@link Disposable.dispose} */
1143
+ dispose(): void;
892
1144
  /**
893
- * Exports all the properties of an IFC into an array of JS objects.
894
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
895
- * @param modelID ID of the IFC model whose properties to extract.
896
- * @param indirect whether to get the indirect relationships as well.
897
- * @param recursiveSpatial whether to get the properties of spatial items recursively
898
- * to make the location data available (e.g. absolute position of building).
1145
+ * Sets the explosion state of the fragments.
1146
+ *
1147
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1148
+ *
1149
+ * @remarks
1150
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1151
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1152
+ * If 'active' is false, the fragments are moved back to their original position.
1153
+ *
1154
+ * The method also keeps track of the exploded items using the 'list' set.
1155
+ *
1156
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
899
1157
  */
900
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1158
+ set(active: boolean): void;
901
1159
  }
902
1160
  import * as WEBIFC from "web-ifc";
903
1161
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1157,211 +1415,215 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1157
1415
  }
1158
1416
  import * as THREE from "three";
1159
1417
  import * as FRAGS from "@thatopen/fragments";
1160
- import { FragmentsGroup } from "@thatopen/fragments";
1161
- import { Component, Components, Disposable, Event } from "../../core";
1418
+ import { Disposable, Component, Event, Components } from "../../core";
1162
1419
  /**
1163
- * 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).
1420
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
1164
1421
  */
1165
- export declare class BoundingBoxer extends Component implements Disposable {
1166
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
1422
+ export interface Classification {
1423
+ /**
1424
+ * A system within the classification.
1425
+ * The key is the system name, and the value is an object representing the classes within the system.
1426
+ */
1427
+ [system: string]: {
1428
+ /**
1429
+ * A class within the system.
1430
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1431
+ */
1432
+ [className: string]: {
1433
+ map: FRAGS.FragmentIdMap;
1434
+ name: string;
1435
+ id: number | null;
1436
+ };
1437
+ };
1438
+ }
1439
+ /**
1440
+ * 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).
1441
+ */
1442
+ export declare class Classifier extends Component implements Disposable {
1443
+ /**
1444
+ * A unique identifier for the component.
1445
+ * This UUID is used to register the component within the Components system.
1446
+ */
1447
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1167
1448
  /** {@link Component.enabled} */
1168
1449
  enabled: boolean;
1450
+ /**
1451
+ * A map representing the classification systems.
1452
+ * The key is the system name, and the value is an object representing the classes within the system.
1453
+ */
1454
+ list: Classification;
1169
1455
  /** {@link Disposable.onDisposed} */
1170
1456
  readonly onDisposed: Event<unknown>;
1171
- private _absoluteMin;
1172
- private _absoluteMax;
1173
- private _meshes;
1174
1457
  constructor(components: Components);
1458
+ private onFragmentsDisposed;
1459
+ /** {@link Disposable.dispose} */
1460
+ dispose(): void;
1175
1461
  /**
1176
- * A static method to calculate the dimensions of a given bounding box.
1462
+ * Removes a fragment from the classification based on its unique identifier (guid).
1463
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1177
1464
  *
1178
- * @param bbox - The bounding box to calculate the dimensions for.
1179
- * @returns An object containing the width, height, depth, and center of the bounding box.
1465
+ * @param guid - The unique identifier of the fragment to be removed.
1180
1466
  */
1181
- static getDimensions(bbox: THREE.Box3): {
1182
- width: number;
1183
- height: number;
1184
- depth: number;
1185
- center: THREE.Vector3;
1186
- };
1467
+ remove(guid: string): void;
1187
1468
  /**
1188
- * A static method to create a new bounding box boundary.
1189
- *
1190
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
1191
- * @returns A new THREE.Vector3 representing the boundary.
1469
+ * Finds and returns fragments based on the provided filter criteria.
1470
+ * If no filter is provided, it returns all fragments.
1192
1471
  *
1193
- * @remarks
1194
- * This method is used to create a new boundary for calculating bounding boxes.
1195
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
1196
- * depending on the value of the 'positive' parameter.
1472
+ * @param filter - An optional object containing filter criteria.
1473
+ * The keys of the object represent the classification system names,
1474
+ * and the values are arrays of class names to match.
1197
1475
  *
1198
- * @example
1199
- * '''typescript
1200
- * const positiveBound = BoundingBoxer.newBound(true);
1201
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
1476
+ * @returns A map of fragment GUIDs to their respective express IDs,
1477
+ * where the express IDs are filtered based on the provided filter criteria.
1202
1478
  *
1203
- * const negativeBound = BoundingBoxer.newBound(false);
1204
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
1205
- * '''
1479
+ * @throws Will throw an error if the fragments map is malformed.
1206
1480
  */
1207
- static newBound(positive: boolean): THREE.Vector3;
1481
+ find(filter?: {
1482
+ [name: string]: string[];
1483
+ }): FRAGS.FragmentIdMap;
1208
1484
  /**
1209
- * A static method to calculate the bounding box of a set of points.
1485
+ * Classifies fragments based on their modelID.
1210
1486
  *
1211
- * @param points - An array of THREE.Vector3 representing the points.
1212
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
1213
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
1214
- * @returns A THREE.Box3 representing the bounding box of the given points.
1487
+ * @param modelID - The unique identifier of the model to classify fragments by.
1488
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1215
1489
  *
1216
1490
  * @remarks
1217
- * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
1218
- * 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.
1219
- *
1220
- * @example
1221
- * '''typescript
1222
- * const points = [
1223
- * new THREE.Vector3(1, 2, 3),
1224
- * new THREE.Vector3(4, 5, 6),
1225
- * new THREE.Vector3(7, 8, 9),
1226
- * ];
1491
+ * This method iterates through the fragments in the provided group,
1492
+ * and classifies them based on their modelID.
1493
+ * The classification is stored in the 'list.models' property,
1494
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1227
1495
  *
1228
- * const bbox = BoundingBoxer.getBounds(points);
1229
- * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
1230
- * '''
1231
1496
  */
1232
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
1233
- /** {@link Disposable.dispose} */
1234
- dispose(): void;
1497
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1235
1498
  /**
1236
- * Returns the bounding box of the calculated fragments.
1499
+ * Classifies fragments based on their PredefinedType property.
1237
1500
  *
1238
- * @returns A new THREE.Box3 instance representing the bounding box.
1501
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1239
1502
  *
1240
1503
  * @remarks
1241
- * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
1242
- * The returned box represents the bounding box of the calculated fragments.
1504
+ * This method iterates through the properties of the fragments in the provided group,
1505
+ * and classifies them based on their PredefinedType property.
1506
+ * The classification is stored in the 'list.predefinedTypes' property,
1507
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1243
1508
  *
1244
- * @example
1245
- * '''typescript
1246
- * const boundingBox = boundingBoxer.get();
1247
- * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
1248
- * '''
1509
+ * @throws Will throw an error if the fragment ID is not found.
1249
1510
  */
1250
- get(): THREE.Box3;
1511
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1251
1512
  /**
1252
- * Calculates and returns a sphere that encompasses the entire bounding box.
1513
+ * Classifies fragments based on their entity type.
1253
1514
  *
1254
- * @returns A new THREE.Sphere instance representing the calculated sphere.
1515
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1255
1516
  *
1256
1517
  * @remarks
1257
- * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
1258
- * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
1259
- * The radius is calculated as the distance from the center to the minimum bound.
1518
+ * This method iterates through the relations of the fragments in the provided group,
1519
+ * and classifies them based on their entity type.
1520
+ * The classification is stored in the 'list.entities' property,
1521
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1260
1522
  *
1261
- * @example
1262
- * '''typescript
1263
- * const boundingBoxer = components.get(BoundingBoxer);
1264
- * boundingBoxer.add(fragmentsGroup);
1265
- * const boundingSphere = boundingBoxer.getSphere();
1266
- * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
1267
- * '''
1523
+ * @throws Will throw an error if the fragment ID is not found.
1268
1524
  */
1269
- getSphere(): THREE.Sphere;
1525
+ byEntity(group: FRAGS.FragmentsGroup): void;
1270
1526
  /**
1271
- * Returns a THREE.Mesh instance representing the bounding box.
1527
+ * Classifies fragments based on a specific IFC relationship.
1272
1528
  *
1273
- * @returns A new THREE.Mesh instance representing the bounding box.
1529
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1530
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1531
+ * @param systemName - The name of the classification system to store the classification.
1274
1532
  *
1275
1533
  * @remarks
1276
- * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
1277
- * It then creates a new THREE.BoxGeometry with the calculated dimensions.
1278
- * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
1279
- * The position of the mesh is set to the center of the bounding box.
1534
+ * This method iterates through the relations of the fragments in the provided group,
1535
+ * and classifies them based on the specified IFC relationship.
1536
+ * The classification is stored in the 'list' property under the specified system name,
1537
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1280
1538
  *
1281
- * @example
1282
- * '''typescript
1283
- * const boundingBoxer = components.get(BoundingBoxer);
1284
- * boundingBoxer.add(fragmentsGroup);
1285
- * const boundingBoxMesh = boundingBoxer.getMesh();
1286
- * scene.add(boundingBoxMesh);
1287
- * '''
1539
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1288
1540
  */
1289
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1541
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1290
1542
  /**
1291
- * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
1292
- * This method is used to prepare the BoundingBoxer for a new set of fragments.
1543
+ * Classifies fragments based on their spatial structure in the IFC model.
1544
+ *
1545
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1546
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1547
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1548
+ * the classifier just pick the WEBIFC categories provided.
1293
1549
  *
1294
1550
  * @remarks
1295
- * This method is called when a new set of fragments is added to the BoundingBoxer.
1296
- * It ensures that the bounding box calculations are accurate and up-to-date.
1551
+ * This method iterates through the relations of the fragments in the provided group,
1552
+ * and classifies them based on their spatial structure in the IFC model.
1553
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1554
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1297
1555
  *
1298
- * @example
1299
- * '''typescript
1300
- * const boundingBoxer = components.get(BoundingBoxer);
1301
- * boundingBoxer.add(fragmentsGroup);
1302
- * // ...
1303
- * boundingBoxer.reset();
1304
- * '''
1556
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1305
1557
  */
1306
- reset(): void;
1558
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1559
+ useProperties?: boolean;
1560
+ isolate?: Set<number>;
1561
+ }): Promise<void>;
1307
1562
  /**
1308
- * Adds a FragmentsGroup to the BoundingBoxer.
1563
+ * Sets the color of the specified fragments.
1309
1564
  *
1310
- * @param group - The FragmentsGroup to add.
1565
+ * @param items - A map of fragment IDs to their respective express IDs.
1566
+ * @param color - The color to set for the fragments.
1567
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1311
1568
  *
1312
1569
  * @remarks
1313
- * This method iterates through each fragment in the provided FragmentsGroup,
1314
- * and calls the 'addMesh' method for each fragment's mesh.
1570
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1571
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1315
1572
  *
1316
- * @example
1317
- * '''typescript
1318
- * const boundingBoxer = components.get(BoundingBoxer);
1319
- * boundingBoxer.add(fragmentsGroup);
1320
- * '''
1573
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1321
1574
  */
1322
- add(group: FragmentsGroup): void;
1575
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1323
1576
  /**
1324
- * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1577
+ * Resets the color of the specified fragments to their original color.
1325
1578
  *
1326
- * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1327
- * @param itemIDs - An optional iterable of numbers representing the item IDs.
1579
+ * @param items - A map of fragment IDs to their respective express IDs.
1328
1580
  *
1329
1581
  * @remarks
1330
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1331
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1332
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1582
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1583
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1333
1584
  *
1334
- * @example
1335
- * '''typescript
1336
- * const boundingBoxer = components.get(BoundingBoxer);
1337
- * boundingBoxer.addMesh(mesh);
1338
- * '''
1585
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1339
1586
  */
1340
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1587
+ resetColor(items: FRAGS.FragmentIdMap): void;
1588
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1589
+ }
1590
+ import * as FRAGS from "@thatopen/fragments";
1591
+ import { Components, Component } from "../../core";
1592
+ /**
1593
+ * 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).
1594
+ */
1595
+ export declare class Hider extends Component {
1341
1596
  /**
1342
- * Uses a FragmentIdMap to add its meshes to the bb calculation.
1597
+ * A unique identifier for the component.
1598
+ * This UUID is used to register the component within the Components system.
1599
+ */
1600
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1601
+ /** {@link Component.enabled} */
1602
+ enabled: boolean;
1603
+ constructor(components: Components);
1604
+ /**
1605
+ * Sets the visibility of fragments within the 3D scene.
1606
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1607
+ * If 'items' is provided, only the specified fragments will be affected.
1343
1608
  *
1344
- * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1345
- * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
1609
+ * @param visible - The visibility state to set for the fragments.
1610
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1611
+ * If not provided, all fragments will be affected.
1346
1612
  *
1347
- * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
1613
+ * @returns {void}
1614
+ */
1615
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1616
+ /**
1617
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1618
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1348
1619
  *
1349
- * @remarks
1350
- * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1351
- * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
1620
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1621
+ * If not provided, all fragments will be isolated.
1352
1622
  *
1353
- * @example
1354
- * '''typescript
1355
- * const boundingBoxer = components.get(BoundingBoxer);
1356
- * const fragmentIdMap: FRAGS.FragmentIdMap = {
1357
- * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1358
- * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1359
- * };
1360
- * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1361
- * '''
1623
+ * @returns {void}
1362
1624
  */
1363
- addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1364
- private static getFragmentBounds;
1625
+ isolate(items: FRAGS.FragmentIdMap): void;
1626
+ private updateCulledVisibility;
1365
1627
  }
1366
1628
  import * as THREE from "three";
1367
1629
  import * as FRAGS from "@thatopen/fragments";
@@ -1468,191 +1730,17 @@ export declare class MeasurementUtils extends Component {
1468
1730
  private getVolumeOfMesh;
1469
1731
  private getSignedVolumeOfTriangle;
1470
1732
  }
1471
- import * as THREE from "three";
1733
+ import * as WEBIFC from "web-ifc";
1472
1734
  import * as FRAGS from "@thatopen/fragments";
1473
- import { Disposable, Component, Event, Components } from "../../core";
1735
+ import { IfcFragmentSettings } from "./src";
1736
+ import { Component, Components, Event, Disposable } from "../../core";
1474
1737
  /**
1475
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
1738
+ * 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).
1476
1739
  */
1477
- export interface Classification {
1740
+ export declare class IfcLoader extends Component implements Disposable {
1478
1741
  /**
1479
- * A system within the classification.
1480
- * The key is the system name, and the value is an object representing the classes within the system.
1481
- */
1482
- [system: string]: {
1483
- /**
1484
- * A class within the system.
1485
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1486
- */
1487
- [className: string]: {
1488
- map: FRAGS.FragmentIdMap;
1489
- name: string;
1490
- id: number | null;
1491
- };
1492
- };
1493
- }
1494
- /**
1495
- * 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).
1496
- */
1497
- export declare class Classifier extends Component implements Disposable {
1498
- /**
1499
- * A unique identifier for the component.
1500
- * This UUID is used to register the component within the Components system.
1501
- */
1502
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1503
- /** {@link Component.enabled} */
1504
- enabled: boolean;
1505
- /**
1506
- * A map representing the classification systems.
1507
- * The key is the system name, and the value is an object representing the classes within the system.
1508
- */
1509
- list: Classification;
1510
- /** {@link Disposable.onDisposed} */
1511
- readonly onDisposed: Event<unknown>;
1512
- constructor(components: Components);
1513
- private onFragmentsDisposed;
1514
- /** {@link Disposable.dispose} */
1515
- dispose(): void;
1516
- /**
1517
- * Removes a fragment from the classification based on its unique identifier (guid).
1518
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1519
- *
1520
- * @param guid - The unique identifier of the fragment to be removed.
1521
- */
1522
- remove(guid: string): void;
1523
- /**
1524
- * Finds and returns fragments based on the provided filter criteria.
1525
- * If no filter is provided, it returns all fragments.
1526
- *
1527
- * @param filter - An optional object containing filter criteria.
1528
- * The keys of the object represent the classification system names,
1529
- * and the values are arrays of class names to match.
1530
- *
1531
- * @returns A map of fragment GUIDs to their respective express IDs,
1532
- * where the express IDs are filtered based on the provided filter criteria.
1533
- *
1534
- * @throws Will throw an error if the fragments map is malformed.
1535
- */
1536
- find(filter?: {
1537
- [name: string]: string[];
1538
- }): FRAGS.FragmentIdMap;
1539
- /**
1540
- * Classifies fragments based on their modelID.
1541
- *
1542
- * @param modelID - The unique identifier of the model to classify fragments by.
1543
- * @param group - The FragmentsGroup containing the fragments to be classified.
1544
- *
1545
- * @remarks
1546
- * This method iterates through the fragments in the provided group,
1547
- * and classifies them based on their modelID.
1548
- * The classification is stored in the 'list.models' property,
1549
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1550
- *
1551
- */
1552
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1553
- /**
1554
- * Classifies fragments based on their PredefinedType property.
1555
- *
1556
- * @param group - The FragmentsGroup containing the fragments to be classified.
1557
- *
1558
- * @remarks
1559
- * This method iterates through the properties of the fragments in the provided group,
1560
- * and classifies them based on their PredefinedType property.
1561
- * The classification is stored in the 'list.predefinedTypes' property,
1562
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1563
- *
1564
- * @throws Will throw an error if the fragment ID is not found.
1565
- */
1566
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1567
- /**
1568
- * Classifies fragments based on their entity type.
1569
- *
1570
- * @param group - The FragmentsGroup containing the fragments to be classified.
1571
- *
1572
- * @remarks
1573
- * This method iterates through the relations of the fragments in the provided group,
1574
- * and classifies them based on their entity type.
1575
- * The classification is stored in the 'list.entities' property,
1576
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1577
- *
1578
- * @throws Will throw an error if the fragment ID is not found.
1579
- */
1580
- byEntity(group: FRAGS.FragmentsGroup): void;
1581
- /**
1582
- * Classifies fragments based on a specific IFC relationship.
1583
- *
1584
- * @param group - The FragmentsGroup containing the fragments to be classified.
1585
- * @param ifcRel - The IFC relationship number to classify fragments by.
1586
- * @param systemName - The name of the classification system to store the classification.
1587
- *
1588
- * @remarks
1589
- * This method iterates through the relations of the fragments in the provided group,
1590
- * and classifies them based on the specified IFC relationship.
1591
- * The classification is stored in the 'list' property under the specified system name,
1592
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1593
- *
1594
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1595
- */
1596
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1597
- /**
1598
- * Classifies fragments based on their spatial structure in the IFC model.
1599
- *
1600
- * @param model - The FragmentsGroup containing the fragments to be classified.
1601
- * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1602
- * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1603
- * the classifier just pick the WEBIFC categories provided.
1604
- *
1605
- * @remarks
1606
- * This method iterates through the relations of the fragments in the provided group,
1607
- * and classifies them based on their spatial structure in the IFC model.
1608
- * The classification is stored in the 'list' property under the system name "spatialStructures",
1609
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1610
- *
1611
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1612
- */
1613
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1614
- useProperties?: boolean;
1615
- isolate?: Set<number>;
1616
- }): Promise<void>;
1617
- /**
1618
- * Sets the color of the specified fragments.
1619
- *
1620
- * @param items - A map of fragment IDs to their respective express IDs.
1621
- * @param color - The color to set for the fragments.
1622
- * @param override - A boolean indicating whether to override the existing color of the fragments.
1623
- *
1624
- * @remarks
1625
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1626
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
1627
- *
1628
- * @throws Will throw an error if the fragment with the specified ID is not found.
1629
- */
1630
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1631
- /**
1632
- * Resets the color of the specified fragments to their original color.
1633
- *
1634
- * @param items - A map of fragment IDs to their respective express IDs.
1635
- *
1636
- * @remarks
1637
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1638
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1639
- *
1640
- * @throws Will throw an error if the fragment with the specified ID is not found.
1641
- */
1642
- resetColor(items: FRAGS.FragmentIdMap): void;
1643
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1644
- }
1645
- import * as WEBIFC from "web-ifc";
1646
- import * as FRAGS from "@thatopen/fragments";
1647
- import { IfcFragmentSettings } from "./src";
1648
- import { Component, Components, Event, Disposable } from "../../core";
1649
- /**
1650
- * 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).
1651
- */
1652
- export declare class IfcLoader extends Component implements Disposable {
1653
- /**
1654
- * A unique identifier for the component.
1655
- * This UUID is used to register the component within the Components system.
1742
+ * A unique identifier for the component.
1743
+ * This UUID is used to register the component within the Components system.
1656
1744
  */
1657
1745
  static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1658
1746
  /** {@link Disposable.onDisposed} */
@@ -1757,145 +1845,57 @@ export declare class IfcLoader extends Component implements Disposable {
1757
1845
  private getGeometry;
1758
1846
  private autoSetWasm;
1759
1847
  }
1848
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1849
+ import * as THREE from "three";
1760
1850
  import * as FRAGS from "@thatopen/fragments";
1761
- import { Components, Component } from "../../core";
1851
+ import { Component, Components, Event, Disposable } from "../../core";
1852
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1762
1853
  /**
1763
- * 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).
1854
+ * 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).
1764
1855
  */
1765
- export declare class Hider extends Component {
1856
+ export declare class FragmentsManager extends Component implements Disposable {
1766
1857
  /**
1767
1858
  * A unique identifier for the component.
1768
1859
  * This UUID is used to register the component within the Components system.
1769
1860
  */
1770
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1771
- /** {@link Component.enabled} */
1772
- enabled: boolean;
1773
- constructor(components: Components);
1861
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1862
+ /** {@link Disposable.onDisposed} */
1863
+ readonly onDisposed: Event<unknown>;
1774
1864
  /**
1775
- * Sets the visibility of fragments within the 3D scene.
1776
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1777
- * If 'items' is provided, only the specified fragments will be affected.
1778
- *
1779
- * @param visible - The visibility state to set for the fragments.
1780
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1781
- * If not provided, all fragments will be affected.
1782
- *
1783
- * @returns {void}
1865
+ * Event triggered when fragments are loaded.
1784
1866
  */
1785
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1867
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
1786
1868
  /**
1787
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1788
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1789
- *
1790
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1791
- * If not provided, all fragments will be isolated.
1792
- *
1793
- * @returns {void}
1869
+ * Event triggered when fragments are disposed.
1794
1870
  */
1795
- isolate(items: FRAGS.FragmentIdMap): void;
1796
- private updateCulledVisibility;
1797
- }
1798
- import { Component, Disposable, Event, Components } from "../../core";
1799
- /**
1800
- * 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).
1801
- */
1802
- export declare class Exploder extends Component implements Disposable {
1871
+ readonly onFragmentsDisposed: Event<{
1872
+ groupID: string;
1873
+ fragmentIDs: string[];
1874
+ }>;
1803
1875
  /**
1804
- * A unique identifier for the component.
1805
- * This UUID is used to register the component within the Components system.
1876
+ * Map containing all loaded fragments.
1877
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1806
1878
  */
1807
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1808
- /** {@link Disposable.onDisposed} */
1809
- readonly onDisposed: Event<unknown>;
1810
- /** {@link Component.enabled} */
1811
- enabled: boolean;
1879
+ readonly list: Map<string, Fragment>;
1812
1880
  /**
1813
- * The height of the explosion animation.
1814
- * This property determines the vertical distance by which fragments are moved during the explosion.
1815
- * Default value is 10.
1881
+ * Map containing all loaded fragment groups.
1882
+ * The key is the group's unique identifier, and the value is the group itself.
1816
1883
  */
1817
- height: number;
1884
+ readonly groups: Map<string, FragmentsGroup>;
1885
+ baseCoordinationModel: string;
1886
+ baseCoordinationMatrix: THREE.Matrix4;
1887
+ /** {@link Component.enabled} */
1888
+ enabled: boolean;
1889
+ private _loader;
1818
1890
  /**
1819
- * The group name used for the explosion animation.
1820
- * This property specifies the group of fragments that will be affected by the explosion.
1821
- * Default value is "storeys".
1891
+ * Getter for the meshes of all fragments in the FragmentsManager.
1892
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1893
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1822
1894
  */
1823
- groupName: string;
1824
- /**
1825
- * A set of strings representing the exploded items.
1826
- * This set is used to keep track of which items have been exploded.
1827
- */
1828
- list: Set<string>;
1829
- constructor(components: Components);
1830
- /** {@link Disposable.dispose} */
1831
- dispose(): void;
1832
- /**
1833
- * Sets the explosion state of the fragments.
1834
- *
1835
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1836
- *
1837
- * @remarks
1838
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1839
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1840
- * If 'active' is false, the fragments are moved back to their original position.
1841
- *
1842
- * The method also keeps track of the exploded items using the 'list' set.
1843
- *
1844
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1845
- */
1846
- set(active: boolean): void;
1847
- }
1848
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1849
- import * as THREE from "three";
1850
- import * as FRAGS from "@thatopen/fragments";
1851
- import { Component, Components, Event, Disposable } from "../../core";
1852
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1853
- /**
1854
- * 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).
1855
- */
1856
- export declare class FragmentsManager extends Component implements Disposable {
1857
- /**
1858
- * A unique identifier for the component.
1859
- * This UUID is used to register the component within the Components system.
1860
- */
1861
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1862
- /** {@link Disposable.onDisposed} */
1863
- readonly onDisposed: Event<unknown>;
1864
- /**
1865
- * Event triggered when fragments are loaded.
1866
- */
1867
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
1868
- /**
1869
- * Event triggered when fragments are disposed.
1870
- */
1871
- readonly onFragmentsDisposed: Event<{
1872
- groupID: string;
1873
- fragmentIDs: string[];
1874
- }>;
1875
- /**
1876
- * Map containing all loaded fragments.
1877
- * The key is the fragment's unique identifier, and the value is the fragment itself.
1878
- */
1879
- readonly list: Map<string, Fragment>;
1880
- /**
1881
- * Map containing all loaded fragment groups.
1882
- * The key is the group's unique identifier, and the value is the group itself.
1883
- */
1884
- readonly groups: Map<string, FragmentsGroup>;
1885
- baseCoordinationModel: string;
1886
- baseCoordinationMatrix: THREE.Matrix4;
1887
- /** {@link Component.enabled} */
1888
- enabled: boolean;
1889
- private _loader;
1890
- /**
1891
- * Getter for the meshes of all fragments in the FragmentsManager.
1892
- * It iterates over the fragments in the list and pushes their meshes into an array.
1893
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1894
- */
1895
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1896
- constructor(components: Components);
1897
- /** {@link Disposable.dispose} */
1898
- dispose(): void;
1895
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1896
+ constructor(components: Components);
1897
+ /** {@link Disposable.dispose} */
1898
+ dispose(): void;
1899
1899
  /**
1900
1900
  * Dispose of a specific fragment group.
1901
1901
  * This method removes the group from the groups map, deletes all fragments within the group from the list,
@@ -1972,24 +1972,6 @@ export declare class FragmentsManager extends Component implements Disposable {
1972
1972
  applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1973
1973
  }
1974
1974
  import * as WEBIFC from "web-ifc";
1975
- export interface IfcItemsCategories {
1976
- [itemID: number]: number;
1977
- }
1978
- export declare class IfcCategories {
1979
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1980
- }
1981
- /**
1982
- * 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.
1983
- *
1984
- * @remarks
1985
- * This map is used to provide a mapping between IFC entity type numbers and their names.
1986
- * It is useful for identifying and processing different types of IFC elements in a project.
1987
- *
1988
- */
1989
- export declare const IfcElements: {
1990
- [key: number]: string;
1991
- };
1992
- import * as WEBIFC from "web-ifc";
1993
1975
  import { Components, Disposable, Event, Component } from "../../core";
1994
1976
  import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1995
1977
  /**
@@ -2087,37 +2069,6 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
2087
2069
  private streamAssets;
2088
2070
  private streamGeometries;
2089
2071
  }
2090
- /**
2091
- * 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.
2092
- */
2093
- export declare const IfcCategoryMap: {
2094
- [key: number]: string;
2095
- };
2096
- import * as FRAGS from "@thatopen/fragments";
2097
- export declare class IfcPropertiesUtils {
2098
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2099
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2100
- [attribute: string]: any;
2101
- } | null>;
2102
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2103
- [relatingID: number]: number[];
2104
- }>;
2105
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2106
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2107
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2108
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2109
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2110
- key: string | null;
2111
- name: string | null;
2112
- }>;
2113
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2114
- key: string | null;
2115
- value: number | null;
2116
- }>;
2117
- static isRel(expressID: number): boolean;
2118
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2119
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2120
- }
2121
2072
  import * as WEBIFC from "web-ifc";
2122
2073
  import { AsyncEvent, Component, Disposable, Event } from "../../core";
2123
2074
  import { PropertiesStreamingSettings } from "./src";
@@ -2183,6 +2134,17 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
2183
2134
  private streamAllProperties;
2184
2135
  private cleanUp;
2185
2136
  }
2137
+ /**
2138
+ * 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.
2139
+ *
2140
+ * @remarks
2141
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2142
+ * It is useful for identifying and processing different types of IFC elements in a project.
2143
+ *
2144
+ */
2145
+ export declare const IfcElements: {
2146
+ [key: number]: string;
2147
+ };
2186
2148
  import * as THREE from "three";
2187
2149
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2188
2150
  /**
@@ -2272,464 +2234,182 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2272
2234
  resize(size?: THREE.Vector2): void;
2273
2235
  private updatePlanes;
2274
2236
  }
2237
+ import * as FRAGS from "@thatopen/fragments";
2238
+ export declare class IfcPropertiesUtils {
2239
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2240
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2241
+ [attribute: string]: any;
2242
+ } | null>;
2243
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2244
+ [relatingID: number]: number[];
2245
+ }>;
2246
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2247
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2248
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2249
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2250
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2251
+ key: string | null;
2252
+ name: string | null;
2253
+ }>;
2254
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2255
+ key: string | null;
2256
+ value: number | null;
2257
+ }>;
2258
+ static isRel(expressID: number): boolean;
2259
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2260
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2261
+ }
2262
+ import * as WEBIFC from "web-ifc";
2263
+ export interface IfcItemsCategories {
2264
+ [itemID: number]: number;
2265
+ }
2266
+ export declare class IfcCategories {
2267
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2268
+ }
2275
2269
  /**
2276
- * A Set of unique numbers representing different types of IFC geometries.
2270
+ * 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.
2277
2271
  */
2278
- export declare const GeometryTypes: Set<number>;
2272
+ export declare const IfcCategoryMap: {
2273
+ [key: number]: string;
2274
+ };
2279
2275
  import { InverseAttribute } from "./types";
2280
2276
  export declare const relToAttributesMap: Map<number, {
2281
2277
  forRelating: InverseAttribute;
2282
2278
  forRelated: InverseAttribute;
2283
2279
  }>;
2284
- /**
2285
- * 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.
2286
- */
2287
- export declare class AsyncEvent<T> {
2280
+ import * as WEBIFC from "web-ifc";
2281
+ import { IfcItemsCategories } from "../../../ifc";
2282
+ export declare class SpatialStructure {
2283
+ itemsByFloor: IfcItemsCategories;
2284
+ private _units;
2285
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2286
+ cleanUp(): void;
2287
+ }
2288
+ import * as FRAGS from "@thatopen/fragments";
2289
+ import * as WEBIFC from "web-ifc";
2290
+ export declare class SpatialIdsFinder {
2291
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2292
+ }
2293
+ import * as WEBIFC from "web-ifc";
2294
+ /** Configuration of the IFC-fragment conversion. */
2295
+ export declare class IfcFragmentSettings {
2296
+ /** Whether to extract the IFC properties into a JSON. */
2297
+ includeProperties: boolean;
2288
2298
  /**
2289
- * Add a callback to this event instance.
2290
- * @param handler - the callback to be added to this event.
2299
+ * Generate the geometry for categories that are not included by default,
2300
+ * like IFCSPACE.
2291
2301
  */
2292
- add(handler: T extends void ? {
2293
- (): Promise<void>;
2294
- } : {
2295
- (data: T): Promise<void>;
2296
- }): void;
2302
+ optionalCategories: number[];
2303
+ /** Whether to use the coordination data coming from the IFC files. */
2304
+ coordinate: boolean;
2305
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2306
+ wasm: {
2307
+ path: string;
2308
+ absolute: boolean;
2309
+ logLevel?: WEBIFC.LogLevel;
2310
+ };
2311
+ /** List of categories that won't be converted to fragments. */
2312
+ excludedCategories: Set<number>;
2313
+ /** Whether to save the absolute location of all IFC items. */
2314
+ saveLocations: boolean;
2315
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2316
+ webIfc: WEBIFC.LoaderSettings;
2297
2317
  /**
2298
- * Removes a callback from this event instance.
2299
- * @param handler - the callback to be removed from this event.
2318
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2319
+ * If set to true, the path will be set to the default path of the WASM file.
2320
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2321
+ * Default value is true.
2300
2322
  */
2301
- remove(handler: T extends void ? {
2302
- (): Promise<void>;
2303
- } : {
2304
- (data: T): Promise<void>;
2305
- }): void;
2306
- /** Triggers all the callbacks assigned to this event. */
2307
- trigger: (data?: T) => Promise<void>;
2308
- /** Gets rid of all the suscribed events. */
2309
- reset(): void;
2310
- private handlers;
2323
+ autoSetWasm: boolean;
2324
+ /**
2325
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2326
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2327
+ * If set to null, the default file location handler will be used.
2328
+ *
2329
+ * @param url - The URL of the file to locate.
2330
+ * @returns The absolute path of the file.
2331
+ */
2332
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2311
2333
  }
2334
+ import * as THREE from "three";
2335
+ import { Disposable, Event } from "../../Types";
2312
2336
  /**
2313
- * 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.
2337
+ * 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.
2314
2338
  */
2315
- export declare class Event<T> {
2339
+ export declare class Mouse implements Disposable {
2340
+ dom: HTMLCanvasElement;
2341
+ private _event?;
2342
+ private _position;
2343
+ /** {@link Disposable.onDisposed} */
2344
+ readonly onDisposed: Event<unknown>;
2345
+ constructor(dom: HTMLCanvasElement);
2316
2346
  /**
2317
- * Add a callback to this event instance.
2318
- * @param handler - the callback to be added to this event.
2319
- */
2320
- add(handler: T extends void ? {
2321
- (): void;
2322
- } : {
2323
- (data: T): void;
2324
- }): void;
2325
- /**
2326
- * Removes a callback from this event instance.
2327
- * @param handler - the callback to be removed from this event.
2328
- */
2329
- remove(handler: T extends void ? {
2330
- (): void;
2331
- } : {
2332
- (data: T): void;
2333
- }): void;
2334
- /** Triggers all the callbacks assigned to this event. */
2335
- trigger: (data?: T) => void;
2336
- /** Gets rid of all the suscribed events. */
2337
- reset(): void;
2338
- private handlers;
2339
- }
2340
- import { Base } from "./base";
2341
- import { World } from "./world";
2342
- import { Event } from "./event";
2343
- import { Components } from "../../Components";
2344
- /**
2345
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2346
- */
2347
- export declare abstract class BaseWorldItem extends Base {
2348
- readonly worlds: Map<string, World>;
2349
- /**
2350
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2351
- * The event payload contains the world instance and the action ("added" or "removed").
2352
- */
2353
- readonly onWorldChanged: Event<{
2354
- world: World;
2355
- action: "added" | "removed";
2356
- }>;
2357
- /**
2358
- * The current world this item is associated with. It can be null if no world is currently active.
2359
- */
2360
- currentWorld: World | null;
2361
- protected constructor(components: Components);
2362
- }
2363
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2364
- import { Components } from "../../Components";
2365
- /**
2366
- * Base class of the library. Useful for finding out the interfaces something implements.
2367
- */
2368
- export declare abstract class Base {
2369
- components: Components;
2370
- constructor(components: Components);
2371
- /** Whether is component is {@link Disposable}. */
2372
- isDisposeable: () => this is Disposable;
2373
- /** Whether is component is {@link Resizeable}. */
2374
- isResizeable: () => this is Resizeable;
2375
- /** Whether is component is {@link Updateable}. */
2376
- isUpdateable: () => this is Updateable;
2377
- /** Whether is component is {@link Hideable}. */
2378
- isHideable: () => this is Hideable;
2379
- /** Whether is component is {@link Configurable}. */
2380
- isConfigurable: () => this is Configurable<any>;
2381
- }
2382
- import * as THREE from "three";
2383
- import CameraControls from "camera-controls";
2384
- import { Event } from "./event";
2385
- /**
2386
- * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2387
- */
2388
- export interface Disposable {
2389
- /**
2390
- * Destroys the object from memory to prevent a
2391
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2392
- */
2393
- dispose: () => void | Promise<void>;
2394
- /** Fired after the tool has been disposed. */
2395
- readonly onDisposed: Event<any>;
2396
- }
2397
- /**
2398
- * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2399
- */
2400
- export interface Hideable {
2401
- /**
2402
- * Whether the geometric representation of this component is
2403
- * currently visible or not in the
2404
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2405
- */
2406
- visible: boolean;
2407
- }
2408
- /**
2409
- * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2410
- */
2411
- export interface Resizeable {
2412
- /**
2413
- * Sets size of this component (e.g. the resolution of a
2414
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2415
- * component.
2416
- */
2417
- resize: (size?: THREE.Vector2) => void;
2418
- /** Event that fires when the component has been resized. */
2419
- onResize: Event<THREE.Vector2>;
2420
- /**
2421
- * Gets the current size of this component (e.g. the resolution of a
2422
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2423
- * component.
2424
- */
2425
- getSize: () => THREE.Vector2;
2426
- }
2427
- /** Whether this component should be updated each frame. */
2428
- export interface Updateable {
2429
- /** Actions that should be executed after updating the component. */
2430
- onAfterUpdate: Event<any>;
2431
- /** Actions that should be executed before updating the component. */
2432
- onBeforeUpdate: Event<any>;
2433
- /**
2434
- * Function used to update the state of this component each frame. For
2435
- * instance, a renderer component will make a render each frame.
2436
- */
2437
- update(delta?: number): void;
2438
- }
2439
- /** Basic type to describe the progress of any kind of process. */
2440
- export interface Progress {
2441
- /** The amount of things that have been done already. */
2442
- current: number;
2443
- /** The total amount of things to be done by the process. */
2444
- total: number;
2445
- }
2446
- /**
2447
- * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
2448
- */
2449
- export interface Createable {
2450
- /** Creates a new instance of an element (e.g. a new Dimension). */
2451
- create: (data: any) => void;
2452
- /**
2453
- * Finish the creation process of the component, successfully creating an
2454
- * instance of whatever the component creates.
2455
- */
2456
- endCreation?: (data: any) => void;
2457
- /**
2458
- * Cancels the creation process of the component, going back to the state
2459
- * before starting to create.
2460
- */
2461
- cancelCreation?: (data: any) => void;
2462
- /** Deletes an existing instance of an element (e.g. a Dimension). */
2463
- delete: (data: any) => void;
2464
- }
2465
- /**
2466
- * Whether this component supports to be configured.
2467
- */
2468
- export interface Configurable<T extends Record<string, any>> {
2469
- /** Wether this components has been already configured. */
2470
- isSetup: boolean;
2471
- /** Use the provided configuration to setup the tool. */
2472
- setup: (config?: Partial<T>) => void | Promise<void>;
2473
- /** Fired after successfully calling {@link Configurable.setup()} */
2474
- readonly onSetup: Event<any>;
2475
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2476
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
2477
- */
2478
- config: Required<T>;
2479
- }
2480
- /**
2481
- * Whether a camera uses the Camera Controls library.
2482
- */
2483
- export interface CameraControllable {
2484
- /**
2485
- * An instance of CameraControls that provides camera control functionalities.
2486
- * This instance is used to manipulate the camera.
2487
- */
2488
- controls: CameraControls;
2489
- }
2490
- import { Base } from "./base";
2491
- /**
2492
- * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2493
- */
2494
- export declare abstract class Component extends Base {
2495
- /**
2496
- * Whether this component is active or not. The behaviour can vary depending
2497
- * on the type of component. E.g. a disabled dimension tool will stop creating
2498
- * dimensions, while a disabled camera will stop moving. A disabled component
2499
- * will not be updated automatically each frame.
2500
- */
2501
- abstract enabled: boolean;
2502
- }
2503
- import * as THREE from "three";
2504
- import { Disposable } from "./interfaces";
2505
- import { Event } from "./event";
2506
- import { Components } from "../../Components";
2507
- import { BaseWorldItem } from "./base-world-item";
2508
- /**
2509
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2510
- */
2511
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2512
- /** {@link Disposable.onDisposed} */
2513
- readonly onDisposed: Event<unknown>;
2514
- /**
2515
- * Abstract property representing the three.js object associated with this scene.
2516
- * It should be implemented by subclasses.
2517
- */
2518
- abstract three: THREE.Object3D;
2519
- protected constructor(components: Components);
2520
- /** {@link Disposable.dispose} */
2521
- dispose(): void;
2522
- }
2523
- import * as THREE from "three";
2524
- import { Vector2 } from "three";
2525
- import { Event } from "./event";
2526
- import { BaseWorldItem } from "./base-world-item";
2527
- import { Disposable, Resizeable, Updateable } from "./interfaces";
2528
- /**
2529
- * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
2530
- */
2531
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
2532
- /**
2533
- * The three.js WebGLRenderer instance associated with this renderer.
2534
- *
2535
- * @abstract
2536
- * @type {THREE.WebGLRenderer}
2537
- */
2538
- abstract three: THREE.WebGLRenderer;
2539
- /** {@link Updateable.onBeforeUpdate} */
2540
- onAfterUpdate: Event<unknown>;
2541
- /** {@link Updateable.onAfterUpdate} */
2542
- onBeforeUpdate: Event<unknown>;
2543
- /** {@link Disposable.onDisposed} */
2544
- readonly onDisposed: Event<undefined>;
2545
- /** {@link Resizeable.onResize} */
2546
- readonly onResize: Event<THREE.Vector2>;
2547
- /**
2548
- * Event that fires when there has been a change to the list of clipping
2549
- * planes used by the active renderer.
2347
+ * The real position of the mouse of the Three.js canvas.
2550
2348
  */
2551
- readonly onClippingPlanesUpdated: Event<unknown>;
2552
- /** {@link Updateable.update} */
2553
- abstract update(delta?: number): void | Promise<void>;
2349
+ get position(): THREE.Vector2;
2554
2350
  /** {@link Disposable.dispose} */
2555
- abstract dispose(): void;
2556
- /** {@link Resizeable.getSize} */
2557
- abstract getSize(): Vector2;
2558
- /** {@link Resizeable.resize} */
2559
- abstract resize(size: Vector2 | undefined): void;
2560
- /**
2561
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
2562
- */
2563
- clippingPlanes: THREE.Plane[];
2564
- /**
2565
- * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
2566
- *
2567
- * @remarks
2568
- * This method is typically called when there is a change to the list of clipping planes
2569
- * used by the active renderer.
2570
- */
2571
- updateClippingPlanes(): void;
2572
- /**
2573
- * Sets or removes a clipping plane from the renderer.
2574
- *
2575
- * @param active - A boolean indicating whether the clipping plane should be active or not.
2576
- * @param plane - The clipping plane to be added or removed.
2577
- * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
2578
- *
2579
- * @remarks
2580
- * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2581
- * If 'active' is 'true' and the plane is not already in the array, it is added.
2582
- * If 'active' is 'false' and the plane is in the array, it is removed.
2583
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2584
- * excluding any planes marked as local.
2585
- */
2586
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2587
- }
2588
- import * as THREE from "three";
2589
- import CameraControls from "camera-controls";
2590
- import { BaseWorldItem } from "./base-world-item";
2591
- import { CameraControllable } from "./interfaces";
2592
- /**
2593
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2594
- */
2595
- export declare abstract class BaseCamera extends BaseWorldItem {
2596
- /**
2597
- * Whether the camera is enabled or not.
2598
- */
2599
- abstract enabled: boolean;
2600
- /**
2601
- * The Three.js camera instance.
2602
- */
2603
- abstract three: THREE.Camera;
2604
- /**
2605
- * Optional CameraControls instance for controlling the camera.
2606
- * This property is only available if the camera is controllable.
2607
- */
2608
- abstract controls?: CameraControls;
2609
- /**
2610
- * Checks whether the instance is {@link CameraControllable}.
2611
- *
2612
- * @returns True if the instance is controllable, false otherwise.
2613
- */
2614
- hasCameraControls: () => this is CameraControllable;
2615
- }
2616
- import * as WEBIFC from "web-ifc";
2617
- import { IfcItemsCategories } from "../../../ifc";
2618
- export declare class SpatialStructure {
2619
- itemsByFloor: IfcItemsCategories;
2620
- private _units;
2621
- setUp(webIfc: WEBIFC.IfcAPI): void;
2622
- cleanUp(): void;
2623
- }
2624
- import * as WEBIFC from "web-ifc";
2625
- /** Configuration of the IFC-fragment conversion. */
2626
- export declare class IfcFragmentSettings {
2627
- /** Whether to extract the IFC properties into a JSON. */
2628
- includeProperties: boolean;
2629
- /**
2630
- * Generate the geometry for categories that are not included by default,
2631
- * like IFCSPACE.
2632
- */
2633
- optionalCategories: number[];
2634
- /** Whether to use the coordination data coming from the IFC files. */
2635
- coordinate: boolean;
2636
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2637
- wasm: {
2638
- path: string;
2639
- absolute: boolean;
2640
- logLevel?: WEBIFC.LogLevel;
2641
- };
2642
- /** List of categories that won't be converted to fragments. */
2643
- excludedCategories: Set<number>;
2644
- /** Whether to save the absolute location of all IFC items. */
2645
- saveLocations: boolean;
2646
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2647
- webIfc: WEBIFC.LoaderSettings;
2648
- /**
2649
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2650
- * If set to true, the path will be set to the default path of the WASM file.
2651
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2652
- * Default value is true.
2653
- */
2654
- autoSetWasm: boolean;
2655
- /**
2656
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2657
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2658
- * If set to null, the default file location handler will be used.
2659
- *
2660
- * @param url - The URL of the file to locate.
2661
- * @returns The absolute path of the file.
2662
- */
2663
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2664
- }
2665
- import * as FRAGS from "@thatopen/fragments";
2666
- import * as WEBIFC from "web-ifc";
2667
- export declare class SpatialIdsFinder {
2668
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2669
- }
2670
- import { Event } from "./event";
2671
- export declare class DataMap<K, V> extends Map<K, V> {
2672
- readonly onItemSet: Event<{
2673
- key: K;
2674
- value: V;
2675
- }>;
2676
- readonly onItemUpdated: Event<{
2677
- key: K;
2678
- value: V;
2679
- }>;
2680
- readonly onItemDeleted: Event<unknown>;
2681
- readonly onCleared: Event<unknown>;
2682
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
2683
- clear(): void;
2684
- set(key: K, value: V): this;
2685
- delete(key: K): boolean;
2686
- dispose(): void;
2687
- }
2688
- import { Event } from "./event";
2689
- export declare class DataSet<T> extends Set<T> {
2690
- readonly onItemAdded: Event<T>;
2691
- readonly onItemDeleted: Event<unknown>;
2692
- readonly onCleared: Event<unknown>;
2693
- constructor(iterable?: Iterable<T> | null);
2694
- clear(): void;
2695
- add(value: T): this;
2696
- delete(value: T): boolean;
2697
2351
  dispose(): void;
2352
+ private getPositionY;
2353
+ private getPositionX;
2354
+ private updateMouseInfo;
2355
+ private setupEvents;
2698
2356
  }
2699
2357
  import * as THREE from "three";
2700
- import { BaseScene } from "./base-scene";
2701
- import { BaseCamera } from "./base-camera";
2702
- import { BaseRenderer } from "./base-renderer";
2703
- import { Updateable, Disposable } from "./interfaces";
2358
+ import { Components } from "../../Components";
2359
+ import { Event, World, Disposable } from "../../Types";
2360
+ import { Mouse } from "./mouse";
2704
2361
  /**
2705
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2362
+ * 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.
2706
2363
  */
2707
- export interface World extends Disposable, Updateable {
2708
- /**
2709
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2710
- */
2711
- meshes: Set<THREE.Mesh>;
2712
- /**
2713
- * The base scene of the world.
2714
- */
2715
- scene: BaseScene;
2364
+ export declare class SimpleRaycaster implements Disposable {
2365
+ /** {@link Component.enabled} */
2366
+ enabled: boolean;
2367
+ /** The components instance to which this Raycaster belongs. */
2368
+ components: Components;
2369
+ /** {@link Disposable.onDisposed} */
2370
+ readonly onDisposed: Event<unknown>;
2371
+ /** The position of the mouse in the screen. */
2372
+ readonly mouse: Mouse;
2716
2373
  /**
2717
- * The base camera of the world.
2374
+ * A reference to the Three.js Raycaster instance.
2375
+ * This is used for raycasting operations.
2718
2376
  */
2719
- camera: BaseCamera;
2377
+ readonly three: THREE.Raycaster;
2720
2378
  /**
2721
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2379
+ * A reference to the world instance to which this Raycaster belongs.
2380
+ * This is used to access the camera and meshes.
2722
2381
  */
2723
- renderer: BaseRenderer | null;
2382
+ world: World;
2383
+ constructor(components: Components, world: World);
2384
+ /** {@link Disposable.dispose} */
2385
+ dispose(): void;
2724
2386
  /**
2725
- * A unique identifier for the world.
2387
+ * Throws a ray from the camera to the mouse or touch event point and returns
2388
+ * the first item found. This also takes into account the clipping planes
2389
+ * used by the renderer.
2390
+ *
2391
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2392
+ * to query. If not provided, it will query all the meshes stored in
2393
+ * {@link Components.meshes}.
2726
2394
  */
2727
- uuid: string;
2395
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2728
2396
  /**
2729
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2397
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2398
+ * This method also takes into account the clipping planes used by the renderer.
2399
+ *
2400
+ * @param origin - The origin of the ray.
2401
+ * @param direction - The direction of the ray.
2402
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2403
+ * @returns The first intersection found or 'null' if no intersection was found.
2730
2404
  */
2731
- isDisposing: boolean;
2405
+ 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;
2406
+ private intersect;
2407
+ private filterClippingPlanes;
2732
2408
  }
2409
+ /**
2410
+ * A Set of unique numbers representing different types of IFC geometries.
2411
+ */
2412
+ export declare const GeometryTypes: Set<number>;
2733
2413
  import * as THREE from "three";
2734
2414
  import { BaseScene, Configurable, Event } from "../../Types";
2735
2415
  import { Components } from "../../Components";
@@ -2770,6 +2450,159 @@ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2770
2450
  setup(config?: Partial<SimpleSceneConfig>): void;
2771
2451
  }
2772
2452
  import * as THREE from "three";
2453
+ import { BaseRenderer, Event } from "../../Types";
2454
+ import { Components } from "../../Components";
2455
+ /**
2456
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2457
+ */
2458
+ export declare class SimpleRenderer extends BaseRenderer {
2459
+ /**
2460
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2461
+ * Default is 'true'.
2462
+ */
2463
+ enabled: boolean;
2464
+ /**
2465
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2466
+ */
2467
+ container: HTMLElement;
2468
+ /**
2469
+ * The THREE.js WebGLRenderer instance.
2470
+ */
2471
+ three: THREE.WebGLRenderer;
2472
+ protected _canvas: HTMLCanvasElement;
2473
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2474
+ protected _resizeObserver: ResizeObserver | null;
2475
+ protected onContainerUpdated: Event<unknown>;
2476
+ private _resizing;
2477
+ /**
2478
+ * Constructor for the SimpleRenderer class.
2479
+ *
2480
+ * @param components - The components instance.
2481
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
2482
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2483
+ */
2484
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2485
+ /** {@link Updateable.update} */
2486
+ update(): void;
2487
+ /** {@link Disposable.dispose} */
2488
+ dispose(): void;
2489
+ /** {@link Resizeable.getSize}. */
2490
+ getSize(): THREE.Vector2;
2491
+ /** {@link Resizeable.resize} */
2492
+ resize: (size?: THREE.Vector2) => void;
2493
+ /**
2494
+ * Sets up and manages the event listeners for the renderer.
2495
+ *
2496
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2497
+ *
2498
+ * @throws Will throw an error if the renderer does not have an HTML container.
2499
+ */
2500
+ setupEvents(active: boolean): void;
2501
+ private resizeEvent;
2502
+ private setupRenderer;
2503
+ private onContextLost;
2504
+ private onContextBack;
2505
+ }
2506
+ import * as THREE from "three";
2507
+ import { Hideable, Disposable, Event, World } from "../../Types";
2508
+ import { Components } from "../../Components";
2509
+ /**
2510
+ * Each of the clipping planes created by the clipper.
2511
+ */
2512
+ export declare class SimplePlane implements Disposable, Hideable {
2513
+ /** Event that fires when the user starts dragging a clipping plane. */
2514
+ readonly onDraggingStarted: Event<unknown>;
2515
+ /** Event that fires when the user stops dragging a clipping plane. */
2516
+ readonly onDraggingEnded: Event<unknown>;
2517
+ /** {@link Disposable.onDisposed} */
2518
+ readonly onDisposed: Event<unknown>;
2519
+ /**
2520
+ * The normal vector of the clipping plane.
2521
+ */
2522
+ readonly normal: THREE.Vector3;
2523
+ /**
2524
+ * The origin point of the clipping plane.
2525
+ */
2526
+ readonly origin: THREE.Vector3;
2527
+ /**
2528
+ * The THREE.js Plane object representing the clipping plane.
2529
+ */
2530
+ readonly three: THREE.Plane;
2531
+ /** The components instance to which this plane belongs. */
2532
+ components: Components;
2533
+ /** The world instance to which this plane belongs. */
2534
+ world: World;
2535
+ /** A custom string to identify what this plane is used for. */
2536
+ type: string;
2537
+ protected readonly _helper: THREE.Object3D;
2538
+ protected _visible: boolean;
2539
+ protected _enabled: boolean;
2540
+ private _controlsActive;
2541
+ private readonly _arrowBoundBox;
2542
+ private readonly _planeMesh;
2543
+ private readonly _controls;
2544
+ private readonly _hiddenMaterial;
2545
+ /**
2546
+ * Getter for the enabled state of the clipping plane.
2547
+ * @returns {boolean} The current enabled state.
2548
+ */
2549
+ get enabled(): boolean;
2550
+ /**
2551
+ * Setter for the enabled state of the clipping plane.
2552
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
2553
+ * @param {boolean} state - The new enabled state.
2554
+ */
2555
+ set enabled(state: boolean);
2556
+ /** {@link Hideable.visible } */
2557
+ get visible(): boolean;
2558
+ /** {@link Hideable.visible } */
2559
+ set visible(state: boolean);
2560
+ /** The meshes used for raycasting */
2561
+ get meshes(): THREE.Mesh[];
2562
+ /** The material of the clipping plane representation. */
2563
+ get planeMaterial(): THREE.Material | THREE.Material[];
2564
+ /** The material of the clipping plane representation. */
2565
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
2566
+ /** The size of the clipping plane representation. */
2567
+ get size(): number;
2568
+ /** Sets the size of the clipping plane representation. */
2569
+ set size(size: number);
2570
+ /**
2571
+ * Getter for the helper object of the clipping plane.
2572
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
2573
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
2574
+ *
2575
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
2576
+ */
2577
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
2578
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
2579
+ /**
2580
+ * Sets the clipping plane's normal and origin from the given normal and point.
2581
+ * This method resets the clipping plane's state, updates the normal and origin,
2582
+ * and positions the helper object accordingly.
2583
+ *
2584
+ * @param normal - The new normal vector for the clipping plane.
2585
+ * @param point - The new origin point for the clipping plane.
2586
+ *
2587
+ * @returns {void}
2588
+ */
2589
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
2590
+ /** {@link Updateable.update} */
2591
+ update: () => void;
2592
+ /** {@link Disposable.dispose} */
2593
+ dispose(): void;
2594
+ private reset;
2595
+ protected toggleControls(state: boolean): void;
2596
+ private newTransformControls;
2597
+ private initializeControls;
2598
+ private createArrowBoundingBox;
2599
+ private changeDrag;
2600
+ private notifyDraggingChanged;
2601
+ private preventCameraMovement;
2602
+ private newHelper;
2603
+ private static newPlaneMesh;
2604
+ }
2605
+ import * as THREE from "three";
2773
2606
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2774
2607
  /**
2775
2608
  * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
@@ -2904,65 +2737,11 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
2904
2737
  * Updates the aspect of the camera to match the size of the
2905
2738
  * {@link Components.renderer}.
2906
2739
  */
2907
- updateAspect: () => void;
2908
- private setupCamera;
2909
- private newCameraControls;
2910
- private setupEvents;
2911
- private static getSubsetOfThree;
2912
- }
2913
- import * as THREE from "three";
2914
- import { BaseRenderer, Event } from "../../Types";
2915
- import { Components } from "../../Components";
2916
- /**
2917
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2918
- */
2919
- export declare class SimpleRenderer extends BaseRenderer {
2920
- /**
2921
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2922
- * Default is 'true'.
2923
- */
2924
- enabled: boolean;
2925
- /**
2926
- * The HTML container of the THREE.js canvas where the scene is rendered.
2927
- */
2928
- container: HTMLElement;
2929
- /**
2930
- * The THREE.js WebGLRenderer instance.
2931
- */
2932
- three: THREE.WebGLRenderer;
2933
- protected _canvas: HTMLCanvasElement;
2934
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2935
- protected _resizeObserver: ResizeObserver | null;
2936
- protected onContainerUpdated: Event<unknown>;
2937
- private _resizing;
2938
- /**
2939
- * Constructor for the SimpleRenderer class.
2940
- *
2941
- * @param components - The components instance.
2942
- * @param container - The HTML container where the THREE.js canvas will be rendered.
2943
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2944
- */
2945
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2946
- /** {@link Updateable.update} */
2947
- update(): void;
2948
- /** {@link Disposable.dispose} */
2949
- dispose(): void;
2950
- /** {@link Resizeable.getSize}. */
2951
- getSize(): THREE.Vector2;
2952
- /** {@link Resizeable.resize} */
2953
- resize: (size?: THREE.Vector2) => void;
2954
- /**
2955
- * Sets up and manages the event listeners for the renderer.
2956
- *
2957
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2958
- *
2959
- * @throws Will throw an error if the renderer does not have an HTML container.
2960
- */
2961
- setupEvents(active: boolean): void;
2962
- private resizeEvent;
2963
- private setupRenderer;
2964
- private onContextLost;
2965
- private onContextBack;
2740
+ updateAspect: () => void;
2741
+ private setupCamera;
2742
+ private newCameraControls;
2743
+ private setupEvents;
2744
+ private static getSubsetOfThree;
2966
2745
  }
2967
2746
  import * as THREE from "three";
2968
2747
  import { Components } from "../../Components";
@@ -3039,21 +2818,277 @@ export declare class CullerRenderer {
3039
2818
  /** {@link Disposable.dispose} */
3040
2819
  dispose(): void;
3041
2820
  /**
3042
- * The function that the culler uses to reprocess the scene. Generally it's
3043
- * better to call needsUpdate, but you can also call this to force it.
3044
- * @param force if true, it will refresh the scene even if needsUpdate is
3045
- * not true.
2821
+ * The function that the culler uses to reprocess the scene. Generally it's
2822
+ * better to call needsUpdate, but you can also call this to force it.
2823
+ * @param force if true, it will refresh the scene even if needsUpdate is
2824
+ * not true.
2825
+ */
2826
+ updateVisibility: (force?: boolean) => Promise<void>;
2827
+ protected getAvailableColor(): {
2828
+ r: number;
2829
+ g: number;
2830
+ b: number;
2831
+ code: string;
2832
+ };
2833
+ protected increaseColor(): void;
2834
+ protected decreaseColor(): void;
2835
+ private applySettings;
2836
+ }
2837
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2838
+ import * as THREE from "three";
2839
+ import { Hideable, Event, World, Disposable } from "../../Types";
2840
+ import { Components } from "../../Components";
2841
+ /**
2842
+ * Configuration interface for the {@link SimpleGrid} class.
2843
+ */
2844
+ export interface GridConfig {
2845
+ /**
2846
+ * The color of the grid lines.
2847
+ */
2848
+ color: THREE.Color;
2849
+ /**
2850
+ * The size of the primary grid lines.
2851
+ */
2852
+ size1: number;
2853
+ /**
2854
+ * The size of the secondary grid lines.
2855
+ */
2856
+ size2: number;
2857
+ /**
2858
+ * The distance at which the grid lines start to fade away.
2859
+ */
2860
+ distance: number;
2861
+ }
2862
+ /**
2863
+ * 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).
2864
+ */
2865
+ export declare class SimpleGrid implements Hideable, Disposable {
2866
+ /** {@link Disposable.onDisposed} */
2867
+ readonly onDisposed: Event<unknown>;
2868
+ /** The world instance to which this Raycaster belongs. */
2869
+ world: World;
2870
+ /** The components instance to which this grid belongs. */
2871
+ components: Components;
2872
+ /** {@link Hideable.visible} */
2873
+ get visible(): boolean;
2874
+ /** {@link Hideable.visible} */
2875
+ set visible(visible: boolean);
2876
+ /** The material of the grid. */
2877
+ get material(): THREE.ShaderMaterial;
2878
+ /**
2879
+ * Whether the grid should fade away with distance. Recommended to be true for
2880
+ * perspective cameras and false for orthographic cameras.
2881
+ */
2882
+ get fade(): boolean;
2883
+ /**
2884
+ * Whether the grid should fade away with distance. Recommended to be true for
2885
+ * perspective cameras and false for orthographic cameras.
2886
+ */
2887
+ set fade(active: boolean);
2888
+ /** The Three.js mesh that contains the infinite grid. */
2889
+ readonly three: THREE.Mesh;
2890
+ private _fade;
2891
+ constructor(components: Components, world: World, config: GridConfig);
2892
+ /** {@link Disposable.dispose} */
2893
+ dispose(): void;
2894
+ private setupEvents;
2895
+ private updateZoom;
2896
+ }
2897
+ /**
2898
+ * 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.
2899
+ */
2900
+ export declare class Event<T> {
2901
+ /**
2902
+ * Add a callback to this event instance.
2903
+ * @param handler - the callback to be added to this event.
2904
+ */
2905
+ add(handler: T extends void ? {
2906
+ (): void;
2907
+ } : {
2908
+ (data: T): void;
2909
+ }): void;
2910
+ /**
2911
+ * Removes a callback from this event instance.
2912
+ * @param handler - the callback to be removed from this event.
2913
+ */
2914
+ remove(handler: T extends void ? {
2915
+ (): void;
2916
+ } : {
2917
+ (data: T): void;
2918
+ }): void;
2919
+ /** Triggers all the callbacks assigned to this event. */
2920
+ trigger: (data?: T) => void;
2921
+ /** Gets rid of all the suscribed events. */
2922
+ reset(): void;
2923
+ private handlers;
2924
+ }
2925
+ /**
2926
+ * 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.
2927
+ */
2928
+ export declare class AsyncEvent<T> {
2929
+ /**
2930
+ * Add a callback to this event instance.
2931
+ * @param handler - the callback to be added to this event.
2932
+ */
2933
+ add(handler: T extends void ? {
2934
+ (): Promise<void>;
2935
+ } : {
2936
+ (data: T): Promise<void>;
2937
+ }): void;
2938
+ /**
2939
+ * Removes a callback from this event instance.
2940
+ * @param handler - the callback to be removed from this event.
2941
+ */
2942
+ remove(handler: T extends void ? {
2943
+ (): Promise<void>;
2944
+ } : {
2945
+ (data: T): Promise<void>;
2946
+ }): void;
2947
+ /** Triggers all the callbacks assigned to this event. */
2948
+ trigger: (data?: T) => Promise<void>;
2949
+ /** Gets rid of all the suscribed events. */
2950
+ reset(): void;
2951
+ private handlers;
2952
+ }
2953
+ import * as THREE from "three";
2954
+ import CameraControls from "camera-controls";
2955
+ import { Event } from "./event";
2956
+ /**
2957
+ * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2958
+ */
2959
+ export interface Disposable {
2960
+ /**
2961
+ * Destroys the object from memory to prevent a
2962
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2963
+ */
2964
+ dispose: () => void | Promise<void>;
2965
+ /** Fired after the tool has been disposed. */
2966
+ readonly onDisposed: Event<any>;
2967
+ }
2968
+ /**
2969
+ * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2970
+ */
2971
+ export interface Hideable {
2972
+ /**
2973
+ * Whether the geometric representation of this component is
2974
+ * currently visible or not in the
2975
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2976
+ */
2977
+ visible: boolean;
2978
+ }
2979
+ /**
2980
+ * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2981
+ */
2982
+ export interface Resizeable {
2983
+ /**
2984
+ * Sets size of this component (e.g. the resolution of a
2985
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2986
+ * component.
2987
+ */
2988
+ resize: (size?: THREE.Vector2) => void;
2989
+ /** Event that fires when the component has been resized. */
2990
+ onResize: Event<THREE.Vector2>;
2991
+ /**
2992
+ * Gets the current size of this component (e.g. the resolution of a
2993
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2994
+ * component.
2995
+ */
2996
+ getSize: () => THREE.Vector2;
2997
+ }
2998
+ /** Whether this component should be updated each frame. */
2999
+ export interface Updateable {
3000
+ /** Actions that should be executed after updating the component. */
3001
+ onAfterUpdate: Event<any>;
3002
+ /** Actions that should be executed before updating the component. */
3003
+ onBeforeUpdate: Event<any>;
3004
+ /**
3005
+ * Function used to update the state of this component each frame. For
3006
+ * instance, a renderer component will make a render each frame.
3007
+ */
3008
+ update(delta?: number): void;
3009
+ }
3010
+ /** Basic type to describe the progress of any kind of process. */
3011
+ export interface Progress {
3012
+ /** The amount of things that have been done already. */
3013
+ current: number;
3014
+ /** The total amount of things to be done by the process. */
3015
+ total: number;
3016
+ }
3017
+ /**
3018
+ * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
3019
+ */
3020
+ export interface Createable {
3021
+ /** Creates a new instance of an element (e.g. a new Dimension). */
3022
+ create: (data: any) => void;
3023
+ /**
3024
+ * Finish the creation process of the component, successfully creating an
3025
+ * instance of whatever the component creates.
3026
+ */
3027
+ endCreation?: (data: any) => void;
3028
+ /**
3029
+ * Cancels the creation process of the component, going back to the state
3030
+ * before starting to create.
3031
+ */
3032
+ cancelCreation?: (data: any) => void;
3033
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
3034
+ delete: (data: any) => void;
3035
+ }
3036
+ /**
3037
+ * Whether this component supports to be configured.
3038
+ */
3039
+ export interface Configurable<T extends Record<string, any>> {
3040
+ /** Wether this components has been already configured. */
3041
+ isSetup: boolean;
3042
+ /** Use the provided configuration to setup the tool. */
3043
+ setup: (config?: Partial<T>) => void | Promise<void>;
3044
+ /** Fired after successfully calling {@link Configurable.setup()} */
3045
+ readonly onSetup: Event<any>;
3046
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
3047
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
3048
+ */
3049
+ config: Required<T>;
3050
+ }
3051
+ /**
3052
+ * Whether a camera uses the Camera Controls library.
3053
+ */
3054
+ export interface CameraControllable {
3055
+ /**
3056
+ * An instance of CameraControls that provides camera control functionalities.
3057
+ * This instance is used to manipulate the camera.
3058
+ */
3059
+ controls: CameraControls;
3060
+ }
3061
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3062
+ import { Components } from "../../Components";
3063
+ /**
3064
+ * Base class of the library. Useful for finding out the interfaces something implements.
3065
+ */
3066
+ export declare abstract class Base {
3067
+ components: Components;
3068
+ constructor(components: Components);
3069
+ /** Whether is component is {@link Disposable}. */
3070
+ isDisposeable: () => this is Disposable;
3071
+ /** Whether is component is {@link Resizeable}. */
3072
+ isResizeable: () => this is Resizeable;
3073
+ /** Whether is component is {@link Updateable}. */
3074
+ isUpdateable: () => this is Updateable;
3075
+ /** Whether is component is {@link Hideable}. */
3076
+ isHideable: () => this is Hideable;
3077
+ /** Whether is component is {@link Configurable}. */
3078
+ isConfigurable: () => this is Configurable<any>;
3079
+ }
3080
+ import { Base } from "./base";
3081
+ /**
3082
+ * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
3083
+ */
3084
+ export declare abstract class Component extends Base {
3085
+ /**
3086
+ * Whether this component is active or not. The behaviour can vary depending
3087
+ * on the type of component. E.g. a disabled dimension tool will stop creating
3088
+ * dimensions, while a disabled camera will stop moving. A disabled component
3089
+ * will not be updated automatically each frame.
3046
3090
  */
3047
- updateVisibility: (force?: boolean) => Promise<void>;
3048
- protected getAvailableColor(): {
3049
- r: number;
3050
- g: number;
3051
- b: number;
3052
- code: string;
3053
- };
3054
- protected increaseColor(): void;
3055
- protected decreaseColor(): void;
3056
- private applySettings;
3091
+ abstract enabled: boolean;
3057
3092
  }
3058
3093
  import * as THREE from "three";
3059
3094
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
@@ -3120,140 +3155,204 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
3120
3155
  private getAvailableMaterial;
3121
3156
  }
3122
3157
  import * as THREE from "three";
3123
- import { Components } from "../../Components";
3124
- import { Event, World, Disposable } from "../../Types";
3125
- import { Mouse } from "./mouse";
3158
+ import CameraControls from "camera-controls";
3159
+ import { BaseWorldItem } from "./base-world-item";
3160
+ import { CameraControllable } from "./interfaces";
3126
3161
  /**
3127
- * 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.
3162
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
3128
3163
  */
3129
- export declare class SimpleRaycaster implements Disposable {
3130
- /** {@link Component.enabled} */
3131
- enabled: boolean;
3132
- /** The components instance to which this Raycaster belongs. */
3133
- components: Components;
3134
- /** {@link Disposable.onDisposed} */
3135
- readonly onDisposed: Event<unknown>;
3136
- /** The position of the mouse in the screen. */
3137
- readonly mouse: Mouse;
3164
+ export declare abstract class BaseCamera extends BaseWorldItem {
3138
3165
  /**
3139
- * A reference to the Three.js Raycaster instance.
3140
- * This is used for raycasting operations.
3166
+ * Whether the camera is enabled or not.
3141
3167
  */
3142
- readonly three: THREE.Raycaster;
3168
+ abstract enabled: boolean;
3143
3169
  /**
3144
- * A reference to the world instance to which this Raycaster belongs.
3145
- * This is used to access the camera and meshes.
3170
+ * The Three.js camera instance.
3146
3171
  */
3147
- world: World;
3148
- constructor(components: Components, world: World);
3172
+ abstract three: THREE.Camera;
3173
+ /**
3174
+ * Optional CameraControls instance for controlling the camera.
3175
+ * This property is only available if the camera is controllable.
3176
+ */
3177
+ abstract controls?: CameraControls;
3178
+ /**
3179
+ * Checks whether the instance is {@link CameraControllable}.
3180
+ *
3181
+ * @returns True if the instance is controllable, false otherwise.
3182
+ */
3183
+ hasCameraControls: () => this is CameraControllable;
3184
+ }
3185
+ import * as THREE from "three";
3186
+ import { Vector2 } from "three";
3187
+ import { Event } from "./event";
3188
+ import { BaseWorldItem } from "./base-world-item";
3189
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
3190
+ /**
3191
+ * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
3192
+ */
3193
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
3194
+ /**
3195
+ * The three.js WebGLRenderer instance associated with this renderer.
3196
+ *
3197
+ * @abstract
3198
+ * @type {THREE.WebGLRenderer}
3199
+ */
3200
+ abstract three: THREE.WebGLRenderer;
3201
+ /** {@link Updateable.onBeforeUpdate} */
3202
+ onAfterUpdate: Event<unknown>;
3203
+ /** {@link Updateable.onAfterUpdate} */
3204
+ onBeforeUpdate: Event<unknown>;
3205
+ /** {@link Disposable.onDisposed} */
3206
+ readonly onDisposed: Event<undefined>;
3207
+ /** {@link Resizeable.onResize} */
3208
+ readonly onResize: Event<THREE.Vector2>;
3209
+ /**
3210
+ * Event that fires when there has been a change to the list of clipping
3211
+ * planes used by the active renderer.
3212
+ */
3213
+ readonly onClippingPlanesUpdated: Event<unknown>;
3214
+ /** {@link Updateable.update} */
3215
+ abstract update(delta?: number): void | Promise<void>;
3149
3216
  /** {@link Disposable.dispose} */
3150
- dispose(): void;
3217
+ abstract dispose(): void;
3218
+ /** {@link Resizeable.getSize} */
3219
+ abstract getSize(): Vector2;
3220
+ /** {@link Resizeable.resize} */
3221
+ abstract resize(size: Vector2 | undefined): void;
3151
3222
  /**
3152
- * Throws a ray from the camera to the mouse or touch event point and returns
3153
- * the first item found. This also takes into account the clipping planes
3154
- * used by the renderer.
3223
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
3224
+ */
3225
+ clippingPlanes: THREE.Plane[];
3226
+ /**
3227
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
3155
3228
  *
3156
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3157
- * to query. If not provided, it will query all the meshes stored in
3158
- * {@link Components.meshes}.
3229
+ * @remarks
3230
+ * This method is typically called when there is a change to the list of clipping planes
3231
+ * used by the active renderer.
3159
3232
  */
3160
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3233
+ updateClippingPlanes(): void;
3161
3234
  /**
3162
- * Casts a ray from a given origin in a given direction and returns the first item found.
3163
- * This method also takes into account the clipping planes used by the renderer.
3235
+ * Sets or removes a clipping plane from the renderer.
3164
3236
  *
3165
- * @param origin - The origin of the ray.
3166
- * @param direction - The direction of the ray.
3167
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3168
- * @returns The first intersection found or 'null' if no intersection was found.
3237
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
3238
+ * @param plane - The clipping plane to be added or removed.
3239
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
3240
+ *
3241
+ * @remarks
3242
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
3243
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
3244
+ * If 'active' is 'false' and the plane is in the array, it is removed.
3245
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
3246
+ * excluding any planes marked as local.
3169
3247
  */
3170
- 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;
3171
- private intersect;
3172
- private filterClippingPlanes;
3248
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
3173
3249
  }
3174
3250
  import * as THREE from "three";
3175
- import { Disposable, Event } from "../../Types";
3251
+ import { Disposable } from "./interfaces";
3252
+ import { Event } from "./event";
3253
+ import { Components } from "../../Components";
3254
+ import { BaseWorldItem } from "./base-world-item";
3176
3255
  /**
3177
- * 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.
3256
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3178
3257
  */
3179
- export declare class Mouse implements Disposable {
3180
- dom: HTMLCanvasElement;
3181
- private _event?;
3182
- private _position;
3258
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3183
3259
  /** {@link Disposable.onDisposed} */
3184
3260
  readonly onDisposed: Event<unknown>;
3185
- constructor(dom: HTMLCanvasElement);
3186
3261
  /**
3187
- * The real position of the mouse of the Three.js canvas.
3262
+ * Abstract property representing the three.js object associated with this scene.
3263
+ * It should be implemented by subclasses.
3188
3264
  */
3189
- get position(): THREE.Vector2;
3265
+ abstract three: THREE.Object3D;
3266
+ protected constructor(components: Components);
3190
3267
  /** {@link Disposable.dispose} */
3191
3268
  dispose(): void;
3192
- private getPositionY;
3193
- private getPositionX;
3194
- private updateMouseInfo;
3195
- private setupEvents;
3196
3269
  }
3197
- import * as THREE from "three";
3198
- import { Hideable, Event, World, Disposable } from "../../Types";
3270
+ import { Base } from "./base";
3271
+ import { World } from "./world";
3272
+ import { Event } from "./event";
3199
3273
  import { Components } from "../../Components";
3200
3274
  /**
3201
- * Configuration interface for the {@link SimpleGrid} class.
3275
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
3202
3276
  */
3203
- export interface GridConfig {
3277
+ export declare abstract class BaseWorldItem extends Base {
3278
+ readonly worlds: Map<string, World>;
3204
3279
  /**
3205
- * The color of the grid lines.
3280
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
3281
+ * The event payload contains the world instance and the action ("added" or "removed").
3206
3282
  */
3207
- color: THREE.Color;
3283
+ readonly onWorldChanged: Event<{
3284
+ world: World;
3285
+ action: "added" | "removed";
3286
+ }>;
3208
3287
  /**
3209
- * The size of the primary grid lines.
3288
+ * The current world this item is associated with. It can be null if no world is currently active.
3210
3289
  */
3211
- size1: number;
3290
+ currentWorld: World | null;
3291
+ protected constructor(components: Components);
3292
+ }
3293
+ import { Event } from "./event";
3294
+ export declare class DataSet<T> extends Set<T> {
3295
+ readonly onItemAdded: Event<T>;
3296
+ readonly onItemDeleted: Event<unknown>;
3297
+ readonly onCleared: Event<unknown>;
3298
+ constructor(iterable?: Iterable<T> | null);
3299
+ clear(): void;
3300
+ add(value: T): this;
3301
+ delete(value: T): boolean;
3302
+ dispose(): void;
3303
+ }
3304
+ import * as THREE from "three";
3305
+ import { BaseScene } from "./base-scene";
3306
+ import { BaseCamera } from "./base-camera";
3307
+ import { BaseRenderer } from "./base-renderer";
3308
+ import { Updateable, Disposable } from "./interfaces";
3309
+ /**
3310
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3311
+ */
3312
+ export interface World extends Disposable, Updateable {
3212
3313
  /**
3213
- * The size of the secondary grid lines.
3314
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
3214
3315
  */
3215
- size2: number;
3316
+ meshes: Set<THREE.Mesh>;
3216
3317
  /**
3217
- * The distance at which the grid lines start to fade away.
3318
+ * The base scene of the world.
3218
3319
  */
3219
- distance: number;
3220
- }
3221
- /**
3222
- * 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).
3223
- */
3224
- export declare class SimpleGrid implements Hideable, Disposable {
3225
- /** {@link Disposable.onDisposed} */
3226
- readonly onDisposed: Event<unknown>;
3227
- /** The world instance to which this Raycaster belongs. */
3228
- world: World;
3229
- /** The components instance to which this grid belongs. */
3230
- components: Components;
3231
- /** {@link Hideable.visible} */
3232
- get visible(): boolean;
3233
- /** {@link Hideable.visible} */
3234
- set visible(visible: boolean);
3235
- /** The material of the grid. */
3236
- get material(): THREE.ShaderMaterial;
3320
+ scene: BaseScene;
3237
3321
  /**
3238
- * Whether the grid should fade away with distance. Recommended to be true for
3239
- * perspective cameras and false for orthographic cameras.
3322
+ * The base camera of the world.
3240
3323
  */
3241
- get fade(): boolean;
3324
+ camera: BaseCamera;
3242
3325
  /**
3243
- * Whether the grid should fade away with distance. Recommended to be true for
3244
- * perspective cameras and false for orthographic cameras.
3326
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3327
+ */
3328
+ renderer: BaseRenderer | null;
3329
+ /**
3330
+ * A unique identifier for the world.
3331
+ */
3332
+ uuid: string;
3333
+ /**
3334
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3245
3335
  */
3246
- set fade(active: boolean);
3247
- /** The Three.js mesh that contains the infinite grid. */
3248
- readonly three: THREE.Mesh;
3249
- private _fade;
3250
- constructor(components: Components, world: World, config: GridConfig);
3251
- /** {@link Disposable.dispose} */
3336
+ isDisposing: boolean;
3337
+ }
3338
+ import { Event } from "./event";
3339
+ export declare class DataMap<K, V> extends Map<K, V> {
3340
+ readonly onItemSet: Event<{
3341
+ key: K;
3342
+ value: V;
3343
+ }>;
3344
+ readonly onItemUpdated: Event<{
3345
+ key: K;
3346
+ value: V;
3347
+ }>;
3348
+ readonly onItemDeleted: Event<unknown>;
3349
+ readonly onCleared: Event<unknown>;
3350
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3351
+ clear(): void;
3352
+ set(key: K, value: V): this;
3353
+ delete(key: K): boolean;
3252
3354
  dispose(): void;
3253
- private setupEvents;
3254
- private updateZoom;
3255
3355
  }
3256
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3257
3356
  import { NavigationMode } from "./types";
3258
3357
  import { OrthoPerspectiveCamera } from "../index";
3259
3358
  /**
@@ -3286,26 +3385,6 @@ export declare class OrbitMode implements NavigationMode {
3286
3385
  set(active: boolean): void;
3287
3386
  private activateOrbitControls;
3288
3387
  }
3289
- import { NavigationMode } from "./types";
3290
- import { OrthoPerspectiveCamera } from "../index";
3291
- /**
3292
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3293
- */
3294
- export declare class PlanMode implements NavigationMode {
3295
- private camera;
3296
- /** {@link NavigationMode.enabled} */
3297
- enabled: boolean;
3298
- /** {@link NavigationMode.id} */
3299
- readonly id = "Plan";
3300
- private mouseAction1?;
3301
- private mouseAction2?;
3302
- private mouseInitialized;
3303
- private readonly defaultAzimuthSpeed;
3304
- private readonly defaultPolarSpeed;
3305
- constructor(camera: OrthoPerspectiveCamera);
3306
- /** {@link NavigationMode.set} */
3307
- set(active: boolean): void;
3308
- }
3309
3388
  import * as THREE from "three";
3310
3389
  import { CameraProjection } from "./types";
3311
3390
  import { Event } from "../../Types";
@@ -3351,131 +3430,6 @@ export declare class ProjectionManager {
3351
3430
  private getDistance;
3352
3431
  private setPerspectiveCamera;
3353
3432
  }
3354
- import * as THREE from "three";
3355
- import { Hideable, Disposable, Event, World } from "../../Types";
3356
- import { Components } from "../../Components";
3357
- /**
3358
- * Each of the clipping planes created by the clipper.
3359
- */
3360
- export declare class SimplePlane implements Disposable, Hideable {
3361
- /** Event that fires when the user starts dragging a clipping plane. */
3362
- readonly onDraggingStarted: Event<unknown>;
3363
- /** Event that fires when the user stops dragging a clipping plane. */
3364
- readonly onDraggingEnded: Event<unknown>;
3365
- /** {@link Disposable.onDisposed} */
3366
- readonly onDisposed: Event<unknown>;
3367
- /**
3368
- * The normal vector of the clipping plane.
3369
- */
3370
- readonly normal: THREE.Vector3;
3371
- /**
3372
- * The origin point of the clipping plane.
3373
- */
3374
- readonly origin: THREE.Vector3;
3375
- /**
3376
- * The THREE.js Plane object representing the clipping plane.
3377
- */
3378
- readonly three: THREE.Plane;
3379
- /** The components instance to which this plane belongs. */
3380
- components: Components;
3381
- /** The world instance to which this plane belongs. */
3382
- world: World;
3383
- /** A custom string to identify what this plane is used for. */
3384
- type: string;
3385
- protected readonly _helper: THREE.Object3D;
3386
- protected _visible: boolean;
3387
- protected _enabled: boolean;
3388
- private _controlsActive;
3389
- private readonly _arrowBoundBox;
3390
- private readonly _planeMesh;
3391
- private readonly _controls;
3392
- private readonly _hiddenMaterial;
3393
- /**
3394
- * Getter for the enabled state of the clipping plane.
3395
- * @returns {boolean} The current enabled state.
3396
- */
3397
- get enabled(): boolean;
3398
- /**
3399
- * Setter for the enabled state of the clipping plane.
3400
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3401
- * @param {boolean} state - The new enabled state.
3402
- */
3403
- set enabled(state: boolean);
3404
- /** {@link Hideable.visible } */
3405
- get visible(): boolean;
3406
- /** {@link Hideable.visible } */
3407
- set visible(state: boolean);
3408
- /** The meshes used for raycasting */
3409
- get meshes(): THREE.Mesh[];
3410
- /** The material of the clipping plane representation. */
3411
- get planeMaterial(): THREE.Material | THREE.Material[];
3412
- /** The material of the clipping plane representation. */
3413
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3414
- /** The size of the clipping plane representation. */
3415
- get size(): number;
3416
- /** Sets the size of the clipping plane representation. */
3417
- set size(size: number);
3418
- /**
3419
- * Getter for the helper object of the clipping plane.
3420
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3421
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3422
- *
3423
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3424
- */
3425
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3426
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3427
- /**
3428
- * Sets the clipping plane's normal and origin from the given normal and point.
3429
- * This method resets the clipping plane's state, updates the normal and origin,
3430
- * and positions the helper object accordingly.
3431
- *
3432
- * @param normal - The new normal vector for the clipping plane.
3433
- * @param point - The new origin point for the clipping plane.
3434
- *
3435
- * @returns {void}
3436
- */
3437
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3438
- /** {@link Updateable.update} */
3439
- update: () => void;
3440
- /** {@link Disposable.dispose} */
3441
- dispose(): void;
3442
- private reset;
3443
- protected toggleControls(state: boolean): void;
3444
- private newTransformControls;
3445
- private initializeControls;
3446
- private createArrowBoundingBox;
3447
- private changeDrag;
3448
- private notifyDraggingChanged;
3449
- private preventCameraMovement;
3450
- private newHelper;
3451
- private static newPlaneMesh;
3452
- }
3453
- /**
3454
- * The projection system of the camera.
3455
- */
3456
- export type CameraProjection = "Perspective" | "Orthographic";
3457
- /**
3458
- * The extensible list of supported navigation modes.
3459
- */
3460
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3461
- /**
3462
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3463
- */
3464
- export interface NavigationMode {
3465
- /** The unique ID of this navigation mode. */
3466
- id: NavModeID;
3467
- /**
3468
- * Enable or disable this navigation mode.
3469
- * When a new navigation mode is enabled, the previous navigation mode
3470
- * must be disabled.
3471
- *
3472
- * @param active - whether to enable or disable this mode.
3473
- * @param options - any additional data required to enable or disable it.
3474
- * */
3475
- set: (active: boolean, options?: any) => void;
3476
- /** Whether this navigation mode is active or not. */
3477
- enabled: boolean;
3478
- }
3479
3433
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3480
3434
  /**
3481
3435
  * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3487,6 +3441,21 @@ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3487
3441
  */
3488
3442
  propertiesSize: number;
3489
3443
  }
3444
+ import * as THREE from "three";
3445
+ import * as WEBIFC from "web-ifc";
3446
+ import * as FRAGS from "@thatopen/fragments";
3447
+ export declare class CivilReader {
3448
+ defLineMat: THREE.LineBasicMaterial;
3449
+ read(webIfc: WEBIFC.IfcAPI): {
3450
+ alignments: Map<number, FRAGS.Alignment>;
3451
+ coordinationMatrix: THREE.Matrix4;
3452
+ } | undefined;
3453
+ get(civilItems: any): {
3454
+ alignments: Map<number, FRAGS.Alignment>;
3455
+ coordinationMatrix: THREE.Matrix4;
3456
+ } | undefined;
3457
+ private getCurves;
3458
+ }
3490
3459
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3491
3460
  /**
3492
3461
  * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3503,21 +3472,6 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3503
3472
  */
3504
3473
  minAssetsSize: number;
3505
3474
  }
3506
- import * as THREE from "three";
3507
- import * as WEBIFC from "web-ifc";
3508
- import * as FRAGS from "@thatopen/fragments";
3509
- export declare class CivilReader {
3510
- defLineMat: THREE.LineBasicMaterial;
3511
- read(webIfc: WEBIFC.IfcAPI): {
3512
- alignments: Map<number, FRAGS.Alignment>;
3513
- coordinationMatrix: THREE.Matrix4;
3514
- } | undefined;
3515
- get(civilItems: any): {
3516
- alignments: Map<number, FRAGS.Alignment>;
3517
- coordinationMatrix: THREE.Matrix4;
3518
- } | undefined;
3519
- private getCurves;
3520
- }
3521
3475
  /**
3522
3476
  * 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.
3523
3477
  */
@@ -3547,10 +3501,51 @@ export interface StreamedAsset {
3547
3501
  color: number[];
3548
3502
  }[];
3549
3503
  }
3550
- import * as WEBIFC from "web-ifc";
3551
- export declare class IfcMetadataReader {
3552
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3553
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3504
+ import { NavigationMode } from "./types";
3505
+ import { OrthoPerspectiveCamera } from "../index";
3506
+ /**
3507
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3508
+ */
3509
+ export declare class PlanMode implements NavigationMode {
3510
+ private camera;
3511
+ /** {@link NavigationMode.enabled} */
3512
+ enabled: boolean;
3513
+ /** {@link NavigationMode.id} */
3514
+ readonly id = "Plan";
3515
+ private mouseAction1?;
3516
+ private mouseAction2?;
3517
+ private mouseInitialized;
3518
+ private readonly defaultAzimuthSpeed;
3519
+ private readonly defaultPolarSpeed;
3520
+ constructor(camera: OrthoPerspectiveCamera);
3521
+ /** {@link NavigationMode.set} */
3522
+ set(active: boolean): void;
3523
+ }
3524
+ /**
3525
+ * The projection system of the camera.
3526
+ */
3527
+ export type CameraProjection = "Perspective" | "Orthographic";
3528
+ /**
3529
+ * The extensible list of supported navigation modes.
3530
+ */
3531
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3532
+ /**
3533
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3534
+ */
3535
+ export interface NavigationMode {
3536
+ /** The unique ID of this navigation mode. */
3537
+ id: NavModeID;
3538
+ /**
3539
+ * Enable or disable this navigation mode.
3540
+ * When a new navigation mode is enabled, the previous navigation mode
3541
+ * must be disabled.
3542
+ *
3543
+ * @param active - whether to enable or disable this mode.
3544
+ * @param options - any additional data required to enable or disable it.
3545
+ * */
3546
+ set: (active: boolean, options?: any) => void;
3547
+ /** Whether this navigation mode is active or not. */
3548
+ enabled: boolean;
3554
3549
  }
3555
3550
  import * as WEBIFC from "web-ifc";
3556
3551
  import * as THREE from "three";
@@ -3562,6 +3557,11 @@ export declare class Units {
3562
3557
  private getLengthUnits;
3563
3558
  private getScaleMatrix;
3564
3559
  }
3560
+ import * as WEBIFC from "web-ifc";
3561
+ export declare class IfcMetadataReader {
3562
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3563
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3564
+ }
3565
3565
  export type RelationsMap = Map<number, Map<number, number[]>>;
3566
3566
  export interface ModelsRelationMap {
3567
3567
  [modelID: string]: RelationsMap;
@@ -3583,7 +3583,11 @@ export type InverseAttributes = [
3583
3583
  "Types",
3584
3584
  "Defines",
3585
3585
  "ContainedInStructure",
3586
- "ContainsElements"
3586
+ "ContainsElements",
3587
+ "HasControlElements",
3588
+ "AssignedToFlowElement",
3589
+ "ConnectedTo",
3590
+ "ConnectedFrom"
3587
3591
  ];
3588
3592
  export type InverseAttribute = InverseAttributes[number];
3589
3593
  import { BufferGeometry } from "three";