@thatopen/components 2.3.0-alpha.2 → 2.3.0-alpha.3

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,122 +1,4 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
3
- /**
4
- * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
5
- */
6
- export declare class Components implements Disposable {
7
- /**
8
- * The version of the @thatopen/components library.
9
- */
10
- static readonly release = "2.3.0-alpha.1";
11
- /** {@link Disposable.onDisposed} */
12
- readonly onDisposed: Event<void>;
13
- /**
14
- * The list of components created in this app.
15
- * The keys are UUIDs and the values are instances of the components.
16
- */
17
- readonly list: Map<string, Component>;
18
- /**
19
- * If disabled, the animation loop will be stopped.
20
- * Default value is false.
21
- */
22
- enabled: boolean;
23
- private _clock;
24
- /**
25
- * Adds a component to the list of components.
26
- * Throws an error if a component with the same UUID already exists.
27
- *
28
- * @param uuid - The unique identifier of the component.
29
- * @param instance - The instance of the component to be added.
30
- *
31
- * @throws Will throw an error if a component with the same UUID already exists.
32
- *
33
- * @internal
34
- */
35
- add(uuid: string, instance: Component): void;
36
- /**
37
- * Retrieves a component instance by its constructor function.
38
- * If the component does not exist in the list, it will be created and added.
39
- *
40
- * @template U - The type of the component to retrieve.
41
- * @param Component - The constructor function of the component to retrieve.
42
- *
43
- * @returns The instance of the requested component.
44
- *
45
- * @throws Will throw an error if a component with the same UUID already exists.
46
- *
47
- * @internal
48
- */
49
- get<U extends Component>(Component: new (components: Components) => U): U;
50
- constructor();
51
- /**
52
- * Initializes the Components instance.
53
- * This method starts the animation loop, sets the enabled flag to true,
54
- * and calls the update method.
55
- *
56
- * @returns {void}
57
- */
58
- init(): void;
59
- /**
60
- * Disposes the memory of all the components and tools of this instance of
61
- * the library. A memory leak will be created if:
62
- *
63
- * - An instance of the library ends up out of scope and this function isn't
64
- * called. This is especially relevant in Single Page Applications (React,
65
- * Angular, Vue, etc).
66
- *
67
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
68
- * referenced by a reference type (object or array).
69
- *
70
- * You can learn more about how Three.js handles memory leaks
71
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
72
- *
73
- */
74
- dispose(): void;
75
- private update;
76
- private static setupBVH;
77
- }
78
- import { Component, Disposable, World, Event } from "../Types";
79
- import { SimpleRaycaster } from "./src";
80
- import { Components } from "../Components";
81
- /**
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).
83
- */
84
- export declare class Raycasters extends Component implements Disposable {
85
- /**
86
- * A unique identifier for the component.
87
- * This UUID is used to register the component within the Components system.
88
- */
89
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
90
- /** {@link Component.enabled} */
91
- enabled: boolean;
92
- /**
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.
95
- */
96
- list: Map<string, SimpleRaycaster>;
97
- /** {@link Disposable.onDisposed} */
98
- onDisposed: Event<unknown>;
99
- constructor(components: Components);
100
- /**
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.
107
- */
108
- get(world: World): SimpleRaycaster;
109
- /**
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}
115
- */
116
- delete(world: World): void;
117
- /** {@link Disposable.dispose} */
118
- dispose(): void;
119
- }
120
2
  import * as THREE from "three";
121
3
  import { Components } from "../Components";
122
4
  import { Component } from "../Types";
@@ -221,53 +103,103 @@ export declare class ShadowedScene extends SimpleScene implements Disposable, Co
221
103
  private recomputeShadows;
222
104
  }
223
105
  import { Component, Disposable, World, Event } from "../Types";
224
- import { GridConfig, SimpleGrid } from "./src";
106
+ import { SimpleRaycaster } from "./src";
225
107
  import { Components } from "../Components";
226
108
  /**
227
- * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
109
+ * 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).
228
110
  */
229
- export declare class Grids extends Component implements Disposable {
111
+ export declare class Raycasters extends Component implements Disposable {
230
112
  /**
231
113
  * A unique identifier for the component.
232
114
  * This UUID is used to register the component within the Components system.
233
115
  */
234
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
116
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
117
+ /** {@link Component.enabled} */
118
+ enabled: boolean;
235
119
  /**
236
- * A map of world UUIDs to their corresponding grid instances.
120
+ * A Map that stores raycasters for each world.
121
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
237
122
  */
238
- list: Map<string, SimpleGrid>;
123
+ list: Map<string, SimpleRaycaster>;
124
+ /** {@link Disposable.onDisposed} */
125
+ onDisposed: Event<unknown>;
126
+ constructor(components: Components);
239
127
  /**
240
- * The default configuration for grid creation.
128
+ * Retrieves a SimpleRaycaster instance for the given world.
129
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
130
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
131
+ *
132
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
133
+ * @returns The SimpleRaycaster instance for the given world.
134
+ */
135
+ get(world: World): SimpleRaycaster;
136
+ /**
137
+ * Deletes the SimpleRaycaster instance associated with the given world.
138
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
139
+ *
140
+ * @param world - The world for which to delete the SimpleRaycaster instance.
141
+ * @returns {void}
142
+ */
143
+ delete(world: World): void;
144
+ /** {@link Disposable.dispose} */
145
+ dispose(): void;
146
+ }
147
+ import * as THREE from "three";
148
+ import { Components } from "../Components";
149
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
150
+ import { Component, Event, Disposable, World } from "../Types";
151
+ /**
152
+ * 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).
153
+ */
154
+ export declare class Cullers extends Component implements Disposable {
155
+ /**
156
+ * A unique identifier for the component.
157
+ * This UUID is used to register the component within the Components system.
158
+ */
159
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
160
+ /**
161
+ * An event that is triggered when the Cullers component is disposed.
241
162
  */
242
- config: Required<GridConfig>;
243
- /** {@link Disposable.onDisposed} */
244
163
  readonly onDisposed: Event<unknown>;
164
+ private _enabled;
165
+ /**
166
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
167
+ */
168
+ list: Map<string, MeshCullerRenderer>;
245
169
  /** {@link Component.enabled} */
246
- enabled: boolean;
170
+ get enabled(): boolean;
171
+ /** {@link Component.enabled} */
172
+ set enabled(value: boolean);
247
173
  constructor(components: Components);
248
174
  /**
249
- * Creates a new grid for the given world.
250
- * Throws an error if a grid already exists for the world.
175
+ * Creates a new MeshCullerRenderer for the given world.
176
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
251
177
  *
252
- * @param world - The world to create the grid for.
253
- * @returns The newly created grid.
178
+ * @param world - The world for which to create the MeshCullerRenderer.
179
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
254
180
  *
255
- * @throws Will throw an error if a grid already exists for the given world.
181
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
256
182
  */
257
- create(world: World): SimpleGrid;
183
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
258
184
  /**
259
- * Deletes the grid associated with the given world.
260
- * If a grid does not exist for the given world, this method does nothing.
185
+ * Deletes the MeshCullerRenderer associated with the given world.
186
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
261
187
  *
262
- * @param world - The world for which to delete the grid.
188
+ * @param world - The world for which to delete the MeshCullerRenderer.
263
189
  *
264
- * @remarks
265
- * This method will dispose of the grid and remove it from the internal list.
266
- * If the world is disposed before calling this method, the grid will be automatically deleted.
190
+ * @returns {void}
267
191
  */
268
192
  delete(world: World): void;
269
193
  /** {@link Disposable.dispose} */
270
194
  dispose(): void;
195
+ /**
196
+ * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
197
+ *
198
+ * @param meshes - The meshes to update.
199
+ *
200
+ * @returns {void}
201
+ */
202
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
271
203
  }
272
204
  import * as THREE from "three";
273
205
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
@@ -400,165 +332,166 @@ export declare class Clipper extends Component implements Createable, Disposable
400
332
  private _onStartDragging;
401
333
  private _onEndDragging;
402
334
  }
403
- import * as THREE from "three";
335
+ import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
404
336
  import { Components } from "../Components";
