@thatopen/components 2.1.8 → 2.1.9

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,573 +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.1.8";
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 * as THREE from "three";
79
- import { Components } from "../Components";
80
- import { Component } from "../Types";
81
- /**
82
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
83
- */
84
- export declare class Disposer extends Component {
85
- private _disposedComponents;
86
- /** {@link Component.enabled} */
87
- enabled: boolean;
88
- /**
89
- * A unique identifier for the component.
90
- * This UUID is used to register the component within the Components system.
91
- */
92
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
93
- constructor(components: Components);
94
- /**
95
- * Return the UUIDs of all disposed components.
96
- */
97
- get(): Set<string>;
98
- /**
99
- * Removes a mesh, its geometry and its materials from memory. If you are
100
- * using any of these in other parts of the application, make sure that you
101
- * remove them from the mesh before disposing it.
102
- *
103
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
- * to remove.
105
- *
106
- * @param materials - whether to dispose the materials of the mesh.
107
- *
108
- * @param recursive - whether to recursively dispose the children of the mesh.
109
- */
110
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
111
- /**
112
- * Disposes a geometry from memory.
113
- *
114
- * @param geometry - the
115
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
- * to remove.
117
- */
118
- disposeGeometry(geometry: THREE.BufferGeometry): void;
119
- private disposeGeometryAndMaterials;
120
- private disposeChildren;
121
- private static disposeMaterial;
122
- }
123
- import { Component, Disposable, World, Event } from "../Types";
124
- import { SimpleRaycaster } from "./src";
125
- import { Components } from "../Components";
126
- /**
127
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
128
- */
129
- export declare class Raycasters extends Component implements Disposable {
130
- /**
131
- * A unique identifier for the component.
132
- * This UUID is used to register the component within the Components system.
133
- */
134
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
135
- /** {@link Component.enabled} */
136
- enabled: boolean;
137
- /**
138
- * A Map that stores raycasters for each world.
139
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
140
- */
141
- list: Map<string, SimpleRaycaster>;
142
- /** {@link Disposable.onDisposed} */
143
- onDisposed: Event<unknown>;
144
- constructor(components: Components);
145
- /**
146
- * Retrieves a SimpleRaycaster instance for the given world.
147
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
148
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
149
- *
150
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
151
- * @returns The SimpleRaycaster instance for the given world.
152
- */
153
- get(world: World): SimpleRaycaster;
154
- /**
155
- * Deletes the SimpleRaycaster instance associated with the given world.
156
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
157
- *
158
- * @param world - The world for which to delete the SimpleRaycaster instance.
159
- * @returns {void}
160
- */
161
- delete(world: World): void;
162
- /** {@link Disposable.dispose} */
163
- dispose(): void;
164
- }
165
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
166
- import { Components } from "../Components";
167
- import { SimpleWorld } from "./src";
168
- /**
169
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
170
- */
171
- export declare class Worlds extends Component implements Updateable, Disposable {
172
- /**
173
- * A unique identifier for the component.
174
- * This UUID is used to register the component within the Components system.
175
- */
176
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
177
- /** {@link Updateable.onAfterUpdate} */
178
- readonly onAfterUpdate: Event<unknown>;
179
- /** {@link Updateable.onBeforeUpdate} */
180
- readonly onBeforeUpdate: Event<unknown>;
181
- /** {@link Disposable.onDisposed} */
182
- readonly onDisposed: Event<unknown>;
183
- /**
184
- * An event that is triggered when a new world is created.
185
- * The event passes the newly created world as a parameter.
186
- */
187
- readonly onWorldCreated: Event<World>;
188
- /**
189
- * An event that is triggered when a world is deleted.
190
- * The event passes the UUID of the deleted world as a parameter.
191
- */
192
- readonly onWorldDeleted: Event<string>;
193
- /**
194
- * A collection of worlds managed by this component.
195
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
196
- */
197
- list: Map<string, World>;
198
- /** {@link Component.enabled} */
199
- enabled: boolean;
200
- constructor(components: Components);
201
- /**
202
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
203
- *
204
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
205
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
206
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
207
- *
208
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
209
- */
210
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
211
- /**
212
- * Deletes a world from the list of worlds.
213
- *
214
- * @param {World} world - The world to be deleted.
215
- *
216
- * @throws {Error} - Throws an error if the provided world is not found in the list.
217
- *
218
- * @returns {void}
219
- */
220
- delete(world: World): void;
221
- /**
222
- * Disposes of the Worlds component and all its managed worlds.
223
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
224
- * and triggers the onDisposed event.
225
- *
226
- * @returns {void}
227
- */
228
- dispose(): void;
229
- /** {@link Updateable.update} */
230
- update(delta?: number): void | Promise<void>;
231
- }
232
- import { Component, Disposable, World, Event } from "../Types";
233
- import { GridConfig, SimpleGrid } from "./src";
234
- import { Components } from "../Components";
235
- /**
236
- * 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).
237
- */
238
- export declare class Grids extends Component implements Disposable {
239
- /**
240
- * A unique identifier for the component.
241
- * This UUID is used to register the component within the Components system.
242
- */
243
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
244
- /**
245
- * A map of world UUIDs to their corresponding grid instances.
246
- */
247
- list: Map<string, SimpleGrid>;
248
- /**
249
- * The default configuration for grid creation.
250
- */
251
- config: Required<GridConfig>;
252
- /** {@link Disposable.onDisposed} */
253
- readonly onDisposed: Event<unknown>;
254
- /** {@link Component.enabled} */
255
- enabled: boolean;
256
- constructor(components: Components);
257
- /**
258
- * Creates a new grid for the given world.
259
- * Throws an error if a grid already exists for the world.
260
- *
261
- * @param world - The world to create the grid for.
262
- * @returns The newly created grid.
263
- *
264
- * @throws Will throw an error if a grid already exists for the given world.
265
- */
266
- create(world: World): SimpleGrid;
267
- /**
268
- * Deletes the grid associated with the given world.
269
- * If a grid does not exist for the given world, this method does nothing.
270
- *
271
- * @param world - The world for which to delete the grid.
272
- *
273
- * @remarks
274
- * This method will dispose of the grid and remove it from the internal list.
275
- * If the world is disposed before calling this method, the grid will be automatically deleted.
276
- */
277
- delete(world: World): void;
278
- /** {@link Disposable.dispose} */
279
- dispose(): void;
280
- }
281
- import * as THREE from "three";
282
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
283
- import { SimplePlane } from "./src";
284
- import { Components } from "../Components";
285
- /**
286
- * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
287
- *
288
- * @param components - the instance of {@link Components} used.
289
- * E.g. {@link SimplePlane}.
290
- */
291
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
292
- /**
293
- * A unique identifier for the component.
294
- * This UUID is used to register the component within the Components system.
295
- */
296
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
297
- /** Event that fires when the user starts dragging a clipping plane. */
298
- readonly onBeforeDrag: Event<void>;
299
- /** Event that fires when the user stops dragging a clipping plane. */
300
- readonly onAfterDrag: Event<void>;
301
- /**
302
- * Event that fires when the user starts creating a clipping plane.
303
- */
304
- readonly onBeforeCreate: Event<unknown>;
305
- /**
306
- * Event that fires when the user cancels the creation of a clipping plane.
307
- */
308
- readonly onBeforeCancel: Event<unknown>;
309
- /**
310
- * Event that fires after the user cancels the creation of a clipping plane.
311
- */
312
- readonly onAfterCancel: Event<unknown>;
313
- /**
314
- * Event that fires when the user starts deleting a clipping plane.
315
- */
316
- readonly onBeforeDelete: Event<unknown>;
317
- /**
318
- * Event that fires after a clipping plane has been created.
319
- * @param plane - The newly created clipping plane.
320
- */
321
- readonly onAfterCreate: Event<SimplePlane>;
322
- /**
323
- * Event that fires after a clipping plane has been deleted.
324
- * @param plane - The deleted clipping plane.
325
- */
326
- readonly onAfterDelete: Event<SimplePlane>;
327
- /** {@link Disposable.onDisposed} */
328
- readonly onDisposed: Event<string>;
329
- /**
330
- * Whether to force the clipping plane to be orthogonal in the Y direction
331
- * (up). This is desirable when clipping a building horizontally and a
332
- * clipping plane is created in its roof, which might have a slight
333
- * slope for draining purposes.
334
- */
335
- orthogonalY: boolean;
336
- /**
337
- * The tolerance that determines whether an almost-horizontal clipping plane
338
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
339
- * has to be 'true' for this to apply.
340
- */
341
- toleranceOrthogonalY: number;
342
- /**
343
- * The type of clipping plane to be created.
344
- * Default is {@link SimplePlane}.
345
- */
346
- Type: new (...args: any) => SimplePlane;
347
- /**
348
- * A list of all the clipping planes created by this component.
349
- */
350
- list: SimplePlane[];
351
- /** The material used in all the clipping planes. */
352
- private _material;
353
- private _size;
354
- private _enabled;
355
- private _visible;
356
- /** {@link Component.enabled} */
357
- get enabled(): boolean;
358
- /** {@link Component.enabled} */
359
- set enabled(state: boolean);
360
- /** {@link Hideable.visible } */
361
- get visible(): boolean;
362
- /** {@link Hideable.visible } */
363
- set visible(state: boolean);
364
- /** The material of the clipping plane representation. */
365
- get material(): THREE.MeshBasicMaterial;
366
- /** The material of the clipping plane representation. */
367
- set material(material: THREE.MeshBasicMaterial);
368
- /** The size of the geometric representation of the clippings planes. */
369
- get size(): number;
370
- /** The size of the geometric representation of the clippings planes. */
371
- set size(size: number);
372
- constructor(components: Components);
373
- /** {@link Disposable.dispose} */
374
- dispose(): void;
375
- /** {@link Createable.create} */
376
- create(world: World): SimplePlane | null;
377
- /**
378
- * Creates a plane in a certain place and with a certain orientation,
379
- * without the need of the mouse.
380
- *
381
- * @param world - the world where this plane should be created.
382
- * @param normal - the orientation of the clipping plane.
383
- * @param point - the position of the clipping plane.
384
- * navigation.
385
- */
386
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
387
- /**
388
- * {@link Createable.delete}
389
- *
390
- * @param world - the world where the plane to delete is.
391
- * @param plane - the plane to delete. If undefined, the first plane
392
- * found under the cursor will be deleted.
393
- */
394
- delete(world: World, plane?: SimplePlane): void;
395
- /**
396
- * Deletes all the existing clipping planes.
397
- *
398
- * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
399
- */
400
- deleteAll(types?: Set<string>): void;
401
- private deletePlane;
402
- private pickPlane;
403
- private getAllPlaneMeshes;
404
- private createPlaneFromIntersection;
405
- private getWorldNormal;
406
- private normalizePlaneDirectionY;
407
- private newPlane;
408
- private updateMaterialsAndPlanes;
409
- private _onStartDragging;
410
- private _onEndDragging;
411
- }
412
- import { Components } from "../Components";
413
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
414
- import { Component, Event, Disposable, World } from "../Types";
415
- /**
416
- * 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).
417
- */
418
- export declare class Cullers extends Component implements Disposable {
419
- /**
420
- * A unique identifier for the component.
421
- * This UUID is used to register the component within the Components system.
422
- */
423
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
424
- /**
425
- * An event that is triggered when the Cullers component is disposed.
426
- */
427
- readonly onDisposed: Event<unknown>;
428
- private _enabled;
429
- /**
430
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
431
- */
432
- list: Map<string, MeshCullerRenderer>;
433
- /** {@link Component.enabled} */
434
- get enabled(): boolean;
435
- /** {@link Component.enabled} */
436
- set enabled(value: boolean);
437
- constructor(components: Components);
438
- /**
439
- * Creates a new MeshCullerRenderer for the given world.
440
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
441
- *
442
- * @param world - The world for which to create the MeshCullerRenderer.
443
- * @param config - Optional configuration settings for the MeshCullerRenderer.
444
- *
445
- * @returns The newly created or existing MeshCullerRenderer for the given world.
446
- */
447
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
448
- /**
449
- * Deletes the MeshCullerRenderer associated with the given world.
450
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
451
- *
452
- * @param world - The world for which to delete the MeshCullerRenderer.
453
- *
454
- * @returns {void}
455
- */
456
- delete(world: World): void;
457
- /** {@link Disposable.dispose} */
458
- dispose(): void;
459
- }
460
- import { MiniMap } from "./src";
461
- import { Component, Updateable, World, Event, Disposable } from "../Types";
462
- import { Components } from "../Components";
463
- /**
464
- * 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).
465
- */
466
- export declare class MiniMaps extends Component implements Updateable, Disposable {
467
- /**
468
- * A unique identifier for the component.
469
- * This UUID is used to register the component within the Components system.
470
- */
471
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
472
- /** {@link Updateable.onAfterUpdate} */
473
- readonly onAfterUpdate: Event<unknown>;
474
- /** {@link Updateable.onBeforeUpdate} */
475
- readonly onBeforeUpdate: Event<unknown>;
476
- /** {@link Disposable.onDisposed} */
477
- readonly onDisposed: Event<unknown>;
478
- /** {@link Component.enabled} */
479
- enabled: boolean;
480
- /**
481
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
482
- */
483
- list: Map<string, MiniMap>;
484
- constructor(components: Components);
485
- /**
486
- * Creates a new {@link MiniMap} instance associated with the given world.
487
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
488
- *
489
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
490
- * @returns The newly created {@link MiniMap} instance.
491
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
492
- */
493
- create(world: World): MiniMap;
494
- /**
495
- * Deletes a {@link MiniMap} instance associated with the given world ID.
496
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
497
- *
498
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
499
- * @returns {void}
500
- */
501
- delete(id: string): void;
502
- /** {@link Disposable.dispose} */
503
- dispose(): void;
504
- /** {@link Updateable.update} */
505
- update(): void;
506
- }
507
- import * as THREE from "three";
508
- import { Components } from "../Components";
509
- import { SimpleCamera } from "..";
510
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
511
- /**
512
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
513
- */
514
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
515
- /**
516
- * A ProjectionManager instance that manages the projection modes of the camera.
517
- */
518
- readonly projection: ProjectionManager;
519
- /**
520
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
521
- * This camera is used when the projection mode is set to orthographic.
522
- */
523
- readonly threeOrtho: THREE.OrthographicCamera;
524
- /**
525
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
526
- * This camera is used when the projection mode is set to perspective.
527
- */
528
- readonly threePersp: THREE.PerspectiveCamera;
529
- protected readonly _userInputButtons: any;
530
- protected readonly _frustumSize = 50;
531
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
532
- protected _mode: NavigationMode | null;
533
- private previousSize;
534
- /**
535
- * Getter for the current navigation mode.
536
- * Throws an error if the mode is not found or the camera is not initialized.
537
- *
538
- * @returns {NavigationMode} The current navigation mode.
539
- *
540
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
541
- */
542
- get mode(): NavigationMode;
543
- constructor(components: Components);
544
- /** {@link Disposable.dispose} */
545
- dispose(): void;
546
- /**
547
- * Sets a new {@link NavigationMode} and disables the previous one.
548
- *
549
- * @param mode - The {@link NavigationMode} to set.
550
- */
551
- set(mode: NavModeID): void;
552
- /**
553
- * Make the camera view fit all the specified meshes.
554
- *
555
- * @param meshes the meshes to fit. If it is not defined, it will
556
- * evaluate {@link Components.meshes}.
557
- * @param offset the distance to the fit object
558
- */
559
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
560
- /**
561
- * Allows or prevents all user input.
562
- *
563
- * @param active - whether to enable or disable user inputs.
564
- */
565
- setUserInput(active: boolean): void;
566
- private disableUserInput;
567
- private enableUserInput;
568
- private newOrthoCamera;
569
- private setOrthoPerspCameraAspect;
570
- }
571
2
  import * as THREE from "three";
572
3
  import * as FRAGS from "@thatopen/fragments";
