@thatopen/components 2.1.5 → 2.1.7

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,4 +1,91 @@
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
+ import { Component, Disposable, World, Event } from "../Types";
48
+ import { SimpleRaycaster } from "./src";
49
+ import { Components } from "../Components";
50
+ /**
51
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
52
+ */
53
+ export declare class Raycasters extends Component implements Disposable {
54
+ /**
55
+ * A unique identifier for the component.
56
+ * This UUID is used to register the component within the Components system.
57
+ */
58
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
59
+ /** {@link Component.enabled} */
60
+ enabled: boolean;
61
+ /**
62
+ * A Map that stores raycasters for each world.
63
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
64
+ */
65
+ list: Map<string, SimpleRaycaster>;
66
+ /** {@link Disposable.onDisposed} */
67
+ onDisposed: Event<unknown>;
68
+ constructor(components: Components);
69
+ /**
70
+ * Retrieves a SimpleRaycaster instance for the given world.
71
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
72
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
73
+ *
74
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
75
+ * @returns The SimpleRaycaster instance for the given world.
76
+ */
77
+ get(world: World): SimpleRaycaster;
78
+ /**
79
+ * Deletes the SimpleRaycaster instance associated with the given world.
80
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
81
+ *
82
+ * @param world - The world for which to delete the SimpleRaycaster instance.
83
+ * @returns {void}
84
+ */
85
+ delete(world: World): void;
86
+ /** {@link Disposable.dispose} */
87
+ dispose(): void;
88
+ }
2
89
  import { Component, Disposable, Event } from "../Types";
3
90
  /**
4
91
  * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
@@ -7,7 +94,7 @@ export declare class Components implements Disposable {
7
94
  /**
8
95
  * The version of the @thatopen/components library.
9
96
  */
10
- static readonly release = "2.1.5";
97
+ static readonly release = "2.1.7";
11
98
  /** {@link Disposable.onDisposed} */
12
99
  readonly onDisposed: Event<void>;
13
100
  /**
@@ -75,92 +162,72 @@ export declare class Components implements Disposable {
75
162
  private update;
76
163
  private static setupBVH;
77
164
  }
78
- import { Component, Disposable, World, Event } from "../Types";
79
- import { SimpleRaycaster } from "./src";
165
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
80
166
  import { Components } from "../Components";
167
+ import { SimpleWorld } from "./src";
81
168
  /**
82
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
169
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
83
170
  */
84
- export declare class Raycasters extends Component implements Disposable {
171
+ export declare class Worlds extends Component implements Updateable, Disposable {
85
172
  /**
86
173
  * A unique identifier for the component.
87
174
  * This UUID is used to register the component within the Components system.
88
175
  */
89
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
90
- /** {@link Component.enabled} */
91
- enabled: boolean;
176
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
177
+ /** {@link Updateable.onAfterUpdate} */
178
+ readonly onAfterUpdate: Event<unknown>;
179
+ /** {@link Updateable.onBeforeUpdate} */
180
+ readonly onBeforeUpdate: Event<unknown>;
181
+ /** {@link Disposable.onDisposed} */
182
+ readonly onDisposed: Event<unknown>;
92
183
  /**
93
- * A Map that stores raycasters for each world.
94
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
184
+ * An event that is triggered when a new world is created.
185
+ * The event passes the newly created world as a parameter.
95
186
  */
96
- list: Map<string, SimpleRaycaster>;
97
- /** {@link Disposable.onDisposed} */
98
- onDisposed: Event<unknown>;
99
- constructor(components: Components);
187
+ readonly onWorldCreated: Event<World>;
100
188
  /**
101
- * Retrieves a SimpleRaycaster instance for the given world.
102
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
103
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
104
- *
105
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
106
- * @returns The SimpleRaycaster instance for the given world.
189
+ * An event that is triggered when a world is deleted.
190
+ * The event passes the UUID of the deleted world as a parameter.
107
191
  */
108
- get(world: World): SimpleRaycaster;
192
+ readonly onWorldDeleted: Event<string>;
109
193
  /**
110
- * Deletes the SimpleRaycaster instance associated with the given world.
111
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
112
- *
113
- * @param world - The world for which to delete the SimpleRaycaster instance.
114
- * @returns {void}
194
+ * A collection of worlds managed by this component.
195
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
115
196
  */
116
- delete(world: World): void;
117
- /** {@link Disposable.dispose} */
118
- dispose(): void;
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;
197
+ list: Map<string, World>;
128
198
  /** {@link Component.enabled} */
129
199
  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
200
  constructor(components: Components);
136
201
  /**
137
- * Return the UUIDs of all disposed components.
202
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
203
+ *
204
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
205
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
206
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
207
+ *
208
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
138
209
  */
139
- get(): Set<string>;
210
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
140
211
  /**
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.
212
+ * Deletes a world from the list of worlds.
144
213
  *
145
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
146
- * to remove.
214
+ * @param {World} world - The world to be deleted.
147
215
  *
148
- * @param materials - whether to dispose the materials of the mesh.
216
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
149
217
  *
150
- * @param recursive - whether to recursively dispose the children of the mesh.
218
+ * @returns {void}
151
219
  */
152
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
220
+ delete(world: World): void;
153
221
  /**
154
- * Disposes a geometry from memory.
222
+ * Disposes of the Worlds component and all its managed worlds.
223
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
224
+ * and triggers the onDisposed event.
155
225
  *
156
- * @param geometry - the
157
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
158
- * to remove.
226
+ * @returns {void}
159
227
  */
160
- disposeGeometry(geometry: THREE.BufferGeometry): void;
161
- private disposeGeometryAndMaterials;
162
- private disposeChildren;
163
- private static disposeMaterial;
228
+ dispose(): void;
229
+ /** {@link Updateable.update} */
230
+ update(delta?: number): void | Promise<void>;
164
231
  }
165
232
  import { Component, Disposable, World, Event } from "../Types";
166
233
  import { GridConfig, SimpleGrid } from "./src";
@@ -211,73 +278,6 @@ export declare class Grids extends Component implements Disposable {
211
278
  /** {@link Disposable.dispose} */
212
279
  dispose(): void;
213
280
  }
214
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
215
- import { Components } from "../Components";
216
- import { SimpleWorld } from "./src";
217
- /**
218
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
219
- */
220
- export declare class Worlds extends Component implements Updateable, Disposable {
221
- /**
222
- * A unique identifier for the component.
223
- * This UUID is used to register the component within the Components system.
224
- */
225
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
226
- /** {@link Updateable.onAfterUpdate} */
227
- readonly onAfterUpdate: Event<unknown>;
228
- /** {@link Updateable.onBeforeUpdate} */
229
- readonly onBeforeUpdate: Event<unknown>;
230
- /** {@link Disposable.onDisposed} */
231
- readonly onDisposed: Event<unknown>;
232
- /**
233
- * An event that is triggered when a new world is created.
234
- * The event passes the newly created world as a parameter.
235
- */
236
- readonly onWorldCreated: Event<World>;
237
- /**
238
- * An event that is triggered when a world is deleted.
239
- * The event passes the UUID of the deleted world as a parameter.
240
- */
241
- readonly onWorldDeleted: Event<string>;
242
- /**
243
- * A collection of worlds managed by this component.
244
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
245
- */
246
- list: Map<string, World>;
247
- /** {@link Component.enabled} */
248
- enabled: boolean;
249
- constructor(components: Components);
250
- /**
251
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
252
- *
253
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
254
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
255
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
256
- *
257
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
258
- */
259
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
260
- /**
261
- * Deletes a world from the list of worlds.
262
- *
263
- * @param {World} world - The world to be deleted.
264
- *
265
- * @throws {Error} - Throws an error if the provided world is not found in the list.
266
- *
267
- * @returns {void}
268
- */
269
- delete(world: World): void;
270
- /**
271
- * Disposes of the Worlds component and all its managed worlds.
272
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
273
- * and triggers the onDisposed event.
274
- *
275
- * @returns {void}
276
- */
277
- dispose(): void;
278
- /** {@link Updateable.update} */
279
- update(delta?: number): void | Promise<void>;
280
- }
281
281
  import * as THREE from "three";
282
282
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
283
283
  import { SimplePlane } from "./src";
@@ -409,8 +409,142 @@ export declare class Clipper extends Component implements Createable, Disposable
409
409
  private _onStartDragging;
410
410
  private _onEndDragging;
411
411
  }
412
- import { Components } from "../Components";
413
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
412
+ import * as THREE from "three";
413
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
414
+ center: THREE.Vector3;
415
+ halfSizes: THREE.Vector3;
416
+ rotation: THREE.Matrix3;
417
+ transformation: THREE.Matrix4;
418
+ };
419
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
420
+ import * as THREE from "three";
421
+ export declare class MaterialsUtils {
422
+ static isTransparent(material: THREE.Material): boolean;
423
+ }
424
+ export declare class UUID {
425
+ private static _pattern;
426
+ private static _lut;
427
+ static create(): string;
428
+ static validate(uuid: string): void;
429
+ }
430
+ import * as THREE from "three";
431
+ import { Component, Components, Disposable, Event, World } from "../core";
432
+ /**
433
+ * Configuration interface for the VertexPicker component.
434
+ */
435
+ export interface VertexPickerConfig {
436
+ /**
437
+ * If true, only vertices will be picked, not the closest point on the face.
438
+ */
439
+ showOnlyVertex: boolean;
440
+ /**
441
+ * The maximum distance for snapping to a vertex.
442
+ */
443
+ snapDistance: number;
444
+ /**
445
+ * The HTML element to use for previewing the picked vertex.
446
+ */
447
+ previewElement: HTMLElement;
448
+ }
449
+ /**
450
+ * A class that provides functionality for picking vertices in a 3D scene.
451
+ */
452
+ export declare class VertexPicker extends Component implements Disposable {
453
+ /** {@link Disposable.onDisposed} */
454
+ readonly onDisposed: Event<unknown>;
455
+ /**
456
+ * An event that is triggered when a vertex is found.
457
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
458
+ */
459
+ readonly onVertexFound: Event<THREE.Vector3>;
460
+ /**
461
+ * An event that is triggered when a vertex is lost.
462
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
463
+ */
464
+ readonly onVertexLost: Event<THREE.Vector3>;
465
+ /**
466
+ * An event that is triggered when the picker is enabled or disabled
467
+ */
468
+ readonly onEnabled: Event<boolean>;
469
+ /**
470
+ * A reference to the Components instance associated with this VertexPicker.
471
+ */
472
+ components: Components;
473
+ /**
474
+ * A reference to the working plane used for vertex picking.
475
+ * This plane is used to determine which vertices are considered valid for picking.
476
+ * If this value is null, all vertices are considered valid.
477
+ */
478
+ workingPlane: THREE.Plane | null;
479
+ private _pickedPoint;
480
+ private _config;
481
+ private _enabled;
482
+ /**
483
+ * Sets the enabled state of the VertexPicker.
484
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
485
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
486
+ *
487
+ * @param value - The new enabled state.
488
+ */
489
+ set enabled(value: boolean);
490
+ /**
491
+ * Gets the current enabled state of the VertexPicker.
492
+ *
493
+ * @returns The current enabled state.
494
+ */
495
+ get enabled(): boolean;
496
+ /**
497
+ * Sets the configuration for the VertexPicker component.
498
+ *
499
+ * @param value - A Partial object containing the configuration properties to update.
500
+ * The properties not provided in the value object will retain their current values.
501
+ *
502
+ * @example
503
+ * '''typescript
504
+ * vertexPicker.config = {
505
+ * snapDistance: 0.5,
506
+ * showOnlyVertex: true,
507
+ * };
508
+ * '''
509
+ */
510
+ set config(value: Partial<VertexPickerConfig>);
511
+ /**
512
+ * Gets the current configuration for the VertexPicker component.
513
+ *
514
+ * @returns A copy of the current VertexPickerConfig object.
515
+ *
516
+ * @example
517
+ * '''typescript
518
+ * const currentConfig = vertexPicker.config;
519
+ * console.log(currentConfig.snapDistance); // Output: 0.25
520
+ * '''
521
+ */
522
+ get config(): Partial<VertexPickerConfig>;
523
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
524
+ /** {@link Disposable.dispose} */
525
+ dispose(): void;
526
+ /**
527
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
528
+ *
529
+ * @param world - The World instance to use for raycasting.
530
+ *
531
+ * @returns The current picked point, or null if no point is picked.
532
+ *
533
+ * @remarks
534
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
535
+ * If enabled, it performs raycasting to find the closest intersecting object.
536
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
537
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
538
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
539
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
540
+ */
541
+ get(world: World): THREE.Vector3 | null;
542
+ private getClosestVertex;
543
+ private getVertices;
544
+ private getVertex;
545
+ }
546
+ import { Components } from "../Components";
547
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
414
548
  import { Component, Event, Disposable, World } from "../Types";
