@thatopen/components 2.1.10 → 2.1.11

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,53 +1,4 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, World, Event } from "../Types";
3
- import { GridConfig, SimpleGrid } from "./src";
4
- import { Components } from "../Components";
5
- /**
6
- * 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).
7
- */
8
- export declare class Grids extends Component implements Disposable {
9
- /**
10
- * A unique identifier for the component.
11
- * This UUID is used to register the component within the Components system.
12
- */
13
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
14
- /**
15
- * A map of world UUIDs to their corresponding grid instances.
16
- */
17
- list: Map<string, SimpleGrid>;
18
- /**
19
- * The default configuration for grid creation.
20
- */
21
- config: Required<GridConfig>;
22
- /** {@link Disposable.onDisposed} */
23
- readonly onDisposed: Event<unknown>;
24
- /** {@link Component.enabled} */
25
- enabled: boolean;
26
- constructor(components: Components);
27
- /**
28
- * Creates a new grid for the given world.
29
- * Throws an error if a grid already exists for the world.
30
- *
31
- * @param world - The world to create the grid for.
32
- * @returns The newly created grid.
33
- *
34
- * @throws Will throw an error if a grid already exists for the given world.
35
- */
36
- create(world: World): SimpleGrid;
37
- /**
38
- * Deletes the grid associated with the given world.
39
- * If a grid does not exist for the given world, this method does nothing.
40
- *
41
- * @param world - The world for which to delete the grid.
42
- *
43
- * @remarks
44
- * This method will dispose of the grid and remove it from the internal list.
45
- * If the world is disposed before calling this method, the grid will be automatically deleted.
46
- */
47
- delete(world: World): void;
48
- /** {@link Disposable.dispose} */
49
- dispose(): void;
50
- }
51
2
  import { Component, Disposable, Event } from "../Types";
52
3
  /**
53
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.
@@ -56,7 +7,7 @@ export declare class Components implements Disposable {
56
7
  /**
57
8
  * The version of the @thatopen/components library.
58
9
  */
59
- static readonly release = "2.1.10";
10
+ static readonly release = "2.1.11";
60
11
  /** {@link Disposable.onDisposed} */
61
12
  readonly onDisposed: Event<void>;
62
13
  /**
@@ -125,137 +76,6 @@ export declare class Components implements Disposable {
125
76
  private static setupBVH;
126
77
  }
127
78
  import * as THREE from "three";
128
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
129
- import { SimplePlane } from "./src";
130
- import { Components } from "../Components";
131
- /**
132
- * 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).
133
- *
134
- * @param components - the instance of {@link Components} used.
135
- * E.g. {@link SimplePlane}.
136
- */
137
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
138
- /**
139
- * A unique identifier for the component.
140
- * This UUID is used to register the component within the Components system.
141
- */
142
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
143
- /** Event that fires when the user starts dragging a clipping plane. */
144
- readonly onBeforeDrag: Event<void>;
145
- /** Event that fires when the user stops dragging a clipping plane. */
146
- readonly onAfterDrag: Event<void>;
147
- /**
148
- * Event that fires when the user starts creating a clipping plane.
149
- */
150
- readonly onBeforeCreate: Event<unknown>;
151
- /**
152
- * Event that fires when the user cancels the creation of a clipping plane.
153
- */
154
- readonly onBeforeCancel: Event<unknown>;
155
- /**
156
- * Event that fires after the user cancels the creation of a clipping plane.
157
- */
158
- readonly onAfterCancel: Event<unknown>;
159
- /**
160
- * Event that fires when the user starts deleting a clipping plane.
161
- */
162
- readonly onBeforeDelete: Event<unknown>;
163
- /**
164
- * Event that fires after a clipping plane has been created.
165
- * @param plane - The newly created clipping plane.
166
- */
167
- readonly onAfterCreate: Event<SimplePlane>;
168
- /**
169
- * Event that fires after a clipping plane has been deleted.
170
- * @param plane - The deleted clipping plane.
171
- */
172
- readonly onAfterDelete: Event<SimplePlane>;
173
- /** {@link Disposable.onDisposed} */
174
- readonly onDisposed: Event<string>;
175
- /**
176
- * Whether to force the clipping plane to be orthogonal in the Y direction
177
- * (up). This is desirable when clipping a building horizontally and a
178
- * clipping plane is created in its roof, which might have a slight
179
- * slope for draining purposes.
180
- */
181
- orthogonalY: boolean;
182
- /**
183
- * The tolerance that determines whether an almost-horizontal clipping plane
184
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
185
- * has to be 'true' for this to apply.
186
- */
187
- toleranceOrthogonalY: number;
188
- /**
189
- * The type of clipping plane to be created.
190
- * Default is {@link SimplePlane}.
191
- */
192
- Type: new (...args: any) => SimplePlane;
193
- /**
194
- * A list of all the clipping planes created by this component.
195
- */
196
- list: SimplePlane[];
197
- /** The material used in all the clipping planes. */
198
- private _material;
199
- private _size;
200
- private _enabled;
201
- private _visible;
202
- /** {@link Component.enabled} */
203
- get enabled(): boolean;
204
- /** {@link Component.enabled} */
205
- set enabled(state: boolean);
206
- /** {@link Hideable.visible } */
207
- get visible(): boolean;
208
- /** {@link Hideable.visible } */
209
- set visible(state: boolean);
210
- /** The material of the clipping plane representation. */
211
- get material(): THREE.MeshBasicMaterial;
212
- /** The material of the clipping plane representation. */
213
- set material(material: THREE.MeshBasicMaterial);
214
- /** The size of the geometric representation of the clippings planes. */
215
- get size(): number;
216
- /** The size of the geometric representation of the clippings planes. */
217
- set size(size: number);
218
- constructor(components: Components);
219
- /** {@link Disposable.dispose} */
220
- dispose(): void;
221
- /** {@link Createable.create} */
222
- create(world: World): SimplePlane | null;
223
- /**
224
- * Creates a plane in a certain place and with a certain orientation,
225
- * without the need of the mouse.
226
- *
227
- * @param world - the world where this plane should be created.
228
- * @param normal - the orientation of the clipping plane.
229
- * @param point - the position of the clipping plane.
230
- * navigation.
231
- */
232
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
233
- /**
234
- * {@link Createable.delete}
235
- *
236
- * @param world - the world where the plane to delete is.
237
- * @param plane - the plane to delete. If undefined, the first plane
238
- * found under the cursor will be deleted.
239
- */
240
- delete(world: World, plane?: SimplePlane): void;
241
- /**
242
- * Deletes all the existing clipping planes.
243
- *
244
- * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
245
- */
246
- deleteAll(types?: Set<string>): void;
247
- private deletePlane;
248
- private pickPlane;
249
- private getAllPlaneMeshes;
250
- private createPlaneFromIntersection;
251
- private getWorldNormal;
252
- private normalizePlaneDirectionY;
253
- private newPlane;
254
- private updateMaterialsAndPlanes;
255
- private _onStartDragging;
256
- private _onEndDragging;
257
- }
258
- import * as THREE from "three";
259
79
  import { Components } from "../Components";
260
80
  import { Component } from "../Types";
261
81
  /**
@@ -300,6 +120,48 @@ export declare class Disposer extends Component {
300
120
  private disposeChildren;
301
121
  private static disposeMaterial;
302
122
  }
123
+ import { Component, Disposable, World, Event } from "../Types";
124
+ import { SimpleRaycaster } from "./src";
125
+ import { Components } from "../Components";
126
+ /**
127
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
128
+ */
129
+ export declare class Raycasters extends Component implements Disposable {
130
+ /**
131
+ * A unique identifier for the component.
132
+ * This UUID is used to register the component within the Components system.
133
+ */
134
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
135
+ /** {@link Component.enabled} */
136
+ enabled: boolean;
137
+ /**
138
+ * A Map that stores raycasters for each world.
139
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
140
+ */
141
+ list: Map<string, SimpleRaycaster>;
142
+ /** {@link Disposable.onDisposed} */
143
+ onDisposed: Event<unknown>;
144
+ constructor(components: Components);
145
+ /**
146
+ * Retrieves a SimpleRaycaster instance for the given world.
147
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
148
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
149
+ *
150
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
151
+ * @returns The SimpleRaycaster instance for the given world.
152
+ */
153
+ get(world: World): SimpleRaycaster;
154
+ /**
155
+ * Deletes the SimpleRaycaster instance associated with the given world.
156
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
157
+ *
158
+ * @param world - The world for which to delete the SimpleRaycaster instance.
159
+ * @returns {void}
160
+ */
161
+ delete(world: World): void;
162
+ /** {@link Disposable.dispose} */
163
+ dispose(): void;
164
+ }
303
165
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
304
166
  import { Components } from "../Components";
305
167
  import { SimpleWorld } from "./src";
@@ -367,94 +229,101 @@ export declare class Worlds extends Component implements Updateable, Disposable
367
229
  /** {@link Updateable.update} */
368
230
  update(delta?: number): void | Promise<void>;
369
231
  }
370
- import { MiniMap } from "./src";
371
- import { Component, Updateable, World, Event, Disposable } from "../Types";
232
+ import { Component, Disposable, World, Event } from "../Types";
233
+ import { GridConfig, SimpleGrid } from "./src";
372
234
  import { Components } from "../Components";
373
235
  /**
374
- * 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).
236
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
375
237
  */
376
- export declare class MiniMaps extends Component implements Updateable, Disposable {
238
+ export declare class Grids extends Component implements Disposable {
377
239
  /**
378
240
  * A unique identifier for the component.
379
241
  * This UUID is used to register the component within the Components system.
380
242
  */
381
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
382
- /** {@link Updateable.onAfterUpdate} */
383
- readonly onAfterUpdate: Event<unknown>;
384
- /** {@link Updateable.onBeforeUpdate} */
385
- readonly onBeforeUpdate: Event<unknown>;
243
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
244
+ /**
245
+ * A map of world UUIDs to their corresponding grid instances.
246
+ */
247
+ list: Map<string, SimpleGrid>;
248
+ /**
249
+ * The default configuration for grid creation.
250
+ */
251
+ config: Required<GridConfig>;
386
252
  /** {@link Disposable.onDisposed} */
387
253
  readonly onDisposed: Event<unknown>;
388
254
  /** {@link Component.enabled} */
389
255
  enabled: boolean;
390
- /**
391
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
392
- */
393
- list: Map<string, MiniMap>;
394
256
  constructor(components: Components);
395
257
  /**
396
- * Creates a new {@link MiniMap} instance associated with the given world.
397
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
258
+ * Creates a new grid for the given world.
259
+ * Throws an error if a grid already exists for the world.
398
260
  *
399
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
400
- * @returns The newly created {@link MiniMap} instance.
401
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
402
- */
403
- create(world: World): MiniMap;
261
+ * @param world - The world to create the grid for.
262
+ * @returns The newly created grid.
263
+ *
264
+ * @throws Will throw an error if a grid already exists for the given world.
265
+ */
266
+ create(world: World): SimpleGrid;
404
267
  /**
405
- * Deletes a {@link MiniMap} instance associated with the given world ID.
406
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
268
+ * Deletes the grid associated with the given world.
269
+ * If a grid does not exist for the given world, this method does nothing.
407
270
  *
408
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
409
- * @returns {void}
271
+ * @param world - The world for which to delete the grid.
272
+ *
273
+ * @remarks
274
+ * This method will dispose of the grid and remove it from the internal list.
275
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
410
276
  */
411
- delete(id: string): void;
277
+ delete(world: World): void;
412
278
  /** {@link Disposable.dispose} */
413
279
  dispose(): void;
414
- /** {@link Updateable.update} */
415
- update(): void;
416
280
  }
417
- import { Component, Disposable, World, Event } from "../Types";
418
- import { SimpleRaycaster } from "./src";
281
+ import { MiniMap } from "./src";
282
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
419
283
  import { Components } from "../Components";
420
284
  /**
421
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
285
+ * 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).
422
286
  */
423
- export declare class Raycasters extends Component implements Disposable {
287
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
424
288
  /**
425
289
  * A unique identifier for the component.
426
290
  * This UUID is used to register the component within the Components system.
427
291
  */
428
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
292
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
293
+ /** {@link Updateable.onAfterUpdate} */
294
+ readonly onAfterUpdate: Event<unknown>;
295
+ /** {@link Updateable.onBeforeUpdate} */
296
+ readonly onBeforeUpdate: Event<unknown>;
297
+ /** {@link Disposable.onDisposed} */
298
+ readonly onDisposed: Event<unknown>;
429
299
  /** {@link Component.enabled} */
430
300
  enabled: boolean;
431
301
  /**
432
- * A Map that stores raycasters for each world.
433
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
302
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
434
303
  */
435
- list: Map<string, SimpleRaycaster>;
436
- /** {@link Disposable.onDisposed} */
437
- onDisposed: Event<unknown>;
304
+ list: Map<string, MiniMap>;
438
305
  constructor(components: Components);
439
306
  /**
440
- * Retrieves a SimpleRaycaster instance for the given world.
441
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
442
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
307
+ * Creates a new {@link MiniMap} instance associated with the given world.
308
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
443
309
  *
444
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
445
- * @returns The SimpleRaycaster instance for the given world.
310
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
311
+ * @returns The newly created {@link MiniMap} instance.
312
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
446
313
  */
447
- get(world: World): SimpleRaycaster;
314
+ create(world: World): MiniMap;
448
315
  /**
449
- * Deletes the SimpleRaycaster instance associated with the given world.
450
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
316
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
317
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
451
318
  *
452
- * @param world - The world for which to delete the SimpleRaycaster instance.
319
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
453
320
  * @returns {void}
454
321
  */
455
- delete(world: World): void;
322
+ delete(id: string): void;
456
323
  /** {@link Disposable.dispose} */
457
324
  dispose(): void;
325
+ /** {@link Updateable.update} */
326
+ update(): void;
458
327
  }
459
328
  import { Components } from "../Components";
460
329
  import { MeshCullerRenderer, CullerRendererSettings } from "./src";
@@ -505,6 +374,137 @@ export declare class Cullers extends Component implements Disposable {
505
374
  dispose(): void;
506
375
  }
507
376
  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): SimplePlane | null;
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
+ /**
491
+ * Deletes all the existing clipping planes.
492
+ *
493
+ * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
494
+ */
495
+ deleteAll(types?: Set<string>): void;
496
+ private deletePlane;
497
+ private pickPlane;
498
+ private getAllPlaneMeshes;
499
+ private createPlaneFromIntersection;
500
+ private getWorldNormal;
501
+ private normalizePlaneDirectionY;
502
+ private newPlane;
503
+ private updateMaterialsAndPlanes;
504
+ private _onStartDragging;
505
+ private _onEndDragging;
506
+ }
507
+ import * as THREE from "three";
508
508
  import { Components } from "../Components";
509
509
  import { SimpleCamera } from "..";
510
510
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
@@ -568,418 +568,454 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
568
568
  private newOrthoCamera;
569
569
  private setOrthoPerspCameraAspect;
570
570
  }
571
- export declare class UUID {
572
- private static _pattern;
573
- private static _lut;
574
- static create(): string;
575
- static validate(uuid: string): void;
576
- }
577
- import * as THREE from "three";
578
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
579
- center: THREE.Vector3;
580
- halfSizes: THREE.Vector3;
581
- rotation: THREE.Matrix3;
582
- transformation: THREE.Matrix4;
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";
571
+ import * as WEBIFC from "web-ifc";
572
+ import * as FRAG from "@thatopen/fragments";
573
+ import { Component, Components } from "../../core";
587
574
  /**
588
- * Configuration interface for the VertexPicker component.
575
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
589
576
  */
