@thatopen/components 2.0.17 → 2.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,80 @@
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.0.18";
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
+ }
2
78
  import * as THREE from "three";
3
79
  import { Components } from "../Components";
4
80
  import { Component } from "../Types";
@@ -86,6 +162,182 @@ export declare class Raycasters extends Component implements Disposable {
86
162
  /** {@link Disposable.dispose} */
87
163
  dispose(): void;
88
164
  }
165
+ import { Component, Disposable, World, Event } from "../Types";
166
+ import { GridConfig, SimpleGrid } from "./src";
167
+ import { Components } from "../Components";
168
+ /**
169
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
170
+ */
171
+ export declare class Grids extends Component implements Disposable {
172
+ /**
173
+ * A unique identifier for the component.
174
+ * This UUID is used to register the component within the Components system.
175
+ */
176
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
177
+ /**
178
+ * A map of world UUIDs to their corresponding grid instances.
179
+ */
180
+ list: Map<string, SimpleGrid>;
181
+ /**
182
+ * The default configuration for grid creation.
183
+ */
184
+ config: Required<GridConfig>;
185
+ /** {@link Disposable.onDisposed} */
186
+ readonly onDisposed: Event<unknown>;
187
+ /** {@link Component.enabled} */
188
+ enabled: boolean;
189
+ constructor(components: Components);
190
+ /**
191
+ * Creates a new grid for the given world.
192
+ * Throws an error if a grid already exists for the world.
193
+ *
194
+ * @param world - The world to create the grid for.
195
+ * @returns The newly created grid.
196
+ *
197
+ * @throws Will throw an error if a grid already exists for the given world.
198
+ */
199
+ create(world: World): SimpleGrid;
200
+ /**
201
+ * Deletes the grid associated with the given world.
202
+ * If a grid does not exist for the given world, this method does nothing.
203
+ *
204
+ * @param world - The world for which to delete the grid.
205
+ *
206
+ * @remarks
207
+ * This method will dispose of the grid and remove it from the internal list.
208
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
209
+ */
210
+ delete(world: World): void;
211
+ /** {@link Disposable.dispose} */
212
+ dispose(): void;
213
+ }
214
+ import * as THREE from "three";
215
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
216
+ import { SimplePlane } from "./src";
217
+ import { Components } from "../Components";
218
+ /**
219
+ * 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).
220
+ *
221
+ * @param components - the instance of {@link Components} used.
222
+ * E.g. {@link SimplePlane}.
223
+ */
224
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
225
+ /**
226
+ * A unique identifier for the component.
227
+ * This UUID is used to register the component within the Components system.
228
+ */
229
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
230
+ /** Event that fires when the user starts dragging a clipping plane. */
231
+ readonly onBeforeDrag: Event<void>;
232
+ /** Event that fires when the user stops dragging a clipping plane. */
233
+ readonly onAfterDrag: Event<void>;
234
+ /**
235
+ * Event that fires when the user starts creating a clipping plane.
236
+ */
237
+ readonly onBeforeCreate: Event<unknown>;
238
+ /**
239
+ * Event that fires when the user cancels the creation of a clipping plane.
240
+ */
241
+ readonly onBeforeCancel: Event<unknown>;
242
+ /**
243
+ * Event that fires after the user cancels the creation of a clipping plane.
244
+ */
245
+ readonly onAfterCancel: Event<unknown>;
246
+ /**
247
+ * Event that fires when the user starts deleting a clipping plane.
248
+ */
249
+ readonly onBeforeDelete: Event<unknown>;
250
+ /**
251
+ * Event that fires after a clipping plane has been created.
252
+ * @param plane - The newly created clipping plane.
253
+ */
254
+ readonly onAfterCreate: Event<SimplePlane>;
255
+ /**
256
+ * Event that fires after a clipping plane has been deleted.
257
+ * @param plane - The deleted clipping plane.
258
+ */
259
+ readonly onAfterDelete: Event<SimplePlane>;
260
+ /** {@link Disposable.onDisposed} */
261
+ readonly onDisposed: Event<string>;
262
+ /**
263
+ * Whether to force the clipping plane to be orthogonal in the Y direction
264
+ * (up). This is desirable when clipping a building horizontally and a
265
+ * clipping plane is created in its roof, which might have a slight
266
+ * slope for draining purposes.
267
+ */
268
+ orthogonalY: boolean;
269
+ /**
270
+ * The tolerance that determines whether an almost-horizontal clipping plane
271
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
272
+ * has to be 'true' for this to apply.
273
+ */
274
+ toleranceOrthogonalY: number;
275
+ /**
276
+ * The type of clipping plane to be created.
277
+ * Default is {@link SimplePlane}.
278
+ */
279
+ Type: new (...args: any) => SimplePlane;
280
+ /**
281
+ * A list of all the clipping planes created by this component.
282
+ */
283
+ list: SimplePlane[];
284
+ /** The material used in all the clipping planes. */
285
+ private _material;
286
+ private _size;
287
+ private _enabled;
288
+ private _visible;
289
+ /** {@link Component.enabled} */
290
+ get enabled(): boolean;
291
+ /** {@link Component.enabled} */
292
+ set enabled(state: boolean);
293
+ /** {@link Hideable.visible } */
294
+ get visible(): boolean;
295
+ /** {@link Hideable.visible } */
296
+ set visible(state: boolean);
297
+ /** The material of the clipping plane representation. */
298
+ get material(): THREE.MeshBasicMaterial;
299
+ /** The material of the clipping plane representation. */
300
+ set material(material: THREE.MeshBasicMaterial);
301
+ /** The size of the geometric representation of the clippings planes. */
302
+ get size(): number;
303
+ /** The size of the geometric representation of the clippings planes. */
304
+ set size(size: number);
305
+ constructor(components: Components);
306
+ /** {@link Disposable.dispose} */
307
+ dispose(): void;
308
+ /** {@link Createable.create} */
309
+ create(world: World): void;
310
+ /**
311
+ * Creates a plane in a certain place and with a certain orientation,
312
+ * without the need of the mouse.
313
+ *
314
+ * @param world - the world where this plane should be created.
315
+ * @param normal - the orientation of the clipping plane.
316
+ * @param point - the position of the clipping plane.
317
+ * navigation.
318
+ */
319
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
320
+ /**
321
+ * {@link Createable.delete}
322
+ *
323
+ * @param world - the world where the plane to delete is.
324
+ * @param plane - the plane to delete. If undefined, the first plane
325
+ * found under the cursor will be deleted.
326
+ */
327
+ delete(world: World, plane?: SimplePlane): void;
328
+ /** Deletes all the existing clipping planes. */
329
+ deleteAll(): void;
330
+ private deletePlane;
331
+ private pickPlane;
332
+ private getAllPlaneMeshes;
333
+ private createPlaneFromIntersection;
334
+ private getWorldNormal;
335
+ private normalizePlaneDirectionY;
336
+ private newPlane;
337
+ private updateMaterialsAndPlanes;
338
+ private _onStartDragging;
339
+ private _onEndDragging;
340
+ }
89
341
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
90
342
  import { Components } from "../Components";
91
343
  import { SimpleWorld } from "./src";
@@ -153,85 +405,9 @@ export declare class Worlds extends Component implements Updateable, Disposable
153
405
  /** {@link Updateable.update} */
154
406
  update(delta?: number): void | Promise<void>;
155
407
  }
156
- import { Component, Disposable, Event } from "../Types";
157
- /**
158
- * 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.
159
- */
160
- export declare class Components implements Disposable {
161
- /**
162
- * The version of the @thatopen/components library.
163
- */
164
- static readonly release = "2.0.14";
165
- /** {@link Disposable.onDisposed} */
166
- readonly onDisposed: Event<void>;
167
- /**
168
- * The list of components created in this app.
169
- * The keys are UUIDs and the values are instances of the components.
170
- */
171
- readonly list: Map<string, Component>;
172
- /**
173
- * If disabled, the animation loop will be stopped.
174
- * Default value is false.
175
- */
176
- enabled: boolean;
177
- private _clock;
178
- /**
179
- * Adds a component to the list of components.
180
- * Throws an error if a component with the same UUID already exists.
181
- *
182
- * @param uuid - The unique identifier of the component.
183
- * @param instance - The instance of the component to be added.
184
- *
185
- * @throws Will throw an error if a component with the same UUID already exists.
186
- *
187
- * @internal
188
- */
189
- add(uuid: string, instance: Component): void;
190
- /**
191
- * Retrieves a component instance by its constructor function.
192
- * If the component does not exist in the list, it will be created and added.
193
- *
194
- * @template U - The type of the component to retrieve.
195
- * @param Component - The constructor function of the component to retrieve.
196
- *
197
- * @returns The instance of the requested component.
198
- *
199
- * @throws Will throw an error if a component with the same UUID already exists.
200
- *
201
- * @internal
202
- */
203
- get<U extends Component>(Component: new (components: Components) => U): U;
204
- constructor();
205
- /**
206
- * Initializes the Components instance.
207
- * This method starts the animation loop, sets the enabled flag to true,
208
- * and calls the update method.
209
- *
210
- * @returns {void}
211
- */
212
- init(): void;
213
- /**
214
- * Disposes the memory of all the components and tools of this instance of
215
- * the library. A memory leak will be created if:
216
- *
217
- * - An instance of the library ends up out of scope and this function isn't
218
- * called. This is especially relevant in Single Page Applications (React,
219
- * Angular, Vue, etc).
220
- *
221
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
222
- * referenced by a reference type (object or array).
223
- *
224
- * You can learn more about how Three.js handles memory leaks
225
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
226
- *
227
- */
228
- dispose(): void;
229
- private update;
230
- private static setupBVH;
231
- }
232
- import { MiniMap } from "./src";
233
- import { Component, Updateable, World, Event, Disposable } from "../Types";
234
- import { Components } from "../Components";
408
+ import { MiniMap } from "./src";
409
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
410
+ import { Components } from "../Components";
235
411
  /**
236
412
  * 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).
237
413
  */
@@ -276,55 +452,6 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
276
452
  /** {@link Updateable.update} */
277
453
  update(): void;
278
454
  }
279
- import { Component, Disposable, World, Event } from "../Types";
280
- import { GridConfig, SimpleGrid } from "./src";
281
- import { Components } from "../Components";
282
- /**
283
- * 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).
284
- */
285
- export declare class Grids extends Component implements Disposable {
286
- /**
287
- * A unique identifier for the component.
288
- * This UUID is used to register the component within the Components system.
289
- */
290
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
291
- /**
292
- * A map of world UUIDs to their corresponding grid instances.
293
- */
294
- list: Map<string, SimpleGrid>;
295
- /**
296
- * The default configuration for grid creation.
297
- */
298
- config: Required<GridConfig>;
299
- /** {@link Disposable.onDisposed} */
300
- readonly onDisposed: Event<unknown>;
301
- /** {@link Component.enabled} */
302
- enabled: boolean;
303
- constructor(components: Components);
304
- /**
305
- * Creates a new grid for the given world.
306
- * Throws an error if a grid already exists for the world.
307
- *
308
- * @param world - The world to create the grid for.
309
- * @returns The newly created grid.
310
- *
311
- * @throws Will throw an error if a grid already exists for the given world.
312
- */
313
- create(world: World): SimpleGrid;
314
- /**
315
- * Deletes the grid associated with the given world.
316
- * If a grid does not exist for the given world, this method does nothing.
317
- *
318
- * @param world - The world for which to delete the grid.
319
- *
320
- * @remarks
321
- * This method will dispose of the grid and remove it from the internal list.
322
- * If the world is disposed before calling this method, the grid will be automatically deleted.
323
- */
324
- delete(world: World): void;
325
- /** {@link Disposable.dispose} */
326
- dispose(): void;
327
- }
328
455
  import { Components } from "../Components";
329
456
  import { MeshCullerRenderer, CullerRendererSettings } from "./src";
330
457
  import { Component, Event, Disposable, World } from "../Types";
@@ -374,133 +501,6 @@ export declare class Cullers extends Component implements Disposable {
374
501
  dispose(): void;
375
502
  }
376
503
  import * as THREE from "three";
377
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
378
- import { SimplePlane } from "./src";
379
- import { Components } from "../Components";
380
- /**
381
- * 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).
382
- *
383
- * @param components - the instance of {@link Components} used.
384
- * E.g. {@link SimplePlane}.
385
- */
386
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
387
- /**
388
- * A unique identifier for the component.
389
- * This UUID is used to register the component within the Components system.
390
- */
391
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
392
- /** Event that fires when the user starts dragging a clipping plane. */
393
- readonly onBeforeDrag: Event<void>;
394
- /** Event that fires when the user stops dragging a clipping plane. */
395
- readonly onAfterDrag: Event<void>;
396
- /**
397
- * Event that fires when the user starts creating a clipping plane.
398
- */
399
- readonly onBeforeCreate: Event<unknown>;
400
- /**
401
- * Event that fires when the user cancels the creation of a clipping plane.
402
- */
403
- readonly onBeforeCancel: Event<unknown>;
404
- /**
405
- * Event that fires after the user cancels the creation of a clipping plane.
406
- */
407
- readonly onAfterCancel: Event<unknown>;
408
- /**
409
- * Event that fires when the user starts deleting a clipping plane.
410
- */
411
- readonly onBeforeDelete: Event<unknown>;
412
- /**
413
- * Event that fires after a clipping plane has been created.
414
- * @param plane - The newly created clipping plane.
415
- */
416
- readonly onAfterCreate: Event<SimplePlane>;
417
- /**
418
- * Event that fires after a clipping plane has been deleted.
419
- * @param plane - The deleted clipping plane.
420
- */
421
- readonly onAfterDelete: Event<SimplePlane>;
422
- /** {@link Disposable.onDisposed} */
423
- readonly onDisposed: Event<string>;
424
- /**
425
- * Whether to force the clipping plane to be orthogonal in the Y direction
426
- * (up). This is desirable when clipping a building horizontally and a
427
- * clipping plane is created in its roof, which might have a slight
428
- * slope for draining purposes.
429
- */
430
- orthogonalY: boolean;
431
- /**
432
- * The tolerance that determines whether an almost-horizontal clipping plane
433
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
434
- * has to be 'true' for this to apply.
435
- */
436
- toleranceOrthogonalY: number;
437
- /**
438
- * The type of clipping plane to be created.
439
- * Default is {@link SimplePlane}.
440
- */
441
- Type: new (...args: any) => SimplePlane;
442
- /**
443
- * A list of all the clipping planes created by this component.
444
- */
445
- list: SimplePlane[];
446
- /** The material used in all the clipping planes. */
447
- private _material;
448
- private _size;
449
- private _enabled;
450
- private _visible;
451
- /** {@link Component.enabled} */
452
- get enabled(): boolean;
453
- /** {@link Component.enabled} */
454
- set enabled(state: boolean);
455
- /** {@link Hideable.visible } */
456
- get visible(): boolean;
457
- /** {@link Hideable.visible } */
458
- set visible(state: boolean);
459
- /** The material of the clipping plane representation. */
460
- get material(): THREE.MeshBasicMaterial;
461
- /** The material of the clipping plane representation. */
462
- set material(material: THREE.MeshBasicMaterial);
463
- /** The size of the geometric representation of the clippings planes. */
464
- get size(): number;
465
- /** The size of the geometric representation of the clippings planes. */
466
- set size(size: number);
467
- constructor(components: Components);
468
- /** {@link Disposable.dispose} */
469
- dispose(): void;
470
- /** {@link Createable.create} */
471
- create(world: World): void;
472
- /**
473
- * Creates a plane in a certain place and with a certain orientation,
474
- * without the need of the mouse.
475
- *
476
- * @param world - the world where this plane should be created.
477
- * @param normal - the orientation of the clipping plane.
478
- * @param point - the position of the clipping plane.
479
- * navigation.
480
- */
481
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
482
- /**
483
- * {@link Createable.delete}
484
- *
485
- * @param world - the world where the plane to delete is.
486
- * @param plane - the plane to delete. If undefined, the first plane
487
- * found under the cursor will be deleted.
488
- */
489
- delete(world: World, plane?: SimplePlane): void;
490
- /** Deletes all the existing clipping planes. */
491
- deleteAll(): void;
492
- private deletePlane;
493
- private pickPlane;
494
- private getAllPlaneMeshes;
495
- private createPlaneFromIntersection;
496
- private getWorldNormal;
497
- private normalizePlaneDirectionY;
498
- private newPlane;
499
- private updateMaterialsAndPlanes;
500
- private _onStartDragging;
501
- private _onEndDragging;
502
- }
503
- import * as THREE from "three";
504
504
  import { Components } from "../Components";
505
505
  import { SimpleCamera } from "..";
506
506
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
@@ -564,7 +564,6 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
564
564
  private newOrthoCamera;
565
565
  private setOrthoPerspCameraAspect;
566
566
  }
567
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
568
567
  import * as THREE from "three";
569
568
  export declare function obbFromPoints(vertices: ArrayLike<number>): {
570
569
  center: THREE.Vector3;
@@ -573,9 +572,20 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
573
572
  transformation: THREE.Matrix4;
574
573
  };
575
574
  import * as THREE from "three";
576
- import { Component, Components, Disposable, Event, World } from "../core";
577
- /**
578
- * Configuration interface for the VertexPicker component.
575
+ export declare class MaterialsUtils {
576
+ static isTransparent(material: THREE.Material): boolean;
577
+ }
578
+ export declare class UUID {
579
+ private static _pattern;
580
+ private static _lut;
581
+ static create(): string;
582
+ static validate(uuid: string): void;
583
+ }
584
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
585
+ import * as THREE from "three";
586
+ import { Component, Components, Disposable, Event, World } from "../core";
587
+ /**
588
+ * Configuration interface for the VertexPicker component.
579
589
  */