405
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
406
- import { Component, Event, Disposable, World } from "../Types";
407
- /**
408
- * 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).
409
- */
410
- export declare class Cullers extends Component implements Disposable {
337
+ import { BCFViewpoint, Viewpoint } from "./src";
338
+ import { ViewpointsConfigManger, ViewpointsConfig } from "./src/viewpoints-config";
339
+ export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfigManger, ViewpointsConfig> {
340
+ static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
341
+ enabled: boolean;
411
342
  /**
412
- * A unique identifier for the component.
413
- * This UUID is used to register the component within the Components system.
343
+ * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
344
+ * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
414
345
  */
415
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
346
+ readonly list: DataMap<string, Viewpoint>;
416
347
  /**
417
- * An event that is triggered when the Cullers component is disposed.
348
+ * Creates a new Viewpoint instance and adds it to the list.
349
+ *
350
+ * @param world - The world in which the Viewpoint will be created.
351
+ * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used.
352
+ *
353
+ * @returns The newly created Viewpoint instance.
418
354
  */
355
+ create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
356
+ constructor(components: Components);
357
+ isSetup: boolean;
358
+ setup(): void;
359
+ onSetup: Event<unknown>;
360
+ config: ViewpointsConfigManger;
419
361
  readonly onDisposed: Event<unknown>;
420
- private _enabled;
421
362
  /**
422
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
363
+ * Disposes of the Viewpoints component and its associated resources.
364
+ *
365
+ * This method is responsible for cleaning up any resources held by the Viewpoints component,
366
+ * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the
367
+ * onDisposed event.
423
368
  */
424
- list: Map<string, MeshCullerRenderer>;
425
- /** {@link Component.enabled} */
426
- get enabled(): boolean;
427
- /** {@link Component.enabled} */
428
- set enabled(value: boolean);
369
+ dispose(): void;
370
+ }
371
+ import { Component, Disposable, World, Event } from "../Types";
372
+ import { GridConfig, SimpleGrid } from "./src";
373
+ import { Components } from "../Components";
374
+ /**
375
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
376
+ */
377
+ export declare class Grids extends Component implements Disposable {
378
+ /**
379
+ * A unique identifier for the component.
380
+ * This UUID is used to register the component within the Components system.
381
+ */
382
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
383
+ /**
384
+ * A map of world UUIDs to their corresponding grid instances.
385
+ */
386
+ list: Map<string, SimpleGrid>;
387
+ /**
388
+ * The default configuration for grid creation.
389
+ */
390
+ config: Required<GridConfig>;
391
+ /** {@link Disposable.onDisposed} */
392
+ readonly onDisposed: Event<unknown>;
393
+ /** {@link Component.enabled} */
394
+ enabled: boolean;
429
395
  constructor(components: Components);
430
396
  /**
431
- * Creates a new MeshCullerRenderer for the given world.
432
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
397
+ * Creates a new grid for the given world.
398
+ * Throws an error if a grid already exists for the world.
433
399
  *
434
- * @param world - The world for which to create the MeshCullerRenderer.
435
- * @param config - Optional configuration settings for the MeshCullerRenderer.
400
+ * @param world - The world to create the grid for.
401
+ * @returns The newly created grid.
436
402
  *
437
- * @returns The newly created or existing MeshCullerRenderer for the given world.
403
+ * @throws Will throw an error if a grid already exists for the given world.
438
404
  */
439
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
405
+ create(world: World): SimpleGrid;
440
406
  /**
441
- * Deletes the MeshCullerRenderer associated with the given world.
442
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
407
+ * Deletes the grid associated with the given world.
408
+ * If a grid does not exist for the given world, this method does nothing.
443
409
  *
444
- * @param world - The world for which to delete the MeshCullerRenderer.
410
+ * @param world - The world for which to delete the grid.
445
411
  *
446
- * @returns {void}
412
+ * @remarks
413
+ * This method will dispose of the grid and remove it from the internal list.
414
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
447
415
  */
448
416
  delete(world: World): void;
449
417
  /** {@link Disposable.dispose} */
450
418
  dispose(): void;
451
- /**
452
- * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
453
- *
454
- * @param meshes - The meshes to update.
455
- *
456
- * @returns {void}
457
- */
458
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
459
419
  }
460
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
461
- import { Components } from "../Components";
462
- import { SimpleWorld } from "./src";
420
+ import { Component, Disposable, Event } from "../Types";
463
421
  /**
464
- * 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).
422
+ * 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.
465
423
  */
466
- export declare class Worlds extends Component implements Updateable, Disposable {
424
+ export declare class Components implements Disposable {
467
425
  /**
468
- * A unique identifier for the component.
469
- * This UUID is used to register the component within the Components system.
426
+ * The version of the @thatopen/components library.
470
427
  */
471
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
472
- /** {@link Updateable.onAfterUpdate} */
473
- readonly onAfterUpdate: Event<unknown>;
474
- /** {@link Updateable.onBeforeUpdate} */
475
- readonly onBeforeUpdate: Event<unknown>;
428
+ static readonly release = "2.3.0-alpha.1";
476
429
  /** {@link Disposable.onDisposed} */
477
- readonly onDisposed: Event<unknown>;
478
- /**
479
- * An event that is triggered when a new world is created.
480
- * The event passes the newly created world as a parameter.
481
- */
482
- readonly onWorldCreated: Event<World>;
430
+ readonly onDisposed: Event<void>;
483
431
  /**
484
- * An event that is triggered when a world is deleted.
485
- * The event passes the UUID of the deleted world as a parameter.
432
+ * The list of components created in this app.
433
+ * The keys are UUIDs and the values are instances of the components.
486
434
  */
487
- readonly onWorldDeleted: Event<string>;
435
+ readonly list: Map<string, Component>;
488
436
  /**
489
- * A collection of worlds managed by this component.
490
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
437
+ * If disabled, the animation loop will be stopped.
438
+ * Default value is false.
491
439
  */
492
- list: Map<string, World>;
493
- /** {@link Component.enabled} */
494
440
  enabled: boolean;
495
- constructor(components: Components);
441
+ private _clock;
496
442
  /**
497
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
443
+ * Adds a component to the list of components.
444
+ * Throws an error if a component with the same UUID already exists.
498
445
  *
499
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
500
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
501
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
446
+ * @param uuid - The unique identifier of the component.
447
+ * @param instance - The instance of the component to be added.
502
448
  *
503
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
449
+ * @throws Will throw an error if a component with the same UUID already exists.
450
+ *
451
+ * @internal
504
452
  */
505
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
453
+ add(uuid: string, instance: Component): void;
506
454
  /**
507
- * Deletes a world from the list of worlds.
455
+ * Retrieves a component instance by its constructor function.
456
+ * If the component does not exist in the list, it will be created and added.
508
457
  *
509
- * @param {World} world - The world to be deleted.
458
+ * @template U - The type of the component to retrieve.
459
+ * @param Component - The constructor function of the component to retrieve.
510
460
  *
511
- * @throws {Error} - Throws an error if the provided world is not found in the list.
461
+ * @returns The instance of the requested component.
512
462
  *
513
- * @returns {void}
463
+ * @throws Will throw an error if a component with the same UUID already exists.
464
+ *
465
+ * @internal
514
466
  */
515
- delete(world: World): void;
467
+ get<U extends Component>(Component: new (components: Components) => U): U;
468
+ constructor();
516
469
  /**
517
- * Disposes of the Worlds component and all its managed worlds.
518
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
519
- * and triggers the onDisposed event.
470
+ * Initializes the Components instance.
471
+ * This method starts the animation loop, sets the enabled flag to true,
472
+ * and calls the update method.
520
473
  *
521
474
  * @returns {void}
522
475
  */
523
- dispose(): void;
524
- /** {@link Updateable.update} */
525
- update(delta?: number): void | Promise<void>;
526
- }
527
- import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
528
- import { Components } from "../Components";
529
- import { BCFViewpoint, Viewpoint } from "./src";
530
- import { ViewpointsConfigManger, ViewpointsConfig } from "./src/viewpoints-config";
531
- export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfigManger, ViewpointsConfig> {
532
- static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
533
- enabled: boolean;
534
- /**
535
- * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
536
- * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
537
- */
538
- readonly list: DataMap<string, Viewpoint>;
476
+ init(): void;
539
477
  /**
540
- * Creates a new Viewpoint instance and adds it to the list.
478
+ * Disposes the memory of all the components and tools of this instance of
479
+ * the library. A memory leak will be created if:
541
480
  *
542
- * @param world - The world in which the Viewpoint will be created.
543
- * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used.
481
+ * - An instance of the library ends up out of scope and this function isn't
482
+ * called. This is especially relevant in Single Page Applications (React,
483
+ * Angular, Vue, etc).
544
484
  *
545
- * @returns The newly created Viewpoint instance.
546
- */
547
- create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
548
- constructor(components: Components);
549
- isSetup: boolean;
550
- setup(): void;
551
- onSetup: Event<unknown>;
552
- config: ViewpointsConfigManger;
553
- readonly onDisposed: Event<unknown>;
554
- /**
555
- * Disposes of the Viewpoints component and its associated resources.
485
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
486
+ * referenced by a reference type (object or array).
487
+ *
488
+ * You can learn more about how Three.js handles memory leaks
489
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
556
490
  *
557
- * This method is responsible for cleaning up any resources held by the Viewpoints component,
558
- * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the
559
- * onDisposed event.
560
491
  */
561
492
  dispose(): void;
493
+ private update;
494
+ private static setupBVH;
562
495
  }
563
496
  import * as THREE from "three";
564
497
  import { Components } from "../Components";
@@ -624,407 +557,72 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
624
557
  private newOrthoCamera;
625
558
  private setOrthoPerspCameraAspect;
626
559
  }
627
- import * as WEBIFC from "web-ifc";
628
- import { FragmentsGroup } from "@thatopen/fragments";
629
- import { Component, Disposable, Event, Components } from "../../core";
630
- /**
631
- * Types for boolean properties in IFC schema.
632
- */
633
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
634
- /**
635
- * Types for string properties in IFC schema.
636
- */
637
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
638
- /**
639
- * Types for numeric properties in IFC schema.
640
- */
641
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
642
- /**
643
- * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
644
- */
645
- export interface ChangeMap {
646
- [modelID: string]: Set<number>;
647
- }
648
- /**
649
- * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
650
- */
651
- export interface AttributeListener {
652
- [modelID: string]: {
653
- [expressID: number]: {
654
- [attributeName: string]: Event<String | Boolean | Number>;
655
- };
656
- };
657
- }
560
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
561
+ import { Components } from "../Components";
562
+ import { SimpleWorld } from "./src";
658
563
  /**
659
- * Component to manage and edit properties and Psets in IFC files.
564
+ * 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).
660
565
  */
661
- export declare class IfcPropertiesManager extends Component implements Disposable {
566
+ export declare class Worlds extends Component implements Updateable, Disposable {
662
567
  /**
663
568
  * A unique identifier for the component.
664
569
  * This UUID is used to register the component within the Components system.
665
570
  */
666
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
571
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
572
+ /** {@link Updateable.onAfterUpdate} */
573
+ readonly onAfterUpdate: Event<unknown>;
574
+ /** {@link Updateable.onBeforeUpdate} */
575
+ readonly onBeforeUpdate: Event<unknown>;
667
576
  /** {@link Disposable.onDisposed} */
668
- readonly onDisposed: Event<string>;
577
+ readonly onDisposed: Event<unknown>;
669
578
  /**
670
- * Event triggered when a file is requested for export.
579
+ * An event that is triggered when a new world is created.
580
+ * The event passes the newly created world as a parameter.
671
581
  */
672
- readonly onRequestFile: Event<unknown>;
582
+ readonly onWorldCreated: Event<World>;
673
583
  /**
674
- * ArrayBuffer containing the IFC data to be exported.
584
+ * An event that is triggered when a world is deleted.
585
+ * The event passes the UUID of the deleted world as a parameter.
675
586
  */
676
- ifcToExport: ArrayBuffer | null;
587
+ readonly onWorldDeleted: Event<string>;
677
588
  /**
678
- * Event triggered when an element is added to a Pset.
589
+ * A collection of worlds managed by this component.
590
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
679
591
  */
680
- readonly onElementToPset: Event<{
681
- model: FragmentsGroup;
682
- psetID: number;
683
- elementID: number;
684
- }>;
592
+ list: Map<string, World>;
593
+ /** {@link Component.enabled} */
594
+ enabled: boolean;
595
+ constructor(components: Components);
685
596
  /**
686
- * Event triggered when a property is added to a Pset.
597
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
598
+ *
599
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
600
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
601
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
602
+ *
603
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
687
604
  */
688
- readonly onPropToPset: Event<{
689
- model: FragmentsGroup;
690
- psetID: number;
691
- propID: number;
692
- }>;
693
- /**
694
- * Event triggered when a Pset is removed.
695
- */
696
- readonly onPsetRemoved: Event<{
697
- model: FragmentsGroup;
698
- psetID: number;
699
- }>;
700
- /**
701
- * Event triggered when data in the model changes.
702
- */
703
- readonly onDataChanged: Event<{
704
- model: FragmentsGroup;
705
- expressID: number;
706
- }>;
707
- /**
708
- * Configuration for the WebAssembly module.
709
- */
710
- wasm: {
711
- path: string;
712
- absolute: boolean;
713
- };
714
- /** {@link Component.enabled} */
715
- enabled: boolean;
716
- /**
717
- * Map of attribute listeners.
718
- */
719
- attributeListeners: AttributeListener;
720
- /**
721
- * The currently selected model.
722
- */
723
- selectedModel?: FragmentsGroup;
724
- /**
725
- * Map of changed entities in the model.
726
- */
727
- changeMap: ChangeMap;
728
- constructor(components: Components);
729
- /** {@link Disposable.dispose} */
730
- dispose(): void;
731
- /**
732
- * Static method to retrieve the IFC schema from a given model.
733
- *
734
- * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
735
- * @throws Will throw an error if the IFC schema is not found in the model.
736
- * @returns The IFC schema associated with the given model.
737
- */
738
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
739
- /**
740
- * Method to add or update entity attributes in the model.
741
- *
742
- * @param model - The FragmentsGroup model in which to set the properties.
743
- * @param dataToSave - An array of objects representing the properties to be saved.
744
- * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
745
- * The rest of the properties will be set as the properties of the entity.
746
- *
747
- * @returns A promise that resolves when all the properties have been set.
748
- *
749
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
750
- */
751
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
752
- /**
753
- * Creates a new Property Set (Pset) in the given model.
754
- *
755
- * @param model - The FragmentsGroup model in which to create the Pset.
756
- * @param name - The name of the Pset.
757
- * @param description - (Optional) The description of the Pset.
758
- *
759
- * @returns A promise that resolves with an object containing the newly created Pset and its relation.
760
- *
761
- * @throws Will throw an error if the IFC schema is not found in the model.
762
- * @throws Will throw an error if no OwnerHistory is found in the model.
763
- */
764
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
765
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
766
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
767
- }>;
768
- /**
769
- * Removes a Property Set (Pset) from the given model.
770
- *
771
- * @param model - The FragmentsGroup model from which to remove the Pset.
772
- * @param psetID - The express IDs of the Psets to be removed.
773
- *
774
- * @returns A promise that resolves when all the Psets have been removed.
775
- *
776
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
777
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
778
- * @throws Will throw an error if no relation is found between the Pset and the model.
779
- */
780
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
781
- /**
782
- * Creates a new single-value property of type string in the given model.
783
- *
784
- * @param model - The FragmentsGroup model in which to create the property.
785
- * @param type - The type of the property value. Must be a string property type.
786
- * @param name - The name of the property.
787
- * @param value - The value of the property. Must be a string.
788
- *
789
- * @returns The newly created single-value property.
790
- *
791
- * @throws Will throw an error if the IFC schema is not found in the model.
792
- * @throws Will throw an error if no OwnerHistory is found in the model.
793
- */
794
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
795
- /**
796
- * Creates a new single-value property of type numeric in the given model.
797
- *
798
- * @param model - The FragmentsGroup model in which to create the property.
799
- * @param type - The type of the property value. Must be a numeric property type.
800
- * @param name - The name of the property.
801
- * @param value - The value of the property. Must be a number.
802
- *
803
- * @returns The newly created single-value property.
804
- *
805
- * @throws Will throw an error if the IFC schema is not found in the model.
806
- * @throws Will throw an error if no OwnerHistory is found in the model.
807
- */
808
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
809
- /**
810
- * Creates a new single-value property of type boolean in the given model.
811
- *
812
- * @param model - The FragmentsGroup model in which to create the property.
813
- * @param type - The type of the property value. Must be a boolean property type.
814
- * @param name - The name of the property.
815
- * @param value - The value of the property. Must be a boolean.
816
- *
817
- * @returns The newly created single-value property.
818
- *
819
- * @throws Will throw an error if the IFC schema is not found in the model.
820
- * @throws Will throw an error if no OwnerHistory is found in the model.
821
- */
822
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
823
- /**
824
- * Removes a property from a Property Set (Pset) in the given model.
825
- *
826
- * @param model - The FragmentsGroup model from which to remove the property.
827
- * @param psetID - The express ID of the Pset from which to remove the property.
828
- * @param propID - The express ID of the property to be removed.
829
- *
830
- * @returns A promise that resolves when the property has been removed.
831
- *
832
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
833
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
834
- */
835
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
836
- addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
837
- /**
838
- * Adds elements to a Property Set (Pset) in the given model.
839
- *
840
- * @param model - The FragmentsGroup model in which to add the elements.
841
- * @param psetID - The express ID of the Pset to which to add the elements.
842
- * @param elementID - The express IDs of the elements to be added.
843
- *
844
- * @returns A promise that resolves when all the elements have been added.
845
- *
846
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
847
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
848
- * @throws Will throw an error if no relation is found between the Pset and the model.
849
- */
850
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
851
- /**
852
- * Saves the changes made to the model to a new IFC file.
853
- *
854
- * @param model - The FragmentsGroup model from which to save the changes.
855
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
856
- *
857
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
858
- *
859
- * @throws Will throw an error if any issues occur during the saving process.
860
- */
861
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
862
- /**
863
- * Retrieves all the entities of a specific type from the model and returns their express IDs wrapped in Handles.
864
- * This is used to make references of an entity inside another entity attributes.
865
- *
866
- * @param model - The FragmentsGroup model from which to retrieve the entities.
867
- * @param type - The type of the entities to retrieve. This should be the express ID of the IFC type.
868
- *
869
- * @returns A promise that resolves with an array of Handles, each containing the express ID of an entity of the specified type.
870
- * @returns null if the model doesn't have any entity of that type
871
- */
872
- getEntityRef(model: FragmentsGroup, type: number): Promise<WEBIFC.Handle<unknown>[] | null>;
605
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
873
606
  /**
874
- * Sets an attribute listener for a specific attribute of an entity in the model.
875
- * The listener will trigger an event whenever the attribute's value changes.
876
- *
877
- * @param model - The FragmentsGroup model in which to set the attribute listener.
878
- * @param expressID - The express ID of the entity for which to set the listener.
879
- * @param attributeName - The name of the attribute for which to set the listener.
607
+ * Deletes a world from the list of worlds.
880
608
  *
881
- * @returns The event that will be triggered when the attribute's value changes.
609
+ * @param {World} world - The world to be deleted.
882
610
  *
883
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
884
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
885
- * @throws Will throw an error if the attribute has a badly defined handle.
886
- */
887
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
888
- private getNewExpressID;
889
- private newGUID;
890
- private getOwnerHistory;
891
- private registerChange;
892
- private newSingleProperty;
893
- }
894
- import { XMLParser } from "fast-xml-parser";
895
- import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core";
896
- import { BCFTopic, Topic, BCFTopicsConfigManager, BCFTopicsConfig } from "./src";
897
- import { Viewpoint } from "../../core/Viewpoints";
898
- export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfigManager, BCFTopicsConfig> {
899
- static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
900
- enabled: boolean;
901
- static xmlParser: XMLParser;
902
- protected _defaultConfig: Required<BCFTopicsConfig>;
903
- config: BCFTopicsConfigManager;
904
- readonly list: DataMap<string, Topic>;
905
- readonly onSetup: Event<unknown>;
906
- isSetup: boolean;
907
- setup(config?: Partial<BCFTopicsConfig>): void;
908
- readonly onBCFImported: Event<Topic[]>;
909
- /**
910
- * Creates a new BCFTopic instance and adds it to the list.
611
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
911
612
  *
912
- * @param data - Optional partial BCFTopic object to initialize the new topic with.
913
- * If not provided, default values will be used.
914
- * @returns The newly created BCFTopic instance.
613
+ * @returns {void}
915
614
  */
916
- create(data?: Partial<BCFTopic>): Topic;
917
- readonly onDisposed: Event<unknown>;
615
+ delete(world: World): void;
918
616
  /**
919
- * Disposes of the BCFTopics component and triggers the onDisposed event.
617
+ * Disposes of the Worlds component and all its managed worlds.
618
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
619
+ * and triggers the onDisposed event.
920
620
  *
921
- * @remarks
922
- * This method clears the list of topics and triggers the onDisposed event.
923
- * It also resets the onDisposed event listener.
621
+ * @returns {void}
924
622
  */
925
623
  dispose(): void;
926
- /**
927
- * Retrieves the unique set of topic types used across all topics.
928
- *
929
- * @returns A Set containing the unique topic types.
930
- */
931
- get usedTypes(): Set<string>;
932
- /**
933
- * Retrieves the unique set of topic statuses used across all topics.
934
- *
935
- * @returns A Set containing the unique topic statuses.
936
- */
937
- get usedStatuses(): Set<string>;
938
- /**
939
- * Retrieves the unique set of topic priorities used across all topics.
940
- *
941
- * @returns A Set containing the unique topic priorities.
942
- * Note: This method filters out any null or undefined priorities.
943
- */
944
- get usedPriorities(): Set<string | undefined>;
945
- /**
946
- * Retrieves the unique set of topic stages used across all topics.
947
- *
948
- * @returns A Set containing the unique topic stages.
949
- * Note: This method filters out any null or undefined stages.
950
- */
951
- get usedStages(): Set<string | undefined>;
952
- /**
953
- * Retrieves the unique set of users associated with topics.
954
- *
955
- * @returns A Set containing the unique users.
956
- * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
957
- */
958
- get usedUsers(): Set<string>;
959
- /**
960
- * Retrieves the unique set of labels used across all topics.
961
- *
962
- * @returns A Set containing the unique labels.
963
- */
964
- get usedLabels(): Set<string>;
965
- /**
966
- * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
967
- * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
968
- */
969
- updateExtensions(): void;
970
- /**
971
- * Updates the references to viewpoints in the topics.
972
- * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
973
- * If a viewpoint does not exist, it is removed from the topic's viewpoints.
974
- */
975
- updateViewpointReferences(): void;
976
- /**
977
- * Exports the given topics to a BCF (Building Collaboration Format) zip file.
978
- *
979
- * @param topics - The topics to export. Defaults to all topics in the list.
980
- * @returns A promise that resolves to a Blob containing the exported BCF zip file.
981
- */
982
- export(topics?: Iterable<Topic>): Promise<Blob>;
983
- private serializeExtensions;
984
- private processMarkupComment;
985
- private getMarkupComments;
986
- private getMarkupLabels;
987
- private getMarkupViewpoints;
988
- private getMarkupRelatedTopics;
989
- /**
990
- * Loads BCF (Building Collaboration Format) data into the engine.
991
- *
992
- * @param world - The default world where the viewpoints are going to be created.
993
- * @param data - The BCF data to load.
994
- *
995
- * @returns A promise that resolves to an object containing the created viewpoints and topics.
996
- *
997
- * @throws An error if the BCF version is not supported.
998
- */
999
- load(data: Uint8Array, world: World): Promise<{
1000
- viewpoints: Viewpoint[];
1001
- topics: Topic[];
1002
- }>;
1003
- }
1004
- import * as WEBIFC from "web-ifc";
1005
- import * as FRAG from "@thatopen/fragments";
1006
- import { Component, Components } from "../../core";
1007
- /**
1008
- * 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).
1009
- */
1010
- export declare class IfcJsonExporter extends Component {
1011
- /**
1012
- * A unique identifier for the component.
1013
- * This UUID is used to register the component within the Components system.
1014
- */
1015
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1016
- /** {@link Component.enabled} */
1017
- enabled: boolean;
1018
- constructor(components: Components);
1019
- /**
1020
- * Exports all the properties of an IFC into an array of JS objects.
1021
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1022
- * @param modelID ID of the IFC model whose properties to extract.
1023
- * @param indirect whether to get the indirect relationships as well.
1024
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1025
- * to make the location data available (e.g. absolute position of building).
1026
- */
1027
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
624
+ /** {@link Updateable.update} */
625
+ update(delta?: number): void | Promise<void>;
1028
626
  }
1029
627
  import * as WEBIFC from "web-ifc";
1030
628
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1201,6 +799,53 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
1201
799
  */
1202
800
  getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1203
801
  }
802
+ import { MiniMap } from "./src";
803
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
804
+ import { Components } from "../Components";
805
+ /**
806
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
807
+ */
808
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
809
+ /**
810
+ * A unique identifier for the component.
811
+ * This UUID is used to register the component within the Components system.
812
+ */
813
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
814
+ /** {@link Updateable.onAfterUpdate} */
815
+ readonly onAfterUpdate: Event<unknown>;
816
+ /** {@link Updateable.onBeforeUpdate} */
817
+ readonly onBeforeUpdate: Event<unknown>;
818
+ /** {@link Disposable.onDisposed} */
819
+ readonly onDisposed: Event<unknown>;
820
+ /** {@link Component.enabled} */
821
+ enabled: boolean;
822
+ /**
823
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
824
+ */
825
+ list: Map<string, MiniMap>;
826
+ constructor(components: Components);
827
+ /**
828
+ * Creates a new {@link MiniMap} instance associated with the given world.
829
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
830
+ *
831
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
832
+ * @returns The newly created {@link MiniMap} instance.
833
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
834
+ */
835
+ create(world: World): MiniMap;
836
+ /**
837
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
838
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
839
+ *
840
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
841
+ * @returns {void}
842
+ */
843
+ delete(id: string): void;
844
+ /** {@link Disposable.dispose} */
845
+ dispose(): void;
846
+ /** {@link Updateable.update} */
847
+ update(): void;
848
+ }
1204
849
  import { Component, Disposable, Event, Components } from "../../core";
1205
850
  /**
1206
851
  * 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).
@@ -1245,58 +890,11 @@ export declare class Exploder extends Component implements Disposable {
1245
890
  * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1246
891
  * If 'active' is false, the fragments are moved back to their original position.
1247
892
  *
1248
- * The method also keeps track of the exploded items using the 'list' set.
1249
- *
1250
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1251
- */
1252
- set(active: boolean): void;
1253
- }
1254
- import { MiniMap } from "./src";
1255
- import { Component, Updateable, World, Event, Disposable } from "../Types";
1256
- import { Components } from "../Components";
1257
- /**
1258
- * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
1259
- */
1260
- export declare class MiniMaps extends Component implements Updateable, Disposable {
1261
- /**
1262
- * A unique identifier for the component.
1263
- * This UUID is used to register the component within the Components system.
1264
- */
1265
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
1266
- /** {@link Updateable.onAfterUpdate} */
1267
- readonly onAfterUpdate: Event<unknown>;
1268
- /** {@link Updateable.onBeforeUpdate} */
1269
- readonly onBeforeUpdate: Event<unknown>;
1270
- /** {@link Disposable.onDisposed} */
1271
- readonly onDisposed: Event<unknown>;
1272
- /** {@link Component.enabled} */
1273
- enabled: boolean;
1274
- /**
1275
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
1276
- */
1277
- list: Map<string, MiniMap>;
1278
- constructor(components: Components);
1279
- /**
1280
- * Creates a new {@link MiniMap} instance associated with the given world.
1281
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
1282
- *
1283
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
1284
- * @returns The newly created {@link MiniMap} instance.
1285
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
1286
- */
1287
- create(world: World): MiniMap;
1288
- /**
1289
- * Deletes a {@link MiniMap} instance associated with the given world ID.
1290
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
893
+ * The method also keeps track of the exploded items using the 'list' set.
1291
894
  *
1292
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
1293
- * @returns {void}
895
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1294
896
  */
1295
- delete(id: string): void;
1296
- /** {@link Disposable.dispose} */
1297
- dispose(): void;
1298
- /** {@link Updateable.update} */
1299
- update(): void;
897
+ set(active: boolean): void;
1300
898
  }
1301
899
  import * as THREE from "three";
1302
900
  import * as FRAGS from "@thatopen/fragments";