415
549
  /**
416
550
  * 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).
@@ -568,101 +702,234 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
568
702
  private newOrthoCamera;
569
703
  private setOrthoPerspCameraAspect;
570
704
  }
705
+ import * as THREE from "three";
571
706
  import * as FRAGS from "@thatopen/fragments";
572
- import { Components, Component } from "../../core";
707
+ import { Disposable, Component, Event, Components } from "../../core";
573
708
  /**
574
- * 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).
709
+ * 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.
575
710
  */
576
- export declare class Hider extends Component {
711
+ export interface Classification {
712
+ /**
713
+ * A system within the classification.
714
+ * The key is the system name, and the value is an object representing the classes within the system.
715
+ */
716
+ [system: string]: {
717
+ /**
718
+ * A class within the system.
719
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
720
+ */
721
+ [className: string]: {
722
+ map: FRAGS.FragmentIdMap;
723
+ name: string;
724
+ id: number | null;
725
+ };
726
+ };
727
+ }
728
+ /**
729
+ * 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).
730
+ */
731
+ export declare class Classifier extends Component implements Disposable {
577
732
  /**
578
733
  * A unique identifier for the component.
579
734
  * This UUID is used to register the component within the Components system.
580
735
  */
581
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
736
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
582
737
  /** {@link Component.enabled} */
583
738
  enabled: boolean;
584
- constructor(components: Components);
585
- /**
586
- * Sets the visibility of fragments within the 3D scene.
587
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
588
- * If 'items' is provided, only the specified fragments will be affected.
589
- *
590
- * @param visible - The visibility state to set for the fragments.
591
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
592
- * If not provided, all fragments will be affected.
593
- *
594
- * @returns {void}
595
- */
596
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
597
739
  /**
598
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
599
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
600
- *
601
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
602
- * If not provided, all fragments will be isolated.
603
- *
604
- * @returns {void}
740
+ * A map representing the classification systems.
741
+ * The key is the system name, and the value is an object representing the classes within the system.
605
742
  */
606
- isolate(items: FRAGS.FragmentIdMap): void;
607
- private updateCulledVisibility;
608
- }
609
- import * as THREE from "three";
610
- import * as FRAGS from "@thatopen/fragments";
611
- import { FragmentsGroup } from "@thatopen/fragments";
612
- import { Component, Components, Disposable, Event } from "../../core";
613
- /**
614
- * 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).
615
- */
616
- export declare class BoundingBoxer extends Component implements Disposable {
617
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
618
- /** {@link Component.enabled} */
619
- enabled: boolean;
743
+ list: Classification;
620
744
  /** {@link Disposable.onDisposed} */
621
745
  readonly onDisposed: Event<unknown>;
622
- private _absoluteMin;
623
- private _absoluteMax;
624
- private _meshes;
625
746
  constructor(components: Components);
747
+ private onFragmentsDisposed;
748
+ /** {@link Disposable.dispose} */
749
+ dispose(): void;
626
750
  /**
627
- * A static method to calculate the dimensions of a given bounding box.
751
+ * Removes a fragment from the classification based on its unique identifier (guid).
752
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
628
753
  *
629
- * @param bbox - The bounding box to calculate the dimensions for.
630
- * @returns An object containing the width, height, depth, and center of the bounding box.
754
+ * @param guid - The unique identifier of the fragment to be removed.
631
755
  */
632
- static getDimensions(bbox: THREE.Box3): {
633
- width: number;
634
- height: number;
635
- depth: number;
636
- center: THREE.Vector3;
637
- };
756
+ remove(guid: string): void;
638
757
  /**
639
- * A static method to create a new bounding box boundary.
640
- *
641
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
642
- * @returns A new THREE.Vector3 representing the boundary.
758
+ * Finds and returns fragments based on the provided filter criteria.
759
+ * If no filter is provided, it returns all fragments.
643
760
  *
644
- * @remarks
645
- * This method is used to create a new boundary for calculating bounding boxes.
646
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
647
- * depending on the value of the 'positive' parameter.
761
+ * @param filter - An optional object containing filter criteria.
762
+ * The keys of the object represent the classification system names,
763
+ * and the values are arrays of class names to match.
648
764
  *
649
- * @example
650
- * '''typescript
651
- * const positiveBound = BoundingBoxer.newBound(true);
652
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
765
+ * @returns A map of fragment GUIDs to their respective express IDs,
766
+ * where the express IDs are filtered based on the provided filter criteria.
653
767
  *
654
- * const negativeBound = BoundingBoxer.newBound(false);
655
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
656
- * '''
768
+ * @throws Will throw an error if the fragments map is malformed.
657
769
  */
658
- static newBound(positive: boolean): THREE.Vector3;
770
+ find(filter?: {
771
+ [name: string]: string[];
772
+ }): FRAGS.FragmentIdMap;
659
773
  /**
660
- * A static method to calculate the bounding box of a set of points.
774
+ * Classifies fragments based on their modelID.
661
775
  *
662
- * @param points - An array of THREE.Vector3 representing the points.
663
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
664
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
665
- * @returns A THREE.Box3 representing the bounding box of the given points.
776
+ * @param modelID - The unique identifier of the model to classify fragments by.
777
+ * @param group - The FragmentsGroup containing the fragments to be classified.
778
+ *
779
+ * @remarks
780
+ * This method iterates through the fragments in the provided group,
781
+ * and classifies them based on their modelID.
782
+ * The classification is stored in the 'list.models' property,
783
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
784
+ *
785
+ */
786
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
787
+ /**
788
+ * Classifies fragments based on their PredefinedType property.
789
+ *
790
+ * @param group - The FragmentsGroup containing the fragments to be classified.
791
+ *
792
+ * @remarks
793
+ * This method iterates through the properties of the fragments in the provided group,
794
+ * and classifies them based on their PredefinedType property.
795
+ * The classification is stored in the 'list.predefinedTypes' property,
796
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
797
+ *
798
+ * @throws Will throw an error if the fragment ID is not found.
799
+ */
800
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
801
+ /**
802
+ * Classifies fragments based on their entity type.
803
+ *
804
+ * @param group - The FragmentsGroup containing the fragments to be classified.
805
+ *
806
+ * @remarks
807
+ * This method iterates through the relations of the fragments in the provided group,
808
+ * and classifies them based on their entity type.
809
+ * The classification is stored in the 'list.entities' property,
810
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
811
+ *
812
+ * @throws Will throw an error if the fragment ID is not found.
813
+ */
814
+ byEntity(group: FRAGS.FragmentsGroup): void;
815
+ /**
816
+ * Classifies fragments based on a specific IFC relationship.
817
+ *
818
+ * @param group - The FragmentsGroup containing the fragments to be classified.
819
+ * @param ifcRel - The IFC relationship number to classify fragments by.
820
+ * @param systemName - The name of the classification system to store the classification.
821
+ *
822
+ * @remarks
823
+ * This method iterates through the relations of the fragments in the provided group,
824
+ * and classifies them based on the specified IFC relationship.
825
+ * The classification is stored in the 'list' property under the specified system name,
826
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
827
+ *
828
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
829
+ */
830
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
831
+ /**
832
+ * Classifies fragments based on their spatial structure in the IFC model.
833
+ *
834
+ * @param model - The FragmentsGroup containing the fragments to be classified.
835
+ * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
836
+ *
837
+ * @remarks
838
+ * This method iterates through the relations of the fragments in the provided group,
839
+ * and classifies them based on their spatial structure in the IFC model.
840
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
841
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
842
+ *
843
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
844
+ */
845
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
846
+ useProperties: boolean;
847
+ }): Promise<void>;
848
+ /**
849
+ * Sets the color of the specified fragments.
850
+ *
851
+ * @param items - A map of fragment IDs to their respective express IDs.
852
+ * @param color - The color to set for the fragments.
853
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
854
+ *
855
+ * @remarks
856
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
857
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
858
+ *
859
+ * @throws Will throw an error if the fragment with the specified ID is not found.
860
+ */
861
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
862
+ /**
863
+ * Resets the color of the specified fragments to their original color.
864
+ *
865
+ * @param items - A map of fragment IDs to their respective express IDs.
866
+ *
867
+ * @remarks
868
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
869
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
870
+ *
871
+ * @throws Will throw an error if the fragment with the specified ID is not found.
872
+ */
873
+ resetColor(items: FRAGS.FragmentIdMap): void;
874
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
875
+ }
876
+ import * as THREE from "three";
877
+ import * as FRAGS from "@thatopen/fragments";
878
+ import { FragmentsGroup } from "@thatopen/fragments";
879
+ import { Component, Components, Disposable, Event } from "../../core";
880
+ /**
881
+ * 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).
882
+ */
883
+ export declare class BoundingBoxer extends Component implements Disposable {
884
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
885
+ /** {@link Component.enabled} */
886
+ enabled: boolean;
887
+ /** {@link Disposable.onDisposed} */
888
+ readonly onDisposed: Event<unknown>;
889
+ private _absoluteMin;
890
+ private _absoluteMax;
891
+ private _meshes;
892
+ constructor(components: Components);
893
+ /**
894
+ * A static method to calculate the dimensions of a given bounding box.
895
+ *
896
+ * @param bbox - The bounding box to calculate the dimensions for.
897
+ * @returns An object containing the width, height, depth, and center of the bounding box.
898
+ */
899
+ static getDimensions(bbox: THREE.Box3): {
900
+ width: number;
901
+ height: number;
902
+ depth: number;
903
+ center: THREE.Vector3;
904
+ };
905
+ /**
906
+ * A static method to create a new bounding box boundary.
907
+ *
908
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
909
+ * @returns A new THREE.Vector3 representing the boundary.
910
+ *
911
+ * @remarks
912
+ * This method is used to create a new boundary for calculating bounding boxes.
913
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
914
+ * depending on the value of the 'positive' parameter.
915
+ *
916
+ * @example
917
+ * '''typescript
918
+ * const positiveBound = BoundingBoxer.newBound(true);
919
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
920
+ *
921
+ * const negativeBound = BoundingBoxer.newBound(false);
922
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
923
+ * '''
924
+ */
925
+ static newBound(positive: boolean): THREE.Vector3;
926
+ /**
927
+ * A static method to calculate the bounding box of a set of points.
928
+ *
929
+ * @param points - An array of THREE.Vector3 representing the points.
930
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
931
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
932
+ * @returns A THREE.Box3 representing the bounding box of the given points.
666
933
  *
667
934
  * @remarks
668
935
  * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
@@ -814,226 +1081,93 @@ export declare class BoundingBoxer extends Component implements Disposable {
814
1081
  addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
815
1082
  private static getFragmentBounds;
816
1083
  }
817
- import * as THREE from "three";
818
- import * as FRAGS from "@thatopen/fragments";
819
- import { Disposable, Component, Event, Components } from "../../core";
820
- /**
821
- * 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.
822
- */
823
- export interface Classification {
824
- /**
825
- * A system within the classification.
826
- * The key is the system name, and the value is an object representing the classes within the system.
827
- */
828
- [system: string]: {
829
- /**
830
- * A class within the system.
831
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
832
- */
833
- [className: string]: {
834
- map: FRAGS.FragmentIdMap;
835
- name: string;
836
- id: number | null;
837
- };
838
- };
839
- }
1084
+ import { Component, Disposable, Event, Components } from "../../core";
840
1085
  /**
841
- * 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).
1086
+ * 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).
842
1087
  */
843
- export declare class Classifier extends Component implements Disposable {
1088
+ export declare class Exploder extends Component implements Disposable {
844
1089
  /**
845
1090
  * A unique identifier for the component.
846
1091
  * This UUID is used to register the component within the Components system.
847
1092
  */
848
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1093
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1094
+ /** {@link Disposable.onDisposed} */
1095
+ readonly onDisposed: Event<unknown>;
849
1096
  /** {@link Component.enabled} */
850
1097
  enabled: boolean;
851
1098
  /**
852
- * A map representing the classification systems.
853
- * The key is the system name, and the value is an object representing the classes within the system.
1099
+ * The height of the explosion animation.
1100
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1101
+ * Default value is 10.
854
1102
  */
855
- list: Classification;
856
- /** {@link Disposable.onDisposed} */
857
- readonly onDisposed: Event<unknown>;
858
- constructor(components: Components);
859
- private onFragmentsDisposed;
860
- /** {@link Disposable.dispose} */
861
- dispose(): void;
1103
+ height: number;
862
1104
  /**
863
- * Removes a fragment from the classification based on its unique identifier (guid).
864
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
865
- *
866
- * @param guid - The unique identifier of the fragment to be removed.
1105
+ * The group name used for the explosion animation.
1106
+ * This property specifies the group of fragments that will be affected by the explosion.
1107
+ * Default value is "storeys".
867
1108
  */
868
- remove(guid: string): void;
1109
+ groupName: string;
869
1110
  /**
870
- * Finds and returns fragments based on the provided filter criteria.
871
- * If no filter is provided, it returns all fragments.
872
- *
873
- * @param filter - An optional object containing filter criteria.
874
- * The keys of the object represent the classification system names,
875
- * and the values are arrays of class names to match.
876
- *
877
- * @returns A map of fragment GUIDs to their respective express IDs,
878
- * where the express IDs are filtered based on the provided filter criteria.
879
- *
880
- * @throws Will throw an error if the fragments map is malformed.
1111
+ * A set of strings representing the exploded items.
1112
+ * This set is used to keep track of which items have been exploded.
881
1113
  */
882
- find(filter?: {
883
- [name: string]: string[];
884
- }): FRAGS.FragmentIdMap;
1114
+ list: Set<string>;
1115
+ constructor(components: Components);
1116
+ /** {@link Disposable.dispose} */
1117
+ dispose(): void;
885
1118
  /**
886
- * Classifies fragments based on their modelID.
1119
+ * Sets the explosion state of the fragments.
887
1120
  *
888
- * @param modelID - The unique identifier of the model to classify fragments by.
889
- * @param group - The FragmentsGroup containing the fragments to be classified.
1121
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
890
1122
  *
891
1123
  * @remarks
892
- * This method iterates through the fragments in the provided group,
893
- * and classifies them based on their modelID.
894
- * The classification is stored in the 'list.models' property,
895
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
896
- *
897
- */
898
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
899
- /**
900
- * Classifies fragments based on their PredefinedType property.
901
- *
902
- * @param group - The FragmentsGroup containing the fragments to be classified.
1124
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1125
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1126
+ * If 'active' is false, the fragments are moved back to their original position.
903
1127
  *
904
- * @remarks
905
- * This method iterates through the properties of the fragments in the provided group,
906
- * and classifies them based on their PredefinedType property.
907
- * The classification is stored in the 'list.predefinedTypes' property,
908
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1128
+ * The method also keeps track of the exploded items using the 'list' set.
909
1129
  *
910
- * @throws Will throw an error if the fragment ID is not found.
1130
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
911
1131
  */
912
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
913
- /**
914
- * Classifies fragments based on their entity type.
915
- *
916
- * @param group - The FragmentsGroup containing the fragments to be classified.
917
- *
918
- * @remarks
919
- * This method iterates through the relations of the fragments in the provided group,
920
- * and classifies them based on their entity type.
921
- * The classification is stored in the 'list.entities' property,
922
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
923
- *
924
- * @throws Will throw an error if the fragment ID is not found.
925
- */
926
- byEntity(group: FRAGS.FragmentsGroup): void;
927
- /**
928
- * Classifies fragments based on a specific IFC relationship.
929
- *
930
- * @param group - The FragmentsGroup containing the fragments to be classified.
931
- * @param ifcRel - The IFC relationship number to classify fragments by.
932
- * @param systemName - The name of the classification system to store the classification.
933
- *
934
- * @remarks
935
- * This method iterates through the relations of the fragments in the provided group,
936
- * and classifies them based on the specified IFC relationship.
937
- * The classification is stored in the 'list' property under the specified system name,
938
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
939
- *
940
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
941
- */
942
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
943
- /**
944
- * Classifies fragments based on their spatial structure in the IFC model.
945
- *
946
- * @param model - The FragmentsGroup containing the fragments to be classified.
947
- * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
948
- *
949
- * @remarks
950
- * This method iterates through the relations of the fragments in the provided group,
951
- * and classifies them based on their spatial structure in the IFC model.
952
- * The classification is stored in the 'list' property under the system name "spatialStructures",
953
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
954
- *
955
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
956
- */
957
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
958
- useProperties: boolean;
959
- }): Promise<void>;
960
- /**
961
- * Sets the color of the specified fragments.
962
- *
963
- * @param items - A map of fragment IDs to their respective express IDs.
964
- * @param color - The color to set for the fragments.
965
- * @param override - A boolean indicating whether to override the existing color of the fragments.
966
- *
967
- * @remarks
968
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
969
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
970
- *
971
- * @throws Will throw an error if the fragment with the specified ID is not found.
972
- */
973
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
974
- /**
975
- * Resets the color of the specified fragments to their original color.
976
- *
977
- * @param items - A map of fragment IDs to their respective express IDs.
978
- *
979
- * @remarks
980
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
981
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
982
- *
983
- * @throws Will throw an error if the fragment with the specified ID is not found.
984
- */
985
- resetColor(items: FRAGS.FragmentIdMap): void;
986
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1132
+ set(active: boolean): void;
987
1133
  }