580
590
  export interface VertexPickerConfig {
581
591
  /**
@@ -684,15 +694,146 @@ export declare class VertexPicker extends Component implements Disposable {
684
694
  private getVertices;
685
695
  private getVertex;
686
696
  }
687
- export declare class UUID {
688
- private static _pattern;
689
- private static _lut;
690
- static create(): string;
691
- static validate(uuid: string): void;
692
- }
693
- import * as THREE from "three";
694
- export declare class MaterialsUtils {
695
- static isTransparent(material: THREE.Material): boolean;
697
+ import * as WEBIFC from "web-ifc";
698
+ import { FragmentsGroup } from "@thatopen/fragments";
699
+ import { Disposable, Event, Component, Components } from "../../core";
700
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
701
+ export type { InverseAttribute, RelationsMap } from "./src/types";
702
+ /**
703
+ * 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).
704
+ */
705
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
706
+ /**
707
+ * A unique identifier for the component.
708
+ * This UUID is used to register the component within the Components system.
709
+ */
710
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
711
+ /** {@link Disposable.onDisposed} */
712
+ readonly onDisposed: Event<string>;
713
+ /**
714
+ * Event triggered when relations for a model have been indexed.
715
+ * This event provides the model's UUID and the relations map generated for that model.
716
+ *
717
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
718
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
719
+ * 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.
720
+ */
721
+ readonly onRelationsIndexed: Event<{
722
+ modelID: string;
723
+ relationsMap: RelationsMap;
724
+ }>;
725
+ /**
726
+ * Holds the relationship mappings for each model processed by the indexer.
727
+ * The structure is a map where each key is a model's UUID, and the value is another map.
728
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
729
+ * representing a specific relation type, and the value is an array of expressIDs of entities
730
+ * that are related through that relation type. This structure allows for efficient querying
731
+ * of entity relationships within a model.
732
+ */
733
+ readonly relationMaps: ModelsRelationMap;
734
+ /** {@link Component.enabled} */
735
+ enabled: boolean;
736
+ private _relToAttributesMap;
737
+ private _inverseAttributes;
738
+ private _ifcRels;
739
+ constructor(components: Components);
740
+ private onFragmentsDisposed;
741
+ private indexRelations;
742
+ /**
743
+ * Adds a relation map to the model's relations map.
744
+ *
745
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
746
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
747
+ *
748
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
749
+ */
750
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
751
+ /**
752
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
753
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
754
+ * and maps them in a structured way to facilitate quick access to related entities.
755
+ *
756
+ * The process involves querying the model for each relation type associated with the inverse attributes
757
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
758
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
759
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
760
+ * of entities that are related through that attribute.
761
+ *
762
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
763
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
764
+ * representation of the relations indexed by entity expressIDs and relation types.
765
+ * @throws An error if the model does not have properties loaded.
766
+ */
767
+ process(model: FragmentsGroup): Promise<RelationsMap>;
768
+ /**
769
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
770
+ *
771
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
772
+ * @param modelID - The unique identifier of the model within the WebIfc API.
773
+ * @returns A promise that resolves to the relations map for the processed model.
774
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
775
+ */
776
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
777
+ /**
778
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
779
+ * This method searches the indexed relation maps for the specified model and entity,
780
+ * returning the IDs of related entities if a match is found.
781
+ *
782
+ * @param model The 'FragmentsGroup' model containing the entity.
783
+ * @param expressID The unique identifier of the entity within the model.
784
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
785
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
786
+ * or the specified relation name is not indexed.
787
+ */
788
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
789
+ /**
790
+ * Serializes the relations of a given relation map into a JSON string.
791
+ * 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,
792
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
793
+ * The resulting object is then serialized into a JSON string.
794
+ *
795
+ * @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.
796
+ * @returns A JSON string representing the serialized relations of the given relation map.
797
+ */
798
+ serializeRelations(relationMap: RelationsMap): string;
799
+ /**
800
+ * Serializes the relations of a specific model into a JSON string.
801
+ * This method iterates through the relations indexed for the given model,
802
+ * organizing them into a structured object where each key is an expressID of an entity,
803
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
804
+ * The resulting object is then serialized into a JSON string.
805
+ *
806
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
807
+ * @returns A JSON string representing the serialized relations of the specified model.
808
+ * If the model has no indexed relations, 'null' is returned.
809
+ */
810
+ serializeModelRelations(model: FragmentsGroup): string | null;
811
+ /**
812
+ * Serializes all relations of every model processed by the indexer into a JSON string.
813
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
814
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
815
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
816
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
817
+ *
818
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
819
+ * If no relations have been indexed, an empty object is returned as a JSON string.
820
+ */
821
+ serializeAllRelations(): string;
822
+ /**
823
+ * Converts a JSON string representing relations between entities into a structured map.
824
+ * This method parses the JSON string to reconstruct the relations map that indexes
825
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
826
+ * and the values are maps where each key is a relation type ID and its value is an array
827
+ * of express IDs of entities related through that relation type.
828
+ *
829
+ * @param json The JSON string to be parsed into the relations map.
830
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
831
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
832
+ * is an array of express IDs (as numbers) of entities related through that relation type.
833
+ */
834
+ getRelationsMapFromJSON(json: string): RelationsMap;
835
+ /** {@link Disposable.dispose} */
836
+ dispose(): void;
696
837
  }
697
838
  import * as WEBIFC from "web-ifc";
698
839
  import * as FRAG from "@thatopen/fragments";
@@ -720,80 +861,189 @@ export declare class IfcJsonExporter extends Component {
720
861
  export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
721
862
  }
722
863
  import * as THREE from "three";
723
- import { Component, Components } from "../../core";
724
- /**
725
- * Represents an edge measurement result.
726
- */
727
- export interface MeasureEdge {
728
- /**
729
- * The distance between the two points of the edge.
730
- */
731
- distance: number;
732
- /**
733
- * The two points that define the edge.
734
- */
735
- points: THREE.Vector3[];
736
- }
864
+ import * as FRAGS from "@thatopen/fragments";
865
+ import { FragmentsGroup } from "@thatopen/fragments";
866
+ import { Component, Components, Disposable, Event } from "../../core";
737
867
  /**
738
- * 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).
868
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
739
869
  */
740
- export declare class MeasurementUtils extends Component {
741
- /**
742
- * A unique identifier for the component.
743
- * This UUID is used to register the component within the Components system.
744
- */
745
- static uuid: string;
870
+ export declare class BoundingBoxer extends Component implements Disposable {
871
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
746
872
  /** {@link Component.enabled} */
747
873
  enabled: boolean;
874
+ /** {@link Disposable.onDisposed} */
875
+ readonly onDisposed: Event<unknown>;
876
+ private _absoluteMin;
877
+ private _absoluteMax;
878
+ private _meshes;
748
879
  constructor(components: Components);
749
880
  /**
750
- * Utility method to calculate the distance from a point to a line segment.
881
+ * A static method to calculate the dimensions of a given bounding box.
751
882
  *
752
- * @param point - The point from which to calculate the distance.
753
- * @param lineStart - The start point of the line segment.
754
- * @param lineEnd - The end point of the line segment.
755
- * @param clamp - If true, the distance will be clamped to the line segment's length.
756
- * @returns The distance from the point to the line segment.
883
+ * @param bbox - The bounding box to calculate the dimensions for.
884
+ * @returns An object containing the width, height, depth, and center of the bounding box.
757
885
  */
758
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
886
+ static getDimensions(bbox: THREE.Box3): {
887
+ width: number;
888
+ height: number;
889
+ depth: number;
890
+ center: THREE.Vector3;
891
+ };
759
892
  /**
760
- * Method to get the face of a mesh that contains a given triangle index.
761
- * It also returns the edges of the found face and their indices.
893
+ * A static method to create a new bounding box boundary.
762
894
  *
763
- * @param mesh - The mesh to get the face from. It must be indexed.
764
- * @param triangleIndex - The index of the triangle within the mesh.
765
- * @param instance - The instance of the mesh (optional).
766
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
767
- */
768
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
769
- edges: MeasureEdge[];
770
- indices: Set<number>;
771
- } | null;
772
- /**
773
- * Method to get the vertices and normal of a mesh face at a given index.
774
- * It also applies instance transformation if provided.
895
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
896
+ * @returns A new THREE.Vector3 representing the boundary.
775
897
  *
776
- * @param mesh - The mesh to get the face from. It must be indexed.
777
- * @param faceIndex - The index of the face within the mesh.
778
- * @param instance - The instance of the mesh (optional).
779
- * @returns An object containing the vertices and normal of the face.
780
- * @throws Will throw an error if the geometry is not indexed.
898
+ * @remarks
899
+ * This method is used to create a new boundary for calculating bounding boxes.
900
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
901
+ * depending on the value of the 'positive' parameter.
902
+ *
903
+ * @example
904
+ * '''typescript
905
+ * const positiveBound = BoundingBoxer.newBound(true);
906
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
907
+ *
908
+ * const negativeBound = BoundingBoxer.newBound(false);
909
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
910
+ * '''
781
911
  */
782
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
783
- p1: THREE.Vector3;
784
- p2: THREE.Vector3;
785
- p3: THREE.Vector3;
786
- faceNormal: THREE.Vector3;
787
- };
912
+ static newBound(positive: boolean): THREE.Vector3;
788
913
  /**
789
- * Method to round the vector's components to a specified number of decimal places.
790
- * This is used to ensure numerical precision in edge detection.
914
+ * A static method to calculate the bounding box of a set of points.
791
915
  *
792
- * @param vector - The vector to round.
793
- * @returns The vector with rounded components.
916
+ * @param points - An array of THREE.Vector3 representing the points.
917
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
918
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
919
+ * @returns A THREE.Box3 representing the bounding box of the given points.
920
+ *
921
+ * @remarks
922
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
923
+ * If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
924
+ *
925
+ * @example
926
+ * '''typescript
927
+ * const points = [
928
+ * new THREE.Vector3(1, 2, 3),
929
+ * new THREE.Vector3(4, 5, 6),
930
+ * new THREE.Vector3(7, 8, 9),
931
+ * ];
932
+ *
933
+ * const bbox = BoundingBoxer.getBounds(points);
934
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
935
+ * '''
794
936
  */
795
- round(vector: THREE.Vector3): void;
796
- private getFaceData;
937
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
938
+ /** {@link Disposable.dispose} */
939
+ dispose(): void;
940
+ /**
941
+ * Returns the bounding box of the calculated fragments.
942
+ *
943
+ * @returns A new THREE.Box3 instance representing the bounding box.
944
+ *
945
+ * @remarks
946
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
947
+ * The returned box represents the bounding box of the calculated fragments.
948
+ *
949
+ * @example
950
+ * '''typescript
951
+ * const boundingBox = boundingBoxer.get();
952
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
953
+ * '''
954
+ */
955
+ get(): THREE.Box3;
956
+ /**
957
+ * Calculates and returns a sphere that encompasses the entire bounding box.
958
+ *
959
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
960
+ *
961
+ * @remarks
962
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
963
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
964
+ * The radius is calculated as the distance from the center to the minimum bound.
965
+ *
966
+ * @example
967
+ * '''typescript
968
+ * const boundingBoxer = components.get(BoundingBoxer);
969
+ * boundingBoxer.add(fragmentsGroup);
970
+ * const boundingSphere = boundingBoxer.getSphere();
971
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
972
+ * '''
973
+ */
974
+ getSphere(): THREE.Sphere;
975
+ /**
976
+ * Returns a THREE.Mesh instance representing the bounding box.
977
+ *
978
+ * @returns A new THREE.Mesh instance representing the bounding box.
979
+ *
980
+ * @remarks
981
+ * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
982
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
983
+ * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
984
+ * The position of the mesh is set to the center of the bounding box.
985
+ *
986
+ * @example
987
+ * '''typescript
988
+ * const boundingBoxer = components.get(BoundingBoxer);
989
+ * boundingBoxer.add(fragmentsGroup);
990
+ * const boundingBoxMesh = boundingBoxer.getMesh();
991
+ * scene.add(boundingBoxMesh);
992
+ * '''
993
+ */
994
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
995
+ /**
996
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
997
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
998
+ *
999
+ * @remarks
1000
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
1001
+ * It ensures that the bounding box calculations are accurate and up-to-date.
1002
+ *
1003
+ * @example
1004
+ * '''typescript
1005
+ * const boundingBoxer = components.get(BoundingBoxer);
1006
+ * boundingBoxer.add(fragmentsGroup);
1007
+ * // ...
1008
+ * boundingBoxer.reset();
1009
+ * '''
1010
+ */
1011
+ reset(): void;
1012
+ /**
1013
+ * Adds a FragmentsGroup to the BoundingBoxer.
1014
+ *
1015
+ * @param group - The FragmentsGroup to add.
1016
+ *
1017
+ * @remarks
1018
+ * This method iterates through each fragment in the provided FragmentsGroup,
1019
+ * and calls the 'addMesh' method for each fragment's mesh.
1020
+ *
1021
+ * @example
1022
+ * '''typescript
1023
+ * const boundingBoxer = components.get(BoundingBoxer);
1024
+ * boundingBoxer.add(fragmentsGroup);
1025
+ * '''
1026
+ */
1027
+ add(group: FragmentsGroup): void;
1028
+ /**
1029
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1030
+ *
1031
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1032
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
1033
+ *
1034
+ * @remarks
1035
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1036
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1037
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1038
+ *
1039
+ * @example
1040
+ * '''typescript
1041
+ * const boundingBoxer = components.get(BoundingBoxer);
1042
+ * boundingBoxer.addMesh(mesh);
1043
+ * '''
1044
+ */
1045
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1046
+ private static getFragmentBounds;
797
1047
  }
798
1048
  import * as WEBIFC from "web-ifc";
799
1049
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1051,6 +1301,94 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1051
1301
  private registerChange;
1052
1302
  private newSingleProperty;
1053
1303
  }
1304
+ import * as FRAGS from "@thatopen/fragments";
1305
+ import { Components, Component } from "../../core";
1306
+ /**
1307
+ * 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).
1308
+ */
1309
+ export declare class Hider extends Component {
1310
+ /**
1311
+ * A unique identifier for the component.
1312
+ * This UUID is used to register the component within the Components system.
1313
+ */
1314
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1315
+ /** {@link Component.enabled} */
1316
+ enabled: boolean;
1317
+ constructor(components: Components);
1318
+ /**
1319
+ * Sets the visibility of fragments within the 3D scene.
1320
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1321
+ * If 'items' is provided, only the specified fragments will be affected.
1322
+ *
1323
+ * @param visible - The visibility state to set for the fragments.
1324
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1325
+ * If not provided, all fragments will be affected.
1326
+ *
1327
+ * @returns {void}
1328
+ */
1329
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1330
+ /**
1331
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1332
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1333
+ *
1334
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1335
+ * If not provided, all fragments will be isolated.
1336
+ *
1337
+ * @returns {void}
1338
+ */
1339
+ isolate(items: FRAGS.FragmentIdMap): void;
1340
+ private updateCulledVisibility;
1341
+ }
1342
+ import { Component, Disposable, Event, Components } from "../../core";
1343
+ /**
1344
+ * 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).
1345
+ */
1346
+ export declare class Exploder extends Component implements Disposable {
1347
+ /**
1348
+ * A unique identifier for the component.
1349
+ * This UUID is used to register the component within the Components system.
1350
+ */
1351
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1352
+ /** {@link Disposable.onDisposed} */
1353
+ readonly onDisposed: Event<unknown>;
1354
+ /** {@link Component.enabled} */
1355
+ enabled: boolean;
1356
+ /**
1357
+ * The height of the explosion animation.
1358
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1359
+ * Default value is 10.
1360
+ */
1361
+ height: number;
1362
+ /**
1363
+ * The group name used for the explosion animation.
1364
+ * This property specifies the group of fragments that will be affected by the explosion.
1365
+ * Default value is "storeys".
1366
+ */
1367
+ groupName: string;
1368
+ /**
1369
+ * A set of strings representing the exploded items.
1370
+ * This set is used to keep track of which items have been exploded.
1371
+ */
1372
+ list: Set<string>;
1373
+ constructor(components: Components);
1374
+ /** {@link Disposable.dispose} */
1375
+ dispose(): void;
1376
+ /**
1377
+ * Sets the explosion state of the fragments.
1378
+ *
1379
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1380
+ *
1381
+ * @remarks
1382
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1383
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1384
+ * If 'active' is false, the fragments are moved back to their original position.
1385
+ *
1386
+ * The method also keeps track of the exploded items using the 'list' set.
1387
+ *
1388
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1389
+ */
1390
+ set(active: boolean): void;
1391
+ }
1054
1392
  import * as THREE from "three";
1055
1393
  import * as FRAGS from "@thatopen/fragments";
1056
1394
  import { Disposable, Component, Event, Components } from "../../core";
@@ -1330,577 +1668,304 @@ export declare class IfcLoader extends Component implements Disposable {
1330
1668
  private getGeometry;
1331
1669
  private autoSetWasm;
1332
1670
  }
1671
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1672
+ import * as THREE from "three";
1333
1673
  import * as FRAGS from "@thatopen/fragments";
1334
- import { Components, Component } from "../../core";
1674
+ import { Component, Components, Event, Disposable } from "../../core";
1675
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1335
1676
  /**
1336
- * 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).
1677
+ * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
1337
1678
  */