@@ -1457,58 +1055,312 @@ export declare class Classifier extends Component implements Disposable {
1457
1055
  *
1458
1056
  * @throws Will throw an error if the fragment with the specified ID is not found.
1459
1057
  */
1460
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1058
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1059
+ /**
1060
+ * Resets the color of the specified fragments to their original color.
1061
+ *
1062
+ * @param items - A map of fragment IDs to their respective express IDs.
1063
+ *
1064
+ * @remarks
1065
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1066
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1067
+ *
1068
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1069
+ */
1070
+ resetColor(items: FRAGS.FragmentIdMap): void;
1071
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1072
+ }
1073
+ import * as WEBIFC from "web-ifc";
1074
+ import * as FRAG from "@thatopen/fragments";
1075
+ import { Component, Components } from "../../core";
1076
+ /**
1077
+ * 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).
1078
+ */
1079
+ export declare class IfcJsonExporter extends Component {
1080
+ /**
1081
+ * A unique identifier for the component.
1082
+ * This UUID is used to register the component within the Components system.
1083
+ */
1084
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1085
+ /** {@link Component.enabled} */
1086
+ enabled: boolean;
1087
+ constructor(components: Components);
1088
+ /**
1089
+ * Exports all the properties of an IFC into an array of JS objects.
1090
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1091
+ * @param modelID ID of the IFC model whose properties to extract.
1092
+ * @param indirect whether to get the indirect relationships as well.
1093
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1094
+ * to make the location data available (e.g. absolute position of building).
1095
+ */
1096
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1097
+ }
1098
+ import * as WEBIFC from "web-ifc";
1099
+ import { FragmentsGroup } from "@thatopen/fragments";
1100
+ import { Component, Disposable, Event, Components } from "../../core";
1101
+ /**
1102
+ * Types for boolean properties in IFC schema.
1103
+ */
1104
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1105
+ /**
1106
+ * Types for string properties in IFC schema.
1107
+ */
1108
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1109
+ /**
1110
+ * Types for numeric properties in IFC schema.
1111
+ */
1112
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
1113
+ /**
1114
+ * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
1115
+ */
1116
+ export interface ChangeMap {
1117
+ [modelID: string]: Set<number>;
1118
+ }
1119
+ /**
1120
+ * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
1121
+ */
1122
+ export interface AttributeListener {
1123
+ [modelID: string]: {
1124
+ [expressID: number]: {
1125
+ [attributeName: string]: Event<String | Boolean | Number>;
1126
+ };
1127
+ };
1128
+ }
1129
+ /**
1130
+ * Component to manage and edit properties and Psets in IFC files.
1131
+ */
1132
+ export declare class IfcPropertiesManager extends Component implements Disposable {
1133
+ /**
1134
+ * A unique identifier for the component.
1135
+ * This UUID is used to register the component within the Components system.
1136
+ */
1137
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1138
+ /** {@link Disposable.onDisposed} */
1139
+ readonly onDisposed: Event<string>;
1140
+ /**
1141
+ * Event triggered when a file is requested for export.
1142
+ */
1143
+ readonly onRequestFile: Event<unknown>;
1144
+ /**
1145
+ * ArrayBuffer containing the IFC data to be exported.
1146
+ */
1147
+ ifcToExport: ArrayBuffer | null;
1148
+ /**
1149
+ * Event triggered when an element is added to a Pset.
1150
+ */
1151
+ readonly onElementToPset: Event<{
1152
+ model: FragmentsGroup;
1153
+ psetID: number;
1154
+ elementID: number;
1155
+ }>;
1156
+ /**
1157
+ * Event triggered when a property is added to a Pset.
1158
+ */
1159
+ readonly onPropToPset: Event<{
1160
+ model: FragmentsGroup;
1161
+ psetID: number;
1162
+ propID: number;
1163
+ }>;
1164
+ /**
1165
+ * Event triggered when a Pset is removed.
1166
+ */
1167
+ readonly onPsetRemoved: Event<{
1168
+ model: FragmentsGroup;
1169
+ psetID: number;
1170
+ }>;
1171
+ /**
1172
+ * Event triggered when data in the model changes.
1173
+ */
1174
+ readonly onDataChanged: Event<{
1175
+ model: FragmentsGroup;
1176
+ expressID: number;
1177
+ }>;
1178
+ /**
1179
+ * Configuration for the WebAssembly module.
1180
+ */
1181
+ wasm: {
1182
+ path: string;
1183
+ absolute: boolean;
1184
+ };
1185
+ /** {@link Component.enabled} */
1186
+ enabled: boolean;
1187
+ /**
1188
+ * Map of attribute listeners.
1189
+ */
1190
+ attributeListeners: AttributeListener;
1191
+ /**
1192
+ * The currently selected model.
1193
+ */
1194
+ selectedModel?: FragmentsGroup;
1195
+ /**
1196
+ * Map of changed entities in the model.
1197
+ */
1198
+ changeMap: ChangeMap;
1199
+ constructor(components: Components);
1200
+ /** {@link Disposable.dispose} */
1201
+ dispose(): void;
1202
+ /**
1203
+ * Static method to retrieve the IFC schema from a given model.
1204
+ *
1205
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1206
+ * @throws Will throw an error if the IFC schema is not found in the model.
1207
+ * @returns The IFC schema associated with the given model.
1208
+ */
1209
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1210
+ /**
1211
+ * Method to add or update entity attributes in the model.
1212
+ *
1213
+ * @param model - The FragmentsGroup model in which to set the properties.
1214
+ * @param dataToSave - An array of objects representing the properties to be saved.
1215
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1216
+ * The rest of the properties will be set as the properties of the entity.
1217
+ *
1218
+ * @returns A promise that resolves when all the properties have been set.
1219
+ *
1220
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1221
+ */
1222
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1223
+ /**
1224
+ * Creates a new Property Set (Pset) in the given model.
1225
+ *
1226
+ * @param model - The FragmentsGroup model in which to create the Pset.
1227
+ * @param name - The name of the Pset.
1228
+ * @param description - (Optional) The description of the Pset.
1229
+ *
1230
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1231
+ *
1232
+ * @throws Will throw an error if the IFC schema is not found in the model.
1233
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1234
+ */
1235
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1236
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1237
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1238
+ }>;
1239
+ /**
1240
+ * Removes a Property Set (Pset) from the given model.
1241
+ *
1242
+ * @param model - The FragmentsGroup model from which to remove the Pset.
1243
+ * @param psetID - The express IDs of the Psets to be removed.
1244
+ *
1245
+ * @returns A promise that resolves when all the Psets have been removed.
1246
+ *
1247
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1248
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1249
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1250
+ */
1251
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1252
+ /**
1253
+ * Creates a new single-value property of type string in the given model.
1254
+ *
1255
+ * @param model - The FragmentsGroup model in which to create the property.
1256
+ * @param type - The type of the property value. Must be a string property type.
1257
+ * @param name - The name of the property.
1258
+ * @param value - The value of the property. Must be a string.
1259
+ *
1260
+ * @returns The newly created single-value property.
1261
+ *
1262
+ * @throws Will throw an error if the IFC schema is not found in the model.
1263
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1264
+ */
1265
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1266
+ /**
1267
+ * Creates a new single-value property of type numeric in the given model.
1268
+ *
1269
+ * @param model - The FragmentsGroup model in which to create the property.
1270
+ * @param type - The type of the property value. Must be a numeric property type.
1271
+ * @param name - The name of the property.
1272
+ * @param value - The value of the property. Must be a number.
1273
+ *
1274
+ * @returns The newly created single-value property.
1275
+ *
1276
+ * @throws Will throw an error if the IFC schema is not found in the model.
1277
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1278
+ */
1279
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1280
+ /**
1281
+ * Creates a new single-value property of type boolean in the given model.
1282
+ *
1283
+ * @param model - The FragmentsGroup model in which to create the property.
1284
+ * @param type - The type of the property value. Must be a boolean property type.
1285
+ * @param name - The name of the property.
1286
+ * @param value - The value of the property. Must be a boolean.
1287
+ *
1288
+ * @returns The newly created single-value property.
1289
+ *
1290
+ * @throws Will throw an error if the IFC schema is not found in the model.
1291
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1292
+ */
1293
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1294
+ /**
1295
+ * Removes a property from a Property Set (Pset) in the given model.
1296
+ *
1297
+ * @param model - The FragmentsGroup model from which to remove the property.
1298
+ * @param psetID - The express ID of the Pset from which to remove the property.
1299
+ * @param propID - The express ID of the property to be removed.
1300
+ *
1301
+ * @returns A promise that resolves when the property has been removed.
1302
+ *
1303
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1304
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1305
+ */
1306
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1307
+ addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
1461
1308
  /**
1462
- * Resets the color of the specified fragments to their original color.
1309
+ * Adds elements to a Property Set (Pset) in the given model.
1463
1310
  *
1464
- * @param items - A map of fragment IDs to their respective express IDs.
1311
+ * @param model - The FragmentsGroup model in which to add the elements.
1312
+ * @param psetID - The express ID of the Pset to which to add the elements.
1313
+ * @param elementID - The express IDs of the elements to be added.
1465
1314
  *
1466
- * @remarks
1467
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1468
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1315
+ * @returns A promise that resolves when all the elements have been added.
1469
1316
  *
1470
- * @throws Will throw an error if the fragment with the specified ID is not found.
1317
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1318
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1319
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1471
1320
  */
1472
- resetColor(items: FRAGS.FragmentIdMap): void;
1473
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1474
- }
1475
- import * as FRAGS from "@thatopen/fragments";
1476
- import { Components, Component } from "../../core";
1477
- /**
1478
- * 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).
1479
- */
1480
- export declare class Hider extends Component {
1321
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1481
1322
  /**
1482
- * A unique identifier for the component.
1483
- * This UUID is used to register the component within the Components system.
1323
+ * Saves the changes made to the model to a new IFC file.
1324
+ *
1325
+ * @param model - The FragmentsGroup model from which to save the changes.
1326
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1327
+ *
1328
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1329
+ *
1330
+ * @throws Will throw an error if any issues occur during the saving process.
1484
1331
  */
1485
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1486
- /** {@link Component.enabled} */
1487
- enabled: boolean;
1488
- constructor(components: Components);
1332
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1489
1333
  /**
1490
- * Sets the visibility of fragments within the 3D scene.
1491
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1492
- * If 'items' is provided, only the specified fragments will be affected.
1334
+ * Retrieves all the entities of a specific type from the model and returns their express IDs wrapped in Handles.
1335
+ * This is used to make references of an entity inside another entity attributes.
1493
1336
  *
1494
- * @param visible - The visibility state to set for the fragments.
1495
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1496
- * If not provided, all fragments will be affected.
1337
+ * @param model - The FragmentsGroup model from which to retrieve the entities.
1338
+ * @param type - The type of the entities to retrieve. This should be the express ID of the IFC type.
1497
1339
  *
1498
- * @returns {void}
1340
+ * @returns A promise that resolves with an array of Handles, each containing the express ID of an entity of the specified type.
1341
+ * @returns null if the model doesn't have any entity of that type
1499
1342
  */
1500
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1343
+ getEntityRef(model: FragmentsGroup, type: number): Promise<WEBIFC.Handle<unknown>[] | null>;
1501
1344
  /**
1502
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1503
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1345
+ * Sets an attribute listener for a specific attribute of an entity in the model.
1346
+ * The listener will trigger an event whenever the attribute's value changes.
1504
1347
  *
1505
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1506
- * If not provided, all fragments will be isolated.
1348
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
1349
+ * @param expressID - The express ID of the entity for which to set the listener.
1350
+ * @param attributeName - The name of the attribute for which to set the listener.
1507
1351
  *
1508
- * @returns {void}
1352
+ * @returns The event that will be triggered when the attribute's value changes.
1353
+ *
1354
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
1355
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1356
+ * @throws Will throw an error if the attribute has a badly defined handle.
1509
1357
  */
1510
- isolate(items: FRAGS.FragmentIdMap): void;
1511
- private updateCulledVisibility;
1358
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1359
+ private getNewExpressID;
1360
+ private newGUID;
1361
+ private getOwnerHistory;
1362
+ private registerChange;
1363
+ private newSingleProperty;
1512
1364
  }
1513
1365
  import * as WEBIFC from "web-ifc";
1514
1366
  import * as FRAGS from "@thatopen/fragments";
@@ -1672,102 +1524,265 @@ export declare class FragmentsManager extends Component implements Disposable {
1672
1524
  * It iterates over the fragments in the list and pushes their meshes into an array.
1673
1525
  * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1674
1526
  */
1675
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1676
- constructor(components: Components);
1677
- /** {@link Disposable.dispose} */
1678
- dispose(): void;
1527
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1528
+ constructor(components: Components);
1529
+ /** {@link Disposable.dispose} */
1530
+ dispose(): void;
1531
+ /**
1532
+ * Dispose of a specific fragment group.
1533
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1534
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1535
+ *
1536
+ * @param group - The fragment group to be disposed.
1537
+ */
1538
+ disposeGroup(group: FragmentsGroup): void;
1539
+ /**
1540
+ * Loads a binary file that contain fragment geometry.
1541
+ * @param data - The binary data to load.
1542
+ * @param config - Optional configuration for loading.
1543
+ * @param config.isStreamed - Optional setting to determine whether this model is streamed or not.
1544
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1545
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1546
+ * @returns The loaded FragmentsGroup.
1547
+ */
1548
+ load(data: Uint8Array, config?: Partial<{
1549
+ coordinate: boolean;
1550
+ name: string;
1551
+ properties: FRAGS.IfcProperties;
1552
+ relationsMap: RelationsMap;
1553
+ isStreamed?: boolean;
1554
+ }>): FragmentsGroup;
1555
+ /**
1556
+ * Export the specified fragmentsgroup to binary data.
1557
+ * @param group - the fragments group to be exported.
1558
+ * @returns the exported data as binary buffer.
1559
+ */
1560
+ export(group: FragmentsGroup): Uint8Array;
1561
+ /**
1562
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1563
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1564
+ * @returns A map of model IDs to sets of express IDs.
1565
+ */
1566
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1567
+ [modelID: string]: Set<number>;
1568
+ };
1569
+ /**
1570
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1571
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1572
+ * @returns A fragment ID map.
1573
+ * @remarks
1574
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1575
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1576
+ * The fragment ID maps are then merged into a single map and returned.
1577
+ * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1578
+ */
1579
+ modelIdToFragmentIdMap(modelIdMap: {
1580
+ [modelID: string]: Set<number>;
1581
+ }): FRAGS.FragmentIdMap;
1582
+ /**
1583
+ * Converts a collection of IFC GUIDs to a fragmentIdMap.
1584
+ *
1585
+ * @param guids - An iterable collection of global IDs to be converted to a fragment ID map.
1586
+ *
1587
+ * @returns A fragment ID map, where the keys are fragment IDs and the values are the corresponding express IDs.
1588
+ */
1589
+ guidToFragmentIdMap(guids: Iterable<string>): FRAGS.FragmentIdMap;
1590
+ /**
1591
+ * Applies coordinate transformation to the provided models.
1592
+ * If no models are provided, all groups are used.
1593
+ * The first model in the list becomes the base model for coordinate transformation.
1594
+ * All other models are then transformed to match the base model's coordinate system.
1595
+ *
1596
+ * @param models - The models to apply coordinate transformation to.
1597
+ * If not provided, all models are used.
1598
+ */
1599
+ coordinate(models?: FragmentsGroup[]): void;
1600
+ /**
1601
+ * Applies the base coordinate system to the provided object.
1602
+ *
1603
+ * This function takes an object and its original coordinate system as input.
1604
+ * It then inverts the original coordinate system and applies the base coordinate system
1605
+ * to the object. This ensures that the object's position, rotation, and scale are
1606
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
1607
+ *
1608
+ * @param object - The object to which the base coordinate system will be applied.
1609
+ * This should be an instance of THREE.Object3D.
1610
+ *
1611
+ * @param originalCoordinateSystem - The original coordinate system of the object.
1612
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
1613
+ */
1614
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem?: THREE.Matrix4): void;
1615
+ /**
1616
+ * Creates a copy of the whole model or a part of it.
1617
+ *
1618
+ * @param model - The model to clone.
1619
+ * @param items - Optional - The part of the model to be cloned. If not given, the whole group is cloned.
1620
+ *
1621
+ */
1622
+ clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
1623
+ }
1624
+ import * as WEBIFC from "web-ifc";
1625
+ import { Components, Disposable, Event, Component } from "../../core";
1626
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1627
+ /**
1628
+ * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1629
+ */
1630
+ export declare class IfcGeometryTiler extends Component implements Disposable {
1631
+ /**
1632
+ * A unique identifier for the component.
1633
+ * This UUID is used to register the component within the Components system.
1634
+ */
1635
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1636
+ /**
1637
+ * Event triggered when geometry is streamed.
1638
+ * Contains the streamed geometry data and its buffer.
1639
+ */
1640
+ readonly onGeometryStreamed: Event<{
1641
+ buffer: Uint8Array;
1642
+ data: StreamedGeometries;
1643
+ }>;
1644
+ /**
1645
+ * Event triggered when assets are streamed.
1646
+ * Contains the streamed assets.
1647
+ */
1648
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
1649
+ /**
1650
+ * Event triggered to indicate the progress of the streaming process.
1651
+ * Contains the progress percentage.
1652
+ */
1653
+ readonly onProgress: Event<number>;
1654
+ /**
1655
+ * Event triggered when the IFC file is loaded.
1656
+ * Contains the loaded IFC file data.
1657
+ */
1658
+ readonly onIfcLoaded: Event<Uint8Array>;
1659
+ /** {@link Disposable.onDisposed} */
1660
+ readonly onDisposed: Event<unknown>;
1661
+ /**
1662
+ * Settings for the IfcGeometryTiler.
1663
+ */
1664
+ settings: IfcStreamingSettings;
1665
+ /** {@link Component.enabled} */
1666
+ enabled: boolean;
1667
+ /**
1668
+ * The WebIFC API instance used for IFC file processing.
1669
+ */
1670
+ webIfc: WEBIFC.IfcAPI;
1671
+ private _spatialTree;
1672
+ private _metaData;
1673
+ private _visitedGeometries;
1674
+ private _streamSerializer;
1675
+ private _geometries;
1676
+ private _geometryCount;
1677
+ private _civil;
1678
+ private _groupSerializer;
1679
+ private _assets;
1680
+ private _meshesWithHoles;
1681
+ constructor(components: Components);
1682
+ /** {@link Disposable.dispose} */
1683
+ dispose(): void;
1684
+ /**
1685
+ * This method streams the IFC file from a given buffer.
1686
+ *
1687
+ * @param data - The Uint8Array containing the IFC file data.
1688
+ * @returns A Promise that resolves when the streaming process is complete.
1689
+ *
1690
+ * @remarks
1691
+ * This method cleans up any resources after the streaming process is complete.
1692
+ *
1693
+ * @example
1694
+ * '''typescript
1695
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
1696
+ * const rawBuffer = await response.arrayBuffer();
1697
+ * const ifcBuffer = new Uint8Array(rawBuffer);
1698
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1699
+ * '''
1700
+ */
1701
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1679
1702
  /**
1680
- * Dispose of a specific fragment group.
1681
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
1682
- * disposes of the group, and triggers the onFragmentsDisposed event.
1703
+ * This method streams the IFC file from a given callback.
1704
+ *
1705
+ * @param loadCallback - The callback function that will be used to load the IFC file.
1706
+ * @returns A Promise that resolves when the streaming process is complete.
1707
+ *
1708
+ * @remarks
1709
+ * This method cleans up any resources after the streaming process is complete.
1683
1710
  *
1684
- * @param group - The fragment group to be disposed.
1685
1711
  */
1686
- disposeGroup(group: FragmentsGroup): void;
1712
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1713
+ private readIfcFile;
1714
+ private streamIfcFile;
1715
+ private streamAllGeometries;
1716
+ private cleanUp;
1717
+ private getMesh;
1718
+ private getGeometry;
1719
+ private streamAssets;
1720
+ private streamGeometries;
1721
+ }
1722
+ import * as WEBIFC from "web-ifc";
1723
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
1724
+ import { PropertiesStreamingSettings } from "./src";
1725
+ /**
1726
+ * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1727
+ */
1728
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
1687
1729
  /**
1688
- * Loads a binary file that contain fragment geometry.
1689
- * @param data - The binary data to load.
1690
- * @param config - Optional configuration for loading.
1691
- * @param config.isStreamed - Optional setting to determine whether this model is streamed or not.
1692
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1693
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1694
- * @returns The loaded FragmentsGroup.
1730
+ * A unique identifier for the component.
1731
+ * This UUID is used to register the component within the Components system.
1695
1732
  */
1696
- load(data: Uint8Array, config?: Partial<{
1697
- coordinate: boolean;
1698
- name: string;
1699
- properties: FRAGS.IfcProperties;
1700
- relationsMap: RelationsMap;
1701
- isStreamed?: boolean;
1702
- }>): FragmentsGroup;
1733
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1703
1734
  /**
1704
- * Export the specified fragmentsgroup to binary data.
1705
- * @param group - the fragments group to be exported.
1706
- * @returns the exported data as binary buffer.
1735
+ * An event that is triggered when properties are streamed from the IFC file.
1736
+ * The event provides the type of the IFC entity and the corresponding data.
1707
1737
  */
1708
- export(group: FragmentsGroup): Uint8Array;
1738
+ readonly onPropertiesStreamed: AsyncEvent<{
1739
+ type: number;
1740
+ data: {
1741
+ [id: number]: any;
1742
+ };
1743
+ }>;
1709
1744
  /**
1710
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1711
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1712
- * @returns A map of model IDs to sets of express IDs.
1745
+ * An event that is triggered to indicate the progress of the streaming process.
1746
+ * The event provides a number between 0 and 1 representing the progress percentage.
1713
1747
  */
1714
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1715
- [modelID: string]: Set<number>;
1716
- };
1748
+ readonly onProgress: AsyncEvent<number>;
1717
1749
  /**
1718
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1719
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1720
- * @returns A fragment ID map.
1721
- * @remarks
1722
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1723
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1724
- * The fragment ID maps are then merged into a single map and returned.
1725
- * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1750
+ * An event that is triggered when indices are streamed from the IFC file.
1751
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1726
1752
  */
1727
- modelIdToFragmentIdMap(modelIdMap: {
1728
- [modelID: string]: Set<number>;
1729
- }): FRAGS.FragmentIdMap;
1753
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1754
+ /** {@link Disposable.onDisposed} */
1755
+ readonly onDisposed: Event<string>;
1756
+ /** {@link Component.enabled} */
1757
+ enabled: boolean;
1730
1758
  /**
1731
- * Converts a collection of IFC GUIDs to a fragmentIdMap.
1732
- *
1733
- * @param guids - An iterable collection of global IDs to be converted to a fragment ID map.
1734
- *
1735
- * @returns A fragment ID map, where the keys are fragment IDs and the values are the corresponding express IDs.
1759
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1736
1760
  */