988
- import { Component, Disposable, Event, Components } from "../../core";
1134
+ import * as FRAGS from "@thatopen/fragments";
1135
+ import { Components, Component } from "../../core";
989
1136
  /**
990
- * 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).
1137
+ * 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).
991
1138
  */
992
- export declare class Exploder extends Component implements Disposable {
1139
+ export declare class Hider extends Component {
993
1140
  /**
994
1141
  * A unique identifier for the component.
995
1142
  * This UUID is used to register the component within the Components system.
996
1143
  */
997
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
998
- /** {@link Disposable.onDisposed} */
999
- readonly onDisposed: Event<unknown>;
1144
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1000
1145
  /** {@link Component.enabled} */
1001
1146
  enabled: boolean;
1002
- /**
1003
- * The height of the explosion animation.
1004
- * This property determines the vertical distance by which fragments are moved during the explosion.
1005
- * Default value is 10.
1006
- */
1007
- height: number;
1008
- /**
1009
- * The group name used for the explosion animation.
1010
- * This property specifies the group of fragments that will be affected by the explosion.
1011
- * Default value is "storeys".
1012
- */
1013
- groupName: string;
1014
- /**
1015
- * A set of strings representing the exploded items.
1016
- * This set is used to keep track of which items have been exploded.
1017
- */
1018
- list: Set<string>;
1019
1147
  constructor(components: Components);
1020
- /** {@link Disposable.dispose} */
1021
- dispose(): void;
1022
1148
  /**
1023
- * Sets the explosion state of the fragments.
1149
+ * Sets the visibility of fragments within the 3D scene.
1150
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1151
+ * If 'items' is provided, only the specified fragments will be affected.
1024
1152
  *
1025
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1153
+ * @param visible - The visibility state to set for the fragments.
1154
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1155
+ * If not provided, all fragments will be affected.
1026
1156
  *
1027
- * @remarks
1028
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1029
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1030
- * If 'active' is false, the fragments are moved back to their original position.
1157
+ * @returns {void}
1158
+ */
1159
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1160
+ /**
1161
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1162
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1031
1163
  *
1032
- * The method also keeps track of the exploded items using the 'list' set.
1164
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1165
+ * If not provided, all fragments will be isolated.
1033
1166
  *
1034
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1167
+ * @returns {void}
1035
1168
  */
1036
- set(active: boolean): void;
1169
+ isolate(items: FRAGS.FragmentIdMap): void;
1170
+ private updateCulledVisibility;
1037
1171
  }
1038
1172
  import * as WEBIFC from "web-ifc";
1039
1173
  import * as FRAGS from "@thatopen/fragments";
@@ -1260,6 +1394,21 @@ export declare class FragmentsManager extends Component implements Disposable {
1260
1394
  * If not provided, all models are used.
1261
1395
  */
1262
1396
  coordinate(models?: FragmentsGroup[]): void;
1397
+ /**
1398
+ * Applies the base coordinate system to the provided object.
1399
+ *
1400
+ * This function takes an object and its original coordinate system as input.
1401
+ * It then inverts the original coordinate system and applies the base coordinate system
1402
+ * to the object. This ensures that the object's position, rotation, and scale are
1403
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
1404
+ *
1405
+ * @param object - The object to which the base coordinate system will be applied.
1406
+ * This should be an instance of THREE.Object3D.
1407
+ *
1408
+ * @param originalCoordinateSystem - The original coordinate system of the object.
1409
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
1410
+ */
1411
+ applyBaseCoordinateSystem(object: THREE.Object3D, originalCoordinateSystem: THREE.Matrix4): void;
1263
1412
  }
1264
1413
  import * as WEBIFC from "web-ifc";
1265
1414
  import { Components, Disposable, Event, Component } from "../../core";
@@ -1424,334 +1573,96 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
1424
1573
  private streamAllProperties;
1425
1574
  private cleanUp;
1426
1575
  }
1427
- import * as THREE from "three";
1428
- import * as FRAGS from "@thatopen/fragments";
1576
+ import * as WEBIFC from "web-ifc";
1577
+ import * as FRAG from "@thatopen/fragments";
1429
1578
  import { Component, Components } from "../../core";
1430
1579
  /**
1431
- * Represents an edge measurement result.
1580
+ * 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).
1432
1581
  */
1433
- export interface MeasureEdge {
1582
+ export declare class IfcJsonExporter extends Component {
1434
1583
  /**
1435
- * The distance between the two points of the edge.
1584
+ * A unique identifier for the component.
1585
+ * This UUID is used to register the component within the Components system.
1436
1586
  */
1437
- distance: number;
1587
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1588
+ /** {@link Component.enabled} */
1589
+ enabled: boolean;
1590
+ constructor(components: Components);
1438
1591
  /**
1439
- * The two points that define the edge.
1592
+ * Exports all the properties of an IFC into an array of JS objects.
1593
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1594
+ * @param modelID ID of the IFC model whose properties to extract.
1595
+ * @param indirect whether to get the indirect relationships as well.
1596
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1597
+ * to make the location data available (e.g. absolute position of building).
1440
1598
  */
1441
- points: THREE.Vector3[];
1599
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1442
1600
  }
1601
+ import * as WEBIFC from "web-ifc";
1602
+ import { FragmentsGroup } from "@thatopen/fragments";
1603
+ import { Disposable, Event, Component, Components } from "../../core";
1604
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1605
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1443
1606
  /**
1444
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1607
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1445
1608
  */
1446
- export declare class MeasurementUtils extends Component {
1609
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1447
1610
  /**
1448
1611
  * A unique identifier for the component.
1449
1612
  * This UUID is used to register the component within the Components system.
1450
1613
  */
1451
- static uuid: string;
1452
- /** {@link Component.enabled} */
1453
- enabled: boolean;
1454
- constructor(components: Components);
1614
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1615
+ /** {@link Disposable.onDisposed} */
1616
+ readonly onDisposed: Event<string>;
1455
1617
  /**
1456
- * Utility method to calculate the distance from a point to a line segment.
1618
+ * Event triggered when relations for a model have been indexed.
1619
+ * This event provides the model's UUID and the relations map generated for that model.
1457
1620
  *
1458
- * @param point - The point from which to calculate the distance.
1459
- * @param lineStart - The start point of the line segment.
1460
- * @param lineEnd - The end point of the line segment.
1461
- * @param clamp - If true, the distance will be clamped to the line segment's length.
1462
- * @returns The distance from the point to the line segment.
1621
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
1622
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1623
+ * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1463
1624
  */
1464
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1625
+ readonly onRelationsIndexed: Event<{
1626
+ modelID: string;
1627
+ relationsMap: RelationsMap;
1628
+ }>;
1465
1629
  /**
1466
- * Method to get the face of a mesh that contains a given triangle index.
1467
- * It also returns the edges of the found face and their indices.
1468
- *
1469
- * @param mesh - The mesh to get the face from. It must be indexed.
1470
- * @param triangleIndex - The index of the triangle within the mesh.
1471
- * @param instance - The instance of the mesh (optional).
1472
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1630
+ * Holds the relationship mappings for each model processed by the indexer.
1631
+ * The structure is a map where each key is a model's UUID, and the value is another map.
1632
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1633
+ * representing a specific relation type, and the value is an array of expressIDs of entities
1634
+ * that are related through that relation type. This structure allows for efficient querying
1635
+ * of entity relationships within a model.
1473
1636
  */
1474
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1475
- edges: MeasureEdge[];
1476
- indices: Set<number>;
1477
- } | null;
1637
+ readonly relationMaps: ModelsRelationMap;
1638
+ /** {@link Component.enabled} */
1639
+ enabled: boolean;
1640
+ private _relToAttributesMap;
1641
+ private _inverseAttributes;
1642
+ private _ifcRels;
1643
+ constructor(components: Components);
1644
+ private onFragmentsDisposed;
1645
+ private indexRelations;
1646
+ private getAttributeIndex;
1478
1647
  /**
1479
- * Method to get the vertices and normal of a mesh face at a given index.
1480
- * It also applies instance transformation if provided.
1648
+ * Adds a relation map to the model's relations map.
1481
1649
  *
1482
- * @param mesh - The mesh to get the face from. It must be indexed.
1483
- * @param faceIndex - The index of the face within the mesh.
1484
- * @param instance - The instance of the mesh (optional).
1485
- * @returns An object containing the vertices and normal of the face.
1486
- * @throws Will throw an error if the geometry is not indexed.
1487
- */
1488
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1489
- p1: THREE.Vector3;
1490
- p2: THREE.Vector3;
1491
- p3: THREE.Vector3;
1492
- faceNormal: THREE.Vector3;
1493
- };
1494
- /**
1495
- * Method to round the vector's components to a specified number of decimal places.
1496
- * This is used to ensure numerical precision in edge detection.
1650
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1651
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1497
1652
  *
1498
- * @param vector - The vector to round.
1499
- * @returns The vector with rounded components.
1653
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1500
1654
  */