1338
- export declare class Hider extends Component {
1679
+ export declare class FragmentsManager extends Component implements Disposable {
1339
1680
  /**
1340
1681
  * A unique identifier for the component.
1341
1682
  * This UUID is used to register the component within the Components system.
1342
1683
  */
1343
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1344
- /** {@link Component.enabled} */
1345
- enabled: boolean;
1346
- constructor(components: Components);
1684
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1685
+ /** {@link Disposable.onDisposed} */
1686
+ readonly onDisposed: Event<unknown>;
1347
1687
  /**
1348
- * Sets the visibility of fragments within the 3D scene.
1349
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1350
- * If 'items' is provided, only the specified fragments will be affected.
1351
- *
1352
- * @param visible - The visibility state to set for the fragments.
1353
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1354
- * If not provided, all fragments will be affected.
1355
- *
1356
- * @returns {void}
1688
+ * Event triggered when fragments are loaded.
1357
1689
  */
1358
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1690
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
1359
1691
  /**
1360
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1361
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1362
- *
1363
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1364
- * If not provided, all fragments will be isolated.
1365
- *
1366
- * @returns {void}
1367
- */
1368
- isolate(items: FRAGS.FragmentIdMap): void;
1369
- private updateCulledVisibility;
1370
- }
1371
- import * as WEBIFC from "web-ifc";
1372
- import { FragmentsGroup } from "@thatopen/fragments";
1373
- import { Disposable, Event, Component, Components } from "../../core";
1374
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1375
- export type { InverseAttribute, RelationsMap } from "./src/types";
1376
- /**
1377
- * 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).
1378
- */
1379
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1380
- /**
1381
- * A unique identifier for the component.
1382
- * This UUID is used to register the component within the Components system.
1692
+ * Event triggered when fragments are disposed.
1383
1693
  */
1384
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1385
- /** {@link Disposable.onDisposed} */
1386
- readonly onDisposed: Event<string>;
1694
+ readonly onFragmentsDisposed: Event<{
1695
+ groupID: string;
1696
+ fragmentIDs: string[];
1697
+ }>;
1387
1698
  /**
1388
- * Event triggered when relations for a model have been indexed.
1389
- * This event provides the model's UUID and the relations map generated for that model.
1390
- *
1391
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1392
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1393
- * 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.
1699
+ * Map containing all loaded fragments.
1700
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1394
1701
  */
1395
- readonly onRelationsIndexed: Event<{
1396
- modelID: string;
1397
- relationsMap: RelationsMap;
1398
- }>;
1702
+ readonly list: Map<string, Fragment>;
1399
1703
  /**
1400
- * Holds the relationship mappings for each model processed by the indexer.
1401
- * The structure is a map where each key is a model's UUID, and the value is another map.
1402
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1403
- * representing a specific relation type, and the value is an array of expressIDs of entities
1404
- * that are related through that relation type. This structure allows for efficient querying
1405
- * of entity relationships within a model.
1704
+ * Map containing all loaded fragment groups.
1705
+ * The key is the group's unique identifier, and the value is the group itself.
1406
1706
  */
1407
- readonly relationMaps: ModelsRelationMap;
1707
+ readonly groups: Map<string, FragmentsGroup>;
1708
+ baseCoordinationModel: string;
1408
1709
  /** {@link Component.enabled} */
1409
1710
  enabled: boolean;
1410
- private _relToAttributesMap;
1411
- private _inverseAttributes;
1412
- private _ifcRels;
1711
+ private _loader;
1712
+ /**
1713
+ * Getter for the meshes of all fragments in the FragmentsManager.
1714
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1715
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1716
+ */
1717
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1413
1718
  constructor(components: Components);
1414
- private onFragmentsDisposed;
1415
- private indexRelations;
1719
+ /** {@link Disposable.dispose} */
1720
+ dispose(): void;
1416
1721
  /**
1417
- * Adds a relation map to the model's relations map.
1418
- *
1419
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1420
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1722
+ * Dispose of a specific fragment group.
1723
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1724
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1421
1725
  *
1422
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1726
+ * @param group - The fragment group to be disposed.
1423
1727
  */
1424
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1728
+ disposeGroup(group: FragmentsGroup): void;
1425
1729
  /**
1426
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1427
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1428
- * and maps them in a structured way to facilitate quick access to related entities.
1429
- *
1430
- * The process involves querying the model for each relation type associated with the inverse attributes
1431
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1432
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1433
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1434
- * of entities that are related through that attribute.
1435
- *
1436
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1437
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1438
- * representation of the relations indexed by entity expressIDs and relation types.
1439
- * @throws An error if the model does not have properties loaded.
1730
+ * Loads a binary file that contain fragment geometry.
1731
+ * @param data - The binary data to load.
1732
+ * @param config - Optional configuration for loading.
1733
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1734
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1735
+ * @returns The loaded FragmentsGroup.
1440
1736
  */
1441
- process(model: FragmentsGroup): Promise<RelationsMap>;
1737
+ load(data: Uint8Array, config?: Partial<{
1738
+ coordinate: boolean;
1739
+ name: string;
1740
+ properties: FRAGS.IfcProperties;
1741
+ relationsMap: RelationsMap;
1742
+ }>): FragmentsGroup;
1442
1743
  /**
1443
- * Processes a given model from a WebIfc API to index its IFC entities relations.
1444
- *
1445
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1446
- * @param modelID - The unique identifier of the model within the WebIfc API.
1447
- * @returns A promise that resolves to the relations map for the processed model.
1448
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1744
+ * Export the specified fragmentsgroup to binary data.
1745
+ * @param group - the fragments group to be exported.
1746
+ * @returns the exported data as binary buffer.
1449
1747
  */
1450
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1748
+ export(group: FragmentsGroup): Uint8Array;
1451
1749
  /**
1452
- * Retrieves the relations of a specific entity within a model based on the given relation name.
1453
- * This method searches the indexed relation maps for the specified model and entity,
1454
- * returning the IDs of related entities if a match is found.
1455
- *
1456
- * @param model The 'FragmentsGroup' model containing the entity.
1457
- * @param expressID The unique identifier of the entity within the model.
1458
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1459
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1460
- * or the specified relation name is not indexed.
1750
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1751
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1752
+ * @returns A map of model IDs to sets of express IDs.
1461
1753
  */
1462
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1754
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1755
+ [modelID: string]: Set<number>;
1756
+ };
1463
1757
  /**
1464
- * Serializes the relations of a given relation map into a JSON string.
1465
- * 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,
1466
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1467
- * The resulting object is then serialized into a JSON string.
1468
- *
1469
- * @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.
1470
- * @returns A JSON string representing the serialized relations of the given relation map.
1758
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1759
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1760
+ * @returns A fragment ID map.
1761
+ * @remarks
1762
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1763
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1764
+ * The fragment ID maps are then merged into a single map and returned.
1765
+ * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1471
1766
  */
1472
- serializeRelations(relationMap: RelationsMap): string;
1767
+ modelIdToFragmentIdMap(modelIdMap: {
1768
+ [modelID: string]: Set<number>;
1769
+ }): FRAGS.FragmentIdMap;
1473
1770
  /**
1474
- * Serializes the relations of a specific model into a JSON string.
1475
- * This method iterates through the relations indexed for the given model,
1476
- * organizing them into a structured object where each key is an expressID of an entity,
1477
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1478
- * The resulting object is then serialized into a JSON string.
1771
+ * Applies coordinate transformation to the provided models.
1772
+ * If no models are provided, all groups are used.
1773
+ * The first model in the list becomes the base model for coordinate transformation.
1774
+ * All other models are then transformed to match the base model's coordinate system.
1479
1775
  *
1480
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1481
- * @returns A JSON string representing the serialized relations of the specified model.
1482
- * If the model has no indexed relations, 'null' is returned.
1776
+ * @param models - The models to apply coordinate transformation to.
1777
+ * If not provided, all groups are used.
1778
+ *
1779
+ * @returns {void}
1483
1780
  */
1484
- serializeModelRelations(model: FragmentsGroup): string | null;
1781
+ coordinate(models?: FragmentsGroup[]): void;
1782
+ }
1783
+ import * as THREE from "three";
1784
+ import { Component, Components } from "../../core";
1785
+ /**
1786
+ * Represents an edge measurement result.
1787
+ */
1788
+ export interface MeasureEdge {
1485
1789
  /**
1486
- * Serializes all relations of every model processed by the indexer into a JSON string.
1487
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1488
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1489
- * and its value is another object mapping entity expressIDs to their related entities, categorized
1490
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1491
- *
1492
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1493
- * If no relations have been indexed, an empty object is returned as a JSON string.
1790
+ * The distance between the two points of the edge.
1494
1791
  */
1495
- serializeAllRelations(): string;
1792
+ distance: number;
1496
1793
  /**
1497
- * Converts a JSON string representing relations between entities into a structured map.
1498
- * This method parses the JSON string to reconstruct the relations map that indexes
1499
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1500
- * and the values are maps where each key is a relation type ID and its value is an array
1501
- * of express IDs of entities related through that relation type.
1502
- *
1503
- * @param json The JSON string to be parsed into the relations map.
1504
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1505
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1506
- * is an array of express IDs (as numbers) of entities related through that relation type.
1794
+ * The two points that define the edge.
1507
1795
  */
1508
- getRelationsMapFromJSON(json: string): RelationsMap;
1509
- /** {@link Disposable.dispose} */
1510
- dispose(): void;
1796
+ points: THREE.Vector3[];
1511
1797
  }
1512
- import * as THREE from "three";
1513
- import * as FRAGS from "@thatopen/fragments";
1514
- import { FragmentsGroup } from "@thatopen/fragments";
1515
- import { Component, Components, Disposable, Event } from "../../core";
1516
1798
  /**
1517
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
1799
+ * 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).
1518
1800
  */
1519
- export declare class BoundingBoxer extends Component implements Disposable {
1520
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
1801
+ export declare class MeasurementUtils extends Component {
1802
+ /**
1803
+ * A unique identifier for the component.
1804
+ * This UUID is used to register the component within the Components system.
1805
+ */
1806
+ static uuid: string;
1521
1807
  /** {@link Component.enabled} */
1522
1808
  enabled: boolean;
1523
- /** {@link Disposable.onDisposed} */
1524
- readonly onDisposed: Event<unknown>;
1525
- private _absoluteMin;
1526
- private _absoluteMax;
1527
- private _meshes;
1528
1809
  constructor(components: Components);
1529
1810
  /**
1530
- * A static method to calculate the dimensions of a given bounding box.
1811
+ * Utility method to calculate the distance from a point to a line segment.
1531
1812
  *
1532
- * @param bbox - The bounding box to calculate the dimensions for.
1533
- * @returns An object containing the width, height, depth, and center of the bounding box.
1813
+ * @param point - The point from which to calculate the distance.
1814
+ * @param lineStart - The start point of the line segment.
1815
+ * @param lineEnd - The end point of the line segment.
1816
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
1817
+ * @returns The distance from the point to the line segment.
1534
1818
  */
1535
- static getDimensions(bbox: THREE.Box3): {
1536
- width: number;
1537
- height: number;
1538
- depth: number;
1539
- center: THREE.Vector3;
1540
- };
1819
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1541
1820
  /**
1542
- * A static method to create a new bounding box boundary.
1543
- *
1544
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
1545
- * @returns A new THREE.Vector3 representing the boundary.
1546
- *
1547
- * @remarks
1548
- * This method is used to create a new boundary for calculating bounding boxes.
1549
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
1550
- * depending on the value of the 'positive' parameter.
1551
- *
1552
- * @example
1553
- * '''typescript
1554
- * const positiveBound = BoundingBoxer.newBound(true);
1555
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
1821
+ * Method to get the face of a mesh that contains a given triangle index.
1822
+ * It also returns the edges of the found face and their indices.
1556
1823
  *
1557
- * const negativeBound = BoundingBoxer.newBound(false);
1558
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
1559
- * '''
1824
+ * @param mesh - The mesh to get the face from. It must be indexed.
1825
+ * @param triangleIndex - The index of the triangle within the mesh.
1826
+ * @param instance - The instance of the mesh (optional).
1827
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1560
1828
  */
1561
- static newBound(positive: boolean): THREE.Vector3;
1829
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1830
+ edges: MeasureEdge[];
1831
+ indices: Set<number>;
1832
+ } | null;
1562
1833
  /**
1563
- * A static method to calculate the bounding box of a set of points.
1564
- *
1565
- * @param points - An array of THREE.Vector3 representing the points.
1566
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
1567
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
1568
- * @returns A THREE.Box3 representing the bounding box of the given points.
1569
- *
1570
- * @remarks
1571
- * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
1572
- * If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
1573
- *
1574
- * @example
1575
- * '''typescript
1576
- * const points = [
1577
- * new THREE.Vector3(1, 2, 3),
1578
- * new THREE.Vector3(4, 5, 6),
1579
- * new THREE.Vector3(7, 8, 9),
1580
- * ];
1834
+ * Method to get the vertices and normal of a mesh face at a given index.
1835
+ * It also applies instance transformation if provided.
1581
1836
  *
1582
- * const bbox = BoundingBoxer.getBounds(points);
1583
- * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
1584
- * '''
1837
+ * @param mesh - The mesh to get the face from. It must be indexed.
1838
+ * @param faceIndex - The index of the face within the mesh.
1839
+ * @param instance - The instance of the mesh (optional).
1840
+ * @returns An object containing the vertices and normal of the face.
1841
+ * @throws Will throw an error if the geometry is not indexed.
1585
1842
  */
1586
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
1587
- /** {@link Disposable.dispose} */
1588
- dispose(): void;
1843
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1844
+ p1: THREE.Vector3;
1845
+ p2: THREE.Vector3;
1846
+ p3: THREE.Vector3;
1847
+ faceNormal: THREE.Vector3;
1848
+ };
1589
1849
  /**
1590
- * Returns the bounding box of the calculated fragments.
1591
- *
1592
- * @returns A new THREE.Box3 instance representing the bounding box.
1593
- *
1594
- * @remarks
1595
- * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
1596
- * The returned box represents the bounding box of the calculated fragments.
1850
+ * Method to round the vector's components to a specified number of decimal places.
1851
+ * This is used to ensure numerical precision in edge detection.
1597
1852
  *
1598
- * @example
1599
- * '''typescript
1600
- * const boundingBox = boundingBoxer.get();
1601
- * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
1602
- * '''
1853
+ * @param vector - The vector to round.
1854
+ * @returns The vector with rounded components.
1603
1855
  */
1604
- get(): THREE.Box3;
1856
+ round(vector: THREE.Vector3): void;
1857
+ private getFaceData;
1858
+ }
1859
+ import * as WEBIFC from "web-ifc";
1860
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
1861
+ import { PropertiesStreamingSettings } from "./src";
1862
+ /**
1863
+ * 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).
1864
+ */
1865
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
1605
1866
  /**
1606
- * Calculates and returns a sphere that encompasses the entire bounding box.
1607
- *
1608
- * @returns A new THREE.Sphere instance representing the calculated sphere.
1609
- *
1610
- * @remarks
1611
- * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
1612
- * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
1613
- * The radius is calculated as the distance from the center to the minimum bound.
1614
- *
1615
- * @example
1616
- * '''typescript
1617
- * const boundingBoxer = components.get(BoundingBoxer);
1618
- * boundingBoxer.add(fragmentsGroup);
1619
- * const boundingSphere = boundingBoxer.getSphere();
1620
- * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
1621
- * '''
1867
+ * A unique identifier for the component.
1868
+ * This UUID is used to register the component within the Components system.
1622
1869
  */
1623
- getSphere(): THREE.Sphere;
1870
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1624
1871
  /**
1625
- * Returns a THREE.Mesh instance representing the bounding box.
1626
- *
1627
- * @returns A new THREE.Mesh instance representing the bounding box.
1628
- *
1629
- * @remarks
1630
- * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
1631
- * It then creates a new THREE.BoxGeometry with the calculated dimensions.
1632
- * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
1633
- * The position of the mesh is set to the center of the bounding box.
1634
- *
1635
- * @example
1636
- * '''typescript
1637
- * const boundingBoxer = components.get(BoundingBoxer);
1638
- * boundingBoxer.add(fragmentsGroup);
1639
- * const boundingBoxMesh = boundingBoxer.getMesh();
1640
- * scene.add(boundingBoxMesh);
1641
- * '''
1872
+ * An event that is triggered when properties are streamed from the IFC file.
1873
+ * The event provides the type of the IFC entity and the corresponding data.
1642
1874
  */
1643
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1875
+ readonly onPropertiesStreamed: AsyncEvent<{
1876
+ type: number;
1877
+ data: {
1878
+ [id: number]: any;
1879
+ };
1880
+ }>;
1644
1881
  /**
1645
- * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
1646
- * This method is used to prepare the BoundingBoxer for a new set of fragments.
1647
- *
1648
- * @remarks
1649
- * This method is called when a new set of fragments is added to the BoundingBoxer.
1650
- * It ensures that the bounding box calculations are accurate and up-to-date.
1651
- *
1652
- * @example
1653
- * '''typescript
1654
- * const boundingBoxer = components.get(BoundingBoxer);
1655
- * boundingBoxer.add(fragmentsGroup);
1656
- * // ...
1657
- * boundingBoxer.reset();
1658
- * '''
1882
+ * An event that is triggered to indicate the progress of the streaming process.
1883
+ * The event provides a number between 0 and 1 representing the progress percentage.
1659
1884
  */
1660
- reset(): void;
1885
+ readonly onProgress: AsyncEvent<number>;
1661
1886
  /**
1662
- * Adds a FragmentsGroup to the BoundingBoxer.
1663
- *
1664
- * @param group - The FragmentsGroup to add.
1665
- *
1666
- * @remarks
1667
- * This method iterates through each fragment in the provided FragmentsGroup,
1668
- * and calls the 'addMesh' method for each fragment's mesh.
1669
- *
1670
- * @example
1671
- * '''typescript
1672
- * const boundingBoxer = components.get(BoundingBoxer);
1673
- * boundingBoxer.add(fragmentsGroup);
1674
- * '''
1887
+ * An event that is triggered when indices are streamed from the IFC file.
1888
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1675
1889
  */
1676
- add(group: FragmentsGroup): void;
1890
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1891
+ /** {@link Disposable.onDisposed} */
1892
+ readonly onDisposed: Event<string>;
1893
+ /** {@link Component.enabled} */
1894
+ enabled: boolean;
1677
1895
  /**
1678
- * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1679
- *
1680
- * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1681
- * @param itemIDs - An optional iterable of numbers representing the item IDs.
1896
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1897
+ */
1898
+ settings: PropertiesStreamingSettings;
1899
+ /**
1900
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1901
+ */
1902
+ webIfc: WEBIFC.IfcAPI;
1903
+ /** {@link Disposable.dispose} */
1904
+ dispose(): Promise<void>;
1905
+ /**
1906
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1682
1907
  *
1683
- * @remarks
1684
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1685
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1686
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1908
+ * @param data - The Uint8Array containing the IFC file data.
1909
+ * @returns A Promise that resolves when the streaming process is complete.
1910
+ */
1911
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1912
+ /**
1913
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1687
1914
  *
1688
- * @example
1689
- * '''typescript
1690
- * const boundingBoxer = components.get(BoundingBoxer);
1691
- * boundingBoxer.addMesh(mesh);
1692
- * '''
1915
+ * @param loadCallback - A callback function that loads the IFC file data.
1916
+ * @returns A Promise that resolves when the streaming process is complete.
1693
1917
  */