1737
- guidToFragmentIdMap(guids: Iterable<string>): FRAGS.FragmentIdMap;
1761
+ settings: PropertiesStreamingSettings;
1738
1762
  /**
1739
- * Applies coordinate transformation to the provided models.
1740
- * If no models are provided, all groups are used.
1741
- * The first model in the list becomes the base model for coordinate transformation.
1742
- * All other models are then transformed to match the base model's coordinate system.
1743
- *
1744
- * @param models - The models to apply coordinate transformation to.
1745
- * If not provided, all models are used.
1763
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1746
1764
  */
1747
- coordinate(models?: FragmentsGroup[]): void;
1765
+ webIfc: WEBIFC.IfcAPI;
1766
+ /** {@link Disposable.dispose} */
1767
+ dispose(): Promise<void>;
1748
1768
  /**
1749
- * Applies the base coordinate system to the provided object.
1750
- *
1751
- * This function takes an object and its original coordinate system as input.
1752
- * It then inverts the original coordinate system and applies the base coordinate system
1753
- * to the object. This ensures that the object's position, rotation, and scale are
1754
- * transformed to match the base coordinate system (which is taken from the first model loaded).
1755
- *
1756
- * @param object - The object to which the base coordinate system will be applied.
1757
- * This should be an instance of THREE.Object3D.
1769
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1758
1770
  *
1759
- * @param originalCoordinateSystem - The original coordinate system of the object.
1760
- * This should be a THREE.Matrix4 representing the object's transformation matrix.
1771
+ * @param data - The Uint8Array containing the IFC file data.
1772
+ * @returns A Promise that resolves when the streaming process is complete.
1761
1773
  */
1762
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem?: THREE.Matrix4): void;
1774
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1763
1775
  /**
1764
- * Creates a copy of the whole model or a part of it.
1765
- *
1766
- * @param model - The model to clone.
1767
- * @param items - Optional - The part of the model to be cloned. If not given, the whole group is cloned.
1776
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1768
1777
  *
1778
+ * @param loadCallback - A callback function that loads the IFC file data.
1779
+ * @returns A Promise that resolves when the streaming process is complete.
1769
1780
  */
1770
- clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
1781
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1782
+ private readIfcFile;
1783
+ private streamIfcFile;
1784
+ private streamAllProperties;
1785
+ private cleanUp;
1771
1786
  }
1772
1787
  import * as THREE from "three";
1773
1788
  import * as FRAGS from "@thatopen/fragments";
@@ -1941,125 +1956,210 @@ export declare class BoundingBoxer extends Component implements Disposable {
1941
1956
  * @param itemIDs - An optional iterable of numbers representing the item IDs.
1942
1957
  *
1943
1958
  * @remarks
1944
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1945
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1946
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1959
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1960
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1961
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1962
+ *
1963
+ * @example
1964
+ * '''typescript
1965
+ * const boundingBoxer = components.get(BoundingBoxer);
1966
+ * boundingBoxer.addMesh(mesh);
1967
+ * '''
1968
+ */
1969
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1970
+ /**
1971
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
1972
+ *
1973
+ * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1974
+ * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
1975
+ *
1976
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
1977
+ *
1978
+ * @remarks
1979
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1980
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
1981
+ *
1982
+ * @example
1983
+ * '''typescript
1984
+ * const boundingBoxer = components.get(BoundingBoxer);
1985
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
1986
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1987
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1988
+ * };
1989
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1990
+ * '''
1991
+ */
1992
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1993
+ private static getFragmentBounds;
1994
+ }
1995
+ import * as THREE from "three";
1996
+ import * as FRAGS from "@thatopen/fragments";
1997
+ import { Component, Components } from "../../core";
1998
+ /**
1999
+ * Represents an edge measurement result.
2000
+ */
2001
+ export interface MeasureEdge {
2002
+ /**
2003
+ * The distance between the two points of the edge.
2004
+ */
2005
+ distance: number;
2006
+ /**
2007
+ * The two points that define the edge.
2008
+ */
2009
+ points: THREE.Vector3[];
2010
+ }
2011
+ /**
2012
+ * 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).
2013
+ */
2014
+ export declare class MeasurementUtils extends Component {
2015
+ /**
2016
+ * A unique identifier for the component.
2017
+ * This UUID is used to register the component within the Components system.
2018
+ */
2019
+ static uuid: string;
2020
+ /** {@link Component.enabled} */
2021
+ enabled: boolean;
2022
+ constructor(components: Components);
2023
+ /**
2024
+ * Utility method to calculate the distance from a point to a line segment.
2025
+ *
2026
+ * @param point - The point from which to calculate the distance.
2027
+ * @param lineStart - The start point of the line segment.
2028
+ * @param lineEnd - The end point of the line segment.
2029
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
2030
+ * @returns The distance from the point to the line segment.
2031
+ */
2032
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2033
+ /**
2034
+ * Method to get the face of a mesh that contains a given triangle index.
2035
+ * It also returns the edges of the found face and their indices.
2036
+ *
2037
+ * @param mesh - The mesh to get the face from. It must be indexed.
2038
+ * @param triangleIndex - The index of the triangle within the mesh.
2039
+ * @param instance - The instance of the mesh (optional).
2040
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2041
+ */
2042
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2043
+ edges: MeasureEdge[];
2044
+ indices: Set<number>;
2045
+ } | null;
2046
+ /**
2047
+ * Method to get the vertices and normal of a mesh face at a given index.
2048
+ * It also applies instance transformation if provided.
2049
+ *
2050
+ * @param mesh - The mesh to get the face from. It must be indexed.
2051
+ * @param faceIndex - The index of the face within the mesh.
2052
+ * @param instance - The instance of the mesh (optional).
2053
+ * @returns An object containing the vertices and normal of the face.
2054
+ * @throws Will throw an error if the geometry is not indexed.
2055
+ */
2056
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2057
+ p1: THREE.Vector3;
2058
+ p2: THREE.Vector3;
2059
+ p3: THREE.Vector3;
2060
+ faceNormal: THREE.Vector3;
2061
+ };
2062
+ /**
2063
+ * Method to round the vector's components to a specified number of decimal places.
2064
+ * This is used to ensure numerical precision in edge detection.
2065
+ *
2066
+ * @param vector - The vector to round.
2067
+ * @returns The vector with rounded components.
2068
+ */
2069
+ round(vector: THREE.Vector3): void;
2070
+ /**
2071
+ * Calculates the volume of a set of fragments.
2072
+ *
2073
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
2074
+ * @returns The total volume of the fragments and the bounding sphere.
2075
+ *
2076
+ * @remarks
2077
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
2078
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1947
2079
  *
1948
- * @example
1949
- * '''typescript
1950
- * const boundingBoxer = components.get(BoundingBoxer);
1951
- * boundingBoxer.addMesh(mesh);
1952
- * '''
2080
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
2081
+ * @throws Will throw an error if the fragment manager is not available.
1953
2082
  */
1954
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
2083
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
1955
2084
  /**
1956
- * Uses a FragmentIdMap to add its meshes to the bb calculation.
1957
- *
1958
- * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1959
- * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
2085
+ * Calculates the total volume of a set of meshes.
1960
2086
  *
1961
- * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
2087
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2088
+ * @returns The total volume of the meshes and the bounding sphere.
1962
2089
  *
1963
2090
  * @remarks
1964
- * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1965
- * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
2091
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
2092
+ * and its bounding sphere.
1966
2093
  *
1967
- * @example
1968
- * '''typescript
1969
- * const boundingBoxer = components.get(BoundingBoxer);
1970
- * const fragmentIdMap: FRAGS.FragmentIdMap = {
1971
- * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1972
- * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1973
- * };
1974
- * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1975
- * '''
1976
2094
  */
1977
- addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1978
- private static getFragmentBounds;
2095
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2096
+ private getFaceData;
2097
+ private getVolumeOfMesh;
2098
+ private getSignedVolumeOfTriangle;
1979
2099
  }
1980
- import * as THREE from "three";
1981
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1982
- center: THREE.Vector3;
1983
- halfSizes: THREE.Vector3;
1984
- rotation: THREE.Matrix3;
1985
- transformation: THREE.Matrix4;
1986
- };
1987
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1988
- import * as WEBIFC from "web-ifc";
1989
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1990
- import { PropertiesStreamingSettings } from "./src";
2100
+ import * as FRAGS from "@thatopen/fragments";
2101
+ import { Components, Component } from "../../core";
1991
2102
  /**
1992
- * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
2103
+ * 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).
1993
2104
  */
1994
- export declare class IfcPropertiesTiler extends Component implements Disposable {
2105
+ export declare class Hider extends Component {
1995
2106
  /**
1996
2107
  * A unique identifier for the component.
1997
2108
  * This UUID is used to register the component within the Components system.
1998
2109
  */
1999
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
2000
- /**
2001
- * An event that is triggered when properties are streamed from the IFC file.
2002
- * The event provides the type of the IFC entity and the corresponding data.
2003
- */
2004
- readonly onPropertiesStreamed: AsyncEvent<{
2005
- type: number;
2006
- data: {
2007
- [id: number]: any;
2008
- };
2009
- }>;
2010
- /**
2011
- * An event that is triggered to indicate the progress of the streaming process.
2012
- * The event provides a number between 0 and 1 representing the progress percentage.
2013
- */
2014
- readonly onProgress: AsyncEvent<number>;
2015
- /**
2016
- * An event that is triggered when indices are streamed from the IFC file.
2017
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
2018
- */
2019
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
2020
- /** {@link Disposable.onDisposed} */
2021
- readonly onDisposed: Event<string>;
2110
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
2022
2111
  /** {@link Component.enabled} */
2023
2112
  enabled: boolean;
2113
+ constructor(components: Components);
2024
2114
  /**
2025
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
2026
- */
2027
- settings: PropertiesStreamingSettings;
2028
- /**
2029
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
2030
- */
2031
- webIfc: WEBIFC.IfcAPI;
2032
- /** {@link Disposable.dispose} */
2033
- dispose(): Promise<void>;
2034
- /**
2035
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
2115
+ * Sets the visibility of fragments within the 3D scene.
2116
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
2117
+ * If 'items' is provided, only the specified fragments will be affected.
2036
2118
  *
2037
- * @param data - The Uint8Array containing the IFC file data.
2038
- * @returns A Promise that resolves when the streaming process is complete.
2119
+ * @param visible - The visibility state to set for the fragments.
2120
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
2121
+ * If not provided, all fragments will be affected.
2122
+ *
2123
+ * @returns {void}
2039
2124
  */
2040
- streamFromBuffer(data: Uint8Array): Promise<void>;
2125
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
2041
2126
  /**
2042
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2127
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
2128
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
2043
2129
  *
2044
- * @param loadCallback - A callback function that loads the IFC file data.
2045
- * @returns A Promise that resolves when the streaming process is complete.
2130
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
2131
+ * If not provided, all fragments will be isolated.
2132
+ *
2133
+ * @returns {void}
2046
2134
  */
2047
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2048
- private readIfcFile;
2049
- private streamIfcFile;
2050
- private streamAllProperties;
2051
- private cleanUp;
2135
+ isolate(items: FRAGS.FragmentIdMap): void;
2136
+ private updateCulledVisibility;
2052
2137
  }
2053
2138
  import * as THREE from "three";
2139
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
2140
+ center: THREE.Vector3;
2141
+ halfSizes: THREE.Vector3;
2142
+ rotation: THREE.Matrix3;
2143
+ transformation: THREE.Matrix4;
2144
+ };
2145
+ import * as THREE from "three";
2054
2146
  export declare class MaterialsUtils {
2055
2147
  static isTransparent(material: THREE.Material): boolean;
2056
2148
  }
2149
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
2057
2150
  export declare class UUID {
2058
2151
  private static _pattern;
2059
2152
  private static _lut;
2060
2153
  static create(): string;
2061
2154
  static validate(uuid: string): void;
2062
2155
  }
2156
+ import * as WEBIFC from "web-ifc";
2157
+ export interface IfcItemsCategories {
2158
+ [itemID: number]: number;
2159
+ }
2160
+ export declare class IfcCategories {
2161
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2162
+ }
2063
2163
  import * as THREE from "three";
2064
2164
  import { Component, Components, Disposable, Event, World } from "../core";
2065
2165
  /**
@@ -2176,209 +2276,158 @@ export declare class VertexPicker extends Component implements Disposable {
2176
2276
  private getVertices;
2177
2277
  private getVertex;
2178
2278
  }
2179
- import * as WEBIFC from "web-ifc";
2180
- import { Components, Disposable, Event, Component } from "../../core";
2181
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
2182
2279
  /**
2183
- * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
2280
+ * 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.
2281
+ *
2282
+ * @remarks
2283
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2284
+ * It is useful for identifying and processing different types of IFC elements in a project.
2285
+ *
2184
2286
  */
2185
- export declare class IfcGeometryTiler extends Component implements Disposable {
2186
- /**
2187
- * A unique identifier for the component.
2188
- * This UUID is used to register the component within the Components system.
2189
- */
2190
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
2191
- /**
2192
- * Event triggered when geometry is streamed.
2193
- * Contains the streamed geometry data and its buffer.
2194
- */
2195
- readonly onGeometryStreamed: Event<{
2196
- buffer: Uint8Array;
2197
- data: StreamedGeometries;
2198
- }>;
2199
- /**
2200
- * Event triggered when assets are streamed.
2201
- * Contains the streamed assets.
2202
- */
2203
- readonly onAssetStreamed: Event<StreamedAsset[]>;
2204
- /**
2205
- * Event triggered to indicate the progress of the streaming process.
2206
- * Contains the progress percentage.
2207
- */
2208
- readonly onProgress: Event<number>;
2209
- /**
2210
- * Event triggered when the IFC file is loaded.
2211
- * Contains the loaded IFC file data.
2212
- */
2213
- readonly onIfcLoaded: Event<Uint8Array>;
2214
- /** {@link Disposable.onDisposed} */
2215
- readonly onDisposed: Event<unknown>;
2216
- /**
2217
- * Settings for the IfcGeometryTiler.
2218
- */
2219
- settings: IfcStreamingSettings;
2220
- /** {@link Component.enabled} */
2287
+ export declare const IfcElements: {
2288
+ [key: number]: string;
2289
+ };
2290
+ import { XMLParser } from "fast-xml-parser";
2291
+ import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core";
2292
+ import { BCFTopic, Topic, BCFTopicsConfigManager, BCFTopicsConfig } from "./src";
2293
+ import { Viewpoint } from "../../core/Viewpoints";
2294
+ export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfigManager, BCFTopicsConfig> {
2295
+ static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
2221
2296
  enabled: boolean;
2297
+ static xmlParser: XMLParser;
2298
+ protected _defaultConfig: Required<BCFTopicsConfig>;
2299
+ config: BCFTopicsConfigManager;
2300
+ readonly list: DataMap<string, Topic>;
2301
+ readonly onSetup: Event<unknown>;
2302
+ isSetup: boolean;
2303
+ setup(config?: Partial<BCFTopicsConfig>): void;
2304
+ readonly onBCFImported: Event<Topic[]>;
2222
2305
  /**
2223
- * The WebIFC API instance used for IFC file processing.
2224
- */
2225
- webIfc: WEBIFC.IfcAPI;
2226
- private _spatialTree;
2227
- private _metaData;
2228
- private _visitedGeometries;
2229
- private _streamSerializer;
2230
- private _geometries;
2231
- private _geometryCount;
2232
- private _civil;
2233
- private _groupSerializer;
2234
- private _assets;
2235
- private _meshesWithHoles;
2236
- constructor(components: Components);
2237
- /** {@link Disposable.dispose} */
2238
- dispose(): void;
2239
- /**
2240
- * This method streams the IFC file from a given buffer.
2241
- *
2242
- * @param data - The Uint8Array containing the IFC file data.
2243
- * @returns A Promise that resolves when the streaming process is complete.
2244
- *
2245
- * @remarks
2246
- * This method cleans up any resources after the streaming process is complete.
2247
- *
2248
- * @example
2249
- * '''typescript
2250
- * const ifcData = await fetch('path/to/ifc/file.ifc');
2251
- * const rawBuffer = await response.arrayBuffer();
2252
- * const ifcBuffer = new Uint8Array(rawBuffer);
2253
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
2254
- * '''
2255
- */
2256
- streamFromBuffer(data: Uint8Array): Promise<void>;
2257
- /**
2258
- * This method streams the IFC file from a given callback.
2259
- *
2260
- * @param loadCallback - The callback function that will be used to load the IFC file.
2261
- * @returns A Promise that resolves when the streaming process is complete.
2262
- *
2263
- * @remarks
2264
- * This method cleans up any resources after the streaming process is complete.
2265
- *
2266
- */
2267
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2268
- private readIfcFile;
2269
- private streamIfcFile;
2270
- private streamAllGeometries;
2271
- private cleanUp;
2272
- private getMesh;
2273
- private getGeometry;
2274
- private streamAssets;
2275
- private streamGeometries;
2276
- }
2277
- import * as THREE from "three";
2278
- import * as FRAGS from "@thatopen/fragments";
2279
- import { Component, Components } from "../../core";
2280
- /**
2281
- * Represents an edge measurement result.
2282
- */
2283
- export interface MeasureEdge {
2284
- /**
2285
- * The distance between the two points of the edge.
2306
+ * Creates a new BCFTopic instance and adds it to the list.
2307
+ *
2308
+ * @param data - Optional partial BCFTopic object to initialize the new topic with.
2309
+ * If not provided, default values will be used.
2310
+ * @returns The newly created BCFTopic instance.
2286
2311
  */
2287
- distance: number;
2312
+ create(data?: Partial<BCFTopic>): Topic;
2313
+ readonly onDisposed: Event<unknown>;
2288
2314
  /**
2289
- * The two points that define the edge.
2315
+ * Disposes of the BCFTopics component and triggers the onDisposed event.
2316
+ *
2317
+ * @remarks
2318
+ * This method clears the list of topics and triggers the onDisposed event.
2319
+ * It also resets the onDisposed event listener.
2290
2320
  */
2291
- points: THREE.Vector3[];
2292
- }
2293
- /**
2294
- * 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).
2295
- */
2296
- export declare class MeasurementUtils extends Component {
2321
+ dispose(): void;
2297
2322
  /**
2298
- * A unique identifier for the component.
2299
- * This UUID is used to register the component within the Components system.
2323
+ * Retrieves the unique set of topic types used across all topics.
2324
+ *
2325
+ * @returns A Set containing the unique topic types.
2300
2326
  */
2301
- static uuid: string;
2302
- /** {@link Component.enabled} */
2303
- enabled: boolean;
2304
- constructor(components: Components);
2327
+ get usedTypes(): Set<string>;
2305
2328
  /**
2306
- * Utility method to calculate the distance from a point to a line segment.
2329
+ * Retrieves the unique set of topic statuses used across all topics.
2307
2330
  *
2308
- * @param point - The point from which to calculate the distance.
2309
- * @param lineStart - The start point of the line segment.
2310
- * @param lineEnd - The end point of the line segment.
2311
- * @param clamp - If true, the distance will be clamped to the line segment's length.
2312
- * @returns The distance from the point to the line segment.
2331
+ * @returns A Set containing the unique topic statuses.
2313
2332
  */
2314
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2333
+ get usedStatuses(): Set<string>;
2315
2334
  /**
2316
- * Method to get the face of a mesh that contains a given triangle index.
2317
- * It also returns the edges of the found face and their indices.
2335
+ * Retrieves the unique set of topic priorities used across all topics.
2318
2336
  *
2319
- * @param mesh - The mesh to get the face from. It must be indexed.
2320
- * @param triangleIndex - The index of the triangle within the mesh.
2321
- * @param instance - The instance of the mesh (optional).
2322
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2337
+ * @returns A Set containing the unique topic priorities.
2338
+ * Note: This method filters out any null or undefined priorities.
2323
2339
  */
2324
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2325
- edges: MeasureEdge[];
2326
- indices: Set<number>;
2327
- } | null;
2340
+ get usedPriorities(): Set<string | undefined>;
2328
2341
  /**
2329
- * Method to get the vertices and normal of a mesh face at a given index.
2330
- * It also applies instance transformation if provided.
2342
+ * Retrieves the unique set of topic stages used across all topics.
2331
2343
  *
2332
- * @param mesh - The mesh to get the face from. It must be indexed.
2333
- * @param faceIndex - The index of the face within the mesh.
2334
- * @param instance - The instance of the mesh (optional).
2335
- * @returns An object containing the vertices and normal of the face.
2336
- * @throws Will throw an error if the geometry is not indexed.
2344
+ * @returns A Set containing the unique topic stages.
2345
+ * Note: This method filters out any null or undefined stages.
2337
2346
  */
2338
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2339
- p1: THREE.Vector3;
2340
- p2: THREE.Vector3;
2341
- p3: THREE.Vector3;
2342
- faceNormal: THREE.Vector3;
2343
- };
2347
+ get usedStages(): Set<string | undefined>;
2344
2348
  /**
2345
- * Method to round the vector's components to a specified number of decimal places.
2346
- * This is used to ensure numerical precision in edge detection.
2349
+ * Retrieves the unique set of users associated with topics.
2347
2350
  *
2348
- * @param vector - The vector to round.
2349
- * @returns The vector with rounded components.
2351
+ * @returns A Set containing the unique users.
2352
+ * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
2350
2353
  */