590
- export interface VertexPickerConfig {
591
- /**
592
- * If true, only vertices will be picked, not the closest point on the face.
593
- */
594
- showOnlyVertex: boolean;
577
+ export declare class IfcJsonExporter extends Component {
595
578
  /**
596
- * The maximum distance for snapping to a vertex.
579
+ * A unique identifier for the component.
580
+ * This UUID is used to register the component within the Components system.
597
581
  */
598
- snapDistance: number;
582
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
583
+ /** {@link Component.enabled} */
584
+ enabled: boolean;
585
+ constructor(components: Components);
599
586
  /**
600
- * The HTML element to use for previewing the picked vertex.
587
+ * Exports all the properties of an IFC into an array of JS objects.
588
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
589
+ * @param modelID ID of the IFC model whose properties to extract.
590
+ * @param indirect whether to get the indirect relationships as well.
591
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
592
+ * to make the location data available (e.g. absolute position of building).
601
593
  */
602
- previewElement: HTMLElement;
594
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
595
+ }
596
+ import * as THREE from "three";
597
+ export declare class MaterialsUtils {
598
+ static isTransparent(material: THREE.Material): boolean;
603
599
  }
600
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
601
+ import * as WEBIFC from "web-ifc";
602
+ import { FragmentsGroup } from "@thatopen/fragments";
603
+ import { Component, Disposable, Event, Components } from "../../core";
604
604
  /**
605
- * A class that provides functionality for picking vertices in a 3D scene.
605
+ * Types for boolean properties in IFC schema.
606
606
  */
607
- export declare class VertexPicker extends Component implements Disposable {
608
- /** {@link Disposable.onDisposed} */
609
- readonly onDisposed: Event<unknown>;
610
- /**
611
- * An event that is triggered when a vertex is found.
612
- * The event passes a THREE.Vector3 representing the position of the found vertex.
607
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
608
+ /**
609
+ * Types for string properties in IFC schema.
610
+ */
611
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
612
+ /**
613
+ * Types for numeric properties in IFC schema.
614
+ */
615
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
616
+ /**
617
+ * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
618
+ */
619
+ export interface ChangeMap {
620
+ [modelID: string]: Set<number>;
621
+ }
622
+ /**
623
+ * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
624
+ */
625
+ export interface AttributeListener {
626
+ [modelID: string]: {
627
+ [expressID: number]: {
628
+ [attributeName: string]: Event<String | Boolean | Number>;
629
+ };
630
+ };
631
+ }
632
+ /**
633
+ * Component to manage and edit properties and Psets in IFC files.
634
+ */
635
+ export declare class IfcPropertiesManager extends Component implements Disposable {
636
+ /**
637
+ * A unique identifier for the component.
638
+ * This UUID is used to register the component within the Components system.
613
639
  */
614
- readonly onVertexFound: Event<THREE.Vector3>;
640
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
641
+ /** {@link Disposable.onDisposed} */
642
+ readonly onDisposed: Event<string>;
615
643
  /**
616
- * An event that is triggered when a vertex is lost.
617
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
644
+ * Event triggered when a file is requested for export.
618
645
  */
619
- readonly onVertexLost: Event<THREE.Vector3>;
646
+ readonly onRequestFile: Event<unknown>;
620
647
  /**
621
- * An event that is triggered when the picker is enabled or disabled
648
+ * ArrayBuffer containing the IFC data to be exported.
622
649
  */
623
- readonly onEnabled: Event<boolean>;
650
+ ifcToExport: ArrayBuffer | null;
624
651
  /**
625
- * A reference to the Components instance associated with this VertexPicker.
652
+ * Event triggered when an element is added to a Pset.
626
653
  */
627
- components: Components;
654
+ readonly onElementToPset: Event<{
655
+ model: FragmentsGroup;
656
+ psetID: number;
657
+ elementID: number;
658
+ }>;
628
659
  /**
629
- * A reference to the working plane used for vertex picking.
630
- * This plane is used to determine which vertices are considered valid for picking.
631
- * If this value is null, all vertices are considered valid.
660
+ * Event triggered when a property is added to a Pset.
632
661
  */
633
- workingPlane: THREE.Plane | null;
634
- private _pickedPoint;
635
- private _config;
636
- private _enabled;
662
+ readonly onPropToPset: Event<{
663
+ model: FragmentsGroup;
664
+ psetID: number;
665
+ propID: number;
666
+ }>;
637
667
  /**
638
- * Sets the enabled state of the VertexPicker.
639
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
640
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
641
- *
642
- * @param value - The new enabled state.
668
+ * Event triggered when a Pset is removed.
643
669
  */
644
- set enabled(value: boolean);
670
+ readonly onPsetRemoved: Event<{
671
+ model: FragmentsGroup;
672
+ psetID: number;
673
+ }>;
645
674
  /**
646
- * Gets the current enabled state of the VertexPicker.
647
- *
648
- * @returns The current enabled state.
675
+ * Event triggered when data in the model changes.
649
676
  */
650
- get enabled(): boolean;
677
+ readonly onDataChanged: Event<{
678
+ model: FragmentsGroup;
679
+ expressID: number;
680
+ }>;
651
681
  /**
652
- * Sets the configuration for the VertexPicker component.
653
- *
654
- * @param value - A Partial object containing the configuration properties to update.
655
- * The properties not provided in the value object will retain their current values.
656
- *
657
- * @example
658
- * '''typescript
659
- * vertexPicker.config = {
660
- * snapDistance: 0.5,
661
- * showOnlyVertex: true,
662
- * };
663
- * '''
682
+ * Configuration for the WebAssembly module.
664
683
  */
665
- set config(value: Partial<VertexPickerConfig>);
684
+ wasm: {
685
+ path: string;
686
+ absolute: boolean;
687
+ };
688
+ /** {@link Component.enabled} */
689
+ enabled: boolean;
666
690
  /**
667
- * Gets the current configuration for the VertexPicker component.
668
- *
669
- * @returns A copy of the current VertexPickerConfig object.
670
- *
671
- * @example
672
- * '''typescript
673
- * const currentConfig = vertexPicker.config;
674
- * console.log(currentConfig.snapDistance); // Output: 0.25
675
- * '''
691
+ * Map of attribute listeners.
676
692
  */
677
- get config(): Partial<VertexPickerConfig>;
678
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
693
+ attributeListeners: AttributeListener;
694
+ /**
695
+ * The currently selected model.
696
+ */
697
+ selectedModel?: FragmentsGroup;
698
+ /**
699
+ * Map of changed entities in the model.
700
+ */
701
+ changeMap: ChangeMap;
702
+ constructor(components: Components);
679
703
  /** {@link Disposable.dispose} */
680
704
  dispose(): void;
681
705
  /**
682
- * Performs the vertex picking operation based on the current state of the VertexPicker.
683
- *
684
- * @param world - The World instance to use for raycasting.
685
- *
686
- * @returns The current picked point, or null if no point is picked.
706
+ * Static method to retrieve the IFC schema from a given model.
687
707
  *
688
- * @remarks
689
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
690
- * If enabled, it performs raycasting to find the closest intersecting object.
691
- * It then determines the closest vertex or point on the face, based on the configuration settings.
692
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
693
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
694
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
708
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
709
+ * @throws Will throw an error if the IFC schema is not found in the model.
710
+ * @returns The IFC schema associated with the given model.
695
711
  */
696
- get(world: World): THREE.Vector3 | null;
697
- private getClosestVertex;
698
- private getVertices;
699
- private getVertex;
700
- }
701
- import * as THREE from "three";
702
- export declare class MaterialsUtils {
703
- static isTransparent(material: THREE.Material): boolean;
704
- }
705
- import * as THREE from "three";
706
- import * as FRAGS from "@thatopen/fragments";
707
- import { Component, Components } from "../../core";
708
- /**
709
- * Represents an edge measurement result.
710
- */
711
- export interface MeasureEdge {
712
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
712
713
  /**
713
- * The distance between the two points of the edge.
714
+ * Method to set properties data in the model.
715
+ *
716
+ * @param model - The FragmentsGroup model in which to set the properties.
717
+ * @param dataToSave - An array of objects representing the properties to be saved.
718
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
719
+ * The rest of the properties will be set as the properties of the entity.
720
+ *
721
+ * @returns A promise that resolves when all the properties have been set.
722
+ *
723
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
714
724
  */
715
- distance: number;
725
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
716
726
  /**
717
- * The two points that define the edge.
727
+ * Creates a new Property Set (Pset) in the given model.
728
+ *
729
+ * @param model - The FragmentsGroup model in which to create the Pset.
730
+ * @param name - The name of the Pset.
731
+ * @param description - (Optional) The description of the Pset.
732
+ *
733
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
734
+ *
735
+ * @throws Will throw an error if the IFC schema is not found in the model.
736
+ * @throws Will throw an error if no OwnerHistory is found in the model.
718
737
  */
719
- points: THREE.Vector3[];
720
- }
721
- /**
722
- * 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).
723
- */
724
- export declare class MeasurementUtils extends Component {
738
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
739
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
740
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
741
+ }>;
725
742
  /**
726
- * A unique identifier for the component.
727
- * This UUID is used to register the component within the Components system.
743
+ * Removes a Property Set (Pset) from the given model.
744
+ *
745
+ * @param model - The FragmentsGroup model from which to remove the Pset.
746
+ * @param psetID - The express IDs of the Psets to be removed.
747
+ *
748
+ * @returns A promise that resolves when all the Psets have been removed.
749
+ *
750
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
751
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
752
+ * @throws Will throw an error if no relation is found between the Pset and the model.
728
753
  */
729
- static uuid: string;
730
- /** {@link Component.enabled} */
731
- enabled: boolean;
732
- constructor(components: Components);
754
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
733
755
  /**
734
- * Utility method to calculate the distance from a point to a line segment.
756
+ * Creates a new single-value property of type string in the given model.
735
757
  *
736
- * @param point - The point from which to calculate the distance.
737
- * @param lineStart - The start point of the line segment.
738
- * @param lineEnd - The end point of the line segment.
739
- * @param clamp - If true, the distance will be clamped to the line segment's length.
740
- * @returns The distance from the point to the line segment.
758
+ * @param model - The FragmentsGroup model in which to create the property.
759
+ * @param type - The type of the property value. Must be a string property type.
760
+ * @param name - The name of the property.
761
+ * @param value - The value of the property. Must be a string.
762
+ *
763
+ * @returns The newly created single-value property.
764
+ *
765
+ * @throws Will throw an error if the IFC schema is not found in the model.
766
+ * @throws Will throw an error if no OwnerHistory is found in the model.
741
767
  */
742
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
768
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
743
769
  /**
744
- * Method to get the face of a mesh that contains a given triangle index.
745
- * It also returns the edges of the found face and their indices.
770
+ * Creates a new single-value property of type numeric in the given model.
746
771
  *
747
- * @param mesh - The mesh to get the face from. It must be indexed.
748
- * @param triangleIndex - The index of the triangle within the mesh.
749
- * @param instance - The instance of the mesh (optional).
750
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
772
+ * @param model - The FragmentsGroup model in which to create the property.
773
+ * @param type - The type of the property value. Must be a numeric property type.
774
+ * @param name - The name of the property.
775
+ * @param value - The value of the property. Must be a number.
776
+ *
777
+ * @returns The newly created single-value property.
778
+ *
779
+ * @throws Will throw an error if the IFC schema is not found in the model.
780
+ * @throws Will throw an error if no OwnerHistory is found in the model.
751
781
  */
752
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
753
- edges: MeasureEdge[];
754
- indices: Set<number>;
755
- } | null;
782
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
756
783
  /**
757
- * Method to get the vertices and normal of a mesh face at a given index.
758
- * It also applies instance transformation if provided.
784
+ * Creates a new single-value property of type boolean in the given model.
785
+ *
786
+ * @param model - The FragmentsGroup model in which to create the property.
787
+ * @param type - The type of the property value. Must be a boolean property type.
788
+ * @param name - The name of the property.
789
+ * @param value - The value of the property. Must be a boolean.
790
+ *
791
+ * @returns The newly created single-value property.
759
792
  *
760
- * @param mesh - The mesh to get the face from. It must be indexed.
761
- * @param faceIndex - The index of the face within the mesh.
762
- * @param instance - The instance of the mesh (optional).
763
- * @returns An object containing the vertices and normal of the face.
764
- * @throws Will throw an error if the geometry is not indexed.
793
+ * @throws Will throw an error if the IFC schema is not found in the model.
794
+ * @throws Will throw an error if no OwnerHistory is found in the model.
765
795
  */
766
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
767
- p1: THREE.Vector3;
768
- p2: THREE.Vector3;
769
- p3: THREE.Vector3;
770
- faceNormal: THREE.Vector3;
771
- };
796
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
772
797
  /**
773
- * Method to round the vector's components to a specified number of decimal places.
774
- * This is used to ensure numerical precision in edge detection.
798
+ * Removes a property from a Property Set (Pset) in the given model.
775
799
  *
776
- * @param vector - The vector to round.
777
- * @returns The vector with rounded components.
800
+ * @param model - The FragmentsGroup model from which to remove the property.
801
+ * @param psetID - The express ID of the Pset from which to remove the property.
802
+ * @param propID - The express ID of the property to be removed.
803
+ *
804
+ * @returns A promise that resolves when the property has been removed.
805
+ *
806
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
807
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
778
808
  */
779
- round(vector: THREE.Vector3): void;
809
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
810
+ addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
780
811
  /**
781
- * Calculates the volume of a set of fragments.
812
+ * Adds elements to a Property Set (Pset) in the given model.
782
813
  *
783
- * @param frags - A map of fragment IDs to their corresponding item IDs.
784
- * @returns The total volume of the fragments and the bounding sphere.
814
+ * @param model - The FragmentsGroup model in which to add the elements.
815
+ * @param psetID - The express ID of the Pset to which to add the elements.
816
+ * @param elementID - The express IDs of the elements to be added.
785
817
  *
786
- * @remarks
787
- * This method creates a set of instanced meshes from the given fragments and item IDs.
788
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
818
+ * @returns A promise that resolves when all the elements have been added.
789
819
  *
790
- * @throws Will throw an error if the geometry of the meshes is not indexed.
791
- * @throws Will throw an error if the fragment manager is not available.
820
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
821
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
822
+ * @throws Will throw an error if no relation is found between the Pset and the model.
792
823
  */
793
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
824
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
794
825
  /**
795
- * Calculates the total volume of a set of meshes.
826
+ * Saves the changes made to the model to a new IFC file.
796
827
  *
797
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
798
- * @returns The total volume of the meshes and the bounding sphere.
828
+ * @param model - The FragmentsGroup model from which to save the changes.
829
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
799
830
  *
800
- * @remarks
801
- * This method calculates the volume of each mesh in the provided array and returns the total volume
802
- * and its bounding sphere.
831
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
803
832
  *
833
+ * @throws Will throw an error if any issues occur during the saving process.
804
834
  */
805
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
806
- private getFaceData;
807
- private getVolumeOfMesh;
808
- private getSignedVolumeOfTriangle;
809
- }
810
- import * as THREE from "three";
811
- import * as FRAGS from "@thatopen/fragments";
812
- import { Disposable, Component, Event, Components } from "../../core";
813
- /**
814
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
815
- */
816
- export interface Classification {
835
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
817
836
  /**
818
- * A system within the classification.
819
- * The key is the system name, and the value is an object representing the classes within the system.
837
+ * Sets an attribute listener for a specific attribute of an entity in the model.
838
+ * The listener will trigger an event whenever the attribute's value changes.
839
+ *
840
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
841
+ * @param expressID - The express ID of the entity for which to set the listener.
842
+ * @param attributeName - The name of the attribute for which to set the listener.
843
+ *
844
+ * @returns The event that will be triggered when the attribute's value changes.
845
+ *
846
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
847
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
848
+ * @throws Will throw an error if the attribute has a badly defined handle.
820
849
  */
821
- [system: string]: {
822
- /**
823
- * A class within the system.
824
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
825
- */
826
- [className: string]: {
827
- map: FRAGS.FragmentIdMap;
828
- name: string;
829
- id: number | null;
830
- };
831
- };
850
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
851
+ private increaseMaxID;
852
+ private newGUID;
853
+ private getOwnerHistory;
854
+ private registerChange;
855
+ private newSingleProperty;
832
856
  }
857
+ import * as WEBIFC from "web-ifc";
858
+ import { FragmentsGroup } from "@thatopen/fragments";
859
+ import { Disposable, Event, Component, Components } from "../../core";
860
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
861
+ export type { InverseAttribute, RelationsMap } from "./src/types";
833
862
  /**
834
- * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
863
+ * 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).
835
864
  */