1694
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1695
- private static getFragmentBounds;
1918
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1919
+ private readIfcFile;
1920
+ private streamIfcFile;
1921
+ private streamAllProperties;
1922
+ private cleanUp;
1696
1923
  }
1697
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1698
- import * as THREE from "three";
1699
- import * as FRAGS from "@thatopen/fragments";
1700
- import { Component, Components, Event, Disposable } from "../../core";
1701
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1924
+ import * as WEBIFC from "web-ifc";
1925
+ import { Components, Disposable, Event, Component } from "../../core";
1926
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1702
1927
  /**
1703
- * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
1928
+ * 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).
1704
1929
  */
1705
- export declare class FragmentsManager extends Component implements Disposable {
1930
+ export declare class IfcGeometryTiler extends Component implements Disposable {
1706
1931
  /**
1707
1932
  * A unique identifier for the component.
1708
1933
  * This UUID is used to register the component within the Components system.
1709
1934
  */
1710
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1711
- /** {@link Disposable.onDisposed} */
1712
- readonly onDisposed: Event<unknown>;
1935
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1713
1936
  /**
1714
- * Event triggered when fragments are loaded.
1937
+ * Event triggered when geometry is streamed.
1938
+ * Contains the streamed geometry data and its buffer.
1715
1939
  */
1716
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
1940
+ readonly onGeometryStreamed: Event<{
1941
+ buffer: Uint8Array;
1942
+ data: StreamedGeometries;
1943
+ }>;
1717
1944
  /**
1718
- * Event triggered when fragments are disposed.
1945
+ * Event triggered when assets are streamed.
1946
+ * Contains the streamed assets.
1719
1947
  */
1720
- readonly onFragmentsDisposed: Event<{
1721
- groupID: string;
1722
- fragmentIDs: string[];
1723
- }>;
1948
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
1724
1949
  /**
1725
- * Map containing all loaded fragments.
1726
- * The key is the fragment's unique identifier, and the value is the fragment itself.
1950
+ * Event triggered to indicate the progress of the streaming process.
1951
+ * Contains the progress percentage.
1727
1952
  */
1728
- readonly list: Map<string, Fragment>;
1953
+ readonly onProgress: Event<number>;
1729
1954
  /**
1730
- * Map containing all loaded fragment groups.
1731
- * The key is the group's unique identifier, and the value is the group itself.
1955
+ * Event triggered when the IFC file is loaded.
1956
+ * Contains the loaded IFC file data.
1732
1957
  */
1733
- readonly groups: Map<string, FragmentsGroup>;
1734
- baseCoordinationModel: string;
1958
+ readonly onIfcLoaded: Event<Uint8Array>;
1959
+ /** {@link Disposable.onDisposed} */
1960
+ readonly onDisposed: Event<unknown>;
1961
+ /**
1962
+ * Settings for the IfcGeometryTiler.
1963
+ */
1964
+ settings: IfcStreamingSettings;
1735
1965
  /** {@link Component.enabled} */
1736
1966
  enabled: boolean;
1737
- private _loader;
1738
1967
  /**
1739
- * Getter for the meshes of all fragments in the FragmentsManager.
1740
- * It iterates over the fragments in the list and pushes their meshes into an array.
1741
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1742
- */
1743
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1744
- constructor(components: Components);
1745
- /** {@link Disposable.dispose} */
1746
- dispose(): void;
1747
- /**
1748
- * Dispose of a specific fragment group.
1749
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
1750
- * disposes of the group, and triggers the onFragmentsDisposed event.
1751
- *
1752
- * @param group - The fragment group to be disposed.
1753
- */
1754
- disposeGroup(group: FragmentsGroup): void;
1755
- /**
1756
- * Loads a binary file that contain fragment geometry.
1757
- * @param data - The binary data to load.
1758
- * @param config - Optional configuration for loading.
1759
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1760
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1761
- * @returns The loaded FragmentsGroup.
1762
- */
1763
- load(data: Uint8Array, config?: Partial<{
1764
- coordinate: boolean;
1765
- name: string;
1766
- properties: FRAGS.IfcProperties;
1767
- relationsMap: RelationsMap;
1768
- }>): FragmentsGroup;
1769
- /**
1770
- * Export the specified fragmentsgroup to binary data.
1771
- * @param group - the fragments group to be exported.
1772
- * @returns the exported data as binary buffer.
1773
- */
1774
- export(group: FragmentsGroup): Uint8Array;
1775
- /**
1776
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1777
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1778
- * @returns A map of model IDs to sets of express IDs.
1779
- */
1780
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1781
- [modelID: string]: Set<number>;
1782
- };
1783
- /**
1784
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1785
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1786
- * @returns A fragment ID map.
1787
- * @remarks
1788
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1789
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1790
- * The fragment ID maps are then merged into a single map and returned.
1791
- * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1792
- */
1793
- modelIdToFragmentIdMap(modelIdMap: {
1794
- [modelID: string]: Set<number>;
1795
- }): FRAGS.FragmentIdMap;
1796
- /**
1797
- * Applies coordinate transformation to the provided models.
1798
- * If no models are provided, all groups are used.
1799
- * The first model in the list becomes the base model for coordinate transformation.
1800
- * All other models are then transformed to match the base model's coordinate system.
1801
- *
1802
- * @param models - The models to apply coordinate transformation to.
1803
- * If not provided, all groups are used.
1804
- *
1805
- * @returns {void}
1806
- */
1807
- coordinate(models?: FragmentsGroup[]): void;
1808
- }
1809
- import { Component, Disposable, Event, Components } from "../../core";
1810
- /**
1811
- * 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).
1812
- */
1813
- export declare class Exploder extends Component implements Disposable {
1814
- /**
1815
- * A unique identifier for the component.
1816
- * This UUID is used to register the component within the Components system.
1817
- */
1818
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1819
- /** {@link Disposable.onDisposed} */
1820
- readonly onDisposed: Event<unknown>;
1821
- /** {@link Component.enabled} */
1822
- enabled: boolean;
1823
- /**
1824
- * The height of the explosion animation.
1825
- * This property determines the vertical distance by which fragments are moved during the explosion.
1826
- * Default value is 10.
1827
- */
1828
- height: number;
1829
- /**
1830
- * The group name used for the explosion animation.
1831
- * This property specifies the group of fragments that will be affected by the explosion.
1832
- * Default value is "storeys".
1833
- */
1834
- groupName: string;
1835
- /**
1836
- * A set of strings representing the exploded items.
1837
- * This set is used to keep track of which items have been exploded.
1838
- */
1839
- list: Set<string>;
1840
- constructor(components: Components);
1841
- /** {@link Disposable.dispose} */
1842
- dispose(): void;
1843
- /**
1844
- * Sets the explosion state of the fragments.
1845
- *
1846
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1847
- *
1848
- * @remarks
1849
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1850
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1851
- * If 'active' is false, the fragments are moved back to their original position.
1852
- *
1853
- * The method also keeps track of the exploded items using the 'list' set.
1854
- *
1855
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1856
- */
1857
- set(active: boolean): void;
1858
- }
1859
- import * as WEBIFC from "web-ifc";
1860
- import { Components, Disposable, Event, Component } from "../../core";
1861
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1862
- /**
1863
- * 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).
1864
- */
1865
- export declare class IfcGeometryTiler extends Component implements Disposable {
1866
- /**
1867
- * A unique identifier for the component.
1868
- * This UUID is used to register the component within the Components system.
1869
- */
1870
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1871
- /**
1872
- * Event triggered when geometry is streamed.
1873
- * Contains the streamed geometry data and its buffer.
1874
- */
1875
- readonly onGeometryStreamed: Event<{
1876
- buffer: Uint8Array;
1877
- data: StreamedGeometries;
1878
- }>;
1879
- /**
1880
- * Event triggered when assets are streamed.
1881
- * Contains the streamed assets.
1882
- */
1883
- readonly onAssetStreamed: Event<StreamedAsset[]>;
1884
- /**
1885
- * Event triggered to indicate the progress of the streaming process.
1886
- * Contains the progress percentage.
1887
- */
1888
- readonly onProgress: Event<number>;
1889
- /**
1890
- * Event triggered when the IFC file is loaded.
1891
- * Contains the loaded IFC file data.
1892
- */
1893
- readonly onIfcLoaded: Event<Uint8Array>;
1894
- /** {@link Disposable.onDisposed} */
1895
- readonly onDisposed: Event<unknown>;
1896
- /**
1897
- * Settings for the IfcGeometryTiler.
1898
- */
1899
- settings: IfcStreamingSettings;
1900
- /** {@link Component.enabled} */
1901
- enabled: boolean;
1902
- /**
1903
- * The WebIFC API instance used for IFC file processing.
1968
+ * The WebIFC API instance used for IFC file processing.
1904
1969
  */
1905
1970
  webIfc: WEBIFC.IfcAPI;
1906
1971
  private _spatialTree;
@@ -1955,103 +2020,91 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
1955
2020
  private streamGeometries;
1956
2021
  }
1957
2022
  import * as WEBIFC from "web-ifc";
1958
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1959
- import { PropertiesStreamingSettings } from "./src";
2023
+ export interface IfcItemsCategories {
2024
+ [itemID: number]: number;
2025
+ }
2026
+ export declare class IfcCategories {
2027
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2028
+ }
1960
2029
  /**
1961
- * 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).
2030
+ * 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.
2031
+ *
2032
+ * @remarks
2033
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2034
+ * It is useful for identifying and processing different types of IFC elements in a project.
2035
+ *
1962
2036
  */
1963
- export declare class IfcPropertiesTiler extends Component implements Disposable {
2037
+ export declare const IfcElements: {
2038
+ [key: number]: string;
2039
+ };
2040
+ import * as FRAGS from "@thatopen/fragments";
2041
+ export declare class IfcPropertiesUtils {
2042
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2043
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2044
+ [attribute: string]: any;
2045
+ } | null>;
2046
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2047
+ [relatingID: number]: number[];
2048
+ }>;
2049
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2050
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2051
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2052
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2053
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2054
+ key: string | null;
2055
+ name: string | null;
2056
+ }>;
2057
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2058
+ key: string | null;
2059
+ value: number | null;
2060
+ }>;
2061
+ static isRel(expressID: number): boolean;
2062
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2063
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2064
+ }
2065
+ /**
2066
+ * A Set of unique numbers representing different types of IFC geometries.
2067
+ */
2068
+ export declare const GeometryTypes: Set<number>;
2069
+ /**
2070
+ * 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.
2071
+ */
2072
+ export declare const IfcCategoryMap: {
2073
+ [key: number]: string;
2074
+ };
2075
+ import * as THREE from "three";
2076
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2077
+ /**
2078
+ * A class representing a 2D minimap of a 3D world.
2079
+ */
2080
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2081
+ /** {@link Disposable.onDisposed} */
2082
+ readonly onDisposed: Event<unknown>;
2083
+ /** {@link Updateable.onAfterUpdate} */
2084
+ readonly onAfterUpdate: Event<unknown>;
2085
+ /** {@link Updateable.onBeforeUpdate} */
2086
+ readonly onBeforeUpdate: Event<unknown>;
2087
+ /** {@link Resizeable.onResize} */
2088
+ readonly onResize: Event<THREE.Vector2>;
1964
2089
  /**
1965
- * A unique identifier for the component.
1966
- * This UUID is used to register the component within the Components system.
2090
+ * The front offset of the minimap.
2091
+ * It determines how much the minimap's view is offset from the camera's view.
2092
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1967
2093
  */
1968
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
2094
+ frontOffset: number;
1969
2095
  /**
1970
- * An event that is triggered when properties are streamed from the IFC file.
1971
- * The event provides the type of the IFC entity and the corresponding data.
2096
+ * The override material for the minimap.
2097
+ * It is used to render the depth information of the world onto the minimap.
1972
2098
  */
1973
- readonly onPropertiesStreamed: AsyncEvent<{
1974
- type: number;
1975
- data: {
1976
- [id: number]: any;
1977
- };
1978
- }>;
2099
+ overrideMaterial: THREE.MeshDepthMaterial;
1979
2100
  /**
1980
- * An event that is triggered to indicate the progress of the streaming process.
1981
- * The event provides a number between 0 and 1 representing the progress percentage.
2101
+ * The background color of the minimap.
2102
+ * It is used to set the background color of the minimap's renderer.
1982
2103
  */
1983
- readonly onProgress: AsyncEvent<number>;
2104
+ backgroundColor: THREE.Color;
1984
2105
  /**
1985
- * An event that is triggered when indices are streamed from the IFC file.
1986
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1987
- */
1988
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1989
- /** {@link Disposable.onDisposed} */
1990
- readonly onDisposed: Event<string>;
1991
- /** {@link Component.enabled} */
1992
- enabled: boolean;
1993
- /**
1994
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1995
- */
1996
- settings: PropertiesStreamingSettings;
1997
- /**
1998
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1999
- */
2000
- webIfc: WEBIFC.IfcAPI;
2001
- /** {@link Disposable.dispose} */
2002
- dispose(): Promise<void>;
2003
- /**
2004
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
2005
- *
2006
- * @param data - The Uint8Array containing the IFC file data.
2007
- * @returns A Promise that resolves when the streaming process is complete.
2008
- */
2009
- streamFromBuffer(data: Uint8Array): Promise<void>;
2010
- /**
2011
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2012
- *
2013
- * @param loadCallback - A callback function that loads the IFC file data.
2014
- * @returns A Promise that resolves when the streaming process is complete.
2015
- */
2016
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2017
- private readIfcFile;
2018
- private streamIfcFile;
2019
- private streamAllProperties;
2020
- private cleanUp;
2021
- }
2022
- import * as THREE from "three";
2023
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2024
- /**
2025
- * A class representing a 2D minimap of a 3D world.
2026
- */
2027
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2028
- /** {@link Disposable.onDisposed} */
2029
- readonly onDisposed: Event<unknown>;
2030
- /** {@link Updateable.onAfterUpdate} */
2031
- readonly onAfterUpdate: Event<unknown>;
2032
- /** {@link Updateable.onBeforeUpdate} */
2033
- readonly onBeforeUpdate: Event<unknown>;
2034
- /** {@link Resizeable.onResize} */
2035
- readonly onResize: Event<THREE.Vector2>;
2036
- /**
2037
- * The front offset of the minimap.
2038
- * It determines how much the minimap's view is offset from the camera's view.
2039
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2040
- */
2041
- frontOffset: number;
2042
- /**
2043
- * The override material for the minimap.
2044
- * It is used to render the depth information of the world onto the minimap.
2045
- */
2046
- overrideMaterial: THREE.MeshDepthMaterial;
2047
- /**
2048
- * The background color of the minimap.
2049
- * It is used to set the background color of the minimap's renderer.
2050
- */
2051
- backgroundColor: THREE.Color;
2052
- /**
2053
- * The WebGL renderer for the minimap.
2054
- * It is used to render the minimap onto the screen.
2106
+ * The WebGL renderer for the minimap.
2107
+ * It is used to render the minimap onto the screen.
2055
2108
  */
2056
2109
  renderer: THREE.WebGLRenderer;
2057
2110
  /**
@@ -2108,151 +2161,11 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2108
2161
  resize(size?: THREE.Vector2): void;
2109
2162
  private updatePlanes;
2110
2163
  }
2111
- import * as WEBIFC from "web-ifc";
2112
- export interface IfcItemsCategories {
2113
- [itemID: number]: number;
2114
- }
2115
- export declare class IfcCategories {
2116
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2117
- }
2118
- import * as FRAGS from "@thatopen/fragments";
2119
- export declare class IfcPropertiesUtils {
2120
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2121
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2122
- [attribute: string]: any;
2123
- } | null>;
2124
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2125
- [relatingID: number]: number[];
2126
- }>;
2127
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2128
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2129
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2130
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2131
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2132
- key: string | null;
2133
- name: string | null;
2134
- }>;
2135
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2136
- key: string | null;
2137
- value: number | null;
2138
- }>;
2139
- static isRel(expressID: number): boolean;
2140
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2141
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2142
- }
2143
- /**
2144
- * 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.
2145
- *
2146
- * @remarks
2147
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2148
- * It is useful for identifying and processing different types of IFC elements in a project.
2149
- *
2150
- */
2151
- export declare const IfcElements: {
2152
- [key: number]: string;
2153
- };
2154
- /**
2155
- * A Set of unique numbers representing different types of IFC geometries.
2156
- */
2157
- export declare const GeometryTypes: Set<number>;
2158
- /**
2159
- * 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.
2160
- */
2161
- export declare const IfcCategoryMap: {
2162
- [key: number]: string;
2163
- };
2164
2164
  import { InverseAttribute } from "./types";
2165
2165
  export declare const relToAttributesMap: Map<number, {
2166
2166
  forRelating: InverseAttribute;
2167
2167
  forRelated: InverseAttribute;
2168
2168
  }>;