1501
- round(vector: THREE.Vector3): void;
1655
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1502
1656
  /**
1503
- * Calculates the volume of a set of fragments.
1657
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1658
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1659
+ * and maps them in a structured way to facilitate quick access to related entities.
1504
1660
  *
1505
- * @param frags - A map of fragment IDs to their corresponding item IDs.
1506
- * @returns The total volume of the fragments and the bounding sphere.
1507
- *
1508
- * @remarks
1509
- * This method creates a set of instanced meshes from the given fragments and item IDs.
1510
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1511
- *
1512
- * @throws Will throw an error if the geometry of the meshes is not indexed.
1513
- * @throws Will throw an error if the fragment manager is not available.
1514
- */
1515
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
1516
- /**
1517
- * Calculates the total volume of a set of meshes.
1518
- *
1519
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
1520
- * @returns The total volume of the meshes and the bounding sphere.
1521
- *
1522
- * @remarks
1523
- * This method calculates the volume of each mesh in the provided array and returns the total volume
1524
- * and its bounding sphere.
1525
- *
1526
- */
1527
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
1528
- private getFaceData;
1529
- private getVolumeOfMesh;
1530
- private getSignedVolumeOfTriangle;
1531
- }
1532
- import * as THREE from "three";
1533
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1534
- center: THREE.Vector3;
1535
- halfSizes: THREE.Vector3;
1536
- rotation: THREE.Matrix3;
1537
- transformation: THREE.Matrix4;
1538
- };
1539
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1540
- import * as THREE from "three";
1541
- export declare class MaterialsUtils {
1542
- static isTransparent(material: THREE.Material): boolean;
1543
- }
1544
- export declare class UUID {
1545
- private static _pattern;
1546
- private static _lut;
1547
- static create(): string;
1548
- static validate(uuid: string): void;
1549
- }
1550
- import * as THREE from "three";
1551
- import { Component, Components, Disposable, Event, World } from "../core";
1552
- /**
1553
- * Configuration interface for the VertexPicker component.
1554
- */
1555
- export interface VertexPickerConfig {
1556
- /**
1557
- * If true, only vertices will be picked, not the closest point on the face.
1558
- */
1559
- showOnlyVertex: boolean;
1560
- /**
1561
- * The maximum distance for snapping to a vertex.
1562
- */
1563
- snapDistance: number;
1564
- /**
1565
- * The HTML element to use for previewing the picked vertex.
1566
- */
1567
- previewElement: HTMLElement;
1568
- }
1569
- /**
1570
- * A class that provides functionality for picking vertices in a 3D scene.
1571
- */
1572
- export declare class VertexPicker extends Component implements Disposable {
1573
- /** {@link Disposable.onDisposed} */
1574
- readonly onDisposed: Event<unknown>;
1575
- /**
1576
- * An event that is triggered when a vertex is found.
1577
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1578
- */
1579
- readonly onVertexFound: Event<THREE.Vector3>;
1580
- /**
1581
- * An event that is triggered when a vertex is lost.
1582
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1583
- */
1584
- readonly onVertexLost: Event<THREE.Vector3>;
1585
- /**
1586
- * An event that is triggered when the picker is enabled or disabled
1587
- */
1588
- readonly onEnabled: Event<boolean>;
1589
- /**
1590
- * A reference to the Components instance associated with this VertexPicker.
1591
- */
1592
- components: Components;
1593
- /**
1594
- * A reference to the working plane used for vertex picking.
1595
- * This plane is used to determine which vertices are considered valid for picking.
1596
- * If this value is null, all vertices are considered valid.
1597
- */
1598
- workingPlane: THREE.Plane | null;
1599
- private _pickedPoint;
1600
- private _config;
1601
- private _enabled;
1602
- /**
1603
- * Sets the enabled state of the VertexPicker.
1604
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1605
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1606
- *
1607
- * @param value - The new enabled state.
1608
- */
1609
- set enabled(value: boolean);
1610
- /**
1611
- * Gets the current enabled state of the VertexPicker.
1612
- *
1613
- * @returns The current enabled state.
1614
- */
1615
- get enabled(): boolean;
1616
- /**
1617
- * Sets the configuration for the VertexPicker component.
1618
- *
1619
- * @param value - A Partial object containing the configuration properties to update.
1620
- * The properties not provided in the value object will retain their current values.
1621
- *
1622
- * @example
1623
- * '''typescript
1624
- * vertexPicker.config = {
1625
- * snapDistance: 0.5,
1626
- * showOnlyVertex: true,
1627
- * };
1628
- * '''
1629
- */
1630
- set config(value: Partial<VertexPickerConfig>);
1631
- /**
1632
- * Gets the current configuration for the VertexPicker component.
1633
- *
1634
- * @returns A copy of the current VertexPickerConfig object.
1635
- *
1636
- * @example
1637
- * '''typescript
1638
- * const currentConfig = vertexPicker.config;
1639
- * console.log(currentConfig.snapDistance); // Output: 0.25
1640
- * '''
1641
- */
1642
- get config(): Partial<VertexPickerConfig>;
1643
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1644
- /** {@link Disposable.dispose} */
1645
- dispose(): void;
1646
- /**
1647
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1648
- *
1649
- * @param world - The World instance to use for raycasting.
1650
- *
1651
- * @returns The current picked point, or null if no point is picked.
1652
- *
1653
- * @remarks
1654
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1655
- * If enabled, it performs raycasting to find the closest intersecting object.
1656
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1657
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1658
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1659
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1660
- */
1661
- get(world: World): THREE.Vector3 | null;
1662
- private getClosestVertex;
1663
- private getVertices;
1664
- private getVertex;
1665
- }
1666
- import * as WEBIFC from "web-ifc";
1667
- import * as FRAG from "@thatopen/fragments";
1668
- import { Component, Components } from "../../core";
1669
- /**
1670
- * 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).
1671
- */
1672
- export declare class IfcJsonExporter extends Component {
1673
- /**
1674
- * A unique identifier for the component.
1675
- * This UUID is used to register the component within the Components system.
1676
- */
1677
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1678
- /** {@link Component.enabled} */
1679
- enabled: boolean;
1680
- constructor(components: Components);
1681
- /**
1682
- * Exports all the properties of an IFC into an array of JS objects.
1683
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1684
- * @param modelID ID of the IFC model whose properties to extract.
1685
- * @param indirect whether to get the indirect relationships as well.
1686
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1687
- * to make the location data available (e.g. absolute position of building).
1688
- */
1689
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1690
- }
1691
- import * as WEBIFC from "web-ifc";
1692
- import { FragmentsGroup } from "@thatopen/fragments";
1693
- import { Disposable, Event, Component, Components } from "../../core";
1694
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1695
- export type { InverseAttribute, RelationsMap } from "./src/types";
1696
- /**
1697
- * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1698
- */
1699
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1700
- /**
1701
- * A unique identifier for the component.
1702
- * This UUID is used to register the component within the Components system.
1703
- */
1704
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1705
- /** {@link Disposable.onDisposed} */
1706
- readonly onDisposed: Event<string>;
1707
- /**
1708
- * Event triggered when relations for a model have been indexed.
1709
- * This event provides the model's UUID and the relations map generated for that model.
1710
- *
1711
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1712
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1713
- * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1714
- */
1715
- readonly onRelationsIndexed: Event<{
1716
- modelID: string;
1717
- relationsMap: RelationsMap;
1718
- }>;
1719
- /**
1720
- * Holds the relationship mappings for each model processed by the indexer.
1721
- * The structure is a map where each key is a model's UUID, and the value is another map.
1722
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1723
- * representing a specific relation type, and the value is an array of expressIDs of entities
1724
- * that are related through that relation type. This structure allows for efficient querying
1725
- * of entity relationships within a model.
1726
- */
1727
- readonly relationMaps: ModelsRelationMap;
1728
- /** {@link Component.enabled} */
1729
- enabled: boolean;
1730
- private _relToAttributesMap;
1731
- private _inverseAttributes;
1732
- private _ifcRels;
1733
- constructor(components: Components);
1734
- private onFragmentsDisposed;
1735
- private indexRelations;
1736
- /**
1737
- * Adds a relation map to the model's relations map.
1738
- *
1739
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1740
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1741
- *
1742
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1743
- */
1744
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1745
- /**
1746
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1747
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1748
- * and maps them in a structured way to facilitate quick access to related entities.
1749
- *
1750
- * The process involves querying the model for each relation type associated with the inverse attributes
1751
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1752
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1753
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1754
- * of entities that are related through that attribute.
1661
+ * The process involves querying the model for each relation type associated with the inverse attributes
1662
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1663
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
1664
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1665
+ * of entities that are related through that attribute.
1755
1666
  *
1756
1667
  * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1757
1668
  * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
@@ -1828,16 +1739,27 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
1828
1739
  getRelationsMapFromJSON(json: string): RelationsMap;
1829
1740
  /** {@link Disposable.dispose} */
1830
1741
  dispose(): void;
1742
+ /**
1743
+ * Adds relations between an entity and other entities in a BIM model.
1744
+ *
1745
+ * @param model - The BIM model to which the relations will be added.
1746
+ * @param expressID - The expressID of the entity within the model.
1747
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1748
+ * @param relIDs - The expressIDs of the related entities within the model.
1749
+ *
1750
+ * @throws An error if the relation name is not a valid relation name.
1751
+ */
1752
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1831
1753
  /**
1832
1754
  * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1833
1755
  *
1834
1756
  * @param model The BIM model whose children to get.
1835
- * @param id The expressID of the item whose children to get.
1757
+ * @param expressID The expressID of the item whose children to get.
1836
1758
  * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1837
1759
  *
1838
1760
  * @returns A 'Set' with the expressIDs of the found items.
1839
1761
  */
1840
- getElementsChildren(model: FragmentsGroup, id: number, found?: Set<number>): Set<number>;
1762
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1841
1763
  }
1842
1764
  import * as WEBIFC from "web-ifc";
1843
1765
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1959,7 +1881,7 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1959
1881
  * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1960
1882
  * The rest of the properties will be set as the properties of the entity.
1961
1883
  *
1962
- * @returns {Promise<void>} A promise that resolves when all the properties have been set.
1884
+ * @returns A promise that resolves when all the properties have been set.
1963
1885
  *
1964
1886
  * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1965
1887
  */
@@ -1986,7 +1908,7 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1986
1908
  * @param model - The FragmentsGroup model from which to remove the Pset.
1987
1909
  * @param psetID - The express IDs of the Psets to be removed.
1988
1910
  *
1989
- * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
1911
+ * @returns A promise that resolves when all the Psets have been removed.
1990
1912
  *
1991
1913
  * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1992
1914
  * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
@@ -2042,13 +1964,13 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2042
1964
  * @param psetID - The express ID of the Pset from which to remove the property.
2043
1965
  * @param propID - The express ID of the property to be removed.
2044
1966
  *
2045
- * @returns {Promise<void>} A promise that resolves when the property has been removed.
1967
+ * @returns A promise that resolves when the property has been removed.
2046
1968
  *
2047
1969
  * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
2048
1970
  * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
2049
1971
  */
2050
1972
  removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