836
- export declare class Classifier extends Component implements Disposable {
865
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
837
866
  /**
838
867
  * A unique identifier for the component.
839
868
  * This UUID is used to register the component within the Components system.
840
869
  */
841
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
842
- /** {@link Component.enabled} */
843
- enabled: boolean;
870
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
871
+ /** {@link Disposable.onDisposed} */
872
+ readonly onDisposed: Event<string>;
844
873
  /**
845
- * A map representing the classification systems.
846
- * The key is the system name, and the value is an object representing the classes within the system.
874
+ * Event triggered when relations for a model have been indexed.
875
+ * This event provides the model's UUID and the relations map generated for that model.
876
+ *
877
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
878
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
879
+ * 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.
847
880
  */
848
- list: Classification;
849
- /** {@link Disposable.onDisposed} */
850
- readonly onDisposed: Event<unknown>;
881
+ readonly onRelationsIndexed: Event<{
882
+ modelID: string;
883
+ relationsMap: RelationsMap;
884
+ }>;
885
+ /**
886
+ * Holds the relationship mappings for each model processed by the indexer.
887
+ * The structure is a map where each key is a model's UUID, and the value is another map.
888
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
889
+ * representing a specific relation type, and the value is an array of expressIDs of entities
890
+ * that are related through that relation type. This structure allows for efficient querying
891
+ * of entity relationships within a model.
892
+ */
893
+ readonly relationMaps: ModelsRelationMap;
894
+ /** {@link Component.enabled} */
895
+ enabled: boolean;
896
+ private _relToAttributesMap;
897
+ private _inverseAttributes;
898
+ private _ifcRels;
851
899
  constructor(components: Components);
852
900
  private onFragmentsDisposed;
853
- /** {@link Disposable.dispose} */
854
- dispose(): void;
901
+ private indexRelations;
902
+ private getAttributeIndex;
855
903
  /**
856
- * Removes a fragment from the classification based on its unique identifier (guid).
857
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
904
+ * Adds a relation map to the model's relations map.
858
905
  *
859
- * @param guid - The unique identifier of the fragment to be removed.
906
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
907
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
908
+ *
909
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
860
910
  */
861
- remove(guid: string): void;
911
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
862
912
  /**
863
- * Finds and returns fragments based on the provided filter criteria.
864
- * If no filter is provided, it returns all fragments.
865
- *
866
- * @param filter - An optional object containing filter criteria.
867
- * The keys of the object represent the classification system names,
868
- * and the values are arrays of class names to match.
913
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
914
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
915
+ * and maps them in a structured way to facilitate quick access to related entities.
869
916
  *
870
- * @returns A map of fragment GUIDs to their respective express IDs,
871
- * where the express IDs are filtered based on the provided filter criteria.
917
+ * The process involves querying the model for each relation type associated with the inverse attributes
918
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
919
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
920
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
921
+ * of entities that are related through that attribute.
872
922
  *
873
- * @throws Will throw an error if the fragments map is malformed.
923
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
924
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
925
+ * representation of the relations indexed by entity expressIDs and relation types.
926
+ * @throws An error if the model does not have properties loaded.
874
927
  */
875
- find(filter?: {
876
- [name: string]: string[];
877
- }): FRAGS.FragmentIdMap;
928
+ process(model: FragmentsGroup): Promise<RelationsMap>;
878
929
  /**
879
- * Classifies fragments based on their modelID.
880
- *
881
- * @param modelID - The unique identifier of the model to classify fragments by.
882
- * @param group - The FragmentsGroup containing the fragments to be classified.
883
- *
884
- * @remarks
885
- * This method iterates through the fragments in the provided group,
886
- * and classifies them based on their modelID.
887
- * The classification is stored in the 'list.models' property,
888
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
930
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
889
931
  *
932
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
933
+ * @param modelID - The unique identifier of the model within the WebIfc API.
934
+ * @returns A promise that resolves to the relations map for the processed model.
935
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
890
936
  */
891
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
937
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
892
938
  /**
893
- * Classifies fragments based on their PredefinedType property.
894
- *
895
- * @param group - The FragmentsGroup containing the fragments to be classified.
896
- *
897
- * @remarks
898
- * This method iterates through the properties of the fragments in the provided group,
899
- * and classifies them based on their PredefinedType property.
900
- * The classification is stored in the 'list.predefinedTypes' property,
901
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
939
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
940
+ * This method searches the indexed relation maps for the specified model and entity,
941
+ * returning the IDs of related entities if a match is found.
902
942
  *
903
- * @throws Will throw an error if the fragment ID is not found.
943
+ * @param model The 'FragmentsGroup' model containing the entity.
944
+ * @param expressID The unique identifier of the entity within the model.
945
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
946
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
947
+ * or the specified relation name is not indexed.
904
948
  */
905
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
949
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
906
950
  /**
907
- * Classifies fragments based on their entity type.
908
- *
909
- * @param group - The FragmentsGroup containing the fragments to be classified.
910
- *
911
- * @remarks
912
- * This method iterates through the relations of the fragments in the provided group,
913
- * and classifies them based on their entity type.
914
- * The classification is stored in the 'list.entities' property,
915
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
951
+ * Serializes the relations of a given relation map into a JSON string.
952
+ * 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,
953
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
954
+ * The resulting object is then serialized into a JSON string.
916
955
  *
917
- * @throws Will throw an error if the fragment ID is not found.
956
+ * @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.
957
+ * @returns A JSON string representing the serialized relations of the given relation map.
918
958
  */
919
- byEntity(group: FRAGS.FragmentsGroup): void;
959
+ serializeRelations(relationMap: RelationsMap): string;
920
960
  /**
921
- * Classifies fragments based on a specific IFC relationship.
922
- *
923
- * @param group - The FragmentsGroup containing the fragments to be classified.
924
- * @param ifcRel - The IFC relationship number to classify fragments by.
925
- * @param systemName - The name of the classification system to store the classification.
926
- *
927
- * @remarks
928
- * This method iterates through the relations of the fragments in the provided group,
929
- * and classifies them based on the specified IFC relationship.
930
- * The classification is stored in the 'list' property under the specified system name,
931
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
961
+ * Serializes the relations of a specific model into a JSON string.
962
+ * This method iterates through the relations indexed for the given model,
963
+ * organizing them into a structured object where each key is an expressID of an entity,
964
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
965
+ * The resulting object is then serialized into a JSON string.
932
966
  *
933
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
967
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
968
+ * @returns A JSON string representing the serialized relations of the specified model.
969
+ * If the model has no indexed relations, 'null' is returned.
934
970
  */
935
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
971
+ serializeModelRelations(model: FragmentsGroup): string | null;
936
972
  /**
937
- * Classifies fragments based on their spatial structure in the IFC model.
938
- *
939
- * @param model - The FragmentsGroup containing the fragments to be classified.
940
- * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
941
- * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
942
- * the classifier just pick the WEBIFC categories provided.
943
- *
944
- * @remarks
945
- * This method iterates through the relations of the fragments in the provided group,
946
- * and classifies them based on their spatial structure in the IFC model.
947
- * The classification is stored in the 'list' property under the system name "spatialStructures",
948
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
973
+ * Serializes all relations of every model processed by the indexer into a JSON string.
974
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
975
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
976
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
977
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
949
978
  *
950
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
979
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
980
+ * If no relations have been indexed, an empty object is returned as a JSON string.
951
981
  */
952
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
953
- useProperties?: boolean;
954
- isolate?: Set<number>;
955
- }): Promise<void>;
982
+ serializeAllRelations(): string;
956
983
  /**
957
- * Sets the color of the specified fragments.
984
+ * Converts a JSON string representing relations between entities into a structured map.
985
+ * This method parses the JSON string to reconstruct the relations map that indexes
986
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
987
+ * and the values are maps where each key is a relation type ID and its value is an array
988
+ * of express IDs of entities related through that relation type.
958
989
  *
959
- * @param items - A map of fragment IDs to their respective express IDs.
960
- * @param color - The color to set for the fragments.
961
- * @param override - A boolean indicating whether to override the existing color of the fragments.
990
+ * @param json The JSON string to be parsed into the relations map.
991
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
992
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
993
+ * is an array of express IDs (as numbers) of entities related through that relation type.
994
+ */
995
+ getRelationsMapFromJSON(json: string): RelationsMap;
996
+ /** {@link Disposable.dispose} */
997
+ dispose(): void;
998
+ /**
999
+ * Adds relations between an entity and other entities in a BIM model.
962
1000
  *
963
- * @remarks
964
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
965
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
1001
+ * @param model - The BIM model to which the relations will be added.
1002
+ * @param expressID - The expressID of the entity within the model.
1003
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1004
+ * @param relIDs - The expressIDs of the related entities within the model.
966
1005
  *
967
- * @throws Will throw an error if the fragment with the specified ID is not found.
1006
+ * @throws An error if the relation name is not a valid relation name.
968
1007
  */
969
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1008
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
970
1009
  /**
971
- * Resets the color of the specified fragments to their original color.
972
- *
973
- * @param items - A map of fragment IDs to their respective express IDs.
1010
+ * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
974
1011
  *
975
- * @remarks
976
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
977
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1012
+ * @param model The BIM model whose children to get.
1013
+ * @param expressID The expressID of the item whose children to get.
1014
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
978
1015
  *
979
- * @throws Will throw an error if the fragment with the specified ID is not found.
1016
+ * @returns A 'Set' with the expressIDs of the found items.
980
1017
  */
981
- resetColor(items: FRAGS.FragmentIdMap): void;
982
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1018
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
983
1019
  }
984
1020
  import * as THREE from "three";
985
1021
  import * as FRAGS from "@thatopen/fragments";
@@ -1189,6 +1225,12 @@ export declare class BoundingBoxer extends Component implements Disposable {
1189
1225
  addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1190
1226
  private static getFragmentBounds;
1191
1227
  }
1228
+ export declare class UUID {
1229
+ private static _pattern;
1230
+ private static _lut;
1231
+ static create(): string;
1232
+ static validate(uuid: string): void;
1233
+ }
1192
1234
  import * as FRAGS from "@thatopen/fragments";
1193
1235
  import { Components, Component } from "../../core";
1194
1236
  /**
@@ -1210,313 +1252,253 @@ export declare class Hider extends Component {
1210
1252
  *
1211
1253
  * @param visible - The visibility state to set for the fragments.
1212
1254
  * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1213
- * If not provided, all fragments will be affected.
1214
- *
1215
- * @returns {void}
1216
- */
1217
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1218
- /**
1219
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1220
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1221
- *
1222
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1223
- * If not provided, all fragments will be isolated.
1224
- *
1225
- * @returns {void}
1226
- */
1227
- isolate(items: FRAGS.FragmentIdMap): void;
1228
- private updateCulledVisibility;
1229
- }
1230
- import { Component, Disposable, Event, Components } from "../../core";
1231
- /**
1232
- * 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).
1233
- */
1234
- export declare class Exploder extends Component implements Disposable {
1235
- /**
1236
- * A unique identifier for the component.
1237
- * This UUID is used to register the component within the Components system.
1238
- */
1239
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1240
- /** {@link Disposable.onDisposed} */
1241
- readonly onDisposed: Event<unknown>;
1242
- /** {@link Component.enabled} */
1243
- enabled: boolean;
1244
- /**
1245
- * The height of the explosion animation.
1246
- * This property determines the vertical distance by which fragments are moved during the explosion.
1247
- * Default value is 10.
1248
- */
1249
- height: number;
1250
- /**
1251
- * The group name used for the explosion animation.
1252
- * This property specifies the group of fragments that will be affected by the explosion.
1253
- * Default value is "storeys".
1254
- */
1255
- groupName: string;
1256
- /**
1257
- * A set of strings representing the exploded items.
1258
- * This set is used to keep track of which items have been exploded.
1259
- */
1260
- list: Set<string>;
1261
- constructor(components: Components);
1262
- /** {@link Disposable.dispose} */
1263
- dispose(): void;
1264
- /**
1265
- * Sets the explosion state of the fragments.
1266
- *
1267
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1268
- *
1269
- * @remarks
1270
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1271
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1272
- * If 'active' is false, the fragments are moved back to their original position.
1273
- *
1274
- * The method also keeps track of the exploded items using the 'list' set.
1275
- *
1276
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1277
- */
1278
- set(active: boolean): void;
1279
- }
1280
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1281
- import * as THREE from "three";
1282
- import * as FRAGS from "@thatopen/fragments";
1283
- import { Component, Components, Event, Disposable } from "../../core";
1284
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1285
- /**
1286
- * 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).
1287
- */
1288
- export declare class FragmentsManager extends Component implements Disposable {
1289
- /**
1290
- * A unique identifier for the component.
1291
- * This UUID is used to register the component within the Components system.
1292
- */
1293
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1294
- /** {@link Disposable.onDisposed} */
1295
- readonly onDisposed: Event<unknown>;
1296
- /**
1297
- * Event triggered when fragments are loaded.
1298
- */
1299
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
1300
- /**
1301
- * Event triggered when fragments are disposed.
1302
- */
1303
- readonly onFragmentsDisposed: Event<{
1304
- groupID: string;
1305
- fragmentIDs: string[];
1306
- }>;
1307
- /**
1308
- * Map containing all loaded fragments.
1309
- * The key is the fragment's unique identifier, and the value is the fragment itself.
1310
- */
1311
- readonly list: Map<string, Fragment>;
1312
- /**
1313
- * Map containing all loaded fragment groups.
1314
- * The key is the group's unique identifier, and the value is the group itself.
1315
- */
1316
- readonly groups: Map<string, FragmentsGroup>;
1317
- baseCoordinationModel: string;
1318
- baseCoordinationMatrix: THREE.Matrix4;
1319
- /** {@link Component.enabled} */
1320
- enabled: boolean;
1321
- private _loader;
1322
- /**
1323
- * Getter for the meshes of all fragments in the FragmentsManager.
1324
- * It iterates over the fragments in the list and pushes their meshes into an array.
1325
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1326
- */
1327
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1328
- constructor(components: Components);
1329
- /** {@link Disposable.dispose} */
1330
- dispose(): void;
1331
- /**
1332
- * Dispose of a specific fragment group.
1333
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
1334
- * disposes of the group, and triggers the onFragmentsDisposed event.
1335
- *
1336
- * @param group - The fragment group to be disposed.
1337
- */
1338
- disposeGroup(group: FragmentsGroup): void;
1339
- /**
1340
- * Loads a binary file that contain fragment geometry.
1341
- * @param data - The binary data to load.
1342
- * @param config - Optional configuration for loading.
1343
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1344
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1345
- * @returns The loaded FragmentsGroup.
1346
- */
1347
- load(data: Uint8Array, config?: Partial<{
1348
- coordinate: boolean;
1349
- name: string;
1350
- properties: FRAGS.IfcProperties;
1351
- relationsMap: RelationsMap;
1352
- }>): FragmentsGroup;
1353
- /**
1354
- * Export the specified fragmentsgroup to binary data.
1355
- * @param group - the fragments group to be exported.
1356
- * @returns the exported data as binary buffer.
1357
- */
1358
- export(group: FragmentsGroup): Uint8Array;
1359
- /**
1360
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1361
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1362
- * @returns A map of model IDs to sets of express IDs.
1363
- */
1364
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1365
- [modelID: string]: Set<number>;
1366
- };
1367
- /**
1368
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1369
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1370
- * @returns A fragment ID map.
1371
- * @remarks
1372
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1373
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1374
- * The fragment ID maps are then merged into a single map and returned.
1375
- * 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.
1376
- */
1377
- modelIdToFragmentIdMap(modelIdMap: {
1378
- [modelID: string]: Set<number>;
1379
- }): FRAGS.FragmentIdMap;
1380
- /**
1381
- * Applies coordinate transformation to the provided models.
1382
- * If no models are provided, all groups are used.
1383
- * The first model in the list becomes the base model for coordinate transformation.
1384
- * All other models are then transformed to match the base model's coordinate system.
1255
+ * If not provided, all fragments will be affected.
1385
1256
  *
1386
- * @param models - The models to apply coordinate transformation to.
1387
- * If not provided, all models are used.
1257
+ * @returns {void}
1388
1258
  */
1389
- coordinate(models?: FragmentsGroup[]): void;
1259
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1390
1260
  /**
1391
- * Applies the base coordinate system to the provided object.
1392
- *
1393
- * This function takes an object and its original coordinate system as input.
1394
- * It then inverts the original coordinate system and applies the base coordinate system
1395
- * to the object. This ensures that the object's position, rotation, and scale are
1396
- * transformed to match the base coordinate system (which is taken from the first model loaded).
1261
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1262
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1397
1263
  *
1398
- * @param object - The object to which the base coordinate system will be applied.
1399
- * This should be an instance of THREE.Object3D.
1264
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1265
+ * If not provided, all fragments will be isolated.
1400
1266
  *
1401
- * @param originalCoordinateSystem - The original coordinate system of the object.
1402
- * This should be a THREE.Matrix4 representing the object's transformation matrix.
1267
+ * @returns {void}
1403
1268
  */
1404
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1269
+ isolate(items: FRAGS.FragmentIdMap): void;
1270
+ private updateCulledVisibility;
1405
1271
  }
1406
- import * as WEBIFC from "web-ifc";
1272
+ import * as THREE from "three";
1273
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1274
+ center: THREE.Vector3;
1275
+ halfSizes: THREE.Vector3;
1276
+ rotation: THREE.Matrix3;
1277
+ transformation: THREE.Matrix4;
1278
+ };
1279
+ import * as THREE from "three";
1407
1280
  import * as FRAGS from "@thatopen/fragments";
1408
- import { IfcFragmentSettings } from "./src";
1409
- import { Component, Components, Event, Disposable } from "../../core";
1281
+ import { Disposable, Component, Event, Components } from "../../core";
1410
1282
  /**
1411
- * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1283
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
1412
1284
  */