2351
- round(vector: THREE.Vector3): void;
2354
+ get usedUsers(): Set<string>;
2352
2355
  /**
2353
- * Calculates the volume of a set of fragments.
2354
- *
2355
- * @param frags - A map of fragment IDs to their corresponding item IDs.
2356
- * @returns The total volume of the fragments and the bounding sphere.
2356
+ * Retrieves the unique set of labels used across all topics.
2357
2357
  *
2358
- * @remarks
2359
- * This method creates a set of instanced meshes from the given fragments and item IDs.
2360
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
2358
+ * @returns A Set containing the unique labels.
2359
+ */
2360
+ get usedLabels(): Set<string>;
2361
+ /**
2362
+ * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
2363
+ * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
2364
+ */
2365
+ updateExtensions(): void;
2366
+ /**
2367
+ * Updates the references to viewpoints in the topics.
2368
+ * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
2369
+ * If a viewpoint does not exist, it is removed from the topic's viewpoints.
2370
+ */
2371
+ updateViewpointReferences(): void;
2372
+ /**
2373
+ * Exports the given topics to a BCF (Building Collaboration Format) zip file.
2361
2374
  *
2362
- * @throws Will throw an error if the geometry of the meshes is not indexed.
2363
- * @throws Will throw an error if the fragment manager is not available.
2375
+ * @param topics - The topics to export. Defaults to all topics in the list.
2376
+ * @returns A promise that resolves to a Blob containing the exported BCF zip file.
2364
2377
  */
2365
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
2378
+ export(topics?: Iterable<Topic>): Promise<Blob>;
2379
+ private serializeExtensions;
2380
+ private processMarkupComment;
2381
+ private getMarkupComments;
2382
+ private getMarkupLabels;
2383
+ private getMarkupViewpoints;
2384
+ private getMarkupRelatedTopics;
2366
2385
  /**
2367
- * Calculates the total volume of a set of meshes.
2386
+ * Loads BCF (Building Collaboration Format) data into the engine.
2368
2387
  *
2369
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2370
- * @returns The total volume of the meshes and the bounding sphere.
2388
+ * @param world - The default world where the viewpoints are going to be created.
2389
+ * @param data - The BCF data to load.
2371
2390
  *
2372
- * @remarks
2373
- * This method calculates the volume of each mesh in the provided array and returns the total volume
2374
- * and its bounding sphere.
2391
+ * @returns A promise that resolves to an object containing the created viewpoints and topics.
2375
2392
  *
2393
+ * @throws An error if the BCF version is not supported.
2376
2394
  */
2377
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2378
- private getFaceData;
2379
- private getVolumeOfMesh;
2380
- private getSignedVolumeOfTriangle;
2395
+ load(data: Uint8Array, world: World): Promise<{
2396
+ viewpoints: Viewpoint[];
2397
+ topics: Topic[];
2398
+ }>;
2399
+ }
2400
+ import * as FRAGS from "@thatopen/fragments";
2401
+ export declare class IfcPropertiesUtils {
2402
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2403
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2404
+ [attribute: string]: any;
2405
+ } | null>;
2406
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2407
+ [relatingID: number]: number[];
2408
+ }>;
2409
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2410
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2411
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2412
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2413
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2414
+ key: string | null;
2415
+ name: string | null;
2416
+ }>;
2417
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2418
+ key: string | null;
2419
+ value: number | null;
2420
+ }>;
2421
+ static isRel(expressID: number): boolean;
2422
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2423
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2381
2424
  }
2425
+ /**
2426
+ * 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.
2427
+ */
2428
+ export declare const IfcCategoryMap: {
2429
+ [key: number]: string;
2430
+ };
2382
2431
  import * as THREE from "three";
2383
2432
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2384
2433
  /**
@@ -2466,94 +2515,40 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2466
2515
  getSize(): THREE.Vector2;
2467
2516
  /** {@link Resizeable.resize} */
2468
2517
  resize(size?: THREE.Vector2): void;
2469
- private updatePlanes;
2470
- }
2471
- /**
2472
- * A Set of unique numbers representing different types of IFC geometries.
2473
- */
2474
- export declare const GeometryTypes: Set<number>;
2475
- import { InverseAttribute } from "./types";
2476
- export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
2477
- forRelating: InverseAttribute;
2478
- forRelated: InverseAttribute;
2479
- }>;
2480
- /**
2481
- * 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.
2482
- *
2483
- * @remarks
2484
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2485
- * It is useful for identifying and processing different types of IFC elements in a project.
2486
- *
2487
- */
2488
- export declare const IfcElements: {
2489
- [key: number]: string;
2490
- };
2491
- import { BooleanSettingsControl, ConfigManager } from "../../Types";
2492
- import { Viewpoints } from "../index";
2493
- /**
2494
- * Configuration interface for the Viewpoints general behavior.
2495
- */
2496
- export interface ViewpointsConfig {
2497
- /**
2498
- * Indicates whether to overwrite the fragments colors when applying viewpoints.
2499
- * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
2500
- * @default false
2501
- */
2502
- overwriteColors: boolean;
2503
- }
2504
- type ViewpointsConfigType = {
2505
- overwriteColors: BooleanSettingsControl;
2506
- };
2507
- export declare class ViewpointsConfigManger extends ConfigManager<Viewpoints, ViewpointsConfigType> {
2508
- protected _list: {
2509
- overwriteColors: {
2510
- value: boolean;
2511
- opacity: number;
2512
- type: "Boolean";
2513
- };
2514
- };
2515
- get overwriteColors(): boolean;
2516
- set overwriteColors(value: boolean);
2517
- }
2518
- export {};
2519
- import * as WEBIFC from "web-ifc";
2520
- export interface IfcItemsCategories {
2521
- [itemID: number]: number;
2522
- }
2523
- export declare class IfcCategories {
2524
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2525
- }
2526
- import * as FRAGS from "@thatopen/fragments";
2527
- export declare class IfcPropertiesUtils {
2528
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2529
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2530
- [attribute: string]: any;
2531
- } | null>;
2532
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2533
- [relatingID: number]: number[];
2534
- }>;
2535
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2536
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2537
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2538
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2539
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2540
- key: string | null;
2541
- name: string | null;
2542
- }>;
2543
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2544
- key: string | null;
2545
- value: number | null;
2546
- }>;
2547
- static isRel(expressID: number): boolean;
2548
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2549
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2518
+ private updatePlanes;
2550
2519
  }
2520
+ import { BooleanSettingsControl, ConfigManager } from "../../Types";
2521
+ import { Viewpoints } from "../index";
2551
2522
  /**
2552
- * 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.
2523
+ * Configuration interface for the Viewpoints general behavior.
2553
2524
  */
2554
- export declare const IfcCategoryMap: {
2555
- [key: number]: string;
2525
+ export interface ViewpointsConfig {
2526
+ /**
2527
+ * Indicates whether to overwrite the fragments colors when applying viewpoints.
2528
+ * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
2529
+ * @default false
2530
+ */
2531
+ overwriteColors: boolean;
2532
+ }
2533
+ type ViewpointsConfigType = {
2534
+ overwriteColors: BooleanSettingsControl;
2556
2535
  };
2536
+ export declare class ViewpointsConfigManger extends ConfigManager<Viewpoints, ViewpointsConfigType> {
2537
+ protected _list: {
2538
+ overwriteColors: {
2539
+ value: boolean;
2540
+ opacity: number;
2541
+ type: "Boolean";
2542
+ };
2543
+ };
2544
+ get overwriteColors(): boolean;
2545
+ set overwriteColors(value: boolean);
2546
+ }
2547
+ export {};
2548
+ /**
2549
+ * A Set of unique numbers representing different types of IFC geometries.
2550
+ */
2551
+ export declare const GeometryTypes: Set<number>;
2557
2552
  import * as WEBIFC from "web-ifc";
2558
2553
  import { IfcItemsCategories } from "../../../ifc";
2559
2554
  export declare class SpatialStructure {
@@ -2562,6 +2557,16 @@ export declare class SpatialStructure {
2562
2557
  setUp(webIfc: WEBIFC.IfcAPI): void;
2563
2558
  cleanUp(): void;
2564
2559
  }
2560
+ import { InverseAttribute } from "./types";
2561
+ export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
2562
+ forRelating: InverseAttribute;
2563
+ forRelated: InverseAttribute;
2564
+ }>;
2565
+ import * as FRAGS from "@thatopen/fragments";
2566
+ import * as WEBIFC from "web-ifc";
2567
+ export declare class SpatialIdsFinder {
2568
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2569
+ }
2565
2570
  import * as WEBIFC from "web-ifc";
2566
2571
  /** Configuration of the IFC-fragment conversion. */
2567
2572
  export declare class IfcFragmentSettings {
@@ -2713,283 +2718,88 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
2713
2718
  unseen: Set<THREE.Mesh>;
2714
2719
  }>;
2715
2720
  /**
2716
- * Pixels in screen a geometry must occupy to be considered "seen".
2717
- * Default value is 100.
2718
- */
2719
- threshold: number;
2720
- /**
2721
- * Map of color code to THREE.InstancedMesh.
2722
- * Used to keep track of color-coded meshes.
2723
- */
2724
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2725
- /**
2726
- * Flag to indicate if the renderer is currently processing.
2727
- * Used to prevent concurrent processing.
2728
- */
2729
- isProcessing: boolean;
2730
- private _interval;
2731
- private _colorCodeMeshMap;
2732
- private _meshIDColorCodeMap;
2733
- private _currentVisibleMeshes;
2734
- private _recentlyHiddenMeshes;
2735
- private _intervalID;
2736
- private readonly _transparentMat;
2737
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2738
- /** {@link Disposable.dispose} */
2739
- dispose(): void;
2740
- /**
2741
- * 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.
2742
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2743
- * @returns {void}
2744
- */
2745
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2746
- /**
2747
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2748
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2749
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2750
- * @returns {void}
2751
- */
2752
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2753
- /**
2754
- * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
2755
- *
2756
- * @param meshes - The meshes to update.
2757
- *
2758
- * @returns {void}
2759
- */
2760
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
2761
- private handleWorkerMessage;
2762
- private getAvailableMaterial;
2763
- }
2764
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2765
- import * as FRAGS from "@thatopen/fragments";
2766
- import * as WEBIFC from "web-ifc";
2767
- export declare class SpatialIdsFinder {
2768
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2769
- }
2770
- import { SimplePlane } from "../../Clipper";
2771
- import { DataSet } from "../../Types";
2772
- export interface ViewpointCamera {
2773
- direction: {
2774
- x: number;
2775
- y: number;
2776
- z: number;
2777
- };
2778
- position: {
2779
- x: number;
2780
- y: number;
2781
- z: number;
2782
- };
2783
- aspectRatio: number;
2784
- }
2785
- export interface ViewpointPerspectiveCamera extends ViewpointCamera {
2786
- fov: number;
2787
- }
2788
- export interface ViewpointOrthographicCamera extends ViewpointCamera {
2789
- viewToWorldScale: number;
2790
- }
2791
- export interface BCFViewpoint {
2792
- title?: string;
2793
- guid: string;
2794
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2795
- selectionComponents: Iterable<string>;
2796
- exceptionComponents: Iterable<string>;
2797
- clippingPlanes: DataSet<SimplePlane>;
2798
- spacesVisible: boolean;
2799
- spaceBoundariesVisible: boolean;
2800
- openingsVisible: boolean;
2801
- defaultVisibility: boolean;
2802
- }
2803
- import * as THREE from "three";
2804
- import { Disposable, Event } from "../../Types";
2805
- /**
2806
- * 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.
2807
- */
2808
- export declare class Mouse implements Disposable {
2809
- dom: HTMLCanvasElement;
2810
- private _event?;
2811
- private _position;
2812
- /** {@link Disposable.onDisposed} */
2813
- readonly onDisposed: Event<unknown>;
2814
- constructor(dom: HTMLCanvasElement);
2815
- /**
2816
- * The real position of the mouse of the Three.js canvas.
2817
- */
2818
- get position(): THREE.Vector2;
2819
- /** {@link Disposable.dispose} */
2820
- dispose(): void;
2821
- private getPositionY;
2822
- private getPositionX;
2823
- private updateMouseInfo;
2824
- private setupEvents;
2825
- }
2826
- import * as THREE from "three";
2827
- import { Hideable, Event, World, Disposable } from "../../Types";
2828
- import { Components } from "../../Components";
2829
- /**
2830
- * Configuration interface for the {@link SimpleGrid} class.
2831
- */
2832
- export interface GridConfig {
2833
- /**
2834
- * The color of the grid lines.
2835
- */
2836
- color: THREE.Color;
2837
- /**
2838
- * The size of the primary grid lines.
2839
- */
2840
- size1: number;
2841
- /**
2842
- * The size of the secondary grid lines.
2843
- */
2844
- size2: number;
2845
- /**
2846
- * The distance at which the grid lines start to fade away.
2847
- */
2848
- distance: number;
2849
- }
2850
- /**
2851
- * 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).
2852
- */
2853
- export declare class SimpleGrid implements Hideable, Disposable {
2854
- /** {@link Disposable.onDisposed} */
2855
- readonly onDisposed: Event<unknown>;
2856
- /** The world instance to which this Raycaster belongs. */
2857
- world: World;
2858
- /** The components instance to which this grid belongs. */
2859
- components: Components;
2860
- /** {@link Hideable.visible} */
2861
- get visible(): boolean;
2862
- /** {@link Hideable.visible} */
2863
- set visible(visible: boolean);
2864
- /** The material of the grid. */
2865
- get material(): THREE.ShaderMaterial;
2866
- /**
2867
- * Whether the grid should fade away with distance. Recommended to be true for
2868
- * perspective cameras and false for orthographic cameras.
2869
- */
2870
- get fade(): boolean;
2871
- /**
2872
- * Whether the grid should fade away with distance. Recommended to be true for
2873
- * perspective cameras and false for orthographic cameras.
2874
- */
2875
- set fade(active: boolean);
2876
- /** The Three.js mesh that contains the infinite grid. */
2877
- readonly three: THREE.Mesh;
2878
- private _fade;
2879
- constructor(components: Components, world: World, config: GridConfig);
2880
- /** {@link Disposable.dispose} */
2881
- dispose(): void;
2882
- private setupEvents;
2883
- private updateZoom;
2884
- }
2885
- /**
2886
- * 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.
2887
- */
2888
- export declare class Event<T> {
2889
- /**
2890
- * Add a callback to this event instance.
2891
- * @param handler - the callback to be added to this event.
2892
- */
2893
- add(handler: T extends void ? {
2894
- (): void;
2895
- } : {
2896
- (data: T): void;
2897
- }): void;
2898
- /**
2899
- * Removes a callback from this event instance.
2900
- * @param handler - the callback to be removed from this event.
2901
- */
2902
- remove(handler: T extends void ? {
2903
- (): void;
2904
- } : {
2905
- (data: T): void;
2906
- }): void;
2907
- /** Triggers all the callbacks assigned to this event. */
2908
- trigger: (data?: T) => void;
2909
- /** Gets rid of all the suscribed events. */
2910
- reset(): void;
2911
- private handlers;
2912
- }
2913
- import * as THREE from "three";
2914
- import { Components } from "../../Components";
2915
- import { Event, World, Disposable } from "../../Types";
2916
- import { Mouse } from "./mouse";
2917
- /**
2918
- * 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.
2919
- */
2920
- export declare class SimpleRaycaster implements Disposable {
2921
- /** {@link Component.enabled} */
2922
- enabled: boolean;
2923
- /** The components instance to which this Raycaster belongs. */
2924
- components: Components;
2925
- /** {@link Disposable.onDisposed} */
2926
- readonly onDisposed: Event<unknown>;
2927
- /** The position of the mouse in the screen. */
2928
- readonly mouse: Mouse;
2721
+ * Pixels in screen a geometry must occupy to be considered "seen".
2722
+ * Default value is 100.
2723
+ */
2724
+ threshold: number;
2929
2725
  /**
2930
- * A reference to the Three.js Raycaster instance.
2931
- * This is used for raycasting operations.
2726
+ * Map of color code to THREE.InstancedMesh.
2727
+ * Used to keep track of color-coded meshes.
2932
2728
  */
2933
- readonly three: THREE.Raycaster;
2729
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2934
2730
  /**
2935
- * A reference to the world instance to which this Raycaster belongs.
2936
- * This is used to access the camera and meshes.
2731
+ * Flag to indicate if the renderer is currently processing.
2732
+ * Used to prevent concurrent processing.
2937
2733
  */
2938
- world: World;
2939
- constructor(components: Components, world: World);
2734
+ isProcessing: boolean;
2735
+ private _interval;
2736
+ private _colorCodeMeshMap;
2737
+ private _meshIDColorCodeMap;
2738
+ private _currentVisibleMeshes;
2739
+ private _recentlyHiddenMeshes;
2740
+ private _intervalID;
2741
+ private readonly _transparentMat;
2742
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2940
2743
  /** {@link Disposable.dispose} */
2941
2744
  dispose(): void;
2942
2745
  /**
2943
- * Throws a ray from the camera to the mouse or touch event point and returns
2944
- * the first item found. This also takes into account the clipping planes
2945
- * used by the renderer.
2946
- *
2947
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2948
- * to query. If not provided, it will query all the meshes stored in
2949
- * {@link Components.meshes}.
2950
- */
2951
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2952
- /**
2953
- * Casts a ray from a given origin in a given direction and returns the first item found.
2954
- * This method also takes into account the clipping planes used by the renderer.
2955
- *
2956
- * @param origin - The origin of the ray.
2957
- * @param direction - The direction of the ray.
2958
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2959
- * @returns The first intersection found or 'null' if no intersection was found.
2746
+ * 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.
2747
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2748
+ * @returns {void}
2960
2749
  */
2961
- 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;
2962
- private intersect;
2963
- private filterClippingPlanes;
2964
- }
2965
- /**
2966
- * 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.
2967
- */
2968
- export declare class AsyncEvent<T> {
2750
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2969
2751
  /**
2970
- * Add a callback to this event instance.
2971
- * @param handler - the callback to be added to this event.
2752
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2753
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2754
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2755
+ * @returns {void}
2972
2756
  */
2973
- add(handler: T extends void ? {
2974
- (): Promise<void>;
2975
- } : {
2976
- (data: T): Promise<void>;
2977
- }): void;
2757
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2978
2758
  /**
2979
- * Removes a callback from this event instance.
2980
- * @param handler - the callback to be removed from this event.
2759
+ * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
2760
+ *
2761
+ * @param meshes - The meshes to update.
2762
+ *
2763
+ * @returns {void}
2981
2764
  */
2982
- remove(handler: T extends void ? {
2983
- (): Promise<void>;
2984
- } : {
2985
- (data: T): Promise<void>;
2986
- }): void;
2987
- /** Triggers all the callbacks assigned to this event. */
2988
- trigger: (data?: T) => Promise<void>;
2989
- /** Gets rid of all the suscribed events. */
2990
- reset(): void;
2991
- private handlers;
2765
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
2766
+ private handleWorkerMessage;
2767
+ private getAvailableMaterial;
2768
+ }
2769
+ import { SimplePlane } from "../../Clipper";
2770
+ import { DataSet } from "../../Types";
2771
+ export interface ViewpointCamera {
2772
+ direction: {
2773
+ x: number;
2774
+ y: number;
2775
+ z: number;
2776
+ };
2777
+ position: {
2778
+ x: number;
2779
+ y: number;
2780
+ z: number;
2781
+ };
2782
+ aspectRatio: number;
2783
+ }
2784
+ export interface ViewpointPerspectiveCamera extends ViewpointCamera {
2785
+ fov: number;
2786
+ }
2787
+ export interface ViewpointOrthographicCamera extends ViewpointCamera {
2788
+ viewToWorldScale: number;
2789
+ }
2790
+ export interface BCFViewpoint {
2791
+ title?: string;
2792
+ guid: string;
2793
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2794
+ selectionComponents: Iterable<string>;
2795
+ exceptionComponents: Iterable<string>;
2796
+ clippingPlanes: DataSet<SimplePlane>;
2797
+ spacesVisible: boolean;
2798
+ spaceBoundariesVisible: boolean;
2799
+ openingsVisible: boolean;
2800
+ defaultVisibility: boolean;
2992
2801
  }