2169
- import * as THREE from "three";
2170
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2171
- /**
2172
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2173
- *
2174
- * @template T - The type of the scene. Default is BaseScene.
2175
- * @template U - The type of the camera. Default is BaseCamera.
2176
- * @template S - The type of the renderer. Default is BaseRenderer.
2177
- */
2178
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2179
- /**
2180
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2181
- */
2182
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2183
- /** {@link Updateable.onAfterUpdate} */
2184
- readonly onAfterUpdate: Event<unknown>;
2185
- /** {@link Updateable.onBeforeUpdate} */
2186
- readonly onBeforeUpdate: Event<unknown>;
2187
- /** {@link Disposable.onDisposed} */
2188
- readonly onDisposed: Event<unknown>;
2189
- /**
2190
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2191
- */
2192
- isDisposing: boolean;
2193
- /**
2194
- * Indicates whether the world is currently enabled.
2195
- * When disabled, the world will not be updated.
2196
- */
2197
- enabled: boolean;
2198
- /**
2199
- * A unique identifier for the world.
2200
- */
2201
- uuid: string;
2202
- /**
2203
- * An optional name for the world.
2204
- */
2205
- name?: string;
2206
- private _scene?;
2207
- private _camera?;
2208
- private _renderer;
2209
- /**
2210
- * Getter for the scene. If no scene is initialized, it throws an error.
2211
- * @returns The current scene.
2212
- */
2213
- get scene(): T;
2214
- /**
2215
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2216
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2217
- * @param scene - The new scene to be set.
2218
- */
2219
- set scene(scene: T);
2220
- /**
2221
- * Getter for the camera. If no camera is initialized, it throws an error.
2222
- * @returns The current camera.
2223
- */
2224
- get camera(): U;
2225
- /**
2226
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2227
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2228
- * @param camera - The new camera to be set.
2229
- */
2230
- set camera(camera: U);
2231
- /**
2232
- * Getter for the renderer.
2233
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
2234
- */
2235
- get renderer(): S | null;
2236
- /**
2237
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2238
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2239
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2240
- * @param renderer - The new renderer to be set or null to remove the current renderer.
2241
- */
2242
- set renderer(renderer: S | null);
2243
- /** {@link Updateable.update} */
2244
- update(delta?: number): void;
2245
- /** {@link Disposable.dispose} */
2246
- dispose(disposeResources?: boolean): void;
2247
- }
2248
- import * as WEBIFC from "web-ifc";
2249
- import { IfcItemsCategories } from "../../../ifc";
2250
- export declare class SpatialStructure {
2251
- itemsByFloor: IfcItemsCategories;
2252
- private _units;
2253
- setUp(webIfc: WEBIFC.IfcAPI): void;
2254
- cleanUp(): void;
2255
- }
2256
2169
  import * as WEBIFC from "web-ifc";
2257
2170
  /** Configuration of the IFC-fragment conversion. */