1413
- export declare class IfcLoader extends Component implements Disposable {
1285
+ export interface Classification {
1286
+ /**
1287
+ * A system within the classification.
1288
+ * The key is the system name, and the value is an object representing the classes within the system.
1289
+ */
1290
+ [system: string]: {
1291
+ /**
1292
+ * A class within the system.
1293
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1294
+ */
1295
+ [className: string]: {
1296
+ map: FRAGS.FragmentIdMap;
1297
+ name: string;
1298
+ id: number | null;
1299
+ };
1300
+ };
1301
+ }
1302
+ /**
1303
+ * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
1304
+ */
1305
+ export declare class Classifier extends Component implements Disposable {
1414
1306
  /**
1415
1307
  * A unique identifier for the component.
1416
1308
  * This UUID is used to register the component within the Components system.
1417
1309
  */
1418
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1310
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1311
+ /** {@link Component.enabled} */
1312
+ enabled: boolean;
1313
+ /**
1314
+ * A map representing the classification systems.
1315
+ * The key is the system name, and the value is an object representing the classes within the system.
1316
+ */
1317
+ list: Classification;
1419
1318
  /** {@link Disposable.onDisposed} */
1420
- readonly onDisposed: Event<string>;
1319
+ readonly onDisposed: Event<unknown>;
1320
+ constructor(components: Components);
1321
+ private onFragmentsDisposed;
1322
+ /** {@link Disposable.dispose} */
1323
+ dispose(): void;
1421
1324
  /**
1422
- * An event triggered when the IFC file starts loading.
1325
+ * Removes a fragment from the classification based on its unique identifier (guid).
1326
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1327
+ *
1328
+ * @param guid - The unique identifier of the fragment to be removed.
1423
1329
  */
1424
- readonly onIfcStartedLoading: Event<void>;
1330
+ remove(guid: string): void;
1425
1331
  /**
1426
- * An event triggered when the setup process is completed.
1332
+ * Finds and returns fragments based on the provided filter criteria.
1333
+ * If no filter is provided, it returns all fragments.
1334
+ *
1335
+ * @param filter - An optional object containing filter criteria.
1336
+ * The keys of the object represent the classification system names,
1337
+ * and the values are arrays of class names to match.
1338
+ *
1339
+ * @returns A map of fragment GUIDs to their respective express IDs,
1340
+ * where the express IDs are filtered based on the provided filter criteria.
1341
+ *
1342
+ * @throws Will throw an error if the fragments map is malformed.
1427
1343
  */
1428
- readonly onSetup: Event<void>;
1344
+ find(filter?: {
1345
+ [name: string]: string[];
1346
+ }): FRAGS.FragmentIdMap;
1429
1347
  /**
1430
- * The settings for the IfcLoader.
1431
- * It includes options for excluding categories, setting WASM paths, and more.
1348
+ * Classifies fragments based on their modelID.
1349
+ *
1350
+ * @param modelID - The unique identifier of the model to classify fragments by.
1351
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1352
+ *
1353
+ * @remarks
1354
+ * This method iterates through the fragments in the provided group,
1355
+ * and classifies them based on their modelID.
1356
+ * The classification is stored in the 'list.models' property,
1357
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1358
+ *
1432
1359
  */
1433
- settings: IfcFragmentSettings;
1360
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1434
1361
  /**
1435
- * The instance of the Web-IFC library used for handling IFC data.
1362
+ * Classifies fragments based on their PredefinedType property.
1363
+ *
1364
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1365
+ *
1366
+ * @remarks
1367
+ * This method iterates through the properties of the fragments in the provided group,
1368
+ * and classifies them based on their PredefinedType property.
1369
+ * The classification is stored in the 'list.predefinedTypes' property,
1370
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1371
+ *
1372
+ * @throws Will throw an error if the fragment ID is not found.
1436
1373
  */
1437
- webIfc: WEBIFC.IfcAPI;
1438
- /** {@link Component.enabled} */
1439
- enabled: boolean;
1440
- private _material;
1441
- private _spatialTree;
1442
- private _metaData;
1443
- private _fragmentInstances;
1444
- private _civil;
1445
- private _visitedFragments;
1446
- private _materialT;
1447
- constructor(components: Components);
1448
- /** {@link Disposable.dispose} */
1449
- dispose(): void;
1374
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1450
1375
  /**
1451
- * Sets up the IfcLoader component with the provided configuration.
1376
+ * Classifies fragments based on their entity type.
1452
1377
  *
1453
- * @param config - Optional configuration settings for the IfcLoader.
1454
- * If not provided, the existing settings will be used.
1378
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1455
1379
  *
1456
- * @returns A Promise that resolves when the setup process is completed.
1380
+ * @remarks
1381
+ * This method iterates through the relations of the fragments in the provided group,
1382
+ * and classifies them based on their entity type.
1383
+ * The classification is stored in the 'list.entities' property,
1384
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1385
+ *
1386
+ * @throws Will throw an error if the fragment ID is not found.
1387
+ */
1388
+ byEntity(group: FRAGS.FragmentsGroup): void;
1389
+ /**
1390
+ * Classifies fragments based on a specific IFC relationship.
1391
+ *
1392
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1393
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1394
+ * @param systemName - The name of the classification system to store the classification.
1457
1395
  *
1458
1396
  * @remarks
1459
- * If the 'autoSetWasm' option is enabled in the configuration,
1460
- * the method will automatically set the WASM paths for the Web-IFC library.
1397
+ * This method iterates through the relations of the fragments in the provided group,
1398
+ * and classifies them based on the specified IFC relationship.
1399
+ * The classification is stored in the 'list' property under the specified system name,
1400
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1461
1401
  *
1462
- * @example
1463
- * '''typescript
1464
- * const ifcLoader = new IfcLoader(components);
1465
- * await ifcLoader.setup({ autoSetWasm: true });
1466
- * '''
1402
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1467
1403
  */
1468
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1404
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1469
1405
  /**
1470
- * Loads an IFC file and processes it for 3D visualization.
1406
+ * Classifies fragments based on their spatial structure in the IFC model.
1471
1407
  *
1472
- * @param data - The Uint8Array containing the IFC file data.
1473
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1408
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1409
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1410
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1411
+ * the classifier just pick the WEBIFC categories provided.
1474
1412
  *
1475
- * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1413
+ * @remarks
1414
+ * This method iterates through the relations of the fragments in the provided group,
1415
+ * and classifies them based on their spatial structure in the IFC model.
1416
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1417
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1476
1418
  *
1477
- * @example
1478
- * '''typescript
1479
- * const ifcLoader = components.get(IfcLoader);
1480
- * const group = await ifcLoader.load(ifcData);
1481
- * '''
1419
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1482
1420
  */
1483
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1421
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1422
+ useProperties?: boolean;
1423
+ isolate?: Set<number>;
1424
+ }): Promise<void>;
1484
1425
  /**
1485
- * Reads an IFC file and initializes the Web-IFC library.
1426
+ * Sets the color of the specified fragments.
1486
1427
  *
1487
- * @param data - The Uint8Array containing the IFC file data.
1428
+ * @param items - A map of fragment IDs to their respective express IDs.
1429
+ * @param color - The color to set for the fragments.
1430
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1488
1431
  *
1489
- * @returns A Promise that resolves when the IFC file is opened and initialized.
1432
+ * @remarks
1433
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1434
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1435
+ *
1436
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1437
+ */
1438
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1439
+ /**
1440
+ * Resets the color of the specified fragments to their original color.
1441
+ *
1442
+ * @param items - A map of fragment IDs to their respective express IDs.
1490
1443
  *
1491
1444
  * @remarks
1492
- * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1493
- * It also opens the IFC model using the provided data and settings.
1445
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1446
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1494
1447
  *
1495
- * @example
1496
- * '''typescript
1497
- * const ifcLoader = components.get(IfcLoader);
1498
- * await ifcLoader.readIfcFile(ifcData);
1499
- * '''
1448
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1449
+ */
1450
+ resetColor(items: FRAGS.FragmentIdMap): void;
1451
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1452
+ }
1453
+ import { Component, Disposable, Event, Components } from "../../core";
1454
+ /**
1455
+ * 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).
1456
+ */
1457
+ export declare class Exploder extends Component implements Disposable {
1458
+ /**
1459
+ * A unique identifier for the component.
1460
+ * This UUID is used to register the component within the Components system.
1461
+ */
1462
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1463
+ /** {@link Disposable.onDisposed} */
1464
+ readonly onDisposed: Event<unknown>;
1465
+ /** {@link Component.enabled} */
1466
+ enabled: boolean;
1467
+ /**
1468
+ * The height of the explosion animation.
1469
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1470
+ * Default value is 10.
1471
+ */
1472
+ height: number;
1473
+ /**
1474
+ * The group name used for the explosion animation.
1475
+ * This property specifies the group of fragments that will be affected by the explosion.
1476
+ * Default value is "storeys".
1477
+ */
1478
+ groupName: string;
1479
+ /**
1480
+ * A set of strings representing the exploded items.
1481
+ * This set is used to keep track of which items have been exploded.
1500
1482
  */
1501
- readIfcFile(data: Uint8Array): Promise<number>;
1483
+ list: Set<string>;
1484
+ constructor(components: Components);
1485
+ /** {@link Disposable.dispose} */
1486
+ dispose(): void;
1502
1487
  /**
1503
- * Cleans up the IfcLoader component by resetting the Web-IFC library,
1504
- * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1488
+ * Sets the explosion state of the fragments.
1489
+ *
1490
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1505
1491
  *
1506
1492
  * @remarks
1507
- * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1493
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1494
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1495
+ * If 'active' is false, the fragments are moved back to their original position.
1508
1496
  *
1509
- * @example
1510
- * '''typescript
1511
- * const ifcLoader = components.get(IfcLoader);
1512
- * ifcLoader.cleanUp();
1513
- * '''
1497
+ * The method also keeps track of the exploded items using the 'list' set.
1498
+ *
1499
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1514
1500
  */
1515
- cleanUp(): void;
1516
- private getAllGeometries;
1517
- private getMesh;
1518
- private getGeometry;
1519
- private autoSetWasm;
1501
+ set(active: boolean): void;
1520
1502
  }
1521
1503
  import * as WEBIFC from "web-ifc";
1522
1504
  import { Components, Disposable, Event, Component } from "../../core";
@@ -1617,513 +1599,549 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
1617
1599
  private streamGeometries;
1618
1600
  }
1619
1601
  import * as WEBIFC from "web-ifc";
1620
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1621
- import { PropertiesStreamingSettings } from "./src";
1602
+ import * as FRAGS from "@thatopen/fragments";
1603
+ import { IfcFragmentSettings } from "./src";
1604
+ import { Component, Components, Event, Disposable } from "../../core";
1622
1605
  /**
1623
- * 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).
1606
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1624
1607
  */
1625
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1608
+ export declare class IfcLoader extends Component implements Disposable {
1626
1609
  /**
1627
1610
  * A unique identifier for the component.
1628
1611
  * This UUID is used to register the component within the Components system.
1629
1612
  */
1630
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1631
- /**
1632
- * An event that is triggered when properties are streamed from the IFC file.
1633
- * The event provides the type of the IFC entity and the corresponding data.
1634
- */
1635
- readonly onPropertiesStreamed: AsyncEvent<{
1636
- type: number;
1637
- data: {
1638
- [id: number]: any;
1639
- };
1640
- }>;
1613
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1614
+ /** {@link Disposable.onDisposed} */
1615
+ readonly onDisposed: Event<string>;
1641
1616
  /**
1642
- * An event that is triggered to indicate the progress of the streaming process.
1643
- * The event provides a number between 0 and 1 representing the progress percentage.
1617
+ * An event triggered when the IFC file starts loading.
1644
1618
  */
1645
- readonly onProgress: AsyncEvent<number>;
1619
+ readonly onIfcStartedLoading: Event<void>;
1646
1620
  /**
1647
- * An event that is triggered when indices are streamed from the IFC file.
1648
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1621
+ * An event triggered when the setup process is completed.
1649
1622
  */
1650
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1651
- /** {@link Disposable.onDisposed} */
1652
- readonly onDisposed: Event<string>;
1653
- /** {@link Component.enabled} */
1654
- enabled: boolean;
1623
+ readonly onSetup: Event<void>;
1655
1624
  /**
1656
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1625
+ * The settings for the IfcLoader.
1626
+ * It includes options for excluding categories, setting WASM paths, and more.
1657
1627
  */
1658
- settings: PropertiesStreamingSettings;
1628
+ settings: IfcFragmentSettings;
1659
1629
  /**
1660
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1630
+ * The instance of the Web-IFC library used for handling IFC data.
1661
1631
  */
1662
1632
  webIfc: WEBIFC.IfcAPI;
1633
+ /** {@link Component.enabled} */
1634
+ enabled: boolean;
1635
+ private _material;
1636
+ private _spatialTree;
1637
+ private _metaData;
1638
+ private _fragmentInstances;
1639
+ private _civil;
1640
+ private _visitedFragments;
1641
+ private _materialT;
1642
+ constructor(components: Components);
1663
1643
  /** {@link Disposable.dispose} */
1664
- dispose(): Promise<void>;
1644
+ dispose(): void;
1665
1645
  /**
1666
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1646
+ * Sets up the IfcLoader component with the provided configuration.
1667
1647
  *
1668
- * @param data - The Uint8Array containing the IFC file data.
1669
- * @returns A Promise that resolves when the streaming process is complete.
1648
+ * @param config - Optional configuration settings for the IfcLoader.
1649
+ * If not provided, the existing settings will be used.
1650
+ *
1651
+ * @returns A Promise that resolves when the setup process is completed.
1652
+ *
1653
+ * @remarks
1654
+ * If the 'autoSetWasm' option is enabled in the configuration,
1655
+ * the method will automatically set the WASM paths for the Web-IFC library.
1656
+ *
1657
+ * @example
1658
+ * '''typescript
1659
+ * const ifcLoader = new IfcLoader(components);
1660
+ * await ifcLoader.setup({ autoSetWasm: true });
1661
+ * '''
1670
1662
  */
1671
- streamFromBuffer(data: Uint8Array): Promise<void>;
1663
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1672
1664
  /**
1673
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1665
+ * Loads an IFC file and processes it for 3D visualization.
1674
1666
  *
1675
- * @param loadCallback - A callback function that loads the IFC file data.
1676
- * @returns A Promise that resolves when the streaming process is complete.
1667
+ * @param data - The Uint8Array containing the IFC file data.
1668
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1669
+ *
1670
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1671
+ *
1672
+ * @example
1673
+ * '''typescript
1674
+ * const ifcLoader = components.get(IfcLoader);
1675
+ * const group = await ifcLoader.load(ifcData);
1676
+ * '''
1677
1677
  */
1678
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1679
- private readIfcFile;
1680
- private streamIfcFile;
1681
- private streamAllProperties;
1682
- private cleanUp;
1683
- }
1684
- import * as WEBIFC from "web-ifc";
1685
- import * as FRAG from "@thatopen/fragments";
1686
- import { Component, Components } from "../../core";
1687
- /**
1688
- * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1689
- */
1690
- export declare class IfcJsonExporter extends Component {
1678
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1691
1679
  /**
1692
- * A unique identifier for the component.
1693
- * This UUID is used to register the component within the Components system.
1680
+ * Reads an IFC file and initializes the Web-IFC library.
1681
+ *
1682
+ * @param data - The Uint8Array containing the IFC file data.
1683
+ *
1684
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
1685
+ *
1686
+ * @remarks
1687
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1688
+ * It also opens the IFC model using the provided data and settings.
1689
+ *
1690
+ * @example
1691
+ * '''typescript
1692
+ * const ifcLoader = components.get(IfcLoader);
1693
+ * await ifcLoader.readIfcFile(ifcData);
1694
+ * '''
1694
1695
  */
1695
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1696
- /** {@link Component.enabled} */
1697
- enabled: boolean;
1698
- constructor(components: Components);
1696
+ readIfcFile(data: Uint8Array): Promise<number>;
1699
1697
  /**
1700
- * Exports all the properties of an IFC into an array of JS objects.
1701
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1702
- * @param modelID ID of the IFC model whose properties to extract.
1703
- * @param indirect whether to get the indirect relationships as well.
1704
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1705
- * to make the location data available (e.g. absolute position of building).
1698
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
1699
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1700
+ *
1701
+ * @remarks
1702
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1703
+ *
1704
+ * @example
1705
+ * '''typescript
1706
+ * const ifcLoader = components.get(IfcLoader);
1707
+ * ifcLoader.cleanUp();
1708
+ * '''
1706
1709
  */
1707
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1710
+ cleanUp(): void;
1711
+ private getAllGeometries;
1712
+ private getMesh;
1713
+ private getGeometry;
1714
+ private autoSetWasm;
1708
1715
  }
1709
- import * as WEBIFC from "web-ifc";
1710
- import { FragmentsGroup } from "@thatopen/fragments";
1711
- import { Disposable, Event, Component, Components } from "../../core";
1712
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1713
- export type { InverseAttribute, RelationsMap } from "./src/types";
1716
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1717
+ import * as THREE from "three";
1718
+ import * as FRAGS from "@thatopen/fragments";
1719
+ import { Component, Components, Event, Disposable } from "../../core";
1720
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1714
1721
  /**
1715
- * 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).
1722
+ * 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).
1716
1723
  */
1717
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1724
+ export declare class FragmentsManager extends Component implements Disposable {
1718
1725
  /**
1719
1726
  * A unique identifier for the component.
1720
1727
  * This UUID is used to register the component within the Components system.
1721
1728
  */
1722
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1729
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1723
1730
  /** {@link Disposable.onDisposed} */
1724
- readonly onDisposed: Event<string>;
1731
+ readonly onDisposed: Event<unknown>;
1725
1732
  /**
1726
- * Event triggered when relations for a model have been indexed.
1727
- * This event provides the model's UUID and the relations map generated for that model.
1728
- *
1729
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1730
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1731
- * 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.
1733
+ * Event triggered when fragments are loaded.
1732
1734
  */
1733
- readonly onRelationsIndexed: Event<{
1734
- modelID: string;
1735
- relationsMap: RelationsMap;
1736
- }>;
1735
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
1737
1736
  /**
1738
- * Holds the relationship mappings for each model processed by the indexer.
1739
- * The structure is a map where each key is a model's UUID, and the value is another map.
1740
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1741
- * representing a specific relation type, and the value is an array of expressIDs of entities
1742
- * that are related through that relation type. This structure allows for efficient querying
1743
- * of entity relationships within a model.
1737
+ * Event triggered when fragments are disposed.
1744
1738
  */
1745
- readonly relationMaps: ModelsRelationMap;
1746
- /** {@link Component.enabled} */
1747
- enabled: boolean;
1748
- private _relToAttributesMap;
1749
- private _inverseAttributes;
1750
- private _ifcRels;
1751
- constructor(components: Components);
1752
- private onFragmentsDisposed;
1753
- private indexRelations;
1754
- private getAttributeIndex;
1739
+ readonly onFragmentsDisposed: Event<{
1740
+ groupID: string;
1741
+ fragmentIDs: string[];
1742
+ }>;
1755
1743
  /**
1756
- * Adds a relation map to the model's relations map.
1757
- *
1758
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1759
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1760
- *
1761
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1744
+ * Map containing all loaded fragments.
1745
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1762
1746
  */
1763
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1764
- /**
1765
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1766
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1767
- * and maps them in a structured way to facilitate quick access to related entities.
1768
- *
1769
- * The process involves querying the model for each relation type associated with the inverse attributes
1770
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1771
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1772
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1773
- * of entities that are related through that attribute.
1774
- *
1775
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1776
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1777
- * representation of the relations indexed by entity expressIDs and relation types.
1778
- * @throws An error if the model does not have properties loaded.
1747
+ readonly list: Map<string, Fragment>;
1748
+ /**
1749
+ * Map containing all loaded fragment groups.
1750
+ * The key is the group's unique identifier, and the value is the group itself.
1779
1751
  */
1780
- process(model: FragmentsGroup): Promise<RelationsMap>;
1752
+ readonly groups: Map<string, FragmentsGroup>;
1753
+ baseCoordinationModel: string;
1754
+ baseCoordinationMatrix: THREE.Matrix4;
1755
+ /** {@link Component.enabled} */
1756
+ enabled: boolean;
1757
+ private _loader;
1781
1758
  /**
1782
- * Processes a given model from a WebIfc API to index its IFC entities relations.
1783
- *
1784
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1785
- * @param modelID - The unique identifier of the model within the WebIfc API.
1786
- * @returns A promise that resolves to the relations map for the processed model.
1787
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1759
+ * Getter for the meshes of all fragments in the FragmentsManager.
1760
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1761
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1788
1762
  */
1789
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1763
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1764
+ constructor(components: Components);
1765
+ /** {@link Disposable.dispose} */
1766
+ dispose(): void;
1790
1767
  /**
1791
- * Retrieves the relations of a specific entity within a model based on the given relation name.
1792
- * This method searches the indexed relation maps for the specified model and entity,
1793
- * returning the IDs of related entities if a match is found.
1768
+ * Dispose of a specific fragment group.
1769
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1770
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1794
1771
  *
1795
- * @param model The 'FragmentsGroup' model containing the entity.
1796
- * @param expressID The unique identifier of the entity within the model.
1797
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1798
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1799
- * or the specified relation name is not indexed.
1772
+ * @param group - The fragment group to be disposed.
1800
1773
  */
1801
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1774
+ disposeGroup(group: FragmentsGroup): void;
1802
1775
  /**
1803
- * Serializes the relations of a given relation map into a JSON string.
1804
- * 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,
1805
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1806
- * The resulting object is then serialized into a JSON string.
1807
- *
1808
- * @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.
1809
- * @returns A JSON string representing the serialized relations of the given relation map.
1776
+ * Loads a binary file that contain fragment geometry.
1777
+ * @param data - The binary data to load.
1778
+ * @param config - Optional configuration for loading.
1779
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1780
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1781
+ * @returns The loaded FragmentsGroup.
1810
1782
  */
1811
- serializeRelations(relationMap: RelationsMap): string;
1783
+ load(data: Uint8Array, config?: Partial<{
1784
+ coordinate: boolean;
1785
+ name: string;
1786
+ properties: FRAGS.IfcProperties;
1787
+ relationsMap: RelationsMap;
1788
+ }>): FragmentsGroup;
1812
1789
  /**
1813
- * Serializes the relations of a specific model into a JSON string.
1814
- * This method iterates through the relations indexed for the given model,
1815
- * organizing them into a structured object where each key is an expressID of an entity,
1816
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1817
- * The resulting object is then serialized into a JSON string.
1818
- *
1819
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1820
- * @returns A JSON string representing the serialized relations of the specified model.
1821
- * If the model has no indexed relations, 'null' is returned.
1790
+ * Export the specified fragmentsgroup to binary data.
1791
+ * @param group - the fragments group to be exported.
1792
+ * @returns the exported data as binary buffer.
1822
1793
  */
1823
- serializeModelRelations(model: FragmentsGroup): string | null;
1794
+ export(group: FragmentsGroup): Uint8Array;
1824
1795
  /**
1825
- * Serializes all relations of every model processed by the indexer into a JSON string.
1826
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1827
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1828
- * and its value is another object mapping entity expressIDs to their related entities, categorized
1829
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1830
- *
1831
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1832
- * If no relations have been indexed, an empty object is returned as a JSON string.
1796
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1797
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1798
+ * @returns A map of model IDs to sets of express IDs.
1833
1799
  */
1834
- serializeAllRelations(): string;
1800
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1801
+ [modelID: string]: Set<number>;
1802
+ };
1835
1803
  /**
1836
- * Converts a JSON string representing relations between entities into a structured map.
1837
- * This method parses the JSON string to reconstruct the relations map that indexes
1838
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1839
- * and the values are maps where each key is a relation type ID and its value is an array
1840
- * of express IDs of entities related through that relation type.
1841
- *
1842
- * @param json The JSON string to be parsed into the relations map.
1843
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1844
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1845
- * is an array of express IDs (as numbers) of entities related through that relation type.
1804
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1805
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1806
+ * @returns A fragment ID map.
1807
+ * @remarks
1808
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1809
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1810
+ * The fragment ID maps are then merged into a single map and returned.
1811
+ * 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.
1846
1812
  */