2802
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2993
2803
  import * as THREE from "three";
2994
2804
  import * as FRAGS from "@thatopen/fragments";
2995
2805
  import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
@@ -3137,80 +2947,238 @@ export declare class Viewpoint implements BCFViewpoint {
3137
2947
  */
3138
2948
  go(transition?: boolean): Promise<void>;
3139
2949
  /**
3140
- * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
3141
- *
3142
- * @remarks
3143
- * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
3144
- * It then calculates the camera's perspective or orthographic settings based on the camera type.
3145
- * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
3146
- *
3147
- * @throws An error if the world's camera does not have camera controls.
3148
- * @throws An error if the world's renderer is not available.
2950
+ * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
2951
+ *
2952
+ * @remarks
2953
+ * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
2954
+ * It then calculates the camera's perspective or orthographic settings based on the camera type.
2955
+ * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
2956
+ *
2957
+ * @throws An error if the world's camera does not have camera controls.
2958
+ * @throws An error if the world's renderer is not available.
2959
+ */
2960
+ updateCamera(): void;
2961
+ /**
2962
+ * Applies color to the components in the viewpoint based on their GUIDs.
2963
+ *
2964
+ * This function iterates through the 'componentColors' map, retrieves the fragment IDs
2965
+ * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
2966
+ *
2967
+ * @remarks
2968
+ * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
2969
+ * The color is provided as a hexadecimal string, prefixed with a '#'.
2970
+ */
2971
+ colorize(): void;
2972
+ /**
2973
+ * Resets the colors of all components in the viewpoint to their original color.
2974
+ * This method iterates through the 'componentColors' map, retrieves the fragment IDs
2975
+ * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
2976
+ */
2977
+ resetColors(): void;
2978
+ private createComponentTags;
2979
+ /**
2980
+ * Serializes the viewpoint into a buildingSMART compliant XML string for export.
2981
+ *
2982
+ * @param version - The version of the BCF Manager to use for serialization.
2983
+ * If not provided, the current version of the manager will be used.
2984
+ *
2985
+ * @returns A Promise that resolves to an XML string representing the viewpoint.
2986
+ * The XML string follows the BCF VisualizationInfo schema.
2987
+ *
2988
+ * @throws An error if the world's camera does not have camera controls.
2989
+ * @throws An error if the world's renderer is not available.
2990
+ */
2991
+ serialize(version?: string): Promise<string>;
2992
+ }
2993
+ import * as THREE from "three";
2994
+ import { Disposable, Event } from "../../Types";
2995
+ /**
2996
+ * 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.
2997
+ */
2998
+ export declare class Mouse implements Disposable {
2999
+ dom: HTMLCanvasElement;
3000
+ private _event?;
3001
+ private _position;
3002
+ /** {@link Disposable.onDisposed} */
3003
+ readonly onDisposed: Event<unknown>;
3004
+ constructor(dom: HTMLCanvasElement);
3005
+ /**
3006
+ * The real position of the mouse of the Three.js canvas.
3007
+ */
3008
+ get position(): THREE.Vector2;
3009
+ /** {@link Disposable.dispose} */
3010
+ dispose(): void;
3011
+ private getPositionY;
3012
+ private getPositionX;
3013
+ private updateMouseInfo;
3014
+ private setupEvents;
3015
+ }
3016
+ import * as THREE from "three";
3017
+ import { Hideable, Event, World, Disposable } from "../../Types";
3018
+ import { Components } from "../../Components";
3019
+ /**
3020
+ * Configuration interface for the {@link SimpleGrid} class.
3021
+ */
3022
+ export interface GridConfig {
3023
+ /**
3024
+ * The color of the grid lines.
3025
+ */
3026
+ color: THREE.Color;
3027
+ /**
3028
+ * The size of the primary grid lines.
3029
+ */
3030
+ size1: number;
3031
+ /**
3032
+ * The size of the secondary grid lines.
3033
+ */
3034
+ size2: number;
3035
+ /**
3036
+ * The distance at which the grid lines start to fade away.
3037
+ */
3038
+ distance: number;
3039
+ }
3040
+ /**
3041
+ * 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).
3042
+ */
3043
+ export declare class SimpleGrid implements Hideable, Disposable {
3044
+ /** {@link Disposable.onDisposed} */
3045
+ readonly onDisposed: Event<unknown>;
3046
+ /** The world instance to which this Raycaster belongs. */
3047
+ world: World;
3048
+ /** The components instance to which this grid belongs. */
3049
+ components: Components;
3050
+ /** {@link Hideable.visible} */
3051
+ get visible(): boolean;
3052
+ /** {@link Hideable.visible} */
3053
+ set visible(visible: boolean);
3054
+ /** The material of the grid. */
3055
+ get material(): THREE.ShaderMaterial;
3056
+ /**
3057
+ * Whether the grid should fade away with distance. Recommended to be true for
3058
+ * perspective cameras and false for orthographic cameras.
3059
+ */
3060
+ get fade(): boolean;
3061
+ /**
3062
+ * Whether the grid should fade away with distance. Recommended to be true for
3063
+ * perspective cameras and false for orthographic cameras.
3064
+ */
3065
+ set fade(active: boolean);
3066
+ /** The Three.js mesh that contains the infinite grid. */
3067
+ readonly three: THREE.Mesh;
3068
+ private _fade;
3069
+ constructor(components: Components, world: World, config: GridConfig);
3070
+ /** {@link Disposable.dispose} */
3071
+ dispose(): void;
3072
+ private setupEvents;
3073
+ private updateZoom;
3074
+ }
3075
+ import * as THREE from "three";
3076
+ import { Components } from "../../Components";
3077
+ import { Event, World, Disposable } from "../../Types";
3078
+ import { Mouse } from "./mouse";
3079
+ /**
3080
+ * 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.
3081
+ */
3082
+ export declare class SimpleRaycaster implements Disposable {
3083
+ /** {@link Component.enabled} */
3084
+ enabled: boolean;
3085
+ /** The components instance to which this Raycaster belongs. */
3086
+ components: Components;
3087
+ /** {@link Disposable.onDisposed} */
3088
+ readonly onDisposed: Event<unknown>;
3089
+ /** The position of the mouse in the screen. */
3090
+ readonly mouse: Mouse;
3091
+ /**
3092
+ * A reference to the Three.js Raycaster instance.
3093
+ * This is used for raycasting operations.
3149
3094
  */
3150
- updateCamera(): void;
3095
+ readonly three: THREE.Raycaster;
3151
3096
  /**
3152
- * Applies color to the components in the viewpoint based on their GUIDs.
3153
- *
3154
- * This function iterates through the 'componentColors' map, retrieves the fragment IDs
3155
- * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
3156
- *
3157
- * @remarks
3158
- * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
3159
- * The color is provided as a hexadecimal string, prefixed with a '#'.
3097
+ * A reference to the world instance to which this Raycaster belongs.
3098
+ * This is used to access the camera and meshes.
3160
3099
  */
3161
- colorize(): void;
3100
+ world: World;
3101
+ constructor(components: Components, world: World);
3102
+ /** {@link Disposable.dispose} */
3103
+ dispose(): void;
3162
3104
  /**
3163
- * Resets the colors of all components in the viewpoint to their original color.
3164
- * This method iterates through the 'componentColors' map, retrieves the fragment IDs
3165
- * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
3105
+ * Throws a ray from the camera to the mouse or touch event point and returns
3106
+ * the first item found. This also takes into account the clipping planes
3107
+ * used by the renderer.
3108
+ *
3109
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3110
+ * to query. If not provided, it will query all the meshes stored in
3111
+ * {@link Components.meshes}.
3166
3112
  */
3167
- resetColors(): void;
3168
- private createComponentTags;
3113
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3169
3114
  /**
3170
- * Serializes the viewpoint into a buildingSMART compliant XML string for export.
3171
- *
3172
- * @param version - The version of the BCF Manager to use for serialization.
3173
- * If not provided, the current version of the manager will be used.
3174
- *
3175
- * @returns A Promise that resolves to an XML string representing the viewpoint.
3176
- * The XML string follows the BCF VisualizationInfo schema.
3115
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3116
+ * This method also takes into account the clipping planes used by the renderer.
3177
3117
  *
3178
- * @throws An error if the world's camera does not have camera controls.
3179
- * @throws An error if the world's renderer is not available.
3118
+ * @param origin - The origin of the ray.
3119
+ * @param direction - The direction of the ray.
3120
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3121
+ * @returns The first intersection found or 'null' if no intersection was found.
3180
3122
  */
3181
- serialize(version?: string): Promise<string>;
3123
+ 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;
3124
+ private intersect;
3125
+ private filterClippingPlanes;
3182
3126
  }
3183
- import { Base } from "./base";
3184
3127
  /**
3185
- * 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.
3128
+ * 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.
3186
3129
  */