2051
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
1973
+ addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
2052
1974
  /**
2053
1975
  * Adds elements to a Property Set (Pset) in the given model.
2054
1976
  *
@@ -2056,7 +1978,7 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2056
1978
  * @param psetID - The express ID of the Pset to which to add the elements.
2057
1979
  * @param elementID - The express IDs of the elements to be added.
2058
1980
  *
2059
- * @returns {Promise<void>} A promise that resolves when all the elements have been added.
1981
+ * @returns A promise that resolves when all the elements have been added.
2060
1982
  *
2061
1983
  * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
2062
1984
  * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
@@ -2095,10 +2017,152 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2095
2017
  private registerChange;
2096
2018
  private newSingleProperty;
2097
2019
  }
2098
- /**
2099
- * A Set of unique numbers representing different types of IFC geometries.
2100
- */
2101
- export declare const GeometryTypes: Set<number>;
2020
+ import * as THREE from "three";
2021
+ import * as FRAGS from "@thatopen/fragments";
2022
+ import { Component, Components } from "../../core";
2023
+ /**
2024
+ * Represents an edge measurement result.
2025
+ */
2026
+ export interface MeasureEdge {
2027
+ /**
2028
+ * The distance between the two points of the edge.
2029
+ */
2030
+ distance: number;
2031
+ /**
2032
+ * The two points that define the edge.
2033
+ */
2034
+ points: THREE.Vector3[];
2035
+ }
2036
+ /**
2037
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
2038
+ */
2039
+ export declare class MeasurementUtils extends Component {
2040
+ /**
2041
+ * A unique identifier for the component.
2042
+ * This UUID is used to register the component within the Components system.
2043
+ */
2044
+ static uuid: string;
2045
+ /** {@link Component.enabled} */
2046
+ enabled: boolean;
2047
+ constructor(components: Components);
2048
+ /**
2049
+ * Utility method to calculate the distance from a point to a line segment.
2050
+ *
2051
+ * @param point - The point from which to calculate the distance.
2052
+ * @param lineStart - The start point of the line segment.
2053
+ * @param lineEnd - The end point of the line segment.
2054
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
2055
+ * @returns The distance from the point to the line segment.
2056
+ */
2057
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2058
+ /**
2059
+ * Method to get the face of a mesh that contains a given triangle index.
2060
+ * It also returns the edges of the found face and their indices.
2061
+ *
2062
+ * @param mesh - The mesh to get the face from. It must be indexed.
2063
+ * @param triangleIndex - The index of the triangle within the mesh.
2064
+ * @param instance - The instance of the mesh (optional).
2065
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2066
+ */
2067
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2068
+ edges: MeasureEdge[];
2069
+ indices: Set<number>;
2070
+ } | null;
2071
+ /**
2072
+ * Method to get the vertices and normal of a mesh face at a given index.
2073
+ * It also applies instance transformation if provided.
2074
+ *
2075
+ * @param mesh - The mesh to get the face from. It must be indexed.
2076
+ * @param faceIndex - The index of the face within the mesh.
2077
+ * @param instance - The instance of the mesh (optional).
2078
+ * @returns An object containing the vertices and normal of the face.
2079
+ * @throws Will throw an error if the geometry is not indexed.
2080
+ */
2081
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2082
+ p1: THREE.Vector3;
2083
+ p2: THREE.Vector3;
2084
+ p3: THREE.Vector3;
2085
+ faceNormal: THREE.Vector3;
2086
+ };
2087
+ /**
2088
+ * Method to round the vector's components to a specified number of decimal places.
2089
+ * This is used to ensure numerical precision in edge detection.
2090
+ *
2091
+ * @param vector - The vector to round.
2092
+ * @returns The vector with rounded components.
2093
+ */
2094
+ round(vector: THREE.Vector3): void;
2095
+ /**
2096
+ * Calculates the volume of a set of fragments.
2097
+ *
2098
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
2099
+ * @returns The total volume of the fragments and the bounding sphere.
2100
+ *
2101
+ * @remarks
2102
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
2103
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
2104
+ *
2105
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
2106
+ * @throws Will throw an error if the fragment manager is not available.
2107
+ */
2108
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
2109
+ /**
2110
+ * Calculates the total volume of a set of meshes.
2111
+ *
2112
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2113
+ * @returns The total volume of the meshes and the bounding sphere.
2114
+ *
2115
+ * @remarks
2116
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
2117
+ * and its bounding sphere.
2118
+ *
2119
+ */
2120
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2121
+ private getFaceData;
2122
+ private getVolumeOfMesh;
2123
+ private getSignedVolumeOfTriangle;
2124
+ }
2125
+ import * as WEBIFC from "web-ifc";
2126
+ /** Configuration of the IFC-fragment conversion. */
2127
+ export declare class IfcFragmentSettings {
2128
+ /** Whether to extract the IFC properties into a JSON. */
2129
+ includeProperties: boolean;
2130
+ /**
2131
+ * Generate the geometry for categories that are not included by default,
2132
+ * like IFCSPACE.
2133
+ */
2134
+ optionalCategories: number[];
2135
+ /** Whether to use the coordination data coming from the IFC files. */
2136
+ coordinate: boolean;
2137
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2138
+ wasm: {
2139
+ path: string;
2140
+ absolute: boolean;
2141
+ logLevel?: WEBIFC.LogLevel;
2142
+ };
2143
+ /** List of categories that won't be converted to fragments. */
2144
+ excludedCategories: Set<number>;
2145
+ /** Whether to save the absolute location of all IFC items. */
2146
+ saveLocations: boolean;
2147
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2148
+ webIfc: WEBIFC.LoaderSettings;
2149
+ /**
2150
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2151
+ * If set to true, the path will be set to the default path of the WASM file.
2152
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2153
+ * Default value is true.
2154
+ */
2155
+ autoSetWasm: boolean;
2156
+ /**
2157
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2158
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2159
+ * If set to null, the default file location handler will be used.
2160
+ *
2161
+ * @param url - The URL of the file to locate.
2162
+ * @returns The absolute path of the file.
2163
+ */
2164
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2165
+ }
2102
2166
  import * as THREE from "three";