1847
- getRelationsMapFromJSON(json: string): RelationsMap;
1848
- /** {@link Disposable.dispose} */
1849
- dispose(): void;
1813
+ modelIdToFragmentIdMap(modelIdMap: {
1814
+ [modelID: string]: Set<number>;
1815
+ }): FRAGS.FragmentIdMap;
1850
1816
  /**
1851
- * Adds relations between an entity and other entities in a BIM model.
1852
- *
1853
- * @param model - The BIM model to which the relations will be added.
1854
- * @param expressID - The expressID of the entity within the model.
1855
- * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1856
- * @param relIDs - The expressIDs of the related entities within the model.
1817
+ * Applies coordinate transformation to the provided models.
1818
+ * If no models are provided, all groups are used.
1819
+ * The first model in the list becomes the base model for coordinate transformation.
1820
+ * All other models are then transformed to match the base model's coordinate system.
1857
1821
  *
1858
- * @throws An error if the relation name is not a valid relation name.
1822
+ * @param models - The models to apply coordinate transformation to.
1823
+ * If not provided, all models are used.
1859
1824
  */
1860
- addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1825
+ coordinate(models?: FragmentsGroup[]): void;
1861
1826
  /**
1862
- * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1827
+ * Applies the base coordinate system to the provided object.
1863
1828
  *
1864
- * @param model The BIM model whose children to get.
1865
- * @param expressID The expressID of the item whose children to get.
1866
- * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1829
+ * This function takes an object and its original coordinate system as input.
1830
+ * It then inverts the original coordinate system and applies the base coordinate system
1831
+ * to the object. This ensures that the object's position, rotation, and scale are
1832
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
1867
1833
  *
1868
- * @returns A 'Set' with the expressIDs of the found items.
1834
+ * @param object - The object to which the base coordinate system will be applied.
1835
+ * This should be an instance of THREE.Object3D.
1836
+ *
1837
+ * @param originalCoordinateSystem - The original coordinate system of the object.
1838
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
1869
1839
  */
1870
- getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1840
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1871
1841
  }
1872
1842
  import * as WEBIFC from "web-ifc";
1873
- import { FragmentsGroup } from "@thatopen/fragments";
1874
- import { Component, Disposable, Event, Components } from "../../core";
1875
- /**
1876
- * Types for boolean properties in IFC schema.
1877
- */
1878
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1879
- /**
1880
- * Types for string properties in IFC schema.
1881
- */
1882
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1883
- /**
1884
- * Types for numeric properties in IFC schema.
1885
- */
1886
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
1887
- /**
1888
- * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
1889
- */
1890
- export interface ChangeMap {
1891
- [modelID: string]: Set<number>;
1892
- }
1893
- /**
1894
- * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
1895
- */
1896
- export interface AttributeListener {
1897
- [modelID: string]: {
1898
- [expressID: number]: {
1899
- [attributeName: string]: Event<String | Boolean | Number>;
1900
- };
1901
- };
1902
- }
1843
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
1844
+ import { PropertiesStreamingSettings } from "./src";
1903
1845
  /**
1904
- * Component to manage and edit properties and Psets in IFC files.
1846
+ * 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).
1905
1847
  */
1906
- export declare class IfcPropertiesManager extends Component implements Disposable {
1848
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
1907
1849
  /**
1908
1850
  * A unique identifier for the component.
1909
1851
  * This UUID is used to register the component within the Components system.
1910
1852
  */
1911
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1853
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1854
+ /**
1855
+ * An event that is triggered when properties are streamed from the IFC file.
1856
+ * The event provides the type of the IFC entity and the corresponding data.
1857
+ */
1858
+ readonly onPropertiesStreamed: AsyncEvent<{
1859
+ type: number;
1860
+ data: {
1861
+ [id: number]: any;
1862
+ };
1863
+ }>;
1864
+ /**
1865
+ * An event that is triggered to indicate the progress of the streaming process.
1866
+ * The event provides a number between 0 and 1 representing the progress percentage.
1867
+ */
1868
+ readonly onProgress: AsyncEvent<number>;
1869
+ /**
1870
+ * An event that is triggered when indices are streamed from the IFC file.
1871
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1872
+ */
1873
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1912
1874
  /** {@link Disposable.onDisposed} */
1913
1875
  readonly onDisposed: Event<string>;
1876
+ /** {@link Component.enabled} */
1877
+ enabled: boolean;
1914
1878
  /**
1915
- * Event triggered when a file is requested for export.
1879
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1916
1880
  */
1917
- readonly onRequestFile: Event<unknown>;
1881
+ settings: PropertiesStreamingSettings;
1918
1882
  /**
1919
- * ArrayBuffer containing the IFC data to be exported.
1883
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1920
1884
  */
1921
- ifcToExport: ArrayBuffer | null;
1885
+ webIfc: WEBIFC.IfcAPI;
1886
+ /** {@link Disposable.dispose} */
1887
+ dispose(): Promise<void>;
1922
1888
  /**
1923
- * Event triggered when an element is added to a Pset.
1889
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1890
+ *
1891
+ * @param data - The Uint8Array containing the IFC file data.
1892
+ * @returns A Promise that resolves when the streaming process is complete.
1924
1893
  */
1925
- readonly onElementToPset: Event<{
1926
- model: FragmentsGroup;
1927
- psetID: number;
1928
- elementID: number;
1929
- }>;
1894
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1930
1895
  /**
1931
- * Event triggered when a property is added to a Pset.
1896
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1897
+ *
1898
+ * @param loadCallback - A callback function that loads the IFC file data.
1899
+ * @returns A Promise that resolves when the streaming process is complete.
1932
1900
  */
1933
- readonly onPropToPset: Event<{
1934
- model: FragmentsGroup;
1935
- psetID: number;
1936
- propID: number;
1937
- }>;
1901
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1902
+ private readIfcFile;
1903
+ private streamIfcFile;
1904
+ private streamAllProperties;
1905
+ private cleanUp;
1906
+ }
1907
+ import * as THREE from "three";
1908
+ import { Component, Components, Disposable, Event, World } from "../core";
1909
+ /**
1910
+ * Configuration interface for the VertexPicker component.
1911
+ */
1912
+ export interface VertexPickerConfig {
1938
1913
  /**
1939
- * Event triggered when a Pset is removed.
1914
+ * If true, only vertices will be picked, not the closest point on the face.
1915
+ */
1916
+ showOnlyVertex: boolean;
1917
+ /**
1918
+ * The maximum distance for snapping to a vertex.
1919
+ */
1920
+ snapDistance: number;
1921
+ /**
1922
+ * The HTML element to use for previewing the picked vertex.
1940
1923
  */
1941
- readonly onPsetRemoved: Event<{
1942
- model: FragmentsGroup;
1943
- psetID: number;
1944
- }>;
1924
+ previewElement: HTMLElement;
1925
+ }
1926
+ /**
1927
+ * A class that provides functionality for picking vertices in a 3D scene.
1928
+ */
1929
+ export declare class VertexPicker extends Component implements Disposable {
1930
+ /** {@link Disposable.onDisposed} */
1931
+ readonly onDisposed: Event<unknown>;
1945
1932
  /**
1946
- * Event triggered when data in the model changes.
1933
+ * An event that is triggered when a vertex is found.
1934
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1947
1935
  */
1948
- readonly onDataChanged: Event<{
1949
- model: FragmentsGroup;
1950
- expressID: number;
1951
- }>;
1936
+ readonly onVertexFound: Event<THREE.Vector3>;
1952
1937
  /**
1953
- * Configuration for the WebAssembly module.
1938
+ * An event that is triggered when a vertex is lost.
1939
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1954
1940
  */
1955
- wasm: {
1956
- path: string;
1957
- absolute: boolean;
1958
- };
1959
- /** {@link Component.enabled} */
1960
- enabled: boolean;
1941
+ readonly onVertexLost: Event<THREE.Vector3>;
1961
1942
  /**
1962
- * Map of attribute listeners.
1943
+ * An event that is triggered when the picker is enabled or disabled
1963
1944
  */
1964
- attributeListeners: AttributeListener;
1945
+ readonly onEnabled: Event<boolean>;
1965
1946
  /**
1966
- * The currently selected model.
1947
+ * A reference to the Components instance associated with this VertexPicker.
1967
1948
  */
1968
- selectedModel?: FragmentsGroup;
1949
+ components: Components;
1969
1950
  /**
1970
- * Map of changed entities in the model.
1951
+ * A reference to the working plane used for vertex picking.
1952
+ * This plane is used to determine which vertices are considered valid for picking.
1953
+ * If this value is null, all vertices are considered valid.
1971
1954
  */
1972
- changeMap: ChangeMap;
1973
- constructor(components: Components);
1974
- /** {@link Disposable.dispose} */
1975
- dispose(): void;
1955
+ workingPlane: THREE.Plane | null;
1956
+ private _pickedPoint;
1957
+ private _config;
1958
+ private _enabled;
1976
1959
  /**
1977
- * Static method to retrieve the IFC schema from a given model.
1960
+ * Sets the enabled state of the VertexPicker.
1961
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1962
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1978
1963
  *
1979
- * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1980
- * @throws Will throw an error if the IFC schema is not found in the model.
1981
- * @returns The IFC schema associated with the given model.
1964
+ * @param value - The new enabled state.
1982
1965
  */
1983
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1966
+ set enabled(value: boolean);
1984
1967
  /**
1985
- * Method to set properties data in the model.
1986
- *
1987
- * @param model - The FragmentsGroup model in which to set the properties.
1988
- * @param dataToSave - An array of objects representing the properties to be saved.
1989
- * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1990
- * The rest of the properties will be set as the properties of the entity.
1991
- *
1992
- * @returns A promise that resolves when all the properties have been set.
1968
+ * Gets the current enabled state of the VertexPicker.
1993
1969
  *
1994
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1970
+ * @returns The current enabled state.
1995
1971
  */
1996
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1972
+ get enabled(): boolean;
1997
1973
  /**
1998
- * Creates a new Property Set (Pset) in the given model.
1999
- *
2000
- * @param model - The FragmentsGroup model in which to create the Pset.
2001
- * @param name - The name of the Pset.
2002
- * @param description - (Optional) The description of the Pset.
1974
+ * Sets the configuration for the VertexPicker component.
2003
1975
  *
2004
- * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1976
+ * @param value - A Partial object containing the configuration properties to update.
1977
+ * The properties not provided in the value object will retain their current values.
2005
1978
  *
2006
- * @throws Will throw an error if the IFC schema is not found in the model.
2007
- * @throws Will throw an error if no OwnerHistory is found in the model.
1979
+ * @example
1980
+ * '''typescript
1981
+ * vertexPicker.config = {
1982
+ * snapDistance: 0.5,
1983
+ * showOnlyVertex: true,
1984
+ * };
1985
+ * '''
2008
1986
  */
2009
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
2010
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
2011
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
2012
- }>;
1987
+ set config(value: Partial<VertexPickerConfig>);
2013
1988
  /**
2014
- * Removes a Property Set (Pset) from the given model.
2015
- *
2016
- * @param model - The FragmentsGroup model from which to remove the Pset.
2017
- * @param psetID - The express IDs of the Psets to be removed.
1989
+ * Gets the current configuration for the VertexPicker component.
2018
1990
  *
2019
- * @returns A promise that resolves when all the Psets have been removed.
1991
+ * @returns A copy of the current VertexPickerConfig object.
2020
1992
  *
2021
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
2022
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
2023
- * @throws Will throw an error if no relation is found between the Pset and the model.
1993
+ * @example
1994
+ * '''typescript
1995
+ * const currentConfig = vertexPicker.config;
1996
+ * console.log(currentConfig.snapDistance); // Output: 0.25
1997
+ * '''
2024
1998
  */
2025
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1999
+ get config(): Partial<VertexPickerConfig>;
2000
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
2001
+ /** {@link Disposable.dispose} */
2002
+ dispose(): void;
2026
2003
  /**
2027
- * Creates a new single-value property of type string in the given model.
2004
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
2028
2005
  *
2029
- * @param model - The FragmentsGroup model in which to create the property.
2030
- * @param type - The type of the property value. Must be a string property type.
2031
- * @param name - The name of the property.
2032
- * @param value - The value of the property. Must be a string.
2006
+ * @param world - The World instance to use for raycasting.
2033
2007
  *
2034
- * @returns The newly created single-value property.
2008
+ * @returns The current picked point, or null if no point is picked.
2035
2009
  *
2036
- * @throws Will throw an error if the IFC schema is not found in the model.
2037
- * @throws Will throw an error if no OwnerHistory is found in the model.
2010
+ * @remarks
2011
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2012
+ * If enabled, it performs raycasting to find the closest intersecting object.
2013
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
2014
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2015
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2016
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
2038
2017
  */
2039
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
2018
+ get(world: World): THREE.Vector3 | null;
2019
+ private getClosestVertex;
2020
+ private getVertices;
2021
+ private getVertex;
2022
+ }
2023
+ /**
2024
+ * 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.
2025
+ *
2026
+ * @remarks
2027
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2028
+ * It is useful for identifying and processing different types of IFC elements in a project.
2029
+ *
2030
+ */
2031
+ export declare const IfcElements: {
2032
+ [key: number]: string;
2033
+ };
2034
+ import * as THREE from "three";
2035
+ import * as FRAGS from "@thatopen/fragments";
2036
+ import { Component, Components } from "../../core";
2037
+ /**
2038
+ * Represents an edge measurement result.
2039
+ */
2040
+ export interface MeasureEdge {
2040
2041
  /**
2041
- * Creates a new single-value property of type numeric in the given model.
2042
- *
2043
- * @param model - The FragmentsGroup model in which to create the property.
2044
- * @param type - The type of the property value. Must be a numeric property type.
2045
- * @param name - The name of the property.
2046
- * @param value - The value of the property. Must be a number.
2047
- *
2048
- * @returns The newly created single-value property.
2049
- *
2050
- * @throws Will throw an error if the IFC schema is not found in the model.
2051
- * @throws Will throw an error if no OwnerHistory is found in the model.
2042
+ * The distance between the two points of the edge.
2052
2043
  */
2053
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
2044
+ distance: number;
2054
2045
  /**
2055
- * Creates a new single-value property of type boolean in the given model.
2056
- *
2057
- * @param model - The FragmentsGroup model in which to create the property.
2058
- * @param type - The type of the property value. Must be a boolean property type.
2059
- * @param name - The name of the property.
2060
- * @param value - The value of the property. Must be a boolean.
2061
- *
2062
- * @returns The newly created single-value property.
2063
- *
2064
- * @throws Will throw an error if the IFC schema is not found in the model.
2065
- * @throws Will throw an error if no OwnerHistory is found in the model.
2046
+ * The two points that define the edge.
2066
2047
  */
2067
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
2048
+ points: THREE.Vector3[];
2049
+ }
2050
+ /**
2051
+ * 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).
2052
+ */
2053
+ export declare class MeasurementUtils extends Component {
2068
2054
  /**
2069
- * Removes a property from a Property Set (Pset) in the given model.
2070
- *
2071
- * @param model - The FragmentsGroup model from which to remove the property.
2072
- * @param psetID - The express ID of the Pset from which to remove the property.
2073
- * @param propID - The express ID of the property to be removed.
2074
- *
2075
- * @returns A promise that resolves when the property has been removed.
2076
- *
2077
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
2078
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
2055
+ * A unique identifier for the component.
2056
+ * This UUID is used to register the component within the Components system.
2079
2057
  */
2080
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
2081
- addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
2058
+ static uuid: string;
2059
+ /** {@link Component.enabled} */
2060
+ enabled: boolean;
2061
+ constructor(components: Components);
2082
2062
  /**
2083
- * Adds elements to a Property Set (Pset) in the given model.
2063
+ * Utility method to calculate the distance from a point to a line segment.
2084
2064
  *
2085
- * @param model - The FragmentsGroup model in which to add the elements.
2086
- * @param psetID - The express ID of the Pset to which to add the elements.
2087
- * @param elementID - The express IDs of the elements to be added.
2065
+ * @param point - The point from which to calculate the distance.
2066
+ * @param lineStart - The start point of the line segment.
2067
+ * @param lineEnd - The end point of the line segment.
2068
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
2069
+ * @returns The distance from the point to the line segment.
2070
+ */
2071
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2072
+ /**
2073
+ * Method to get the face of a mesh that contains a given triangle index.
2074
+ * It also returns the edges of the found face and their indices.
2088
2075
  *
2089
- * @returns A promise that resolves when all the elements have been added.
2076
+ * @param mesh - The mesh to get the face from. It must be indexed.
2077
+ * @param triangleIndex - The index of the triangle within the mesh.
2078
+ * @param instance - The instance of the mesh (optional).
2079
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2080
+ */
2081
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2082
+ edges: MeasureEdge[];
2083
+ indices: Set<number>;
2084
+ } | null;
2085
+ /**
2086
+ * Method to get the vertices and normal of a mesh face at a given index.
2087
+ * It also applies instance transformation if provided.
2090
2088
  *
2091
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
2092
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
2093
- * @throws Will throw an error if no relation is found between the Pset and the model.
2089
+ * @param mesh - The mesh to get the face from. It must be indexed.
2090
+ * @param faceIndex - The index of the face within the mesh.
2091
+ * @param instance - The instance of the mesh (optional).
2092
+ * @returns An object containing the vertices and normal of the face.
2093
+ * @throws Will throw an error if the geometry is not indexed.
2094
+ */
2095
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2096
+ p1: THREE.Vector3;
2097
+ p2: THREE.Vector3;
2098
+ p3: THREE.Vector3;
2099
+ faceNormal: THREE.Vector3;
2100
+ };
2101
+ /**
2102
+ * Method to round the vector's components to a specified number of decimal places.
2103
+ * This is used to ensure numerical precision in edge detection.
2104
+ *
2105
+ * @param vector - The vector to round.
2106
+ * @returns The vector with rounded components.
2094
2107
  */