3187
- export declare abstract class Component extends Base {
3130
+ export declare class AsyncEvent<T> {
3188
3131
  /**
3189
- * Whether this component is active or not. The behaviour can vary depending
3190
- * on the type of component. E.g. a disabled dimension tool will stop creating
3191
- * dimensions, while a disabled camera will stop moving. A disabled component
3192
- * will not be updated automatically each frame.
3132
+ * Add a callback to this event instance.
3133
+ * @param handler - the callback to be added to this event.
3193
3134
  */
3194
- abstract enabled: boolean;
3135
+ add(handler: T extends void ? {
3136
+ (): Promise<void>;
3137
+ } : {
3138
+ (data: T): Promise<void>;
3139
+ }): void;
3140
+ /**
3141
+ * Removes a callback from this event instance.
3142
+ * @param handler - the callback to be removed from this event.
3143
+ */
3144
+ remove(handler: T extends void ? {
3145
+ (): Promise<void>;
3146
+ } : {
3147
+ (data: T): Promise<void>;
3148
+ }): void;
3149
+ /** Triggers all the callbacks assigned to this event. */
3150
+ trigger: (data?: T) => Promise<void>;
3151
+ /** Gets rid of all the suscribed events. */
3152
+ reset(): void;
3153
+ private handlers;
3195
3154
  }
3196
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3197
- import { Components } from "../../Components";
3198
3155
  /**
3199
- * Base class of the library. Useful for finding out the interfaces something implements.
3156
+ * 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.
3200
3157
  */
3201
- export declare abstract class Base {
3202
- components: Components;
3203
- constructor(components: Components);
3204
- /** Whether is component is {@link Disposable}. */
3205
- isDisposeable: () => this is Disposable;
3206
- /** Whether is component is {@link Resizeable}. */
3207
- isResizeable: () => this is Resizeable;
3208
- /** Whether is component is {@link Updateable}. */
3209
- isUpdateable: () => this is Updateable;
3210
- /** Whether is component is {@link Hideable}. */
3211
- isHideable: () => this is Hideable;
3212
- /** Whether is component is {@link Configurable}. */
3213
- isConfigurable: () => this is Configurable<any, any>;
3158
+ export declare class Event<T> {
3159
+ /**
3160
+ * Add a callback to this event instance.
3161
+ * @param handler - the callback to be added to this event.
3162
+ */
3163
+ add(handler: T extends void ? {
3164
+ (): void;
3165
+ } : {
3166
+ (data: T): void;
3167
+ }): void;
3168
+ /**
3169
+ * Removes a callback from this event instance.
3170
+ * @param handler - the callback to be removed from this event.
3171
+ */
3172
+ remove(handler: T extends void ? {
3173
+ (): void;
3174
+ } : {
3175
+ (data: T): void;
3176
+ }): void;
3177
+ /** Triggers all the callbacks assigned to this event. */
3178
+ trigger: (data?: T) => void;
3179
+ /** Gets rid of all the suscribed events. */
3180
+ reset(): void;
3181
+ private handlers;
3214
3182
  }
3215
3183
  import * as THREE from "three";
3216
3184
  import CameraControls from "camera-controls";
@@ -3320,6 +3288,38 @@ export interface CameraControllable {
3320
3288
  controls: CameraControls;
3321
3289
  }
3322
3290
  import { Base } from "./base";
3291
+ /**
3292
+ * 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.
3293
+ */
3294
+ export declare abstract class Component extends Base {
3295
+ /**
3296
+ * Whether this component is active or not. The behaviour can vary depending
3297
+ * on the type of component. E.g. a disabled dimension tool will stop creating
3298
+ * dimensions, while a disabled camera will stop moving. A disabled component
3299
+ * will not be updated automatically each frame.
3300
+ */
3301
+ abstract enabled: boolean;
3302
+ }
3303
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3304
+ import { Components } from "../../Components";
3305
+ /**
3306
+ * Base class of the library. Useful for finding out the interfaces something implements.
3307
+ */
3308
+ export declare abstract class Base {
3309
+ components: Components;
3310
+ constructor(components: Components);
3311
+ /** Whether is component is {@link Disposable}. */
3312
+ isDisposeable: () => this is Disposable;
3313
+ /** Whether is component is {@link Resizeable}. */
3314
+ isResizeable: () => this is Resizeable;
3315
+ /** Whether is component is {@link Updateable}. */
3316
+ isUpdateable: () => this is Updateable;
3317
+ /** Whether is component is {@link Hideable}. */
3318
+ isHideable: () => this is Hideable;
3319
+ /** Whether is component is {@link Configurable}. */
3320
+ isConfigurable: () => this is Configurable<any, any>;
3321
+ }
3322
+ import { Base } from "./base";
3323
3323
  import { World } from "./world";
3324
3324
  import { Event } from "./event";
3325
3325
  import { Components } from "../../Components";
@@ -3550,92 +3550,8 @@ export declare class DataSet<T> extends Set<T> {
3550
3550
  delete(value: T): boolean;
3551
3551
  /**
3552
3552
  * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3553
- */
3554
- dispose(): void;
3555
- }
3556
- import { Event } from "./event";
3557
- /**
3558
- * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
3559
- *
3560
- * @template K - The type of keys in the map.
3561
- * @template V - The type of values in the map.
3562
- */
3563
- export declare class DataMap<K, V> extends Map<K, V> {
3564
- /**
3565
- * An event triggered when a new item is set in the map.
3566
- */
3567
- readonly onItemSet: Event<{
3568
- key: K;
3569
- value: V;
3570
- }>;
3571
- /**
3572
- * An event triggered when an existing item in the map is updated.
3573
- */
3574
- readonly onItemUpdated: Event<{
3575
- key: K;
3576
- value: V;
3577
- }>;
3578
- /**
3579
- * An event triggered when an item is deleted from the map.
3580
- */
3581
- readonly onItemDeleted: Event<K>;
3582
- /**
3583
- * An event triggered when the map is cleared.
3584
- */
3585
- readonly onCleared: Event<unknown>;
3586
- /**
3587
- * Constructs a new DataMap instance.
3588
- *
3589
- * @param iterable - An iterable object containing key-value pairs to populate the map.
3590
- */
3591
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3592
- /**
3593
- * Clears the map and triggers the onCleared event.
3594
- */
3595
- clear(): void;
3596
- /**
3597
- * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
3598
- *
3599
- * @param key - The key of the item to set.
3600
- * @param value - The value of the item to set.
3601
- * @returns The DataMap instance.
3602
- */
3603
- set(key: K, value: V): this;
3604
- /**
3605
- * A function that acts as a guard for adding items to the set.
3606
- * It determines whether a given value should be allowed to be added to the set.
3607
- *
3608
- * @param key - The key of the entry to be checked against the guard.
3609
- * @param value - The value of the entry to be checked against the guard.
3610
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
3611
- * By default, this function always returns true, allowing all values to be added.
3612
- * You can override this behavior by providing a custom implementation.
3613
- */
3614
- guard: (key: K, value: V) => boolean;
3615
- /**
3616
- * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
3617
- *
3618
- * @param key - The key of the item to delete.
3619
- * @returns True if the key was found and deleted; otherwise, false.
3620
- */
3621
- delete(key: K): boolean;
3622
- /**
3623
- * Clears the map and resets the events.
3624
- */
3625
- dispose(): void;
3626
- }
3627
- import { Component } from "./component";
3628
- export type ComponentUIElement = {
3629
- name: string;
3630
- componentID: string;
3631
- attributes: {
3632
- [name: string]: string;
3633
- };
3634
- get: () => HTMLElement;
3635
- };
3636
- export declare abstract class ComponentWithUI extends Component {
3637
- abstract name: string;
3638
- abstract getUI(): ComponentUIElement[];
3553
+ */
3554
+ dispose(): void;
3639
3555
  }
3640
3556
  import * as THREE from "three";
3641
3557
  export interface BooleanSettingsControl {
@@ -3687,183 +3603,89 @@ export declare abstract class ConfigManager<T, U extends ControlsSchema> {
3687
3603
  constructor(component: T);
3688
3604
  }
3689
3605
  export {};
3690
- import * as THREE from "three";
3691
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3606
+ import { Component } from "./component";
3607
+ export type ComponentUIElement = {
3608
+ name: string;
3609
+ componentID: string;
3610
+ attributes: {
3611
+ [name: string]: string;
3612
+ };
3613
+ get: () => HTMLElement;
3614
+ };
3615
+ export declare abstract class ComponentWithUI extends Component {
3616
+ abstract name: string;
3617
+ abstract getUI(): ComponentUIElement[];
3618
+ }
3619
+ import { Event } from "./event";
3692
3620
  /**
3693
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3621
+ * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
3694
3622
  *
3695
- * @template T - The type of the scene. Default is BaseScene.
3696
- * @template U - The type of the camera. Default is BaseCamera.
3697
- * @template S - The type of the renderer. Default is BaseRenderer.
3623
+ * @template K - The type of keys in the map.
3624
+ * @template V - The type of values in the map.
3698
3625
  */
3699
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3700
- /**
3701
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3702
- */
3703
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3704
- /** {@link Updateable.onAfterUpdate} */
3705
- readonly onAfterUpdate: Event<unknown>;
3706
- /** {@link Updateable.onBeforeUpdate} */
3707
- readonly onBeforeUpdate: Event<unknown>;
3708
- /** {@link Disposable.onDisposed} */
3709
- readonly onDisposed: Event<unknown>;
3710
- /**
3711
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3712
- */
3713
- isDisposing: boolean;
3714
- /**
3715
- * Indicates whether the world is currently enabled.
3716
- * When disabled, the world will not be updated.
3717
- */
3718
- enabled: boolean;
3719
- /**
3720
- * A unique identifier for the world.
3721
- */
3722
- uuid: string;
3723
- /**
3724
- * An optional name for the world.
3725
- */
3726
- name?: string;
3727
- private _scene?;
3728
- private _camera?;
3729
- private _renderer;
3730
- /**
3731
- * Getter for the scene. If no scene is initialized, it throws an error.
3732
- * @returns The current scene.
3733
- */
3734
- get scene(): T;
3735
- /**
3736
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3737
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3738
- * @param scene - The new scene to be set.
3739
- */
3740
- set scene(scene: T);
3741
- /**
3742
- * Getter for the camera. If no camera is initialized, it throws an error.
3743
- * @returns The current camera.
3744
- */
3745
- get camera(): U;
3626
+ export declare class DataMap<K, V> extends Map<K, V> {
3746
3627
  /**
3747
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3748
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3749
- * @param camera - The new camera to be set.
3628
+ * An event triggered when a new item is set in the map.
3750
3629
  */
3751
- set camera(camera: U);
3630
+ readonly onItemSet: Event<{
3631
+ key: K;
3632
+ value: V;
3633
+ }>;
3752
3634
  /**
3753
- * Getter for the renderer.
3754
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3635
+ * An event triggered when an existing item in the map is updated.
3755
3636
  */
3756
- get renderer(): S | null;
3637
+ readonly onItemUpdated: Event<{
3638
+ key: K;
3639
+ value: V;
3640
+ }>;
3757
3641
  /**
3758
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3759
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3760
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3761
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3642
+ * An event triggered when an item is deleted from the map.
3762
3643
  */
3763
- set renderer(renderer: S | null);
3764
- /** {@link Updateable.update} */
3765
- update(delta?: number): void;
3766
- /** {@link Disposable.dispose} */
3767
- dispose(disposeResources?: boolean): void;
3768
- }
3769
- import * as THREE from "three";
3770
- import { Hideable, Disposable, Event, World } from "../../Types";
3771
- import { Components } from "../../Components";
3772
- /**
3773
- * Each of the clipping planes created by the clipper.
3774
- */
3775
- export declare class SimplePlane implements Disposable, Hideable {
3776
- /** Event that fires when the user starts dragging a clipping plane. */
3777
- readonly onDraggingStarted: Event<unknown>;
3778
- /** Event that fires when the user stops dragging a clipping plane. */
3779
- readonly onDraggingEnded: Event<unknown>;
3780
- /** {@link Disposable.onDisposed} */
3781
- readonly onDisposed: Event<unknown>;
3644
+ readonly onItemDeleted: Event<K>;
3782
3645
  /**
3783
- * The normal vector of the clipping plane.
3646
+ * An event triggered when the map is cleared.
3784
3647
  */
3785
- readonly normal: THREE.Vector3;
3648
+ readonly onCleared: Event<unknown>;
3786
3649
  /**
3787
- * The origin point of the clipping plane.
3650
+ * Constructs a new DataMap instance.
3651
+ *
3652
+ * @param iterable - An iterable object containing key-value pairs to populate the map.
3788
3653
  */
3789
- readonly origin: THREE.Vector3;
3654
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3790
3655
  /**
3791
- * The THREE.js Plane object representing the clipping plane.
3656
+ * Clears the map and triggers the onCleared event.
3792
3657
  */
3793
- readonly three: THREE.Plane;
3794
- /** The components instance to which this plane belongs. */
3795
- components: Components;
3796
- /** The world instance to which this plane belongs. */
3797
- world: World;
3798
- /** A custom string to identify what this plane is used for. */
3799
- type: string;
3800
- protected readonly _helper: THREE.Object3D;
3801
- protected _visible: boolean;
3802
- protected _enabled: boolean;
3803
- private _controlsActive;
3804
- private readonly _arrowBoundBox;
3805
- private readonly _planeMesh;
3806
- private readonly _controls;
3807
- private readonly _hiddenMaterial;
3658
+ clear(): void;
3808
3659
  /**
3809
- * Getter for the enabled state of the clipping plane.
3810
- * @returns {boolean} The current enabled state.
3660
+ * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
3661
+ *
3662
+ * @param key - The key of the item to set.
3663
+ * @param value - The value of the item to set.
3664
+ * @returns The DataMap instance.
3811
3665
  */
3812
- get enabled(): boolean;
3666
+ set(key: K, value: V): this;
3813
3667
  /**
3814
- * Setter for the enabled state of the clipping plane.
3815
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3816
- * @param {boolean} state - The new enabled state.
3668
+ * A function that acts as a guard for adding items to the set.
3669
+ * It determines whether a given value should be allowed to be added to the set.
3670
+ *
3671
+ * @param key - The key of the entry to be checked against the guard.
3672
+ * @param value - The value of the entry to be checked against the guard.
3673
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
3674
+ * By default, this function always returns true, allowing all values to be added.
3675
+ * You can override this behavior by providing a custom implementation.
3817
3676
  */
3818
- set enabled(state: boolean);
3819
- /** {@link Hideable.visible } */
3820
- get visible(): boolean;
3821
- /** {@link Hideable.visible } */
3822
- set visible(state: boolean);
3823
- /** The meshes used for raycasting */
3824
- get meshes(): THREE.Mesh[];
3825
- /** The material of the clipping plane representation. */
3826
- get planeMaterial(): THREE.Material | THREE.Material[];
3827
- /** The material of the clipping plane representation. */
3828
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3829
- /** The size of the clipping plane representation. */
3830
- get size(): number;
3831
- /** Sets the size of the clipping plane representation. */
3832
- set size(size: number);
3677
+ guard: (key: K, value: V) => boolean;
3833
3678
  /**
3834
- * Getter for the helper object of the clipping plane.
3835
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3836
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3679
+ * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
3837
3680
  *
3838
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3681
+ * @param key - The key of the item to delete.
3682
+ * @returns True if the key was found and deleted; otherwise, false.
3839
3683
  */
3840
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3841
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3684
+ delete(key: K): boolean;
3842
3685
  /**
3843
- * Sets the clipping plane's normal and origin from the given normal and point.
3844
- * This method resets the clipping plane's state, updates the normal and origin,
3845
- * and positions the helper object accordingly.
3846
- *
3847
- * @param normal - The new normal vector for the clipping plane.
3848
- * @param point - The new origin point for the clipping plane.
3849
- *
3850
- * @returns {void}
3686
+ * Clears the map and resets the events.
3851
3687
  */
3852
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3853
- /** {@link Updateable.update} */
3854
- update: () => void;
3855
- /** {@link Disposable.dispose} */
3856
3688
  dispose(): void;
3857
- private reset;
3858
- protected toggleControls(state: boolean): void;
3859
- private newTransformControls;
3860
- private initializeControls;
3861
- private createArrowBoundingBox;
3862
- private changeDrag;
3863
- private notifyDraggingChanged;
3864
- private preventCameraMovement;
3865
- private newHelper;
3866
- private static newPlaneMesh;
3867
3689
  }
3868
3690
  import * as THREE from "three";
3869
3691
  import { BaseScene, Configurable, Event } from "../../Types";
@@ -3876,18 +3698,80 @@ export declare class SimpleScene extends BaseScene implements Configurable<Simpl
3876
3698
  /** {@link Configurable.isSetup} */
3877
3699
  isSetup: boolean;
3878
3700
  /**
3879
- * The underlying Three.js scene object.
3880
- * It is used to define the 3D space containing objects, lights, and cameras.
3701
+ * The underlying Three.js scene object.
3702
+ * It is used to define the 3D space containing objects, lights, and cameras.
3703
+ */
3704
+ three: THREE.Scene;
3705
+ /** {@link Configurable.onSetup} */
3706
+ readonly onSetup: Event<SimpleScene>;
3707
+ /** {@link Configurable.config} */
3708
+ config: SimpleSceneConfigManager;
3709
+ protected _defaultConfig: SimpleSceneConfig;
3710
+ constructor(components: Components);
3711
+ /** {@link Configurable.setup} */
3712
+ setup(config?: Partial<SimpleSceneConfig>): void;
3713
+ }
3714
+ import * as THREE from "three";
3715
+ import CameraControls from "camera-controls";
3716
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3717
+ import { Components } from "../../Components";
3718
+ /**
3719
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3720
+ */
3721
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3722
+ /** {@link Updateable.onBeforeUpdate} */
3723
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3724
+ /** {@link Updateable.onAfterUpdate} */
3725
+ readonly onAfterUpdate: Event<SimpleCamera>;
3726
+ /**
3727
+ * Event that is triggered when the aspect of the camera has been updated.
3728
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3729
+ */
3730
+ readonly onAspectUpdated: Event<unknown>;
3731
+ /** {@link Disposable.onDisposed} */
3732
+ readonly onDisposed: Event<string>;
3733
+ /**
3734
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3735
+ * This camera is used for rendering the scene.
3736
+ */
3737
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3738
+ private _allControls;
3739
+ /**
3740
+ * The object that controls the camera. An instance of
3741
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3742
+ * Transforming the camera directly will have no effect: you need to use this
3743
+ * object to move, rotate, look at objects, etc.
3744
+ */
3745
+ get controls(): CameraControls;
3746
+ /**
3747
+ * Getter for the enabled state of the camera controls.
3748
+ * If the current world is null, it returns false.
3749
+ * Otherwise, it returns the enabled state of the camera controls.
3750
+ *
3751
+ * @returns {boolean} The enabled state of the camera controls.
3881
3752
  */
3882
- three: THREE.Scene;
3883
- /** {@link Configurable.onSetup} */
3884
- readonly onSetup: Event<SimpleScene>;
3885
- /** {@link Configurable.config} */
3886
- config: SimpleSceneConfigManager;
3887
- protected _defaultConfig: SimpleSceneConfig;
3753
+ get enabled(): boolean;
3754
+ /**
3755
+ * Setter for the enabled state of the camera controls.
3756
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3757
+ *
3758
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3759
+ */
3760
+ set enabled(enabled: boolean);
3888
3761
  constructor(components: Components);
3889
- /** {@link Configurable.setup} */
3890
- setup(config?: Partial<SimpleSceneConfig>): void;
3762
+ /** {@link Disposable.dispose} */
3763
+ dispose(): void;
3764
+ /** {@link Updateable.update} */
3765
+ update(_delta: number): void;
3766
+ /**
3767
+ * Updates the aspect of the camera to match the size of the
3768
+ * {@link Components.renderer}.
3769
+ */
3770
+ updateAspect: () => void;
3771
+ private setupCamera;
3772
+ private newCameraControls;
3773
+ private setupEvents;
3774
+ private static getSubsetOfThree;
3891
3775
  }
3892
3776
  import * as THREE from "three";
3893
3777
  import { BaseRenderer, Event } from "../../Types";
@@ -3944,66 +3828,83 @@ export declare class SimpleRenderer extends BaseRenderer {
3944
3828
  private onContextBack;
3945
3829
  }
3946
3830
  import * as THREE from "three";
3947
- import CameraControls from "camera-controls";
3948
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3949
- import { Components } from "../../Components";
3831
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3950
3832
  /**
3951
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3833
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3834
+ *
3835
+ * @template T - The type of the scene. Default is BaseScene.
3836
+ * @template U - The type of the camera. Default is BaseCamera.
3837
+ * @template S - The type of the renderer. Default is BaseRenderer.
3952
3838
  */
3953
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3954
- /** {@link Updateable.onBeforeUpdate} */
3955
- readonly onBeforeUpdate: Event<SimpleCamera>;
3956
- /** {@link Updateable.onAfterUpdate} */
3957
- readonly onAfterUpdate: Event<SimpleCamera>;
3839
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3958
3840
  /**
3959
- * Event that is triggered when the aspect of the camera has been updated.
3960
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3841
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3961
3842
  */
3962
- readonly onAspectUpdated: Event<unknown>;
3843
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3844
+ /** {@link Updateable.onAfterUpdate} */
3845
+ readonly onAfterUpdate: Event<unknown>;
3846
+ /** {@link Updateable.onBeforeUpdate} */
3847
+ readonly onBeforeUpdate: Event<unknown>;
3963
3848
  /** {@link Disposable.onDisposed} */
3964
- readonly onDisposed: Event<string>;
3849
+ readonly onDisposed: Event<unknown>;
3965
3850
  /**
3966
- * A three.js PerspectiveCamera or OrthographicCamera instance.
3967
- * This camera is used for rendering the scene.
3851
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3968
3852
  */
3969
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3970
- private _allControls;
3853
+ isDisposing: boolean;
3971
3854
  /**
3972
- * The object that controls the camera. An instance of
3973
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3974
- * Transforming the camera directly will have no effect: you need to use this
3975
- * object to move, rotate, look at objects, etc.
3855
+ * Indicates whether the world is currently enabled.
3856
+ * When disabled, the world will not be updated.
3976
3857
  */
3977
- get controls(): CameraControls;
3858
+ enabled: boolean;
3978
3859
  /**
3979
- * Getter for the enabled state of the camera controls.
3980
- * If the current world is null, it returns false.
3981
- * Otherwise, it returns the enabled state of the camera controls.
3982
- *
3983
- * @returns {boolean} The enabled state of the camera controls.
3860
+ * A unique identifier for the world.
3984
3861
  */
3985
- get enabled(): boolean;
3862
+ uuid: string;
3986
3863
  /**
3987
- * Setter for the enabled state of the camera controls.
3988
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3989
- *
3990
- * @param {boolean} enabled - The new enabled state of the camera controls.
3864
+ * An optional name for the world.
3991
3865
  */
3992
- set enabled(enabled: boolean);
3993
- constructor(components: Components);
3994
- /** {@link Disposable.dispose} */
3995
- dispose(): void;
3996
- /** {@link Updateable.update} */
3997
- update(_delta: number): void;
3866
+ name?: string;
3867
+ private _scene?;
3868
+ private _camera?;
3869
+ private _renderer;
3998
3870
  /**
3999
- * Updates the aspect of the camera to match the size of the
4000
- * {@link Components.renderer}.
3871
+ * Getter for the scene. If no scene is initialized, it throws an error.
3872
+ * @returns The current scene.
4001
3873
  */
4002
- updateAspect: () => void;
4003
- private setupCamera;
4004
- private newCameraControls;
4005
- private setupEvents;
4006
- private static getSubsetOfThree;
3874
+ get scene(): T;
3875
+ /**
3876
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3877
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3878
+ * @param scene - The new scene to be set.
3879
+ */
3880
+ set scene(scene: T);
3881
+ /**
3882
+ * Getter for the camera. If no camera is initialized, it throws an error.
3883
+ * @returns The current camera.
3884
+ */
3885
+ get camera(): U;
3886
+ /**
3887
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3888
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3889
+ * @param camera - The new camera to be set.
3890
+ */
3891
+ set camera(camera: U);
3892
+ /**
3893
+ * Getter for the renderer.
3894
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3895
+ */
3896
+ get renderer(): S | null;
3897
+ /**
3898
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3899
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3900
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3901
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3902
+ */
3903
+ set renderer(renderer: S | null);
3904
+ /** {@link Updateable.update} */
3905
+ update(delta?: number): void;
3906
+ /** {@link Disposable.dispose} */
3907
+ dispose(disposeResources?: boolean): void;
4007
3908
  }
4008
3909
  import * as THREE from "three";
4009
3910
  import { SimpleScene } from "./simple-scene";
@@ -4041,62 +3942,185 @@ declare class AmbientLightConfig {
4041
3942
  set intensity(value: number);
4042
3943
  }
4043
3944
  /**
4044
- * Configuration interface for the {@link SimpleScene}.
3945
+ * Configuration interface for the {@link SimpleScene}.
3946
+ */
3947
+ export interface SimpleSceneConfig {
3948
+ backgroundColor: THREE.Color;
3949
+ directionalLight: {
3950
+ color: THREE.Color;
3951
+ intensity: number;
3952
+ position: THREE.Vector3;
3953
+ };
3954
+ ambientLight: {
3955
+ color: THREE.Color;
3956
+ intensity: number;
3957
+ };
3958
+ }
3959
+ export declare class SimpleSceneConfigManager extends ConfigManager<SimpleScene, SimpleSceneConfigType> {
3960
+ protected _list: {
3961
+ backgroundColor: {
3962
+ value: THREE.Color;
3963
+ opacity: number;
3964
+ type: "Color";
3965
+ };
3966
+ ambientLight: {
3967
+ color: {
3968
+ type: "Color";
3969
+ opacity: number;
3970
+ value: THREE.Color;
3971
+ };
3972
+ intensity: {
3973
+ type: "Number";
3974
+ interpolable: boolean;
3975
+ value: number;
3976
+ };
3977
+ };
3978
+ directionalLight: {
3979
+ color: {
3980
+ type: "Color";
3981
+ opacity: number;
3982
+ value: THREE.Color;
3983
+ };
3984
+ intensity: {
3985
+ type: "Number";
3986
+ interpolable: boolean;
3987
+ value: number;
3988
+ };
3989
+ position: {
3990
+ type: "Vector";
3991
+ value: THREE.Vector3;
3992
+ };
3993
+ };
3994
+ };
3995
+ ambientLight: AmbientLightConfig;
3996
+ directionalLight: DirectionalLightConfig;
3997
+ get backgroundColor(): THREE.Color;
3998
+ set backgroundColor(value: THREE.Color);
3999
+ }
4000
+ export {};
4001
+ import { NavigationMode } from "./types";
4002
+ import { OrthoPerspectiveCamera } from "../index";
4003
+ /**
4004
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
4005
+ */
4006
+ export declare class FirstPersonMode implements NavigationMode {
4007
+ private camera;
4008
+ /** {@link NavigationMode.enabled} */
4009
+ enabled: boolean;
4010
+ /** {@link NavigationMode.id} */
4011
+ readonly id = "FirstPerson";
4012
+ constructor(camera: OrthoPerspectiveCamera);
4013
+ /** {@link NavigationMode.set} */
4014
+ set(active: boolean): void;
4015
+ private setupFirstPersonCamera;
4016
+ }
4017
+ import { NavigationMode } from "./types";
4018
+ import { OrthoPerspectiveCamera } from "../index";
4019
+ /**
4020
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
4021
+ */
4022
+ export declare class OrbitMode implements NavigationMode {
4023
+ camera: OrthoPerspectiveCamera;
4024
+ /** {@link NavigationMode.enabled} */
4025
+ enabled: boolean;
4026
+ /** {@link NavigationMode.id} */
4027
+ readonly id = "Orbit";
4028
+ constructor(camera: OrthoPerspectiveCamera);
4029
+ /** {@link NavigationMode.set} */
4030
+ set(active: boolean): void;
4031
+ private activateOrbitControls;
4032
+ }
4033
+ import { NavigationMode } from "./types";
4034
+ import { OrthoPerspectiveCamera } from "../index";
4035
+ /**
4036
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
4037
+ */
4038
+ export declare class PlanMode implements NavigationMode {
4039
+ private camera;
4040
+ /** {@link NavigationMode.enabled} */
4041
+ enabled: boolean;
4042
+ /** {@link NavigationMode.id} */
4043
+ readonly id = "Plan";
4044
+ private mouseAction1?;
4045
+ private mouseAction2?;
4046
+ private mouseInitialized;
4047
+ private readonly defaultAzimuthSpeed;
4048
+ private readonly defaultPolarSpeed;
4049
+ constructor(camera: OrthoPerspectiveCamera);
4050
+ /** {@link NavigationMode.set} */
4051
+ set(active: boolean): void;
4052
+ }
4053
+ import * as THREE from "three";
4054
+ import { CameraProjection } from "./types";
4055
+ import { Event } from "../../Types";
4056
+ import { OrthoPerspectiveCamera } from "../index";
4057
+ /**
4058
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4045
4059
  */