2258
2171
  export declare class IfcFragmentSettings {
@@ -2294,851 +2207,843 @@ export declare class IfcFragmentSettings {
2294
2207
  */
2295
2208
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2296
2209
  }
2297
- import * as THREE from "three";
2298
- import { BaseRenderer, Event } from "../../Types";
2299
- import { Components } from "../../Components";
2300
2210
  /**
2301
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2211
+ * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2302
2212
  */
2303
- export declare class SimpleRenderer extends BaseRenderer {
2213
+ export declare class Event<T> {
2304
2214
  /**
2305
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2306
- * Default is 'true'.
2215
+ * Add a callback to this event instance.
2216
+ * @param handler - the callback to be added to this event.
2307
2217
  */
2308
- enabled: boolean;
2218
+ add(handler: T extends void ? {
2219
+ (): void;
2220
+ } : {
2221
+ (data: T): void;
2222
+ }): void;
2309
2223
  /**
2310
- * The HTML container of the THREE.js canvas where the scene is rendered.
2224
+ * Removes a callback from this event instance.
2225
+ * @param handler - the callback to be removed from this event.
2311
2226
  */
2312
- container: HTMLElement;
2227
+ remove(handler: T extends void ? {
2228
+ (): void;
2229
+ } : {
2230
+ (data: T): void;
2231
+ }): void;
2232
+ /** Triggers all the callbacks assigned to this event. */
2233
+ trigger: (data?: T) => void;
2234
+ /** Gets rid of all the suscribed events. */
2235
+ reset(): void;
2236
+ private handlers;
2237
+ }
2238
+ /**
2239
+ * 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.
2240
+ */
2241
+ export declare class AsyncEvent<T> {
2313
2242
  /**
2314
- * The THREE.js WebGLRenderer instance.
2243
+ * Add a callback to this event instance.
2244
+ * @param handler - the callback to be added to this event.
2315
2245
  */
2316
- three: THREE.WebGLRenderer;
2317
- protected _canvas: HTMLCanvasElement;
2318
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2319
- protected _resizeObserver: ResizeObserver | null;
2320
- protected onContainerUpdated: Event<unknown>;
2321
- private _resizing;
2246
+ add(handler: T extends void ? {
2247
+ (): Promise<void>;
2248
+ } : {
2249
+ (data: T): Promise<void>;
2250
+ }): void;
2322
2251
  /**
2323
- * Constructor for the SimpleRenderer class.
2324
- *
2325
- * @param components - The components instance.
2326
- * @param container - The HTML container where the THREE.js canvas will be rendered.
2327
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2328
- */
2329
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2330
- /** {@link Updateable.update} */
2331
- update(): void;
2332
- /** {@link Disposable.dispose} */
2333
- dispose(): void;
2334
- /** {@link Resizeable.getSize}. */
2335
- getSize(): THREE.Vector2;
2336
- /** {@link Resizeable.resize} */
2337
- resize: (size?: THREE.Vector2) => void;
2338
- /**
2339
- * Sets up and manages the event listeners for the renderer.
2340
- *
2341
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2342
- *
2343
- * @throws Will throw an error if the renderer does not have an HTML container.
2252
+ * Removes a callback from this event instance.
2253
+ * @param handler - the callback to be removed from this event.
2344
2254
  */
2345
- setupEvents(active: boolean): void;
2346
- private resizeEvent;
2347
- private setupRenderer;
2348
- private onContextLost;
2349
- private onContextBack;
2255
+ remove(handler: T extends void ? {
2256
+ (): Promise<void>;
2257
+ } : {
2258
+ (data: T): Promise<void>;
2259
+ }): void;
2260
+ /** Triggers all the callbacks assigned to this event. */
2261
+ trigger: (data?: T) => Promise<void>;
2262
+ /** Gets rid of all the suscribed events. */
2263
+ reset(): void;
2264
+ private handlers;
2350
2265
  }
2351
2266
  import * as THREE from "three";
2352
2267
  import CameraControls from "camera-controls";
2353
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2354
- import { Components } from "../../Components";
2268
+ import { Event } from "./event";
2355
2269
  /**
2356
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
2270
+ * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2357
2271
  */
2358
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2359
- /** {@link Updateable.onBeforeUpdate} */
2360
- readonly onBeforeUpdate: Event<SimpleCamera>;
2361
- /** {@link Updateable.onAfterUpdate} */
2362
- readonly onAfterUpdate: Event<SimpleCamera>;
2272
+ export interface Disposable {
2363
2273
  /**
2364
- * Event that is triggered when the aspect of the camera has been updated.
2365
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2274
+ * Destroys the object from memory to prevent a
2275
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2366
2276
  */
2367
- readonly onAspectUpdated: Event<unknown>;
2368
- /** {@link Disposable.onDisposed} */
2369
- readonly onDisposed: Event<string>;
2277
+ dispose: () => void | Promise<void>;
2278
+ /** Fired after the tool has been disposed. */
2279
+ readonly onDisposed: Event<any>;
2280
+ }
2281
+ /**
2282
+ * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2283
+ */
2284
+ export interface Hideable {
2370
2285
  /**
2371
- * A three.js PerspectiveCamera or OrthographicCamera instance.
2372
- * This camera is used for rendering the scene.
2286
+ * Whether the geometric representation of this component is
2287
+ * currently visible or not in the
2288
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2373
2289
  */
2374
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2375
- private _allControls;
2290
+ visible: boolean;
2291
+ }
2292
+ /**
2293
+ * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2294
+ */
2295
+ export interface Resizeable {
2376
2296
  /**
2377
- * The object that controls the camera. An instance of
2378
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2379
- * Transforming the camera directly will have no effect: you need to use this
2380
- * object to move, rotate, look at objects, etc.
2297
+ * Sets size of this component (e.g. the resolution of a
2298
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2299
+ * component.
2381
2300
  */
2382
- get controls(): CameraControls;
2301
+ resize: (size?: THREE.Vector2) => void;
2302
+ /** Event that fires when the component has been resized. */
2303
+ onResize: Event<THREE.Vector2>;
2383
2304
  /**
2384
- * Getter for the enabled state of the camera controls.
2385
- * If the current world is null, it returns false.
2386
- * Otherwise, it returns the enabled state of the camera controls.
2387
- *
2388
- * @returns {boolean} The enabled state of the camera controls.
2305
+ * Gets the current size of this component (e.g. the resolution of a
2306
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2307
+ * component.
2389
2308
  */
2390
- get enabled(): boolean;
2309
+ getSize: () => THREE.Vector2;
2310
+ }
2311
+ /** Whether this component should be updated each frame. */
2312
+ export interface Updateable {
2313
+ /** Actions that should be executed after updating the component. */
2314
+ onAfterUpdate: Event<any>;
2315
+ /** Actions that should be executed before updating the component. */
2316
+ onBeforeUpdate: Event<any>;
2391
2317
  /**
2392
- * Setter for the enabled state of the camera controls.
2393
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2394
- *
2395
- * @param {boolean} enabled - The new enabled state of the camera controls.
2318
+ * Function used to update the state of this component each frame. For
2319
+ * instance, a renderer component will make a render each frame.
2396
2320
  */
2397
- set enabled(enabled: boolean);
2398
- constructor(components: Components);
2399
- /** {@link Disposable.dispose} */
2400
- dispose(): void;
2401
- /** {@link Updateable.update} */
2402
- update(_delta: number): void;
2321
+ update(delta?: number): void;
2322
+ }
2323
+ /** Basic type to describe the progress of any kind of process. */
2324
+ export interface Progress {
2325
+ /** The amount of things that have been done already. */
2326
+ current: number;
2327
+ /** The total amount of things to be done by the process. */
2328
+ total: number;
2329
+ }
2330
+ /**
2331
+ * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
2332
+ */
2333
+ export interface Createable {
2334
+ /** Creates a new instance of an element (e.g. a new Dimension). */
2335
+ create: (data: any) => void;
2403
2336
  /**
2404
- * Updates the aspect of the camera to match the size of the
2405
- * {@link Components.renderer}.
2337
+ * Finish the creation process of the component, successfully creating an
2338
+ * instance of whatever the component creates.
2406
2339
  */
2407
- updateAspect: () => void;
2408
- private setupCamera;
2409
- private newCameraControls;
2410
- private setupEvents;
2411
- private static getSubsetOfThree;
2340
+ endCreation?: (data: any) => void;
2341
+ /**
2342
+ * Cancels the creation process of the component, going back to the state
2343
+ * before starting to create.
2344
+ */
2345
+ cancelCreation?: (data: any) => void;
2346
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
2347
+ delete: (data: any) => void;
2412
2348
  }
2413
- import * as THREE from "three";
2414
- import { BaseScene, Configurable, Event } from "../../Types";
2415
- import { Components } from "../../Components";
2416
2349
  /**
2417
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2350
+ * Whether this component supports to be configured.
2418
2351
  */
2419
- export interface SimpleSceneConfig {
2420
- directionalLight: {
2421
- color: THREE.Color;
2422
- intensity: number;
2423
- position: THREE.Vector3;
2424
- };
2425
- ambientLight: {
2426
- color: THREE.Color;
2427
- intensity: number;
2428
- };
2352
+ export interface Configurable<T extends Record<string, any>> {
2353
+ /** Wether this components has been already configured. */
2354
+ isSetup: boolean;
2355
+ /** Use the provided configuration to setup the tool. */
2356
+ setup: (config?: Partial<T>) => void | Promise<void>;
2357
+ /** Fired after successfully calling {@link Configurable.setup()} */
2358
+ readonly onSetup: Event<any>;
2359
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2360
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
2361
+ */
2362
+ config: Required<T>;
2429
2363
  }
2430
2364
  /**
2431
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2365
+ * Whether a camera uses the Camera Controls library.
2432
2366
  */
2433
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2434
- /** {@link Configurable.isSetup} */
2435
- isSetup: boolean;
2367
+ export interface CameraControllable {
2436
2368
  /**
2437
- * The underlying Three.js scene object.
2438
- * It is used to define the 3D space containing objects, lights, and cameras.
2369
+ * An instance of CameraControls that provides camera control functionalities.
2370
+ * This instance is used to manipulate the camera.
2439
2371
  */
2440
- three: THREE.Scene;
2441
- /** {@link Configurable.onSetup} */
2442
- readonly onSetup: Event<SimpleScene>;
2372
+ controls: CameraControls;
2373
+ }
2374
+ import * as WEBIFC from "web-ifc";
2375
+ import { IfcItemsCategories } from "../../../ifc";
2376
+ export declare class SpatialStructure {
2377
+ itemsByFloor: IfcItemsCategories;
2378
+ private _units;
2379
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2380
+ cleanUp(): void;
2381
+ }
2382
+ import { Base } from "./base";
2383
+ /**
2384
+ * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2385
+ */
2386
+ export declare abstract class Component extends Base {
2443
2387
  /**
2444
- * Configuration interface for the {@link SimpleScene}.
2445
- * Defines properties for directional and ambient lights.
2388
+ * Whether this component is active or not. The behaviour can vary depending
2389
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2390
+ * dimensions, while a disabled camera will stop moving. A disabled component
2391
+ * will not be updated automatically each frame.
2446
2392
  */
2447
- config: Required<SimpleSceneConfig>;
2448
- constructor(components: Components);
2449
- /** {@link Configurable.setup} */
2450
- setup(config?: Partial<SimpleSceneConfig>): void;
2393
+ abstract enabled: boolean;
2451
2394
  }
2452
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2453
- import * as THREE from "three";
2454
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2395
+ import { Base } from "./base";
2396
+ import { World } from "./world";
2397
+ import { Event } from "./event";
2455
2398
  import { Components } from "../../Components";
2456
- import { Event, World, Disposable } from "../../Types";
2457
2399
  /**
2458
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2400
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2459
2401
  */
2460
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2402
+ export declare abstract class BaseWorldItem extends Base {
2403
+ readonly worlds: Map<string, World>;
2461
2404
  /**
2462
- * Event triggered when the visibility of meshes is updated.
2463
- * Contains two sets: seen and unseen.
2405
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2406
+ * The event payload contains the world instance and the action ("added" or "removed").
2464
2407
  */
2465
- readonly onViewUpdated: Event<{
2466
- seen: Set<THREE.Mesh>;
2467
- unseen: Set<THREE.Mesh>;
2408
+ readonly onWorldChanged: Event<{
2409
+ world: World;
2410
+ action: "added" | "removed";
2468
2411
  }>;
2469
2412
  /**
2470
- * Pixels in screen a geometry must occupy to be considered "seen".
2471
- * Default value is 100.
2413
+ * The current world this item is associated with. It can be null if no world is currently active.
2472
2414
  */
2473
- threshold: number;
2415
+ currentWorld: World | null;
2416
+ protected constructor(components: Components);
2417
+ }
2418
+ import * as THREE from "three";
2419
+ import CameraControls from "camera-controls";
2420
+ import { BaseWorldItem } from "./base-world-item";
2421
+ import { CameraControllable } from "./interfaces";
2422
+ /**
2423
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2424
+ */
2425
+ export declare abstract class BaseCamera extends BaseWorldItem {
2474
2426
  /**
2475
- * Map of color code to THREE.InstancedMesh.
2476
- * Used to keep track of color-coded meshes.
2427
+ * Whether the camera is enabled or not.
2477
2428
  */
2478
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2429
+ abstract enabled: boolean;
2479
2430
  /**
2480
- * Flag to indicate if the renderer is currently processing.
2481
- * Used to prevent concurrent processing.
2431
+ * The Three.js camera instance.
2482
2432
  */
2483
- isProcessing: boolean;
2484
- private _colorCodeMeshMap;
2485
- private _meshIDColorCodeMap;
2486
- private _currentVisibleMeshes;
2487
- private _recentlyHiddenMeshes;
2488
- private _intervalID;
2489
- private readonly _transparentMat;
2490
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2491
- /** {@link Disposable.dispose} */
2492
- dispose(): void;
2433
+ abstract three: THREE.Camera;
2493
2434
  /**
2494
- * 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.
2495
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2496
- * @returns {void}
2435
+ * Optional CameraControls instance for controlling the camera.
2436
+ * This property is only available if the camera is controllable.
2497
2437
  */
2498
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2438
+ abstract controls?: CameraControls;
2499
2439
  /**
2500
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2501
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2502
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2503
- * @returns {void}
2440
+ * Checks whether the instance is {@link CameraControllable}.
2441
+ *
2442
+ * @returns True if the instance is controllable, false otherwise.
2504
2443
  */
2505
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2506
- private handleWorkerMessage;
2507
- private getAvailableMaterial;
2444
+ hasCameraControls: () => this is CameraControllable;
2508
2445
  }
2509
- import * as THREE from "three";
2446
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2510
2447
  import { Components } from "../../Components";
2511
- import { AsyncEvent, Event, World } from "../../Types";
2512
2448
  /**
2513
- * Settings to configure the CullerRenderer.
2449
+ * Base class of the library. Useful for finding out the interfaces something implements.
2514
2450
  */
2515
- export interface CullerRendererSettings {
2451
+ export declare abstract class Base {
2452
+ components: Components;
2453
+ constructor(components: Components);
2454
+ /** Whether is component is {@link Disposable}. */
2455
+ isDisposeable: () => this is Disposable;
2456
+ /** Whether is component is {@link Resizeable}. */
2457
+ isResizeable: () => this is Resizeable;
2458
+ /** Whether is component is {@link Updateable}. */
2459
+ isUpdateable: () => this is Updateable;
2460
+ /** Whether is component is {@link Hideable}. */
2461
+ isHideable: () => this is Hideable;
2462
+ /** Whether is component is {@link Configurable}. */
2463
+ isConfigurable: () => this is Configurable<any>;
2464
+ }
2465
+ import * as THREE from "three";
2466
+ import { BaseScene } from "./base-scene";
2467
+ import { BaseCamera } from "./base-camera";
2468
+ import { BaseRenderer } from "./base-renderer";
2469
+ import { Updateable, Disposable } from "./interfaces";
2470
+ /**
2471
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2472
+ */
2473
+ export interface World extends Disposable, Updateable {
2516
2474
  /**
2517
- * Interval in milliseconds at which the visibility check should be performed.
2518
- * Default value is 1000.
2475
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2519
2476
  */
2520
- updateInterval?: number;
2477
+ meshes: Set<THREE.Mesh>;
2521
2478
  /**
2522
- * Width of the render target used for visibility checks.
2523
- * Default value is 512.
2479
+ * The base scene of the world.
2524
2480
  */
2525
- width?: number;
2481
+ scene: BaseScene;
2526
2482
  /**
2527
- * Height of the render target used for visibility checks.
2528
- * Default value is 512.
2483
+ * The base camera of the world.
2529
2484
  */
2530
- height?: number;
2485
+ camera: BaseCamera;
2531
2486
  /**
2532
- * Whether the visibility check should be performed automatically.
2533
- * Default value is true.
2487
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2534
2488
  */
2535
- autoUpdate?: boolean;
2489
+ renderer: BaseRenderer | null;
2490
+ /**
2491
+ * A unique identifier for the world.
2492
+ */
2493
+ uuid: string;
2494
+ /**
2495
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2496
+ */
2497
+ isDisposing: boolean;
2536
2498
  }
2499
+ import * as THREE from "three";
2500
+ import { Vector2 } from "three";
2501
+ import { Event } from "./event";
2502
+ import { BaseWorldItem } from "./base-world-item";
2503
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
2537
2504
  /**
2538
- * A base renderer to determine visibility on screen.
2505
+ * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
2539
2506
  */
2540
- export declare class CullerRenderer {
2541
- /** {@link Disposable.onDisposed} */
2542
- readonly onDisposed: Event<string>;
2507
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
2543
2508
  /**
2544
- * Fires after making the visibility check to the meshes. It lists the
2545
- * meshes that are currently visible, and the ones that were visible
2546
- * just before but not anymore.
2509
+ * The three.js WebGLRenderer instance associated with this renderer.
2510
+ *
2511
+ * @abstract
2512
+ * @type {THREE.WebGLRenderer}
2547
2513
  */
2548
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2514
+ abstract three: THREE.WebGLRenderer;
2515
+ /** {@link Updateable.onBeforeUpdate} */
2516
+ onAfterUpdate: Event<unknown>;
2517
+ /** {@link Updateable.onAfterUpdate} */
2518
+ onBeforeUpdate: Event<unknown>;
2519
+ /** {@link Disposable.onDisposed} */
2520
+ readonly onDisposed: Event<undefined>;
2521
+ /** {@link Resizeable.onResize} */
2522
+ readonly onResize: Event<THREE.Vector2>;
2549
2523
  /**
2550
- * Whether this renderer is active or not. If not, it won't render anything.
2524
+ * Event that fires when there has been a change to the list of clipping
2525
+ * planes used by the active renderer.
2551
2526
  */
2552
- enabled: boolean;
2527
+ readonly onClippingPlanesUpdated: Event<unknown>;
2528
+ /** {@link Updateable.update} */
2529
+ abstract update(delta?: number): void | Promise<void>;
2530
+ /** {@link Disposable.dispose} */
2531
+ abstract dispose(): void;
2532
+ /** {@link Resizeable.getSize} */
2533
+ abstract getSize(): Vector2;
2534
+ /** {@link Resizeable.resize} */
2535
+ abstract resize(size: Vector2 | undefined): void;
2553
2536
  /**
2554
- * Needs to check whether there are objects that need to be hidden or shown.
2555
- * You can bind this to the camera movement, to a certain interval, etc.
2537
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
2556
2538
  */
2557
- needsUpdate: boolean;
2539
+ clippingPlanes: THREE.Plane[];
2558
2540
  /**
2559
- * Render the internal scene used to determine the object visibility. Used
2560
- * for debugging purposes.
2541
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
2542
+ *
2543
+ * @remarks
2544
+ * This method is typically called when there is a change to the list of clipping planes
2545
+ * used by the active renderer.
2561
2546
  */
2562
- renderDebugFrame: boolean;
2563
- /** The components instance to which this renderer belongs. */
2564
- components: Components;
2565
- /** The world instance to which this renderer belongs. */
2566
- readonly world: World;
2567
- /** The THREE.js renderer used to make the visibility test. */
2568
- readonly renderer: THREE.WebGLRenderer;
2569
- protected autoUpdate: boolean;
2570
- protected updateInterval: number;
2571
- protected readonly worker: Worker;
2572
- protected readonly scene: THREE.Scene;
2573
- private _width;
2574
- private _height;
2575
- private _availableColor;
2576
- private readonly renderTarget;
2577
- private readonly bufferSize;
2578
- private readonly _buffer;
2579
- protected _isWorkerBusy: boolean;
2580
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2581
- /** {@link Disposable.dispose} */
2582
- dispose(): void;
2547
+ updateClippingPlanes(): void;
2583
2548
  /**
2584
- * The function that the culler uses to reprocess the scene. Generally it's
2585
- * better to call needsUpdate, but you can also call this to force it.
2586
- * @param force if true, it will refresh the scene even if needsUpdate is
2587
- * not true.
2549
+ * Sets or removes a clipping plane from the renderer.
2550
+ *
2551
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
2552
+ * @param plane - The clipping plane to be added or removed.
2553
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
2554
+ *
2555
+ * @remarks
2556
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2557
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
2558
+ * If 'active' is 'false' and the plane is in the array, it is removed.
2559
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2560
+ * excluding any planes marked as local.
2588
2561
  */
2589
- updateVisibility: (force?: boolean) => Promise<void>;
2590
- protected getAvailableColor(): {
2591
- r: number;
2592
- g: number;
2593
- b: number;
2594
- code: string;
2595
- };
2596
- protected increaseColor(): void;
2597
- protected decreaseColor(): void;
2598
- private applySettings;
2562
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2599
2563
  }
2600
2564
  import * as THREE from "three";
2601
- import { Disposable, Event } from "../../Types";
2565
+ import { Disposable } from "./interfaces";
2566
+ import { Event } from "./event";
2567
+ import { Components } from "../../Components";
2568
+ import { BaseWorldItem } from "./base-world-item";
2602
2569
  /**
2603
- * 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.
2570
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2604
2571
  */
2605
- export declare class Mouse implements Disposable {
2606
- dom: HTMLCanvasElement;
2607
- private _event?;
2608
- private _position;
2572
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2609
2573
  /** {@link Disposable.onDisposed} */
2610
2574
  readonly onDisposed: Event<unknown>;
2611
- constructor(dom: HTMLCanvasElement);
2612
2575
  /**
2613
- * The real position of the mouse of the Three.js canvas.
2576
+ * Abstract property representing the three.js object associated with this scene.
2577
+ * It should be implemented by subclasses.
2614
2578
  */
2615
- get position(): THREE.Vector2;
2579
+ abstract three: THREE.Object3D;
2580
+ protected constructor(components: Components);
2616
2581
  /** {@link Disposable.dispose} */
2617
2582
  dispose(): void;
2618
- private getPositionY;
2619
- private getPositionX;
2620
- private updateMouseInfo;
2621
- private setupEvents;
2622
2583
  }
2623
2584
  import * as THREE from "three";
2624
- import { Hideable, Event, World, Disposable } from "../../Types";
2625
- import { Components } from "../../Components";
2585
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2626
2586
  /**
2627
- * Configuration interface for the {@link SimpleGrid} class.
2587
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2588
+ *
2589
+ * @template T - The type of the scene. Default is BaseScene.
2590
+ * @template U - The type of the camera. Default is BaseCamera.
2591
+ * @template S - The type of the renderer. Default is BaseRenderer.
2628
2592
  */
2629
- export interface GridConfig {
2593
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2630
2594
  /**
2631
- * The color of the grid lines.
2595
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2632
2596
  */
2633
- color: THREE.Color;
2597
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2598
+ /** {@link Updateable.onAfterUpdate} */
2599
+ readonly onAfterUpdate: Event<unknown>;
2600
+ /** {@link Updateable.onBeforeUpdate} */
2601
+ readonly onBeforeUpdate: Event<unknown>;
2602
+ /** {@link Disposable.onDisposed} */
2603
+ readonly onDisposed: Event<unknown>;
2634
2604
  /**
2635
- * The size of the primary grid lines.
2605
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2636
2606
  */
2637
- size1: number;
2607
+ isDisposing: boolean;
2638
2608
  /**
2639
- * The size of the secondary grid lines.
2609
+ * Indicates whether the world is currently enabled.
2610
+ * When disabled, the world will not be updated.
2640
2611
  */
2641
- size2: number;
2612
+ enabled: boolean;
2642
2613
  /**
2643
- * The distance at which the grid lines start to fade away.
2614
+ * A unique identifier for the world.
2644
2615
  */
2645
- distance: number;
2646
- }
2647
- /**
2648
- * 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).
2649
- */
2650
- export declare class SimpleGrid implements Hideable, Disposable {
2651
- /** {@link Disposable.onDisposed} */
2652
- readonly onDisposed: Event<unknown>;
2653
- /** The world instance to which this Raycaster belongs. */
2654
- world: World;
2655
- /** The components instance to which this grid belongs. */
2656
- components: Components;
2657
- /** {@link Hideable.visible} */
2658
- get visible(): boolean;
2659
- /** {@link Hideable.visible} */
2660
- set visible(visible: boolean);
2661
- /** The material of the grid. */
2662
- get material(): THREE.ShaderMaterial;
2616
+ uuid: string;
2663
2617
  /**
2664
- * Whether the grid should fade away with distance. Recommended to be true for
2665
- * perspective cameras and false for orthographic cameras.
2618
+ * An optional name for the world.
2666
2619
  */
2667
- get fade(): boolean;
2620
+ name?: string;
2621
+ private _scene?;
2622
+ private _camera?;
2623
+ private _renderer;
2668
2624
  /**
2669
- * Whether the grid should fade away with distance. Recommended to be true for
2670
- * perspective cameras and false for orthographic cameras.
2625
+ * Getter for the scene. If no scene is initialized, it throws an error.
2626
+ * @returns The current scene.
2671
2627
  */
2672
- set fade(active: boolean);
2673
- /** The Three.js mesh that contains the infinite grid. */
2674
- readonly three: THREE.Mesh;
2675
- private _fade;
2676
- constructor(components: Components, world: World, config: GridConfig);
2628
+ get scene(): T;
2629
+ /**
2630
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2631
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2632
+ * @param scene - The new scene to be set.
2633
+ */
2634
+ set scene(scene: T);
2635
+ /**
2636
+ * Getter for the camera. If no camera is initialized, it throws an error.
2637
+ * @returns The current camera.
2638
+ */
2639
+ get camera(): U;
2640
+ /**
2641
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2642
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2643
+ * @param camera - The new camera to be set.
2644
+ */
2645
+ set camera(camera: U);
2646
+ /**
2647
+ * Getter for the renderer.
2648
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
2649
+ */
2650
+ get renderer(): S | null;
2651
+ /**
2652
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2653
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2654
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2655
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
2656
+ */
2657
+ set renderer(renderer: S | null);
2658
+ /** {@link Updateable.update} */
2659
+ update(delta?: number): void;
2677
2660
  /** {@link Disposable.dispose} */
2678
- dispose(): void;
2679
- private setupEvents;
2680
- private updateZoom;
2661
+ dispose(disposeResources?: boolean): void;
2681
2662
  }
2682
2663
  import * as THREE from "three";
2664
+ import { BaseScene, Configurable, Event } from "../../Types";
2683
2665
  import { Components } from "../../Components";
2684
- import { Event, World, Disposable } from "../../Types";
2685
- import { Mouse } from "./mouse";
2686
2666
  /**
2687
- * 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.
2667
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2688
2668
  */
2689
- export declare class SimpleRaycaster implements Disposable {
2690
- /** {@link Component.enabled} */
2669
+ export interface SimpleSceneConfig {
2670
+ directionalLight: {
2671
+ color: THREE.Color;
2672
+ intensity: number;
2673
+ position: THREE.Vector3;
2674
+ };
2675
+ ambientLight: {
2676
+ color: THREE.Color;
2677
+ intensity: number;
2678
+ };
2679
+ }
2680
+ /**
2681
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2682
+ */
2683
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2684
+ /** {@link Configurable.isSetup} */
2685
+ isSetup: boolean;
2686
+ /**
2687
+ * The underlying Three.js scene object.
2688
+ * It is used to define the 3D space containing objects, lights, and cameras.
2689
+ */
2690
+ three: THREE.Scene;
2691
+ /** {@link Configurable.onSetup} */
2692
+ readonly onSetup: Event<SimpleScene>;
2693
+ /**
2694
+ * Configuration interface for the {@link SimpleScene}.
2695
+ * Defines properties for directional and ambient lights.
2696
+ */
2697
+ config: Required<SimpleSceneConfig>;
2698
+ constructor(components: Components);
2699
+ /** {@link Configurable.setup} */
2700
+ setup(config?: Partial<SimpleSceneConfig>): void;
2701
+ }
2702
+ import * as THREE from "three";
2703
+ import { BaseRenderer, Event } from "../../Types";
2704
+ import { Components } from "../../Components";
2705
+ /**
2706
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2707
+ */
2708
+ export declare class SimpleRenderer extends BaseRenderer {
2709
+ /**
2710
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2711
+ * Default is 'true'.
2712
+ */
2691
2713
  enabled: boolean;
2692
- /** The components instance to which this Raycaster belongs. */
2693
- components: Components;
2694
- /** {@link Disposable.onDisposed} */
2695
- readonly onDisposed: Event<unknown>;
2696
- /** The position of the mouse in the screen. */
2697
- readonly mouse: Mouse;
2698
2714
  /**
2699
- * A reference to the Three.js Raycaster instance.
2700
- * This is used for raycasting operations.
2715
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2701
2716
  */
2702
- readonly three: THREE.Raycaster;
2717
+ container: HTMLElement;
2703
2718
  /**
2704
- * A reference to the world instance to which this Raycaster belongs.
2705
- * This is used to access the camera and meshes.
2719
+ * The THREE.js WebGLRenderer instance.
2706
2720
  */
2707
- world: World;
2708
- constructor(components: Components, world: World);
2709
- /** {@link Disposable.dispose} */
2710
- dispose(): void;
2721
+ three: THREE.WebGLRenderer;
2722
+ protected _canvas: HTMLCanvasElement;
2723
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2724
+ protected _resizeObserver: ResizeObserver | null;
2725
+ protected onContainerUpdated: Event<unknown>;
2726
+ private _resizing;
2711
2727
  /**
2712
- * Throws a ray from the camera to the mouse or touch event point and returns
2713
- * the first item found. This also takes into account the clipping planes
2714
- * used by the renderer.
2728
+ * Constructor for the SimpleRenderer class.
2715
2729
  *
2716
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2717
- * to query. If not provided, it will query all the meshes stored in
2718
- * {@link Components.meshes}.
2730
+ * @param components - The components instance.
2731
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
2732
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2719
2733
  */
2720
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2734
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2735
+ /** {@link Updateable.update} */
2736
+ update(): void;
2737
+ /** {@link Disposable.dispose} */
2738
+ dispose(): void;
2739
+ /** {@link Resizeable.getSize}. */
2740
+ getSize(): THREE.Vector2;
2741
+ /** {@link Resizeable.resize} */
2742
+ resize: (size?: THREE.Vector2) => void;
2721
2743
  /**
2722
- * Casts a ray from a given origin in a given direction and returns the first item found.
2723
- * This method also takes into account the clipping planes used by the renderer.
2744
+ * Sets up and manages the event listeners for the renderer.
2724
2745
  *
2725
- * @param origin - The origin of the ray.
2726
- * @param direction - The direction of the ray.
2727
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2728
- * @returns The first intersection found or 'null' if no intersection was found.
2746
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2747
+ *
2748
+ * @throws Will throw an error if the renderer does not have an HTML container.
2729
2749
  */
2730
- 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;
2731
- private intersect;
2732
- private filterClippingPlanes;
2750
+ setupEvents(active: boolean): void;
2751
+ private resizeEvent;
2752
+ private setupRenderer;
2753
+ private onContextLost;
2754
+ private onContextBack;
2733
2755
  }
2734
2756
  import * as THREE from "three";
2735
- import { Hideable, Disposable, Event, World } from "../../Types";
2736
2757
  import { Components } from "../../Components";
2758
+ import { AsyncEvent, Event, World } from "../../Types";
2737
2759
  /**
2738
- * Each of the clipping planes created by the clipper.
2760
+ * Settings to configure the CullerRenderer.
2739
2761
  */
2740
- export declare class SimplePlane implements Disposable, Hideable {
2741
- /** Event that fires when the user starts dragging a clipping plane. */
2742
- readonly onDraggingStarted: Event<unknown>;
2743
- /** Event that fires when the user stops dragging a clipping plane. */
2744
- readonly onDraggingEnded: Event<unknown>;
2745
- /** {@link Disposable.onDisposed} */
2746
- readonly onDisposed: Event<unknown>;
2762
+ export interface CullerRendererSettings {
2747
2763
  /**
2748
- * The normal vector of the clipping plane.
2764
+ * Interval in milliseconds at which the visibility check should be performed.
2765
+ * Default value is 1000.
2749
2766
  */
2750
- readonly normal: THREE.Vector3;
2767
+ updateInterval?: number;
2751
2768
  /**
2752
- * The origin point of the clipping plane.
2769
+ * Width of the render target used for visibility checks.
2770
+ * Default value is 512.
2753
2771
  */
2754
- readonly origin: THREE.Vector3;
2772
+ width?: number;
2755
2773
  /**
2756
- * The THREE.js Plane object representing the clipping plane.
2774
+ * Height of the render target used for visibility checks.
2775
+ * Default value is 512.
2757
2776
  */
2758
- readonly three: THREE.Plane;
2759
- /** The components instance to which this plane belongs. */
2760
- components: Components;
2761
- /** The world instance to which this plane belongs. */
2762
- world: World;
2763
- protected readonly _helper: THREE.Object3D;
2764
- protected _visible: boolean;
2765
- protected _enabled: boolean;
2766
- private _controlsActive;
2767
- private readonly _arrowBoundBox;
2768
- private readonly _planeMesh;
2769
- private readonly _controls;
2770
- private readonly _hiddenMaterial;
2777
+ height?: number;
2771
2778
  /**
2772
- * Getter for the enabled state of the clipping plane.
2773
- * @returns {boolean} The current enabled state.
2779
+ * Whether the visibility check should be performed automatically.
2780
+ * Default value is true.
2774
2781
  */
2775
- get enabled(): boolean;
2782
+ autoUpdate?: boolean;
2783
+ }
2784
+ /**
2785
+ * A base renderer to determine visibility on screen.
2786
+ */
2787
+ export declare class CullerRenderer {
2788
+ /** {@link Disposable.onDisposed} */
2789
+ readonly onDisposed: Event<string>;
2776
2790
  /**
2777
- * Setter for the enabled state of the clipping plane.
2778
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
2779
- * @param {boolean} state - The new enabled state.
2791
+ * Fires after making the visibility check to the meshes. It lists the
2792
+ * meshes that are currently visible, and the ones that were visible
2793
+ * just before but not anymore.
2780
2794
  */
2781
- set enabled(state: boolean);
2782
- /** {@link Hideable.visible } */
2783
- get visible(): boolean;
2784
- /** {@link Hideable.visible } */
2785
- set visible(state: boolean);
2786
- /** The meshes used for raycasting */
2787
- get meshes(): THREE.Mesh[];
2788
- /** The material of the clipping plane representation. */
2789
- get planeMaterial(): THREE.Material | THREE.Material[];
2790
- /** The material of the clipping plane representation. */
2791
- set planeMaterial(material: THREE.Material | THREE.Material[]);
2792
- /** The size of the clipping plane representation. */
2793
- get size(): number;
2794
- /** Sets the size of the clipping plane representation. */
2795
- set size(size: number);
2795
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2796
2796
  /**
2797
- * Getter for the helper object of the clipping plane.
2798
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
2799
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
2800
- *
2801
- * @returns {THREE.Object3D} The helper object of the clipping plane.
2797
+ * Whether this renderer is active or not. If not, it won't render anything.
2802
2798
  */
2803
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
2804
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
2799
+ enabled: boolean;
2805
2800
  /**
2806
- * Sets the clipping plane's normal and origin from the given normal and point.
2807
- * This method resets the clipping plane's state, updates the normal and origin,
2808
- * and positions the helper object accordingly.
2809
- *
2810
- * @param normal - The new normal vector for the clipping plane.
2811
- * @param point - The new origin point for the clipping plane.
2812
- *
2813
- * @returns {void}
2801
+ * Needs to check whether there are objects that need to be hidden or shown.
2802
+ * You can bind this to the camera movement, to a certain interval, etc.
2814
2803
  */
2815
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
2816
- /** {@link Updateable.update} */
2817
- update: () => void;
2818
- /** {@link Disposable.dispose} */
2819
- dispose(): void;
2820
- private reset;
2821
- protected toggleControls(state: boolean): void;
2822
- private newTransformControls;
2823
- private initializeControls;
2824
- private createArrowBoundingBox;
2825
- private changeDrag;
2826
- private notifyDraggingChanged;
2827
- private preventCameraMovement;
2828
- private newHelper;
2829
- private static newPlaneMesh;
2830
- }
2831
- /**
2832
- * 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.
2833
- */
2834
- export declare class Event<T> {
2804
+ needsUpdate: boolean;
2835
2805
  /**
2836
- * Add a callback to this event instance.
2837
- * @param handler - the callback to be added to this event.
2806
+ * Render the internal scene used to determine the object visibility. Used
2807
+ * for debugging purposes.
2838
2808
  */
2839
- add(handler: T extends void ? {
2840
- (): void;
2841
- } : {
2842
- (data: T): void;
2843
- }): void;
2809
+ renderDebugFrame: boolean;
2810
+ /** The components instance to which this renderer belongs. */
2811
+ components: Components;
2812
+ /** The world instance to which this renderer belongs. */
2813
+ readonly world: World;
2814
+ /** The THREE.js renderer used to make the visibility test. */
2815
+ readonly renderer: THREE.WebGLRenderer;
2816
+ protected autoUpdate: boolean;
2817
+ protected updateInterval: number;
2818
+ protected readonly worker: Worker;
2819
+ protected readonly scene: THREE.Scene;
2820
+ private _width;
2821
+ private _height;
2822
+ private _availableColor;
2823
+ private readonly renderTarget;
2824
+ private readonly bufferSize;
2825
+ private readonly _buffer;
2826
+ protected _isWorkerBusy: boolean;
2827
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2828
+ /** {@link Disposable.dispose} */
2829
+ dispose(): void;
2844
2830
  /**
2845
- * Removes a callback from this event instance.
2846
- * @param handler - the callback to be removed from this event.
2831
+ * The function that the culler uses to reprocess the scene. Generally it's
2832
+ * better to call needsUpdate, but you can also call this to force it.
2833
+ * @param force if true, it will refresh the scene even if needsUpdate is
2834
+ * not true.
2847
2835
  */
2848
- remove(handler: T extends void ? {
2849
- (): void;
2850
- } : {
2851
- (data: T): void;
2852
- }): void;
2853
- /** Triggers all the callbacks assigned to this event. */
2854
- trigger: (data?: T) => void;
2855
- /** Gets rid of all the suscribed events. */
2856
- reset(): void;
2857
- private handlers;
2836
+ updateVisibility: (force?: boolean) => Promise<void>;
2837
+ protected getAvailableColor(): {
2838
+ r: number;
2839
+ g: number;
2840
+ b: number;
2841
+ code: string;
2842
+ };
2843
+ protected increaseColor(): void;
2844
+ protected decreaseColor(): void;
2845
+ private applySettings;
2858
2846
  }
2859
2847
  import * as THREE from "three";
2860
2848
  import CameraControls from "camera-controls";
2861
- import { Event } from "./event";
2849
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2850
+ import { Components } from "../../Components";
2862
2851
  /**
2863
- * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2852
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
2864
2853
  */
2865
- export interface Disposable {
2854
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2855
+ /** {@link Updateable.onBeforeUpdate} */
2856
+ readonly onBeforeUpdate: Event<SimpleCamera>;
2857
+ /** {@link Updateable.onAfterUpdate} */
2858
+ readonly onAfterUpdate: Event<SimpleCamera>;
2866
2859
  /**
2867
- * Destroys the object from memory to prevent a
2868
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2860
+ * Event that is triggered when the aspect of the camera has been updated.
2861
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2869
2862
  */
2870
- dispose: () => void | Promise<void>;
2871
- /** Fired after the tool has been disposed. */
2872
- readonly onDisposed: Event<any>;
2873
- }
2874
- /**
2875
- * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2876
- */
2877
- export interface Hideable {
2863
+ readonly onAspectUpdated: Event<unknown>;
2864
+ /** {@link Disposable.onDisposed} */
2865
+ readonly onDisposed: Event<string>;
2878
2866
  /**
2879
- * Whether the geometric representation of this component is
2880
- * currently visible or not in the
2881
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2867
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
2868
+ * This camera is used for rendering the scene.
2882
2869
  */
2883
- visible: boolean;
2884
- }
2885
- /**
2886
- * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2887
- */
2888
- export interface Resizeable {
2870
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2871
+ private _allControls;
2889
2872
  /**
2890
- * Sets size of this component (e.g. the resolution of a
2891
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2892
- * component.
2873
+ * The object that controls the camera. An instance of
2874
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2875
+ * Transforming the camera directly will have no effect: you need to use this
2876
+ * object to move, rotate, look at objects, etc.
2893
2877
  */
2894
- resize: (size?: THREE.Vector2) => void;
2895
- /** Event that fires when the component has been resized. */
2896
- onResize: Event<THREE.Vector2>;
2878
+ get controls(): CameraControls;
2897
2879
  /**
2898
- * Gets the current size of this component (e.g. the resolution of a
2899
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2900
- * component.
2880
+ * Getter for the enabled state of the camera controls.
2881
+ * If the current world is null, it returns false.
2882
+ * Otherwise, it returns the enabled state of the camera controls.
2883
+ *
2884
+ * @returns {boolean} The enabled state of the camera controls.
2901
2885
  */
2902
- getSize: () => THREE.Vector2;
2903
- }
2904
- /** Whether this component should be updated each frame. */
2905
- export interface Updateable {
2906
- /** Actions that should be executed after updating the component. */
2907
- onAfterUpdate: Event<any>;
2908
- /** Actions that should be executed before updating the component. */
2909
- onBeforeUpdate: Event<any>;
2886
+ get enabled(): boolean;
2910
2887
  /**
2911
- * Function used to update the state of this component each frame. For
2912
- * instance, a renderer component will make a render each frame.
2888
+ * Setter for the enabled state of the camera controls.
2889
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2890
+ *
2891
+ * @param {boolean} enabled - The new enabled state of the camera controls.
2913
2892
  */
2914
- update(delta?: number): void;
2915
- }
2916
- /** Basic type to describe the progress of any kind of process. */
2917
- export interface Progress {
2918
- /** The amount of things that have been done already. */
2919
- current: number;
2920
- /** The total amount of things to be done by the process. */
2921
- total: number;
2893
+ set enabled(enabled: boolean);
2894
+ constructor(components: Components);
2895
+ /** {@link Disposable.dispose} */
2896
+ dispose(): void;
2897
+ /** {@link Updateable.update} */
2898
+ update(_delta: number): void;
2899
+ /**
2900
+ * Updates the aspect of the camera to match the size of the
2901
+ * {@link Components.renderer}.
2902
+ */
2903
+ updateAspect: () => void;
2904
+ private setupCamera;
2905
+ private newCameraControls;
2906
+ private setupEvents;
2907
+ private static getSubsetOfThree;
2922
2908
  }
2909
+ import * as THREE from "three";
2910
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2911
+ import { Components } from "../../Components";
2912
+ import { Event, World, Disposable } from "../../Types";
2923
2913
  /**
2924
- * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
2914
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2925
2915
  */
2926
- export interface Createable {
2927
- /** Creates a new instance of an element (e.g. a new Dimension). */
2928
- create: (data: any) => void;
2916
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2929
2917
  /**
2930
- * Finish the creation process of the component, successfully creating an
2931
- * instance of whatever the component creates.
2918
+ * Event triggered when the visibility of meshes is updated.
2919
+ * Contains two sets: seen and unseen.
2932
2920
  */
2933
- endCreation?: (data: any) => void;
2921
+ readonly onViewUpdated: Event<{
2922
+ seen: Set<THREE.Mesh>;
2923
+ unseen: Set<THREE.Mesh>;
2924
+ }>;
2934
2925
  /**
2935
- * Cancels the creation process of the component, going back to the state
2936
- * before starting to create.
2937
- */
2938
- cancelCreation?: (data: any) => void;
2939
- /** Deletes an existing instance of an element (e.g. a Dimension). */
2940
- delete: (data: any) => void;
2941
- }
2942
- /**
2943
- * Whether this component supports to be configured.
2944
- */
2945
- export interface Configurable<T extends Record<string, any>> {
2946
- /** Wether this components has been already configured. */
2947
- isSetup: boolean;
2948
- /** Use the provided configuration to setup the tool. */
2949
- setup: (config?: Partial<T>) => void | Promise<void>;
2950
- /** Fired after successfully calling {@link Configurable.setup()} */
2951
- readonly onSetup: Event<any>;
2952
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2953
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
2926
+ * Pixels in screen a geometry must occupy to be considered "seen".
2927
+ * Default value is 100.
2954
2928
  */
2955
- config: Required<T>;
2956
- }
2957
- /**
2958
- * Whether a camera uses the Camera Controls library.
2959
- */
2960
- export interface CameraControllable {
2929
+ threshold: number;
2961
2930
  /**
2962
- * An instance of CameraControls that provides camera control functionalities.
2963
- * This instance is used to manipulate the camera.
2931
+ * Map of color code to THREE.InstancedMesh.
2932
+ * Used to keep track of color-coded meshes.
2964
2933
  */
2965
- controls: CameraControls;
2966
- }
2967
- /**
2968
- * 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.
2969
- */
2970
- export declare class AsyncEvent<T> {
2934
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2971
2935
  /**
2972
- * Add a callback to this event instance.
2973
- * @param handler - the callback to be added to this event.
2936
+ * Flag to indicate if the renderer is currently processing.
2937
+ * Used to prevent concurrent processing.
2974
2938
  */
2975
- add(handler: T extends void ? {
2976
- (): Promise<void>;
2977
- } : {
2978
- (data: T): Promise<void>;
2979
- }): void;
2939
+ isProcessing: boolean;
2940
+ private _colorCodeMeshMap;
2941
+ private _meshIDColorCodeMap;
2942
+ private _currentVisibleMeshes;
2943
+ private _recentlyHiddenMeshes;
2944
+ private _intervalID;
2945
+ private readonly _transparentMat;
2946
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2947
+ /** {@link Disposable.dispose} */
2948
+ dispose(): void;
2980
2949
  /**
2981
- * Removes a callback from this event instance.
2982
- * @param handler - the callback to be removed from this event.
2950
+ * 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.
2951
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2952
+ * @returns {void}
2983
2953
  */
2984
- remove(handler: T extends void ? {
2985
- (): Promise<void>;
2986
- } : {
2987
- (data: T): Promise<void>;
2988
- }): void;
2989
- /** Triggers all the callbacks assigned to this event. */
2990
- trigger: (data?: T) => Promise<void>;
2991
- /** Gets rid of all the suscribed events. */
2992
- reset(): void;
2993
- private handlers;
2994
- }
2995
- import { Base } from "./base";
2996
- /**
2997
- * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2998
- */
2999
- export declare abstract class Component extends Base {
2954
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3000
2955
  /**
3001
- * Whether this component is active or not. The behaviour can vary depending
3002
- * on the type of component. E.g. a disabled dimension tool will stop creating
3003
- * dimensions, while a disabled camera will stop moving. A disabled component
3004
- * will not be updated automatically each frame.
2956
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2957
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2958
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2959
+ * @returns {void}
3005
2960
  */
3006
- abstract enabled: boolean;
2961
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2962
+ private handleWorkerMessage;
2963
+ private getAvailableMaterial;
3007
2964
  }
2965
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3008
2966
  import * as THREE from "three";
3009
- import CameraControls from "camera-controls";
3010
- import { BaseWorldItem } from "./base-world-item";
3011
- import { CameraControllable } from "./interfaces";
2967
+ import { Hideable, Event, World, Disposable } from "../../Types";
2968
+ import { Components } from "../../Components";
3012
2969
  /**
3013
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2970
+ * Configuration interface for the {@link SimpleGrid} class.
3014
2971
  */
3015
- export declare abstract class BaseCamera extends BaseWorldItem {
2972
+ export interface GridConfig {
3016
2973
  /**
3017
- * Whether the camera is enabled or not.
2974
+ * The color of the grid lines.
3018
2975
  */
3019
- abstract enabled: boolean;
2976
+ color: THREE.Color;
3020
2977
  /**
3021
- * The Three.js camera instance.
2978
+ * The size of the primary grid lines.
3022
2979
  */
3023
- abstract three: THREE.Camera;
2980
+ size1: number;
3024
2981
  /**
3025
- * Optional CameraControls instance for controlling the camera.
3026
- * This property is only available if the camera is controllable.
2982
+ * The size of the secondary grid lines.
3027
2983
  */
3028
- abstract controls?: CameraControls;
2984
+ size2: number;
3029
2985
  /**
3030
- * Checks whether the instance is {@link CameraControllable}.
3031
- *
3032
- * @returns True if the instance is controllable, false otherwise.
2986
+ * The distance at which the grid lines start to fade away.
3033
2987
  */
3034
- hasCameraControls: () => this is CameraControllable;
2988
+ distance: number;
3035
2989
  }
3036
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3037
- import { Components } from "../../Components";
3038
2990
  /**
3039
- * Base class of the library. Useful for finding out the interfaces something implements.
2991
+ * 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).
3040
2992
  */
3041
- export declare abstract class Base {
2993
+ export declare class SimpleGrid implements Hideable, Disposable {
2994
+ /** {@link Disposable.onDisposed} */
2995
+ readonly onDisposed: Event<unknown>;
2996
+ /** The world instance to which this Raycaster belongs. */
2997
+ world: World;
2998
+ /** The components instance to which this grid belongs. */
3042
2999
  components: Components;
3043
- constructor(components: Components);
3044
- /** Whether is component is {@link Disposable}. */
3045
- isDisposeable: () => this is Disposable;
3046
- /** Whether is component is {@link Resizeable}. */
3047
- isResizeable: () => this is Resizeable;
3048
- /** Whether is component is {@link Updateable}. */
3049
- isUpdateable: () => this is Updateable;
3050
- /** Whether is component is {@link Hideable}. */
3051
- isHideable: () => this is Hideable;
3052
- /** Whether is component is {@link Configurable}. */
3053
- isConfigurable: () => this is Configurable<any>;
3054
- }
3055
- import { Base } from "./base";
3056
- import { World } from "./world";
3057
- import { Event } from "./event";
3058
- import { Components } from "../../Components";
3059
- /**
3060
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
3061
- */
3062
- export declare abstract class BaseWorldItem extends Base {
3063
- readonly worlds: Map<string, World>;
3000
+ /** {@link Hideable.visible} */
3001
+ get visible(): boolean;
3002
+ /** {@link Hideable.visible} */
3003
+ set visible(visible: boolean);
3004
+ /** The material of the grid. */
3005
+ get material(): THREE.ShaderMaterial;
3064
3006
  /**
3065
- * Event that is triggered when a world is added or removed from the 'worlds' map.
3066
- * The event payload contains the world instance and the action ("added" or "removed").
3007
+ * Whether the grid should fade away with distance. Recommended to be true for
3008
+ * perspective cameras and false for orthographic cameras.
3067
3009
  */
3068
- readonly onWorldChanged: Event<{
3069
- world: World;
3070
- action: "added" | "removed";
3071
- }>;
3010
+ get fade(): boolean;
3072
3011
  /**
3073
- * The current world this item is associated with. It can be null if no world is currently active.
3012
+ * Whether the grid should fade away with distance. Recommended to be true for
3013
+ * perspective cameras and false for orthographic cameras.
3074
3014
  */
3075
- currentWorld: World | null;
3076
- protected constructor(components: Components);
3015
+ set fade(active: boolean);
3016
+ /** The Three.js mesh that contains the infinite grid. */
3017
+ readonly three: THREE.Mesh;
3018
+ private _fade;
3019
+ constructor(components: Components, world: World, config: GridConfig);
3020
+ /** {@link Disposable.dispose} */
3021
+ dispose(): void;
3022
+ private setupEvents;
3023
+ private updateZoom;
3077
3024
  }
3078
3025
  import * as THREE from "three";
3079
- import { Vector2 } from "three";
3080
- import { Event } from "./event";
3081
- import { BaseWorldItem } from "./base-world-item";
3082
- import { Disposable, Resizeable, Updateable } from "./interfaces";
3026
+ import { Disposable, Event } from "../../Types";
3083
3027
  /**
3084
- * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
3028
+ * 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.
3085
3029
  */
3086
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
3087
- /**
3088
- * The three.js WebGLRenderer instance associated with this renderer.
3089
- *
3090
- * @abstract
3091
- * @type {THREE.WebGLRenderer}
3092
- */
3093
- abstract three: THREE.WebGLRenderer;
3094
- /** {@link Updateable.onBeforeUpdate} */
3095
- onAfterUpdate: Event<unknown>;
3096
- /** {@link Updateable.onAfterUpdate} */
3097
- onBeforeUpdate: Event<unknown>;
3030
+ export declare class Mouse implements Disposable {
3031
+ dom: HTMLCanvasElement;
3032
+ private _event?;
3033
+ private _position;
3098
3034
  /** {@link Disposable.onDisposed} */
3099
- readonly onDisposed: Event<undefined>;
3100
- /** {@link Resizeable.onResize} */
3101
- readonly onResize: Event<THREE.Vector2>;
3035
+ readonly onDisposed: Event<unknown>;
3036
+ constructor(dom: HTMLCanvasElement);
3102
3037
  /**
3103
- * Event that fires when there has been a change to the list of clipping
3104
- * planes used by the active renderer.
3038
+ * The real position of the mouse of the Three.js canvas.
3105
3039
  */
3106
- readonly onClippingPlanesUpdated: Event<unknown>;
3107
- /** {@link Updateable.update} */
3108
- abstract update(delta?: number): void | Promise<void>;
3040
+ get position(): THREE.Vector2;
3109
3041
  /** {@link Disposable.dispose} */
3110
- abstract dispose(): void;
3111
- /** {@link Resizeable.getSize} */
3112
- abstract getSize(): Vector2;
3113
- /** {@link Resizeable.resize} */
3114
- abstract resize(size: Vector2 | undefined): void;
3115
- /**
3116
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
3117
- */
3118
- clippingPlanes: THREE.Plane[];
3119
- /**
3120
- * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
3121
- *
3122
- * @remarks
3123
- * This method is typically called when there is a change to the list of clipping planes
3124
- * used by the active renderer.
3125
- */
3126
- updateClippingPlanes(): void;
3127
- /**
3128
- * Sets or removes a clipping plane from the renderer.
3129
- *
3130
- * @param active - A boolean indicating whether the clipping plane should be active or not.
3131
- * @param plane - The clipping plane to be added or removed.
3132
- * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
3133
- *
3134
- * @remarks
3135
- * This method adds or removes a clipping plane from the 'clippingPlanes' array.
3136
- * If 'active' is 'true' and the plane is not already in the array, it is added.
3137
- * If 'active' is 'false' and the plane is in the array, it is removed.
3138
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
3139
- * excluding any planes marked as local.
3140
- */
3141
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
3042
+ dispose(): void;
3043
+ private getPositionY;
3044
+ private getPositionX;
3045
+ private updateMouseInfo;
3046
+ private setupEvents;
3142
3047
  }
3143
3048
  import { NavigationMode } from "./types";
3144
3049
  import { OrthoPerspectiveCamera } from "../index";
@@ -3157,94 +3062,92 @@ export declare class FirstPersonMode implements NavigationMode {
3157
3062
  private setupFirstPersonCamera;
3158
3063
  }
3159
3064
  import * as THREE from "three";
3160
- import { BaseScene } from "./base-scene";
3161
- import { BaseCamera } from "./base-camera";
3162
- import { BaseRenderer } from "./base-renderer";
3163
- import { Updateable, Disposable } from "./interfaces";
3164
- /**
3165
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3166
- */
3167
- export interface World extends Disposable, Updateable {
3168
- /**
3169
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
3170
- */
3171
- meshes: Set<THREE.Mesh>;
3172
- /**
3173
- * The base scene of the world.
3174
- */
3175
- scene: BaseScene;
3176
- /**
3177
- * The base camera of the world.
3178
- */
3179
- camera: BaseCamera;
3180
- /**
3181
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3182
- */
3183
- renderer: BaseRenderer | null;
3184
- /**
3185
- * A unique identifier for the world.
3186
- */
3187
- uuid: string;
3188
- /**
3189
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3190
- */
3191
- isDisposing: boolean;
3192
- }
3193
- import * as THREE from "three";
3194
- import { Disposable } from "./interfaces";
3195
- import { Event } from "./event";
3196
3065
  import { Components } from "../../Components";
3197
- import { BaseWorldItem } from "./base-world-item";
3066
+ import { Event, World, Disposable } from "../../Types";
3067
+ import { Mouse } from "./mouse";
3198
3068
  /**
3199
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3069
+ * 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.
3200
3070
  */
3201
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3071
+ export declare class SimpleRaycaster implements Disposable {
3072
+ /** {@link Component.enabled} */
3073
+ enabled: boolean;
3074
+ /** The components instance to which this Raycaster belongs. */
3075
+ components: Components;
3202
3076
  /** {@link Disposable.onDisposed} */
3203
3077
  readonly onDisposed: Event<unknown>;
3078
+ /** The position of the mouse in the screen. */
3079
+ readonly mouse: Mouse;
3080
+ /**
3081
+ * A reference to the Three.js Raycaster instance.
3082
+ * This is used for raycasting operations.
3083
+ */
3084
+ readonly three: THREE.Raycaster;
3204
3085
  /**
3205
- * Abstract property representing the three.js object associated with this scene.
3206
- * It should be implemented by subclasses.
3086
+ * A reference to the world instance to which this Raycaster belongs.
3087
+ * This is used to access the camera and meshes.
3207
3088
  */
3208
- abstract three: THREE.Object3D;
3209
- protected constructor(components: Components);
3089
+ world: World;
3090
+ constructor(components: Components, world: World);
3210
3091
  /** {@link Disposable.dispose} */
3211
3092
  dispose(): void;
3093
+ /**
3094
+ * Throws a ray from the camera to the mouse or touch event point and returns
3095
+ * the first item found. This also takes into account the clipping planes
3096
+ * used by the renderer.
3097
+ *
3098
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3099
+ * to query. If not provided, it will query all the meshes stored in
3100
+ * {@link Components.meshes}.
3101
+ */
3102
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3103
+ /**
3104
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3105
+ * This method also takes into account the clipping planes used by the renderer.
3106
+ *
3107
+ * @param origin - The origin of the ray.
3108
+ * @param direction - The direction of the ray.
3109
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3110
+ * @returns The first intersection found or 'null' if no intersection was found.
3111
+ */
3112
+ 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;
3113
+ private intersect;
3114
+ private filterClippingPlanes;
3212
3115
  }
3213
3116
  import { NavigationMode } from "./types";
3214
3117
  import { OrthoPerspectiveCamera } from "../index";
3215
3118
  /**
3216
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3119
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3217
3120
  */
3218
- export declare class OrbitMode implements NavigationMode {
3219
- camera: OrthoPerspectiveCamera;
3121
+ export declare class PlanMode implements NavigationMode {
3122
+ private camera;
3220
3123
  /** {@link NavigationMode.enabled} */
3221
3124
  enabled: boolean;
3222
3125
  /** {@link NavigationMode.id} */
3223
- readonly id = "Orbit";
3126
+ readonly id = "Plan";
3127
+ private mouseAction1?;
3128
+ private mouseAction2?;
3129
+ private mouseInitialized;
3130
+ private readonly defaultAzimuthSpeed;
3131
+ private readonly defaultPolarSpeed;
3224
3132
  constructor(camera: OrthoPerspectiveCamera);
3225
3133
  /** {@link NavigationMode.set} */
3226
3134
  set(active: boolean): void;
3227
- private activateOrbitControls;
3228
3135
  }
3229
3136
  import { NavigationMode } from "./types";
3230
3137
  import { OrthoPerspectiveCamera } from "../index";
3231
3138
  /**
3232
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3139
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3233
3140
  */
3234
- export declare class PlanMode implements NavigationMode {
3235
- private camera;
3141
+ export declare class OrbitMode implements NavigationMode {
3142
+ camera: OrthoPerspectiveCamera;
3236
3143
  /** {@link NavigationMode.enabled} */
3237
3144
  enabled: boolean;
3238
3145
  /** {@link NavigationMode.id} */
3239
- readonly id = "Plan";
3240
- private mouseAction1?;
3241
- private mouseAction2?;
3242
- private mouseInitialized;
3243
- private readonly defaultAzimuthSpeed;
3244
- private readonly defaultPolarSpeed;
3146
+ readonly id = "Orbit";
3245
3147
  constructor(camera: OrthoPerspectiveCamera);
3246
3148
  /** {@link NavigationMode.set} */
3247
3149
  set(active: boolean): void;
3150
+ private activateOrbitControls;
3248
3151
  }
3249
3152
  import * as THREE from "three";
3250
3153
  import { CameraProjection } from "./types";
@@ -3317,6 +3220,103 @@ export interface NavigationMode {
3317
3220
  /** Whether this navigation mode is active or not. */
3318
3221
  enabled: boolean;
3319
3222
  }
3223
+ import * as THREE from "three";
3224
+ import { Hideable, Disposable, Event, World } from "../../Types";
3225
+ import { Components } from "../../Components";
3226
+ /**
3227
+ * Each of the clipping planes created by the clipper.
3228
+ */
3229
+ export declare class SimplePlane implements Disposable, Hideable {
3230
+ /** Event that fires when the user starts dragging a clipping plane. */
3231
+ readonly onDraggingStarted: Event<unknown>;
3232
+ /** Event that fires when the user stops dragging a clipping plane. */
3233
+ readonly onDraggingEnded: Event<unknown>;
3234
+ /** {@link Disposable.onDisposed} */
3235
+ readonly onDisposed: Event<unknown>;
3236
+ /**
3237
+ * The normal vector of the clipping plane.
3238
+ */
3239
+ readonly normal: THREE.Vector3;
3240
+ /**
3241
+ * The origin point of the clipping plane.
3242
+ */
3243
+ readonly origin: THREE.Vector3;
3244
+ /**
3245
+ * The THREE.js Plane object representing the clipping plane.
3246
+ */
3247
+ readonly three: THREE.Plane;
3248
+ /** The components instance to which this plane belongs. */
3249
+ components: Components;
3250
+ /** The world instance to which this plane belongs. */
3251
+ world: World;
3252
+ protected readonly _helper: THREE.Object3D;
3253
+ protected _visible: boolean;
3254
+ protected _enabled: boolean;
3255
+ private _controlsActive;
3256
+ private readonly _arrowBoundBox;
3257
+ private readonly _planeMesh;
3258
+ private readonly _controls;
3259
+ private readonly _hiddenMaterial;
3260
+ /**
3261
+ * Getter for the enabled state of the clipping plane.
3262
+ * @returns {boolean} The current enabled state.
3263
+ */
3264
+ get enabled(): boolean;
3265
+ /**
3266
+ * Setter for the enabled state of the clipping plane.
3267
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3268
+ * @param {boolean} state - The new enabled state.
3269
+ */
3270
+ set enabled(state: boolean);
3271
+ /** {@link Hideable.visible } */
3272
+ get visible(): boolean;
3273
+ /** {@link Hideable.visible } */
3274
+ set visible(state: boolean);
3275
+ /** The meshes used for raycasting */
3276
+ get meshes(): THREE.Mesh[];
3277
+ /** The material of the clipping plane representation. */
3278
+ get planeMaterial(): THREE.Material | THREE.Material[];
3279
+ /** The material of the clipping plane representation. */
3280
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
3281
+ /** The size of the clipping plane representation. */
3282
+ get size(): number;
3283
+ /** Sets the size of the clipping plane representation. */
3284
+ set size(size: number);
3285
+ /**
3286
+ * Getter for the helper object of the clipping plane.
3287
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3288
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3289
+ *
3290
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
3291
+ */
3292
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3293
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3294
+ /**
3295
+ * Sets the clipping plane's normal and origin from the given normal and point.
3296
+ * This method resets the clipping plane's state, updates the normal and origin,
3297
+ * and positions the helper object accordingly.
3298
+ *
3299
+ * @param normal - The new normal vector for the clipping plane.
3300
+ * @param point - The new origin point for the clipping plane.
3301
+ *
3302
+ * @returns {void}
3303
+ */
3304
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3305
+ /** {@link Updateable.update} */
3306
+ update: () => void;
3307
+ /** {@link Disposable.dispose} */
3308
+ dispose(): void;
3309
+ private reset;
3310
+ protected toggleControls(state: boolean): void;
3311
+ private newTransformControls;
3312
+ private initializeControls;
3313
+ private createArrowBoundingBox;
3314
+ private changeDrag;
3315
+ private notifyDraggingChanged;
3316
+ private preventCameraMovement;
3317
+ private newHelper;
3318
+ private static newPlaneMesh;
3319
+ }
3320
3320
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3321
3321
  /**
3322
3322
  * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3328,6 +3328,52 @@ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3328
3328
  */
3329
3329
  propertiesSize: number;
3330
3330
  }
3331
+ import * as THREE from "three";
3332
+ import * as WEBIFC from "web-ifc";
3333
+ import * as FRAGS from "@thatopen/fragments";
3334
+ export declare class CivilReader {
3335
+ defLineMat: THREE.LineBasicMaterial;
3336
+ read(webIfc: WEBIFC.IfcAPI): {
3337
+ alignments: Map<number, FRAGS.Alignment>;
3338
+ coordinationMatrix: THREE.Matrix4;
3339
+ } | undefined;
3340
+ get(civilItems: any): {
3341
+ alignments: Map<number, FRAGS.Alignment>;
3342
+ coordinationMatrix: THREE.Matrix4;
3343
+ } | undefined;
3344
+ private getCurves;
3345
+ }
3346
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3347
+ /**
3348
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3349
+ */
3350
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3351
+ /**
3352
+ * Minimum number of geometries to be streamed.
3353
+ * Defaults to 10 geometries.
3354
+ */
3355
+ minGeometrySize: number;
3356
+ /**
3357
+ * Minimum amount of assets to be streamed.
3358
+ * Defaults to 1000 assets.
3359
+ */
3360
+ minAssetsSize: number;
3361
+ }
3362
+ import * as WEBIFC from "web-ifc";
3363
+ export declare class IfcMetadataReader {
3364
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3365
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3366
+ }
3367
+ import * as WEBIFC from "web-ifc";
3368
+ import * as THREE from "three";
3369
+ export declare class Units {
3370
+ factor: number;
3371
+ complement: number;
3372
+ apply(matrix: THREE.Matrix4): void;
3373
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3374
+ private getLengthUnits;
3375
+ private getScaleMatrix;
3376
+ }
3331
3377
  /**
3332
3378
  * 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.
3333
3379
  */
@@ -3357,36 +3403,10 @@ export interface StreamedAsset {
3357
3403
  color: number[];
3358
3404
  }[];
3359
3405
  }
3360
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3361
- /**
3362
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3363
- */
3364
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3365
- /**
3366
- * Minimum number of geometries to be streamed.
3367
- * Defaults to 10 geometries.
3368
- */
3369
- minGeometrySize: number;
3370
- /**
3371
- * Minimum amount of assets to be streamed.
3372
- * Defaults to 1000 assets.
3373
- */
3374
- minAssetsSize: number;
3375
- }
3406
+ import { BufferGeometry } from "three";
3376
3407
  import * as THREE from "three";
3377
- import * as WEBIFC from "web-ifc";
3378
- import * as FRAGS from "@thatopen/fragments";
3379
- export declare class CivilReader {
3380
- defLineMat: THREE.LineBasicMaterial;
3381
- read(webIfc: WEBIFC.IfcAPI): {
3382
- alignments: Map<number, FRAGS.Alignment>;
3383
- coordinationMatrix: THREE.Matrix4;
3384
- } | undefined;
3385
- get(civilItems: any): {
3386
- alignments: Map<number, FRAGS.Alignment>;
3387
- coordinationMatrix: THREE.Matrix4;
3388
- } | undefined;
3389
- private getCurves;
3408
+ export declare class TransformHelper {
3409
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3390
3410
  }
3391
3411
  export type RelationsMap = Map<number, Map<number, number[]>>;
3392
3412
  export interface ModelsRelationMap {
@@ -3412,25 +3432,5 @@ export type InverseAttributes = [
3412
3432
  "ContainsElements"
3413
3433
  ];
3414
3434
  export type InverseAttribute = InverseAttributes[number];
3415
- import { BufferGeometry } from "three";
3416
- import * as THREE from "three";
3417
- export declare class TransformHelper {
3418
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3419
- }
3420
- import * as WEBIFC from "web-ifc";
3421
- export declare class IfcMetadataReader {
3422
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3423
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3424
- }
3425
- import * as WEBIFC from "web-ifc";
3426
- import * as THREE from "three";
3427
- export declare class Units {
3428
- factor: number;
3429
- complement: number;
3430
- apply(matrix: THREE.Matrix4): void;
3431
- setUp(webIfc: WEBIFC.IfcAPI): void;
3432
- private getLengthUnits;
3433
- private getScaleMatrix;
3434
- }
3435
3435
 
3436
3436
  }