2095
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
2108
+ round(vector: THREE.Vector3): void;
2096
2109
  /**
2097
- * Saves the changes made to the model to a new IFC file.
2110
+ * Calculates the volume of a set of fragments.
2098
2111
  *
2099
- * @param model - The FragmentsGroup model from which to save the changes.
2100
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
2112
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
2113
+ * @returns The total volume of the fragments and the bounding sphere.
2101
2114
  *
2102
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
2115
+ * @remarks
2116
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
2117
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
2103
2118
  *
2104
- * @throws Will throw an error if any issues occur during the saving process.
2119
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
2120
+ * @throws Will throw an error if the fragment manager is not available.
2105
2121
  */
2106
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
2122
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
2107
2123
  /**
2108
- * Sets an attribute listener for a specific attribute of an entity in the model.
2109
- * The listener will trigger an event whenever the attribute's value changes.
2124
+ * Calculates the total volume of a set of meshes.
2110
2125
  *
2111
- * @param model - The FragmentsGroup model in which to set the attribute listener.
2112
- * @param expressID - The express ID of the entity for which to set the listener.
2113
- * @param attributeName - The name of the attribute for which to set the listener.
2126
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2127
+ * @returns The total volume of the meshes and the bounding sphere.
2114
2128
  *
2115
- * @returns The event that will be triggered when the attribute's value changes.
2129
+ * @remarks
2130
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
2131
+ * and its bounding sphere.
2116
2132
  *
2117
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
2118
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
2119
- * @throws Will throw an error if the attribute has a badly defined handle.
2120
2133
  */
2121
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
2122
- private increaseMaxID;
2123
- private newGUID;
2124
- private getOwnerHistory;
2125
- private registerChange;
2126
- private newSingleProperty;
2134
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2135
+ private getFaceData;
2136
+ private getVolumeOfMesh;
2137
+ private getSignedVolumeOfTriangle;
2138
+ }
2139
+ import * as WEBIFC from "web-ifc";
2140
+ export interface IfcItemsCategories {
2141
+ [itemID: number]: number;
2142
+ }
2143
+ export declare class IfcCategories {
2144
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2127
2145
  }
2128
2146
  import * as THREE from "three";
2129
2147
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
@@ -2215,84 +2233,6 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2215
2233
  private updatePlanes;
2216
2234
  }
2217
2235
  import * as FRAGS from "@thatopen/fragments";
2218
- import * as WEBIFC from "web-ifc";
2219
- export declare class SpatialIdsFinder {
2220
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2221
- }
2222
- import * as WEBIFC from "web-ifc";
2223
- import { IfcItemsCategories } from "../../../ifc";
2224
- export declare class SpatialStructure {
2225
- itemsByFloor: IfcItemsCategories;
2226
- private _units;
2227
- setUp(webIfc: WEBIFC.IfcAPI): void;
2228
- cleanUp(): void;
2229
- }
2230
- /**
2231
- * 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.
2232
- */
2233
- export declare const IfcCategoryMap: {
2234
- [key: number]: string;
2235
- };
2236
- import * as WEBIFC from "web-ifc";
2237
- export interface IfcItemsCategories {
2238
- [itemID: number]: number;
2239
- }
2240
- export declare class IfcCategories {
2241
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2242
- }
2243
- import * as WEBIFC from "web-ifc";
2244
- /** Configuration of the IFC-fragment conversion. */
2245
- export declare class IfcFragmentSettings {
2246
- /** Whether to extract the IFC properties into a JSON. */
2247
- includeProperties: boolean;
2248
- /**
2249
- * Generate the geometry for categories that are not included by default,
2250
- * like IFCSPACE.
2251
- */
2252
- optionalCategories: number[];
2253
- /** Whether to use the coordination data coming from the IFC files. */
2254
- coordinate: boolean;
2255
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2256
- wasm: {
2257
- path: string;
2258
- absolute: boolean;
2259
- logLevel?: WEBIFC.LogLevel;
2260
- };
2261
- /** List of categories that won't be converted to fragments. */
2262
- excludedCategories: Set<number>;
2263
- /** Whether to save the absolute location of all IFC items. */
2264
- saveLocations: boolean;
2265
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2266
- webIfc: WEBIFC.LoaderSettings;
2267
- /**
2268
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2269
- * If set to true, the path will be set to the default path of the WASM file.
2270
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2271
- * Default value is true.
2272
- */
2273
- autoSetWasm: boolean;
2274
- /**
2275
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2276
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2277
- * If set to null, the default file location handler will be used.
2278
- *
2279
- * @param url - The URL of the file to locate.
2280
- * @returns The absolute path of the file.
2281
- */
2282
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2283
- }
2284
- /**
2285
- * 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.
2286
- *
2287
- * @remarks
2288
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2289
- * It is useful for identifying and processing different types of IFC elements in a project.
2290
- *
2291
- */
2292
- export declare const IfcElements: {
2293
- [key: number]: string;
2294
- };
2295
- import * as FRAGS from "@thatopen/fragments";
2296
2236
  export declare class IfcPropertiesUtils {
2297
2237
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2298
2238
  static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
@@ -2314,213 +2254,120 @@ export declare class IfcPropertiesUtils {
2314
2254
  value: number | null;
2315
2255
  }>;
2316
2256
  static isRel(expressID: number): boolean;
2317
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2318
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2319
- }
2320
- import * as THREE from "three";
2321
- import { Hideable, Event, World, Disposable } from "../../Types";
2322
- import { Components } from "../../Components";
2323
- /**
2324
- * Configuration interface for the {@link SimpleGrid} class.
2325
- */
2326
- export interface GridConfig {
2327
- /**
2328
- * The color of the grid lines.
2329
- */
2330
- color: THREE.Color;
2331
- /**
2332
- * The size of the primary grid lines.
2333
- */
2334
- size1: number;
2335
- /**
2336
- * The size of the secondary grid lines.
2337
- */
2338
- size2: number;
2339
- /**
2340
- * The distance at which the grid lines start to fade away.
2341
- */
2342
- distance: number;
2343
- }
2344
- /**
2345
- * 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).
2346
- */
2347
- export declare class SimpleGrid implements Hideable, Disposable {
2348
- /** {@link Disposable.onDisposed} */
2349
- readonly onDisposed: Event<unknown>;
2350
- /** The world instance to which this Raycaster belongs. */
2351
- world: World;
2352
- /** The components instance to which this grid belongs. */
2353
- components: Components;
2354
- /** {@link Hideable.visible} */
2355
- get visible(): boolean;
2356
- /** {@link Hideable.visible} */
2357
- set visible(visible: boolean);
2358
- /** The material of the grid. */
2359
- get material(): THREE.ShaderMaterial;
2360
- /**
2361
- * Whether the grid should fade away with distance. Recommended to be true for
2362
- * perspective cameras and false for orthographic cameras.
2363
- */
2364
- get fade(): boolean;
2365
- /**
2366
- * Whether the grid should fade away with distance. Recommended to be true for
2367
- * perspective cameras and false for orthographic cameras.
2368
- */
2369
- set fade(active: boolean);
2370
- /** The Three.js mesh that contains the infinite grid. */
2371
- readonly three: THREE.Mesh;
2372
- private _fade;
2373
- constructor(components: Components, world: World, config: GridConfig);
2374
- /** {@link Disposable.dispose} */
2375
- dispose(): void;
2376
- private setupEvents;
2377
- private updateZoom;
2378
- }
2379
- import { NavigationMode } from "./types";
2380
- import { OrthoPerspectiveCamera } from "../index";
2381
- /**
2382
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2383
- */
2384
- export declare class FirstPersonMode implements NavigationMode {
2385
- private camera;
2386
- /** {@link NavigationMode.enabled} */
2387
- enabled: boolean;
2388
- /** {@link NavigationMode.id} */
2389
- readonly id = "FirstPerson";
2390
- constructor(camera: OrthoPerspectiveCamera);
2391
- /** {@link NavigationMode.set} */
2392
- set(active: boolean): void;
2393
- private setupFirstPersonCamera;
2394
- }
2395
- import { NavigationMode } from "./types";
2396
- import { OrthoPerspectiveCamera } from "../index";
2397
- /**
2398
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2399
- */
2400
- export declare class OrbitMode implements NavigationMode {
2401
- camera: OrthoPerspectiveCamera;
2402
- /** {@link NavigationMode.enabled} */
2403
- enabled: boolean;
2404
- /** {@link NavigationMode.id} */
2405
- readonly id = "Orbit";
2406
- constructor(camera: OrthoPerspectiveCamera);
2407
- /** {@link NavigationMode.set} */
2408
- set(active: boolean): void;
2409
- private activateOrbitControls;
2410
- }
2411
- /**
2412
- * A Set of unique numbers representing different types of IFC geometries.
2413
- */
2414
- export declare const GeometryTypes: Set<number>;
2415
- import { NavigationMode } from "./types";
2416
- import { OrthoPerspectiveCamera } from "../index";
2417
- /**
2418
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2419
- */
2420
- export declare class PlanMode implements NavigationMode {
2421
- private camera;
2422
- /** {@link NavigationMode.enabled} */
2423
- enabled: boolean;
2424
- /** {@link NavigationMode.id} */
2425
- readonly id = "Plan";
2426
- private mouseAction1?;
2427
- private mouseAction2?;
2428
- private mouseInitialized;
2429
- private readonly defaultAzimuthSpeed;
2430
- private readonly defaultPolarSpeed;
2431
- constructor(camera: OrthoPerspectiveCamera);
2432
- /** {@link NavigationMode.set} */
2433
- set(active: boolean): void;
2434
- }
2435
- /**
2436
- * The projection system of the camera.
2437
- */
2438
- export type CameraProjection = "Perspective" | "Orthographic";
2439
- /**
2440
- * The extensible list of supported navigation modes.
2441
- */
2442
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
2257
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2258
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2259
+ }
2443
2260
  /**
2444
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
2261
+ * 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.
2445
2262
  */
2446
- export interface NavigationMode {
2447
- /** The unique ID of this navigation mode. */
2448
- id: NavModeID;
2449
- /**
2450
- * Enable or disable this navigation mode.
2451
- * When a new navigation mode is enabled, the previous navigation mode
2452
- * must be disabled.
2453
- *
2454
- * @param active - whether to enable or disable this mode.
2455
- * @param options - any additional data required to enable or disable it.
2456
- * */
2457
- set: (active: boolean, options?: any) => void;
2458
- /** Whether this navigation mode is active or not. */
2459
- enabled: boolean;
2460
- }
2461
- import * as THREE from "three";
2462
- import { CameraProjection } from "./types";
2463
- import { Event } from "../../Types";
2464
- import { OrthoPerspectiveCamera } from "../index";
2263
+ export declare const IfcCategoryMap: {
2264
+ [key: number]: string;
2265
+ };
2465
2266
  /**
2466
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2267
+ * A Set of unique numbers representing different types of IFC geometries.
2467
2268
  */
2468
- export declare class ProjectionManager {
2269
+ export declare const GeometryTypes: Set<number>;
2270
+ import { InverseAttribute } from "./types";
2271
+ export declare const relToAttributesMap: Map<number, {
2272
+ forRelating: InverseAttribute;
2273
+ forRelated: InverseAttribute;
2274
+ }>;
2275
+ import * as WEBIFC from "web-ifc";
2276
+ /** Configuration of the IFC-fragment conversion. */
2277
+ export declare class IfcFragmentSettings {
2278
+ /** Whether to extract the IFC properties into a JSON. */
2279
+ includeProperties: boolean;
2469
2280
  /**
2470
- * Event that fires when the {@link CameraProjection} changes.
2281
+ * Generate the geometry for categories that are not included by default,
2282
+ * like IFCSPACE.
2471
2283
  */
2472
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
2284
+ optionalCategories: number[];
2285
+ /** Whether to use the coordination data coming from the IFC files. */
2286
+ coordinate: boolean;
2287
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2288
+ wasm: {
2289
+ path: string;
2290
+ absolute: boolean;
2291
+ logLevel?: WEBIFC.LogLevel;
2292
+ };
2293
+ /** List of categories that won't be converted to fragments. */
2294
+ excludedCategories: Set<number>;
2295
+ /** Whether to save the absolute location of all IFC items. */
2296
+ saveLocations: boolean;
2297
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2298
+ webIfc: WEBIFC.LoaderSettings;
2473
2299
  /**
2474
- * Current projection mode of the camera.
2475
- * Default is "Perspective".
2300
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2301
+ * If set to true, the path will be set to the default path of the WASM file.
2302
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2303
+ * Default value is true.
2476
2304
  */
2477
- current: CameraProjection;
2305
+ autoSetWasm: boolean;
2478
2306
  /**
2479
- * The camera controlled by this ProjectionManager.
2480
- * It can be either a PerspectiveCamera or an OrthographicCamera.
2307
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2308
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2309
+ * If set to null, the default file location handler will be used.
2310
+ *
2311
+ * @param url - The URL of the file to locate.
2312
+ * @returns The absolute path of the file.
2481
2313
  */
2482
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2483
- /** Match Ortho zoom with Perspective distance when changing projection mode */
2484
- matchOrthoDistanceEnabled: boolean;
2485
- private _component;
2486
- private _previousDistance;
2487
- constructor(camera: OrthoPerspectiveCamera);
2314
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2315
+ }
2316
+ /**
2317
+ * 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.
2318
+ */
2319
+ export declare class Event<T> {
2488
2320
  /**
2489
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2490
- *
2491
- * @param projection - the new projection to set. If it is the current projection,
2492
- * it will have no effect.
2321
+ * Add a callback to this event instance.
2322
+ * @param handler - the callback to be added to this event.
2493
2323
  */
2494
- set(projection: CameraProjection): Promise<void>;
2324
+ add(handler: T extends void ? {
2325
+ (): void;
2326
+ } : {
2327
+ (data: T): void;
2328
+ }): void;
2495
2329
  /**
2496
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
2497
- * and vice versa.
2330
+ * Removes a callback from this event instance.
2331
+ * @param handler - the callback to be removed from this event.
2498
2332
  */
2499
- toggle(): Promise<void>;
2500
- private setOrthoCamera;
2501
- private getPerspectiveDims;
2502
- private setupOrthoCamera;
2503
- private getDistance;
2504
- private setPerspectiveCamera;
2333
+ remove(handler: T extends void ? {
2334
+ (): void;
2335
+ } : {
2336
+ (data: T): void;
2337
+ }): void;
2338
+ /** Triggers all the callbacks assigned to this event. */
2339
+ trigger: (data?: T) => void;
2340
+ /** Gets rid of all the suscribed events. */
2341
+ reset(): void;
2342
+ private handlers;
2505
2343
  }
2506
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2507
- import { Components } from "../../Components";
2508
2344
  /**
2509
- * Base class of the library. Useful for finding out the interfaces something implements.
2345
+ * 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.
2510
2346
  */
2511
- export declare abstract class Base {
2512
- components: Components;
2513
- constructor(components: Components);
2514
- /** Whether is component is {@link Disposable}. */
2515
- isDisposeable: () => this is Disposable;
2516
- /** Whether is component is {@link Resizeable}. */
2517
- isResizeable: () => this is Resizeable;
2518
- /** Whether is component is {@link Updateable}. */
2519
- isUpdateable: () => this is Updateable;
2520
- /** Whether is component is {@link Hideable}. */
2521
- isHideable: () => this is Hideable;
2522
- /** Whether is component is {@link Configurable}. */
2523
- isConfigurable: () => this is Configurable<any>;
2347
+ export declare class AsyncEvent<T> {
2348
+ /**
2349
+ * Add a callback to this event instance.
2350
+ * @param handler - the callback to be added to this event.
2351
+ */
2352
+ add(handler: T extends void ? {
2353
+ (): Promise<void>;
2354
+ } : {
2355
+ (data: T): Promise<void>;
2356
+ }): void;
2357
+ /**
2358
+ * Removes a callback from this event instance.
2359
+ * @param handler - the callback to be removed from this event.
2360
+ */
2361
+ remove(handler: T extends void ? {
2362
+ (): Promise<void>;
2363
+ } : {
2364
+ (data: T): Promise<void>;
2365
+ }): void;
2366
+ /** Triggers all the callbacks assigned to this event. */
2367
+ trigger: (data?: T) => Promise<void>;
2368
+ /** Gets rid of all the suscribed events. */
2369
+ reset(): void;
2370
+ private handlers;
2524
2371
  }
2525
2372
  import * as THREE from "three";
2526
2373
  import CameraControls from "camera-controls";
@@ -2630,67 +2477,6 @@ export interface CameraControllable {
2630
2477
  */
2631
2478
  controls: CameraControls;
2632
2479
  }
2633
- import { InverseAttribute } from "./types";
2634
- export declare const relToAttributesMap: Map<number, {
2635
- forRelating: InverseAttribute;
2636
- forRelated: InverseAttribute;
2637
- }>;
2638
- /**
2639
- * 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.
2640
- */
2641
- export declare class Event<T> {
2642
- /**
2643
- * Add a callback to this event instance.
2644
- * @param handler - the callback to be added to this event.
2645
- */
2646
- add(handler: T extends void ? {
2647
- (): void;
2648
- } : {
2649
- (data: T): void;
2650
- }): void;
2651
- /**
2652
- * Removes a callback from this event instance.
2653
- * @param handler - the callback to be removed from this event.
2654
- */
2655
- remove(handler: T extends void ? {
2656
- (): void;
2657
- } : {
2658
- (data: T): void;
2659
- }): void;
2660
- /** Triggers all the callbacks assigned to this event. */
2661
- trigger: (data?: T) => void;
2662
- /** Gets rid of all the suscribed events. */
2663
- reset(): void;
2664
- private handlers;
2665
- }
2666
- import * as THREE from "three";
2667
- import CameraControls from "camera-controls";
2668
- import { BaseWorldItem } from "./base-world-item";
2669
- import { CameraControllable } from "./interfaces";
2670
- /**
2671
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2672
- */
2673
- export declare abstract class BaseCamera extends BaseWorldItem {
2674
- /**
2675
- * Whether the camera is enabled or not.
2676
- */
2677
- abstract enabled: boolean;
2678
- /**
2679
- * The Three.js camera instance.
2680
- */
2681
- abstract three: THREE.Camera;
2682
- /**
2683
- * Optional CameraControls instance for controlling the camera.
2684
- * This property is only available if the camera is controllable.
2685
- */
2686
- abstract controls?: CameraControls;
2687
- /**
2688
- * Checks whether the instance is {@link CameraControllable}.
2689
- *
2690
- * @returns True if the instance is controllable, false otherwise.
2691
- */
2692
- hasCameraControls: () => this is CameraControllable;
2693
- }
2694
2480
  import { Base } from "./base";
2695
2481
  /**
2696
2482
  * 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.
@@ -2702,58 +2488,54 @@ export declare abstract class Component extends Base {
2702
2488
  * dimensions, while a disabled camera will stop moving. A disabled component
2703
2489
  * will not be updated automatically each frame.
2704
2490
  */
2705
- abstract enabled: boolean;
2706
- }
2707
- /**
2708
- * 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.
2709
- */
2710
- export declare class AsyncEvent<T> {
2711
- /**
2712
- * Add a callback to this event instance.
2713
- * @param handler - the callback to be added to this event.
2714
- */
2715
- add(handler: T extends void ? {
2716
- (): Promise<void>;
2717
- } : {
2718
- (data: T): Promise<void>;
2719
- }): void;
2720
- /**
2721
- * Removes a callback from this event instance.
2722
- * @param handler - the callback to be removed from this event.
2723
- */
2724
- remove(handler: T extends void ? {
2725
- (): Promise<void>;
2726
- } : {
2727
- (data: T): Promise<void>;
2728
- }): void;
2729
- /** Triggers all the callbacks assigned to this event. */
2730
- trigger: (data?: T) => Promise<void>;
2731
- /** Gets rid of all the suscribed events. */
2732
- reset(): void;
2733
- private handlers;
2734
- }
2735
- import { Base } from "./base";
2736
- import { World } from "./world";
2737
- import { Event } from "./event";
2738
- import { Components } from "../../Components";
2491
+ abstract enabled: boolean;
2492
+ }
2493
+ import * as THREE from "three";
2494
+ import CameraControls from "camera-controls";
2495
+ import { BaseWorldItem } from "./base-world-item";
2496
+ import { CameraControllable } from "./interfaces";
2739
2497
  /**
2740
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2498
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2741
2499
  */