2103
2167
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2104
2168
  /**
@@ -2189,45 +2253,11 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2189
2253
  private updatePlanes;
2190
2254
  }
2191
2255
  import * as WEBIFC from "web-ifc";
2192
- /** Configuration of the IFC-fragment conversion. */
2193
- export declare class IfcFragmentSettings {
2194
- /** Whether to extract the IFC properties into a JSON. */
2195
- includeProperties: boolean;
2196
- /**
2197
- * Generate the geometry for categories that are not included by default,
2198
- * like IFCSPACE.
2199
- */
2200
- optionalCategories: number[];
2201
- /** Whether to use the coordination data coming from the IFC files. */
2202
- coordinate: boolean;
2203
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2204
- wasm: {
2205
- path: string;
2206
- absolute: boolean;
2207
- logLevel?: WEBIFC.LogLevel;
2208
- };
2209
- /** List of categories that won't be converted to fragments. */
2210
- excludedCategories: Set<number>;
2211
- /** Whether to save the absolute location of all IFC items. */
2212
- saveLocations: boolean;
2213
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2214
- webIfc: WEBIFC.LoaderSettings;
2215
- /**
2216
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2217
- * If set to true, the path will be set to the default path of the WASM file.
2218
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2219
- * Default value is true.
2220
- */
2221
- autoSetWasm: boolean;
2222
- /**
2223
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2224
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2225
- * If set to null, the default file location handler will be used.
2226
- *
2227
- * @param url - The URL of the file to locate.
2228
- * @returns The absolute path of the file.
2229
- */
2230
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2256
+ export interface IfcItemsCategories {
2257
+ [itemID: number]: number;
2258
+ }
2259
+ export declare class IfcCategories {
2260
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2231
2261
  }
2232
2262
  import * as WEBIFC from "web-ifc";
2233
2263
  import { IfcItemsCategories } from "../../../ifc";
@@ -2237,24 +2267,6 @@ export declare class SpatialStructure {
2237
2267
  setUp(webIfc: WEBIFC.IfcAPI): void;
2238
2268
  cleanUp(): void;
2239
2269
  }
2240
- import * as WEBIFC from "web-ifc";
2241
- export interface IfcItemsCategories {
2242
- [itemID: number]: number;
2243
- }
2244
- export declare class IfcCategories {
2245
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2246
- }
2247
- /**
2248
- * 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.
2249
- *
2250
- * @remarks
2251
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2252
- * It is useful for identifying and processing different types of IFC elements in a project.
2253
- *
2254
- */
2255
- export declare const IfcElements: {
2256
- [key: number]: string;
2257
- };
2258
2270
  /**
2259
2271
  * 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.
2260
2272
  */
@@ -2287,40 +2299,82 @@ export declare class IfcPropertiesUtils {
2287
2299
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2288
2300
  }
2289
2301
  /**
2290
- * 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.
2302
+ * 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.
2303
+ *
2304
+ * @remarks
2305
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2306
+ * It is useful for identifying and processing different types of IFC elements in a project.
2307
+ *
2291
2308
  */
2292
- export declare class Event<T> {
2309
+ export declare const IfcElements: {
2310
+ [key: number]: string;
2311
+ };
2312
+ import * as THREE from "three";
2313
+ import { Hideable, Event, World, Disposable } from "../../Types";
2314
+ import { Components } from "../../Components";
2315
+ /**
2316
+ * Configuration interface for the {@link SimpleGrid} class.
2317
+ */
2318
+ export interface GridConfig {
2293
2319
  /**
2294
- * Add a callback to this event instance.
2295
- * @param handler - the callback to be added to this event.
2320
+ * The color of the grid lines.
2296
2321
  */
2297
- add(handler: T extends void ? {
2298
- (): void;
2299
- } : {
2300
- (data: T): void;
2301
- }): void;
2322
+ color: THREE.Color;
2302
2323
  /**
2303
- * Removes a callback from this event instance.
2304
- * @param handler - the callback to be removed from this event.
2324
+ * The size of the primary grid lines.
2305
2325
  */
2306
- remove(handler: T extends void ? {
2307
- (): void;
2308
- } : {
2309
- (data: T): void;
2310
- }): void;
2311
- /** Triggers all the callbacks assigned to this event. */
2312
- trigger: (data?: T) => void;
2313
- /** Gets rid of all the suscribed events. */
2314
- reset(): void;
2315
- private handlers;
2316
- }
2317
- /**
2318
- * 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.
2319
- */
2320
- export declare class AsyncEvent<T> {
2326
+ size1: number;
2321
2327
  /**
2322
- * Add a callback to this event instance.
2323
- * @param handler - the callback to be added to this event.
2328
+ * The size of the secondary grid lines.
2329
+ */
2330
+ size2: number;
2331
+ /**
2332
+ * The distance at which the grid lines start to fade away.
2333
+ */
2334
+ distance: number;
2335
+ }
2336
+ /**
2337
+ * 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).
2338
+ */
2339
+ export declare class SimpleGrid implements Hideable, Disposable {
2340
+ /** {@link Disposable.onDisposed} */
2341
+ readonly onDisposed: Event<unknown>;
2342
+ /** The world instance to which this Raycaster belongs. */
2343
+ world: World;
2344
+ /** The components instance to which this grid belongs. */
2345
+ components: Components;
2346
+ /** {@link Hideable.visible} */
2347
+ get visible(): boolean;
2348
+ /** {@link Hideable.visible} */
2349
+ set visible(visible: boolean);
2350
+ /** The material of the grid. */
2351
+ get material(): THREE.ShaderMaterial;
2352
+ /**
2353
+ * Whether the grid should fade away with distance. Recommended to be true for
2354
+ * perspective cameras and false for orthographic cameras.
2355
+ */
2356
+ get fade(): boolean;
2357
+ /**
2358
+ * Whether the grid should fade away with distance. Recommended to be true for
2359
+ * perspective cameras and false for orthographic cameras.
2360
+ */
2361
+ set fade(active: boolean);
2362
+ /** The Three.js mesh that contains the infinite grid. */
2363
+ readonly three: THREE.Mesh;
2364
+ private _fade;
2365
+ constructor(components: Components, world: World, config: GridConfig);
2366
+ /** {@link Disposable.dispose} */
2367
+ dispose(): void;
2368
+ private setupEvents;
2369
+ private updateZoom;
2370
+ }
2371
+ /**
2372
+ * 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.
2373
+ */
2374
+ export declare class AsyncEvent<T> {
2375
+ /**
2376
+ * Add a callback to this event instance.
2377
+ * @param handler - the callback to be added to this event.
2324
2378
  */
2325
2379
  add(handler: T extends void ? {
2326
2380
  (): Promise<void>;
@@ -2342,6 +2396,34 @@ export declare class AsyncEvent<T> {
2342
2396
  reset(): void;
2343
2397
  private handlers;
2344
2398
  }
2399
+ /**
2400
+ * 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.
2401
+ */
2402
+ export declare class Event<T> {
2403
+ /**
2404
+ * Add a callback to this event instance.
2405
+ * @param handler - the callback to be added to this event.
2406
+ */
2407
+ add(handler: T extends void ? {
2408
+ (): void;
2409
+ } : {
2410
+ (data: T): void;
2411
+ }): void;
2412
+ /**
2413
+ * Removes a callback from this event instance.
2414
+ * @param handler - the callback to be removed from this event.
2415
+ */
2416
+ remove(handler: T extends void ? {
2417
+ (): void;
2418
+ } : {
2419
+ (data: T): void;
2420
+ }): void;
2421
+ /** Triggers all the callbacks assigned to this event. */
2422
+ trigger: (data?: T) => void;
2423
+ /** Gets rid of all the suscribed events. */
2424
+ reset(): void;
2425
+ private handlers;
2426
+ }
2345
2427
  import * as THREE from "three";
2346
2428
  import CameraControls from "camera-controls";
2347
2429
  import { Event } from "./event";
@@ -2450,6 +2532,23 @@ export interface CameraControllable {
2450
2532
  */
2451
2533
  controls: CameraControls;
2452
2534
  }
2535
+ import { Base } from "./base";
2536
+ /**
2537
+ * 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.
2538
+ */
2539
+ export declare abstract class Component extends Base {
2540
+ /**
2541
+ * Whether this component is active or not. The behaviour can vary depending
2542
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2543
+ * dimensions, while a disabled camera will stop moving. A disabled component
2544
+ * will not be updated automatically each frame.
2545
+ */
2546
+ abstract enabled: boolean;
2547
+ }
2548
+ /**
2549
+ * A Set of unique numbers representing different types of IFC geometries.
2550
+ */
2551
+ export declare const GeometryTypes: Set<number>;
2453
2552
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2454
2553
  import { Components } from "../../Components";
2455
2554
  /**
@@ -2469,19 +2568,6 @@ export declare abstract class Base {
2469
2568
  /** Whether is component is {@link Configurable}. */
2470
2569
  isConfigurable: () => this is Configurable<any>;
2471
2570
  }
2472
- import { Base } from "./base";
2473
- /**
2474
- * 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.
2475
- */
2476
- export declare abstract class Component extends Base {
2477
- /**
2478
- * Whether this component is active or not. The behaviour can vary depending
2479
- * on the type of component. E.g. a disabled dimension tool will stop creating
2480
- * dimensions, while a disabled camera will stop moving. A disabled component
2481
- * will not be updated automatically each frame.
2482
- */
2483
- abstract enabled: boolean;
2484
- }
2485
2571
  import { InverseAttribute } from "./types";
2486
2572
  export declare const relToAttributesMap: Map<number, {
2487
2573
  forRelating: InverseAttribute;
@@ -2511,6 +2597,34 @@ export declare abstract class BaseWorldItem extends Base {
2511
2597
  protected constructor(components: Components);
2512
2598
  }
2513
2599
  import * as THREE from "three";
2600
+ import CameraControls from "camera-controls";
2601
+ import { BaseWorldItem } from "./base-world-item";
2602
+ import { CameraControllable } from "./interfaces";
2603
+ /**
2604
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2605
+ */
2606
+ export declare abstract class BaseCamera extends BaseWorldItem {
2607
+ /**
2608
+ * Whether the camera is enabled or not.
2609
+ */
2610
+ abstract enabled: boolean;
2611
+ /**
2612
+ * The Three.js camera instance.
2613
+ */
2614
+ abstract three: THREE.Camera;
2615
+ /**
2616
+ * Optional CameraControls instance for controlling the camera.
2617
+ * This property is only available if the camera is controllable.
2618
+ */
2619
+ abstract controls?: CameraControls;
2620
+ /**
2621
+ * Checks whether the instance is {@link CameraControllable}.
2622
+ *
2623
+ * @returns True if the instance is controllable, false otherwise.
2624
+ */
2625
+ hasCameraControls: () => this is CameraControllable;
2626
+ }
2627
+ import * as THREE from "three";
2514
2628
  import { Vector2 } from "three";
2515
2629
  import { Event } from "./event";
2516
2630
  import { BaseWorldItem } from "./base-world-item";
@@ -2576,34 +2690,6 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2576
2690
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2577
2691
  }
2578
2692
  import * as THREE from "three";
2579
- import CameraControls from "camera-controls";
2580
- import { BaseWorldItem } from "./base-world-item";
2581
- import { CameraControllable } from "./interfaces";
2582
- /**
2583
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2584
- */
2585
- export declare abstract class BaseCamera extends BaseWorldItem {
2586
- /**
2587
- * Whether the camera is enabled or not.
2588
- */
2589
- abstract enabled: boolean;
2590
- /**
2591
- * The Three.js camera instance.
2592
- */
2593
- abstract three: THREE.Camera;
2594
- /**
2595
- * Optional CameraControls instance for controlling the camera.
2596
- * This property is only available if the camera is controllable.
2597
- */
2598
- abstract controls?: CameraControls;
2599
- /**
2600
- * Checks whether the instance is {@link CameraControllable}.
2601
- *
2602
- * @returns True if the instance is controllable, false otherwise.
2603
- */
2604
- hasCameraControls: () => this is CameraControllable;
2605
- }
2606
- import * as THREE from "three";
2607
2693
  import { Disposable } from "./interfaces";
2608
2694
  import { Event } from "./event";
2609
2695
  import { Components } from "../../Components";
@@ -2658,90 +2744,175 @@ export interface World extends Disposable, Updateable {
2658
2744
  isDisposing: boolean;
2659
2745
  }
2660
2746
  import * as THREE from "three";
2661
- import { Disposable, Event } from "../../Types";
2747
+ import { Components } from "../../Components";
2748
+ import { AsyncEvent, Event, World } from "../../Types";
2662
2749
  /**
2663
- * 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.
2750
+ * Settings to configure the CullerRenderer.
2664
2751
  */
2665
- export declare class Mouse implements Disposable {
2666
- dom: HTMLCanvasElement;
2667
- private _event?;
2668
- private _position;
2669
- /** {@link Disposable.onDisposed} */
2670
- readonly onDisposed: Event<unknown>;
2671
- constructor(dom: HTMLCanvasElement);
2752
+ export interface CullerRendererSettings {
2672
2753
  /**
2673
- * The real position of the mouse of the Three.js canvas.
2754
+ * Interval in milliseconds at which the visibility check should be performed.
2755
+ * Default value is 1000.
2674
2756
  */
2675
- get position(): THREE.Vector2;
2676
- /** {@link Disposable.dispose} */
2677
- dispose(): void;
2678
- private getPositionY;
2679
- private getPositionX;
2680
- private updateMouseInfo;
2681
- private setupEvents;
2682
- }
2683
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2684
- /**
2685
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2686
- */
2687
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2757
+ updateInterval?: number;
2688
2758
  /**
2689
- * Amount of properties to be streamed.
2690
- * Defaults to 100 properties.
2759
+ * Width of the render target used for visibility checks.
2760
+ * Default value is 512.
2691
2761
  */
2692
- propertiesSize: number;
2762
+ width?: number;
2763
+ /**
2764
+ * Height of the render target used for visibility checks.
2765
+ * Default value is 512.
2766
+ */
2767
+ height?: number;
2768
+ /**
2769
+ * Whether the visibility check should be performed automatically.
2770
+ * Default value is true.
2771
+ */
2772
+ autoUpdate?: boolean;
2693
2773
  }
2694
- import * as THREE from "three";
2695
- import { Components } from "../../Components";
2696
- import { Event, World, Disposable } from "../../Types";
2697
- import { Mouse } from "./mouse";
2698
2774
  /**
2699
- * 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.
2775
+ * A base renderer to determine visibility on screen.
2700
2776
  */
2701
- export declare class SimpleRaycaster implements Disposable {
2702
- /** {@link Component.enabled} */
2703
- enabled: boolean;
2704
- /** The components instance to which this Raycaster belongs. */
2705
- components: Components;
2777
+ export declare class CullerRenderer {
2706
2778
  /** {@link Disposable.onDisposed} */
2707
- readonly onDisposed: Event<unknown>;
2708
- /** The position of the mouse in the screen. */
2709
- readonly mouse: Mouse;
2779
+ readonly onDisposed: Event<string>;
2710
2780
  /**
2711
- * A reference to the Three.js Raycaster instance.
2712
- * This is used for raycasting operations.
2781
+ * Fires after making the visibility check to the meshes. It lists the
2782
+ * meshes that are currently visible, and the ones that were visible
2783
+ * just before but not anymore.
2713
2784
  */
2714
- readonly three: THREE.Raycaster;
2785
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2715
2786
  /**
2716
- * A reference to the world instance to which this Raycaster belongs.
2717
- * This is used to access the camera and meshes.
2787
+ * Whether this renderer is active or not. If not, it won't render anything.
2718
2788
  */
2719
- world: World;
2720
- constructor(components: Components, world: World);
2721
- /** {@link Disposable.dispose} */
2722
- dispose(): void;
2789
+ enabled: boolean;
2723
2790
  /**
2724
- * Throws a ray from the camera to the mouse or touch event point and returns
2725
- * the first item found. This also takes into account the clipping planes
2726
- * used by the renderer.
2727
- *
2728
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2729
- * to query. If not provided, it will query all the meshes stored in
2730
- * {@link Components.meshes}.
2791
+ * Needs to check whether there are objects that need to be hidden or shown.
2792
+ * You can bind this to the camera movement, to a certain interval, etc.
2731
2793
  */
2732
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2794
+ needsUpdate: boolean;
2733
2795
  /**
2734
- * Casts a ray from a given origin in a given direction and returns the first item found.
2735
- * This method also takes into account the clipping planes used by the renderer.
2736
- *
2737
- * @param origin - The origin of the ray.
2738
- * @param direction - The direction of the ray.
2739
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2740
- * @returns The first intersection found or 'null' if no intersection was found.
2796
+ * Render the internal scene used to determine the object visibility. Used
2797
+ * for debugging purposes.
2741
2798
  */
2742
- 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;
2743
- private intersect;
2744
- private filterClippingPlanes;
2799
+ renderDebugFrame: boolean;
2800
+ /** The components instance to which this renderer belongs. */
2801
+ components: Components;
2802
+ /** The world instance to which this renderer belongs. */
2803
+ readonly world: World;
2804
+ /** The THREE.js renderer used to make the visibility test. */
2805
+ readonly renderer: THREE.WebGLRenderer;
2806
+ protected autoUpdate: boolean;
2807
+ protected updateInterval: number;
2808
+ protected readonly worker: Worker;
2809
+ protected readonly scene: THREE.Scene;
2810
+ private _width;
2811
+ private _height;
2812
+ private _availableColor;
2813
+ private readonly renderTarget;
2814
+ private readonly bufferSize;
2815
+ private readonly _buffer;
2816
+ protected _isWorkerBusy: boolean;
2817
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2818
+ /** {@link Disposable.dispose} */
2819
+ dispose(): void;
2820
+ /**
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
+ import * as THREE from "three";
2838
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2839
+ import { Components } from "../../Components";
2840
+ import { Event, World, Disposable } from "../../Types";
2841
+ /**
2842
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2843
+ */
2844
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2845
+ /**
2846
+ * Event triggered when the visibility of meshes is updated.
2847
+ * Contains two sets: seen and unseen.
2848
+ */
2849
+ readonly onViewUpdated: Event<{
2850
+ seen: Set<THREE.Mesh>;
2851
+ unseen: Set<THREE.Mesh>;
2852
+ }>;
2853
+ /**
2854
+ * Pixels in screen a geometry must occupy to be considered "seen".
2855
+ * Default value is 100.
2856
+ */
2857
+ threshold: number;
2858
+ /**
2859
+ * Map of color code to THREE.InstancedMesh.
2860
+ * Used to keep track of color-coded meshes.
2861
+ */
2862
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2863
+ /**
2864
+ * Flag to indicate if the renderer is currently processing.
2865
+ * Used to prevent concurrent processing.
2866
+ */
2867
+ isProcessing: boolean;
2868
+ private _colorCodeMeshMap;
2869
+ private _meshIDColorCodeMap;
2870
+ private _currentVisibleMeshes;
2871
+ private _recentlyHiddenMeshes;
2872
+ private _intervalID;
2873
+ private readonly _transparentMat;
2874
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2875
+ /** {@link Disposable.dispose} */
2876
+ dispose(): void;
2877
+ /**
2878
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2879
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2880
+ * @returns {void}
2881
+ */
2882
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2883
+ /**
2884
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2885
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2886
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2887
+ * @returns {void}
2888
+ */
2889
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2890
+ private handleWorkerMessage;
2891
+ private getAvailableMaterial;
2892
+ }
2893
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2894
+ import * as THREE from "three";
2895
+ import { Disposable, Event } from "../../Types";
2896
+ /**
2897
+ * 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.
2898
+ */
2899
+ export declare class Mouse implements Disposable {
2900
+ dom: HTMLCanvasElement;
2901
+ private _event?;
2902
+ private _position;
2903
+ /** {@link Disposable.onDisposed} */
2904
+ readonly onDisposed: Event<unknown>;
2905
+ constructor(dom: HTMLCanvasElement);
2906
+ /**
2907
+ * The real position of the mouse of the Three.js canvas.
2908
+ */
2909
+ get position(): THREE.Vector2;
2910
+ /** {@link Disposable.dispose} */
2911
+ dispose(): void;
2912
+ private getPositionY;
2913
+ private getPositionX;
2914
+ private updateMouseInfo;
2915
+ private setupEvents;
2745
2916
  }
2746
2917
  import * as THREE from "three";
2747
2918
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
@@ -2823,6 +2994,58 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
2823
2994
  dispose(disposeResources?: boolean): void;
2824
2995
  }
2825
2996
  import * as THREE from "three";
2997
+ import { Components } from "../../Components";
2998
+ import { Event, World, Disposable } from "../../Types";
2999
+ import { Mouse } from "./mouse";
3000
+ /**
3001
+ * 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.
3002
+ */
3003
+ export declare class SimpleRaycaster implements Disposable {
3004
+ /** {@link Component.enabled} */
3005
+ enabled: boolean;
3006
+ /** The components instance to which this Raycaster belongs. */
3007
+ components: Components;
3008
+ /** {@link Disposable.onDisposed} */
3009
+ readonly onDisposed: Event<unknown>;
3010
+ /** The position of the mouse in the screen. */
3011
+ readonly mouse: Mouse;
3012
+ /**
3013
+ * A reference to the Three.js Raycaster instance.
3014
+ * This is used for raycasting operations.
3015
+ */
3016
+ readonly three: THREE.Raycaster;
3017
+ /**
3018
+ * A reference to the world instance to which this Raycaster belongs.
3019
+ * This is used to access the camera and meshes.
3020
+ */
3021
+ world: World;
3022
+ constructor(components: Components, world: World);
3023
+ /** {@link Disposable.dispose} */
3024
+ dispose(): void;
3025
+ /**
3026
+ * Throws a ray from the camera to the mouse or touch event point and returns
3027
+ * the first item found. This also takes into account the clipping planes
3028
+ * used by the renderer.
3029
+ *
3030
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3031
+ * to query. If not provided, it will query all the meshes stored in
3032
+ * {@link Components.meshes}.
3033
+ */
3034
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3035
+ /**
3036
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3037
+ * This method also takes into account the clipping planes used by the renderer.
3038
+ *
3039
+ * @param origin - The origin of the ray.
3040
+ * @param direction - The direction of the ray.
3041
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3042
+ * @returns The first intersection found or 'null' if no intersection was found.
3043
+ */
3044
+ 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;
3045
+ private intersect;
3046
+ private filterClippingPlanes;
3047
+ }
3048
+ import * as THREE from "three";
2826
3049
  import { BaseScene, Configurable, Event } from "../../Types";
2827
3050
  import { Components } from "../../Components";
2828
3051
  /**
@@ -2940,372 +3163,58 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
2940
3163
  */
2941
3164
  three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2942
3165
  private _allControls;
2943
- /**
2944
- * The object that controls the camera. An instance of
2945
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2946
- * Transforming the camera directly will have no effect: you need to use this
2947
- * object to move, rotate, look at objects, etc.
2948
- */
2949
- get controls(): CameraControls;
2950
- /**
2951
- * Getter for the enabled state of the camera controls.
2952
- * If the current world is null, it returns false.
2953
- * Otherwise, it returns the enabled state of the camera controls.
2954
- *
2955
- * @returns {boolean} The enabled state of the camera controls.
2956
- */
2957
- get enabled(): boolean;
2958
- /**
2959
- * Setter for the enabled state of the camera controls.
2960
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2961
- *
2962
- * @param {boolean} enabled - The new enabled state of the camera controls.
2963
- */
2964
- set enabled(enabled: boolean);
2965
- constructor(components: Components);
2966
- /** {@link Disposable.dispose} */
2967
- dispose(): void;
2968
- /** {@link Updateable.update} */
2969
- update(_delta: number): void;
2970
- /**
2971
- * Updates the aspect of the camera to match the size of the
2972
- * {@link Components.renderer}.
2973
- */
2974
- updateAspect: () => void;
2975
- private setupCamera;
2976
- private newCameraControls;
2977
- private setupEvents;
2978
- private static getSubsetOfThree;
2979
- }
2980
- import * as THREE from "three";
2981
- import { Hideable, Event, World, Disposable } from "../../Types";
2982
- import { Components } from "../../Components";
2983
- /**
2984
- * Configuration interface for the {@link SimpleGrid} class.
2985
- */
2986
- export interface GridConfig {
2987
- /**
2988
- * The color of the grid lines.
2989
- */
2990
- color: THREE.Color;
2991
- /**
2992
- * The size of the primary grid lines.
2993
- */
2994
- size1: number;
2995
- /**
2996
- * The size of the secondary grid lines.
2997
- */
2998
- size2: number;
2999
- /**
3000
- * The distance at which the grid lines start to fade away.
3001
- */
3002
- distance: number;
3003
- }
3004
- /**
3005
- * 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).
3006
- */
3007
- export declare class SimpleGrid implements Hideable, Disposable {
3008
- /** {@link Disposable.onDisposed} */
3009
- readonly onDisposed: Event<unknown>;
3010
- /** The world instance to which this Raycaster belongs. */
3011
- world: World;
3012
- /** The components instance to which this grid belongs. */
3013
- components: Components;
3014
- /** {@link Hideable.visible} */
3015
- get visible(): boolean;
3016
- /** {@link Hideable.visible} */
3017
- set visible(visible: boolean);
3018
- /** The material of the grid. */
3019
- get material(): THREE.ShaderMaterial;
3020
- /**
3021
- * Whether the grid should fade away with distance. Recommended to be true for
3022
- * perspective cameras and false for orthographic cameras.
3023
- */
3024
- get fade(): boolean;
3025
- /**
3026
- * Whether the grid should fade away with distance. Recommended to be true for
3027
- * perspective cameras and false for orthographic cameras.
3028
- */
3029
- set fade(active: boolean);
3030
- /** The Three.js mesh that contains the infinite grid. */
3031
- readonly three: THREE.Mesh;
3032
- private _fade;
3033
- constructor(components: Components, world: World, config: GridConfig);
3034
- /** {@link Disposable.dispose} */
3035
- dispose(): void;
3036
- private setupEvents;
3037
- private updateZoom;
3038
- }
3039
- import { NavigationMode } from "./types";
3040
- import { OrthoPerspectiveCamera } from "../index";
3041
- /**
3042
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3043
- */
3044
- export declare class FirstPersonMode implements NavigationMode {
3045
- private camera;
3046
- /** {@link NavigationMode.enabled} */
3047
- enabled: boolean;
3048
- /** {@link NavigationMode.id} */
3049
- readonly id = "FirstPerson";
3050
- constructor(camera: OrthoPerspectiveCamera);
3051
- /** {@link NavigationMode.set} */
3052
- set(active: boolean): void;
3053
- private setupFirstPersonCamera;
3054
- }
3055
- import { NavigationMode } from "./types";
3056
- import { OrthoPerspectiveCamera } from "../index";
3057
- /**
3058
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3059
- */
3060
- export declare class PlanMode implements NavigationMode {
3061
- private camera;
3062
- /** {@link NavigationMode.enabled} */
3063
- enabled: boolean;
3064
- /** {@link NavigationMode.id} */
3065
- readonly id = "Plan";
3066
- private mouseAction1?;
3067
- private mouseAction2?;
3068
- private mouseInitialized;
3069
- private readonly defaultAzimuthSpeed;
3070
- private readonly defaultPolarSpeed;
3071
- constructor(camera: OrthoPerspectiveCamera);
3072
- /** {@link NavigationMode.set} */
3073
- set(active: boolean): void;
3074
- }
3075
- import { NavigationMode } from "./types";
3076
- import { OrthoPerspectiveCamera } from "../index";
3077
- /**
3078
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3079
- */
3080
- export declare class OrbitMode implements NavigationMode {
3081
- camera: OrthoPerspectiveCamera;
3082
- /** {@link NavigationMode.enabled} */
3083
- enabled: boolean;
3084
- /** {@link NavigationMode.id} */
3085
- readonly id = "Orbit";
3086
- constructor(camera: OrthoPerspectiveCamera);
3087
- /** {@link NavigationMode.set} */
3088
- set(active: boolean): void;
3089
- private activateOrbitControls;
3090
- }
3091
- import * as THREE from "three";
3092
- import { CameraProjection } from "./types";
3093
- import { Event } from "../../Types";
3094
- import { OrthoPerspectiveCamera } from "../index";
3095
- /**
3096
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3097
- */
3098
- export declare class ProjectionManager {
3099
- /**
3100
- * Event that fires when the {@link CameraProjection} changes.
3101
- */
3102
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3103
- /**
3104
- * Current projection mode of the camera.
3105
- * Default is "Perspective".
3106
- */
3107
- current: CameraProjection;
3108
- /**
3109
- * The camera controlled by this ProjectionManager.
3110
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3111
- */
3112
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3113
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3114
- matchOrthoDistanceEnabled: boolean;
3115
- private _component;
3116
- private _previousDistance;
3117
- constructor(camera: OrthoPerspectiveCamera);
3118
- /**
3119
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3120
- *
3121
- * @param projection - the new projection to set. If it is the current projection,
3122
- * it will have no effect.
3123
- */
3124
- set(projection: CameraProjection): Promise<void>;
3125
- /**
3126
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3127
- * and vice versa.
3128
- */
3129
- toggle(): Promise<void>;
3130
- private setOrthoCamera;
3131
- private getPerspectiveDims;
3132
- private setupOrthoCamera;
3133
- private getDistance;
3134
- private setPerspectiveCamera;
3135
- }
3136
- /**
3137
- * The projection system of the camera.
3138
- */
3139
- export type CameraProjection = "Perspective" | "Orthographic";
3140
- /**
3141
- * The extensible list of supported navigation modes.
3142
- */
3143
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3144
- /**
3145
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3146
- */
3147
- export interface NavigationMode {
3148
- /** The unique ID of this navigation mode. */
3149
- id: NavModeID;
3150
- /**
3151
- * Enable or disable this navigation mode.
3152
- * When a new navigation mode is enabled, the previous navigation mode
3153
- * must be disabled.
3154
- *
3155
- * @param active - whether to enable or disable this mode.
3156
- * @param options - any additional data required to enable or disable it.
3157
- * */
3158
- set: (active: boolean, options?: any) => void;
3159
- /** Whether this navigation mode is active or not. */
3160
- enabled: boolean;
3161
- }
3162
- import * as THREE from "three";
3163
- import { Components } from "../../Components";
3164
- import { AsyncEvent, Event, World } from "../../Types";
3165
- /**
3166
- * Settings to configure the CullerRenderer.
3167
- */
3168
- export interface CullerRendererSettings {
3169
- /**
3170
- * Interval in milliseconds at which the visibility check should be performed.
3171
- * Default value is 1000.
3172
- */
3173
- updateInterval?: number;
3174
- /**
3175
- * Width of the render target used for visibility checks.
3176
- * Default value is 512.
3177
- */
3178
- width?: number;
3179
- /**
3180
- * Height of the render target used for visibility checks.
3181
- * Default value is 512.
3182
- */
3183
- height?: number;
3184
- /**
3185
- * Whether the visibility check should be performed automatically.
3186
- * Default value is true.
3187
- */
3188
- autoUpdate?: boolean;
3189
- }
3190
- /**
3191
- * A base renderer to determine visibility on screen.
3192
- */
3193
- export declare class CullerRenderer {
3194
- /** {@link Disposable.onDisposed} */
3195
- readonly onDisposed: Event<string>;
3196
- /**
3197
- * Fires after making the visibility check to the meshes. It lists the
3198
- * meshes that are currently visible, and the ones that were visible
3199
- * just before but not anymore.
3200
- */
3201
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3202
- /**
3203
- * Whether this renderer is active or not. If not, it won't render anything.
3204
- */
3205
- enabled: boolean;
3206
- /**
3207
- * Needs to check whether there are objects that need to be hidden or shown.
3208
- * You can bind this to the camera movement, to a certain interval, etc.
3209
- */
3210
- needsUpdate: boolean;
3211
- /**
3212
- * Render the internal scene used to determine the object visibility. Used
3213
- * for debugging purposes.
3214
- */
3215
- renderDebugFrame: boolean;
3216
- /** The components instance to which this renderer belongs. */
3217
- components: Components;
3218
- /** The world instance to which this renderer belongs. */
3219
- readonly world: World;
3220
- /** The THREE.js renderer used to make the visibility test. */
3221
- readonly renderer: THREE.WebGLRenderer;
3222
- protected autoUpdate: boolean;
3223
- protected updateInterval: number;
3224
- protected readonly worker: Worker;
3225
- protected readonly scene: THREE.Scene;
3226
- private _width;
3227
- private _height;
3228
- private _availableColor;
3229
- private readonly renderTarget;
3230
- private readonly bufferSize;
3231
- private readonly _buffer;
3232
- protected _isWorkerBusy: boolean;
3233
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3234
- /** {@link Disposable.dispose} */
3235
- dispose(): void;
3236
- /**
3237
- * The function that the culler uses to reprocess the scene. Generally it's
3238
- * better to call needsUpdate, but you can also call this to force it.
3239
- * @param force if true, it will refresh the scene even if needsUpdate is
3240
- * not true.
3241
- */
3242
- updateVisibility: (force?: boolean) => Promise<void>;
3243
- protected getAvailableColor(): {
3244
- r: number;
3245
- g: number;
3246
- b: number;
3247
- code: string;
3248
- };
3249
- protected increaseColor(): void;
3250
- protected decreaseColor(): void;
3251
- private applySettings;
3252
- }
3253
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3254
- import * as THREE from "three";
3255
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3256
- import { Components } from "../../Components";
3257
- import { Event, World, Disposable } from "../../Types";
3258
- /**
3259
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3260
- */
3261
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3262
- /**
3263
- * Event triggered when the visibility of meshes is updated.
3264
- * Contains two sets: seen and unseen.
3265
- */
3266
- readonly onViewUpdated: Event<{
3267
- seen: Set<THREE.Mesh>;
3268
- unseen: Set<THREE.Mesh>;
3269
- }>;
3270
- /**
3271
- * Pixels in screen a geometry must occupy to be considered "seen".
3272
- * Default value is 100.
3166
+ /**
3167
+ * The object that controls the camera. An instance of
3168
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3169
+ * Transforming the camera directly will have no effect: you need to use this
3170
+ * object to move, rotate, look at objects, etc.
3273
3171
  */
3274
- threshold: number;
3172
+ get controls(): CameraControls;
3275
3173
  /**
3276
- * Map of color code to THREE.InstancedMesh.
3277
- * Used to keep track of color-coded meshes.
3174
+ * Getter for the enabled state of the camera controls.
3175
+ * If the current world is null, it returns false.
3176
+ * Otherwise, it returns the enabled state of the camera controls.
3177
+ *
3178
+ * @returns {boolean} The enabled state of the camera controls.
3278
3179
  */
3279
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3180
+ get enabled(): boolean;
3280
3181
  /**
3281
- * Flag to indicate if the renderer is currently processing.
3282
- * Used to prevent concurrent processing.
3182
+ * Setter for the enabled state of the camera controls.
3183
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3184
+ *
3185
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3283
3186
  */
3284
- isProcessing: boolean;
3285
- private _colorCodeMeshMap;
3286
- private _meshIDColorCodeMap;
3287
- private _currentVisibleMeshes;
3288
- private _recentlyHiddenMeshes;
3289
- private _intervalID;
3290
- private readonly _transparentMat;
3291
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3187
+ set enabled(enabled: boolean);
3188
+ constructor(components: Components);
3292
3189
  /** {@link Disposable.dispose} */
3293
3190
  dispose(): void;
3191
+ /** {@link Updateable.update} */
3192
+ update(_delta: number): void;
3294
3193
  /**
3295
- * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
3296
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3297
- * @returns {void}
3298
- */
3299
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3300
- /**
3301
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3302
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3303
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3304
- * @returns {void}
3194
+ * Updates the aspect of the camera to match the size of the
3195
+ * {@link Components.renderer}.
3305
3196
  */
3306
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3307
- private handleWorkerMessage;
3308
- private getAvailableMaterial;
3197
+ updateAspect: () => void;
3198
+ private setupCamera;
3199
+ private newCameraControls;
3200
+ private setupEvents;
3201
+ private static getSubsetOfThree;
3202
+ }
3203
+ import { NavigationMode } from "./types";
3204
+ import { OrthoPerspectiveCamera } from "../index";
3205
+ /**
3206
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3207
+ */
3208
+ export declare class FirstPersonMode implements NavigationMode {
3209
+ private camera;
3210
+ /** {@link NavigationMode.enabled} */
3211
+ enabled: boolean;
3212
+ /** {@link NavigationMode.id} */
3213
+ readonly id = "FirstPerson";
3214
+ constructor(camera: OrthoPerspectiveCamera);
3215
+ /** {@link NavigationMode.set} */
3216
+ set(active: boolean): void;
3217
+ private setupFirstPersonCamera;
3309
3218
  }
3310
3219
  import * as THREE from "three";
3311
3220
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3406,6 +3315,113 @@ export declare class SimplePlane implements Disposable, Hideable {
3406
3315
  private newHelper;
3407
3316
  private static newPlaneMesh;
3408
3317
  }
3318
+ import { NavigationMode } from "./types";
3319
+ import { OrthoPerspectiveCamera } from "../index";
3320
+ /**
3321
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3322
+ */
3323
+ export declare class PlanMode implements NavigationMode {
3324
+ private camera;
3325
+ /** {@link NavigationMode.enabled} */
3326
+ enabled: boolean;
3327
+ /** {@link NavigationMode.id} */
3328
+ readonly id = "Plan";
3329
+ private mouseAction1?;
3330
+ private mouseAction2?;
3331
+ private mouseInitialized;
3332
+ private readonly defaultAzimuthSpeed;
3333
+ private readonly defaultPolarSpeed;
3334
+ constructor(camera: OrthoPerspectiveCamera);
3335
+ /** {@link NavigationMode.set} */
3336
+ set(active: boolean): void;
3337
+ }
3338
+ import { NavigationMode } from "./types";
3339
+ import { OrthoPerspectiveCamera } from "../index";
3340
+ /**
3341
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3342
+ */
3343
+ export declare class OrbitMode implements NavigationMode {
3344
+ camera: OrthoPerspectiveCamera;
3345
+ /** {@link NavigationMode.enabled} */
3346
+ enabled: boolean;
3347
+ /** {@link NavigationMode.id} */
3348
+ readonly id = "Orbit";
3349
+ constructor(camera: OrthoPerspectiveCamera);
3350
+ /** {@link NavigationMode.set} */
3351
+ set(active: boolean): void;
3352
+ private activateOrbitControls;
3353
+ }
3354
+ /**
3355
+ * The projection system of the camera.
3356
+ */
3357
+ export type CameraProjection = "Perspective" | "Orthographic";
3358
+ /**
3359
+ * The extensible list of supported navigation modes.
3360
+ */
3361
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3362
+ /**
3363
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3364
+ */
3365
+ export interface NavigationMode {
3366
+ /** The unique ID of this navigation mode. */
3367
+ id: NavModeID;
3368
+ /**
3369
+ * Enable or disable this navigation mode.
3370
+ * When a new navigation mode is enabled, the previous navigation mode
3371
+ * must be disabled.
3372
+ *
3373
+ * @param active - whether to enable or disable this mode.
3374
+ * @param options - any additional data required to enable or disable it.
3375
+ * */
3376
+ set: (active: boolean, options?: any) => void;
3377
+ /** Whether this navigation mode is active or not. */
3378
+ enabled: boolean;
3379
+ }
3380
+ import * as THREE from "three";
3381
+ import { CameraProjection } from "./types";
3382
+ import { Event } from "../../Types";
3383
+ import { OrthoPerspectiveCamera } from "../index";
3384
+ /**
3385
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3386
+ */
3387
+ export declare class ProjectionManager {
3388
+ /**
3389
+ * Event that fires when the {@link CameraProjection} changes.
3390
+ */
3391
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3392
+ /**
3393
+ * Current projection mode of the camera.
3394
+ * Default is "Perspective".
3395
+ */
3396
+ current: CameraProjection;
3397
+ /**
3398
+ * The camera controlled by this ProjectionManager.
3399
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3400
+ */
3401
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3402
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3403
+ matchOrthoDistanceEnabled: boolean;
3404
+ private _component;
3405
+ private _previousDistance;
3406
+ constructor(camera: OrthoPerspectiveCamera);
3407
+ /**
3408
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3409
+ *
3410
+ * @param projection - the new projection to set. If it is the current projection,
3411
+ * it will have no effect.
3412
+ */
3413
+ set(projection: CameraProjection): Promise<void>;
3414
+ /**
3415
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3416
+ * and vice versa.
3417
+ */
3418
+ toggle(): Promise<void>;
3419
+ private setOrthoCamera;
3420
+ private getPerspectiveDims;
3421
+ private setupOrthoCamera;
3422
+ private getDistance;
3423
+ private setPerspectiveCamera;
3424
+ }
3409
3425
  import * as THREE from "three";
3410
3426
  import * as WEBIFC from "web-ifc";
3411
3427
  import * as FRAGS from "@thatopen/fragments";
@@ -3426,6 +3442,27 @@ export declare class IfcMetadataReader {
3426
3442
  getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3427
3443
  getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3428
3444
  }
3445
+ import * as WEBIFC from "web-ifc";
3446
+ import * as THREE from "three";
3447
+ export declare class Units {
3448
+ factor: number;
3449
+ complement: number;
3450
+ apply(matrix: THREE.Matrix4): void;
3451
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3452
+ private getLengthUnits;
3453
+ private getScaleMatrix;
3454
+ }
3455
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3456
+ /**
3457
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3458
+ */
3459
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3460
+ /**
3461
+ * Amount of properties to be streamed.
3462
+ * Defaults to 100 properties.
3463
+ */
3464
+ propertiesSize: number;
3465
+ }
3429
3466
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3430
3467
  /**
3431
3468
  * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3442,40 +3479,6 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3442
3479
  */
3443
3480
  minAssetsSize: number;
3444
3481
  }