4046
- export interface SimpleSceneConfig {
4047
- backgroundColor: THREE.Color;
4048
- directionalLight: {
4049
- color: THREE.Color;
4050
- intensity: number;
4051
- position: THREE.Vector3;
4052
- };
4053
- ambientLight: {
4054
- color: THREE.Color;
4055
- intensity: number;
4056
- };
4060
+ export declare class ProjectionManager {
4061
+ /**
4062
+ * Event that fires when the {@link CameraProjection} changes.
4063
+ */
4064
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
4065
+ /**
4066
+ * Current projection mode of the camera.
4067
+ * Default is "Perspective".
4068
+ */
4069
+ current: CameraProjection;
4070
+ /**
4071
+ * The camera controlled by this ProjectionManager.
4072
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
4073
+ */
4074
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
4075
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
4076
+ matchOrthoDistanceEnabled: boolean;
4077
+ private _component;
4078
+ private _previousDistance;
4079
+ constructor(camera: OrthoPerspectiveCamera);
4080
+ /**
4081
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4082
+ *
4083
+ * @param projection - the new projection to set. If it is the current projection,
4084
+ * it will have no effect.
4085
+ */
4086
+ set(projection: CameraProjection): Promise<void>;
4087
+ /**
4088
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
4089
+ * and vice versa.
4090
+ */
4091
+ toggle(): Promise<void>;
4092
+ private setOrthoCamera;
4093
+ private getPerspectiveDims;
4094
+ private setupOrthoCamera;
4095
+ private getDistance;
4096
+ private setPerspectiveCamera;
4057
4097
  }
4058
- export declare class SimpleSceneConfigManager extends ConfigManager<SimpleScene, SimpleSceneConfigType> {
4059
- protected _list: {
4060
- backgroundColor: {
4061
- value: THREE.Color;
4062
- opacity: number;
4063
- type: "Color";
4064
- };
4065
- ambientLight: {
4066
- color: {
4067
- type: "Color";
4068
- opacity: number;
4069
- value: THREE.Color;
4070
- };
4071
- intensity: {
4072
- type: "Number";
4073
- interpolable: boolean;
4074
- value: number;
4075
- };
4076
- };
4077
- directionalLight: {
4078
- color: {
4079
- type: "Color";
4080
- opacity: number;
4081
- value: THREE.Color;
4082
- };
4083
- intensity: {
4084
- type: "Number";
4085
- interpolable: boolean;
4086
- value: number;
4087
- };
4088
- position: {
4089
- type: "Vector";
4090
- value: THREE.Vector3;
4091
- };
4092
- };
4093
- };
4094
- ambientLight: AmbientLightConfig;
4095
- directionalLight: DirectionalLightConfig;
4096
- get backgroundColor(): THREE.Color;
4097
- set backgroundColor(value: THREE.Color);
4098
+ /**
4099
+ * The projection system of the camera.
4100
+ */
4101
+ export type CameraProjection = "Perspective" | "Orthographic";
4102
+ /**
4103
+ * The extensible list of supported navigation modes.
4104
+ */
4105
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
4106
+ /**
4107
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
4108
+ */
4109
+ export interface NavigationMode {
4110
+ /** The unique ID of this navigation mode. */
4111
+ id: NavModeID;
4112
+ /**
4113
+ * Enable or disable this navigation mode.
4114
+ * When a new navigation mode is enabled, the previous navigation mode
4115
+ * must be disabled.
4116
+ *
4117
+ * @param active - whether to enable or disable this mode.
4118
+ * @param options - any additional data required to enable or disable it.
4119
+ * */
4120
+ set: (active: boolean, options?: any) => void;
4121
+ /** Whether this navigation mode is active or not. */
4122
+ enabled: boolean;
4098
4123
  }
4099
- export {};
4100
4124
  import * as THREE from "three";
4101
4125
  import { Event, World } from "../../Types";
4102
4126
  import { Components } from "../../Components";
@@ -4164,128 +4188,190 @@ export declare class DistanceRenderer {
4164
4188
  compute: () => Promise<void>;
4165
4189
  private handleWorkerMessage;
4166
4190
  }
4167
- import { NavigationMode } from "./types";
4168
- import { OrthoPerspectiveCamera } from "../index";
4169
- /**
4170
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
4171
- */
4172
- export declare class OrbitMode implements NavigationMode {
4173
- camera: OrthoPerspectiveCamera;
4174
- /** {@link NavigationMode.enabled} */
4175
- enabled: boolean;
4176
- /** {@link NavigationMode.id} */
4177
- readonly id = "Orbit";
4178
- constructor(camera: OrthoPerspectiveCamera);
4179
- /** {@link NavigationMode.set} */
4180
- set(active: boolean): void;
4181
- private activateOrbitControls;
4182
- }
4183
- import { NavigationMode } from "./types";
4184
- import { OrthoPerspectiveCamera } from "../index";
4185
- /**
4186
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
4187
- */
4188
- export declare class FirstPersonMode implements NavigationMode {
4189
- private camera;
4190
- /** {@link NavigationMode.enabled} */
4191
- enabled: boolean;
4192
- /** {@link NavigationMode.id} */
4193
- readonly id = "FirstPerson";
4194
- constructor(camera: OrthoPerspectiveCamera);
4195
- /** {@link NavigationMode.set} */
4196
- set(active: boolean): void;
4197
- private setupFirstPersonCamera;
4198
- }
4199
- import { NavigationMode } from "./types";
4200
- import { OrthoPerspectiveCamera } from "../index";
4191
+ import * as THREE from "three";
4192
+ import { Hideable, Disposable, Event, World } from "../../Types";
4193
+ import { Components } from "../../Components";
4201
4194
  /**
4202
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
4195
+ * Each of the clipping planes created by the clipper.
4203
4196
  */
4204
- export declare class PlanMode implements NavigationMode {
4205
- private camera;
4206
- /** {@link NavigationMode.enabled} */
4207
- enabled: boolean;
4208
- /** {@link NavigationMode.id} */
4209
- readonly id = "Plan";
4210
- private mouseAction1?;
4211
- private mouseAction2?;
4212
- private mouseInitialized;
4213
- private readonly defaultAzimuthSpeed;
4214
- private readonly defaultPolarSpeed;
4215
- constructor(camera: OrthoPerspectiveCamera);
4216
- /** {@link NavigationMode.set} */
4217
- set(active: boolean): void;
4197
+ export declare class SimplePlane implements Disposable, Hideable {
4198
+ /** Event that fires when the user starts dragging a clipping plane. */
4199
+ readonly onDraggingStarted: Event<unknown>;
4200
+ /** Event that fires when the user stops dragging a clipping plane. */
4201
+ readonly onDraggingEnded: Event<unknown>;
4202
+ /** {@link Disposable.onDisposed} */
4203
+ readonly onDisposed: Event<unknown>;
4204
+ /**
4205
+ * The normal vector of the clipping plane.
4206
+ */
4207
+ readonly normal: THREE.Vector3;
4208
+ /**
4209
+ * The origin point of the clipping plane.
4210
+ */
4211
+ readonly origin: THREE.Vector3;
4212
+ /**
4213
+ * The THREE.js Plane object representing the clipping plane.
4214
+ */
4215
+ readonly three: THREE.Plane;
4216
+ /** The components instance to which this plane belongs. */
4217
+ components: Components;
4218
+ /** The world instance to which this plane belongs. */
4219
+ world: World;
4220
+ /** A custom string to identify what this plane is used for. */
4221
+ type: string;
4222
+ protected readonly _helper: THREE.Object3D;
4223
+ protected _visible: boolean;
4224
+ protected _enabled: boolean;
4225
+ private _controlsActive;
4226
+ private readonly _arrowBoundBox;
4227
+ private readonly _planeMesh;
4228
+ private readonly _controls;
4229
+ private readonly _hiddenMaterial;
4230
+ /**
4231
+ * Getter for the enabled state of the clipping plane.
4232
+ * @returns {boolean} The current enabled state.
4233
+ */
4234
+ get enabled(): boolean;
4235
+ /**
4236
+ * Setter for the enabled state of the clipping plane.
4237
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
4238
+ * @param {boolean} state - The new enabled state.
4239
+ */
4240
+ set enabled(state: boolean);
4241
+ /** {@link Hideable.visible } */
4242
+ get visible(): boolean;
4243
+ /** {@link Hideable.visible } */
4244
+ set visible(state: boolean);
4245
+ /** The meshes used for raycasting */
4246
+ get meshes(): THREE.Mesh[];
4247
+ /** The material of the clipping plane representation. */
4248
+ get planeMaterial(): THREE.Material | THREE.Material[];
4249
+ /** The material of the clipping plane representation. */
4250
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
4251
+ /** The size of the clipping plane representation. */
4252
+ get size(): number;
4253
+ /** Sets the size of the clipping plane representation. */
4254
+ set size(size: number);
4255
+ /**
4256
+ * Getter for the helper object of the clipping plane.
4257
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
4258
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
4259
+ *
4260
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
4261
+ */
4262
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
4263
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
4264
+ /**
4265
+ * Sets the clipping plane's normal and origin from the given normal and point.
4266
+ * This method resets the clipping plane's state, updates the normal and origin,
4267
+ * and positions the helper object accordingly.
4268
+ *
4269
+ * @param normal - The new normal vector for the clipping plane.
4270
+ * @param point - The new origin point for the clipping plane.
4271
+ *
4272
+ * @returns {void}
4273
+ */
4274
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
4275
+ /** {@link Updateable.update} */
4276
+ update: () => void;
4277
+ /** {@link Disposable.dispose} */
4278
+ dispose(): void;
4279
+ private reset;
4280
+ protected toggleControls(state: boolean): void;
4281
+ private newTransformControls;
4282
+ private initializeControls;
4283
+ private createArrowBoundingBox;
4284
+ private changeDrag;
4285
+ private notifyDraggingChanged;
4286
+ private preventCameraMovement;
4287
+ private newHelper;
4288
+ private static newPlaneMesh;
4218
4289
  }
4219
4290
  import * as THREE from "three";
4220
- import { CameraProjection } from "./types";
4221
- import { Event } from "../../Types";
4222
- import { OrthoPerspectiveCamera } from "../index";
4291
+ import * as WEBIFC from "web-ifc";
4292
+ import * as FRAGS from "@thatopen/fragments";
4293
+ export declare class CivilReader {
4294
+ defLineMat: THREE.LineBasicMaterial;
4295
+ read(webIfc: WEBIFC.IfcAPI): {
4296
+ alignments: Map<number, FRAGS.Alignment>;
4297
+ coordinationMatrix: THREE.Matrix4;
4298
+ } | undefined;
4299
+ get(civilItems: any): {
4300
+ alignments: Map<number, FRAGS.Alignment>;
4301
+ coordinationMatrix: THREE.Matrix4;
4302
+ } | undefined;
4303
+ private getCurves;
4304
+ }
4305
+ import * as WEBIFC from "web-ifc";
4306
+ export declare class IfcMetadataReader {
4307
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4308
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4309
+ }
4310
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
4223
4311
  /**
4224
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4312
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4225
4313
  */
4226
- export declare class ProjectionManager {
4227
- /**
4228
- * Event that fires when the {@link CameraProjection} changes.
4229
- */
4230
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
4231
- /**
4232
- * Current projection mode of the camera.
4233
- * Default is "Perspective".
4234
- */
4235
- current: CameraProjection;
4236
- /**
4237
- * The camera controlled by this ProjectionManager.
4238
- * It can be either a PerspectiveCamera or an OrthographicCamera.
4239
- */
4240
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
4241
- /** Match Ortho zoom with Perspective distance when changing projection mode */
4242
- matchOrthoDistanceEnabled: boolean;
4243
- private _component;
4244
- private _previousDistance;
4245
- constructor(camera: OrthoPerspectiveCamera);
4314
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
4246
4315
  /**
4247
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4248
- *
4249
- * @param projection - the new projection to set. If it is the current projection,
4250
- * it will have no effect.
4316
+ * Minimum number of geometries to be streamed.
4317
+ * Defaults to 10 geometries.
4251
4318
  */
4252
- set(projection: CameraProjection): Promise<void>;
4319
+ minGeometrySize: number;
4253
4320
  /**
4254
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
4255
- * and vice versa.
4321
+ * Minimum amount of assets to be streamed.
4322
+ * Defaults to 1000 assets.
4256
4323
  */
4257
- toggle(): Promise<void>;
4258
- private setOrthoCamera;
4259
- private getPerspectiveDims;
4260
- private setupOrthoCamera;
4261
- private getDistance;
4262
- private setPerspectiveCamera;
4324
+ minAssetsSize: number;
4263
4325
  }
4264
4326
  /**
4265
- * The projection system of the camera.
4327
+ * 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.
4266
4328
  */
4267
- export type CameraProjection = "Perspective" | "Orthographic";
4329
+ export interface StreamedGeometries {
4330
+ [id: number]: {
4331
+ /** The bounding box of the geometry as a Float32Array. */
4332
+ boundingBox: Float32Array;
4333
+ /** A boolean indicating whether the geometry has holes. */
4334
+ hasHoles: boolean;
4335
+ /** An optional file path for the geometry data. */
4336
+ geometryFile?: string;
4337
+ };
4338
+ }
4268
4339
  /**
4269
- * The extensible list of supported navigation modes.
4340
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
4270
4341
  */
4271
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
4342
+ export interface StreamedAsset {
4343
+ /** The unique identifier of the asset. */
4344
+ id: number;
4345
+ /** An array of geometries associated with the asset. */
4346
+ geometries: {
4347
+ /** The unique identifier of the geometry. */
4348
+ geometryID: number;
4349
+ /** The transformation matrix of the geometry as a number array. */
4350
+ transformation: number[];
4351
+ /** The color of the geometry as a number array. */
4352
+ color: number[];
4353
+ }[];
4354
+ }
4355
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
4272
4356
  /**
4273
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
4357
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
4274
4358
  */
4275
- export interface NavigationMode {
4276
- /** The unique ID of this navigation mode. */
4277
- id: NavModeID;
4359
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
4278
4360
  /**
4279
- * Enable or disable this navigation mode.
4280
- * When a new navigation mode is enabled, the previous navigation mode
4281
- * must be disabled.
4282
- *
4283
- * @param active - whether to enable or disable this mode.
4284
- * @param options - any additional data required to enable or disable it.
4285
- * */
4286
- set: (active: boolean, options?: any) => void;
4287
- /** Whether this navigation mode is active or not. */
4288
- enabled: boolean;
4361
+ * Amount of properties to be streamed.
4362
+ * Defaults to 100 properties.
4363
+ */
4364
+ propertiesSize: number;
4365
+ }
4366
+ import * as WEBIFC from "web-ifc";
4367
+ import * as THREE from "three";
4368
+ export declare class Units {
4369
+ factor: number;
4370
+ complement: number;
4371
+ apply(matrix: THREE.Matrix4): void;
4372
+ setUp(webIfc: WEBIFC.IfcAPI): void;
4373
+ private getLengthUnits;
4374
+ private getScaleMatrix;
4289
4375
  }
4290
4376
  import { Components } from "../../../core/Components";
4291
4377
  import { Viewpoint } from "../../../core/Viewpoints";
@@ -4410,25 +4496,6 @@ export declare class Topic implements BCFTopic {
4410
4496
  */
4411
4497
  serialize(): string;
4412
4498
  }
4413
- export type BCFVersion = "2.1" | "3";
4414
- export interface BCFTopic {
4415
- guid: string;
4416
- serverAssignedId?: string;
4417
- type: string;
4418
- status: string;
4419
- title: string;
4420
- priority?: string;
4421
- index?: number;
4422
- labels: Set<string>;
4423
- creationDate: Date;
4424
- creationAuthor: string;
4425
- modifiedDate?: Date;
4426
- modifiedAuthor?: string;
4427
- dueDate?: Date;
4428
- assignedTo?: string;
4429
- description?: string;
4430
- stage?: string;
4431
- }
4432
4499
  import { Topic } from "..";
4433
4500
  import { Viewpoint } from "../../../core/Viewpoints";
4434
4501
  import { Components } from "../../../core/Components";
@@ -4469,6 +4536,25 @@ export declare class Comment {
4469
4536
  */
4470
4537
  serialize(): string;
4471
4538
  }
4539
+ export type BCFVersion = "2.1" | "3";
4540
+ export interface BCFTopic {
4541
+ guid: string;
4542
+ serverAssignedId?: string;
4543
+ type: string;
4544
+ status: string;
4545
+ title: string;
4546
+ priority?: string;
4547
+ index?: number;
4548
+ labels: Set<string>;
4549
+ creationDate: Date;
4550
+ creationAuthor: string;
4551
+ modifiedDate?: Date;
4552
+ modifiedAuthor?: string;
4553
+ dueDate?: Date;
4554
+ assignedTo?: string;
4555
+ description?: string;
4556
+ stage?: string;
4557
+ }
4472
4558
  import { BCFTopics, BCFVersion } from "../index";
4473
4559
  import { BooleanSettingsControl, ConfigManager, SelectSettingControl, TextSetSettingControl, TextSettingsControl } from "../../../core";
4474
4560
  /**
@@ -4650,92 +4736,6 @@ export declare class BCFTopicsConfigManager extends ConfigManager<BCFTopics, BCF
4650
4736
  set ignoreIncompleteTopicsOnImport(value: boolean);
4651
4737
  }
4652
4738
  export {};
4653
- import { IfcFragmentSettings } from "../../IfcLoader/src";
4654
- /**
4655
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
4656
- */
4657
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
4658
- /**
4659
- * Amount of properties to be streamed.
4660
- * Defaults to 100 properties.
4661
- */
4662
- propertiesSize: number;
4663
- }
4664
- import * as THREE from "three";
4665
- import * as WEBIFC from "web-ifc";
4666
- import * as FRAGS from "@thatopen/fragments";
4667
- export declare class CivilReader {
4668
- defLineMat: THREE.LineBasicMaterial;
4669
- read(webIfc: WEBIFC.IfcAPI): {
4670
- alignments: Map<number, FRAGS.Alignment>;
4671
- coordinationMatrix: THREE.Matrix4;
4672
- } | undefined;
4673
- get(civilItems: any): {
4674
- alignments: Map<number, FRAGS.Alignment>;
4675
- coordinationMatrix: THREE.Matrix4;
4676
- } | undefined;
4677
- private getCurves;
4678
- }
4679
- import * as WEBIFC from "web-ifc";
4680
- export declare class IfcMetadataReader {
4681
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4682
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4683
- }
4684
- import { IfcFragmentSettings } from "../../IfcLoader/src";
4685
- /**
4686
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4687
- */
4688
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
4689
- /**
4690
- * Minimum number of geometries to be streamed.
4691
- * Defaults to 10 geometries.
4692
- */
4693
- minGeometrySize: number;
4694
- /**
4695
- * Minimum amount of assets to be streamed.
4696
- * Defaults to 1000 assets.
4697
- */
4698
- minAssetsSize: number;
4699
- }
4700
- /**
4701
- * 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.
4702
- */
4703
- export interface StreamedGeometries {
4704
- [id: number]: {
4705
- /** The bounding box of the geometry as a Float32Array. */
4706
- boundingBox: Float32Array;
4707
- /** A boolean indicating whether the geometry has holes. */
4708
- hasHoles: boolean;
4709
- /** An optional file path for the geometry data. */
4710
- geometryFile?: string;
4711
- };
4712
- }
4713
- /**
4714
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
4715
- */
4716
- export interface StreamedAsset {
4717
- /** The unique identifier of the asset. */
4718
- id: number;
4719
- /** An array of geometries associated with the asset. */
4720
- geometries: {
4721
- /** The unique identifier of the geometry. */
4722
- geometryID: number;
4723
- /** The transformation matrix of the geometry as a number array. */
4724
- transformation: number[];
4725
- /** The color of the geometry as a number array. */
4726
- color: number[];
4727
- }[];
4728
- }
4729
- import * as WEBIFC from "web-ifc";
4730
- import * as THREE from "three";
4731
- export declare class Units {
4732
- factor: number;
4733
- complement: number;
4734
- apply(matrix: THREE.Matrix4): void;
4735
- setUp(webIfc: WEBIFC.IfcAPI): void;
4736
- private getLengthUnits;
4737
- private getScaleMatrix;
4738
- }
4739
4739
  import { BCFTopics } from "../..";
4740
4740
  export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void;
4741
4741
  import * as WEBIFC from "web-ifc";