2742
- export declare abstract class BaseWorldItem extends Base {
2743
- readonly worlds: Map<string, World>;
2500
+ export declare abstract class BaseCamera extends BaseWorldItem {
2744
2501
  /**
2745
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2746
- * The event payload contains the world instance and the action ("added" or "removed").
2502
+ * Whether the camera is enabled or not.
2747
2503
  */
2748
- readonly onWorldChanged: Event<{
2749
- world: World;
2750
- action: "added" | "removed";
2751
- }>;
2504
+ abstract enabled: boolean;
2752
2505
  /**
2753
- * The current world this item is associated with. It can be null if no world is currently active.
2506
+ * The Three.js camera instance.
2754
2507
  */
2755
- currentWorld: World | null;
2756
- protected constructor(components: Components);
2508
+ abstract three: THREE.Camera;
2509
+ /**
2510
+ * Optional CameraControls instance for controlling the camera.
2511
+ * This property is only available if the camera is controllable.
2512
+ */
2513
+ abstract controls?: CameraControls;
2514
+ /**
2515
+ * Checks whether the instance is {@link CameraControllable}.
2516
+ *
2517
+ * @returns True if the instance is controllable, false otherwise.
2518
+ */
2519
+ hasCameraControls: () => this is CameraControllable;
2520
+ }
2521
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2522
+ import { Components } from "../../Components";
2523
+ /**
2524
+ * Base class of the library. Useful for finding out the interfaces something implements.
2525
+ */
2526
+ export declare abstract class Base {
2527
+ components: Components;
2528
+ constructor(components: Components);
2529
+ /** Whether is component is {@link Disposable}. */
2530
+ isDisposeable: () => this is Disposable;
2531
+ /** Whether is component is {@link Resizeable}. */
2532
+ isResizeable: () => this is Resizeable;
2533
+ /** Whether is component is {@link Updateable}. */
2534
+ isUpdateable: () => this is Updateable;
2535
+ /** Whether is component is {@link Hideable}. */
2536
+ isHideable: () => this is Hideable;
2537
+ /** Whether is component is {@link Configurable}. */
2538
+ isConfigurable: () => this is Configurable<any>;
2757
2539
  }
2758
2540
  import * as THREE from "three";
2759
2541
  import { Vector2 } from "three";
@@ -2820,6 +2602,42 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2820
2602
  */
2821
2603
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2822
2604
  }
2605
+ import { Base } from "./base";
2606
+ import { World } from "./world";
2607
+ import { Event } from "./event";
2608
+ import { Components } from "../../Components";
2609
+ /**
2610
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2611
+ */
2612
+ export declare abstract class BaseWorldItem extends Base {
2613
+ readonly worlds: Map<string, World>;
2614
+ /**
2615
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2616
+ * The event payload contains the world instance and the action ("added" or "removed").
2617
+ */
2618
+ readonly onWorldChanged: Event<{
2619
+ world: World;
2620
+ action: "added" | "removed";
2621
+ }>;
2622
+ /**
2623
+ * The current world this item is associated with. It can be null if no world is currently active.
2624
+ */
2625
+ currentWorld: World | null;
2626
+ protected constructor(components: Components);
2627
+ }
2628
+ import * as FRAGS from "@thatopen/fragments";
2629
+ import * as WEBIFC from "web-ifc";
2630
+ export declare class SpatialIdsFinder {
2631
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2632
+ }
2633
+ import * as WEBIFC from "web-ifc";
2634
+ import { IfcItemsCategories } from "../../../ifc";
2635
+ export declare class SpatialStructure {
2636
+ itemsByFloor: IfcItemsCategories;
2637
+ private _units;
2638
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2639
+ cleanUp(): void;
2640
+ }
2823
2641
  import * as THREE from "three";
2824
2642
  import { Disposable } from "./interfaces";
2825
2643
  import { Event } from "./event";
@@ -2841,6 +2659,99 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
2841
2659
  dispose(): void;
2842
2660
  }
2843
2661
  import * as THREE from "three";
2662
+ import { BaseScene } from "./base-scene";
2663
+ import { BaseCamera } from "./base-camera";
2664
+ import { BaseRenderer } from "./base-renderer";
2665
+ import { Updateable, Disposable } from "./interfaces";
2666
+ /**
2667
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2668
+ */
2669
+ export interface World extends Disposable, Updateable {
2670
+ /**
2671
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2672
+ */
2673
+ meshes: Set<THREE.Mesh>;
2674
+ /**
2675
+ * The base scene of the world.
2676
+ */
2677
+ scene: BaseScene;
2678
+ /**
2679
+ * The base camera of the world.
2680
+ */
2681
+ camera: BaseCamera;
2682
+ /**
2683
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2684
+ */
2685
+ renderer: BaseRenderer | null;
2686
+ /**
2687
+ * A unique identifier for the world.
2688
+ */
2689
+ uuid: string;
2690
+ /**
2691
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2692
+ */
2693
+ isDisposing: boolean;
2694
+ }
2695
+ import * as THREE from "three";
2696
+ import { Hideable, Event, World, Disposable } from "../../Types";
2697
+ import { Components } from "../../Components";
2698
+ /**
2699
+ * Configuration interface for the {@link SimpleGrid} class.
2700
+ */
2701
+ export interface GridConfig {
2702
+ /**
2703
+ * The color of the grid lines.
2704
+ */
2705
+ color: THREE.Color;
2706
+ /**
2707
+ * The size of the primary grid lines.
2708
+ */
2709
+ size1: number;
2710
+ /**
2711
+ * The size of the secondary grid lines.
2712
+ */
2713
+ size2: number;
2714
+ /**
2715
+ * The distance at which the grid lines start to fade away.
2716
+ */
2717
+ distance: number;
2718
+ }
2719
+ /**
2720
+ * 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).
2721
+ */
2722
+ export declare class SimpleGrid implements Hideable, Disposable {
2723
+ /** {@link Disposable.onDisposed} */
2724
+ readonly onDisposed: Event<unknown>;
2725
+ /** The world instance to which this Raycaster belongs. */
2726
+ world: World;
2727
+ /** The components instance to which this grid belongs. */
2728
+ components: Components;
2729
+ /** {@link Hideable.visible} */
2730
+ get visible(): boolean;
2731
+ /** {@link Hideable.visible} */
2732
+ set visible(visible: boolean);
2733
+ /** The material of the grid. */
2734
+ get material(): THREE.ShaderMaterial;
2735
+ /**
2736
+ * Whether the grid should fade away with distance. Recommended to be true for
2737
+ * perspective cameras and false for orthographic cameras.
2738
+ */
2739
+ get fade(): boolean;
2740
+ /**
2741
+ * Whether the grid should fade away with distance. Recommended to be true for
2742
+ * perspective cameras and false for orthographic cameras.
2743
+ */
2744
+ set fade(active: boolean);
2745
+ /** The Three.js mesh that contains the infinite grid. */
2746
+ readonly three: THREE.Mesh;
2747
+ private _fade;
2748
+ constructor(components: Components, world: World, config: GridConfig);
2749
+ /** {@link Disposable.dispose} */
2750
+ dispose(): void;
2751
+ private setupEvents;
2752
+ private updateZoom;
2753
+ }
2754
+ import * as THREE from "three";
2844
2755
  import { Disposable, Event } from "../../Types";
2845
2756
  /**
2846
2757
  * 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.
@@ -2916,117 +2827,151 @@ export declare class SimpleRaycaster implements Disposable {
2916
2827
  private filterClippingPlanes;
2917
2828
  }
2918
2829
  import * as THREE from "three";
2919
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2830
+ import { Components } from "../../Components";
2831
+ import { AsyncEvent, Event, World } from "../../Types";
2920
2832
  /**
2921
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2922
- *
2923
- * @template T - The type of the scene. Default is BaseScene.
2924
- * @template U - The type of the camera. Default is BaseCamera.
2925
- * @template S - The type of the renderer. Default is BaseRenderer.
2833
+ * Settings to configure the CullerRenderer.
2926
2834
  */
2927
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2928
- /**
2929
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2930
- */
2931
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2932
- /** {@link Updateable.onAfterUpdate} */
2933
- readonly onAfterUpdate: Event<unknown>;
2934
- /** {@link Updateable.onBeforeUpdate} */
2935
- readonly onBeforeUpdate: Event<unknown>;
2936
- /** {@link Disposable.onDisposed} */
2937
- readonly onDisposed: Event<unknown>;
2938
- /**
2939
- * 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.
2940
- */
2941
- isDisposing: boolean;
2942
- /**
2943
- * Indicates whether the world is currently enabled.
2944
- * When disabled, the world will not be updated.
2945
- */
2946
- enabled: boolean;
2835
+ export interface CullerRendererSettings {
2947
2836
  /**
2948
- * A unique identifier for the world.
2837
+ * Interval in milliseconds at which the visibility check should be performed.
2838
+ * Default value is 1000.
2949
2839
  */
2950
- uuid: string;
2840
+ updateInterval?: number;
2951
2841
  /**
2952
- * An optional name for the world.
2842
+ * Width of the render target used for visibility checks.
2843
+ * Default value is 512.
2953
2844
  */
2954
- name?: string;
2955
- private _scene?;
2956
- private _camera?;
2957
- private _renderer;
2845
+ width?: number;
2958
2846
  /**
2959
- * Getter for the scene. If no scene is initialized, it throws an error.
2960
- * @returns The current scene.
2847
+ * Height of the render target used for visibility checks.
2848
+ * Default value is 512.
2961
2849
  */
2962
- get scene(): T;
2850
+ height?: number;
2963
2851
  /**
2964
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2965
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2966
- * @param scene - The new scene to be set.
2852
+ * Whether the visibility check should be performed automatically.
2853
+ * Default value is true.
2967
2854
  */
2968
- set scene(scene: T);
2855
+ autoUpdate?: boolean;
2856
+ }
2857
+ /**
2858
+ * A base renderer to determine visibility on screen.
2859
+ */
2860
+ export declare class CullerRenderer {
2861
+ /** {@link Disposable.onDisposed} */
2862
+ readonly onDisposed: Event<string>;
2969
2863
  /**
2970
- * Getter for the camera. If no camera is initialized, it throws an error.
2971
- * @returns The current camera.
2864
+ * Fires after making the visibility check to the meshes. It lists the
2865
+ * meshes that are currently visible, and the ones that were visible
2866
+ * just before but not anymore.
2972
2867
  */
2973
- get camera(): U;
2868
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2974
2869
  /**
2975
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2976
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2977
- * @param camera - The new camera to be set.
2870
+ * Whether this renderer is active or not. If not, it won't render anything.
2978
2871
  */
2979
- set camera(camera: U);
2872
+ enabled: boolean;
2980
2873
  /**
2981
- * Getter for the renderer.
2982
- * @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).
2874
+ * Needs to check whether there are objects that need to be hidden or shown.
2875
+ * You can bind this to the camera movement, to a certain interval, etc.
2983
2876
  */
2984
- get renderer(): S | null;
2877
+ needsUpdate: boolean;
2985
2878
  /**
2986
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2987
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2988
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2989
- * @param renderer - The new renderer to be set or null to remove the current renderer.
2879
+ * Render the internal scene used to determine the object visibility. Used
2880
+ * for debugging purposes.
2990
2881
  */
2991
- set renderer(renderer: S | null);
2992
- /** {@link Updateable.update} */
2993
- update(delta?: number): void;
2882
+ renderDebugFrame: boolean;
2883
+ /** The components instance to which this renderer belongs. */
2884
+ components: Components;
2885
+ /** The world instance to which this renderer belongs. */
2886
+ readonly world: World;
2887
+ /** The THREE.js renderer used to make the visibility test. */
2888
+ readonly renderer: THREE.WebGLRenderer;
2889
+ protected autoUpdate: boolean;
2890
+ protected updateInterval: number;
2891
+ protected readonly worker: Worker;
2892
+ protected readonly scene: THREE.Scene;
2893
+ private _width;
2894
+ private _height;
2895
+ private _availableColor;
2896
+ private readonly renderTarget;
2897
+ private readonly bufferSize;
2898
+ private readonly _buffer;
2899
+ protected _isWorkerBusy: boolean;
2900
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2994
2901
  /** {@link Disposable.dispose} */
2995
- dispose(disposeResources?: boolean): void;
2902
+ dispose(): void;
2903
+ /**
2904
+ * The function that the culler uses to reprocess the scene. Generally it's
2905
+ * better to call needsUpdate, but you can also call this to force it.
2906
+ * @param force if true, it will refresh the scene even if needsUpdate is
2907
+ * not true.
2908
+ */
2909
+ updateVisibility: (force?: boolean) => Promise<void>;
2910
+ protected getAvailableColor(): {
2911
+ r: number;
2912
+ g: number;
2913
+ b: number;
2914
+ code: string;
2915
+ };
2916
+ protected increaseColor(): void;
2917
+ protected decreaseColor(): void;
2918
+ private applySettings;
2996
2919
  }
2997
2920
  import * as THREE from "three";
2998
- import { BaseScene } from "./base-scene";
2999
- import { BaseCamera } from "./base-camera";
3000
- import { BaseRenderer } from "./base-renderer";
3001
- import { Updateable, Disposable } from "./interfaces";
2921
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2922
+ import { Components } from "../../Components";
2923
+ import { Event, World, Disposable } from "../../Types";
3002
2924
  /**
3003
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2925
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3004
2926
  */