3445
- import * as WEBIFC from "web-ifc";
3446
- import * as THREE from "three";
3447
- export declare class Units {
3448
- factor: number;
3449
- complement: number;
3450
- apply(matrix: THREE.Matrix4): void;
3451
- setUp(webIfc: WEBIFC.IfcAPI): void;
3452
- private getLengthUnits;
3453
- private getScaleMatrix;
3454
- }
3455
- export type RelationsMap = Map<number, Map<number, number[]>>;
3456
- export interface ModelsRelationMap {
3457
- [modelID: string]: RelationsMap;
3458
- }
3459
- /**
3460
- * Type alias for an array of inverse attribute names.
3461
- */
3462
- export type InverseAttributes = [
3463
- "IsDecomposedBy",
3464
- "Decomposes",
3465
- "AssociatedTo",
3466
- "HasAssociations",
3467
- "ClassificationForObjects",
3468
- "IsGroupedBy",
3469
- "HasAssignments",
3470
- "IsDefinedBy",
3471
- "DefinesOcurrence",
3472
- "IsTypedBy",
3473
- "Types",
3474
- "Defines",
3475
- "ContainedInStructure",
3476
- "ContainsElements"
3477
- ];
3478
- export type InverseAttribute = InverseAttributes[number];
3479
3482
  /**
3480
3483
  * 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.
3481
3484
  */
@@ -3505,6 +3508,30 @@ export interface StreamedAsset {
3505
3508
  color: number[];
3506
3509
  }[];
3507
3510
  }
3511
+ export type RelationsMap = Map<number, Map<number, number[]>>;
3512
+ export interface ModelsRelationMap {
3513
+ [modelID: string]: RelationsMap;
3514
+ }
3515
+ /**
3516
+ * Type alias for an array of inverse attribute names.
3517
+ */
3518
+ export type InverseAttributes = [
3519
+ "IsDecomposedBy",
3520
+ "Decomposes",
3521
+ "AssociatedTo",
3522
+ "HasAssociations",
3523
+ "ClassificationForObjects",
3524
+ "IsGroupedBy",
3525
+ "HasAssignments",
3526
+ "IsDefinedBy",
3527
+ "DefinesOcurrence",
3528
+ "IsTypedBy",
3529
+ "Types",
3530
+ "Defines",
3531
+ "ContainedInStructure",
3532
+ "ContainsElements"
3533
+ ];
3534
+ export type InverseAttribute = InverseAttributes[number];
3508
3535
  import { BufferGeometry } from "three";
3509
3536
  import * as THREE from "three";
3510
3537
  export declare class TransformHelper {