573
4
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -773,8 +204,58 @@ export declare class BoundingBoxer extends Component implements Disposable {
773
204
  * boundingBoxer.addFragmentIdMap(fragmentIdMap);
774
205
  * '''
775
206
  */
776
- addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
777
- private static getFragmentBounds;
207
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
208
+ private static getFragmentBounds;
209
+ }
210
+ import { Component, Disposable, Event, Components } from "../../core";
211
+ /**
212
+ * 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).
213
+ */
214
+ export declare class Exploder extends Component implements Disposable {
215
+ /**
216
+ * A unique identifier for the component.
217
+ * This UUID is used to register the component within the Components system.
218
+ */
219
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
220
+ /** {@link Disposable.onDisposed} */
221
+ readonly onDisposed: Event<unknown>;
222
+ /** {@link Component.enabled} */
223
+ enabled: boolean;
224
+ /**
225
+ * The height of the explosion animation.
226
+ * This property determines the vertical distance by which fragments are moved during the explosion.
227
+ * Default value is 10.
228
+ */
229
+ height: number;
230
+ /**
231
+ * The group name used for the explosion animation.
232
+ * This property specifies the group of fragments that will be affected by the explosion.
233
+ * Default value is "storeys".
234
+ */
235
+ groupName: string;
236
+ /**
237
+ * A set of strings representing the exploded items.
238
+ * This set is used to keep track of which items have been exploded.
239
+ */
240
+ list: Set<string>;
241
+ constructor(components: Components);
242
+ /** {@link Disposable.dispose} */
243
+ dispose(): void;
244
+ /**
245
+ * Sets the explosion state of the fragments.
246
+ *
247
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
248
+ *
249
+ * @remarks
250
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
251
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
252
+ * If 'active' is false, the fragments are moved back to their original position.
253
+ *
254
+ * The method also keeps track of the exploded items using the 'list' set.
255
+ *
256
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
257
+ */
258
+ set(active: boolean): void;
778
259
  }
779
260
  import * as THREE from "three";
780
261
  import * as FRAGS from "@thatopen/fragments";
@@ -906,7 +387,9 @@ export declare class Classifier extends Component implements Disposable {
906
387
  * Classifies fragments based on their spatial structure in the IFC model.
907
388
  *
908
389
  * @param model - The FragmentsGroup containing the fragments to be classified.
909
- * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
390
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
391
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
392
+ * the classifier just pick the WEBIFC categories provided.
910
393
  *
911
394
  * @remarks
912
395
  * This method iterates through the relations of the fragments in the provided group,
@@ -916,8 +399,9 @@ export declare class Classifier extends Component implements Disposable {
916
399
  *
917
400
  * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
918
401
  */
919
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
920
- useProperties: boolean;
402
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config: {
403
+ useProperties?: boolean;
404
+ isolate?: Set<number>;
921
405
  }): Promise<void>;
922
406
  /**
923
407
  * Sets the color of the specified fragments.
@@ -947,93 +431,271 @@ export declare class Classifier extends Component implements Disposable {
947
431
  resetColor(items: FRAGS.FragmentIdMap): void;
948
432
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
949
433
  }
950
- import { Component, Disposable, Event, Components } from "../../core";
434
+ import * as FRAGS from "@thatopen/fragments";
435
+ import { Components, Component } from "../../core";
951
436
  /**
952
- * 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).
437
+ * 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).
953
438
  */
954
- export declare class Exploder extends Component implements Disposable {
439
+ export declare class Hider extends Component {
955
440
  /**
956
441
  * A unique identifier for the component.
957
442
  * This UUID is used to register the component within the Components system.
958
443
  */
959
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
960
- /** {@link Disposable.onDisposed} */
961
- readonly onDisposed: Event<unknown>;
444
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
962
445
  /** {@link Component.enabled} */
963
446
  enabled: boolean;
447
+ constructor(components: Components);
964
448
  /**
965
- * The height of the explosion animation.
966
- * This property determines the vertical distance by which fragments are moved during the explosion.
967
- * Default value is 10.
449
+ * Sets the visibility of fragments within the 3D scene.
450
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
451
+ * If 'items' is provided, only the specified fragments will be affected.
452
+ *
453
+ * @param visible - The visibility state to set for the fragments.
454
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
455
+ * If not provided, all fragments will be affected.
456
+ *
457
+ * @returns {void}
968
458
  */
969
- height: number;
459
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
970
460
  /**
971
- * The group name used for the explosion animation.
972
- * This property specifies the group of fragments that will be affected by the explosion.
973
- * Default value is "storeys".
461
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
462
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
463
+ *
464
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
465
+ * If not provided, all fragments will be isolated.
466
+ *
467
+ * @returns {void}
974
468
  */
975
- groupName: string;
469
+ isolate(items: FRAGS.FragmentIdMap): void;
470
+ private updateCulledVisibility;
471
+ }
472
+ import * as WEBIFC from "web-ifc";
473
+ import { Components, Disposable, Event, Component } from "../../core";
474
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
475
+ /**
476
+ * 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).
477
+ */
478
+ export declare class IfcGeometryTiler extends Component implements Disposable {
976
479
  /**
977
- * A set of strings representing the exploded items.
978
- * This set is used to keep track of which items have been exploded.
480
+ * A unique identifier for the component.
481
+ * This UUID is used to register the component within the Components system.
979
482
  */
980
- list: Set<string>;
483
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
484
+ /**
485
+ * Event triggered when geometry is streamed.
486
+ * Contains the streamed geometry data and its buffer.
487
+ */
488
+ readonly onGeometryStreamed: Event<{
489
+ buffer: Uint8Array;
490
+ data: StreamedGeometries;
491
+ }>;
492
+ /**
493
+ * Event triggered when assets are streamed.
494
+ * Contains the streamed assets.
495
+ */
496
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
497
+ /**
498
+ * Event triggered to indicate the progress of the streaming process.
499
+ * Contains the progress percentage.
500
+ */
501
+ readonly onProgress: Event<number>;
502
+ /**
503
+ * Event triggered when the IFC file is loaded.
504
+ * Contains the loaded IFC file data.
505
+ */
506
+ readonly onIfcLoaded: Event<Uint8Array>;
507
+ /** {@link Disposable.onDisposed} */
508
+ readonly onDisposed: Event<unknown>;
509
+ /**
510
+ * Settings for the IfcGeometryTiler.
511
+ */
512
+ settings: IfcStreamingSettings;
513
+ /** {@link Component.enabled} */
514
+ enabled: boolean;
515
+ /**
516
+ * The WebIFC API instance used for IFC file processing.
517
+ */
518
+ webIfc: WEBIFC.IfcAPI;
519
+ private _spatialTree;
520
+ private _metaData;
521
+ private _visitedGeometries;
522
+ private _streamSerializer;
523
+ private _geometries;
524
+ private _geometryCount;
525
+ private _civil;
526
+ private _groupSerializer;
527
+ private _assets;
528
+ private _meshesWithHoles;
981
529
  constructor(components: Components);
982
530
  /** {@link Disposable.dispose} */
983
531
  dispose(): void;
984
532
  /**
985
- * Sets the explosion state of the fragments.
533
+ * This method streams the IFC file from a given buffer.
986
534
  *
987
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
535
+ * @param data - The Uint8Array containing the IFC file data.
536
+ * @returns A Promise that resolves when the streaming process is complete.
988
537
  *
989
538
  * @remarks
990
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
991
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
992
- * If 'active' is false, the fragments are moved back to their original position.
539
+ * This method cleans up any resources after the streaming process is complete.
993
540
  *
994
- * The method also keeps track of the exploded items using the 'list' set.
541
+ * @example
542
+ * '''typescript
543
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
544
+ * const rawBuffer = await response.arrayBuffer();
545
+ * const ifcBuffer = new Uint8Array(rawBuffer);
546
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
547
+ * '''
548
+ */
549
+ streamFromBuffer(data: Uint8Array): Promise<void>;
550
+ /**
551
+ * This method streams the IFC file from a given callback.
552
+ *
553
+ * @param loadCallback - The callback function that will be used to load the IFC file.
554
+ * @returns A Promise that resolves when the streaming process is complete.
555
+ *
556
+ * @remarks
557
+ * This method cleans up any resources after the streaming process is complete.
995
558
  *
996
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
997
559
  */
998
- set(active: boolean): void;
560
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
561
+ private readIfcFile;
562
+ private streamIfcFile;
563
+ private streamAllGeometries;
564
+ private cleanUp;
565
+ private getMesh;
566
+ private getGeometry;
567
+ private streamAssets;
568
+ private streamGeometries;
999
569
  }
570
+ import * as THREE from "three";
1000
571
  import * as FRAGS from "@thatopen/fragments";
1001
- import { Components, Component } from "../../core";
572
+ import { Component, Components } from "../../core";
1002
573
  /**
1003
- * 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).
574
+ * Represents an edge measurement result.
1004
575
  */
1005
- export declare class Hider extends Component {
576
+ export interface MeasureEdge {
577
+ /**
578
+ * The distance between the two points of the edge.
579
+ */
580
+ distance: number;
581
+ /**
582
+ * The two points that define the edge.
583
+ */
584
+ points: THREE.Vector3[];
585
+ }
586
+ /**
587
+ * 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).
588
+ */
589
+ export declare class MeasurementUtils extends Component {
1006
590
  /**
1007
591
  * A unique identifier for the component.
1008
592
  * This UUID is used to register the component within the Components system.
1009
593
  */
1010
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
594
+ static uuid: string;
1011
595
  /** {@link Component.enabled} */
1012
596
  enabled: boolean;
1013
597
  constructor(components: Components);
1014
598
  /**
1015
- * Sets the visibility of fragments within the 3D scene.
1016
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1017
- * If 'items' is provided, only the specified fragments will be affected.
599
+ * Utility method to calculate the distance from a point to a line segment.
1018
600
  *
1019
- * @param visible - The visibility state to set for the fragments.
1020
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1021
- * If not provided, all fragments will be affected.
601
+ * @param point - The point from which to calculate the distance.
602
+ * @param lineStart - The start point of the line segment.
603
+ * @param lineEnd - The end point of the line segment.
604
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
605
+ * @returns The distance from the point to the line segment.
606
+ */
607
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
608
+ /**
609
+ * Method to get the face of a mesh that contains a given triangle index.
610
+ * It also returns the edges of the found face and their indices.
1022
611
  *
1023
- * @returns {void}
612
+ * @param mesh - The mesh to get the face from. It must be indexed.
613
+ * @param triangleIndex - The index of the triangle within the mesh.
614
+ * @param instance - The instance of the mesh (optional).
615
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1024
616
  */
1025
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
617
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
618
+ edges: MeasureEdge[];
619
+ indices: Set<number>;
620
+ } | null;
1026
621
  /**
1027
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1028
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
622
+ * Method to get the vertices and normal of a mesh face at a given index.
623
+ * It also applies instance transformation if provided.
1029
624
  *
1030
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1031
- * If not provided, all fragments will be isolated.
625
+ * @param mesh - The mesh to get the face from. It must be indexed.
626
+ * @param faceIndex - The index of the face within the mesh.
627
+ * @param instance - The instance of the mesh (optional).
628
+ * @returns An object containing the vertices and normal of the face.
629
+ * @throws Will throw an error if the geometry is not indexed.
630
+ */
631
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
632
+ p1: THREE.Vector3;
633
+ p2: THREE.Vector3;
634
+ p3: THREE.Vector3;
635
+ faceNormal: THREE.Vector3;
636
+ };
637
+ /**
638
+ * Method to round the vector's components to a specified number of decimal places.
639
+ * This is used to ensure numerical precision in edge detection.
1032
640
  *
1033
- * @returns {void}
641
+ * @param vector - The vector to round.
642
+ * @returns The vector with rounded components.
643
+ */
644
+ round(vector: THREE.Vector3): void;
645
+ /**
646
+ * Calculates the volume of a set of fragments.
647
+ *
648
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
649
+ * @returns The total volume of the fragments and the bounding sphere.
650
+ *
651
+ * @remarks
652
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
653
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
654
+ *
655
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
656
+ * @throws Will throw an error if the fragment manager is not available.
657
+ */
658
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
659
+ /**
660
+ * Calculates the total volume of a set of meshes.
661
+ *
662
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
663
+ * @returns The total volume of the meshes and the bounding sphere.
664
+ *
665
+ * @remarks
666
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
667
+ * and its bounding sphere.
668
+ *
669
+ */
670
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
671
+ private getFaceData;
672
+ private getVolumeOfMesh;
673
+ private getSignedVolumeOfTriangle;
674
+ }
675
+ import * as WEBIFC from "web-ifc";
676
+ import * as FRAG from "@thatopen/fragments";
677
+ import { Component, Components } from "../../core";
678
+ /**
679
+ * 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).
680
+ */
681
+ export declare class IfcJsonExporter extends Component {
682
+ /**
683
+ * A unique identifier for the component.
684
+ * This UUID is used to register the component within the Components system.
1034
685
  */
1035
- isolate(items: FRAGS.FragmentIdMap): void;
1036
- private updateCulledVisibility;
686
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
687
+ /** {@link Component.enabled} */
688
+ enabled: boolean;
689
+ constructor(components: Components);
690
+ /**
691
+ * Exports all the properties of an IFC into an array of JS objects.
692
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
693
+ * @param modelID ID of the IFC model whose properties to extract.
694
+ * @param indirect whether to get the indirect relationships as well.
695
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
696
+ * to make the location data available (e.g. absolute position of building).
697
+ */
698
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1037
699
  }
1038
700
  import * as WEBIFC from "web-ifc";
1039
701
  import * as FRAGS from "@thatopen/fragments";
@@ -1256,965 +918,1262 @@ export declare class FragmentsManager extends Component implements Disposable {
1256
918
  * The first model in the list becomes the base model for coordinate transformation.
1257
919
  * All other models are then transformed to match the base model's coordinate system.
1258
920
  *
1259
- * @param models - The models to apply coordinate transformation to.
1260
- * If not provided, all models are used.
921
+ * @param models - The models to apply coordinate transformation to.
922
+ * If not provided, all models are used.
923
+ */
924
+ coordinate(models?: FragmentsGroup[]): void;
925
+ /**
926
+ * Applies the base coordinate system to the provided object.
927
+ *
928
+ * This function takes an object and its original coordinate system as input.
929
+ * It then inverts the original coordinate system and applies the base coordinate system
930
+ * to the object. This ensures that the object's position, rotation, and scale are
931
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
932
+ *
933
+ * @param object - The object to which the base coordinate system will be applied.
934
+ * This should be an instance of THREE.Object3D.
935
+ *
936
+ * @param originalCoordinateSystem - The original coordinate system of the object.
937
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
938
+ */
939
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
940
+ }
941
+ import * as WEBIFC from "web-ifc";
942
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
943
+ import { PropertiesStreamingSettings } from "./src";
944
+ /**
945
+ * 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).
946
+ */
947
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
948
+ /**
949
+ * A unique identifier for the component.
950
+ * This UUID is used to register the component within the Components system.
951
+ */
952
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
953
+ /**
954
+ * An event that is triggered when properties are streamed from the IFC file.
955
+ * The event provides the type of the IFC entity and the corresponding data.
956
+ */
957
+ readonly onPropertiesStreamed: AsyncEvent<{
958
+ type: number;
959
+ data: {
960
+ [id: number]: any;
961
+ };
962
+ }>;
963
+ /**
964
+ * An event that is triggered to indicate the progress of the streaming process.
965
+ * The event provides a number between 0 and 1 representing the progress percentage.
966
+ */
967
+ readonly onProgress: AsyncEvent<number>;
968
+ /**
969
+ * An event that is triggered when indices are streamed from the IFC file.
970
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
971
+ */
972
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
973
+ /** {@link Disposable.onDisposed} */
974
+ readonly onDisposed: Event<string>;
975
+ /** {@link Component.enabled} */
976
+ enabled: boolean;
977
+ /**
978
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
979
+ */
980
+ settings: PropertiesStreamingSettings;
981
+ /**
982
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
983
+ */
984
+ webIfc: WEBIFC.IfcAPI;
985
+ /** {@link Disposable.dispose} */
986
+ dispose(): Promise<void>;
987
+ /**
988
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
989
+ *
990
+ * @param data - The Uint8Array containing the IFC file data.
991
+ * @returns A Promise that resolves when the streaming process is complete.
992
+ */
993
+ streamFromBuffer(data: Uint8Array): Promise<void>;
994
+ /**
995
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
996
+ *
997
+ * @param loadCallback - A callback function that loads the IFC file data.
998
+ * @returns A Promise that resolves when the streaming process is complete.
999
+ */
1000
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1001
+ private readIfcFile;
1002
+ private streamIfcFile;
1003
+ private streamAllProperties;
1004
+ private cleanUp;
1005
+ }
1006
+ import * as THREE from "three";
1007
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1008
+ center: THREE.Vector3;
1009
+ halfSizes: THREE.Vector3;
1010
+ rotation: THREE.Matrix3;
1011
+ transformation: THREE.Matrix4;
1012
+ };
1013
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1014
+ import * as WEBIFC from "web-ifc";
1015
+ import { FragmentsGroup } from "@thatopen/fragments";
1016
+ import { Component, Disposable, Event, Components } from "../../core";
1017
+ /**
1018
+ * Types for boolean properties in IFC schema.
1019
+ */
1020
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1021
+ /**
1022
+ * Types for string properties in IFC schema.
1023
+ */
1024
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1025
+ /**
1026
+ * Types for numeric properties in IFC schema.
1027
+ */
1028
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
1029
+ /**
1030
+ * 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.
1031
+ */
1032
+ export interface ChangeMap {
1033
+ [modelID: string]: Set<number>;
1034
+ }
1035
+ /**
1036
+ * 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.
1037
+ */
1038
+ export interface AttributeListener {
1039
+ [modelID: string]: {
1040
+ [expressID: number]: {
1041
+ [attributeName: string]: Event<String | Boolean | Number>;
1042
+ };
1043
+ };
1044
+ }
1045
+ /**
1046
+ * Component to manage and edit properties and Psets in IFC files.
1047
+ */
1048
+ export declare class IfcPropertiesManager extends Component implements Disposable {
1049
+ /**
1050
+ * A unique identifier for the component.
1051
+ * This UUID is used to register the component within the Components system.
1052
+ */
1053
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1054
+ /** {@link Disposable.onDisposed} */
1055
+ readonly onDisposed: Event<string>;
1056
+ /**
1057
+ * Event triggered when a file is requested for export.
1058
+ */
1059
+ readonly onRequestFile: Event<unknown>;
1060
+ /**
1061
+ * ArrayBuffer containing the IFC data to be exported.
1062
+ */
1063
+ ifcToExport: ArrayBuffer | null;
1064
+ /**
1065
+ * Event triggered when an element is added to a Pset.
1066
+ */
1067
+ readonly onElementToPset: Event<{
1068
+ model: FragmentsGroup;
1069
+ psetID: number;
1070
+ elementID: number;
1071
+ }>;
1072
+ /**
1073
+ * Event triggered when a property is added to a Pset.
1074
+ */
1075
+ readonly onPropToPset: Event<{
1076
+ model: FragmentsGroup;
1077
+ psetID: number;
1078
+ propID: number;
1079
+ }>;
1080
+ /**
1081
+ * Event triggered when a Pset is removed.
1082
+ */
1083
+ readonly onPsetRemoved: Event<{
1084
+ model: FragmentsGroup;
1085
+ psetID: number;
1086
+ }>;
1087
+ /**
1088
+ * Event triggered when data in the model changes.
1089
+ */
1090
+ readonly onDataChanged: Event<{
1091
+ model: FragmentsGroup;
1092
+ expressID: number;
1093
+ }>;
1094
+ /**
1095
+ * Configuration for the WebAssembly module.
1096
+ */
1097
+ wasm: {
1098
+ path: string;
1099
+ absolute: boolean;
1100
+ };
1101
+ /** {@link Component.enabled} */
1102
+ enabled: boolean;
1103
+ /**
1104
+ * Map of attribute listeners.
1105
+ */
1106
+ attributeListeners: AttributeListener;
1107
+ /**
1108
+ * The currently selected model.
1109
+ */
1110
+ selectedModel?: FragmentsGroup;
1111
+ /**
1112
+ * Map of changed entities in the model.
1113
+ */
1114
+ changeMap: ChangeMap;
1115
+ constructor(components: Components);
1116
+ /** {@link Disposable.dispose} */
1117
+ dispose(): void;
1118
+ /**
1119
+ * Static method to retrieve the IFC schema from a given model.
1120
+ *
1121
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1122
+ * @throws Will throw an error if the IFC schema is not found in the model.
1123
+ * @returns The IFC schema associated with the given model.
1124
+ */
1125
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1126
+ /**
1127
+ * Method to set properties data in the model.
1128
+ *
1129
+ * @param model - The FragmentsGroup model in which to set the properties.
1130
+ * @param dataToSave - An array of objects representing the properties to be saved.
1131
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1132
+ * The rest of the properties will be set as the properties of the entity.
1133
+ *
1134
+ * @returns A promise that resolves when all the properties have been set.
1135
+ *
1136
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1137
+ */
1138
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1139
+ /**
1140
+ * Creates a new Property Set (Pset) in the given model.
1141
+ *
1142
+ * @param model - The FragmentsGroup model in which to create the Pset.
1143
+ * @param name - The name of the Pset.
1144
+ * @param description - (Optional) The description of the Pset.
1145
+ *
1146
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1147
+ *
1148
+ * @throws Will throw an error if the IFC schema is not found in the model.
1149
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1150
+ */
1151
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1152
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1153
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1154
+ }>;
1155
+ /**
1156
+ * Removes a Property Set (Pset) from the given model.
1157
+ *
1158
+ * @param model - The FragmentsGroup model from which to remove the Pset.
1159
+ * @param psetID - The express IDs of the Psets to be removed.
1160
+ *
1161
+ * @returns A promise that resolves when all the Psets have been removed.
1162
+ *
1163
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1164
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1165
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1261
1166
  */
1262
- coordinate(models?: FragmentsGroup[]): void;
1167
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1263
1168
  /**
1264
- * Applies the base coordinate system to the provided object.
1169
+ * Creates a new single-value property of type string in the given model.
1265
1170
  *
1266
- * This function takes an object and its original coordinate system as input.
1267
- * It then inverts the original coordinate system and applies the base coordinate system
1268
- * to the object. This ensures that the object's position, rotation, and scale are
1269
- * transformed to match the base coordinate system (which is taken from the first model loaded).
1171
+ * @param model - The FragmentsGroup model in which to create the property.
1172
+ * @param type - The type of the property value. Must be a string property type.
1173
+ * @param name - The name of the property.
1174
+ * @param value - The value of the property. Must be a string.
1270
1175
  *
1271
- * @param object - The object to which the base coordinate system will be applied.
1272
- * This should be an instance of THREE.Object3D.
1176
+ * @returns The newly created single-value property.
1273
1177
  *
1274
- * @param originalCoordinateSystem - The original coordinate system of the object.
1275
- * This should be a THREE.Matrix4 representing the object's transformation matrix.
1276
- */
1277
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1278
- }
1279
- import * as WEBIFC from "web-ifc";
1280
- import { Components, Disposable, Event, Component } from "../../core";
1281
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1282
- /**
1283
- * 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).
1284
- */
1285
- export declare class IfcGeometryTiler extends Component implements Disposable {
1286
- /**
1287
- * A unique identifier for the component.
1288
- * This UUID is used to register the component within the Components system.
1289
- */
1290
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1291
- /**
1292
- * Event triggered when geometry is streamed.
1293
- * Contains the streamed geometry data and its buffer.
1294
- */
1295
- readonly onGeometryStreamed: Event<{
1296
- buffer: Uint8Array;
1297
- data: StreamedGeometries;
1298
- }>;
1299
- /**
1300
- * Event triggered when assets are streamed.
1301
- * Contains the streamed assets.
1178
+ * @throws Will throw an error if the IFC schema is not found in the model.
1179
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1302
1180
  */
1303
- readonly onAssetStreamed: Event<StreamedAsset[]>;
1181
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1304
1182
  /**
1305
- * Event triggered to indicate the progress of the streaming process.
1306
- * Contains the progress percentage.
1183
+ * Creates a new single-value property of type numeric in the given model.
1184
+ *
1185
+ * @param model - The FragmentsGroup model in which to create the property.
1186
+ * @param type - The type of the property value. Must be a numeric property type.
1187
+ * @param name - The name of the property.
1188
+ * @param value - The value of the property. Must be a number.
1189
+ *
1190
+ * @returns The newly created single-value property.
1191
+ *
1192
+ * @throws Will throw an error if the IFC schema is not found in the model.
1193
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1307
1194
  */
1308
- readonly onProgress: Event<number>;
1195
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1309
1196
  /**
1310
- * Event triggered when the IFC file is loaded.
1311
- * Contains the loaded IFC file data.
1197
+ * Creates a new single-value property of type boolean in the given model.
1198
+ *
1199
+ * @param model - The FragmentsGroup model in which to create the property.
1200
+ * @param type - The type of the property value. Must be a boolean property type.
1201
+ * @param name - The name of the property.
1202
+ * @param value - The value of the property. Must be a boolean.
1203
+ *
1204
+ * @returns The newly created single-value property.
1205
+ *
1206
+ * @throws Will throw an error if the IFC schema is not found in the model.
1207
+ * @throws Will throw an error if no OwnerHistory is found in the model.
1312
1208
  */
1313
- readonly onIfcLoaded: Event<Uint8Array>;
1314
- /** {@link Disposable.onDisposed} */
1315
- readonly onDisposed: Event<unknown>;
1209
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1316
1210
  /**
1317
- * Settings for the IfcGeometryTiler.
1211
+ * Removes a property from a Property Set (Pset) in the given model.
1212
+ *
1213
+ * @param model - The FragmentsGroup model from which to remove the property.
1214
+ * @param psetID - The express ID of the Pset from which to remove the property.
1215
+ * @param propID - The express ID of the property to be removed.
1216
+ *
1217
+ * @returns A promise that resolves when the property has been removed.
1218
+ *
1219
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1220
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1318
1221
  */
1319
- settings: IfcStreamingSettings;
1320
- /** {@link Component.enabled} */
1321
- enabled: boolean;
1222
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1223
+ addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
1322
1224
  /**
1323
- * The WebIFC API instance used for IFC file processing.
1225
+ * Adds elements to a Property Set (Pset) in the given model.
1226
+ *
1227
+ * @param model - The FragmentsGroup model in which to add the elements.
1228
+ * @param psetID - The express ID of the Pset to which to add the elements.
1229
+ * @param elementID - The express IDs of the elements to be added.
1230
+ *
1231
+ * @returns A promise that resolves when all the elements have been added.
1232
+ *
1233
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1234
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1235
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1324
1236
  */
1325
- webIfc: WEBIFC.IfcAPI;
1326
- private _spatialTree;
1327
- private _metaData;
1328
- private _visitedGeometries;
1329
- private _streamSerializer;
1330
- private _geometries;
1331
- private _geometryCount;
1332
- private _civil;
1333
- private _groupSerializer;
1334
- private _assets;
1335
- private _meshesWithHoles;
1336
- constructor(components: Components);
1337
- /** {@link Disposable.dispose} */
1338
- dispose(): void;
1237
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1339
1238
  /**
1340
- * This method streams the IFC file from a given buffer.
1239
+ * Saves the changes made to the model to a new IFC file.
1341
1240
  *
1342
- * @param data - The Uint8Array containing the IFC file data.
1343
- * @returns A Promise that resolves when the streaming process is complete.
1241
+ * @param model - The FragmentsGroup model from which to save the changes.
1242
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1344
1243
  *
1345
- * @remarks
1346
- * This method cleans up any resources after the streaming process is complete.
1244
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1347
1245
  *
1348
- * @example
1349
- * '''typescript
1350
- * const ifcData = await fetch('path/to/ifc/file.ifc');
1351
- * const rawBuffer = await response.arrayBuffer();
1352
- * const ifcBuffer = new Uint8Array(rawBuffer);
1353
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1354
- * '''
1246
+ * @throws Will throw an error if any issues occur during the saving process.
1355
1247
  */
1356
- streamFromBuffer(data: Uint8Array): Promise<void>;
1248
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1357
1249
  /**
1358
- * This method streams the IFC file from a given callback.
1250
+ * Sets an attribute listener for a specific attribute of an entity in the model.
1251
+ * The listener will trigger an event whenever the attribute's value changes.
1359
1252
  *
1360
- * @param loadCallback - The callback function that will be used to load the IFC file.
1361
- * @returns A Promise that resolves when the streaming process is complete.
1253
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
1254
+ * @param expressID - The express ID of the entity for which to set the listener.
1255
+ * @param attributeName - The name of the attribute for which to set the listener.
1362
1256
  *
1363
- * @remarks
1364
- * This method cleans up any resources after the streaming process is complete.
1257
+ * @returns The event that will be triggered when the attribute's value changes.
1365
1258
  *
1259
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
1260
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1261
+ * @throws Will throw an error if the attribute has a badly defined handle.
1366
1262
  */
1367
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1368
- private readIfcFile;
1369
- private streamIfcFile;
1370
- private streamAllGeometries;
1371
- private cleanUp;
1372
- private getMesh;
1373
- private getGeometry;
1374
- private streamAssets;
1375
- private streamGeometries;
1263
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1264
+ private increaseMaxID;
1265
+ private newGUID;
1266
+ private getOwnerHistory;
1267
+ private registerChange;
1268
+ private newSingleProperty;
1376
1269
  }
1377
1270
  import * as WEBIFC from "web-ifc";
1378
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1379
- import { PropertiesStreamingSettings } from "./src";
1271
+ import { FragmentsGroup } from "@thatopen/fragments";
1272
+ import { Disposable, Event, Component, Components } from "../../core";
1273
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1274
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1380
1275
  /**
1381
- * 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).
1276
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1382
1277
  */
1383
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1278
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1384
1279
  /**
1385
1280
  * A unique identifier for the component.
1386
1281
  * This UUID is used to register the component within the Components system.
1387
1282
  */
1388
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1283
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1284
+ /** {@link Disposable.onDisposed} */
1285
+ readonly onDisposed: Event<string>;
1389
1286
  /**
1390
- * An event that is triggered when properties are streamed from the IFC file.
1391
- * The event provides the type of the IFC entity and the corresponding data.
1287
+ * Event triggered when relations for a model have been indexed.
1288
+ * This event provides the model's UUID and the relations map generated for that model.
1289
+ *
1290
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
1291
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1292
+ * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1392
1293
  */
1393
- readonly onPropertiesStreamed: AsyncEvent<{
1394
- type: number;
1395
- data: {
1396
- [id: number]: any;
1397
- };
1294
+ readonly onRelationsIndexed: Event<{
1295
+ modelID: string;
1296
+ relationsMap: RelationsMap;
1398
1297
  }>;
1399
1298
  /**
1400
- * An event that is triggered to indicate the progress of the streaming process.
1401
- * The event provides a number between 0 and 1 representing the progress percentage.
1402
- */
1403
- readonly onProgress: AsyncEvent<number>;
1404
- /**
1405
- * An event that is triggered when indices are streamed from the IFC file.
1406
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1299
+ * Holds the relationship mappings for each model processed by the indexer.
1300
+ * The structure is a map where each key is a model's UUID, and the value is another map.
1301
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1302
+ * representing a specific relation type, and the value is an array of expressIDs of entities
1303
+ * that are related through that relation type. This structure allows for efficient querying
1304
+ * of entity relationships within a model.
1407
1305
  */
1408
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1409
- /** {@link Disposable.onDisposed} */
1410
- readonly onDisposed: Event<string>;
1306
+ readonly relationMaps: ModelsRelationMap;
1411
1307
  /** {@link Component.enabled} */
1412
1308
  enabled: boolean;
1309
+ private _relToAttributesMap;
1310
+ private _inverseAttributes;
1311
+ private _ifcRels;
1312
+ constructor(components: Components);
1313
+ private onFragmentsDisposed;
1314
+ private indexRelations;
1315
+ private getAttributeIndex;
1413
1316
  /**
1414
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1317
+ * Adds a relation map to the model's relations map.
1318
+ *
1319
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1320
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1321
+ *
1322
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1415
1323
  */
1416
- settings: PropertiesStreamingSettings;
1324
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1325
+ /**
1326
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1327
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1328
+ * and maps them in a structured way to facilitate quick access to related entities.
1329
+ *
1330
+ * The process involves querying the model for each relation type associated with the inverse attributes
1331
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1332
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
1333
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1334
+ * of entities that are related through that attribute.
1335
+ *
1336
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1337
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1338
+ * representation of the relations indexed by entity expressIDs and relation types.
1339
+ * @throws An error if the model does not have properties loaded.
1340
+ */
1341
+ process(model: FragmentsGroup): Promise<RelationsMap>;
1417
1342
  /**
1418
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1343
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
1344
+ *
1345
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1346
+ * @param modelID - The unique identifier of the model within the WebIfc API.
1347
+ * @returns A promise that resolves to the relations map for the processed model.
1348
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1419
1349
  */
1420
- webIfc: WEBIFC.IfcAPI;
1421
- /** {@link Disposable.dispose} */
1422
- dispose(): Promise<void>;
1350
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1423
1351
  /**
1424
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1352
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
1353
+ * This method searches the indexed relation maps for the specified model and entity,
1354
+ * returning the IDs of related entities if a match is found.
1425
1355
  *
1426
- * @param data - The Uint8Array containing the IFC file data.
1427
- * @returns A Promise that resolves when the streaming process is complete.
1356
+ * @param model The 'FragmentsGroup' model containing the entity.
1357
+ * @param expressID The unique identifier of the entity within the model.
1358
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1359
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1360
+ * or the specified relation name is not indexed.
1428
1361
  */
1429
- streamFromBuffer(data: Uint8Array): Promise<void>;
1362
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1430
1363
  /**
1431
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1364
+ * Serializes the relations of a given relation map into a JSON string.
1365
+ * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
1366
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1367
+ * The resulting object is then serialized into a JSON string.
1432
1368
  *
1433
- * @param loadCallback - A callback function that loads the IFC file data.
1434
- * @returns A Promise that resolves when the streaming process is complete.
1369
+ * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1370
+ * @returns A JSON string representing the serialized relations of the given relation map.
1435
1371
  */
1436
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1437
- private readIfcFile;
1438
- private streamIfcFile;
1439
- private streamAllProperties;
1440
- private cleanUp;
1441
- }
1442
- import * as THREE from "three";
1443
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1444
- center: THREE.Vector3;
1445
- halfSizes: THREE.Vector3;
1446
- rotation: THREE.Matrix3;
1447
- transformation: THREE.Matrix4;
1448
- };
1449
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1450
- import * as THREE from "three";
1451
- export declare class MaterialsUtils {
1452
- static isTransparent(material: THREE.Material): boolean;
1453
- }
1454
- export declare class UUID {
1455
- private static _pattern;
1456
- private static _lut;
1457
- static create(): string;
1458
- static validate(uuid: string): void;
1459
- }
1460
- import * as WEBIFC from "web-ifc";
1461
- import * as FRAG from "@thatopen/fragments";
1462
- import { Component, Components } from "../../core";
1463
- /**
1464
- * 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).
1465
- */
1466
- export declare class IfcJsonExporter extends Component {
1372
+ serializeRelations(relationMap: RelationsMap): string;
1467
1373
  /**
1468
- * A unique identifier for the component.
1469
- * This UUID is used to register the component within the Components system.
1374
+ * Serializes the relations of a specific model into a JSON string.
1375
+ * This method iterates through the relations indexed for the given model,
1376
+ * organizing them into a structured object where each key is an expressID of an entity,
1377
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1378
+ * The resulting object is then serialized into a JSON string.
1379
+ *
1380
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1381
+ * @returns A JSON string representing the serialized relations of the specified model.
1382
+ * If the model has no indexed relations, 'null' is returned.
1470
1383
  */
1471
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1472
- /** {@link Component.enabled} */
1473
- enabled: boolean;
1474
- constructor(components: Components);
1384
+ serializeModelRelations(model: FragmentsGroup): string | null;
1475
1385
  /**
1476
- * Exports all the properties of an IFC into an array of JS objects.
1477
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1478
- * @param modelID ID of the IFC model whose properties to extract.
1479
- * @param indirect whether to get the indirect relationships as well.
1480
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1481
- * to make the location data available (e.g. absolute position of building).
1386
+ * Serializes all relations of every model processed by the indexer into a JSON string.
1387
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1388
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1389
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
1390
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
1391
+ *
1392
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1393
+ * If no relations have been indexed, an empty object is returned as a JSON string.
1482
1394
  */
1483
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1484
- }
1485
- import * as THREE from "three";
1486
- import { Component, Components, Disposable, Event, World } from "../core";
1487
- /**
1488
- * Configuration interface for the VertexPicker component.
1489
- */
1490
- export interface VertexPickerConfig {
1395
+ serializeAllRelations(): string;
1491
1396
  /**
1492
- * If true, only vertices will be picked, not the closest point on the face.
1397
+ * Converts a JSON string representing relations between entities into a structured map.
1398
+ * This method parses the JSON string to reconstruct the relations map that indexes
1399
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1400
+ * and the values are maps where each key is a relation type ID and its value is an array
1401
+ * of express IDs of entities related through that relation type.
1402
+ *
1403
+ * @param json The JSON string to be parsed into the relations map.
1404
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1405
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1406
+ * is an array of express IDs (as numbers) of entities related through that relation type.
1493
1407
  */
1494
- showOnlyVertex: boolean;
1408
+ getRelationsMapFromJSON(json: string): RelationsMap;
1409
+ /** {@link Disposable.dispose} */
1410
+ dispose(): void;
1495
1411
  /**
1496
- * The maximum distance for snapping to a vertex.
1412
+ * Adds relations between an entity and other entities in a BIM model.
1413
+ *
1414
+ * @param model - The BIM model to which the relations will be added.
1415
+ * @param expressID - The expressID of the entity within the model.
1416
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1417
+ * @param relIDs - The expressIDs of the related entities within the model.
1418
+ *
1419
+ * @throws An error if the relation name is not a valid relation name.
1497
1420
  */
1498
- snapDistance: number;
1421
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1499
1422
  /**
1500
- * The HTML element to use for previewing the picked vertex.
1423
+ * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1424
+ *
1425
+ * @param model The BIM model whose children to get.
1426
+ * @param expressID The expressID of the item whose children to get.
1427
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1428
+ *
1429
+ * @returns A 'Set' with the expressIDs of the found items.
1501
1430
  */
1502
- previewElement: HTMLElement;
1431
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1503
1432
  }
1433
+ import { Component, Disposable, Event } from "../Types";
1504
1434
  /**
1505
- * A class that provides functionality for picking vertices in a 3D scene.
1435
+ * 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.
1506
1436
  */
1507
- export declare class VertexPicker extends Component implements Disposable {
1508
- /** {@link Disposable.onDisposed} */
1509
- readonly onDisposed: Event<unknown>;
1510
- /**
1511
- * An event that is triggered when a vertex is found.
1512
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1513
- */
1514
- readonly onVertexFound: Event<THREE.Vector3>;
1437
+ export declare class Components implements Disposable {
1515
1438
  /**
1516
- * An event that is triggered when a vertex is lost.
1517
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1439
+ * The version of the @thatopen/components library.
1518
1440
  */
1519
- readonly onVertexLost: Event<THREE.Vector3>;
1441
+ static readonly release = "2.1.9";
1442
+ /** {@link Disposable.onDisposed} */
1443
+ readonly onDisposed: Event<void>;
1520
1444
  /**
1521
- * An event that is triggered when the picker is enabled or disabled
1445
+ * The list of components created in this app.
1446
+ * The keys are UUIDs and the values are instances of the components.
1522
1447
  */
1523
- readonly onEnabled: Event<boolean>;
1448
+ readonly list: Map<string, Component>;
1524
1449
  /**
1525
- * A reference to the Components instance associated with this VertexPicker.
1450
+ * If disabled, the animation loop will be stopped.
1451
+ * Default value is false.
1526
1452
  */
1527
- components: Components;
1453
+ enabled: boolean;
1454
+ private _clock;
1528
1455
  /**
1529
- * A reference to the working plane used for vertex picking.
1530
- * This plane is used to determine which vertices are considered valid for picking.
1531
- * If this value is null, all vertices are considered valid.
1456
+ * Adds a component to the list of components.
1457
+ * Throws an error if a component with the same UUID already exists.
1458
+ *
1459
+ * @param uuid - The unique identifier of the component.
1460
+ * @param instance - The instance of the component to be added.
1461
+ *
1462
+ * @throws Will throw an error if a component with the same UUID already exists.
1463
+ *
1464
+ * @internal
1532
1465
  */
1533
- workingPlane: THREE.Plane | null;
1534
- private _pickedPoint;
1535
- private _config;
1536
- private _enabled;
1466
+ add(uuid: string, instance: Component): void;
1537
1467
  /**
1538
- * Sets the enabled state of the VertexPicker.
1539
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1540
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1468
+ * Retrieves a component instance by its constructor function.
1469
+ * If the component does not exist in the list, it will be created and added.
1541
1470
  *
1542
- * @param value - The new enabled state.
1471
+ * @template U - The type of the component to retrieve.
1472
+ * @param Component - The constructor function of the component to retrieve.
1473
+ *
1474
+ * @returns The instance of the requested component.
1475
+ *
1476
+ * @throws Will throw an error if a component with the same UUID already exists.
1477
+ *
1478
+ * @internal
1543
1479
  */
1544
- set enabled(value: boolean);
1480
+ get<U extends Component>(Component: new (components: Components) => U): U;
1481
+ constructor();
1545
1482
  /**
1546
- * Gets the current enabled state of the VertexPicker.
1483
+ * Initializes the Components instance.
1484
+ * This method starts the animation loop, sets the enabled flag to true,
1485
+ * and calls the update method.
1547
1486
  *
1548
- * @returns The current enabled state.
1487
+ * @returns {void}
1549
1488
  */
1550
- get enabled(): boolean;
1489
+ init(): void;
1551
1490
  /**
1552
- * Sets the configuration for the VertexPicker component.
1491
+ * Disposes the memory of all the components and tools of this instance of
1492
+ * the library. A memory leak will be created if:
1553
1493
  *
1554
- * @param value - A Partial object containing the configuration properties to update.
1555
- * The properties not provided in the value object will retain their current values.
1494
+ * - An instance of the library ends up out of scope and this function isn't
1495
+ * called. This is especially relevant in Single Page Applications (React,
1496
+ * Angular, Vue, etc).
1497
+ *
1498
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
1499
+ * referenced by a reference type (object or array).
1500
+ *
1501
+ * You can learn more about how Three.js handles memory leaks
1502
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1556
1503
  *
1557
- * @example
1558
- * '''typescript
1559
- * vertexPicker.config = {
1560
- * snapDistance: 0.5,
1561
- * showOnlyVertex: true,
1562
- * };
1563
- * '''
1564
1504
  */
1565
- set config(value: Partial<VertexPickerConfig>);
1505
+ dispose(): void;
1506
+ private update;
1507
+ private static setupBVH;
1508
+ }
1509
+ import * as THREE from "three";
1510
+ import { Components } from "../Components";
1511
+ import { Component } from "../Types";
1512
+ /**
1513
+ * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1514
+ */
1515
+ export declare class Disposer extends Component {
1516
+ private _disposedComponents;
1517
+ /** {@link Component.enabled} */
1518
+ enabled: boolean;
1519
+ /**
1520
+ * A unique identifier for the component.
1521
+ * This UUID is used to register the component within the Components system.
1522
+ */
1523
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
1524
+ constructor(components: Components);
1525
+ /**
1526
+ * Return the UUIDs of all disposed components.
1527
+ */
1528
+ get(): Set<string>;
1566
1529
  /**
1567
- * Gets the current configuration for the VertexPicker component.
1530
+ * Removes a mesh, its geometry and its materials from memory. If you are
1531
+ * using any of these in other parts of the application, make sure that you
1532
+ * remove them from the mesh before disposing it.
1568
1533
  *
1569
- * @returns A copy of the current VertexPickerConfig object.
1534
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
1535
+ * to remove.
1570
1536
  *
1571
- * @example
1572
- * '''typescript
1573
- * const currentConfig = vertexPicker.config;
1574
- * console.log(currentConfig.snapDistance); // Output: 0.25
1575
- * '''
1537
+ * @param materials - whether to dispose the materials of the mesh.
1538
+ *
1539
+ * @param recursive - whether to recursively dispose the children of the mesh.
1576
1540
  */
1577
- get config(): Partial<VertexPickerConfig>;
1578
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1579
- /** {@link Disposable.dispose} */
1580
- dispose(): void;
1541
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
1581
1542
  /**
1582
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1583
- *
1584
- * @param world - The World instance to use for raycasting.
1585
- *
1586
- * @returns The current picked point, or null if no point is picked.
1543
+ * Disposes a geometry from memory.
1587
1544
  *
1588
- * @remarks
1589
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1590
- * If enabled, it performs raycasting to find the closest intersecting object.
1591
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1592
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1593
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1594
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1545
+ * @param geometry - the
1546
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
1547
+ * to remove.
1595
1548
  */
1596
- get(world: World): THREE.Vector3 | null;
1597
- private getClosestVertex;
1598
- private getVertices;
1599
- private getVertex;
1549
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
1550
+ private disposeGeometryAndMaterials;
1551
+ private disposeChildren;
1552
+ private static disposeMaterial;
1600
1553
  }
1601
- import * as WEBIFC from "web-ifc";
1602
- import { FragmentsGroup } from "@thatopen/fragments";
1603
- import { Disposable, Event, Component, Components } from "../../core";
1604
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1605
- export type { InverseAttribute, RelationsMap } from "./src/types";
1554
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
1555
+ import { Components } from "../Components";
1556
+ import { SimpleWorld } from "./src";
1606
1557
  /**
1607
- * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1558
+ * 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).
1608
1559
  */
1609
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1560
+ export declare class Worlds extends Component implements Updateable, Disposable {
1610
1561
  /**
1611
1562
  * A unique identifier for the component.
1612
1563
  * This UUID is used to register the component within the Components system.
1613
1564
  */
1614
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1565
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
1566
+ /** {@link Updateable.onAfterUpdate} */
1567
+ readonly onAfterUpdate: Event<unknown>;
1568
+ /** {@link Updateable.onBeforeUpdate} */
1569
+ readonly onBeforeUpdate: Event<unknown>;
1615
1570
  /** {@link Disposable.onDisposed} */
1616
- readonly onDisposed: Event<string>;
1571
+ readonly onDisposed: Event<unknown>;
1617
1572
  /**
1618
- * Event triggered when relations for a model have been indexed.
1619
- * This event provides the model's UUID and the relations map generated for that model.
1620
- *
1621
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1622
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1623
- * The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1573
+ * An event that is triggered when a new world is created.
1574
+ * The event passes the newly created world as a parameter.
1624
1575
  */
1625
- readonly onRelationsIndexed: Event<{
1626
- modelID: string;
1627
- relationsMap: RelationsMap;
1628
- }>;
1576
+ readonly onWorldCreated: Event<World>;
1629
1577
  /**
1630
- * Holds the relationship mappings for each model processed by the indexer.
1631
- * The structure is a map where each key is a model's UUID, and the value is another map.
1632
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1633
- * representing a specific relation type, and the value is an array of expressIDs of entities
1634
- * that are related through that relation type. This structure allows for efficient querying
1635
- * of entity relationships within a model.
1578
+ * An event that is triggered when a world is deleted.
1579
+ * The event passes the UUID of the deleted world as a parameter.
1636
1580
  */
1637
- readonly relationMaps: ModelsRelationMap;
1581
+ readonly onWorldDeleted: Event<string>;
1582
+ /**
1583
+ * A collection of worlds managed by this component.
1584
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
1585
+ */
1586
+ list: Map<string, World>;
1638
1587
  /** {@link Component.enabled} */
1639
1588
  enabled: boolean;
1640
- private _relToAttributesMap;
1641
- private _inverseAttributes;
1642
- private _ifcRels;
1643
1589
  constructor(components: Components);
1644
- private onFragmentsDisposed;
1645
- private indexRelations;
1646
- private getAttributeIndex;
1647
1590
  /**
1648
- * Adds a relation map to the model's relations map.
1591
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
1649
1592
  *
1650
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1651
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1593
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
1594
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
1595
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
1652
1596
  *
1653
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1597
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
1654
1598
  */
1655
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1599
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
1656
1600
  /**
1657
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1658
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1659
- * and maps them in a structured way to facilitate quick access to related entities.
1601
+ * Deletes a world from the list of worlds.
1660
1602
  *
1661
- * The process involves querying the model for each relation type associated with the inverse attributes
1662
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1663
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1664
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1665
- * of entities that are related through that attribute.
1603
+ * @param {World} world - The world to be deleted.
1666
1604
  *
1667
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1668
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1669
- * representation of the relations indexed by entity expressIDs and relation types.
1670
- * @throws An error if the model does not have properties loaded.
1605
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
1606
+ *
1607
+ * @returns {void}
1671
1608
  */
1672
- process(model: FragmentsGroup): Promise<RelationsMap>;
1609
+ delete(world: World): void;
1673
1610
  /**
1674
- * Processes a given model from a WebIfc API to index its IFC entities relations.
1611
+ * Disposes of the Worlds component and all its managed worlds.
1612
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
1613
+ * and triggers the onDisposed event.
1675
1614
  *
1676
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1677
- * @param modelID - The unique identifier of the model within the WebIfc API.
1678
- * @returns A promise that resolves to the relations map for the processed model.
1679
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1615
+ * @returns {void}
1680
1616
  */
1681
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1617
+ dispose(): void;
1618
+ /** {@link Updateable.update} */
1619
+ update(delta?: number): void | Promise<void>;
1620
+ }
1621
+ import { Component, Disposable, World, Event } from "../Types";
1622
+ import { GridConfig, SimpleGrid } from "./src";
1623
+ import { Components } from "../Components";
1624
+ /**
1625
+ * 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).
1626
+ */
1627
+ export declare class Grids extends Component implements Disposable {
1682
1628
  /**
1683
- * Retrieves the relations of a specific entity within a model based on the given relation name.
1684
- * This method searches the indexed relation maps for the specified model and entity,
1685
- * returning the IDs of related entities if a match is found.
1686
- *
1687
- * @param model The 'FragmentsGroup' model containing the entity.
1688
- * @param expressID The unique identifier of the entity within the model.
1689
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1690
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1691
- * or the specified relation name is not indexed.
1629
+ * A unique identifier for the component.
1630
+ * This UUID is used to register the component within the Components system.
1692
1631
  */
1693
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1632
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
1694
1633
  /**
1695
- * Serializes the relations of a given relation map into a JSON string.
1696
- * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
1697
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1698
- * The resulting object is then serialized into a JSON string.
1699
- *
1700
- * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
1701
- * @returns A JSON string representing the serialized relations of the given relation map.
1634
+ * A map of world UUIDs to their corresponding grid instances.
1702
1635
  */
1703
- serializeRelations(relationMap: RelationsMap): string;
1636
+ list: Map<string, SimpleGrid>;
1704
1637
  /**
1705
- * Serializes the relations of a specific model into a JSON string.
1706
- * This method iterates through the relations indexed for the given model,
1707
- * organizing them into a structured object where each key is an expressID of an entity,
1708
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1709
- * The resulting object is then serialized into a JSON string.
1710
- *
1711
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1712
- * @returns A JSON string representing the serialized relations of the specified model.
1713
- * If the model has no indexed relations, 'null' is returned.
1638
+ * The default configuration for grid creation.
1714
1639
  */
1715
- serializeModelRelations(model: FragmentsGroup): string | null;
1640
+ config: Required<GridConfig>;
1641
+ /** {@link Disposable.onDisposed} */
1642
+ readonly onDisposed: Event<unknown>;
1643
+ /** {@link Component.enabled} */
1644
+ enabled: boolean;
1645
+ constructor(components: Components);
1716
1646
  /**
1717
- * Serializes all relations of every model processed by the indexer into a JSON string.
1718
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1719
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1720
- * and its value is another object mapping entity expressIDs to their related entities, categorized
1721
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1647
+ * Creates a new grid for the given world.
1648
+ * Throws an error if a grid already exists for the world.
1722
1649
  *
1723
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1724
- * If no relations have been indexed, an empty object is returned as a JSON string.
1650
+ * @param world - The world to create the grid for.
1651
+ * @returns The newly created grid.
1652
+ *
1653
+ * @throws Will throw an error if a grid already exists for the given world.
1725
1654
  */
1726
- serializeAllRelations(): string;
1655
+ create(world: World): SimpleGrid;
1727
1656
  /**
1728
- * Converts a JSON string representing relations between entities into a structured map.
1729
- * This method parses the JSON string to reconstruct the relations map that indexes
1730
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1731
- * and the values are maps where each key is a relation type ID and its value is an array
1732
- * of express IDs of entities related through that relation type.
1657
+ * Deletes the grid associated with the given world.
1658
+ * If a grid does not exist for the given world, this method does nothing.
1733
1659
  *
1734
- * @param json The JSON string to be parsed into the relations map.
1735
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1736
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1737
- * is an array of express IDs (as numbers) of entities related through that relation type.
1660
+ * @param world - The world for which to delete the grid.
1661
+ *
1662
+ * @remarks
1663
+ * This method will dispose of the grid and remove it from the internal list.
1664
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
1738
1665
  */
1739
- getRelationsMapFromJSON(json: string): RelationsMap;
1666
+ delete(world: World): void;
1740
1667
  /** {@link Disposable.dispose} */
1741
1668
  dispose(): void;
1669
+ }
1670
+ import { Component, Disposable, World, Event } from "../Types";
1671
+ import { SimpleRaycaster } from "./src";
1672
+ import { Components } from "../Components";
1673
+ /**
1674
+ * 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).
1675
+ */
1676
+ export declare class Raycasters extends Component implements Disposable {
1742
1677
  /**
1743
- * Adds relations between an entity and other entities in a BIM model.
1744
- *
1745
- * @param model - The BIM model to which the relations will be added.
1746
- * @param expressID - The expressID of the entity within the model.
1747
- * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1748
- * @param relIDs - The expressIDs of the related entities within the model.
1678
+ * A unique identifier for the component.
1679
+ * This UUID is used to register the component within the Components system.
1680
+ */
1681
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
1682
+ /** {@link Component.enabled} */
1683
+ enabled: boolean;
1684
+ /**
1685
+ * A Map that stores raycasters for each world.
1686
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
1687
+ */
1688
+ list: Map<string, SimpleRaycaster>;
1689
+ /** {@link Disposable.onDisposed} */
1690
+ onDisposed: Event<unknown>;
1691
+ constructor(components: Components);
1692
+ /**
1693
+ * Retrieves a SimpleRaycaster instance for the given world.
1694
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
1695
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
1749
1696
  *
1750
- * @throws An error if the relation name is not a valid relation name.
1697
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
1698
+ * @returns The SimpleRaycaster instance for the given world.
1751
1699
  */
1752
- addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1700
+ get(world: World): SimpleRaycaster;
1753
1701
  /**
1754
- * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1755
- *
1756
- * @param model The BIM model whose children to get.
1757
- * @param expressID The expressID of the item whose children to get.
1758
- * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1702
+ * Deletes the SimpleRaycaster instance associated with the given world.
1703
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
1759
1704
  *
1760
- * @returns A 'Set' with the expressIDs of the found items.
1705
+ * @param world - The world for which to delete the SimpleRaycaster instance.
1706
+ * @returns {void}
1761
1707
  */
1762
- getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1763
- }
1764
- import * as WEBIFC from "web-ifc";
1765
- import { FragmentsGroup } from "@thatopen/fragments";
1766
- import { Component, Disposable, Event, Components } from "../../core";
1767
- /**
1768
- * Types for boolean properties in IFC schema.
1769
- */
1770
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1771
- /**
1772
- * Types for string properties in IFC schema.
1773
- */
1774
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1775
- /**
1776
- * Types for numeric properties in IFC schema.
1777
- */
1778
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
1779
- /**
1780
- * 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.
1781
- */
1782
- export interface ChangeMap {
1783
- [modelID: string]: Set<number>;
1784
- }
1785
- /**
1786
- * 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.
1787
- */
1788
- export interface AttributeListener {
1789
- [modelID: string]: {
1790
- [expressID: number]: {
1791
- [attributeName: string]: Event<String | Boolean | Number>;
1792
- };
1793
- };
1708
+ delete(world: World): void;
1709
+ /** {@link Disposable.dispose} */
1710
+ dispose(): void;
1794
1711
  }
1712
+ import * as THREE from "three";
1713
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
1714
+ import { SimplePlane } from "./src";
1715
+ import { Components } from "../Components";
1795
1716
  /**
1796
- * Component to manage and edit properties and Psets in IFC files.
1717
+ * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
1718
+ *
1719
+ * @param components - the instance of {@link Components} used.
1720
+ * E.g. {@link SimplePlane}.
1797
1721
  */
1798
- export declare class IfcPropertiesManager extends Component implements Disposable {
1722
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
1799
1723
  /**
1800
1724
  * A unique identifier for the component.
1801
1725
  * This UUID is used to register the component within the Components system.
1802
1726
  */
1803
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1804
- /** {@link Disposable.onDisposed} */
1805
- readonly onDisposed: Event<string>;
1727
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
1728
+ /** Event that fires when the user starts dragging a clipping plane. */
1729
+ readonly onBeforeDrag: Event<void>;
1730
+ /** Event that fires when the user stops dragging a clipping plane. */
1731
+ readonly onAfterDrag: Event<void>;
1806
1732
  /**
1807
- * Event triggered when a file is requested for export.
1733
+ * Event that fires when the user starts creating a clipping plane.
1808
1734
  */
1809
- readonly onRequestFile: Event<unknown>;
1735
+ readonly onBeforeCreate: Event<unknown>;
1810
1736
  /**
1811
- * ArrayBuffer containing the IFC data to be exported.
1737
+ * Event that fires when the user cancels the creation of a clipping plane.
1812
1738
  */
1813
- ifcToExport: ArrayBuffer | null;
1739
+ readonly onBeforeCancel: Event<unknown>;
1814
1740
  /**
1815
- * Event triggered when an element is added to a Pset.
1741
+ * Event that fires after the user cancels the creation of a clipping plane.
1816
1742
  */
1817
- readonly onElementToPset: Event<{
1818
- model: FragmentsGroup;
1819
- psetID: number;
1820
- elementID: number;
1821
- }>;
1743
+ readonly onAfterCancel: Event<unknown>;
1822
1744
  /**
1823
- * Event triggered when a property is added to a Pset.
1745
+ * Event that fires when the user starts deleting a clipping plane.
1824
1746
  */
1825
- readonly onPropToPset: Event<{
1826
- model: FragmentsGroup;
1827
- psetID: number;
1828
- propID: number;
1829
- }>;
1747
+ readonly onBeforeDelete: Event<unknown>;
1830
1748
  /**
1831
- * Event triggered when a Pset is removed.
1749
+ * Event that fires after a clipping plane has been created.
1750
+ * @param plane - The newly created clipping plane.
1832
1751
  */
1833
- readonly onPsetRemoved: Event<{
1834
- model: FragmentsGroup;
1835
- psetID: number;
1836
- }>;
1752
+ readonly onAfterCreate: Event<SimplePlane>;
1837
1753
  /**
1838
- * Event triggered when data in the model changes.
1754
+ * Event that fires after a clipping plane has been deleted.
1755
+ * @param plane - The deleted clipping plane.
1839
1756
  */
1840
- readonly onDataChanged: Event<{
1841
- model: FragmentsGroup;
1842
- expressID: number;
1843
- }>;
1757
+ readonly onAfterDelete: Event<SimplePlane>;
1758
+ /** {@link Disposable.onDisposed} */
1759
+ readonly onDisposed: Event<string>;
1844
1760
  /**
1845
- * Configuration for the WebAssembly module.
1761
+ * Whether to force the clipping plane to be orthogonal in the Y direction
1762
+ * (up). This is desirable when clipping a building horizontally and a
1763
+ * clipping plane is created in its roof, which might have a slight
1764
+ * slope for draining purposes.
1846
1765
  */
1847
- wasm: {
1848
- path: string;
1849
- absolute: boolean;
1850
- };
1851
- /** {@link Component.enabled} */
1852
- enabled: boolean;
1766
+ orthogonalY: boolean;
1853
1767
  /**
1854
- * Map of attribute listeners.
1768
+ * The tolerance that determines whether an almost-horizontal clipping plane
1769
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
1770
+ * has to be 'true' for this to apply.
1855
1771
  */
1856
- attributeListeners: AttributeListener;
1772
+ toleranceOrthogonalY: number;
1857
1773
  /**
1858
- * The currently selected model.
1774
+ * The type of clipping plane to be created.
1775
+ * Default is {@link SimplePlane}.
1859
1776
  */
1860
- selectedModel?: FragmentsGroup;
1777
+ Type: new (...args: any) => SimplePlane;
1861
1778
  /**
1862
- * Map of changed entities in the model.
1779
+ * A list of all the clipping planes created by this component.
1863
1780
  */
1864
- changeMap: ChangeMap;
1781
+ list: SimplePlane[];
1782
+ /** The material used in all the clipping planes. */
1783
+ private _material;
1784
+ private _size;
1785
+ private _enabled;
1786
+ private _visible;
1787
+ /** {@link Component.enabled} */
1788
+ get enabled(): boolean;
1789
+ /** {@link Component.enabled} */
1790
+ set enabled(state: boolean);
1791
+ /** {@link Hideable.visible } */
1792
+ get visible(): boolean;
1793
+ /** {@link Hideable.visible } */
1794
+ set visible(state: boolean);
1795
+ /** The material of the clipping plane representation. */
1796
+ get material(): THREE.MeshBasicMaterial;
1797
+ /** The material of the clipping plane representation. */
1798
+ set material(material: THREE.MeshBasicMaterial);
1799
+ /** The size of the geometric representation of the clippings planes. */
1800
+ get size(): number;
1801
+ /** The size of the geometric representation of the clippings planes. */
1802
+ set size(size: number);
1865
1803
  constructor(components: Components);
1866
1804
  /** {@link Disposable.dispose} */
1867
1805
  dispose(): void;
1806
+ /** {@link Createable.create} */
1807
+ create(world: World): SimplePlane | null;
1868
1808
  /**
1869
- * Static method to retrieve the IFC schema from a given model.
1809
+ * Creates a plane in a certain place and with a certain orientation,
1810
+ * without the need of the mouse.
1870
1811
  *
1871
- * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1872
- * @throws Will throw an error if the IFC schema is not found in the model.
1873
- * @returns The IFC schema associated with the given model.
1812
+ * @param world - the world where this plane should be created.
1813
+ * @param normal - the orientation of the clipping plane.
1814
+ * @param point - the position of the clipping plane.
1815
+ * navigation.
1874
1816
  */
1875
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1817
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
1876
1818
  /**
1877
- * Method to set properties data in the model.
1878
- *
1879
- * @param model - The FragmentsGroup model in which to set the properties.
1880
- * @param dataToSave - An array of objects representing the properties to be saved.
1881
- * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1882
- * The rest of the properties will be set as the properties of the entity.
1883
- *
1884
- * @returns A promise that resolves when all the properties have been set.
1819
+ * {@link Createable.delete}
1885
1820
  *
1886
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1821
+ * @param world - the world where the plane to delete is.
1822
+ * @param plane - the plane to delete. If undefined, the first plane
1823
+ * found under the cursor will be deleted.
1887
1824
  */
1888
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1825
+ delete(world: World, plane?: SimplePlane): void;
1889
1826
  /**
1890
- * Creates a new Property Set (Pset) in the given model.
1891
- *
1892
- * @param model - The FragmentsGroup model in which to create the Pset.
1893
- * @param name - The name of the Pset.
1894
- * @param description - (Optional) The description of the Pset.
1895
- *
1896
- * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1827
+ * Deletes all the existing clipping planes.
1897
1828
  *
1898
- * @throws Will throw an error if the IFC schema is not found in the model.
1899
- * @throws Will throw an error if no OwnerHistory is found in the model.
1829
+ * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
1900
1830
  */
1901
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1902
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1903
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1904
- }>;
1831
+ deleteAll(types?: Set<string>): void;
1832
+ private deletePlane;
1833
+ private pickPlane;
1834
+ private getAllPlaneMeshes;
1835
+ private createPlaneFromIntersection;
1836
+ private getWorldNormal;
1837
+ private normalizePlaneDirectionY;
1838
+ private newPlane;
1839
+ private updateMaterialsAndPlanes;
1840
+ private _onStartDragging;
1841
+ private _onEndDragging;
1842
+ }
1843
+ import { MiniMap } from "./src";
1844
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
1845
+ import { Components } from "../Components";
1846
+ /**
1847
+ * 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).
1848
+ */
1849
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
1905
1850
  /**
1906
- * Removes a Property Set (Pset) from the given model.
1907
- *
1908
- * @param model - The FragmentsGroup model from which to remove the Pset.
1909
- * @param psetID - The express IDs of the Psets to be removed.
1910
- *
1911
- * @returns A promise that resolves when all the Psets have been removed.
1912
- *
1913
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1914
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1915
- * @throws Will throw an error if no relation is found between the Pset and the model.
1851
+ * A unique identifier for the component.
1852
+ * This UUID is used to register the component within the Components system.
1916
1853
  */
1917
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1854
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
1855
+ /** {@link Updateable.onAfterUpdate} */
1856
+ readonly onAfterUpdate: Event<unknown>;
1857
+ /** {@link Updateable.onBeforeUpdate} */
1858
+ readonly onBeforeUpdate: Event<unknown>;
1859
+ /** {@link Disposable.onDisposed} */
1860
+ readonly onDisposed: Event<unknown>;
1861
+ /** {@link Component.enabled} */
1862
+ enabled: boolean;
1918
1863
  /**
1919
- * Creates a new single-value property of type string in the given model.
1920
- *
1921
- * @param model - The FragmentsGroup model in which to create the property.
1922
- * @param type - The type of the property value. Must be a string property type.
1923
- * @param name - The name of the property.
1924
- * @param value - The value of the property. Must be a string.
1925
- *
1926
- * @returns The newly created single-value property.
1864
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
1865
+ */
1866
+ list: Map<string, MiniMap>;
1867
+ constructor(components: Components);
1868
+ /**
1869
+ * Creates a new {@link MiniMap} instance associated with the given world.
1870
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
1927
1871
  *
1928
- * @throws Will throw an error if the IFC schema is not found in the model.
1929
- * @throws Will throw an error if no OwnerHistory is found in the model.
1872
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
1873
+ * @returns The newly created {@link MiniMap} instance.
1874
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
1930
1875
  */
1931
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1876
+ create(world: World): MiniMap;
1932
1877
  /**
1933
- * Creates a new single-value property of type numeric in the given model.
1934
- *
1935
- * @param model - The FragmentsGroup model in which to create the property.
1936
- * @param type - The type of the property value. Must be a numeric property type.
1937
- * @param name - The name of the property.
1938
- * @param value - The value of the property. Must be a number.
1939
- *
1940
- * @returns The newly created single-value property.
1878
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
1879
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
1941
1880
  *
1942
- * @throws Will throw an error if the IFC schema is not found in the model.
1943
- * @throws Will throw an error if no OwnerHistory is found in the model.
1881
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
1882
+ * @returns {void}
1944
1883
  */
1945
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1884
+ delete(id: string): void;
1885
+ /** {@link Disposable.dispose} */
1886
+ dispose(): void;
1887
+ /** {@link Updateable.update} */
1888
+ update(): void;
1889
+ }
1890
+ import * as THREE from "three";
1891
+ export declare class MaterialsUtils {
1892
+ static isTransparent(material: THREE.Material): boolean;
1893
+ }
1894
+ import { Components } from "../Components";
1895
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
1896
+ import { Component, Event, Disposable, World } from "../Types";
1897
+ /**
1898
+ * 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).
1899
+ */
1900
+ export declare class Cullers extends Component implements Disposable {
1946
1901
  /**
1947
- * Creates a new single-value property of type boolean in the given model.
1948
- *
1949
- * @param model - The FragmentsGroup model in which to create the property.
1950
- * @param type - The type of the property value. Must be a boolean property type.
1951
- * @param name - The name of the property.
1952
- * @param value - The value of the property. Must be a boolean.
1953
- *
1954
- * @returns The newly created single-value property.
1955
- *
1956
- * @throws Will throw an error if the IFC schema is not found in the model.
1957
- * @throws Will throw an error if no OwnerHistory is found in the model.
1902
+ * A unique identifier for the component.
1903
+ * This UUID is used to register the component within the Components system.
1958
1904
  */
1959
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1905
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
1960
1906
  /**
1961
- * Removes a property from a Property Set (Pset) in the given model.
1962
- *
1963
- * @param model - The FragmentsGroup model from which to remove the property.
1964
- * @param psetID - The express ID of the Pset from which to remove the property.
1965
- * @param propID - The express ID of the property to be removed.
1966
- *
1967
- * @returns A promise that resolves when the property has been removed.
1968
- *
1969
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1970
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1907
+ * An event that is triggered when the Cullers component is disposed.
1971
1908
  */
1972
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1973
- addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
1909
+ readonly onDisposed: Event<unknown>;
1910
+ private _enabled;
1974
1911
  /**
1975
- * Adds elements to a Property Set (Pset) in the given model.
1976
- *
1977
- * @param model - The FragmentsGroup model in which to add the elements.
1978
- * @param psetID - The express ID of the Pset to which to add the elements.
1979
- * @param elementID - The express IDs of the elements to be added.
1980
- *
1981
- * @returns A promise that resolves when all the elements have been added.
1982
- *
1983
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1984
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1985
- * @throws Will throw an error if no relation is found between the Pset and the model.
1912
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
1986
1913
  */
1987
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1914
+ list: Map<string, MeshCullerRenderer>;
1915
+ /** {@link Component.enabled} */
1916
+ get enabled(): boolean;
1917
+ /** {@link Component.enabled} */
1918
+ set enabled(value: boolean);
1919
+ constructor(components: Components);
1988
1920
  /**
1989
- * Saves the changes made to the model to a new IFC file.
1990
- *
1991
- * @param model - The FragmentsGroup model from which to save the changes.
1992
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1921
+ * Creates a new MeshCullerRenderer for the given world.
1922
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
1993
1923
  *
1994
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1924
+ * @param world - The world for which to create the MeshCullerRenderer.
1925
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
1995
1926
  *
1996
- * @throws Will throw an error if any issues occur during the saving process.
1927
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
1997
1928
  */
1998
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1929
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
1999
1930
  /**
2000
- * Sets an attribute listener for a specific attribute of an entity in the model.
2001
- * The listener will trigger an event whenever the attribute's value changes.
2002
- *
2003
- * @param model - The FragmentsGroup model in which to set the attribute listener.
2004
- * @param expressID - The express ID of the entity for which to set the listener.
2005
- * @param attributeName - The name of the attribute for which to set the listener.
1931
+ * Deletes the MeshCullerRenderer associated with the given world.
1932
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
2006
1933
  *
2007
- * @returns The event that will be triggered when the attribute's value changes.
1934
+ * @param world - The world for which to delete the MeshCullerRenderer.
2008
1935
  *
2009
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
2010
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
2011
- * @throws Will throw an error if the attribute has a badly defined handle.
1936
+ * @returns {void}
2012
1937
  */
2013
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
2014
- private increaseMaxID;
2015
- private newGUID;
2016
- private getOwnerHistory;
2017
- private registerChange;
2018
- private newSingleProperty;
1938
+ delete(world: World): void;
1939
+ /** {@link Disposable.dispose} */
1940
+ dispose(): void;
2019
1941
  }
2020
1942
  import * as THREE from "three";
2021
- import * as FRAGS from "@thatopen/fragments";
2022
- import { Component, Components } from "../../core";
1943
+ import { Components } from "../Components";
1944
+ import { SimpleCamera } from "..";
1945
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
2023
1946
  /**
2024
- * Represents an edge measurement result.
1947
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
2025
1948
  */
2026
- export interface MeasureEdge {
1949
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
2027
1950
  /**
2028
- * The distance between the two points of the edge.
1951
+ * A ProjectionManager instance that manages the projection modes of the camera.
2029
1952
  */
2030
- distance: number;
1953
+ readonly projection: ProjectionManager;
2031
1954
  /**
2032
- * The two points that define the edge.
1955
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
1956
+ * This camera is used when the projection mode is set to orthographic.
2033
1957
  */
2034
- points: THREE.Vector3[];
2035
- }
2036
- /**
2037
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
2038
- */
2039
- export declare class MeasurementUtils extends Component {
1958
+ readonly threeOrtho: THREE.OrthographicCamera;
2040
1959
  /**
2041
- * A unique identifier for the component.
2042
- * This UUID is used to register the component within the Components system.
1960
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
1961
+ * This camera is used when the projection mode is set to perspective.
2043
1962
  */
2044
- static uuid: string;
2045
- /** {@link Component.enabled} */
2046
- enabled: boolean;
2047
- constructor(components: Components);
1963
+ readonly threePersp: THREE.PerspectiveCamera;
1964
+ protected readonly _userInputButtons: any;
1965
+ protected readonly _frustumSize = 50;
1966
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
1967
+ protected _mode: NavigationMode | null;
1968
+ private previousSize;
2048
1969
  /**
2049
- * Utility method to calculate the distance from a point to a line segment.
1970
+ * Getter for the current navigation mode.
1971
+ * Throws an error if the mode is not found or the camera is not initialized.
2050
1972
  *
2051
- * @param point - The point from which to calculate the distance.
2052
- * @param lineStart - The start point of the line segment.
2053
- * @param lineEnd - The end point of the line segment.
2054
- * @param clamp - If true, the distance will be clamped to the line segment's length.
2055
- * @returns The distance from the point to the line segment.
2056
- */
2057
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2058
- /**
2059
- * Method to get the face of a mesh that contains a given triangle index.
2060
- * It also returns the edges of the found face and their indices.
1973
+ * @returns {NavigationMode} The current navigation mode.
2061
1974
  *
2062
- * @param mesh - The mesh to get the face from. It must be indexed.
2063
- * @param triangleIndex - The index of the triangle within the mesh.
2064
- * @param instance - The instance of the mesh (optional).
2065
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1975
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
2066
1976
  */
2067
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2068
- edges: MeasureEdge[];
2069
- indices: Set<number>;
2070
- } | null;
1977
+ get mode(): NavigationMode;
1978
+ constructor(components: Components);
1979
+ /** {@link Disposable.dispose} */
1980
+ dispose(): void;
2071
1981
  /**
2072
- * Method to get the vertices and normal of a mesh face at a given index.
2073
- * It also applies instance transformation if provided.
1982
+ * Sets a new {@link NavigationMode} and disables the previous one.
2074
1983
  *
2075
- * @param mesh - The mesh to get the face from. It must be indexed.
2076
- * @param faceIndex - The index of the face within the mesh.
2077
- * @param instance - The instance of the mesh (optional).
2078
- * @returns An object containing the vertices and normal of the face.
2079
- * @throws Will throw an error if the geometry is not indexed.
1984
+ * @param mode - The {@link NavigationMode} to set.
2080
1985
  */
2081
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2082
- p1: THREE.Vector3;
2083
- p2: THREE.Vector3;
2084
- p3: THREE.Vector3;
2085
- faceNormal: THREE.Vector3;
2086
- };
1986
+ set(mode: NavModeID): void;
2087
1987
  /**
2088
- * Method to round the vector's components to a specified number of decimal places.
2089
- * This is used to ensure numerical precision in edge detection.
1988
+ * Make the camera view fit all the specified meshes.
2090
1989
  *
2091
- * @param vector - The vector to round.
2092
- * @returns The vector with rounded components.
1990
+ * @param meshes the meshes to fit. If it is not defined, it will
1991
+ * evaluate {@link Components.meshes}.
1992
+ * @param offset the distance to the fit object
2093
1993
  */
2094
- round(vector: THREE.Vector3): void;
1994
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
2095
1995
  /**
2096
- * Calculates the volume of a set of fragments.
2097
- *
2098
- * @param frags - A map of fragment IDs to their corresponding item IDs.
2099
- * @returns The total volume of the fragments and the bounding sphere.
2100
- *
2101
- * @remarks
2102
- * This method creates a set of instanced meshes from the given fragments and item IDs.
2103
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1996
+ * Allows or prevents all user input.
2104
1997
  *
2105
- * @throws Will throw an error if the geometry of the meshes is not indexed.
2106
- * @throws Will throw an error if the fragment manager is not available.
1998
+ * @param active - whether to enable or disable user inputs.
2107
1999
  */
2108
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
2000
+ setUserInput(active: boolean): void;
2001
+ private disableUserInput;
2002
+ private enableUserInput;
2003
+ private newOrthoCamera;
2004
+ private setOrthoPerspCameraAspect;
2005
+ }
2006
+ export declare class UUID {
2007
+ private static _pattern;
2008
+ private static _lut;
2009
+ static create(): string;
2010
+ static validate(uuid: string): void;
2011
+ }
2012
+ import * as THREE from "three";
2013
+ import { Component, Components, Disposable, Event, World } from "../core";
2014
+ /**
2015
+ * Configuration interface for the VertexPicker component.
2016
+ */
2017
+ export interface VertexPickerConfig {
2109
2018
  /**
2110
- * Calculates the total volume of a set of meshes.
2111
- *
2112
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2113
- * @returns The total volume of the meshes and the bounding sphere.
2114
- *
2115
- * @remarks
2116
- * This method calculates the volume of each mesh in the provided array and returns the total volume
2117
- * and its bounding sphere.
2118
- *
2019
+ * If true, only vertices will be picked, not the closest point on the face.
2119
2020
  */
2120
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2121
- private getFaceData;
2122
- private getVolumeOfMesh;
2123
- private getSignedVolumeOfTriangle;
2021
+ showOnlyVertex: boolean;
2022
+ /**
2023
+ * The maximum distance for snapping to a vertex.
2024
+ */
2025
+ snapDistance: number;
2026
+ /**
2027
+ * The HTML element to use for previewing the picked vertex.
2028
+ */
2029
+ previewElement: HTMLElement;
2124
2030
  }
2125
- import * as THREE from "three";
2126
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2127
2031
  /**
2128
- * A class representing a 2D minimap of a 3D world.
2032
+ * A class that provides functionality for picking vertices in a 3D scene.
2129
2033
  */
2130
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2034
+ export declare class VertexPicker extends Component implements Disposable {
2131
2035
  /** {@link Disposable.onDisposed} */
2132
2036
  readonly onDisposed: Event<unknown>;
2133
- /** {@link Updateable.onAfterUpdate} */
2134
- readonly onAfterUpdate: Event<unknown>;
2135
- /** {@link Updateable.onBeforeUpdate} */
2136
- readonly onBeforeUpdate: Event<unknown>;
2137
- /** {@link Resizeable.onResize} */
2138
- readonly onResize: Event<THREE.Vector2>;
2139
- /**
2140
- * The front offset of the minimap.
2141
- * It determines how much the minimap's view is offset from the camera's view.
2142
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2143
- */
2144
- frontOffset: number;
2145
2037
  /**
2146
- * The override material for the minimap.
2147
- * It is used to render the depth information of the world onto the minimap.
2038
+ * An event that is triggered when a vertex is found.
2039
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
2148
2040
  */
2149
- overrideMaterial: THREE.MeshDepthMaterial;
2041
+ readonly onVertexFound: Event<THREE.Vector3>;
2150
2042
  /**
2151
- * The background color of the minimap.
2152
- * It is used to set the background color of the minimap's renderer.
2043
+ * An event that is triggered when a vertex is lost.
2044
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
2153
2045
  */
2154
- backgroundColor: THREE.Color;
2046
+ readonly onVertexLost: Event<THREE.Vector3>;
2155
2047
  /**
2156
- * The WebGL renderer for the minimap.
2157
- * It is used to render the minimap onto the screen.
2048
+ * An event that is triggered when the picker is enabled or disabled
2158
2049
  */
2159
- renderer: THREE.WebGLRenderer;
2050
+ readonly onEnabled: Event<boolean>;
2160
2051
  /**
2161
- * A flag indicating whether the minimap is enabled.
2162
- * If disabled, the minimap will not update or render.
2052
+ * A reference to the Components instance associated with this VertexPicker.
2163
2053
  */
2164
- enabled: boolean;
2054
+ components: Components;
2165
2055
  /**
2166
- * The world in which the minimap is displayed.
2167
- * It provides access to the 3D scene, camera, and other relevant world elements.
2056
+ * A reference to the working plane used for vertex picking.
2057
+ * This plane is used to determine which vertices are considered valid for picking.
2058
+ * If this value is null, all vertices are considered valid.
2168
2059
  */
2169
- world: World;
2170
- private _lockRotation;
2171
- private _camera;
2172
- private _plane;
2173
- private _size;
2174
- private _tempVector1;
2175
- private _tempVector2;
2176
- private _tempTarget;
2177
- private readonly down;
2060
+ workingPlane: THREE.Plane | null;
2061
+ private _pickedPoint;
2062
+ private _config;
2063
+ private _enabled;
2178
2064
  /**
2179
- * Gets or sets whether the minimap rotation is locked.
2180
- * When rotation is locked, the minimap will always face the same direction as the camera.
2065
+ * Sets the enabled state of the VertexPicker.
2066
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
2067
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
2068
+ *
2069
+ * @param value - The new enabled state.
2181
2070
  */
2182
- get lockRotation(): boolean;
2071
+ set enabled(value: boolean);
2183
2072
  /**
2184
- * Sets whether the minimap rotation is locked.
2185
- * When rotation is locked, the minimap will always face the same direction as the camera.
2186
- * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2073
+ * Gets the current enabled state of the VertexPicker.
2074
+ *
2075
+ * @returns The current enabled state.
2187
2076
  */
2188
- set lockRotation(active: boolean);
2077
+ get enabled(): boolean;
2189
2078
  /**
2190
- * Gets the current zoom level of the minimap.
2191
- * The zoom level determines how much of the world is visible on the minimap.
2192
- * @returns The current zoom level of the minimap.
2079
+ * Sets the configuration for the VertexPicker component.
2080
+ *
2081
+ * @param value - A Partial object containing the configuration properties to update.
2082
+ * The properties not provided in the value object will retain their current values.
2083
+ *
2084
+ * @example
2085
+ * '''typescript
2086
+ * vertexPicker.config = {
2087
+ * snapDistance: 0.5,
2088
+ * showOnlyVertex: true,
2089
+ * };
2090
+ * '''
2193
2091
  */
2194
- get zoom(): number;
2092
+ set config(value: Partial<VertexPickerConfig>);
2195
2093
  /**
2196
- * Sets the zoom level of the minimap.
2197
- * The zoom level determines how much of the world is visible on the minimap.
2198
- * @param value - The new zoom level of the minimap.
2094
+ * Gets the current configuration for the VertexPicker component.
2095
+ *
2096
+ * @returns A copy of the current VertexPickerConfig object.
2097
+ *
2098
+ * @example
2099
+ * '''typescript
2100
+ * const currentConfig = vertexPicker.config;
2101
+ * console.log(currentConfig.snapDistance); // Output: 0.25
2102
+ * '''
2199
2103
  */
2200
- set zoom(value: number);
2201
- constructor(world: World);
2104
+ get config(): Partial<VertexPickerConfig>;
2105
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
2202
2106
  /** {@link Disposable.dispose} */
2203
2107
  dispose(): void;
2204
- /** Returns the camera used by the MiniMap */
2205
- get(): THREE.OrthographicCamera;
2206
- /** {@link Updateable.update} */
2207
- update(): void;
2208
- /** {@link Resizeable.getSize} */
2209
- getSize(): THREE.Vector2;
2210
- /** {@link Resizeable.resize} */
2211
- resize(size?: THREE.Vector2): void;
2212
- private updatePlanes;
2108
+ /**
2109
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
2110
+ *
2111
+ * @param world - The World instance to use for raycasting.
2112
+ *
2113
+ * @returns The current picked point, or null if no point is picked.
2114
+ *
2115
+ * @remarks
2116
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2117
+ * If enabled, it performs raycasting to find the closest intersecting object.
2118
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
2119
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2120
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2121
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
2122
+ */
2123
+ get(world: World): THREE.Vector3 | null;
2124
+ private getClosestVertex;
2125
+ private getVertices;
2126
+ private getVertex;
2127
+ }
2128
+ import * as FRAGS from "@thatopen/fragments";
2129
+ export declare class IfcPropertiesUtils {
2130
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2131
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2132
+ [attribute: string]: any;
2133
+ } | null>;
2134
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2135
+ [relatingID: number]: number[];
2136
+ }>;
2137
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2138
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2139
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2140
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2141
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2142
+ key: string | null;
2143
+ name: string | null;
2144
+ }>;
2145
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2146
+ key: string | null;
2147
+ value: number | null;
2148
+ }>;
2149
+ static isRel(expressID: number): boolean;
2150
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2151
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2213
2152
  }
2214
2153
  /**
2215
- * A Set of unique numbers representing different types of IFC geometries.
2154
+ * 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.
2155
+ *
2156
+ * @remarks
2157
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2158
+ * It is useful for identifying and processing different types of IFC elements in a project.
2159
+ *
2216
2160
  */
2217
- export declare const GeometryTypes: Set<number>;
2161
+ export declare const IfcElements: {
2162
+ [key: number]: string;
2163
+ };
2164
+ /**
2165
+ * 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.
2166
+ */
2167
+ export declare const IfcCategoryMap: {
2168
+ [key: number]: string;
2169
+ };
2170
+ import * as WEBIFC from "web-ifc";
2171
+ export interface IfcItemsCategories {
2172
+ [itemID: number]: number;
2173
+ }
2174
+ export declare class IfcCategories {
2175
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2176
+ }
2218
2177
  import * as WEBIFC from "web-ifc";
2219
2178
  /** Configuration of the IFC-fragment conversion. */
2220
2179
  export declare class IfcFragmentSettings {
@@ -2256,6 +2215,15 @@ export declare class IfcFragmentSettings {
2256
2215
  */
2257
2216
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2258
2217
  }
2218
+ /**
2219
+ * A Set of unique numbers representing different types of IFC geometries.
2220
+ */
2221
+ export declare const GeometryTypes: Set<number>;
2222
+ import { InverseAttribute } from "./types";
2223
+ export declare const relToAttributesMap: Map<number, {
2224
+ forRelating: InverseAttribute;
2225
+ forRelated: InverseAttribute;
2226
+ }>;
2259
2227
  import * as WEBIFC from "web-ifc";
2260
2228
  import { IfcItemsCategories } from "../../../ifc";
2261
2229
  export declare class SpatialStructure {
@@ -2264,54 +2232,21 @@ export declare class SpatialStructure {
2264
2232
  setUp(webIfc: WEBIFC.IfcAPI): void;
2265
2233
  cleanUp(): void;
2266
2234
  }
2235
+ import * as FRAGS from "@thatopen/fragments";
2267
2236
  import * as WEBIFC from "web-ifc";
2268
- export interface IfcItemsCategories {
2269
- [itemID: number]: number;
2270
- }
2271
- export declare class IfcCategories {
2272
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2237
+ export declare class SpatialIdsFinder {
2238
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2273
2239
  }
2274
- /**
2275
- * 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.
2276
- *
2277
- * @remarks
2278
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2279
- * It is useful for identifying and processing different types of IFC elements in a project.
2280
- *
2281
- */
2282
- export declare const IfcElements: {
2283
- [key: number]: string;
2284
- };
2285
- /**
2286
- * 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.
2287
- */
2288
- export declare const IfcCategoryMap: {
2289
- [key: number]: string;
2290
- };
2291
- import * as FRAGS from "@thatopen/fragments";
2292
- export declare class IfcPropertiesUtils {
2293
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2294
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2295
- [attribute: string]: any;
2296
- } | null>;
2297
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2298
- [relatingID: number]: number[];
2299
- }>;
2300
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2301
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2302
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2303
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2304
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2305
- key: string | null;
2306
- name: string | null;
2307
- }>;
2308
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2309
- key: string | null;
2310
- value: number | null;
2311
- }>;
2312
- static isRel(expressID: number): boolean;
2313
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2314
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2240
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2241
+ /**
2242
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2243
+ */
2244
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2245
+ /**
2246
+ * Amount of properties to be streamed.
2247
+ * Defaults to 100 properties.
2248
+ */
2249
+ propertiesSize: number;
2315
2250
  }
2316
2251
  /**
2317
2252
  * 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.
@@ -2490,11 +2425,95 @@ export declare abstract class Component extends Base {
2490
2425
  */
2491
2426
  abstract enabled: boolean;
2492
2427
  }
2493
- import { InverseAttribute } from "./types";
2494
- export declare const relToAttributesMap: Map<number, {
2495
- forRelating: InverseAttribute;
2496
- forRelated: InverseAttribute;
2497
- }>;
2428
+ import * as THREE from "three";
2429
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2430
+ /**
2431
+ * A class representing a 2D minimap of a 3D world.
2432
+ */
2433
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2434
+ /** {@link Disposable.onDisposed} */
2435
+ readonly onDisposed: Event<unknown>;
2436
+ /** {@link Updateable.onAfterUpdate} */
2437
+ readonly onAfterUpdate: Event<unknown>;
2438
+ /** {@link Updateable.onBeforeUpdate} */
2439
+ readonly onBeforeUpdate: Event<unknown>;
2440
+ /** {@link Resizeable.onResize} */
2441
+ readonly onResize: Event<THREE.Vector2>;
2442
+ /**
2443
+ * The front offset of the minimap.
2444
+ * It determines how much the minimap's view is offset from the camera's view.
2445
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2446
+ */
2447
+ frontOffset: number;
2448
+ /**
2449
+ * The override material for the minimap.
2450
+ * It is used to render the depth information of the world onto the minimap.
2451
+ */
2452
+ overrideMaterial: THREE.MeshDepthMaterial;
2453
+ /**
2454
+ * The background color of the minimap.
2455
+ * It is used to set the background color of the minimap's renderer.
2456
+ */
2457
+ backgroundColor: THREE.Color;
2458
+ /**
2459
+ * The WebGL renderer for the minimap.
2460
+ * It is used to render the minimap onto the screen.
2461
+ */
2462
+ renderer: THREE.WebGLRenderer;
2463
+ /**
2464
+ * A flag indicating whether the minimap is enabled.
2465
+ * If disabled, the minimap will not update or render.
2466
+ */
2467
+ enabled: boolean;
2468
+ /**
2469
+ * The world in which the minimap is displayed.
2470
+ * It provides access to the 3D scene, camera, and other relevant world elements.
2471
+ */
2472
+ world: World;
2473
+ private _lockRotation;
2474
+ private _camera;
2475
+ private _plane;
2476
+ private _size;
2477
+ private _tempVector1;
2478
+ private _tempVector2;
2479
+ private _tempTarget;
2480
+ private readonly down;
2481
+ /**
2482
+ * Gets or sets whether the minimap rotation is locked.
2483
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2484
+ */
2485
+ get lockRotation(): boolean;
2486
+ /**
2487
+ * Sets whether the minimap rotation is locked.
2488
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2489
+ * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2490
+ */
2491
+ set lockRotation(active: boolean);
2492
+ /**
2493
+ * Gets the current zoom level of the minimap.
2494
+ * The zoom level determines how much of the world is visible on the minimap.
2495
+ * @returns The current zoom level of the minimap.
2496
+ */
2497
+ get zoom(): number;
2498
+ /**
2499
+ * Sets the zoom level of the minimap.
2500
+ * The zoom level determines how much of the world is visible on the minimap.
2501
+ * @param value - The new zoom level of the minimap.
2502
+ */
2503
+ set zoom(value: number);
2504
+ constructor(world: World);
2505
+ /** {@link Disposable.dispose} */
2506
+ dispose(): void;
2507
+ /** Returns the camera used by the MiniMap */
2508
+ get(): THREE.OrthographicCamera;
2509
+ /** {@link Updateable.update} */
2510
+ update(): void;
2511
+ /** {@link Resizeable.getSize} */
2512
+ getSize(): THREE.Vector2;
2513
+ /** {@link Resizeable.resize} */
2514
+ resize(size?: THREE.Vector2): void;
2515
+ private updatePlanes;
2516
+ }
2498
2517
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2499
2518
  import { Components } from "../../Components";
2500
2519
  /**
@@ -2538,34 +2557,6 @@ export declare abstract class BaseWorldItem extends Base {
2538
2557
  protected constructor(components: Components);
2539
2558
  }
2540
2559
  import * as THREE from "three";
2541
- import CameraControls from "camera-controls";
2542
- import { BaseWorldItem } from "./base-world-item";
2543
- import { CameraControllable } from "./interfaces";
2544
- /**
2545
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2546
- */
2547
- export declare abstract class BaseCamera extends BaseWorldItem {
2548
- /**
2549
- * Whether the camera is enabled or not.
2550
- */
2551
- abstract enabled: boolean;
2552
- /**
2553
- * The Three.js camera instance.
2554
- */
2555
- abstract three: THREE.Camera;
2556
- /**
2557
- * Optional CameraControls instance for controlling the camera.
2558
- * This property is only available if the camera is controllable.
2559
- */
2560
- abstract controls?: CameraControls;
2561
- /**
2562
- * Checks whether the instance is {@link CameraControllable}.
2563
- *
2564
- * @returns True if the instance is controllable, false otherwise.
2565
- */
2566
- hasCameraControls: () => this is CameraControllable;
2567
- }
2568
- import * as THREE from "three";
2569
2560
  import { Vector2 } from "three";
2570
2561
  import { Event } from "./event";
2571
2562
  import { BaseWorldItem } from "./base-world-item";
@@ -2631,404 +2622,240 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2631
2622
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2632
2623
  }
2633
2624
  import * as THREE from "three";
2634
- import { Disposable } from "./interfaces";
2635
- import { Event } from "./event";
2636
- import { Components } from "../../Components";
2625
+ import CameraControls from "camera-controls";
2637
2626
  import { BaseWorldItem } from "./base-world-item";
2627
+ import { CameraControllable } from "./interfaces";
2638
2628
  /**
2639
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2640
- */
2641
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2642
- /** {@link Disposable.onDisposed} */
2643
- readonly onDisposed: Event<unknown>;
2644
- /**
2645
- * Abstract property representing the three.js object associated with this scene.
2646
- * It should be implemented by subclasses.
2647
- */
2648
- abstract three: THREE.Object3D;
2649
- protected constructor(components: Components);
2650
- /** {@link Disposable.dispose} */
2651
- dispose(): void;
2652
- }
2653
- import * as THREE from "three";
2654
- import { BaseScene } from "./base-scene";
2655
- import { BaseCamera } from "./base-camera";
2656
- import { BaseRenderer } from "./base-renderer";
2657
- import { Updateable, Disposable } from "./interfaces";
2658
- /**
2659
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2660
- */
2661
- export interface World extends Disposable, Updateable {
2662
- /**
2663
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2664
- */
2665
- meshes: Set<THREE.Mesh>;
2666
- /**
2667
- * The base scene of the world.
2668
- */
2669
- scene: BaseScene;
2670
- /**
2671
- * The base camera of the world.
2672
- */
2673
- camera: BaseCamera;
2674
- /**
2675
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2676
- */
2677
- renderer: BaseRenderer | null;
2678
- /**
2679
- * A unique identifier for the world.
2680
- */
2681
- uuid: string;
2682
- /**
2683
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2684
- */
2685
- isDisposing: boolean;
2686
- }
2687
- import * as THREE from "three";
2688
- import { Disposable, Event } from "../../Types";
2689
- /**
2690
- * 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.
2691
- */
2692
- export declare class Mouse implements Disposable {
2693
- dom: HTMLCanvasElement;
2694
- private _event?;
2695
- private _position;
2696
- /** {@link Disposable.onDisposed} */
2697
- readonly onDisposed: Event<unknown>;
2698
- constructor(dom: HTMLCanvasElement);
2699
- /**
2700
- * The real position of the mouse of the Three.js canvas.
2701
- */
2702
- get position(): THREE.Vector2;
2703
- /** {@link Disposable.dispose} */
2704
- dispose(): void;
2705
- private getPositionY;
2706
- private getPositionX;
2707
- private updateMouseInfo;
2708
- private setupEvents;
2709
- }
2710
- import * as THREE from "three";
2711
- import { Components } from "../../Components";
2712
- import { Event, World, Disposable } from "../../Types";
2713
- import { Mouse } from "./mouse";
2714
- /**
2715
- * 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.
2629
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2716
2630
  */
2717
- export declare class SimpleRaycaster implements Disposable {
2718
- /** {@link Component.enabled} */
2719
- enabled: boolean;
2720
- /** The components instance to which this Raycaster belongs. */
2721
- components: Components;
2722
- /** {@link Disposable.onDisposed} */
2723
- readonly onDisposed: Event<unknown>;
2724
- /** The position of the mouse in the screen. */
2725
- readonly mouse: Mouse;
2631
+ export declare abstract class BaseCamera extends BaseWorldItem {
2726
2632
  /**
2727
- * A reference to the Three.js Raycaster instance.
2728
- * This is used for raycasting operations.
2633
+ * Whether the camera is enabled or not.
2729
2634
  */
2730
- readonly three: THREE.Raycaster;
2635
+ abstract enabled: boolean;
2731
2636
  /**
2732
- * A reference to the world instance to which this Raycaster belongs.
2733
- * This is used to access the camera and meshes.
2637
+ * The Three.js camera instance.
2734
2638
  */
2735
- world: World;
2736
- constructor(components: Components, world: World);
2737
- /** {@link Disposable.dispose} */
2738
- dispose(): void;
2639
+ abstract three: THREE.Camera;
2739
2640
  /**
2740
- * Throws a ray from the camera to the mouse or touch event point and returns
2741
- * the first item found. This also takes into account the clipping planes
2742
- * used by the renderer.
2743
- *
2744
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2745
- * to query. If not provided, it will query all the meshes stored in
2746
- * {@link Components.meshes}.
2641
+ * Optional CameraControls instance for controlling the camera.
2642
+ * This property is only available if the camera is controllable.
2747
2643
  */
2748
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2644
+ abstract controls?: CameraControls;
2749
2645
  /**
2750
- * Casts a ray from a given origin in a given direction and returns the first item found.
2751
- * This method also takes into account the clipping planes used by the renderer.
2752
- *
2753
- * @param origin - The origin of the ray.
2754
- * @param direction - The direction of the ray.
2755
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2756
- * @returns The first intersection found or 'null' if no intersection was found.
2646
+ * Checks whether the instance is {@link CameraControllable}.
2647
+ *
2648
+ * @returns True if the instance is controllable, false otherwise.
2757
2649
  */
2758
- 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;
2759
- private intersect;
2760
- private filterClippingPlanes;
2650
+ hasCameraControls: () => this is CameraControllable;
2761
2651
  }
2762
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2763
2652
  import * as THREE from "three";
2653
+ import { Disposable } from "./interfaces";
2654
+ import { Event } from "./event";
2764
2655
  import { Components } from "../../Components";
2765
- import { AsyncEvent, Event, World } from "../../Types";
2656
+ import { BaseWorldItem } from "./base-world-item";
2766
2657
  /**
2767
- * Settings to configure the CullerRenderer.
2658
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2768
2659
  */
2769
- export interface CullerRendererSettings {
2660
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2661
+ /** {@link Disposable.onDisposed} */
2662
+ readonly onDisposed: Event<unknown>;
2770
2663
  /**
2771
- * Interval in milliseconds at which the visibility check should be performed.
2772
- * Default value is 1000.
2664
+ * Abstract property representing the three.js object associated with this scene.
2665
+ * It should be implemented by subclasses.
2773
2666
  */
2774
- updateInterval?: number;
2667
+ abstract three: THREE.Object3D;
2668
+ protected constructor(components: Components);
2669
+ /** {@link Disposable.dispose} */
2670
+ dispose(): void;
2671
+ }
2672
+ import * as THREE from "three";
2673
+ import { BaseScene } from "./base-scene";
2674
+ import { BaseCamera } from "./base-camera";
2675
+ import { BaseRenderer } from "./base-renderer";
2676
+ import { Updateable, Disposable } from "./interfaces";
2677
+ /**
2678
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2679
+ */
2680
+ export interface World extends Disposable, Updateable {
2775
2681
  /**
2776
- * Width of the render target used for visibility checks.
2777
- * Default value is 512.
2682
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2778
2683
  */
2779
- width?: number;
2684
+ meshes: Set<THREE.Mesh>;
2780
2685
  /**
2781
- * Height of the render target used for visibility checks.
2782
- * Default value is 512.
2686
+ * The base scene of the world.
2783
2687
  */
2784
- height?: number;
2688
+ scene: BaseScene;
2785
2689
  /**
2786
- * Whether the visibility check should be performed automatically.
2787
- * Default value is true.
2690
+ * The base camera of the world.
2788
2691
  */
2789
- autoUpdate?: boolean;
2790
- }
2791
- /**
2792
- * A base renderer to determine visibility on screen.
2793
- */
2794
- export declare class CullerRenderer {
2795
- /** {@link Disposable.onDisposed} */
2796
- readonly onDisposed: Event<string>;
2692
+ camera: BaseCamera;
2797
2693
  /**
2798
- * Fires after making the visibility check to the meshes. It lists the
2799
- * meshes that are currently visible, and the ones that were visible
2800
- * just before but not anymore.
2694
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2801
2695
  */
2802
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2696
+ renderer: BaseRenderer | null;
2803
2697
  /**
2804
- * Whether this renderer is active or not. If not, it won't render anything.
2698
+ * A unique identifier for the world.
2805
2699
  */
2806
- enabled: boolean;
2700
+ uuid: string;
2807
2701
  /**
2808
- * Needs to check whether there are objects that need to be hidden or shown.
2809
- * You can bind this to the camera movement, to a certain interval, etc.
2702
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2810
2703
  */
2811
- needsUpdate: boolean;
2704
+ isDisposing: boolean;
2705
+ }
2706
+ import * as THREE from "three";
2707
+ import { Disposable, Event } from "../../Types";
2708
+ /**
2709
+ * 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.
2710
+ */
2711
+ export declare class Mouse implements Disposable {
2712
+ dom: HTMLCanvasElement;
2713
+ private _event?;
2714
+ private _position;
2715
+ /** {@link Disposable.onDisposed} */
2716
+ readonly onDisposed: Event<unknown>;
2717
+ constructor(dom: HTMLCanvasElement);
2812
2718
  /**
2813
- * Render the internal scene used to determine the object visibility. Used
2814
- * for debugging purposes.
2719
+ * The real position of the mouse of the Three.js canvas.
2815
2720
  */
2816
- renderDebugFrame: boolean;
2817
- /** The components instance to which this renderer belongs. */
2818
- components: Components;
2819
- /** The world instance to which this renderer belongs. */
2820
- readonly world: World;
2821
- /** The THREE.js renderer used to make the visibility test. */
2822
- readonly renderer: THREE.WebGLRenderer;
2823
- protected autoUpdate: boolean;
2824
- protected updateInterval: number;
2825
- protected readonly worker: Worker;
2826
- protected readonly scene: THREE.Scene;
2827
- private _width;
2828
- private _height;
2829
- private _availableColor;
2830
- private readonly renderTarget;
2831
- private readonly bufferSize;
2832
- private readonly _buffer;
2833
- protected _isWorkerBusy: boolean;
2834
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2721
+ get position(): THREE.Vector2;
2835
2722
  /** {@link Disposable.dispose} */
2836
2723
  dispose(): void;
2837
- /**
2838
- * The function that the culler uses to reprocess the scene. Generally it's
2839
- * better to call needsUpdate, but you can also call this to force it.
2840
- * @param force if true, it will refresh the scene even if needsUpdate is
2841
- * not true.
2842
- */
2843
- updateVisibility: (force?: boolean) => Promise<void>;
2844
- protected getAvailableColor(): {
2845
- r: number;
2846
- g: number;
2847
- b: number;
2848
- code: string;
2849
- };
2850
- protected increaseColor(): void;
2851
- protected decreaseColor(): void;
2852
- private applySettings;
2724
+ private getPositionY;
2725
+ private getPositionX;
2726
+ private updateMouseInfo;
2727
+ private setupEvents;
2853
2728
  }
2854
2729
  import * as THREE from "three";
2855
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2730
+ import { Hideable, Event, World, Disposable } from "../../Types";
2856
2731
  import { Components } from "../../Components";
2857
- import { Event, World, Disposable } from "../../Types";
2858
2732
  /**
2859
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2733
+ * Configuration interface for the {@link SimpleGrid} class.
2860
2734
  */
2861
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2735
+ export interface GridConfig {
2862
2736
  /**
2863
- * Event triggered when the visibility of meshes is updated.
2864
- * Contains two sets: seen and unseen.
2737
+ * The color of the grid lines.
2865
2738
  */
2866
- readonly onViewUpdated: Event<{
2867
- seen: Set<THREE.Mesh>;
2868
- unseen: Set<THREE.Mesh>;
2869
- }>;
2739
+ color: THREE.Color;
2870
2740
  /**
2871
- * Pixels in screen a geometry must occupy to be considered "seen".
2872
- * Default value is 100.
2741
+ * The size of the primary grid lines.
2873
2742
  */
2874
- threshold: number;
2743
+ size1: number;
2875
2744
  /**
2876
- * Map of color code to THREE.InstancedMesh.
2877
- * Used to keep track of color-coded meshes.
2745
+ * The size of the secondary grid lines.
2878
2746
  */
2879
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2747
+ size2: number;
2880
2748
  /**
2881
- * Flag to indicate if the renderer is currently processing.
2882
- * Used to prevent concurrent processing.
2749
+ * The distance at which the grid lines start to fade away.
2883
2750
  */
2884
- isProcessing: boolean;
2885
- private _colorCodeMeshMap;
2886
- private _meshIDColorCodeMap;
2887
- private _currentVisibleMeshes;
2888
- private _recentlyHiddenMeshes;
2889
- private _intervalID;
2890
- private readonly _transparentMat;
2891
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2892
- /** {@link Disposable.dispose} */
2893
- dispose(): void;
2751
+ distance: number;
2752
+ }
2753
+ /**
2754
+ * 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).
2755
+ */
2756
+ export declare class SimpleGrid implements Hideable, Disposable {
2757
+ /** {@link Disposable.onDisposed} */
2758
+ readonly onDisposed: Event<unknown>;
2759
+ /** The world instance to which this Raycaster belongs. */
2760
+ world: World;
2761
+ /** The components instance to which this grid belongs. */
2762
+ components: Components;
2763
+ /** {@link Hideable.visible} */
2764
+ get visible(): boolean;
2765
+ /** {@link Hideable.visible} */
2766
+ set visible(visible: boolean);
2767
+ /** The material of the grid. */
2768
+ get material(): THREE.ShaderMaterial;
2894
2769
  /**
2895
- * 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.
2896
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2897
- * @returns {void}
2770
+ * Whether the grid should fade away with distance. Recommended to be true for
2771
+ * perspective cameras and false for orthographic cameras.
2898
2772
  */
2899
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2773
+ get fade(): boolean;
2900
2774
  /**
2901
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2902
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2903
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2904
- * @returns {void}
2775
+ * Whether the grid should fade away with distance. Recommended to be true for
2776
+ * perspective cameras and false for orthographic cameras.
2905
2777
  */
2906
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2907
- private handleWorkerMessage;
2908
- private getAvailableMaterial;
2909
- }
2910
- import { NavigationMode } from "./types";
2911
- import { OrthoPerspectiveCamera } from "../index";
2912
- /**
2913
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2914
- */
2915
- export declare class FirstPersonMode implements NavigationMode {
2916
- private camera;
2917
- /** {@link NavigationMode.enabled} */
2918
- enabled: boolean;
2919
- /** {@link NavigationMode.id} */
2920
- readonly id = "FirstPerson";
2921
- constructor(camera: OrthoPerspectiveCamera);
2922
- /** {@link NavigationMode.set} */
2923
- set(active: boolean): void;
2924
- private setupFirstPersonCamera;
2925
- }
2926
- import { NavigationMode } from "./types";
2927
- import { OrthoPerspectiveCamera } from "../index";
2928
- /**
2929
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2930
- */
2931
- export declare class OrbitMode implements NavigationMode {
2932
- camera: OrthoPerspectiveCamera;
2933
- /** {@link NavigationMode.enabled} */
2934
- enabled: boolean;
2935
- /** {@link NavigationMode.id} */
2936
- readonly id = "Orbit";
2937
- constructor(camera: OrthoPerspectiveCamera);
2938
- /** {@link NavigationMode.set} */
2939
- set(active: boolean): void;
2940
- private activateOrbitControls;
2941
- }
2942
- import { NavigationMode } from "./types";
2943
- import { OrthoPerspectiveCamera } from "../index";
2944
- /**
2945
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2946
- */
2947
- export declare class PlanMode implements NavigationMode {
2948
- private camera;
2949
- /** {@link NavigationMode.enabled} */
2950
- enabled: boolean;
2951
- /** {@link NavigationMode.id} */
2952
- readonly id = "Plan";
2953
- private mouseAction1?;
2954
- private mouseAction2?;
2955
- private mouseInitialized;
2956
- private readonly defaultAzimuthSpeed;
2957
- private readonly defaultPolarSpeed;
2958
- constructor(camera: OrthoPerspectiveCamera);
2959
- /** {@link NavigationMode.set} */
2960
- set(active: boolean): void;
2778
+ set fade(active: boolean);
2779
+ /** The Three.js mesh that contains the infinite grid. */
2780
+ readonly three: THREE.Mesh;
2781
+ private _fade;
2782
+ constructor(components: Components, world: World, config: GridConfig);
2783
+ /** {@link Disposable.dispose} */
2784
+ dispose(): void;
2785
+ private setupEvents;
2786
+ private updateZoom;
2961
2787
  }
2962
2788
  import * as THREE from "three";
2963
- import { CameraProjection } from "./types";
2964
- import { Event } from "../../Types";
2965
- import { OrthoPerspectiveCamera } from "../index";
2789
+ import { Components } from "../../Components";
2790
+ import { Event, World, Disposable } from "../../Types";
2791
+ import { Mouse } from "./mouse";
2966
2792
  /**
2967
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2793
+ * 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.
2968
2794
  */
2969
- export declare class ProjectionManager {
2970
- /**
2971
- * Event that fires when the {@link CameraProjection} changes.
2972
- */
2973
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
2795
+ export declare class SimpleRaycaster implements Disposable {
2796
+ /** {@link Component.enabled} */
2797
+ enabled: boolean;
2798
+ /** The components instance to which this Raycaster belongs. */
2799
+ components: Components;
2800
+ /** {@link Disposable.onDisposed} */
2801
+ readonly onDisposed: Event<unknown>;
2802
+ /** The position of the mouse in the screen. */
2803
+ readonly mouse: Mouse;
2974
2804
  /**
2975
- * Current projection mode of the camera.
2976
- * Default is "Perspective".
2805
+ * A reference to the Three.js Raycaster instance.
2806
+ * This is used for raycasting operations.
2977
2807
  */
2978
- current: CameraProjection;
2808
+ readonly three: THREE.Raycaster;
2979
2809
  /**
2980
- * The camera controlled by this ProjectionManager.
2981
- * It can be either a PerspectiveCamera or an OrthographicCamera.
2810
+ * A reference to the world instance to which this Raycaster belongs.
2811
+ * This is used to access the camera and meshes.
2982
2812
  */
2983
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2984
- /** Match Ortho zoom with Perspective distance when changing projection mode */
2985
- matchOrthoDistanceEnabled: boolean;
2986
- private _component;
2987
- private _previousDistance;
2988
- constructor(camera: OrthoPerspectiveCamera);
2813
+ world: World;
2814
+ constructor(components: Components, world: World);
2815
+ /** {@link Disposable.dispose} */
2816
+ dispose(): void;
2989
2817
  /**
2990
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2818
+ * Throws a ray from the camera to the mouse or touch event point and returns
2819
+ * the first item found. This also takes into account the clipping planes
2820
+ * used by the renderer.
2991
2821
  *
2992
- * @param projection - the new projection to set. If it is the current projection,
2993
- * it will have no effect.
2822
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2823
+ * to query. If not provided, it will query all the meshes stored in
2824
+ * {@link Components.meshes}.
2994
2825
  */
2995
- set(projection: CameraProjection): Promise<void>;
2826
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2996
2827
  /**
2997
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
2998
- * and vice versa.
2828
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2829
+ * This method also takes into account the clipping planes used by the renderer.
2830
+ *
2831
+ * @param origin - The origin of the ray.
2832
+ * @param direction - The direction of the ray.
2833
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2834
+ * @returns The first intersection found or 'null' if no intersection was found.
2999
2835
  */
3000
- toggle(): Promise<void>;
3001
- private setOrthoCamera;
3002
- private getPerspectiveDims;
3003
- private setupOrthoCamera;
3004
- private getDistance;
3005
- private setPerspectiveCamera;
2836
+ 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;
2837
+ private intersect;
2838
+ private filterClippingPlanes;
3006
2839
  }
3007
- /**
3008
- * The projection system of the camera.
3009
- */
3010
- export type CameraProjection = "Perspective" | "Orthographic";
3011
- /**
3012
- * The extensible list of supported navigation modes.
3013
- */
3014
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3015
- /**
3016
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3017
- */
3018
- export interface NavigationMode {
3019
- /** The unique ID of this navigation mode. */
3020
- id: NavModeID;
3021
- /**
3022
- * Enable or disable this navigation mode.
3023
- * When a new navigation mode is enabled, the previous navigation mode
3024
- * must be disabled.
3025
- *
3026
- * @param active - whether to enable or disable this mode.
3027
- * @param options - any additional data required to enable or disable it.
3028
- * */
3029
- set: (active: boolean, options?: any) => void;
3030
- /** Whether this navigation mode is active or not. */
3031
- enabled: boolean;
2840
+ import * as THREE from "three";
2841
+ import * as WEBIFC from "web-ifc";
2842
+ import * as FRAGS from "@thatopen/fragments";
2843
+ export declare class CivilReader {
2844
+ defLineMat: THREE.LineBasicMaterial;
2845
+ read(webIfc: WEBIFC.IfcAPI): {
2846
+ alignments: Map<number, FRAGS.Alignment>;
2847
+ coordinationMatrix: THREE.Matrix4;
2848
+ } | undefined;
2849
+ get(civilItems: any): {
2850
+ alignments: Map<number, FRAGS.Alignment>;
2851
+ coordinationMatrix: THREE.Matrix4;
2852
+ } | undefined;
2853
+ private getCurves;
2854
+ }
2855
+ import * as WEBIFC from "web-ifc";
2856
+ export declare class IfcMetadataReader {
2857
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2858
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3032
2859
  }
3033
2860
  import * as THREE from "three";
3034
2861
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
@@ -3202,6 +3029,22 @@ export declare class SimpleRenderer extends BaseRenderer {
3202
3029
  private onContextLost;
3203
3030
  private onContextBack;
3204
3031
  }
3032
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3033
+ /**
3034
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3035
+ */
3036
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3037
+ /**
3038
+ * Minimum number of geometries to be streamed.
3039
+ * Defaults to 10 geometries.
3040
+ */
3041
+ minGeometrySize: number;
3042
+ /**
3043
+ * Minimum amount of assets to be streamed.
3044
+ * Defaults to 1000 assets.
3045
+ */
3046
+ minAssetsSize: number;
3047
+ }
3205
3048
  import * as THREE from "three";
3206
3049
  import CameraControls from "camera-controls";
3207
3050
  import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
@@ -3264,105 +3107,135 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3264
3107
  private setupEvents;
3265
3108
  private static getSubsetOfThree;
3266
3109
  }
3267
- import * as THREE from "three";
3110
+ /**
3111
+ * 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.
3112
+ */
3113
+ export interface StreamedGeometries {
3114
+ [id: number]: {
3115
+ /** The bounding box of the geometry as a Float32Array. */
3116
+ boundingBox: Float32Array;
3117
+ /** A boolean indicating whether the geometry has holes. */
3118
+ hasHoles: boolean;
3119
+ /** An optional file path for the geometry data. */
3120
+ geometryFile?: string;
3121
+ };
3122
+ }
3123
+ /**
3124
+ * 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.
3125
+ */
3126
+ export interface StreamedAsset {
3127
+ /** The unique identifier of the asset. */
3128
+ id: number;
3129
+ /** An array of geometries associated with the asset. */
3130
+ geometries: {
3131
+ /** The unique identifier of the geometry. */
3132
+ geometryID: number;
3133
+ /** The transformation matrix of the geometry as a number array. */
3134
+ transformation: number[];
3135
+ /** The color of the geometry as a number array. */
3136
+ color: number[];
3137
+ }[];
3138
+ }
3268
3139
  import * as WEBIFC from "web-ifc";
3269
- import * as FRAGS from "@thatopen/fragments";
3270
- export declare class CivilReader {
3271
- defLineMat: THREE.LineBasicMaterial;
3272
- read(webIfc: WEBIFC.IfcAPI): {
3273
- alignments: Map<number, FRAGS.Alignment>;
3274
- coordinationMatrix: THREE.Matrix4;
3275
- } | undefined;
3276
- get(civilItems: any): {
3277
- alignments: Map<number, FRAGS.Alignment>;
3278
- coordinationMatrix: THREE.Matrix4;
3279
- } | undefined;
3280
- private getCurves;
3140
+ import * as THREE from "three";
3141
+ export declare class Units {
3142
+ factor: number;
3143
+ complement: number;
3144
+ apply(matrix: THREE.Matrix4): void;
3145
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3146
+ private getLengthUnits;
3147
+ private getScaleMatrix;
3281
3148
  }
3282
3149
  import * as THREE from "three";
3283
- import { Hideable, Event, World, Disposable } from "../../Types";
3284
3150
  import { Components } from "../../Components";
3151
+ import { AsyncEvent, Event, World } from "../../Types";
3285
3152
  /**
3286
- * Configuration interface for the {@link SimpleGrid} class.
3153
+ * Settings to configure the CullerRenderer.
3287
3154
  */
3288
- export interface GridConfig {
3155
+ export interface CullerRendererSettings {
3289
3156
  /**
3290
- * The color of the grid lines.
3157
+ * Interval in milliseconds at which the visibility check should be performed.
3158
+ * Default value is 1000.
3291
3159
  */
3292
- color: THREE.Color;
3160
+ updateInterval?: number;
3293
3161
  /**
3294
- * The size of the primary grid lines.
3162
+ * Width of the render target used for visibility checks.
3163
+ * Default value is 512.
3295
3164
  */
3296
- size1: number;
3165
+ width?: number;
3297
3166
  /**
3298
- * The size of the secondary grid lines.
3167
+ * Height of the render target used for visibility checks.
3168
+ * Default value is 512.
3299
3169
  */
3300
- size2: number;
3170
+ height?: number;
3301
3171
  /**
3302
- * The distance at which the grid lines start to fade away.
3172
+ * Whether the visibility check should be performed automatically.
3173
+ * Default value is true.
3303
3174
  */
3304
- distance: number;
3175
+ autoUpdate?: boolean;
3305
3176
  }
3306
3177
  /**
3307
- * 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).
3178
+ * A base renderer to determine visibility on screen.
3308
3179
  */
3309
- export declare class SimpleGrid implements Hideable, Disposable {
3180
+ export declare class CullerRenderer {
3310
3181
  /** {@link Disposable.onDisposed} */
3311
- readonly onDisposed: Event<unknown>;
3312
- /** The world instance to which this Raycaster belongs. */
3313
- world: World;
3314
- /** The components instance to which this grid belongs. */
3315
- components: Components;
3316
- /** {@link Hideable.visible} */
3317
- get visible(): boolean;
3318
- /** {@link Hideable.visible} */
3319
- set visible(visible: boolean);
3320
- /** The material of the grid. */
3321
- get material(): THREE.ShaderMaterial;
3182
+ readonly onDisposed: Event<string>;
3322
3183
  /**
3323
- * Whether the grid should fade away with distance. Recommended to be true for
3324
- * perspective cameras and false for orthographic cameras.
3184
+ * Fires after making the visibility check to the meshes. It lists the
3185
+ * meshes that are currently visible, and the ones that were visible
3186
+ * just before but not anymore.
3325
3187
  */
3326
- get fade(): boolean;
3188
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3327
3189
  /**
3328
- * Whether the grid should fade away with distance. Recommended to be true for
3329
- * perspective cameras and false for orthographic cameras.
3190
+ * Whether this renderer is active or not. If not, it won't render anything.
3330
3191
  */
3331
- set fade(active: boolean);
3332
- /** The Three.js mesh that contains the infinite grid. */
3333
- readonly three: THREE.Mesh;
3334
- private _fade;
3335
- constructor(components: Components, world: World, config: GridConfig);
3192
+ enabled: boolean;
3193
+ /**
3194
+ * Needs to check whether there are objects that need to be hidden or shown.
3195
+ * You can bind this to the camera movement, to a certain interval, etc.
3196
+ */
3197
+ needsUpdate: boolean;
3198
+ /**
3199
+ * Render the internal scene used to determine the object visibility. Used
3200
+ * for debugging purposes.
3201
+ */
3202
+ renderDebugFrame: boolean;
3203
+ /** The components instance to which this renderer belongs. */
3204
+ components: Components;
3205
+ /** The world instance to which this renderer belongs. */
3206
+ readonly world: World;
3207
+ /** The THREE.js renderer used to make the visibility test. */
3208
+ readonly renderer: THREE.WebGLRenderer;
3209
+ protected autoUpdate: boolean;
3210
+ protected updateInterval: number;
3211
+ protected readonly worker: Worker;
3212
+ protected readonly scene: THREE.Scene;
3213
+ private _width;
3214
+ private _height;
3215
+ private _availableColor;
3216
+ private readonly renderTarget;
3217
+ private readonly bufferSize;
3218
+ private readonly _buffer;
3219
+ protected _isWorkerBusy: boolean;
3220
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3336
3221
  /** {@link Disposable.dispose} */
3337
3222
  dispose(): void;
3338
- private setupEvents;
3339
- private updateZoom;
3340
- }
3341
- import * as WEBIFC from "web-ifc";
3342
- export declare class IfcMetadataReader {
3343
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3344
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3345
- }
3346
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3347
- /**
3348
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3349
- */
3350
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3351
3223
  /**
3352
- * Amount of properties to be streamed.
3353
- * Defaults to 100 properties.
3224
+ * The function that the culler uses to reprocess the scene. Generally it's
3225
+ * better to call needsUpdate, but you can also call this to force it.
3226
+ * @param force if true, it will refresh the scene even if needsUpdate is
3227
+ * not true.
3354
3228
  */
3355
- propertiesSize: number;
3356
- }
3357
- import * as WEBIFC from "web-ifc";
3358
- import * as THREE from "three";
3359
- export declare class Units {
3360
- factor: number;
3361
- complement: number;
3362
- apply(matrix: THREE.Matrix4): void;
3363
- setUp(webIfc: WEBIFC.IfcAPI): void;
3364
- private getLengthUnits;
3365
- private getScaleMatrix;
3229
+ updateVisibility: (force?: boolean) => Promise<void>;
3230
+ protected getAvailableColor(): {
3231
+ r: number;
3232
+ g: number;
3233
+ b: number;
3234
+ code: string;
3235
+ };
3236
+ protected increaseColor(): void;
3237
+ protected decreaseColor(): void;
3238
+ private applySettings;
3366
3239
  }
3367
3240
  import * as THREE from "three";
3368
3241
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3463,50 +3336,120 @@ export declare class SimplePlane implements Disposable, Hideable {
3463
3336
  private newHelper;
3464
3337
  private static newPlaneMesh;
3465
3338
  }
3466
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3339
+ import * as THREE from "three";
3340
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3341
+ import { Components } from "../../Components";
3342
+ import { Event, World, Disposable } from "../../Types";
3467
3343
  /**
3468
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3344
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3469
3345
  */
3470
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3346
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3471
3347
  /**
3472
- * Minimum number of geometries to be streamed.
3473
- * Defaults to 10 geometries.
3348
+ * Event triggered when the visibility of meshes is updated.
3349
+ * Contains two sets: seen and unseen.
3474
3350
  */
3475
- minGeometrySize: number;
3351
+ readonly onViewUpdated: Event<{
3352
+ seen: Set<THREE.Mesh>;
3353
+ unseen: Set<THREE.Mesh>;
3354
+ }>;
3476
3355
  /**
3477
- * Minimum amount of assets to be streamed.
3478
- * Defaults to 1000 assets.
3356
+ * Pixels in screen a geometry must occupy to be considered "seen".
3357
+ * Default value is 100.
3479
3358
  */
3480
- minAssetsSize: number;
3359
+ threshold: number;
3360
+ /**
3361
+ * Map of color code to THREE.InstancedMesh.
3362
+ * Used to keep track of color-coded meshes.
3363
+ */
3364
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3365
+ /**
3366
+ * Flag to indicate if the renderer is currently processing.
3367
+ * Used to prevent concurrent processing.
3368
+ */
3369
+ isProcessing: boolean;
3370
+ private _colorCodeMeshMap;
3371
+ private _meshIDColorCodeMap;
3372
+ private _currentVisibleMeshes;
3373
+ private _recentlyHiddenMeshes;
3374
+ private _intervalID;
3375
+ private readonly _transparentMat;
3376
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3377
+ /** {@link Disposable.dispose} */
3378
+ dispose(): void;
3379
+ /**
3380
+ * 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.
3381
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3382
+ * @returns {void}
3383
+ */
3384
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3385
+ /**
3386
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3387
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3388
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3389
+ * @returns {void}
3390
+ */
3391
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3392
+ private handleWorkerMessage;
3393
+ private getAvailableMaterial;
3481
3394
  }
3395
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3396
+ import { NavigationMode } from "./types";
3397
+ import { OrthoPerspectiveCamera } from "../index";
3482
3398
  /**
3483
- * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
3399
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3484
3400
  */
3485
- export interface StreamedGeometries {
3486
- [id: number]: {
3487
- /** The bounding box of the geometry as a Float32Array. */
3488
- boundingBox: Float32Array;
3489
- /** A boolean indicating whether the geometry has holes. */
3490
- hasHoles: boolean;
3491
- /** An optional file path for the geometry data. */
3492
- geometryFile?: string;
3493
- };
3401
+ export declare class FirstPersonMode implements NavigationMode {
3402
+ private camera;
3403
+ /** {@link NavigationMode.enabled} */
3404
+ enabled: boolean;
3405
+ /** {@link NavigationMode.id} */
3406
+ readonly id = "FirstPerson";
3407
+ constructor(camera: OrthoPerspectiveCamera);
3408
+ /** {@link NavigationMode.set} */
3409
+ set(active: boolean): void;
3410
+ private setupFirstPersonCamera;
3494
3411
  }
3412
+ import { NavigationMode } from "./types";
3413
+ import { OrthoPerspectiveCamera } from "../index";
3495
3414
  /**
3496
- * 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.
3415
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3497
3416
  */
3498
- export interface StreamedAsset {
3499
- /** The unique identifier of the asset. */
3500
- id: number;
3501
- /** An array of geometries associated with the asset. */
3502
- geometries: {
3503
- /** The unique identifier of the geometry. */
3504
- geometryID: number;
3505
- /** The transformation matrix of the geometry as a number array. */
3506
- transformation: number[];
3507
- /** The color of the geometry as a number array. */
3508
- color: number[];
3509
- }[];
3417
+ export declare class OrbitMode implements NavigationMode {
3418
+ camera: OrthoPerspectiveCamera;
3419
+ /** {@link NavigationMode.enabled} */
3420
+ enabled: boolean;
3421
+ /** {@link NavigationMode.id} */
3422
+ readonly id = "Orbit";
3423
+ constructor(camera: OrthoPerspectiveCamera);
3424
+ /** {@link NavigationMode.set} */
3425
+ set(active: boolean): void;
3426
+ private activateOrbitControls;
3427
+ }
3428
+ /**
3429
+ * The projection system of the camera.
3430
+ */
3431
+ export type CameraProjection = "Perspective" | "Orthographic";
3432
+ /**
3433
+ * The extensible list of supported navigation modes.
3434
+ */
3435
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3436
+ /**
3437
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3438
+ */
3439
+ export interface NavigationMode {
3440
+ /** The unique ID of this navigation mode. */
3441
+ id: NavModeID;
3442
+ /**
3443
+ * Enable or disable this navigation mode.
3444
+ * When a new navigation mode is enabled, the previous navigation mode
3445
+ * must be disabled.
3446
+ *
3447
+ * @param active - whether to enable or disable this mode.
3448
+ * @param options - any additional data required to enable or disable it.
3449
+ * */
3450
+ set: (active: boolean, options?: any) => void;
3451
+ /** Whether this navigation mode is active or not. */
3452
+ enabled: boolean;
3510
3453
  }
3511
3454
  export type RelationsMap = Map<number, Map<number, number[]>>;
3512
3455
  export interface ModelsRelationMap {
@@ -3532,6 +3475,71 @@ export type InverseAttributes = [
3532
3475
  "ContainsElements"
3533
3476
  ];
3534
3477
  export type InverseAttribute = InverseAttributes[number];
3478
+ import * as THREE from "three";
3479
+ import { CameraProjection } from "./types";
3480
+ import { Event } from "../../Types";
3481
+ import { OrthoPerspectiveCamera } from "../index";
3482
+ /**
3483
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3484
+ */
3485
+ export declare class ProjectionManager {
3486
+ /**
3487
+ * Event that fires when the {@link CameraProjection} changes.
3488
+ */
3489
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3490
+ /**
3491
+ * Current projection mode of the camera.
3492
+ * Default is "Perspective".
3493
+ */
3494
+ current: CameraProjection;
3495
+ /**
3496
+ * The camera controlled by this ProjectionManager.
3497
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3498
+ */
3499
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3500
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3501
+ matchOrthoDistanceEnabled: boolean;
3502
+ private _component;
3503
+ private _previousDistance;
3504
+ constructor(camera: OrthoPerspectiveCamera);
3505
+ /**
3506
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3507
+ *
3508
+ * @param projection - the new projection to set. If it is the current projection,
3509
+ * it will have no effect.
3510
+ */
3511
+ set(projection: CameraProjection): Promise<void>;
3512
+ /**
3513
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3514
+ * and vice versa.
3515
+ */
3516
+ toggle(): Promise<void>;
3517
+ private setOrthoCamera;
3518
+ private getPerspectiveDims;
3519
+ private setupOrthoCamera;
3520
+ private getDistance;
3521
+ private setPerspectiveCamera;
3522
+ }
3523
+ import { NavigationMode } from "./types";
3524
+ import { OrthoPerspectiveCamera } from "../index";
3525
+ /**
3526
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3527
+ */
3528
+ export declare class PlanMode implements NavigationMode {
3529
+ private camera;
3530
+ /** {@link NavigationMode.enabled} */
3531
+ enabled: boolean;
3532
+ /** {@link NavigationMode.id} */
3533
+ readonly id = "Plan";
3534
+ private mouseAction1?;
3535
+ private mouseAction2?;
3536
+ private mouseInitialized;
3537
+ private readonly defaultAzimuthSpeed;
3538
+ private readonly defaultPolarSpeed;
3539
+ constructor(camera: OrthoPerspectiveCamera);
3540
+ /** {@link NavigationMode.set} */
3541
+ set(active: boolean): void;
3542
+ }
3535
3543
  import { BufferGeometry } from "three";
3536
3544
  import * as THREE from "three";
3537
3545
  export declare class TransformHelper {