3005
- export interface World extends Disposable, Updateable {
2927
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3006
2928
  /**
3007
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2929
+ * Event triggered when the visibility of meshes is updated.
2930
+ * Contains two sets: seen and unseen.
3008
2931
  */
3009
- meshes: Set<THREE.Mesh>;
2932
+ readonly onViewUpdated: Event<{
2933
+ seen: Set<THREE.Mesh>;
2934
+ unseen: Set<THREE.Mesh>;
2935
+ }>;
3010
2936
  /**
3011
- * The base scene of the world.
2937
+ * Pixels in screen a geometry must occupy to be considered "seen".
2938
+ * Default value is 100.
3012
2939
  */
3013
- scene: BaseScene;
2940
+ threshold: number;
3014
2941
  /**
3015
- * The base camera of the world.
2942
+ * Map of color code to THREE.InstancedMesh.
2943
+ * Used to keep track of color-coded meshes.
3016
2944
  */
3017
- camera: BaseCamera;
2945
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3018
2946
  /**
3019
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2947
+ * Flag to indicate if the renderer is currently processing.
2948
+ * Used to prevent concurrent processing.
3020
2949
  */
3021
- renderer: BaseRenderer | null;
2950
+ isProcessing: boolean;
2951
+ private _colorCodeMeshMap;
2952
+ private _meshIDColorCodeMap;
2953
+ private _currentVisibleMeshes;
2954
+ private _recentlyHiddenMeshes;
2955
+ private _intervalID;
2956
+ private readonly _transparentMat;
2957
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2958
+ /** {@link Disposable.dispose} */
2959
+ dispose(): void;
3022
2960
  /**
3023
- * A unique identifier for the world.
2961
+ * 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.
2962
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2963
+ * @returns {void}
3024
2964
  */
3025
- uuid: string;
2965
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3026
2966
  /**
3027
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2967
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2968
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2969
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2970
+ * @returns {void}
3028
2971
  */
3029
- isDisposing: boolean;
2972
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2973
+ private handleWorkerMessage;
2974
+ private getAvailableMaterial;
3030
2975
  }
3031
2976
  import * as THREE from "three";
3032
2977
  import { BaseScene, Configurable, Event } from "../../Types";
@@ -3122,95 +3067,116 @@ export declare class SimpleRenderer extends BaseRenderer {
3122
3067
  private onContextBack;
3123
3068
  }
3124
3069
  import * as THREE from "three";
3125
- import { Components } from "../../Components";
3126
- import { AsyncEvent, Event, World } from "../../Types";
3070
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3127
3071
  /**
3128
- * Settings to configure the CullerRenderer.
3072
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3073
+ *
3074
+ * @template T - The type of the scene. Default is BaseScene.
3075
+ * @template U - The type of the camera. Default is BaseCamera.
3076
+ * @template S - The type of the renderer. Default is BaseRenderer.
3129
3077
  */
3130
- export interface CullerRendererSettings {
3078
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3131
3079
  /**
3132
- * Interval in milliseconds at which the visibility check should be performed.
3133
- * Default value is 1000.
3080
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3134
3081
  */
3135
- updateInterval?: number;
3082
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3083
+ /** {@link Updateable.onAfterUpdate} */
3084
+ readonly onAfterUpdate: Event<unknown>;
3085
+ /** {@link Updateable.onBeforeUpdate} */
3086
+ readonly onBeforeUpdate: Event<unknown>;
3087
+ /** {@link Disposable.onDisposed} */
3088
+ readonly onDisposed: Event<unknown>;
3136
3089
  /**
3137
- * Width of the render target used for visibility checks.
3138
- * Default value is 512.
3090
+ * 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.
3139
3091
  */
3140
- width?: number;
3092
+ isDisposing: boolean;
3141
3093
  /**
3142
- * Height of the render target used for visibility checks.
3143
- * Default value is 512.
3094
+ * Indicates whether the world is currently enabled.
3095
+ * When disabled, the world will not be updated.
3144
3096
  */
3145
- height?: number;
3097
+ enabled: boolean;
3146
3098
  /**
3147
- * Whether the visibility check should be performed automatically.
3148
- * Default value is true.
3099
+ * A unique identifier for the world.
3149
3100
  */
3150
- autoUpdate?: boolean;
3151
- }
3152
- /**
3153
- * A base renderer to determine visibility on screen.
3154
- */
3155
- export declare class CullerRenderer {
3156
- /** {@link Disposable.onDisposed} */
3157
- readonly onDisposed: Event<string>;
3101
+ uuid: string;
3158
3102
  /**
3159
- * Fires after making the visibility check to the meshes. It lists the
3160
- * meshes that are currently visible, and the ones that were visible
3161
- * just before but not anymore.
3103
+ * An optional name for the world.
3162
3104
  */
3163
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3105
+ name?: string;
3106
+ private _scene?;
3107
+ private _camera?;
3108
+ private _renderer;
3164
3109
  /**
3165
- * Whether this renderer is active or not. If not, it won't render anything.
3110
+ * Getter for the scene. If no scene is initialized, it throws an error.
3111
+ * @returns The current scene.
3166
3112
  */
3167
- enabled: boolean;
3113
+ get scene(): T;
3168
3114
  /**
3169
- * Needs to check whether there are objects that need to be hidden or shown.
3170
- * You can bind this to the camera movement, to a certain interval, etc.
3115
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3116
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3117
+ * @param scene - The new scene to be set.
3171
3118
  */
3172
- needsUpdate: boolean;
3119
+ set scene(scene: T);
3173
3120
  /**
3174
- * Render the internal scene used to determine the object visibility. Used
3175
- * for debugging purposes.
3121
+ * Getter for the camera. If no camera is initialized, it throws an error.
3122
+ * @returns The current camera.
3176
3123
  */
3177
- renderDebugFrame: boolean;
3178
- /** The components instance to which this renderer belongs. */
3179
- components: Components;
3180
- /** The world instance to which this renderer belongs. */
3181
- readonly world: World;
3182
- /** The THREE.js renderer used to make the visibility test. */
3183
- readonly renderer: THREE.WebGLRenderer;
3184
- protected autoUpdate: boolean;
3185
- protected updateInterval: number;
3186
- protected readonly worker: Worker;
3187
- protected readonly scene: THREE.Scene;
3188
- private _width;
3189
- private _height;
3190
- private _availableColor;
3191
- private readonly renderTarget;
3192
- private readonly bufferSize;
3193
- private readonly _buffer;
3194
- protected _isWorkerBusy: boolean;
3195
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3196
- /** {@link Disposable.dispose} */
3197
- dispose(): void;
3124
+ get camera(): U;
3198
3125
  /**
3199
- * The function that the culler uses to reprocess the scene. Generally it's
3200
- * better to call needsUpdate, but you can also call this to force it.
3201
- * @param force if true, it will refresh the scene even if needsUpdate is
3202
- * not true.
3126
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3127
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3128
+ * @param camera - The new camera to be set.
3203
3129
  */
3204
- updateVisibility: (force?: boolean) => Promise<void>;
3205
- protected getAvailableColor(): {
3206
- r: number;
3207
- g: number;
3208
- b: number;
3209
- code: string;
3210
- };
3211
- protected increaseColor(): void;
3212
- protected decreaseColor(): void;
3213
- private applySettings;
3130
+ set camera(camera: U);
3131
+ /**
3132
+ * Getter for the renderer.
3133
+ * @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).
3134
+ */
3135
+ get renderer(): S | null;
3136
+ /**
3137
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3138
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3139
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3140
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3141
+ */
3142
+ set renderer(renderer: S | null);
3143
+ /** {@link Updateable.update} */
3144
+ update(delta?: number): void;
3145
+ /** {@link Disposable.dispose} */
3146
+ dispose(disposeResources?: boolean): void;
3147
+ }
3148
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3149
+ import { NavigationMode } from "./types";
3150
+ import { OrthoPerspectiveCamera } from "../index";
3151
+ /**
3152
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3153
+ */
3154
+ export declare class FirstPersonMode implements NavigationMode {
3155
+ private camera;
3156
+ /** {@link NavigationMode.enabled} */
3157
+ enabled: boolean;
3158
+ /** {@link NavigationMode.id} */
3159
+ readonly id = "FirstPerson";
3160
+ constructor(camera: OrthoPerspectiveCamera);
3161
+ /** {@link NavigationMode.set} */
3162
+ set(active: boolean): void;
3163
+ private setupFirstPersonCamera;
3164
+ }
3165
+ import { NavigationMode } from "./types";
3166
+ import { OrthoPerspectiveCamera } from "../index";
3167
+ /**
3168
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3169
+ */
3170
+ export declare class OrbitMode implements NavigationMode {
3171
+ camera: OrthoPerspectiveCamera;
3172
+ /** {@link NavigationMode.enabled} */
3173
+ enabled: boolean;
3174
+ /** {@link NavigationMode.id} */
3175
+ readonly id = "Orbit";
3176
+ constructor(camera: OrthoPerspectiveCamera);
3177
+ /** {@link NavigationMode.set} */
3178
+ set(active: boolean): void;
3179
+ private activateOrbitControls;
3214
3180
  }
3215
3181
  import * as THREE from "three";
3216
3182
  import CameraControls from "camera-controls";
@@ -3275,62 +3241,6 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3275
3241
  private static getSubsetOfThree;
3276
3242
  }
3277
3243
  import * as THREE from "three";
3278
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3279
- import { Components } from "../../Components";
3280
- import { Event, World, Disposable } from "../../Types";
3281
- /**
3282
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3283
- */
3284
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3285
- /**
3286
- * Event triggered when the visibility of meshes is updated.
3287
- * Contains two sets: seen and unseen.
3288
- */
3289
- readonly onViewUpdated: Event<{
3290
- seen: Set<THREE.Mesh>;
3291
- unseen: Set<THREE.Mesh>;
3292
- }>;
3293
- /**
3294
- * Pixels in screen a geometry must occupy to be considered "seen".
3295
- * Default value is 100.
3296
- */
3297
- threshold: number;
3298
- /**
3299
- * Map of color code to THREE.InstancedMesh.
3300
- * Used to keep track of color-coded meshes.
3301
- */
3302
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3303
- /**
3304
- * Flag to indicate if the renderer is currently processing.
3305
- * Used to prevent concurrent processing.
3306
- */
3307
- isProcessing: boolean;
3308
- private _colorCodeMeshMap;
3309
- private _meshIDColorCodeMap;
3310
- private _currentVisibleMeshes;
3311
- private _recentlyHiddenMeshes;
3312
- private _intervalID;
3313
- private readonly _transparentMat;
3314
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3315
- /** {@link Disposable.dispose} */
3316
- dispose(): void;
3317
- /**
3318
- * 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.
3319
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3320
- * @returns {void}
3321
- */
3322
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3323
- /**
3324
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3325
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3326
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3327
- * @returns {void}
3328
- */
3329
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3330
- private handleWorkerMessage;
3331
- private getAvailableMaterial;
3332
- }
3333
- import * as THREE from "three";
3334
3244
  import { Hideable, Disposable, Event, World } from "../../Types";
3335
3245
  import { Components } from "../../Components";
3336
3246
  /**
@@ -3429,67 +3339,96 @@ export declare class SimplePlane implements Disposable, Hideable {
3429
3339
  private newHelper;
3430
3340
  private static newPlaneMesh;
3431
3341
  }
3432
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3433
- import * as WEBIFC from "web-ifc";
3434
- export declare class IfcMetadataReader {
3435
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3436
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3437
- }
3438
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3342
+ import * as THREE from "three";
3343
+ import { CameraProjection } from "./types";
3344
+ import { Event } from "../../Types";
3345
+ import { OrthoPerspectiveCamera } from "../index";
3439
3346
  /**
3440
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3347
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3441
3348
  */
3442
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3349
+ export declare class ProjectionManager {
3443
3350
  /**
3444
- * Minimum number of geometries to be streamed.
3445
- * Defaults to 10 geometries.
3351
+ * Event that fires when the {@link CameraProjection} changes.
3446
3352
  */
3447
- minGeometrySize: number;
3353
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3448
3354
  /**
3449
- * Minimum amount of assets to be streamed.
3450
- * Defaults to 1000 assets.
3355
+ * Current projection mode of the camera.
3356
+ * Default is "Perspective".
3451
3357
  */
3452
- minAssetsSize: number;
3453
- }
3454
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3455
- /**
3456
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3457
- */
3458
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3358
+ current: CameraProjection;
3459
3359
  /**
3460
- * Amount of properties to be streamed.
3461
- * Defaults to 100 properties.
3360
+ * The camera controlled by this ProjectionManager.
3361
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3462
3362
  */
3463
- propertiesSize: number;
3363
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3364
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3365
+ matchOrthoDistanceEnabled: boolean;
3366
+ private _component;
3367
+ private _previousDistance;
3368
+ constructor(camera: OrthoPerspectiveCamera);
3369
+ /**
3370
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3371
+ *
3372
+ * @param projection - the new projection to set. If it is the current projection,
3373
+ * it will have no effect.
3374
+ */
3375
+ set(projection: CameraProjection): Promise<void>;
3376
+ /**
3377
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3378
+ * and vice versa.
3379
+ */
3380
+ toggle(): Promise<void>;
3381
+ private setOrthoCamera;
3382
+ private getPerspectiveDims;
3383
+ private setupOrthoCamera;
3384
+ private getDistance;
3385
+ private setPerspectiveCamera;
3464
3386
  }
3465
3387
  /**
3466
- * 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.
3388
+ * The projection system of the camera.
3467
3389
  */
3468
- export interface StreamedGeometries {
3469
- [id: number]: {
3470
- /** The bounding box of the geometry as a Float32Array. */
3471
- boundingBox: Float32Array;
3472
- /** A boolean indicating whether the geometry has holes. */
3473
- hasHoles: boolean;
3474
- /** An optional file path for the geometry data. */
3475
- geometryFile?: string;
3476
- };
3390
+ export type CameraProjection = "Perspective" | "Orthographic";
3391
+ /**
3392
+ * The extensible list of supported navigation modes.
3393
+ */
3394
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3395
+ /**
3396
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3397
+ */
3398
+ export interface NavigationMode {
3399
+ /** The unique ID of this navigation mode. */
3400
+ id: NavModeID;
3401
+ /**
3402
+ * Enable or disable this navigation mode.
3403
+ * When a new navigation mode is enabled, the previous navigation mode
3404
+ * must be disabled.
3405
+ *
3406
+ * @param active - whether to enable or disable this mode.
3407
+ * @param options - any additional data required to enable or disable it.
3408
+ * */
3409
+ set: (active: boolean, options?: any) => void;
3410
+ /** Whether this navigation mode is active or not. */
3411
+ enabled: boolean;
3477
3412
  }
3413
+ import { NavigationMode } from "./types";
3414
+ import { OrthoPerspectiveCamera } from "../index";
3478
3415
  /**
3479
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3416
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3480
3417
  */
3481
- export interface StreamedAsset {
3482
- /** The unique identifier of the asset. */
3483
- id: number;
3484
- /** An array of geometries associated with the asset. */
3485
- geometries: {
3486
- /** The unique identifier of the geometry. */
3487
- geometryID: number;
3488
- /** The transformation matrix of the geometry as a number array. */
3489
- transformation: number[];
3490
- /** The color of the geometry as a number array. */
3491
- color: number[];
3492
- }[];
3418
+ export declare class PlanMode implements NavigationMode {
3419
+ private camera;
3420
+ /** {@link NavigationMode.enabled} */
3421
+ enabled: boolean;
3422
+ /** {@link NavigationMode.id} */
3423
+ readonly id = "Plan";
3424
+ private mouseAction1?;
3425
+ private mouseAction2?;
3426
+ private mouseInitialized;
3427
+ private readonly defaultAzimuthSpeed;
3428
+ private readonly defaultPolarSpeed;
3429
+ constructor(camera: OrthoPerspectiveCamera);
3430
+ /** {@link NavigationMode.set} */
3431
+ set(active: boolean): void;
3493
3432
  }
3494
3433
  import * as THREE from "three";
3495
3434
  import * as WEBIFC from "web-ifc";
@@ -3507,6 +3446,11 @@ export declare class CivilReader {
3507
3446
  private getCurves;
3508
3447
  }
3509
3448
  import * as WEBIFC from "web-ifc";
3449
+ export declare class IfcMetadataReader {
3450
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3451
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3452
+ }
3453
+ import * as WEBIFC from "web-ifc";
3510
3454
  import * as THREE from "three";
3511
3455
  export declare class Units {
3512
3456
  factor: number;
@@ -3516,6 +3460,35 @@ export declare class Units {
3516
3460
  private getLengthUnits;
3517
3461
  private getScaleMatrix;
3518
3462
  }
3463
+ /**
3464
+ * 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.
3465
+ */
3466
+ export interface StreamedGeometries {
3467
+ [id: number]: {
3468
+ /** The bounding box of the geometry as a Float32Array. */
3469
+ boundingBox: Float32Array;
3470
+ /** A boolean indicating whether the geometry has holes. */
3471
+ hasHoles: boolean;
3472
+ /** An optional file path for the geometry data. */
3473
+ geometryFile?: string;
3474
+ };
3475
+ }
3476
+ /**
3477
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3478
+ */
3479
+ export interface StreamedAsset {
3480
+ /** The unique identifier of the asset. */
3481
+ id: number;
3482
+ /** An array of geometries associated with the asset. */
3483
+ geometries: {
3484
+ /** The unique identifier of the geometry. */
3485
+ geometryID: number;
3486
+ /** The transformation matrix of the geometry as a number array. */
3487
+ transformation: number[];
3488
+ /** The color of the geometry as a number array. */
3489
+ color: number[];
3490
+ }[];
3491
+ }
3519
3492
  export type RelationsMap = Map<number, Map<number, number[]>>;
3520
3493
  export interface ModelsRelationMap {
3521
3494
  [modelID: string]: RelationsMap;
@@ -3540,6 +3513,33 @@ export type InverseAttributes = [
3540
3513
  "ContainsElements"
3541
3514
  ];
3542
3515
  export type InverseAttribute = InverseAttributes[number];
3516
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3517
+ /**
3518
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3519
+ */
3520
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3521
+ /**
3522
+ * Minimum number of geometries to be streamed.
3523
+ * Defaults to 10 geometries.
3524
+ */
3525
+ minGeometrySize: number;
3526
+ /**
3527
+ * Minimum amount of assets to be streamed.
3528
+ * Defaults to 1000 assets.
3529
+ */
3530
+ minAssetsSize: number;
3531
+ }
3532
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3533
+ /**
3534
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3535
+ */
3536
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3537
+ /**
3538
+ * Amount of properties to be streamed.
3539
+ * Defaults to 100 properties.
3540
+ */
3541
+ propertiesSize: number;
3542
+ }
3543
3543
  import { BufferGeometry } from "three";
3544
3544
  import * as THREE from "three";
3545
3545
  export declare class TransformHelper {