@thatopen/components 2.0.23 → 2.0.24

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,175 +1,157 @@
1
1
  declare namespace OBC {
2
2
  import * as THREE from "three";
3
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
4
- import { SimplePlane } from "./src";
5
3
  import { Components } from "../Components";
4
+ import { Component } from "../Types";
6
5
  /**
7
- * 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).
8
- *
9
- * @param components - the instance of {@link Components} used.
10
- * E.g. {@link SimplePlane}.
6
+ * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
11
7
  */
12
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
8
+ export declare class Disposer extends Component {
9
+ private _disposedComponents;
10
+ /** {@link Component.enabled} */
11
+ enabled: boolean;
13
12
  /**
14
13
  * A unique identifier for the component.
15
14
  * This UUID is used to register the component within the Components system.
16
15
  */
17
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
18
- /** Event that fires when the user starts dragging a clipping plane. */
19
- readonly onBeforeDrag: Event<void>;
20
- /** Event that fires when the user stops dragging a clipping plane. */
21
- readonly onAfterDrag: Event<void>;
22
- /**
23
- * Event that fires when the user starts creating a clipping plane.
24
- */
25
- readonly onBeforeCreate: Event<unknown>;
26
- /**
27
- * Event that fires when the user cancels the creation of a clipping plane.
28
- */
29
- readonly onBeforeCancel: Event<unknown>;
16
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
17
+ constructor(components: Components);
30
18
  /**
31
- * Event that fires after the user cancels the creation of a clipping plane.
19
+ * Return the UUIDs of all disposed components.
32
20
  */
33
- readonly onAfterCancel: Event<unknown>;
21
+ get(): Set<string>;
34
22
  /**
35
- * Event that fires when the user starts deleting a clipping plane.
23
+ * Removes a mesh, its geometry and its materials from memory. If you are
24
+ * using any of these in other parts of the application, make sure that you
25
+ * remove them from the mesh before disposing it.
26
+ *
27
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
+ * to remove.
29
+ *
30
+ * @param materials - whether to dispose the materials of the mesh.
31
+ *
32
+ * @param recursive - whether to recursively dispose the children of the mesh.
36
33
  */
37
- readonly onBeforeDelete: Event<unknown>;
34
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
38
35
  /**
39
- * Event that fires after a clipping plane has been created.
40
- * @param plane - The newly created clipping plane.
36
+ * Disposes a geometry from memory.
37
+ *
38
+ * @param geometry - the
39
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
+ * to remove.
41
41
  */
42
- readonly onAfterCreate: Event<SimplePlane>;
42
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
43
+ private disposeGeometryAndMaterials;
44
+ private disposeChildren;
45
+ private static disposeMaterial;
46
+ }
47
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
48
+ import { Components } from "../Components";
49
+ import { SimpleWorld } from "./src";
50
+ /**
51
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
52
+ */
53
+ export declare class Worlds extends Component implements Updateable, Disposable {
43
54
  /**
44
- * Event that fires after a clipping plane has been deleted.
45
- * @param plane - The deleted clipping plane.
55
+ * A unique identifier for the component.
56
+ * This UUID is used to register the component within the Components system.
46
57
  */
47
- readonly onAfterDelete: Event<SimplePlane>;
58
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
59
+ /** {@link Updateable.onAfterUpdate} */
60
+ readonly onAfterUpdate: Event<unknown>;
61
+ /** {@link Updateable.onBeforeUpdate} */
62
+ readonly onBeforeUpdate: Event<unknown>;
48
63
  /** {@link Disposable.onDisposed} */
49
- readonly onDisposed: Event<string>;
50
- /**
51
- * Whether to force the clipping plane to be orthogonal in the Y direction
52
- * (up). This is desirable when clipping a building horizontally and a
53
- * clipping plane is created in its roof, which might have a slight
54
- * slope for draining purposes.
55
- */
56
- orthogonalY: boolean;
64
+ readonly onDisposed: Event<unknown>;
57
65
  /**
58
- * The tolerance that determines whether an almost-horizontal clipping plane
59
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
60
- * has to be 'true' for this to apply.
66
+ * An event that is triggered when a new world is created.
67
+ * The event passes the newly created world as a parameter.
61
68
  */
62
- toleranceOrthogonalY: number;
69
+ readonly onWorldCreated: Event<World>;
63
70
  /**
64
- * The type of clipping plane to be created.
65
- * Default is {@link SimplePlane}.
71
+ * An event that is triggered when a world is deleted.
72
+ * The event passes the UUID of the deleted world as a parameter.
66
73
  */
67
- Type: new (...args: any) => SimplePlane;
74
+ readonly onWorldDeleted: Event<string>;
68
75
  /**
69
- * A list of all the clipping planes created by this component.
76
+ * A collection of worlds managed by this component.
77
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
70
78
  */
71
- list: SimplePlane[];
72
- /** The material used in all the clipping planes. */
73
- private _material;
74
- private _size;
75
- private _enabled;
76
- private _visible;
77
- /** {@link Component.enabled} */
78
- get enabled(): boolean;
79
+ list: Map<string, World>;
79
80
  /** {@link Component.enabled} */
80
- set enabled(state: boolean);
81
- /** {@link Hideable.visible } */
82
- get visible(): boolean;
83
- /** {@link Hideable.visible } */
84
- set visible(state: boolean);
85
- /** The material of the clipping plane representation. */
86
- get material(): THREE.MeshBasicMaterial;
87
- /** The material of the clipping plane representation. */
88
- set material(material: THREE.MeshBasicMaterial);
89
- /** The size of the geometric representation of the clippings planes. */
90
- get size(): number;
91
- /** The size of the geometric representation of the clippings planes. */
92
- set size(size: number);
81
+ enabled: boolean;
93
82
  constructor(components: Components);
94
- /** {@link Disposable.dispose} */
95
- dispose(): void;
96
- /** {@link Createable.create} */
97
- create(world: World): void;
98
83
  /**
99
- * Creates a plane in a certain place and with a certain orientation,
100
- * without the need of the mouse.
84
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
101
85
  *
102
- * @param world - the world where this plane should be created.
103
- * @param normal - the orientation of the clipping plane.
104
- * @param point - the position of the clipping plane.
105
- * navigation.
86
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
87
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
88
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
89
+ *
90
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
106
91
  */
107
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
92
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
108
93
  /**
109
- * {@link Createable.delete}
94
+ * Deletes a world from the list of worlds.
110
95
  *
111
- * @param world - the world where the plane to delete is.
112
- * @param plane - the plane to delete. If undefined, the first plane
113
- * found under the cursor will be deleted.
96
+ * @param {World} world - The world to be deleted.
97
+ *
98
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
99
+ *
100
+ * @returns {void}
114
101
  */
115
- delete(world: World, plane?: SimplePlane): void;
116
- /** Deletes all the existing clipping planes. */
117
- deleteAll(): void;
118
- private deletePlane;
119
- private pickPlane;
120
- private getAllPlaneMeshes;
121
- private createPlaneFromIntersection;
122
- private getWorldNormal;
123
- private normalizePlaneDirectionY;
124
- private newPlane;
125
- private updateMaterialsAndPlanes;
126
- private _onStartDragging;
127
- private _onEndDragging;
102
+ delete(world: World): void;
103
+ /**
104
+ * Disposes of the Worlds component and all its managed worlds.
105
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
106
+ * and triggers the onDisposed event.
107
+ *
108
+ * @returns {void}
109
+ */
110
+ dispose(): void;
111
+ /** {@link Updateable.update} */
112
+ update(delta?: number): void | Promise<void>;
128
113
  }
129
- import * as THREE from "three";
114
+ import { Component, Disposable, World, Event } from "../Types";
115
+ import { SimpleRaycaster } from "./src";
130
116
  import { Components } from "../Components";
131
- import { Component } from "../Types";
132
117
  /**
133
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
118
+ * 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).
134
119
  */
135
- export declare class Disposer extends Component {
136
- private _disposedComponents;
137
- /** {@link Component.enabled} */
138
- enabled: boolean;
120
+ export declare class Raycasters extends Component implements Disposable {
139
121
  /**
140
122
  * A unique identifier for the component.
141
123
  * This UUID is used to register the component within the Components system.
142
124
  */
143
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
144
- constructor(components: Components);
125
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
126
+ /** {@link Component.enabled} */
127
+ enabled: boolean;
145
128
  /**
146
- * Return the UUIDs of all disposed components.
129
+ * A Map that stores raycasters for each world.
130
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
147
131
  */
148
- get(): Set<string>;
132
+ list: Map<string, SimpleRaycaster>;
133
+ /** {@link Disposable.onDisposed} */
134
+ onDisposed: Event<unknown>;
135
+ constructor(components: Components);
149
136
  /**
150
- * Removes a mesh, its geometry and its materials from memory. If you are
151
- * using any of these in other parts of the application, make sure that you
152
- * remove them from the mesh before disposing it.
153
- *
154
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
155
- * to remove.
156
- *
157
- * @param materials - whether to dispose the materials of the mesh.
137
+ * Retrieves a SimpleRaycaster instance for the given world.
138
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
139
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
158
140
  *
159
- * @param recursive - whether to recursively dispose the children of the mesh.
141
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
142
+ * @returns The SimpleRaycaster instance for the given world.
160
143
  */
161
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
144
+ get(world: World): SimpleRaycaster;
162
145
  /**
163
- * Disposes a geometry from memory.
146
+ * Deletes the SimpleRaycaster instance associated with the given world.
147
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
164
148
  *
165
- * @param geometry - the
166
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
167
- * to remove.
149
+ * @param world - The world for which to delete the SimpleRaycaster instance.
150
+ * @returns {void}
168
151
  */
169
- disposeGeometry(geometry: THREE.BufferGeometry): void;
170
- private disposeGeometryAndMaterials;
171
- private disposeChildren;
172
- private static disposeMaterial;
152
+ delete(world: World): void;
153
+ /** {@link Disposable.dispose} */
154
+ dispose(): void;
173
155
  }
174
156
  import { Component, Disposable, Event } from "../Types";
175
157
  /**
@@ -179,7 +161,7 @@ export declare class Components implements Disposable {
179
161
  /**
180
162
  * The version of the @thatopen/components library.
181
163
  */
182
- static readonly release = "2.0.23";
164
+ static readonly release = "2.0.24";
183
165
  /** {@link Disposable.onDisposed} */
184
166
  readonly onDisposed: Event<void>;
185
167
  /**
@@ -248,210 +230,165 @@ export declare class Components implements Disposable {
248
230
  private static setupBVH;
249
231
  }
250
232
  import { Component, Disposable, World, Event } from "../Types";
251
- import { SimpleRaycaster } from "./src";
233
+ import { GridConfig, SimpleGrid } from "./src";
252
234
  import { Components } from "../Components";
253
235
  /**
254
- * 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).
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).
255
237
  */
256
- export declare class Raycasters extends Component implements Disposable {
238
+ export declare class Grids extends Component implements Disposable {
257
239
  /**
258
240
  * A unique identifier for the component.
259
241
  * This UUID is used to register the component within the Components system.
260
242
  */
261
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
262
- /** {@link Component.enabled} */
263
- enabled: boolean;
243
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
264
244
  /**
265
- * A Map that stores raycasters for each world.
266
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
245
+ * A map of world UUIDs to their corresponding grid instances.
267
246
  */
268
- list: Map<string, SimpleRaycaster>;
247
+ list: Map<string, SimpleGrid>;
248
+ /**
249
+ * The default configuration for grid creation.
250
+ */
251
+ config: Required<GridConfig>;
269
252
  /** {@link Disposable.onDisposed} */
270
- onDisposed: Event<unknown>;
253
+ readonly onDisposed: Event<unknown>;
254
+ /** {@link Component.enabled} */
255
+ enabled: boolean;
271
256
  constructor(components: Components);
272
257
  /**
273
- * Retrieves a SimpleRaycaster instance for the given world.
274
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
275
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
258
+ * Creates a new grid for the given world.
259
+ * Throws an error if a grid already exists for the world.
276
260
  *
277
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
278
- * @returns The SimpleRaycaster instance for the given world.
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.
279
265
  */
280
- get(world: World): SimpleRaycaster;
266
+ create(world: World): SimpleGrid;
281
267
  /**
282
- * Deletes the SimpleRaycaster instance associated with the given world.
283
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
268
+ * Deletes the grid associated with the given world.
269
+ * If a grid does not exist for the given world, this method does nothing.
284
270
  *
285
- * @param world - The world for which to delete the SimpleRaycaster instance.
286
- * @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.
287
276
  */
288
277
  delete(world: World): void;
289
278
  /** {@link Disposable.dispose} */
290
279
  dispose(): void;
291
280
  }
281
+ import * as THREE from "three";
292
282
  import { Components } from "../Components";
293
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
294
- import { Component, Event, Disposable, World } from "../Types";
283
+ import { SimpleCamera } from "..";
284
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
295
285
  /**
296
- * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
286
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
297
287
  */
298
- export declare class Cullers extends Component implements Disposable {
299
- /**
300
- * A unique identifier for the component.
301
- * This UUID is used to register the component within the Components system.
302
- */
303
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
288
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
304
289
  /**
305
- * An event that is triggered when the Cullers component is disposed.
290
+ * A ProjectionManager instance that manages the projection modes of the camera.
306
291
  */
307
- readonly onDisposed: Event<unknown>;
308
- private _enabled;
292
+ readonly projection: ProjectionManager;
309
293
  /**
310
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
294
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
295
+ * This camera is used when the projection mode is set to orthographic.
311
296
  */
312
- list: Map<string, MeshCullerRenderer>;
313
- /** {@link Component.enabled} */
314
- get enabled(): boolean;
315
- /** {@link Component.enabled} */
316
- set enabled(value: boolean);
317
- constructor(components: Components);
297
+ readonly threeOrtho: THREE.OrthographicCamera;
318
298
  /**
319
- * Creates a new MeshCullerRenderer for the given world.
320
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
321
- *
322
- * @param world - The world for which to create the MeshCullerRenderer.
323
- * @param config - Optional configuration settings for the MeshCullerRenderer.
324
- *
325
- * @returns The newly created or existing MeshCullerRenderer for the given world.
299
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
300
+ * This camera is used when the projection mode is set to perspective.
326
301
  */
327
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
302
+ readonly threePersp: THREE.PerspectiveCamera;
303
+ protected readonly _userInputButtons: any;
304
+ protected readonly _frustumSize = 50;
305
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
306
+ protected _mode: NavigationMode | null;
307
+ private previousSize;
328
308
  /**
329
- * Deletes the MeshCullerRenderer associated with the given world.
330
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
309
+ * Getter for the current navigation mode.
310
+ * Throws an error if the mode is not found or the camera is not initialized.
331
311
  *
332
- * @param world - The world for which to delete the MeshCullerRenderer.
312
+ * @returns {NavigationMode} The current navigation mode.
333
313
  *
334
- * @returns {void}
314
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
335
315
  */
336
- delete(world: World): void;
316
+ get mode(): NavigationMode;
317
+ constructor(components: Components);
337
318
  /** {@link Disposable.dispose} */
338
319
  dispose(): void;
339
- }
340
- import { Component, Disposable, World, Event } from "../Types";
341
- import { GridConfig, SimpleGrid } from "./src";
342
- import { Components } from "../Components";
343
- /**
344
- * 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).
345
- */
346
- export declare class Grids extends Component implements Disposable {
347
- /**
348
- * A unique identifier for the component.
349
- * This UUID is used to register the component within the Components system.
350
- */
351
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
352
- /**
353
- * A map of world UUIDs to their corresponding grid instances.
354
- */
355
- list: Map<string, SimpleGrid>;
356
320
  /**
357
- * The default configuration for grid creation.
321
+ * Sets a new {@link NavigationMode} and disables the previous one.
322
+ *
323
+ * @param mode - The {@link NavigationMode} to set.
358
324
  */
359
- config: Required<GridConfig>;
360
- /** {@link Disposable.onDisposed} */
361
- readonly onDisposed: Event<unknown>;
362
- /** {@link Component.enabled} */
363
- enabled: boolean;
364
- constructor(components: Components);
325
+ set(mode: NavModeID): void;
365
326
  /**
366
- * Creates a new grid for the given world.
367
- * Throws an error if a grid already exists for the world.
368
- *
369
- * @param world - The world to create the grid for.
370
- * @returns The newly created grid.
327
+ * Make the camera view fit all the specified meshes.
371
328
  *
372
- * @throws Will throw an error if a grid already exists for the given world.
329
+ * @param meshes the meshes to fit. If it is not defined, it will
330
+ * evaluate {@link Components.meshes}.
331
+ * @param offset the distance to the fit object
373
332
  */
374
- create(world: World): SimpleGrid;
333
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
375
334
  /**
376
- * Deletes the grid associated with the given world.
377
- * If a grid does not exist for the given world, this method does nothing.
378
- *
379
- * @param world - The world for which to delete the grid.
335
+ * Allows or prevents all user input.
380
336
  *
381
- * @remarks
382
- * This method will dispose of the grid and remove it from the internal list.
383
- * If the world is disposed before calling this method, the grid will be automatically deleted.
337
+ * @param active - whether to enable or disable user inputs.
384
338
  */
385
- delete(world: World): void;
386
- /** {@link Disposable.dispose} */
387
- dispose(): void;
339
+ setUserInput(active: boolean): void;
340
+ private disableUserInput;
341
+ private enableUserInput;
342
+ private newOrthoCamera;
343
+ private setOrthoPerspCameraAspect;
388
344
  }
389
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
390
345
  import { Components } from "../Components";
391
- import { SimpleWorld } from "./src";
346
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
347
+ import { Component, Event, Disposable, World } from "../Types";
392
348
  /**
393
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
349
+ * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
394
350
  */
395
- export declare class Worlds extends Component implements Updateable, Disposable {
351
+ export declare class Cullers extends Component implements Disposable {
396
352
  /**
397
353
  * A unique identifier for the component.
398
354
  * This UUID is used to register the component within the Components system.
399
355
  */
400
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
401
- /** {@link Updateable.onAfterUpdate} */
402
- readonly onAfterUpdate: Event<unknown>;
403
- /** {@link Updateable.onBeforeUpdate} */
404
- readonly onBeforeUpdate: Event<unknown>;
405
- /** {@link Disposable.onDisposed} */
406
- readonly onDisposed: Event<unknown>;
407
- /**
408
- * An event that is triggered when a new world is created.
409
- * The event passes the newly created world as a parameter.
410
- */
411
- readonly onWorldCreated: Event<World>;
356
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
412
357
  /**
413
- * An event that is triggered when a world is deleted.
414
- * The event passes the UUID of the deleted world as a parameter.
358
+ * An event that is triggered when the Cullers component is disposed.
415
359
  */
416
- readonly onWorldDeleted: Event<string>;
360
+ readonly onDisposed: Event<unknown>;
361
+ private _enabled;
417
362
  /**
418
- * A collection of worlds managed by this component.
419
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
363
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
420
364
  */
421
- list: Map<string, World>;
365
+ list: Map<string, MeshCullerRenderer>;
422
366
  /** {@link Component.enabled} */
423
- enabled: boolean;
367
+ get enabled(): boolean;
368
+ /** {@link Component.enabled} */
369
+ set enabled(value: boolean);
424
370
  constructor(components: Components);
425
371
  /**
426
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
372
+ * Creates a new MeshCullerRenderer for the given world.
373
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
427
374
  *
428
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
429
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
430
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
375
+ * @param world - The world for which to create the MeshCullerRenderer.
376
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
431
377
  *
432
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
378
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
433
379
  */
434
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
380
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
435
381
  /**
436
- * Deletes a world from the list of worlds.
437
- *
438
- * @param {World} world - The world to be deleted.
382
+ * Deletes the MeshCullerRenderer associated with the given world.
383
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
439
384
  *
440
- * @throws {Error} - Throws an error if the provided world is not found in the list.
385
+ * @param world - The world for which to delete the MeshCullerRenderer.
441
386
  *
442
387
  * @returns {void}
443
388
  */
444
389
  delete(world: World): void;
445
- /**
446
- * Disposes of the Worlds component and all its managed worlds.
447
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
448
- * and triggers the onDisposed event.
449
- *
450
- * @returns {void}
451
- */
390
+ /** {@link Disposable.dispose} */
452
391
  dispose(): void;
453
- /** {@link Updateable.update} */
454
- update(delta?: number): void | Promise<void>;
455
392
  }
456
393
  import { MiniMap } from "./src";
457
394
  import { Component, Updateable, World, Event, Disposable } from "../Types";
@@ -501,144 +438,135 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
501
438
  update(): void;
502
439
  }
503
440
  import * as THREE from "three";
441
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
442
+ import { SimplePlane } from "./src";
504
443
  import { Components } from "../Components";
505
- import { SimpleCamera } from "..";
506
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
507
444
  /**
508
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
445
+ * 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).
446
+ *
447
+ * @param components - the instance of {@link Components} used.
448
+ * E.g. {@link SimplePlane}.
509
449
  */
510
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
450
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
511
451
  /**
512
- * A ProjectionManager instance that manages the projection modes of the camera.
452
+ * A unique identifier for the component.
453
+ * This UUID is used to register the component within the Components system.
513
454
  */
514
- readonly projection: ProjectionManager;
455
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
456
+ /** Event that fires when the user starts dragging a clipping plane. */
457
+ readonly onBeforeDrag: Event<void>;
458
+ /** Event that fires when the user stops dragging a clipping plane. */
459
+ readonly onAfterDrag: Event<void>;
515
460
  /**
516
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
517
- * This camera is used when the projection mode is set to orthographic.
461
+ * Event that fires when the user starts creating a clipping plane.
518
462
  */
519
- readonly threeOrtho: THREE.OrthographicCamera;
463
+ readonly onBeforeCreate: Event<unknown>;
520
464
  /**
521
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
522
- * This camera is used when the projection mode is set to perspective.
465
+ * Event that fires when the user cancels the creation of a clipping plane.
523
466
  */
524
- readonly threePersp: THREE.PerspectiveCamera;
525
- protected readonly _userInputButtons: any;
526
- protected readonly _frustumSize = 50;
527
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
528
- protected _mode: NavigationMode | null;
529
- private previousSize;
467
+ readonly onBeforeCancel: Event<unknown>;
530
468
  /**
531
- * Getter for the current navigation mode.
532
- * Throws an error if the mode is not found or the camera is not initialized.
533
- *
534
- * @returns {NavigationMode} The current navigation mode.
535
- *
536
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
469
+ * Event that fires after the user cancels the creation of a clipping plane.
537
470
  */
538
- get mode(): NavigationMode;
539
- constructor(components: Components);
540
- /** {@link Disposable.dispose} */
541
- dispose(): void;
471
+ readonly onAfterCancel: Event<unknown>;
542
472
  /**
543
- * Sets a new {@link NavigationMode} and disables the previous one.
544
- *
545
- * @param mode - The {@link NavigationMode} to set.
473
+ * Event that fires when the user starts deleting a clipping plane.
546
474
  */
547
- set(mode: NavModeID): void;
475
+ readonly onBeforeDelete: Event<unknown>;
548
476
  /**
549
- * Make the camera view fit all the specified meshes.
550
- *
551
- * @param meshes the meshes to fit. If it is not defined, it will
552
- * evaluate {@link Components.meshes}.
553
- * @param offset the distance to the fit object
554
- */
555
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
556
- /**
557
- * Allows or prevents all user input.
558
- *
559
- * @param active - whether to enable or disable user inputs.
477
+ * Event that fires after a clipping plane has been created.
478
+ * @param plane - The newly created clipping plane.
560
479
  */
561
- setUserInput(active: boolean): void;
562
- private disableUserInput;
563
- private enableUserInput;
564
- private newOrthoCamera;
565
- private setOrthoPerspCameraAspect;
566
- }
567
- import * as THREE from "three";
568
- import { Component, Components } from "../../core";
569
- /**
570
- * Represents an edge measurement result.
571
- */
572
- export interface MeasureEdge {
480
+ readonly onAfterCreate: Event<SimplePlane>;
573
481
  /**
574
- * The distance between the two points of the edge.
482
+ * Event that fires after a clipping plane has been deleted.
483
+ * @param plane - The deleted clipping plane.
575
484
  */
576
- distance: number;
485
+ readonly onAfterDelete: Event<SimplePlane>;
486
+ /** {@link Disposable.onDisposed} */
487
+ readonly onDisposed: Event<string>;
577
488
  /**
578
- * The two points that define the edge.
489
+ * Whether to force the clipping plane to be orthogonal in the Y direction
490
+ * (up). This is desirable when clipping a building horizontally and a
491
+ * clipping plane is created in its roof, which might have a slight
492
+ * slope for draining purposes.
579
493
  */
580
- points: THREE.Vector3[];
581
- }
582
- /**
583
- * 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).
584
- */
585
- export declare class MeasurementUtils extends Component {
494
+ orthogonalY: boolean;
586
495
  /**
587
- * A unique identifier for the component.
588
- * This UUID is used to register the component within the Components system.
496
+ * The tolerance that determines whether an almost-horizontal clipping plane
497
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
498
+ * has to be 'true' for this to apply.
589
499
  */
590
- static uuid: string;
591
- /** {@link Component.enabled} */
592
- enabled: boolean;
593
- constructor(components: Components);
500
+ toleranceOrthogonalY: number;
594
501
  /**
595
- * Utility method to calculate the distance from a point to a line segment.
596
- *
597
- * @param point - The point from which to calculate the distance.
598
- * @param lineStart - The start point of the line segment.
599
- * @param lineEnd - The end point of the line segment.
600
- * @param clamp - If true, the distance will be clamped to the line segment's length.
601
- * @returns The distance from the point to the line segment.
502
+ * The type of clipping plane to be created.
503
+ * Default is {@link SimplePlane}.
602
504
  */
603
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
505
+ Type: new (...args: any) => SimplePlane;
604
506
  /**
605
- * Method to get the face of a mesh that contains a given triangle index.
606
- * It also returns the edges of the found face and their indices.
607
- *
608
- * @param mesh - The mesh to get the face from. It must be indexed.
609
- * @param triangleIndex - The index of the triangle within the mesh.
610
- * @param instance - The instance of the mesh (optional).
611
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
507
+ * A list of all the clipping planes created by this component.
612
508
  */
613
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
614
- edges: MeasureEdge[];
615
- indices: Set<number>;
616
- } | null;
509
+ list: SimplePlane[];
510
+ /** The material used in all the clipping planes. */
511
+ private _material;
512
+ private _size;
513
+ private _enabled;
514
+ private _visible;
515
+ /** {@link Component.enabled} */
516
+ get enabled(): boolean;
517
+ /** {@link Component.enabled} */
518
+ set enabled(state: boolean);
519
+ /** {@link Hideable.visible } */
520
+ get visible(): boolean;
521
+ /** {@link Hideable.visible } */
522
+ set visible(state: boolean);
523
+ /** The material of the clipping plane representation. */
524
+ get material(): THREE.MeshBasicMaterial;
525
+ /** The material of the clipping plane representation. */
526
+ set material(material: THREE.MeshBasicMaterial);
527
+ /** The size of the geometric representation of the clippings planes. */
528
+ get size(): number;
529
+ /** The size of the geometric representation of the clippings planes. */
530
+ set size(size: number);
531
+ constructor(components: Components);
532
+ /** {@link Disposable.dispose} */
533
+ dispose(): void;
534
+ /** {@link Createable.create} */
535
+ create(world: World): void;
617
536
  /**
618
- * Method to get the vertices and normal of a mesh face at a given index.
619
- * It also applies instance transformation if provided.
537
+ * Creates a plane in a certain place and with a certain orientation,
538
+ * without the need of the mouse.
620
539
  *
621
- * @param mesh - The mesh to get the face from. It must be indexed.
622
- * @param faceIndex - The index of the face within the mesh.
623
- * @param instance - The instance of the mesh (optional).
624
- * @returns An object containing the vertices and normal of the face.
625
- * @throws Will throw an error if the geometry is not indexed.
540
+ * @param world - the world where this plane should be created.
541
+ * @param normal - the orientation of the clipping plane.
542
+ * @param point - the position of the clipping plane.
543
+ * navigation.
626
544
  */
627
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
628
- p1: THREE.Vector3;
629
- p2: THREE.Vector3;
630
- p3: THREE.Vector3;
631
- faceNormal: THREE.Vector3;
632
- };
545
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
633
546
  /**
634
- * Method to round the vector's components to a specified number of decimal places.
635
- * This is used to ensure numerical precision in edge detection.
547
+ * {@link Createable.delete}
636
548
  *
637
- * @param vector - The vector to round.
638
- * @returns The vector with rounded components.
549
+ * @param world - the world where the plane to delete is.
550
+ * @param plane - the plane to delete. If undefined, the first plane
551
+ * found under the cursor will be deleted.
639
552
  */
640
- round(vector: THREE.Vector3): void;
641
- private getFaceData;
553
+ delete(world: World, plane?: SimplePlane): void;
554
+ /** Deletes all the existing clipping planes. */
555
+ deleteAll(): void;
556
+ private deletePlane;
557
+ private pickPlane;
558
+ private getAllPlaneMeshes;
559
+ private createPlaneFromIntersection;
560
+ private getWorldNormal;
561
+ private normalizePlaneDirectionY;
562
+ private newPlane;
563
+ private updateMaterialsAndPlanes;
564
+ private _onStartDragging;
565
+ private _onEndDragging;
566
+ }
567
+ import * as THREE from "three";
568
+ export declare class MaterialsUtils {
569
+ static isTransparent(material: THREE.Material): boolean;
642
570
  }
643
571
  import * as THREE from "three";
644
572
  export declare function obbFromPoints(vertices: ArrayLike<number>): {
@@ -648,10 +576,6 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
648
576
  transformation: THREE.Matrix4;
649
577
  };
650
578
  export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
651
- import * as THREE from "three";
652
- export declare class MaterialsUtils {
653
- static isTransparent(material: THREE.Material): boolean;
654
- }
655
579
  export declare class UUID {
656
580
  private static _pattern;
657
581
  private static _lut;
@@ -770,1313 +694,1473 @@ export declare class VertexPicker extends Component implements Disposable {
770
694
  private getVertices;
771
695
  private getVertex;
772
696
  }
773
- import * as THREE from "three";
774
- import * as FRAGS from "@thatopen/fragments";
775
- import { Disposable, Component, Event, Components } from "../../core";
697
+ import * as WEBIFC from "web-ifc";
698
+ import { FragmentsGroup } from "@thatopen/fragments";
699
+ import { Component, Disposable, Event, Components } from "../../core";
776
700
  /**
777
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
701
+ * Types for boolean properties in IFC schema.
778
702
  */
779
- export interface Classification {
780
- /**
781
- * A system within the classification.
782
- * The key is the system name, and the value is an object representing the classes within the system.
783
- */
784
- [system: string]: {
785
- /**
786
- * A class within the system.
787
- * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
788
- */
789
- [className: string]: FRAGS.FragmentIdMap;
703
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
704
+ /**
705
+ * Types for string properties in IFC schema.
706
+ */
707
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
708
+ /**
709
+ * Types for numeric properties in IFC schema.
710
+ */
711
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
712
+ /**
713
+ * 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.
714
+ */
715
+ export interface ChangeMap {
716
+ [modelID: string]: Set<number>;
717
+ }
718
+ /**
719
+ * 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.
720
+ */
721
+ export interface AttributeListener {
722
+ [modelID: string]: {
723
+ [expressID: number]: {
724
+ [attributeName: string]: Event<String | Boolean | Number>;
725
+ };
790
726
  };
791
727
  }
792
728
  /**
793
- * 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).
729
+ * Component to manage and edit properties and Psets in IFC files.
794
730
  */
795
- export declare class Classifier extends Component implements Disposable {
731
+ export declare class IfcPropertiesManager extends Component implements Disposable {
796
732
  /**
797
733
  * A unique identifier for the component.
798
734
  * This UUID is used to register the component within the Components system.
799
735
  */
800
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
801
- /** {@link Component.enabled} */
802
- enabled: boolean;
803
- /**
804
- * A map representing the classification systems.
805
- * The key is the system name, and the value is an object representing the classes within the system.
806
- */
807
- list: Classification;
736
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
808
737
  /** {@link Disposable.onDisposed} */
809
- readonly onDisposed: Event<unknown>;
810
- constructor(components: Components);
811
- private onFragmentsDisposed;
812
- /** {@link Disposable.dispose} */
813
- dispose(): void;
738
+ readonly onDisposed: Event<string>;
814
739
  /**
815
- * Removes a fragment from the classification based on its unique identifier (guid).
816
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
817
- *
818
- * @param guid - The unique identifier of the fragment to be removed.
740
+ * Event triggered when a file is requested for export.
819
741
  */
820
- remove(guid: string): void;
742
+ readonly onRequestFile: Event<unknown>;
821
743
  /**
822
- * Finds and returns fragments based on the provided filter criteria.
823
- * If no filter is provided, it returns all fragments.
824
- *
825
- * @param filter - An optional object containing filter criteria.
826
- * The keys of the object represent the classification system names,
827
- * and the values are arrays of class names to match.
828
- *
829
- * @returns A map of fragment GUIDs to their respective express IDs,
830
- * where the express IDs are filtered based on the provided filter criteria.
831
- *
832
- * @throws Will throw an error if the fragments map is malformed.
744
+ * ArrayBuffer containing the IFC data to be exported.
833
745
  */
834
- find(filter?: {
835
- [name: string]: string[];
836
- }): FRAGS.FragmentIdMap;
746
+ ifcToExport: ArrayBuffer | null;
837
747
  /**
838
- * Classifies fragments based on their modelID.
839
- *
840
- * @param modelID - The unique identifier of the model to classify fragments by.
841
- * @param group - The FragmentsGroup containing the fragments to be classified.
842
- *
843
- * @remarks
844
- * This method iterates through the fragments in the provided group,
845
- * and classifies them based on their modelID.
846
- * The classification is stored in the 'list.models' property,
847
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
848
- *
748
+ * Event triggered when an element is added to a Pset.
849
749
  */
850
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
750
+ readonly onElementToPset: Event<{
751
+ model: FragmentsGroup;
752
+ psetID: number;
753
+ elementID: number;
754
+ }>;
851
755
  /**
852
- * Classifies fragments based on their PredefinedType property.
853
- *
854
- * @param group - The FragmentsGroup containing the fragments to be classified.
855
- *
856
- * @remarks
857
- * This method iterates through the properties of the fragments in the provided group,
858
- * and classifies them based on their PredefinedType property.
859
- * The classification is stored in the 'list.predefinedTypes' property,
860
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
756
+ * Event triggered when a property is added to a Pset.
757
+ */
758
+ readonly onPropToPset: Event<{
759
+ model: FragmentsGroup;
760
+ psetID: number;
761
+ propID: number;
762
+ }>;
763
+ /**
764
+ * Event triggered when a Pset is removed.
765
+ */
766
+ readonly onPsetRemoved: Event<{
767
+ model: FragmentsGroup;
768
+ psetID: number;
769
+ }>;
770
+ /**
771
+ * Event triggered when data in the model changes.
772
+ */
773
+ readonly onDataChanged: Event<{
774
+ model: FragmentsGroup;
775
+ expressID: number;
776
+ }>;
777
+ /**
778
+ * Configuration for the WebAssembly module.
779
+ */
780
+ wasm: {
781
+ path: string;
782
+ absolute: boolean;
783
+ };
784
+ /** {@link Component.enabled} */
785
+ enabled: boolean;
786
+ /**
787
+ * Map of attribute listeners.
788
+ */
789
+ attributeListeners: AttributeListener;
790
+ /**
791
+ * The currently selected model.
792
+ */
793
+ selectedModel?: FragmentsGroup;
794
+ /**
795
+ * Map of changed entities in the model.
796
+ */
797
+ changeMap: ChangeMap;
798
+ constructor(components: Components);
799
+ /** {@link Disposable.dispose} */
800
+ dispose(): void;
801
+ /**
802
+ * Static method to retrieve the IFC schema from a given model.
861
803
  *
862
- * @throws Will throw an error if the fragment ID is not found.
804
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
805
+ * @throws Will throw an error if the IFC schema is not found in the model.
806
+ * @returns The IFC schema associated with the given model.
863
807
  */
864
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
808
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
865
809
  /**
866
- * Classifies fragments based on their entity type.
810
+ * Method to set properties data in the model.
867
811
  *
868
- * @param group - The FragmentsGroup containing the fragments to be classified.
812
+ * @param model - The FragmentsGroup model in which to set the properties.
813
+ * @param dataToSave - An array of objects representing the properties to be saved.
814
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
815
+ * The rest of the properties will be set as the properties of the entity.
869
816
  *
870
- * @remarks
871
- * This method iterates through the relations of the fragments in the provided group,
872
- * and classifies them based on their entity type.
873
- * The classification is stored in the 'list.entities' property,
874
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
817
+ * @returns {Promise<void>} A promise that resolves when all the properties have been set.
875
818
  *
876
- * @throws Will throw an error if the fragment ID is not found.
819
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
877
820
  */
878
- byEntity(group: FRAGS.FragmentsGroup): void;
821
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
879
822
  /**
880
- * Classifies fragments based on a specific IFC relationship.
823
+ * Creates a new Property Set (Pset) in the given model.
881
824
  *
882
- * @param group - The FragmentsGroup containing the fragments to be classified.
883
- * @param ifcRel - The IFC relationship number to classify fragments by.
884
- * @param systemName - The name of the classification system to store the classification.
825
+ * @param model - The FragmentsGroup model in which to create the Pset.
826
+ * @param name - The name of the Pset.
827
+ * @param description - (Optional) The description of the Pset.
885
828
  *
886
- * @remarks
887
- * This method iterates through the relations of the fragments in the provided group,
888
- * and classifies them based on the specified IFC relationship.
889
- * The classification is stored in the 'list' property under the specified system name,
890
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
829
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
891
830
  *
892
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
831
+ * @throws Will throw an error if the IFC schema is not found in the model.
832
+ * @throws Will throw an error if no OwnerHistory is found in the model.
893
833
  */
894
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
834
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
835
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
836
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
837
+ }>;
895
838
  /**
896
- * Classifies fragments based on their spatial structure in the IFC model.
839
+ * Removes a Property Set (Pset) from the given model.
897
840
  *
898
- * @param model - The FragmentsGroup containing the fragments to be classified.
841
+ * @param model - The FragmentsGroup model from which to remove the Pset.
842
+ * @param psetID - The express IDs of the Psets to be removed.
899
843
  *
900
- * @remarks
901
- * This method iterates through the relations of the fragments in the provided group,
902
- * and classifies them based on their spatial structure in the IFC model.
903
- * The classification is stored in the 'list' property under the system name "spatialStructures",
904
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
844
+ * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
905
845
  *
906
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
846
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
847
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
848
+ * @throws Will throw an error if no relation is found between the Pset and the model.
907
849
  */
908
- bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
850
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
909
851
  /**
910
- * Sets the color of the specified fragments.
852
+ * Creates a new single-value property of type string in the given model.
911
853
  *
912
- * @param items - A map of fragment IDs to their respective express IDs.
913
- * @param color - The color to set for the fragments.
914
- * @param override - A boolean indicating whether to override the existing color of the fragments.
854
+ * @param model - The FragmentsGroup model in which to create the property.
855
+ * @param type - The type of the property value. Must be a string property type.
856
+ * @param name - The name of the property.
857
+ * @param value - The value of the property. Must be a string.
915
858
  *
916
- * @remarks
917
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
918
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
859
+ * @returns The newly created single-value property.
919
860
  *
920
- * @throws Will throw an error if the fragment with the specified ID is not found.
861
+ * @throws Will throw an error if the IFC schema is not found in the model.
862
+ * @throws Will throw an error if no OwnerHistory is found in the model.
921
863
  */
922
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
864
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
923
865
  /**
924
- * Resets the color of the specified fragments to their original color.
866
+ * Creates a new single-value property of type numeric in the given model.
925
867
  *
926
- * @param items - A map of fragment IDs to their respective express IDs.
868
+ * @param model - The FragmentsGroup model in which to create the property.
869
+ * @param type - The type of the property value. Must be a numeric property type.
870
+ * @param name - The name of the property.
871
+ * @param value - The value of the property. Must be a number.
927
872
  *
928
- * @remarks
929
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
930
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
873
+ * @returns The newly created single-value property.
931
874
  *
932
- * @throws Will throw an error if the fragment with the specified ID is not found.
875
+ * @throws Will throw an error if the IFC schema is not found in the model.
876
+ * @throws Will throw an error if no OwnerHistory is found in the model.
933
877
  */
934
- resetColor(items: FRAGS.FragmentIdMap): void;
935
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
936
- }
937
- import * as THREE from "three";
938
- import * as FRAGS from "@thatopen/fragments";
939
- import { FragmentsGroup } from "@thatopen/fragments";
940
- import { Component, Components, Disposable, Event } from "../../core";
941
- /**
942
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
943
- */
944
- export declare class BoundingBoxer extends Component implements Disposable {
945
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
946
- /** {@link Component.enabled} */
947
- enabled: boolean;
948
- /** {@link Disposable.onDisposed} */
949
- readonly onDisposed: Event<unknown>;
950
- private _absoluteMin;
951
- private _absoluteMax;
952
- private _meshes;
953
- constructor(components: Components);
878
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
954
879
  /**
955
- * A static method to calculate the dimensions of a given bounding box.
880
+ * Creates a new single-value property of type boolean in the given model.
956
881
  *
957
- * @param bbox - The bounding box to calculate the dimensions for.
958
- * @returns An object containing the width, height, depth, and center of the bounding box.
882
+ * @param model - The FragmentsGroup model in which to create the property.
883
+ * @param type - The type of the property value. Must be a boolean property type.
884
+ * @param name - The name of the property.
885
+ * @param value - The value of the property. Must be a boolean.
886
+ *
887
+ * @returns The newly created single-value property.
888
+ *
889
+ * @throws Will throw an error if the IFC schema is not found in the model.
890
+ * @throws Will throw an error if no OwnerHistory is found in the model.
959
891
  */
960
- static getDimensions(bbox: THREE.Box3): {
961
- width: number;
962
- height: number;
963
- depth: number;
964
- center: THREE.Vector3;
965
- };
892
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
966
893
  /**
967
- * A static method to create a new bounding box boundary.
968
- *
969
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
970
- * @returns A new THREE.Vector3 representing the boundary.
894
+ * Removes a property from a Property Set (Pset) in the given model.
971
895
  *
972
- * @remarks
973
- * This method is used to create a new boundary for calculating bounding boxes.
974
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
975
- * depending on the value of the 'positive' parameter.
896
+ * @param model - The FragmentsGroup model from which to remove the property.
897
+ * @param psetID - The express ID of the Pset from which to remove the property.
898
+ * @param propID - The express ID of the property to be removed.
976
899
  *
977
- * @example
978
- * '''typescript
979
- * const positiveBound = BoundingBoxer.newBound(true);
980
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
900
+ * @returns {Promise<void>} A promise that resolves when the property has been removed.
981
901
  *
982
- * const negativeBound = BoundingBoxer.newBound(false);
983
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
984
- * '''
902
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
903
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
985
904
  */
986
- static newBound(positive: boolean): THREE.Vector3;
905
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
906
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
987
907
  /**
988
- * A static method to calculate the bounding box of a set of points.
989
- *
990
- * @param points - An array of THREE.Vector3 representing the points.
991
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
992
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
993
- * @returns A THREE.Box3 representing the bounding box of the given points.
908
+ * Adds elements to a Property Set (Pset) in the given model.
994
909
  *
995
- * @remarks
996
- * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
997
- * If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
910
+ * @param model - The FragmentsGroup model in which to add the elements.
911
+ * @param psetID - The express ID of the Pset to which to add the elements.
912
+ * @param elementID - The express IDs of the elements to be added.
998
913
  *
999
- * @example
1000
- * '''typescript
1001
- * const points = [
1002
- * new THREE.Vector3(1, 2, 3),
1003
- * new THREE.Vector3(4, 5, 6),
1004
- * new THREE.Vector3(7, 8, 9),
1005
- * ];
914
+ * @returns {Promise<void>} A promise that resolves when all the elements have been added.
1006
915
  *
1007
- * const bbox = BoundingBoxer.getBounds(points);
1008
- * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
1009
- * '''
916
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
917
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
918
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1010
919
  */
1011
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
1012
- /** {@link Disposable.dispose} */
1013
- dispose(): void;
920
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1014
921
  /**
1015
- * Returns the bounding box of the calculated fragments.
922
+ * Saves the changes made to the model to a new IFC file.
1016
923
  *
1017
- * @returns A new THREE.Box3 instance representing the bounding box.
924
+ * @param model - The FragmentsGroup model from which to save the changes.
925
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1018
926
  *
1019
- * @remarks
1020
- * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
1021
- * The returned box represents the bounding box of the calculated fragments.
927
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1022
928
  *
1023
- * @example
1024
- * '''typescript
1025
- * const boundingBox = boundingBoxer.get();
1026
- * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
1027
- * '''
929
+ * @throws Will throw an error if any issues occur during the saving process.
1028
930
  */
1029
- get(): THREE.Box3;
931
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1030
932
  /**
1031
- * Calculates and returns a sphere that encompasses the entire bounding box.
933
+ * Sets an attribute listener for a specific attribute of an entity in the model.
934
+ * The listener will trigger an event whenever the attribute's value changes.
1032
935
  *
1033
- * @returns A new THREE.Sphere instance representing the calculated sphere.
936
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
937
+ * @param expressID - The express ID of the entity for which to set the listener.
938
+ * @param attributeName - The name of the attribute for which to set the listener.
1034
939
  *
1035
- * @remarks
1036
- * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
1037
- * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
1038
- * The radius is calculated as the distance from the center to the minimum bound.
940
+ * @returns The event that will be triggered when the attribute's value changes.
1039
941
  *
1040
- * @example
1041
- * '''typescript
1042
- * const boundingBoxer = components.get(BoundingBoxer);
1043
- * boundingBoxer.add(fragmentsGroup);
1044
- * const boundingSphere = boundingBoxer.getSphere();
1045
- * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
1046
- * '''
942
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
943
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
944
+ * @throws Will throw an error if the attribute has a badly defined handle.
1047
945
  */
1048
- getSphere(): THREE.Sphere;
946
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
947
+ private increaseMaxID;
948
+ private newGUID;
949
+ private getOwnerHistory;
950
+ private registerChange;
951
+ private newSingleProperty;
952
+ }
953
+ import * as THREE from "three";
954
+ import * as FRAGS from "@thatopen/fragments";
955
+ import { Component, Components } from "../../core";
956
+ /**
957
+ * Represents an edge measurement result.
958
+ */
959
+ export interface MeasureEdge {
1049
960
  /**
1050
- * Returns a THREE.Mesh instance representing the bounding box.
1051
- *
1052
- * @returns A new THREE.Mesh instance representing the bounding box.
961
+ * The distance between the two points of the edge.
962
+ */
963
+ distance: number;
964
+ /**
965
+ * The two points that define the edge.
966
+ */
967
+ points: THREE.Vector3[];
968
+ }
969
+ /**
970
+ * 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).
971
+ */
972
+ export declare class MeasurementUtils extends Component {
973
+ /**
974
+ * A unique identifier for the component.
975
+ * This UUID is used to register the component within the Components system.
976
+ */
977
+ static uuid: string;
978
+ /** {@link Component.enabled} */
979
+ enabled: boolean;
980
+ constructor(components: Components);
981
+ /**
982
+ * Utility method to calculate the distance from a point to a line segment.
1053
983
  *
1054
- * @remarks
1055
- * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
1056
- * It then creates a new THREE.BoxGeometry with the calculated dimensions.
1057
- * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
1058
- * The position of the mesh is set to the center of the bounding box.
984
+ * @param point - The point from which to calculate the distance.
985
+ * @param lineStart - The start point of the line segment.
986
+ * @param lineEnd - The end point of the line segment.
987
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
988
+ * @returns The distance from the point to the line segment.
989
+ */
990
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
991
+ /**
992
+ * Method to get the face of a mesh that contains a given triangle index.
993
+ * It also returns the edges of the found face and their indices.
1059
994
  *
1060
- * @example
1061
- * '''typescript
1062
- * const boundingBoxer = components.get(BoundingBoxer);
1063
- * boundingBoxer.add(fragmentsGroup);
1064
- * const boundingBoxMesh = boundingBoxer.getMesh();
1065
- * scene.add(boundingBoxMesh);
1066
- * '''
995
+ * @param mesh - The mesh to get the face from. It must be indexed.
996
+ * @param triangleIndex - The index of the triangle within the mesh.
997
+ * @param instance - The instance of the mesh (optional).
998
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1067
999
  */
1068
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1000
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1001
+ edges: MeasureEdge[];
1002
+ indices: Set<number>;
1003
+ } | null;
1069
1004
  /**
1070
- * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
1071
- * This method is used to prepare the BoundingBoxer for a new set of fragments.
1005
+ * Method to get the vertices and normal of a mesh face at a given index.
1006
+ * It also applies instance transformation if provided.
1072
1007
  *
1073
- * @remarks
1074
- * This method is called when a new set of fragments is added to the BoundingBoxer.
1075
- * It ensures that the bounding box calculations are accurate and up-to-date.
1008
+ * @param mesh - The mesh to get the face from. It must be indexed.
1009
+ * @param faceIndex - The index of the face within the mesh.
1010
+ * @param instance - The instance of the mesh (optional).
1011
+ * @returns An object containing the vertices and normal of the face.
1012
+ * @throws Will throw an error if the geometry is not indexed.
1013
+ */
1014
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1015
+ p1: THREE.Vector3;
1016
+ p2: THREE.Vector3;
1017
+ p3: THREE.Vector3;
1018
+ faceNormal: THREE.Vector3;
1019
+ };
1020
+ /**
1021
+ * Method to round the vector's components to a specified number of decimal places.
1022
+ * This is used to ensure numerical precision in edge detection.
1076
1023
  *
1077
- * @example
1078
- * '''typescript
1079
- * const boundingBoxer = components.get(BoundingBoxer);
1080
- * boundingBoxer.add(fragmentsGroup);
1081
- * // ...
1082
- * boundingBoxer.reset();
1083
- * '''
1024
+ * @param vector - The vector to round.
1025
+ * @returns The vector with rounded components.
1084
1026
  */
1085
- reset(): void;
1027
+ round(vector: THREE.Vector3): void;
1086
1028
  /**
1087
- * Adds a FragmentsGroup to the BoundingBoxer.
1029
+ * Calculates the volume of a set of fragments.
1088
1030
  *
1089
- * @param group - The FragmentsGroup to add.
1031
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
1032
+ * @returns The total volume of the fragments and the bounding sphere.
1090
1033
  *
1091
1034
  * @remarks
1092
- * This method iterates through each fragment in the provided FragmentsGroup,
1093
- * and calls the 'addMesh' method for each fragment's mesh.
1035
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
1036
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1094
1037
  *
1095
- * @example
1096
- * '''typescript
1097
- * const boundingBoxer = components.get(BoundingBoxer);
1098
- * boundingBoxer.add(fragmentsGroup);
1099
- * '''
1038
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
1039
+ * @throws Will throw an error if the fragment manager is not available.
1100
1040
  */
1101
- add(group: FragmentsGroup): void;
1041
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): {
1042
+ volume: number;
1043
+ sphere: THREE.Sphere;
1044
+ };
1102
1045
  /**
1103
- * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1046
+ * Calculates the total volume of a set of meshes.
1104
1047
  *
1105
- * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1106
- * @param itemIDs - An optional iterable of numbers representing the item IDs.
1048
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
1049
+ * @returns The total volume of the meshes and the bounding sphere.
1107
1050
  *
1108
1051
  * @remarks
1109
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1110
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1111
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1052
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
1053
+ * and its bounding sphere.
1112
1054
  *
1113
- * @example
1114
- * '''typescript
1115
- * const boundingBoxer = components.get(BoundingBoxer);
1116
- * boundingBoxer.addMesh(mesh);
1117
- * '''
1118
1055
  */
1119
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1120
- private static getFragmentBounds;
1056
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): {
1057
+ volume: number;
1058
+ sphere: THREE.Sphere;
1059
+ };
1060
+ private getFaceData;
1061
+ private getVolumeOfMesh;
1062
+ private getSignedVolumeOfTriangle;
1121
1063
  }
1122
- import * as FRAGS from "@thatopen/fragments";
1123
- import { Components, Component } from "../../core";
1064
+ import * as WEBIFC from "web-ifc";
1065
+ import * as FRAG from "@thatopen/fragments";
1066
+ import { Component, Components } from "../../core";
1124
1067
  /**
1125
- * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
1068
+ * 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).
1126
1069
  */
1127
- export declare class Hider extends Component {
1070
+ export declare class IfcJsonExporter extends Component {
1128
1071
  /**
1129
1072
  * A unique identifier for the component.
1130
1073
  * This UUID is used to register the component within the Components system.
1131
1074
  */
1132
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1075
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1133
1076
  /** {@link Component.enabled} */
1134
1077
  enabled: boolean;
1135
1078
  constructor(components: Components);
1136
1079
  /**
1137
- * Sets the visibility of fragments within the 3D scene.
1138
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1139
- * If 'items' is provided, only the specified fragments will be affected.
1140
- *
1141
- * @param visible - The visibility state to set for the fragments.
1142
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1143
- * If not provided, all fragments will be affected.
1144
- *
1145
- * @returns {void}
1146
- */
1147
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1148
- /**
1149
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1150
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1151
- *
1152
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1153
- * If not provided, all fragments will be isolated.
1154
- *
1155
- * @returns {void}
1080
+ * Exports all the properties of an IFC into an array of JS objects.
1081
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1082
+ * @param modelID ID of the IFC model whose properties to extract.
1083
+ * @param indirect whether to get the indirect relationships as well.
1084
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1085
+ * to make the location data available (e.g. absolute position of building).
1156
1086
  */
1157
- isolate(items: FRAGS.FragmentIdMap): void;
1158
- private updateCulledVisibility;
1087
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1159
1088
  }
1160
- import { Component, Disposable, Event, Components } from "../../core";
1089
+ import * as WEBIFC from "web-ifc";
1090
+ import { FragmentsGroup } from "@thatopen/fragments";
1091
+ import { Disposable, Event, Component, Components } from "../../core";
1092
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1093
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1161
1094
  /**
1162
- * 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).
1095
+ * 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).
1163
1096
  */
1164
- export declare class Exploder extends Component implements Disposable {
1097
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1165
1098
  /**
1166
1099
  * A unique identifier for the component.
1167
1100
  * This UUID is used to register the component within the Components system.
1168
1101
  */
1169
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1102
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1170
1103
  /** {@link Disposable.onDisposed} */
1171
- readonly onDisposed: Event<unknown>;
1172
- /** {@link Component.enabled} */
1173
- enabled: boolean;
1174
- /**
1175
- * The height of the explosion animation.
1176
- * This property determines the vertical distance by which fragments are moved during the explosion.
1177
- * Default value is 10.
1178
- */
1179
- height: number;
1104
+ readonly onDisposed: Event<string>;
1180
1105
  /**
1181
- * The group name used for the explosion animation.
1182
- * This property specifies the group of fragments that will be affected by the explosion.
1183
- * Default value is "storeys".
1106
+ * Event triggered when relations for a model have been indexed.
1107
+ * This event provides the model's UUID and the relations map generated for that model.
1108
+ *
1109
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
1110
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1111
+ * 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.
1184
1112
  */
1185
- groupName: string;
1113
+ readonly onRelationsIndexed: Event<{
1114
+ modelID: string;
1115
+ relationsMap: RelationsMap;
1116
+ }>;
1186
1117
  /**
1187
- * A set of strings representing the exploded items.
1188
- * This set is used to keep track of which items have been exploded.
1118
+ * Holds the relationship mappings for each model processed by the indexer.
1119
+ * The structure is a map where each key is a model's UUID, and the value is another map.
1120
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1121
+ * representing a specific relation type, and the value is an array of expressIDs of entities
1122
+ * that are related through that relation type. This structure allows for efficient querying
1123
+ * of entity relationships within a model.
1189
1124
  */
1190
- list: Set<string>;
1125
+ readonly relationMaps: ModelsRelationMap;
1126
+ /** {@link Component.enabled} */
1127
+ enabled: boolean;
1128
+ private _relToAttributesMap;
1129
+ private _inverseAttributes;
1130
+ private _ifcRels;
1191
1131
  constructor(components: Components);
1192
- /** {@link Disposable.dispose} */
1193
- dispose(): void;
1132
+ private onFragmentsDisposed;
1133
+ private indexRelations;
1194
1134
  /**
1195
- * Sets the explosion state of the fragments.
1196
- *
1197
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1135
+ * Adds a relation map to the model's relations map.
1198
1136
  *
1199
- * @remarks
1200
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1201
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1202
- * If 'active' is false, the fragments are moved back to their original position.
1203
- *
1204
- * The method also keeps track of the exploded items using the 'list' set.
1137
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1138
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1205
1139
  *
1206
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1207
- */
1208
- set(active: boolean): void;
1209
- }
1210
- import * as WEBIFC from "web-ifc";
1211
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1212
- import { PropertiesStreamingSettings } from "./src";
1213
- /**
1214
- * 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).
1215
- */
1216
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1217
- /**
1218
- * A unique identifier for the component.
1219
- * This UUID is used to register the component within the Components system.
1140
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1220
1141
  */
1221
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1142
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1222
1143
  /**
1223
- * An event that is triggered when properties are streamed from the IFC file.
1224
- * The event provides the type of the IFC entity and the corresponding data.
1144
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1145
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1146
+ * and maps them in a structured way to facilitate quick access to related entities.
1147
+ *
1148
+ * The process involves querying the model for each relation type associated with the inverse attributes
1149
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1150
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
1151
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1152
+ * of entities that are related through that attribute.
1153
+ *
1154
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1155
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1156
+ * representation of the relations indexed by entity expressIDs and relation types.
1157
+ * @throws An error if the model does not have properties loaded.
1225
1158
  */
1226
- readonly onPropertiesStreamed: AsyncEvent<{
1227
- type: number;
1228
- data: {
1229
- [id: number]: any;
1230
- };
1231
- }>;
1159
+ process(model: FragmentsGroup): Promise<RelationsMap>;
1232
1160
  /**
1233
- * An event that is triggered to indicate the progress of the streaming process.
1234
- * The event provides a number between 0 and 1 representing the progress percentage.
1161
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
1162
+ *
1163
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1164
+ * @param modelID - The unique identifier of the model within the WebIfc API.
1165
+ * @returns A promise that resolves to the relations map for the processed model.
1166
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1235
1167
  */
1236
- readonly onProgress: AsyncEvent<number>;
1168
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1237
1169
  /**
1238
- * An event that is triggered when indices are streamed from the IFC file.
1239
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1170
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
1171
+ * This method searches the indexed relation maps for the specified model and entity,
1172
+ * returning the IDs of related entities if a match is found.
1173
+ *
1174
+ * @param model The 'FragmentsGroup' model containing the entity.
1175
+ * @param expressID The unique identifier of the entity within the model.
1176
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1177
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1178
+ * or the specified relation name is not indexed.
1240
1179
  */
1241
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1242
- /** {@link Disposable.onDisposed} */
1243
- readonly onDisposed: Event<string>;
1244
- /** {@link Component.enabled} */
1245
- enabled: boolean;
1180
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1246
1181
  /**
1247
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1182
+ * Serializes the relations of a given relation map into a JSON string.
1183
+ * 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,
1184
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1185
+ * The resulting object is then serialized into a JSON string.
1186
+ *
1187
+ * @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.
1188
+ * @returns A JSON string representing the serialized relations of the given relation map.
1248
1189
  */
1249
- settings: PropertiesStreamingSettings;
1190
+ serializeRelations(relationMap: RelationsMap): string;
1250
1191
  /**
1251
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1192
+ * Serializes the relations of a specific model into a JSON string.
1193
+ * This method iterates through the relations indexed for the given model,
1194
+ * organizing them into a structured object where each key is an expressID of an entity,
1195
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1196
+ * The resulting object is then serialized into a JSON string.
1197
+ *
1198
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1199
+ * @returns A JSON string representing the serialized relations of the specified model.
1200
+ * If the model has no indexed relations, 'null' is returned.
1252
1201
  */
1253
- webIfc: WEBIFC.IfcAPI;
1254
- /** {@link Disposable.dispose} */
1255
- dispose(): Promise<void>;
1202
+ serializeModelRelations(model: FragmentsGroup): string | null;
1256
1203
  /**
1257
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1204
+ * Serializes all relations of every model processed by the indexer into a JSON string.
1205
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1206
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1207
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
1208
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
1258
1209
  *
1259
- * @param data - The Uint8Array containing the IFC file data.
1260
- * @returns A Promise that resolves when the streaming process is complete.
1210
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1211
+ * If no relations have been indexed, an empty object is returned as a JSON string.
1261
1212
  */
1262
- streamFromBuffer(data: Uint8Array): Promise<void>;
1213
+ serializeAllRelations(): string;
1263
1214
  /**
1264
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1215
+ * Converts a JSON string representing relations between entities into a structured map.
1216
+ * This method parses the JSON string to reconstruct the relations map that indexes
1217
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1218
+ * and the values are maps where each key is a relation type ID and its value is an array
1219
+ * of express IDs of entities related through that relation type.
1265
1220
  *
1266
- * @param loadCallback - A callback function that loads the IFC file data.
1267
- * @returns A Promise that resolves when the streaming process is complete.
1221
+ * @param json The JSON string to be parsed into the relations map.
1222
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1223
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1224
+ * is an array of express IDs (as numbers) of entities related through that relation type.
1268
1225
  */
1269
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1270
- private readIfcFile;
1271
- private streamIfcFile;
1272
- private streamAllProperties;
1273
- private cleanUp;
1226
+ getRelationsMapFromJSON(json: string): RelationsMap;
1227
+ /** {@link Disposable.dispose} */
1228
+ dispose(): void;
1274
1229
  }
1275
- import * as WEBIFC from "web-ifc";
1230
+ import * as THREE from "three";
1276
1231
  import * as FRAGS from "@thatopen/fragments";
1277
- import { IfcFragmentSettings } from "./src";
1278
- import { Component, Components, Event, Disposable } from "../../core";
1232
+ import { FragmentsGroup } from "@thatopen/fragments";
1233
+ import { Component, Components, Disposable, Event } from "../../core";
1279
1234
  /**
1280
- * 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).
1235
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
1281
1236
  */
1282
- export declare class IfcLoader extends Component implements Disposable {
1283
- /**
1284
- * A unique identifier for the component.
1285
- * This UUID is used to register the component within the Components system.
1286
- */
1287
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1288
- /** {@link Disposable.onDisposed} */
1289
- readonly onDisposed: Event<string>;
1290
- /**
1291
- * An event triggered when the IFC file starts loading.
1292
- */
1293
- readonly onIfcStartedLoading: Event<void>;
1294
- /**
1295
- * An event triggered when the setup process is completed.
1296
- */
1297
- readonly onSetup: Event<void>;
1298
- /**
1299
- * The settings for the IfcLoader.
1300
- * It includes options for excluding categories, setting WASM paths, and more.
1301
- */
1302
- settings: IfcFragmentSettings;
1303
- /**
1304
- * The instance of the Web-IFC library used for handling IFC data.
1305
- */
1306
- webIfc: WEBIFC.IfcAPI;
1237
+ export declare class BoundingBoxer extends Component implements Disposable {
1238
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
1307
1239
  /** {@link Component.enabled} */
1308
1240
  enabled: boolean;
1309
- private _material;
1310
- private _spatialTree;
1311
- private _metaData;
1312
- private _fragmentInstances;
1313
- private _civil;
1314
- private _visitedFragments;
1315
- private _materialT;
1241
+ /** {@link Disposable.onDisposed} */
1242
+ readonly onDisposed: Event<unknown>;
1243
+ private _absoluteMin;
1244
+ private _absoluteMax;
1245
+ private _meshes;
1316
1246
  constructor(components: Components);
1317
- /** {@link Disposable.dispose} */
1318
- dispose(): void;
1319
1247
  /**
1320
- * Sets up the IfcLoader component with the provided configuration.
1248
+ * A static method to calculate the dimensions of a given bounding box.
1321
1249
  *
1322
- * @param config - Optional configuration settings for the IfcLoader.
1323
- * If not provided, the existing settings will be used.
1250
+ * @param bbox - The bounding box to calculate the dimensions for.
1251
+ * @returns An object containing the width, height, depth, and center of the bounding box.
1252
+ */
1253
+ static getDimensions(bbox: THREE.Box3): {
1254
+ width: number;
1255
+ height: number;
1256
+ depth: number;
1257
+ center: THREE.Vector3;
1258
+ };
1259
+ /**
1260
+ * A static method to create a new bounding box boundary.
1324
1261
  *
1325
- * @returns A Promise that resolves when the setup process is completed.
1262
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
1263
+ * @returns A new THREE.Vector3 representing the boundary.
1326
1264
  *
1327
1265
  * @remarks
1328
- * If the 'autoSetWasm' option is enabled in the configuration,
1329
- * the method will automatically set the WASM paths for the Web-IFC library.
1266
+ * This method is used to create a new boundary for calculating bounding boxes.
1267
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
1268
+ * depending on the value of the 'positive' parameter.
1330
1269
  *
1331
1270
  * @example
1332
1271
  * '''typescript
1333
- * const ifcLoader = new IfcLoader(components);
1334
- * await ifcLoader.setup({ autoSetWasm: true });
1272
+ * const positiveBound = BoundingBoxer.newBound(true);
1273
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
1274
+ *
1275
+ * const negativeBound = BoundingBoxer.newBound(false);
1276
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
1335
1277
  * '''
1336
1278
  */
1337
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1279
+ static newBound(positive: boolean): THREE.Vector3;
1338
1280
  /**
1339
- * Loads an IFC file and processes it for 3D visualization.
1281
+ * A static method to calculate the bounding box of a set of points.
1340
1282
  *
1341
- * @param data - The Uint8Array containing the IFC file data.
1342
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1283
+ * @param points - An array of THREE.Vector3 representing the points.
1284
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
1285
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
1286
+ * @returns A THREE.Box3 representing the bounding box of the given points.
1343
1287
  *
1344
- * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1288
+ * @remarks
1289
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
1290
+ * If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
1345
1291
  *
1346
1292
  * @example
1347
1293
  * '''typescript
1348
- * const ifcLoader = components.get(IfcLoader);
1349
- * const group = await ifcLoader.load(ifcData);
1294
+ * const points = [
1295
+ * new THREE.Vector3(1, 2, 3),
1296
+ * new THREE.Vector3(4, 5, 6),
1297
+ * new THREE.Vector3(7, 8, 9),
1298
+ * ];
1299
+ *
1300
+ * const bbox = BoundingBoxer.getBounds(points);
1301
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
1350
1302
  * '''
1351
1303
  */
1352
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1304
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
1305
+ /** {@link Disposable.dispose} */
1306
+ dispose(): void;
1353
1307
  /**
1354
- * Reads an IFC file and initializes the Web-IFC library.
1355
- *
1356
- * @param data - The Uint8Array containing the IFC file data.
1308
+ * Returns the bounding box of the calculated fragments.
1357
1309
  *
1358
- * @returns A Promise that resolves when the IFC file is opened and initialized.
1310
+ * @returns A new THREE.Box3 instance representing the bounding box.
1359
1311
  *
1360
1312
  * @remarks
1361
- * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1362
- * It also opens the IFC model using the provided data and settings.
1313
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
1314
+ * The returned box represents the bounding box of the calculated fragments.
1363
1315
  *
1364
1316
  * @example
1365
1317
  * '''typescript
1366
- * const ifcLoader = components.get(IfcLoader);
1367
- * await ifcLoader.readIfcFile(ifcData);
1318
+ * const boundingBox = boundingBoxer.get();
1319
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
1368
1320
  * '''
1369
1321
  */
1370
- readIfcFile(data: Uint8Array): Promise<number>;
1322
+ get(): THREE.Box3;
1371
1323
  /**
1372
- * Cleans up the IfcLoader component by resetting the Web-IFC library,
1373
- * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1324
+ * Calculates and returns a sphere that encompasses the entire bounding box.
1325
+ *
1326
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
1374
1327
  *
1375
1328
  * @remarks
1376
- * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1329
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
1330
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
1331
+ * The radius is calculated as the distance from the center to the minimum bound.
1377
1332
  *
1378
1333
  * @example
1379
1334
  * '''typescript
1380
- * const ifcLoader = components.get(IfcLoader);
1381
- * ifcLoader.cleanUp();
1335
+ * const boundingBoxer = components.get(BoundingBoxer);
1336
+ * boundingBoxer.add(fragmentsGroup);
1337
+ * const boundingSphere = boundingBoxer.getSphere();
1338
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
1382
1339
  * '''
1383
1340
  */
1384
- cleanUp(): void;
1385
- private getAllGeometries;
1386
- private getMesh;
1387
- private getGeometry;
1388
- private autoSetWasm;
1341
+ getSphere(): THREE.Sphere;
1342
+ /**
1343
+ * Returns a THREE.Mesh instance representing the bounding box.
1344
+ *
1345
+ * @returns A new THREE.Mesh instance representing the bounding box.
1346
+ *
1347
+ * @remarks
1348
+ * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
1349
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
1350
+ * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
1351
+ * The position of the mesh is set to the center of the bounding box.
1352
+ *
1353
+ * @example
1354
+ * '''typescript
1355
+ * const boundingBoxer = components.get(BoundingBoxer);
1356
+ * boundingBoxer.add(fragmentsGroup);
1357
+ * const boundingBoxMesh = boundingBoxer.getMesh();
1358
+ * scene.add(boundingBoxMesh);
1359
+ * '''
1360
+ */
1361
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1362
+ /**
1363
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
1364
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
1365
+ *
1366
+ * @remarks
1367
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
1368
+ * It ensures that the bounding box calculations are accurate and up-to-date.
1369
+ *
1370
+ * @example
1371
+ * '''typescript
1372
+ * const boundingBoxer = components.get(BoundingBoxer);
1373
+ * boundingBoxer.add(fragmentsGroup);
1374
+ * // ...
1375
+ * boundingBoxer.reset();
1376
+ * '''
1377
+ */
1378
+ reset(): void;
1379
+ /**
1380
+ * Adds a FragmentsGroup to the BoundingBoxer.
1381
+ *
1382
+ * @param group - The FragmentsGroup to add.
1383
+ *
1384
+ * @remarks
1385
+ * This method iterates through each fragment in the provided FragmentsGroup,
1386
+ * and calls the 'addMesh' method for each fragment's mesh.
1387
+ *
1388
+ * @example
1389
+ * '''typescript
1390
+ * const boundingBoxer = components.get(BoundingBoxer);
1391
+ * boundingBoxer.add(fragmentsGroup);
1392
+ * '''
1393
+ */
1394
+ add(group: FragmentsGroup): void;
1395
+ /**
1396
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1397
+ *
1398
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1399
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
1400
+ *
1401
+ * @remarks
1402
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1403
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1404
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1405
+ *
1406
+ * @example
1407
+ * '''typescript
1408
+ * const boundingBoxer = components.get(BoundingBoxer);
1409
+ * boundingBoxer.addMesh(mesh);
1410
+ * '''
1411
+ */
1412
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1413
+ private static getFragmentBounds;
1389
1414
  }
1390
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1391
- import * as THREE from "three";
1392
1415
  import * as FRAGS from "@thatopen/fragments";
1393
- import { Component, Components, Event, Disposable } from "../../core";
1394
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1416
+ import { Components, Component } from "../../core";
1395
1417
  /**
1396
- * 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).
1418
+ * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
1397
1419
  */
1398
- export declare class FragmentsManager extends Component implements Disposable {
1420
+ export declare class Hider extends Component {
1399
1421
  /**
1400
1422
  * A unique identifier for the component.
1401
1423
  * This UUID is used to register the component within the Components system.
1402
1424
  */
1403
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1404
- /** {@link Disposable.onDisposed} */
1405
- readonly onDisposed: Event<unknown>;
1425
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1426
+ /** {@link Component.enabled} */
1427
+ enabled: boolean;
1428
+ constructor(components: Components);
1406
1429
  /**
1407
- * Event triggered when fragments are loaded.
1430
+ * Sets the visibility of fragments within the 3D scene.
1431
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1432
+ * If 'items' is provided, only the specified fragments will be affected.
1433
+ *
1434
+ * @param visible - The visibility state to set for the fragments.
1435
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1436
+ * If not provided, all fragments will be affected.
1437
+ *
1438
+ * @returns {void}
1408
1439
  */
1409
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
1440
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1410
1441
  /**
1411
- * Event triggered when fragments are disposed.
1442
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1443
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1444
+ *
1445
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1446
+ * If not provided, all fragments will be isolated.
1447
+ *
1448
+ * @returns {void}
1412
1449
  */
1413
- readonly onFragmentsDisposed: Event<{
1414
- groupID: string;
1415
- fragmentIDs: string[];
1416
- }>;
1450
+ isolate(items: FRAGS.FragmentIdMap): void;
1451
+ private updateCulledVisibility;
1452
+ }
1453
+ import * as THREE from "three";
1454
+ import * as FRAGS from "@thatopen/fragments";
1455
+ import { Disposable, Component, Event, Components } from "../../core";
1456
+ /**
1457
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
1458
+ */
1459
+ export interface Classification {
1417
1460
  /**
1418
- * Map containing all loaded fragments.
1419
- * The key is the fragment's unique identifier, and the value is the fragment itself.
1461
+ * A system within the classification.
1462
+ * The key is the system name, and the value is an object representing the classes within the system.
1420
1463
  */
1421
- readonly list: Map<string, Fragment>;
1464
+ [system: string]: {
1465
+ /**
1466
+ * A class within the system.
1467
+ * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
1468
+ */
1469
+ [className: string]: FRAGS.FragmentIdMap;
1470
+ };
1471
+ }
1472
+ /**
1473
+ * 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).
1474
+ */
1475
+ export declare class Classifier extends Component implements Disposable {
1422
1476
  /**
1423
- * Map containing all loaded fragment groups.
1424
- * The key is the group's unique identifier, and the value is the group itself.
1477
+ * A unique identifier for the component.
1478
+ * This UUID is used to register the component within the Components system.
1425
1479
  */
1426
- readonly groups: Map<string, FragmentsGroup>;
1427
- baseCoordinationModel: string;
1480
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1428
1481
  /** {@link Component.enabled} */
1429
1482
  enabled: boolean;
1430
- private _loader;
1431
1483
  /**
1432
- * Getter for the meshes of all fragments in the FragmentsManager.
1433
- * It iterates over the fragments in the list and pushes their meshes into an array.
1434
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1484
+ * A map representing the classification systems.
1485
+ * The key is the system name, and the value is an object representing the classes within the system.
1435
1486
  */
1436
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1487
+ list: Classification;
1488
+ /** {@link Disposable.onDisposed} */
1489
+ readonly onDisposed: Event<unknown>;
1437
1490
  constructor(components: Components);
1491
+ private onFragmentsDisposed;
1438
1492
  /** {@link Disposable.dispose} */
1439
1493
  dispose(): void;
1440
1494
  /**
1441
- * Dispose of a specific fragment group.
1442
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
1443
- * disposes of the group, and triggers the onFragmentsDisposed event.
1495
+ * Removes a fragment from the classification based on its unique identifier (guid).
1496
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1444
1497
  *
1445
- * @param group - The fragment group to be disposed.
1446
- */
1447
- disposeGroup(group: FragmentsGroup): void;
1448
- /**
1449
- * Loads a binary file that contain fragment geometry.
1450
- * @param data - The binary data to load.
1451
- * @param config - Optional configuration for loading.
1452
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1453
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1454
- * @returns The loaded FragmentsGroup.
1455
- */
1456
- load(data: Uint8Array, config?: Partial<{
1457
- coordinate: boolean;
1458
- name: string;
1459
- properties: FRAGS.IfcProperties;
1460
- relationsMap: RelationsMap;
1461
- }>): FragmentsGroup;
1462
- /**
1463
- * Export the specified fragmentsgroup to binary data.
1464
- * @param group - the fragments group to be exported.
1465
- * @returns the exported data as binary buffer.
1498
+ * @param guid - The unique identifier of the fragment to be removed.
1466
1499
  */
1467
- export(group: FragmentsGroup): Uint8Array;
1500
+ remove(guid: string): void;
1468
1501
  /**
1469
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1470
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1471
- * @returns A map of model IDs to sets of express IDs.
1502
+ * Finds and returns fragments based on the provided filter criteria.
1503
+ * If no filter is provided, it returns all fragments.
1504
+ *
1505
+ * @param filter - An optional object containing filter criteria.
1506
+ * The keys of the object represent the classification system names,
1507
+ * and the values are arrays of class names to match.
1508
+ *
1509
+ * @returns A map of fragment GUIDs to their respective express IDs,
1510
+ * where the express IDs are filtered based on the provided filter criteria.
1511
+ *
1512
+ * @throws Will throw an error if the fragments map is malformed.
1472
1513
  */
1473
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1474
- [modelID: string]: Set<number>;
1475
- };
1514
+ find(filter?: {
1515
+ [name: string]: string[];
1516
+ }): FRAGS.FragmentIdMap;
1476
1517
  /**
1477
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1478
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1479
- * @returns A fragment ID map.
1518
+ * Classifies fragments based on their modelID.
1519
+ *
1520
+ * @param modelID - The unique identifier of the model to classify fragments by.
1521
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1522
+ *
1480
1523
  * @remarks
1481
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1482
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1483
- * The fragment ID maps are then merged into a single map and returned.
1484
- * 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.
1524
+ * This method iterates through the fragments in the provided group,
1525
+ * and classifies them based on their modelID.
1526
+ * The classification is stored in the 'list.models' property,
1527
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1528
+ *
1485
1529
  */
1486
- modelIdToFragmentIdMap(modelIdMap: {
1487
- [modelID: string]: Set<number>;
1488
- }): FRAGS.FragmentIdMap;
1530
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1489
1531
  /**
1490
- * Applies coordinate transformation to the provided models.
1491
- * If no models are provided, all groups are used.
1492
- * The first model in the list becomes the base model for coordinate transformation.
1493
- * All other models are then transformed to match the base model's coordinate system.
1532
+ * Classifies fragments based on their PredefinedType property.
1494
1533
  *
1495
- * @param models - The models to apply coordinate transformation to.
1496
- * If not provided, all groups are used.
1534
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1497
1535
  *
1498
- * @returns {void}
1499
- */
1500
- coordinate(models?: FragmentsGroup[]): void;
1501
- }
1502
- import * as WEBIFC from "web-ifc";
1503
- import { Components, Disposable, Event, Component } from "../../core";
1504
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1505
- /**
1506
- * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1507
- */
1508
- export declare class IfcGeometryTiler extends Component implements Disposable {
1509
- /**
1510
- * A unique identifier for the component.
1511
- * This UUID is used to register the component within the Components system.
1512
- */
1513
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1514
- /**
1515
- * Event triggered when geometry is streamed.
1516
- * Contains the streamed geometry data and its buffer.
1517
- */
1518
- readonly onGeometryStreamed: Event<{
1519
- buffer: Uint8Array;
1520
- data: StreamedGeometries;
1521
- }>;
1522
- /**
1523
- * Event triggered when assets are streamed.
1524
- * Contains the streamed assets.
1525
- */
1526
- readonly onAssetStreamed: Event<StreamedAsset[]>;
1527
- /**
1528
- * Event triggered to indicate the progress of the streaming process.
1529
- * Contains the progress percentage.
1536
+ * @remarks
1537
+ * This method iterates through the properties of the fragments in the provided group,
1538
+ * and classifies them based on their PredefinedType property.
1539
+ * The classification is stored in the 'list.predefinedTypes' property,
1540
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1541
+ *
1542
+ * @throws Will throw an error if the fragment ID is not found.
1530
1543
  */
1531
- readonly onProgress: Event<number>;
1544
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1532
1545
  /**
1533
- * Event triggered when the IFC file is loaded.
1534
- * Contains the loaded IFC file data.
1546
+ * Classifies fragments based on their entity type.
1547
+ *
1548
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1549
+ *
1550
+ * @remarks
1551
+ * This method iterates through the relations of the fragments in the provided group,
1552
+ * and classifies them based on their entity type.
1553
+ * The classification is stored in the 'list.entities' property,
1554
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1555
+ *
1556
+ * @throws Will throw an error if the fragment ID is not found.
1535
1557
  */
1536
- readonly onIfcLoaded: Event<Uint8Array>;
1537
- /** {@link Disposable.onDisposed} */
1538
- readonly onDisposed: Event<unknown>;
1558
+ byEntity(group: FRAGS.FragmentsGroup): void;
1539
1559
  /**
1540
- * Settings for the IfcGeometryTiler.
1560
+ * Classifies fragments based on a specific IFC relationship.
1561
+ *
1562
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1563
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1564
+ * @param systemName - The name of the classification system to store the classification.
1565
+ *
1566
+ * @remarks
1567
+ * This method iterates through the relations of the fragments in the provided group,
1568
+ * and classifies them based on the specified IFC relationship.
1569
+ * The classification is stored in the 'list' property under the specified system name,
1570
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1571
+ *
1572
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1541
1573
  */
1542
- settings: IfcStreamingSettings;
1543
- /** {@link Component.enabled} */
1544
- enabled: boolean;
1574
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1545
1575
  /**
1546
- * The WebIFC API instance used for IFC file processing.
1576
+ * Classifies fragments based on their spatial structure in the IFC model.
1577
+ *
1578
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1579
+ *
1580
+ * @remarks
1581
+ * This method iterates through the relations of the fragments in the provided group,
1582
+ * and classifies them based on their spatial structure in the IFC model.
1583
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1584
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1585
+ *
1586
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1547
1587
  */
1548
- webIfc: WEBIFC.IfcAPI;
1549
- private _spatialTree;
1550
- private _metaData;
1551
- private _visitedGeometries;
1552
- private _streamSerializer;
1553
- private _geometries;
1554
- private _geometryCount;
1555
- private _civil;
1556
- private _groupSerializer;
1557
- private _assets;
1558
- private _meshesWithHoles;
1559
- constructor(components: Components);
1560
- /** {@link Disposable.dispose} */
1561
- dispose(): void;
1588
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
1562
1589
  /**
1563
- * This method streams the IFC file from a given buffer.
1590
+ * Sets the color of the specified fragments.
1564
1591
  *
1565
- * @param data - The Uint8Array containing the IFC file data.
1566
- * @returns A Promise that resolves when the streaming process is complete.
1592
+ * @param items - A map of fragment IDs to their respective express IDs.
1593
+ * @param color - The color to set for the fragments.
1594
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1567
1595
  *
1568
1596
  * @remarks
1569
- * This method cleans up any resources after the streaming process is complete.
1597
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1598
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1570
1599
  *
1571
- * @example
1572
- * '''typescript
1573
- * const ifcData = await fetch('path/to/ifc/file.ifc');
1574
- * const rawBuffer = await response.arrayBuffer();
1575
- * const ifcBuffer = new Uint8Array(rawBuffer);
1576
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1577
- * '''
1600
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1578
1601
  */
1579
- streamFromBuffer(data: Uint8Array): Promise<void>;
1602
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1580
1603
  /**
1581
- * This method streams the IFC file from a given callback.
1604
+ * Resets the color of the specified fragments to their original color.
1582
1605
  *
1583
- * @param loadCallback - The callback function that will be used to load the IFC file.
1584
- * @returns A Promise that resolves when the streaming process is complete.
1606
+ * @param items - A map of fragment IDs to their respective express IDs.
1585
1607
  *
1586
1608
  * @remarks
1587
- * This method cleans up any resources after the streaming process is complete.
1609
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1610
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1588
1611
  *
1612
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1589
1613
  */
1590
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1591
- private readIfcFile;
1592
- private streamIfcFile;
1593
- private streamAllGeometries;
1594
- private cleanUp;
1595
- private getMesh;
1596
- private getGeometry;
1597
- private streamAssets;
1598
- private streamGeometries;
1614
+ resetColor(items: FRAGS.FragmentIdMap): void;
1615
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
1599
1616
  }
1600
- import * as WEBIFC from "web-ifc";
1601
- import { FragmentsGroup } from "@thatopen/fragments";
1602
- import { Disposable, Event, Component, Components } from "../../core";
1603
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1604
- export type { InverseAttribute, RelationsMap } from "./src/types";
1617
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1618
+ import * as THREE from "three";
1619
+ import * as FRAGS from "@thatopen/fragments";
1620
+ import { Component, Components, Event, Disposable } from "../../core";
1621
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1605
1622
  /**
1606
- * 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).
1623
+ * 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).
1607
1624
  */
1608
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1625
+ export declare class FragmentsManager extends Component implements Disposable {
1609
1626
  /**
1610
1627
  * A unique identifier for the component.
1611
1628
  * This UUID is used to register the component within the Components system.
1612
1629
  */
1613
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1630
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1614
1631
  /** {@link Disposable.onDisposed} */
1615
- readonly onDisposed: Event<string>;
1632
+ readonly onDisposed: Event<unknown>;
1616
1633
  /**
1617
- * Event triggered when relations for a model have been indexed.
1618
- * This event provides the model's UUID and the relations map generated for that model.
1619
- *
1620
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1621
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1622
- * 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.
1634
+ * Event triggered when fragments are loaded.
1623
1635
  */
1624
- readonly onRelationsIndexed: Event<{
1625
- modelID: string;
1626
- relationsMap: RelationsMap;
1636
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
1637
+ /**
1638
+ * Event triggered when fragments are disposed.
1639
+ */
1640
+ readonly onFragmentsDisposed: Event<{
1641
+ groupID: string;
1642
+ fragmentIDs: string[];
1627
1643
  }>;
1628
1644
  /**
1629
- * Holds the relationship mappings for each model processed by the indexer.
1630
- * The structure is a map where each key is a model's UUID, and the value is another map.
1631
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1632
- * representing a specific relation type, and the value is an array of expressIDs of entities
1633
- * that are related through that relation type. This structure allows for efficient querying
1634
- * of entity relationships within a model.
1645
+ * Map containing all loaded fragments.
1646
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1635
1647
  */
1636
- readonly relationMaps: ModelsRelationMap;
1648
+ readonly list: Map<string, Fragment>;
1649
+ /**
1650
+ * Map containing all loaded fragment groups.
1651
+ * The key is the group's unique identifier, and the value is the group itself.
1652
+ */
1653
+ readonly groups: Map<string, FragmentsGroup>;
1654
+ baseCoordinationModel: string;
1637
1655
  /** {@link Component.enabled} */
1638
1656
  enabled: boolean;
1639
- private _relToAttributesMap;
1640
- private _inverseAttributes;
1641
- private _ifcRels;
1657
+ private _loader;
1658
+ /**
1659
+ * Getter for the meshes of all fragments in the FragmentsManager.
1660
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1661
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1662
+ */
1663
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1642
1664
  constructor(components: Components);
1643
- private onFragmentsDisposed;
1644
- private indexRelations;
1665
+ /** {@link Disposable.dispose} */
1666
+ dispose(): void;
1645
1667
  /**
1646
- * Adds a relation map to the model's relations map.
1647
- *
1648
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1649
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1668
+ * Dispose of a specific fragment group.
1669
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1670
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1650
1671
  *
1651
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1672
+ * @param group - The fragment group to be disposed.
1652
1673
  */
1653
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1674
+ disposeGroup(group: FragmentsGroup): void;
1654
1675
  /**
1655
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1656
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1657
- * and maps them in a structured way to facilitate quick access to related entities.
1658
- *
1659
- * The process involves querying the model for each relation type associated with the inverse attributes
1660
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1661
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1662
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1663
- * of entities that are related through that attribute.
1664
- *
1665
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1666
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1667
- * representation of the relations indexed by entity expressIDs and relation types.
1668
- * @throws An error if the model does not have properties loaded.
1676
+ * Loads a binary file that contain fragment geometry.
1677
+ * @param data - The binary data to load.
1678
+ * @param config - Optional configuration for loading.
1679
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1680
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1681
+ * @returns The loaded FragmentsGroup.
1669
1682
  */
1670
- process(model: FragmentsGroup): Promise<RelationsMap>;
1683
+ load(data: Uint8Array, config?: Partial<{
1684
+ coordinate: boolean;
1685
+ name: string;
1686
+ properties: FRAGS.IfcProperties;
1687
+ relationsMap: RelationsMap;
1688
+ }>): FragmentsGroup;
1671
1689
  /**
1672
- * Processes a given model from a WebIfc API to index its IFC entities relations.
1673
- *
1674
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1675
- * @param modelID - The unique identifier of the model within the WebIfc API.
1676
- * @returns A promise that resolves to the relations map for the processed model.
1677
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1690
+ * Export the specified fragmentsgroup to binary data.
1691
+ * @param group - the fragments group to be exported.
1692
+ * @returns the exported data as binary buffer.
1678
1693
  */
1679
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1694
+ export(group: FragmentsGroup): Uint8Array;
1680
1695
  /**
1681
- * Retrieves the relations of a specific entity within a model based on the given relation name.
1682
- * This method searches the indexed relation maps for the specified model and entity,
1683
- * returning the IDs of related entities if a match is found.
1684
- *
1685
- * @param model The 'FragmentsGroup' model containing the entity.
1686
- * @param expressID The unique identifier of the entity within the model.
1687
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1688
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1689
- * or the specified relation name is not indexed.
1690
- */
1691
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1692
- /**
1693
- * Serializes the relations of a given relation map into a JSON string.
1694
- * 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,
1695
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1696
- * The resulting object is then serialized into a JSON string.
1697
- *
1698
- * @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.
1699
- * @returns A JSON string representing the serialized relations of the given relation map.
1696
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1697
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1698
+ * @returns A map of model IDs to sets of express IDs.
1700
1699
  */
1701
- serializeRelations(relationMap: RelationsMap): string;
1700
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1701
+ [modelID: string]: Set<number>;
1702
+ };
1702
1703
  /**
1703
- * Serializes the relations of a specific model into a JSON string.
1704
- * This method iterates through the relations indexed for the given model,
1705
- * organizing them into a structured object where each key is an expressID of an entity,
1706
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1707
- * The resulting object is then serialized into a JSON string.
1708
- *
1709
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1710
- * @returns A JSON string representing the serialized relations of the specified model.
1711
- * If the model has no indexed relations, 'null' is returned.
1704
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1705
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1706
+ * @returns A fragment ID map.
1707
+ * @remarks
1708
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1709
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1710
+ * The fragment ID maps are then merged into a single map and returned.
1711
+ * 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.
1712
1712
  */
1713
- serializeModelRelations(model: FragmentsGroup): string | null;
1713
+ modelIdToFragmentIdMap(modelIdMap: {
1714
+ [modelID: string]: Set<number>;
1715
+ }): FRAGS.FragmentIdMap;
1714
1716
  /**
1715
- * Serializes all relations of every model processed by the indexer into a JSON string.
1716
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1717
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1718
- * and its value is another object mapping entity expressIDs to their related entities, categorized
1719
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1717
+ * Applies coordinate transformation to the provided models.
1718
+ * If no models are provided, all groups are used.
1719
+ * The first model in the list becomes the base model for coordinate transformation.
1720
+ * All other models are then transformed to match the base model's coordinate system.
1720
1721
  *
1721
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1722
- * If no relations have been indexed, an empty object is returned as a JSON string.
1723
- */
1724
- serializeAllRelations(): string;
1725
- /**
1726
- * Converts a JSON string representing relations between entities into a structured map.
1727
- * This method parses the JSON string to reconstruct the relations map that indexes
1728
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1729
- * and the values are maps where each key is a relation type ID and its value is an array
1730
- * of express IDs of entities related through that relation type.
1722
+ * @param models - The models to apply coordinate transformation to.
1723
+ * If not provided, all groups are used.
1731
1724
  *
1732
- * @param json The JSON string to be parsed into the relations map.
1733
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1734
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1735
- * is an array of express IDs (as numbers) of entities related through that relation type.
1725
+ * @returns {void}
1736
1726
  */
1737
- getRelationsMapFromJSON(json: string): RelationsMap;
1738
- /** {@link Disposable.dispose} */
1739
- dispose(): void;
1727
+ coordinate(models?: FragmentsGroup[]): void;
1740
1728
  }
1741
1729
  import * as WEBIFC from "web-ifc";
1742
- import { FragmentsGroup } from "@thatopen/fragments";
1743
- import { Component, Disposable, Event, Components } from "../../core";
1744
- /**
1745
- * Types for boolean properties in IFC schema.
1746
- */
1747
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1748
- /**
1749
- * Types for string properties in IFC schema.
1750
- */
1751
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1752
- /**
1753
- * Types for numeric properties in IFC schema.
1754
- */
1755
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
1756
- /**
1757
- * 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.
1758
- */
1759
- export interface ChangeMap {
1760
- [modelID: string]: Set<number>;
1761
- }
1762
- /**
1763
- * 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.
1764
- */
1765
- export interface AttributeListener {
1766
- [modelID: string]: {
1767
- [expressID: number]: {
1768
- [attributeName: string]: Event<String | Boolean | Number>;
1769
- };
1770
- };
1771
- }
1730
+ import * as FRAGS from "@thatopen/fragments";
1731
+ import { IfcFragmentSettings } from "./src";
1732
+ import { Component, Components, Event, Disposable } from "../../core";
1772
1733
  /**
1773
- * Component to manage and edit properties and Psets in IFC files.
1734
+ * 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).
1774
1735
  */
1775
- export declare class IfcPropertiesManager extends Component implements Disposable {
1736
+ export declare class IfcLoader extends Component implements Disposable {
1776
1737
  /**
1777
1738
  * A unique identifier for the component.
1778
1739
  * This UUID is used to register the component within the Components system.
1779
1740
  */
1780
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1741
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1781
1742
  /** {@link Disposable.onDisposed} */
1782
1743
  readonly onDisposed: Event<string>;
1783
1744
  /**
1784
- * Event triggered when a file is requested for export.
1785
- */
1786
- readonly onRequestFile: Event<unknown>;
1787
- /**
1788
- * ArrayBuffer containing the IFC data to be exported.
1789
- */
1790
- ifcToExport: ArrayBuffer | null;
1791
- /**
1792
- * Event triggered when an element is added to a Pset.
1793
- */
1794
- readonly onElementToPset: Event<{
1795
- model: FragmentsGroup;
1796
- psetID: number;
1797
- elementID: number;
1798
- }>;
1799
- /**
1800
- * Event triggered when a property is added to a Pset.
1745
+ * An event triggered when the IFC file starts loading.
1801
1746
  */
1802
- readonly onPropToPset: Event<{
1803
- model: FragmentsGroup;
1804
- psetID: number;
1805
- propID: number;
1806
- }>;
1747
+ readonly onIfcStartedLoading: Event<void>;
1807
1748
  /**
1808
- * Event triggered when a Pset is removed.
1749
+ * An event triggered when the setup process is completed.
1809
1750
  */
1810
- readonly onPsetRemoved: Event<{
1811
- model: FragmentsGroup;
1812
- psetID: number;
1813
- }>;
1751
+ readonly onSetup: Event<void>;
1814
1752
  /**
1815
- * Event triggered when data in the model changes.
1753
+ * The settings for the IfcLoader.
1754
+ * It includes options for excluding categories, setting WASM paths, and more.
1816
1755
  */
1817
- readonly onDataChanged: Event<{
1818
- model: FragmentsGroup;
1819
- expressID: number;
1820
- }>;
1756
+ settings: IfcFragmentSettings;
1821
1757
  /**
1822
- * Configuration for the WebAssembly module.
1758
+ * The instance of the Web-IFC library used for handling IFC data.
1823
1759
  */
1824
- wasm: {
1825
- path: string;
1826
- absolute: boolean;
1827
- };
1760
+ webIfc: WEBIFC.IfcAPI;
1828
1761
  /** {@link Component.enabled} */
1829
1762
  enabled: boolean;
1830
- /**
1831
- * Map of attribute listeners.
1832
- */
1833
- attributeListeners: AttributeListener;
1834
- /**
1835
- * The currently selected model.
1836
- */
1837
- selectedModel?: FragmentsGroup;
1838
- /**
1839
- * Map of changed entities in the model.
1840
- */
1841
- changeMap: ChangeMap;
1763
+ private _material;
1764
+ private _spatialTree;
1765
+ private _metaData;
1766
+ private _fragmentInstances;
1767
+ private _civil;
1768
+ private _visitedFragments;
1769
+ private _materialT;
1842
1770
  constructor(components: Components);
1843
1771
  /** {@link Disposable.dispose} */
1844
1772
  dispose(): void;
1845
1773
  /**
1846
- * Static method to retrieve the IFC schema from a given model.
1774
+ * Sets up the IfcLoader component with the provided configuration.
1847
1775
  *
1848
- * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1849
- * @throws Will throw an error if the IFC schema is not found in the model.
1850
- * @returns The IFC schema associated with the given model.
1851
- */
1852
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1853
- /**
1854
- * Method to set properties data in the model.
1776
+ * @param config - Optional configuration settings for the IfcLoader.
1777
+ * If not provided, the existing settings will be used.
1855
1778
  *
1856
- * @param model - The FragmentsGroup model in which to set the properties.
1857
- * @param dataToSave - An array of objects representing the properties to be saved.
1858
- * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1859
- * The rest of the properties will be set as the properties of the entity.
1779
+ * @returns A Promise that resolves when the setup process is completed.
1860
1780
  *
1861
- * @returns {Promise<void>} A promise that resolves when all the properties have been set.
1781
+ * @remarks
1782
+ * If the 'autoSetWasm' option is enabled in the configuration,
1783
+ * the method will automatically set the WASM paths for the Web-IFC library.
1862
1784
  *
1863
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1785
+ * @example
1786
+ * '''typescript
1787
+ * const ifcLoader = new IfcLoader(components);
1788
+ * await ifcLoader.setup({ autoSetWasm: true });
1789
+ * '''
1864
1790
  */
1865
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1791
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1866
1792
  /**
1867
- * Creates a new Property Set (Pset) in the given model.
1793
+ * Loads an IFC file and processes it for 3D visualization.
1868
1794
  *
1869
- * @param model - The FragmentsGroup model in which to create the Pset.
1870
- * @param name - The name of the Pset.
1871
- * @param description - (Optional) The description of the Pset.
1795
+ * @param data - The Uint8Array containing the IFC file data.
1796
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1872
1797
  *
1873
- * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1798
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1874
1799
  *
1875
- * @throws Will throw an error if the IFC schema is not found in the model.
1876
- * @throws Will throw an error if no OwnerHistory is found in the model.
1800
+ * @example
1801
+ * '''typescript
1802
+ * const ifcLoader = components.get(IfcLoader);
1803
+ * const group = await ifcLoader.load(ifcData);
1804
+ * '''
1877
1805
  */
1878
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1879
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1880
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1881
- }>;
1806
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1882
1807
  /**
1883
- * Removes a Property Set (Pset) from the given model.
1808
+ * Reads an IFC file and initializes the Web-IFC library.
1884
1809
  *
1885
- * @param model - The FragmentsGroup model from which to remove the Pset.
1886
- * @param psetID - The express IDs of the Psets to be removed.
1810
+ * @param data - The Uint8Array containing the IFC file data.
1887
1811
  *
1888
- * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
1812
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
1889
1813
  *
1890
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1891
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1892
- * @throws Will throw an error if no relation is found between the Pset and the model.
1814
+ * @remarks
1815
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1816
+ * It also opens the IFC model using the provided data and settings.
1817
+ *
1818
+ * @example
1819
+ * '''typescript
1820
+ * const ifcLoader = components.get(IfcLoader);
1821
+ * await ifcLoader.readIfcFile(ifcData);
1822
+ * '''
1893
1823
  */
1894
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1824
+ readIfcFile(data: Uint8Array): Promise<number>;
1895
1825
  /**
1896
- * Creates a new single-value property of type string in the given model.
1826
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
1827
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1897
1828
  *
1898
- * @param model - The FragmentsGroup model in which to create the property.
1899
- * @param type - The type of the property value. Must be a string property type.
1900
- * @param name - The name of the property.
1901
- * @param value - The value of the property. Must be a string.
1902
- *
1903
- * @returns The newly created single-value property.
1829
+ * @remarks
1830
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1904
1831
  *
1905
- * @throws Will throw an error if the IFC schema is not found in the model.
1906
- * @throws Will throw an error if no OwnerHistory is found in the model.
1832
+ * @example
1833
+ * '''typescript
1834
+ * const ifcLoader = components.get(IfcLoader);
1835
+ * ifcLoader.cleanUp();
1836
+ * '''
1907
1837
  */
1908
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1838
+ cleanUp(): void;
1839
+ private getAllGeometries;
1840
+ private getMesh;
1841
+ private getGeometry;
1842
+ private autoSetWasm;
1843
+ }
1844
+ import { Component, Disposable, Event, Components } from "../../core";
1845
+ /**
1846
+ * 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).
1847
+ */
1848
+ export declare class Exploder extends Component implements Disposable {
1909
1849
  /**
1910
- * Creates a new single-value property of type numeric in the given model.
1911
- *
1912
- * @param model - The FragmentsGroup model in which to create the property.
1913
- * @param type - The type of the property value. Must be a numeric property type.
1914
- * @param name - The name of the property.
1915
- * @param value - The value of the property. Must be a number.
1916
- *
1917
- * @returns The newly created single-value property.
1918
- *
1919
- * @throws Will throw an error if the IFC schema is not found in the model.
1920
- * @throws Will throw an error if no OwnerHistory is found in the model.
1850
+ * A unique identifier for the component.
1851
+ * This UUID is used to register the component within the Components system.
1921
1852
  */
1922
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1853
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1854
+ /** {@link Disposable.onDisposed} */
1855
+ readonly onDisposed: Event<unknown>;
1856
+ /** {@link Component.enabled} */
1857
+ enabled: boolean;
1923
1858
  /**
1924
- * Creates a new single-value property of type boolean in the given model.
1925
- *
1926
- * @param model - The FragmentsGroup model in which to create the property.
1927
- * @param type - The type of the property value. Must be a boolean property type.
1928
- * @param name - The name of the property.
1929
- * @param value - The value of the property. Must be a boolean.
1930
- *
1931
- * @returns The newly created single-value property.
1932
- *
1933
- * @throws Will throw an error if the IFC schema is not found in the model.
1934
- * @throws Will throw an error if no OwnerHistory is found in the model.
1859
+ * The height of the explosion animation.
1860
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1861
+ * Default value is 10.
1935
1862
  */
1936
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1863
+ height: number;
1937
1864
  /**
1938
- * Removes a property from a Property Set (Pset) in the given model.
1939
- *
1940
- * @param model - The FragmentsGroup model from which to remove the property.
1941
- * @param psetID - The express ID of the Pset from which to remove the property.
1942
- * @param propID - The express ID of the property to be removed.
1943
- *
1944
- * @returns {Promise<void>} A promise that resolves when the property has been removed.
1945
- *
1946
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1947
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1865
+ * The group name used for the explosion animation.
1866
+ * This property specifies the group of fragments that will be affected by the explosion.
1867
+ * Default value is "storeys".
1948
1868
  */
1949
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1950
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
1869
+ groupName: string;
1951
1870
  /**
1952
- * Adds elements to a Property Set (Pset) in the given model.
1953
- *
1954
- * @param model - The FragmentsGroup model in which to add the elements.
1955
- * @param psetID - The express ID of the Pset to which to add the elements.
1956
- * @param elementID - The express IDs of the elements to be added.
1957
- *
1958
- * @returns {Promise<void>} A promise that resolves when all the elements have been added.
1959
- *
1960
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1961
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1962
- * @throws Will throw an error if no relation is found between the Pset and the model.
1871
+ * A set of strings representing the exploded items.
1872
+ * This set is used to keep track of which items have been exploded.
1963
1873
  */
1964
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1874
+ list: Set<string>;
1875
+ constructor(components: Components);
1876
+ /** {@link Disposable.dispose} */
1877
+ dispose(): void;
1965
1878
  /**
1966
- * Saves the changes made to the model to a new IFC file.
1967
- *
1968
- * @param model - The FragmentsGroup model from which to save the changes.
1969
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1970
- *
1971
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1879
+ * Sets the explosion state of the fragments.
1972
1880
  *
1973
- * @throws Will throw an error if any issues occur during the saving process.
1974
- */
1975
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1976
- /**
1977
- * Sets an attribute listener for a specific attribute of an entity in the model.
1978
- * The listener will trigger an event whenever the attribute's value changes.
1881
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1979
1882
  *
1980
- * @param model - The FragmentsGroup model in which to set the attribute listener.
1981
- * @param expressID - The express ID of the entity for which to set the listener.
1982
- * @param attributeName - The name of the attribute for which to set the listener.
1883
+ * @remarks
1884
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1885
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1886
+ * If 'active' is false, the fragments are moved back to their original position.
1983
1887
  *
1984
- * @returns The event that will be triggered when the attribute's value changes.
1888
+ * The method also keeps track of the exploded items using the 'list' set.
1985
1889
  *
1986
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
1987
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1988
- * @throws Will throw an error if the attribute has a badly defined handle.
1890
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1989
1891
  */
1990
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1991
- private increaseMaxID;
1992
- private newGUID;
1993
- private getOwnerHistory;
1994
- private registerChange;
1995
- private newSingleProperty;
1892
+ set(active: boolean): void;
1996
1893
  }
1997
1894
  import * as WEBIFC from "web-ifc";
1998
- import * as FRAG from "@thatopen/fragments";
1999
- import { Component, Components } from "../../core";
1895
+ export interface IfcItemsCategories {
1896
+ [itemID: number]: number;
1897
+ }
1898
+ export declare class IfcCategories {
1899
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1900
+ }
2000
1901
  /**
2001
- * 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).
1902
+ * 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.
2002
1903
  */
2003
- export declare class IfcJsonExporter extends Component {
1904
+ export declare const IfcCategoryMap: {
1905
+ [key: number]: string;
1906
+ };
1907
+ import * as WEBIFC from "web-ifc";
1908
+ import { Components, Disposable, Event, Component } from "../../core";
1909
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1910
+ /**
1911
+ * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1912
+ */
1913
+ export declare class IfcGeometryTiler extends Component implements Disposable {
2004
1914
  /**
2005
1915
  * A unique identifier for the component.
2006
1916
  * This UUID is used to register the component within the Components system.
2007
1917
  */
2008
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
2009
- /** {@link Component.enabled} */
2010
- enabled: boolean;
2011
- constructor(components: Components);
2012
- /**
2013
- * Exports all the properties of an IFC into an array of JS objects.
2014
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
2015
- * @param modelID ID of the IFC model whose properties to extract.
2016
- * @param indirect whether to get the indirect relationships as well.
2017
- * @param recursiveSpatial whether to get the properties of spatial items recursively
2018
- * to make the location data available (e.g. absolute position of building).
2019
- */
2020
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
2021
- }
2022
- import * as THREE from "three";
2023
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2024
- /**
2025
- * A class representing a 2D minimap of a 3D world.
2026
- */
2027
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2028
- /** {@link Disposable.onDisposed} */
2029
- readonly onDisposed: Event<unknown>;
2030
- /** {@link Updateable.onAfterUpdate} */
2031
- readonly onAfterUpdate: Event<unknown>;
2032
- /** {@link Updateable.onBeforeUpdate} */
2033
- readonly onBeforeUpdate: Event<unknown>;
2034
- /** {@link Resizeable.onResize} */
2035
- readonly onResize: Event<THREE.Vector2>;
1918
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
2036
1919
  /**
2037
- * The front offset of the minimap.
2038
- * It determines how much the minimap's view is offset from the camera's view.
2039
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1920
+ * Event triggered when geometry is streamed.
1921
+ * Contains the streamed geometry data and its buffer.
2040
1922
  */
2041
- frontOffset: number;
1923
+ readonly onGeometryStreamed: Event<{
1924
+ buffer: Uint8Array;
1925
+ data: StreamedGeometries;
1926
+ }>;
2042
1927
  /**
2043
- * The override material for the minimap.
2044
- * It is used to render the depth information of the world onto the minimap.
1928
+ * Event triggered when assets are streamed.
1929
+ * Contains the streamed assets.
2045
1930
  */
2046
- overrideMaterial: THREE.MeshDepthMaterial;
1931
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
2047
1932
  /**
2048
- * The background color of the minimap.
2049
- * It is used to set the background color of the minimap's renderer.
1933
+ * Event triggered to indicate the progress of the streaming process.
1934
+ * Contains the progress percentage.
2050
1935
  */
2051
- backgroundColor: THREE.Color;
1936
+ readonly onProgress: Event<number>;
2052
1937
  /**
2053
- * The WebGL renderer for the minimap.
2054
- * It is used to render the minimap onto the screen.
1938
+ * Event triggered when the IFC file is loaded.
1939
+ * Contains the loaded IFC file data.
2055
1940
  */
2056
- renderer: THREE.WebGLRenderer;
1941
+ readonly onIfcLoaded: Event<Uint8Array>;
1942
+ /** {@link Disposable.onDisposed} */
1943
+ readonly onDisposed: Event<unknown>;
2057
1944
  /**
2058
- * A flag indicating whether the minimap is enabled.
2059
- * If disabled, the minimap will not update or render.
1945
+ * Settings for the IfcGeometryTiler.
2060
1946
  */
1947
+ settings: IfcStreamingSettings;
1948
+ /** {@link Component.enabled} */
2061
1949
  enabled: boolean;
2062
1950
  /**
2063
- * The world in which the minimap is displayed.
2064
- * It provides access to the 3D scene, camera, and other relevant world elements.
1951
+ * The WebIFC API instance used for IFC file processing.
2065
1952
  */
2066
- world: World;
2067
- private _lockRotation;
2068
- private _camera;
2069
- private _plane;
2070
- private _size;
2071
- private _tempVector1;
2072
- private _tempVector2;
2073
- private _tempTarget;
2074
- private readonly down;
1953
+ webIfc: WEBIFC.IfcAPI;
1954
+ private _spatialTree;
1955
+ private _metaData;
1956
+ private _visitedGeometries;
1957
+ private _streamSerializer;
1958
+ private _geometries;
1959
+ private _geometryCount;
1960
+ private _civil;
1961
+ private _groupSerializer;
1962
+ private _assets;
1963
+ private _meshesWithHoles;
1964
+ constructor(components: Components);
1965
+ /** {@link Disposable.dispose} */
1966
+ dispose(): void;
2075
1967
  /**
2076
- * Gets or sets whether the minimap rotation is locked.
2077
- * When rotation is locked, the minimap will always face the same direction as the camera.
1968
+ * This method streams the IFC file from a given buffer.
1969
+ *
1970
+ * @param data - The Uint8Array containing the IFC file data.
1971
+ * @returns A Promise that resolves when the streaming process is complete.
1972
+ *
1973
+ * @remarks
1974
+ * This method cleans up any resources after the streaming process is complete.
1975
+ *
1976
+ * @example
1977
+ * '''typescript
1978
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
1979
+ * const rawBuffer = await response.arrayBuffer();
1980
+ * const ifcBuffer = new Uint8Array(rawBuffer);
1981
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1982
+ * '''
2078
1983
  */
2079
- get lockRotation(): boolean;
1984
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1985
+ /**
1986
+ * This method streams the IFC file from a given callback.
1987
+ *
1988
+ * @param loadCallback - The callback function that will be used to load the IFC file.
1989
+ * @returns A Promise that resolves when the streaming process is complete.
1990
+ *
1991
+ * @remarks
1992
+ * This method cleans up any resources after the streaming process is complete.
1993
+ *
1994
+ */
1995
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1996
+ private readIfcFile;
1997
+ private streamIfcFile;
1998
+ private streamAllGeometries;
1999
+ private cleanUp;
2000
+ private getMesh;
2001
+ private getGeometry;
2002
+ private streamAssets;
2003
+ private streamGeometries;
2004
+ }
2005
+ import * as WEBIFC from "web-ifc";
2006
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
2007
+ import { PropertiesStreamingSettings } from "./src";
2008
+ /**
2009
+ * 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).
2010
+ */
2011
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
2012
+ /**
2013
+ * A unique identifier for the component.
2014
+ * This UUID is used to register the component within the Components system.
2015
+ */
2016
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
2017
+ /**
2018
+ * An event that is triggered when properties are streamed from the IFC file.
2019
+ * The event provides the type of the IFC entity and the corresponding data.
2020
+ */
2021
+ readonly onPropertiesStreamed: AsyncEvent<{
2022
+ type: number;
2023
+ data: {
2024
+ [id: number]: any;
2025
+ };
2026
+ }>;
2027
+ /**
2028
+ * An event that is triggered to indicate the progress of the streaming process.
2029
+ * The event provides a number between 0 and 1 representing the progress percentage.
2030
+ */
2031
+ readonly onProgress: AsyncEvent<number>;
2032
+ /**
2033
+ * An event that is triggered when indices are streamed from the IFC file.
2034
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
2035
+ */
2036
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
2037
+ /** {@link Disposable.onDisposed} */
2038
+ readonly onDisposed: Event<string>;
2039
+ /** {@link Component.enabled} */
2040
+ enabled: boolean;
2041
+ /**
2042
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
2043
+ */
2044
+ settings: PropertiesStreamingSettings;
2045
+ /**
2046
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
2047
+ */
2048
+ webIfc: WEBIFC.IfcAPI;
2049
+ /** {@link Disposable.dispose} */
2050
+ dispose(): Promise<void>;
2051
+ /**
2052
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
2053
+ *
2054
+ * @param data - The Uint8Array containing the IFC file data.
2055
+ * @returns A Promise that resolves when the streaming process is complete.
2056
+ */
2057
+ streamFromBuffer(data: Uint8Array): Promise<void>;
2058
+ /**
2059
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2060
+ *
2061
+ * @param loadCallback - A callback function that loads the IFC file data.
2062
+ * @returns A Promise that resolves when the streaming process is complete.
2063
+ */
2064
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2065
+ private readIfcFile;
2066
+ private streamIfcFile;
2067
+ private streamAllProperties;
2068
+ private cleanUp;
2069
+ }
2070
+ /**
2071
+ * 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.
2072
+ *
2073
+ * @remarks
2074
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2075
+ * It is useful for identifying and processing different types of IFC elements in a project.
2076
+ *
2077
+ */
2078
+ export declare const IfcElements: {
2079
+ [key: number]: string;
2080
+ };
2081
+ import * as FRAGS from "@thatopen/fragments";
2082
+ export declare class IfcPropertiesUtils {
2083
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2084
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2085
+ [attribute: string]: any;
2086
+ } | null>;
2087
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2088
+ [relatingID: number]: number[];
2089
+ }>;
2090
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2091
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2092
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2093
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2094
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2095
+ key: string | null;
2096
+ name: string | null;
2097
+ }>;
2098
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2099
+ key: string | null;
2100
+ value: number | null;
2101
+ }>;
2102
+ static isRel(expressID: number): boolean;
2103
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2104
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2105
+ }
2106
+ import * as THREE from "three";
2107
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2108
+ /**
2109
+ * A class representing a 2D minimap of a 3D world.
2110
+ */
2111
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2112
+ /** {@link Disposable.onDisposed} */
2113
+ readonly onDisposed: Event<unknown>;
2114
+ /** {@link Updateable.onAfterUpdate} */
2115
+ readonly onAfterUpdate: Event<unknown>;
2116
+ /** {@link Updateable.onBeforeUpdate} */
2117
+ readonly onBeforeUpdate: Event<unknown>;
2118
+ /** {@link Resizeable.onResize} */
2119
+ readonly onResize: Event<THREE.Vector2>;
2120
+ /**
2121
+ * The front offset of the minimap.
2122
+ * It determines how much the minimap's view is offset from the camera's view.
2123
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2124
+ */
2125
+ frontOffset: number;
2126
+ /**
2127
+ * The override material for the minimap.
2128
+ * It is used to render the depth information of the world onto the minimap.
2129
+ */
2130
+ overrideMaterial: THREE.MeshDepthMaterial;
2131
+ /**
2132
+ * The background color of the minimap.
2133
+ * It is used to set the background color of the minimap's renderer.
2134
+ */
2135
+ backgroundColor: THREE.Color;
2136
+ /**
2137
+ * The WebGL renderer for the minimap.
2138
+ * It is used to render the minimap onto the screen.
2139
+ */
2140
+ renderer: THREE.WebGLRenderer;
2141
+ /**
2142
+ * A flag indicating whether the minimap is enabled.
2143
+ * If disabled, the minimap will not update or render.
2144
+ */
2145
+ enabled: boolean;
2146
+ /**
2147
+ * The world in which the minimap is displayed.
2148
+ * It provides access to the 3D scene, camera, and other relevant world elements.
2149
+ */
2150
+ world: World;
2151
+ private _lockRotation;
2152
+ private _camera;
2153
+ private _plane;
2154
+ private _size;
2155
+ private _tempVector1;
2156
+ private _tempVector2;
2157
+ private _tempTarget;
2158
+ private readonly down;
2159
+ /**
2160
+ * Gets or sets whether the minimap rotation is locked.
2161
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2162
+ */
2163
+ get lockRotation(): boolean;
2080
2164
  /**
2081
2165
  * Sets whether the minimap rotation is locked.
2082
2166
  * When rotation is locked, the minimap will always face the same direction as the camera.
@@ -2112,6 +2196,11 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2112
2196
  * A Set of unique numbers representing different types of IFC geometries.
2113
2197
  */
2114
2198
  export declare const GeometryTypes: Set<number>;
2199
+ import { InverseAttribute } from "./types";
2200
+ export declare const relToAttributesMap: Map<number, {
2201
+ forRelating: InverseAttribute;
2202
+ forRelated: InverseAttribute;
2203
+ }>;
2115
2204
  import * as WEBIFC from "web-ifc";
2116
2205
  import { IfcItemsCategories } from "../../../ifc";
2117
2206
  export declare class SpatialStructure {
@@ -2161,68 +2250,94 @@ export declare class IfcFragmentSettings {
2161
2250
  */
2162
2251
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2163
2252
  }
2164
- import * as WEBIFC from "web-ifc";
2165
- export interface IfcItemsCategories {
2166
- [itemID: number]: number;
2167
- }
2168
- export declare class IfcCategories {
2169
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2170
- }
2171
- /**
2172
- * 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.
2173
- *
2174
- * @remarks
2175
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2176
- * It is useful for identifying and processing different types of IFC elements in a project.
2177
- *
2178
- */
2179
- export declare const IfcElements: {
2180
- [key: number]: string;
2181
- };
2182
- /**
2183
- * 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.
2184
- */
2185
- export declare const IfcCategoryMap: {
2186
- [key: number]: string;
2187
- };
2188
- import * as FRAGS from "@thatopen/fragments";
2189
- export declare class IfcPropertiesUtils {
2190
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2191
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2192
- [attribute: string]: any;
2193
- } | null>;
2194
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2195
- [relatingID: number]: number[];
2196
- }>;
2197
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2198
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2199
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2200
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2201
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2202
- key: string | null;
2203
- name: string | null;
2204
- }>;
2205
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2206
- key: string | null;
2207
- value: number | null;
2208
- }>;
2209
- static isRel(expressID: number): boolean;
2210
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2211
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2212
- }
2213
2253
  import * as THREE from "three";
2214
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2254
+ import { Components } from "../../Components";
2255
+ import { Event, World, Disposable } from "../../Types";
2256
+ import { Mouse } from "./mouse";
2215
2257
  /**
2216
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2217
- *
2218
- * @template T - The type of the scene. Default is BaseScene.
2219
- * @template U - The type of the camera. Default is BaseCamera.
2220
- * @template S - The type of the renderer. Default is BaseRenderer.
2258
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2221
2259
  */
2222
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2260
+ export declare class SimpleRaycaster implements Disposable {
2261
+ /** {@link Component.enabled} */
2262
+ enabled: boolean;
2263
+ /** The components instance to which this Raycaster belongs. */
2264
+ components: Components;
2265
+ /** {@link Disposable.onDisposed} */
2266
+ readonly onDisposed: Event<unknown>;
2267
+ /** The position of the mouse in the screen. */
2268
+ readonly mouse: Mouse;
2223
2269
  /**
2224
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2225
- */
2270
+ * A reference to the Three.js Raycaster instance.
2271
+ * This is used for raycasting operations.
2272
+ */
2273
+ readonly three: THREE.Raycaster;
2274
+ /**
2275
+ * A reference to the world instance to which this Raycaster belongs.
2276
+ * This is used to access the camera and meshes.
2277
+ */
2278
+ world: World;
2279
+ constructor(components: Components, world: World);
2280
+ /** {@link Disposable.dispose} */
2281
+ dispose(): void;
2282
+ /**
2283
+ * Throws a ray from the camera to the mouse or touch event point and returns
2284
+ * the first item found. This also takes into account the clipping planes
2285
+ * used by the renderer.
2286
+ *
2287
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2288
+ * to query. If not provided, it will query all the meshes stored in
2289
+ * {@link Components.meshes}.
2290
+ */
2291
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2292
+ /**
2293
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2294
+ * This method also takes into account the clipping planes used by the renderer.
2295
+ *
2296
+ * @param origin - The origin of the ray.
2297
+ * @param direction - The direction of the ray.
2298
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2299
+ * @returns The first intersection found or 'null' if no intersection was found.
2300
+ */
2301
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
2302
+ private intersect;
2303
+ private filterClippingPlanes;
2304
+ }
2305
+ import * as THREE from "three";
2306
+ import { Disposable, Event } from "../../Types";
2307
+ /**
2308
+ * 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.
2309
+ */
2310
+ export declare class Mouse implements Disposable {
2311
+ dom: HTMLCanvasElement;
2312
+ private _event?;
2313
+ private _position;
2314
+ /** {@link Disposable.onDisposed} */
2315
+ readonly onDisposed: Event<unknown>;
2316
+ constructor(dom: HTMLCanvasElement);
2317
+ /**
2318
+ * The real position of the mouse of the Three.js canvas.
2319
+ */
2320
+ get position(): THREE.Vector2;
2321
+ /** {@link Disposable.dispose} */
2322
+ dispose(): void;
2323
+ private getPositionY;
2324
+ private getPositionX;
2325
+ private updateMouseInfo;
2326
+ private setupEvents;
2327
+ }
2328
+ import * as THREE from "three";
2329
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2330
+ /**
2331
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2332
+ *
2333
+ * @template T - The type of the scene. Default is BaseScene.
2334
+ * @template U - The type of the camera. Default is BaseCamera.
2335
+ * @template S - The type of the renderer. Default is BaseRenderer.
2336
+ */
2337
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2338
+ /**
2339
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2340
+ */
2226
2341
  readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2227
2342
  /** {@link Updateable.onAfterUpdate} */
2228
2343
  readonly onAfterUpdate: Event<unknown>;
@@ -2329,6 +2444,157 @@ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2329
2444
  setup(config?: Partial<SimpleSceneConfig>): void;
2330
2445
  }
2331
2446
  import * as THREE from "three";
2447
+ import { Components } from "../../Components";
2448
+ import { AsyncEvent, Event, World } from "../../Types";
2449
+ /**
2450
+ * Settings to configure the CullerRenderer.
2451
+ */
2452
+ export interface CullerRendererSettings {
2453
+ /**
2454
+ * Interval in milliseconds at which the visibility check should be performed.
2455
+ * Default value is 1000.
2456
+ */
2457
+ updateInterval?: number;
2458
+ /**
2459
+ * Width of the render target used for visibility checks.
2460
+ * Default value is 512.
2461
+ */
2462
+ width?: number;
2463
+ /**
2464
+ * Height of the render target used for visibility checks.
2465
+ * Default value is 512.
2466
+ */
2467
+ height?: number;
2468
+ /**
2469
+ * Whether the visibility check should be performed automatically.
2470
+ * Default value is true.
2471
+ */
2472
+ autoUpdate?: boolean;
2473
+ }
2474
+ /**
2475
+ * A base renderer to determine visibility on screen.
2476
+ */
2477
+ export declare class CullerRenderer {
2478
+ /** {@link Disposable.onDisposed} */
2479
+ readonly onDisposed: Event<string>;
2480
+ /**
2481
+ * Fires after making the visibility check to the meshes. It lists the
2482
+ * meshes that are currently visible, and the ones that were visible
2483
+ * just before but not anymore.
2484
+ */
2485
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2486
+ /**
2487
+ * Whether this renderer is active or not. If not, it won't render anything.
2488
+ */
2489
+ enabled: boolean;
2490
+ /**
2491
+ * Needs to check whether there are objects that need to be hidden or shown.
2492
+ * You can bind this to the camera movement, to a certain interval, etc.
2493
+ */
2494
+ needsUpdate: boolean;
2495
+ /**
2496
+ * Render the internal scene used to determine the object visibility. Used
2497
+ * for debugging purposes.
2498
+ */
2499
+ renderDebugFrame: boolean;
2500
+ /** The components instance to which this renderer belongs. */
2501
+ components: Components;
2502
+ /** The world instance to which this renderer belongs. */
2503
+ readonly world: World;
2504
+ /** The THREE.js renderer used to make the visibility test. */
2505
+ readonly renderer: THREE.WebGLRenderer;
2506
+ protected autoUpdate: boolean;
2507
+ protected updateInterval: number;
2508
+ protected readonly worker: Worker;
2509
+ protected readonly scene: THREE.Scene;
2510
+ private _width;
2511
+ private _height;
2512
+ private _availableColor;
2513
+ private readonly renderTarget;
2514
+ private readonly bufferSize;
2515
+ private readonly _buffer;
2516
+ protected _isWorkerBusy: boolean;
2517
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2518
+ /** {@link Disposable.dispose} */
2519
+ dispose(): void;
2520
+ /**
2521
+ * The function that the culler uses to reprocess the scene. Generally it's
2522
+ * better to call needsUpdate, but you can also call this to force it.
2523
+ * @param force if true, it will refresh the scene even if needsUpdate is
2524
+ * not true.
2525
+ */
2526
+ updateVisibility: (force?: boolean) => Promise<void>;
2527
+ protected getAvailableColor(): {
2528
+ r: number;
2529
+ g: number;
2530
+ b: number;
2531
+ code: string;
2532
+ };
2533
+ protected increaseColor(): void;
2534
+ protected decreaseColor(): void;
2535
+ private applySettings;
2536
+ }
2537
+ import * as THREE from "three";
2538
+ import { Hideable, Event, World, Disposable } from "../../Types";
2539
+ import { Components } from "../../Components";
2540
+ /**
2541
+ * Configuration interface for the {@link SimpleGrid} class.
2542
+ */
2543
+ export interface GridConfig {
2544
+ /**
2545
+ * The color of the grid lines.
2546
+ */
2547
+ color: THREE.Color;
2548
+ /**
2549
+ * The size of the primary grid lines.
2550
+ */
2551
+ size1: number;
2552
+ /**
2553
+ * The size of the secondary grid lines.
2554
+ */
2555
+ size2: number;
2556
+ /**
2557
+ * The distance at which the grid lines start to fade away.
2558
+ */
2559
+ distance: number;
2560
+ }
2561
+ /**
2562
+ * 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).
2563
+ */
2564
+ export declare class SimpleGrid implements Hideable, Disposable {
2565
+ /** {@link Disposable.onDisposed} */
2566
+ readonly onDisposed: Event<unknown>;
2567
+ /** The world instance to which this Raycaster belongs. */
2568
+ world: World;
2569
+ /** The components instance to which this grid belongs. */
2570
+ components: Components;
2571
+ /** {@link Hideable.visible} */
2572
+ get visible(): boolean;
2573
+ /** {@link Hideable.visible} */
2574
+ set visible(visible: boolean);
2575
+ /** The material of the grid. */
2576
+ get material(): THREE.ShaderMaterial;
2577
+ /**
2578
+ * Whether the grid should fade away with distance. Recommended to be true for
2579
+ * perspective cameras and false for orthographic cameras.
2580
+ */
2581
+ get fade(): boolean;
2582
+ /**
2583
+ * Whether the grid should fade away with distance. Recommended to be true for
2584
+ * perspective cameras and false for orthographic cameras.
2585
+ */
2586
+ set fade(active: boolean);
2587
+ /** The Three.js mesh that contains the infinite grid. */
2588
+ readonly three: THREE.Mesh;
2589
+ private _fade;
2590
+ constructor(components: Components, world: World, config: GridConfig);
2591
+ /** {@link Disposable.dispose} */
2592
+ dispose(): void;
2593
+ private setupEvents;
2594
+ private updateZoom;
2595
+ }
2596
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2597
+ import * as THREE from "three";
2332
2598
  import { BaseRenderer, Event } from "../../Types";
2333
2599
  import { Components } from "../../Components";
2334
2600
  /**
@@ -2445,33 +2711,158 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
2445
2711
  private static getSubsetOfThree;
2446
2712
  }
2447
2713
  import * as THREE from "three";
2448
- import CameraControls from "camera-controls";
2449
- import { Event } from "./event";
2714
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2715
+ import { Components } from "../../Components";
2716
+ import { Event, World, Disposable } from "../../Types";
2450
2717
  /**
2451
- * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2718
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2452
2719
  */
2453
- export interface Disposable {
2720
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2454
2721
  /**
2455
- * Destroys the object from memory to prevent a
2456
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2722
+ * Event triggered when the visibility of meshes is updated.
2723
+ * Contains two sets: seen and unseen.
2457
2724
  */
2458
- dispose: () => void | Promise<void>;
2459
- /** Fired after the tool has been disposed. */
2460
- readonly onDisposed: Event<any>;
2461
- }
2462
- /**
2463
- * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2464
- */
2465
- export interface Hideable {
2725
+ readonly onViewUpdated: Event<{
2726
+ seen: Set<THREE.Mesh>;
2727
+ unseen: Set<THREE.Mesh>;
2728
+ }>;
2466
2729
  /**
2467
- * Whether the geometric representation of this component is
2468
- * currently visible or not in the
2469
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2730
+ * Pixels in screen a geometry must occupy to be considered "seen".
2731
+ * Default value is 100.
2470
2732
  */
2471
- visible: boolean;
2472
- }
2473
- /**
2474
- * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2733
+ threshold: number;
2734
+ /**
2735
+ * Map of color code to THREE.InstancedMesh.
2736
+ * Used to keep track of color-coded meshes.
2737
+ */
2738
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2739
+ /**
2740
+ * Flag to indicate if the renderer is currently processing.
2741
+ * Used to prevent concurrent processing.
2742
+ */
2743
+ isProcessing: boolean;
2744
+ private _colorCodeMeshMap;
2745
+ private _meshIDColorCodeMap;
2746
+ private _currentVisibleMeshes;
2747
+ private _recentlyHiddenMeshes;
2748
+ private _intervalID;
2749
+ private readonly _transparentMat;
2750
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2751
+ /** {@link Disposable.dispose} */
2752
+ dispose(): void;
2753
+ /**
2754
+ * 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.
2755
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2756
+ * @returns {void}
2757
+ */
2758
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2759
+ /**
2760
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2761
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2762
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2763
+ * @returns {void}
2764
+ */
2765
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2766
+ private handleWorkerMessage;
2767
+ private getAvailableMaterial;
2768
+ }
2769
+ /**
2770
+ * 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.
2771
+ */
2772
+ export declare class Event<T> {
2773
+ /**
2774
+ * Add a callback to this event instance.
2775
+ * @param handler - the callback to be added to this event.
2776
+ */
2777
+ add(handler: T extends void ? {
2778
+ (): void;
2779
+ } : {
2780
+ (data: T): void;
2781
+ }): void;
2782
+ /**
2783
+ * Removes a callback from this event instance.
2784
+ * @param handler - the callback to be removed from this event.
2785
+ */
2786
+ remove(handler: T extends void ? {
2787
+ (): void;
2788
+ } : {
2789
+ (data: T): void;
2790
+ }): void;
2791
+ /** Triggers all the callbacks assigned to this event. */
2792
+ trigger: (data?: T) => void;
2793
+ /** Gets rid of all the suscribed events. */
2794
+ reset(): void;
2795
+ private handlers;
2796
+ }
2797
+ /**
2798
+ * 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.
2799
+ */
2800
+ export declare class AsyncEvent<T> {
2801
+ /**
2802
+ * Add a callback to this event instance.
2803
+ * @param handler - the callback to be added to this event.
2804
+ */
2805
+ add(handler: T extends void ? {
2806
+ (): Promise<void>;
2807
+ } : {
2808
+ (data: T): Promise<void>;
2809
+ }): void;
2810
+ /**
2811
+ * Removes a callback from this event instance.
2812
+ * @param handler - the callback to be removed from this event.
2813
+ */
2814
+ remove(handler: T extends void ? {
2815
+ (): Promise<void>;
2816
+ } : {
2817
+ (data: T): Promise<void>;
2818
+ }): void;
2819
+ /** Triggers all the callbacks assigned to this event. */
2820
+ trigger: (data?: T) => Promise<void>;
2821
+ /** Gets rid of all the suscribed events. */
2822
+ reset(): void;
2823
+ private handlers;
2824
+ }
2825
+ import { Base } from "./base";
2826
+ /**
2827
+ * 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.
2828
+ */
2829
+ export declare abstract class Component extends Base {
2830
+ /**
2831
+ * Whether this component is active or not. The behaviour can vary depending
2832
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2833
+ * dimensions, while a disabled camera will stop moving. A disabled component
2834
+ * will not be updated automatically each frame.
2835
+ */
2836
+ abstract enabled: boolean;
2837
+ }
2838
+ import * as THREE from "three";
2839
+ import CameraControls from "camera-controls";
2840
+ import { Event } from "./event";
2841
+ /**
2842
+ * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2843
+ */
2844
+ export interface Disposable {
2845
+ /**
2846
+ * Destroys the object from memory to prevent a
2847
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2848
+ */
2849
+ dispose: () => void | Promise<void>;
2850
+ /** Fired after the tool has been disposed. */
2851
+ readonly onDisposed: Event<any>;
2852
+ }
2853
+ /**
2854
+ * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2855
+ */
2856
+ export interface Hideable {
2857
+ /**
2858
+ * Whether the geometric representation of this component is
2859
+ * currently visible or not in the
2860
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2861
+ */
2862
+ visible: boolean;
2863
+ }
2864
+ /**
2865
+ * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2475
2866
  */
2476
2867
  export interface Resizeable {
2477
2868
  /**
@@ -2552,80 +2943,6 @@ export interface CameraControllable {
2552
2943
  */
2553
2944
  controls: CameraControls;
2554
2945
  }
2555
- /**
2556
- * 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.
2557
- */
2558
- export declare class Event<T> {
2559
- /**
2560
- * Add a callback to this event instance.
2561
- * @param handler - the callback to be added to this event.
2562
- */
2563
- add(handler: T extends void ? {
2564
- (): void;
2565
- } : {
2566
- (data: T): void;
2567
- }): void;
2568
- /**
2569
- * Removes a callback from this event instance.
2570
- * @param handler - the callback to be removed from this event.
2571
- */
2572
- remove(handler: T extends void ? {
2573
- (): void;
2574
- } : {
2575
- (data: T): void;
2576
- }): void;
2577
- /** Triggers all the callbacks assigned to this event. */
2578
- trigger: (data?: T) => void;
2579
- /** Gets rid of all the suscribed events. */
2580
- reset(): void;
2581
- private handlers;
2582
- }
2583
- import { Base } from "./base";
2584
- /**
2585
- * 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.
2586
- */
2587
- export declare abstract class Component extends Base {
2588
- /**
2589
- * Whether this component is active or not. The behaviour can vary depending
2590
- * on the type of component. E.g. a disabled dimension tool will stop creating
2591
- * dimensions, while a disabled camera will stop moving. A disabled component
2592
- * will not be updated automatically each frame.
2593
- */
2594
- abstract enabled: boolean;
2595
- }
2596
- import { InverseAttribute } from "./types";
2597
- export declare const relToAttributesMap: Map<number, {
2598
- forRelating: InverseAttribute;
2599
- forRelated: InverseAttribute;
2600
- }>;
2601
- /**
2602
- * 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.
2603
- */
2604
- export declare class AsyncEvent<T> {
2605
- /**
2606
- * Add a callback to this event instance.
2607
- * @param handler - the callback to be added to this event.
2608
- */
2609
- add(handler: T extends void ? {
2610
- (): Promise<void>;
2611
- } : {
2612
- (data: T): Promise<void>;
2613
- }): void;
2614
- /**
2615
- * Removes a callback from this event instance.
2616
- * @param handler - the callback to be removed from this event.
2617
- */
2618
- remove(handler: T extends void ? {
2619
- (): Promise<void>;
2620
- } : {
2621
- (data: T): Promise<void>;
2622
- }): void;
2623
- /** Triggers all the callbacks assigned to this event. */
2624
- trigger: (data?: T) => Promise<void>;
2625
- /** Gets rid of all the suscribed events. */
2626
- reset(): void;
2627
- private handlers;
2628
- }
2629
2946
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2630
2947
  import { Components } from "../../Components";
2631
2948
  /**
@@ -2645,29 +2962,6 @@ export declare abstract class Base {
2645
2962
  /** Whether is component is {@link Configurable}. */
2646
2963
  isConfigurable: () => this is Configurable<any>;
2647
2964
  }
2648
- import { Base } from "./base";
2649
- import { World } from "./world";
2650
- import { Event } from "./event";
2651
- import { Components } from "../../Components";
2652
- /**
2653
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2654
- */
2655
- export declare abstract class BaseWorldItem extends Base {
2656
- readonly worlds: Map<string, World>;
2657
- /**
2658
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2659
- * The event payload contains the world instance and the action ("added" or "removed").
2660
- */
2661
- readonly onWorldChanged: Event<{
2662
- world: World;
2663
- action: "added" | "removed";
2664
- }>;
2665
- /**
2666
- * The current world this item is associated with. It can be null if no world is currently active.
2667
- */
2668
- currentWorld: World | null;
2669
- protected constructor(components: Components);
2670
- }
2671
2965
  import * as THREE from "three";
2672
2966
  import CameraControls from "camera-controls";
2673
2967
  import { BaseWorldItem } from "./base-world-item";
@@ -2696,6 +2990,29 @@ export declare abstract class BaseCamera extends BaseWorldItem {
2696
2990
  */
2697
2991
  hasCameraControls: () => this is CameraControllable;
2698
2992
  }
2993
+ import { Base } from "./base";
2994
+ import { World } from "./world";
2995
+ import { Event } from "./event";
2996
+ import { Components } from "../../Components";
2997
+ /**
2998
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2999
+ */
3000
+ export declare abstract class BaseWorldItem extends Base {
3001
+ readonly worlds: Map<string, World>;
3002
+ /**
3003
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
3004
+ * The event payload contains the world instance and the action ("added" or "removed").
3005
+ */
3006
+ readonly onWorldChanged: Event<{
3007
+ world: World;
3008
+ action: "added" | "removed";
3009
+ }>;
3010
+ /**
3011
+ * The current world this item is associated with. It can be null if no world is currently active.
3012
+ */
3013
+ currentWorld: World | null;
3014
+ protected constructor(components: Components);
3015
+ }
2699
3016
  import * as THREE from "three";
2700
3017
  import { Vector2 } from "three";
2701
3018
  import { Event } from "./event";
@@ -2781,322 +3098,76 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
2781
3098
  /** {@link Disposable.dispose} */
2782
3099
  dispose(): void;
2783
3100
  }
2784
- import * as THREE from "three";
2785
- import { BaseScene } from "./base-scene";
2786
- import { BaseCamera } from "./base-camera";
2787
- import { BaseRenderer } from "./base-renderer";
2788
- import { Updateable, Disposable } from "./interfaces";
2789
- /**
2790
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2791
- */
2792
- export interface World extends Disposable, Updateable {
2793
- /**
2794
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2795
- */
2796
- meshes: Set<THREE.Mesh>;
2797
- /**
2798
- * The base scene of the world.
2799
- */
2800
- scene: BaseScene;
2801
- /**
2802
- * The base camera of the world.
2803
- */
2804
- camera: BaseCamera;
2805
- /**
2806
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2807
- */
2808
- renderer: BaseRenderer | null;
2809
- /**
2810
- * A unique identifier for the world.
2811
- */
2812
- uuid: string;
2813
- /**
2814
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2815
- */
2816
- isDisposing: boolean;
2817
- }
2818
- import * as THREE from "three";
2819
- import { Components } from "../../Components";
2820
- import { Event, World, Disposable } from "../../Types";
2821
- import { Mouse } from "./mouse";
3101
+ import { NavigationMode } from "./types";
3102
+ import { OrthoPerspectiveCamera } from "../index";
2822
3103
  /**
2823
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
3104
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2824
3105
  */
2825
- export declare class SimpleRaycaster implements Disposable {
2826
- /** {@link Component.enabled} */
3106
+ export declare class PlanMode implements NavigationMode {
3107
+ private camera;
3108
+ /** {@link NavigationMode.enabled} */
2827
3109
  enabled: boolean;
2828
- /** The components instance to which this Raycaster belongs. */
2829
- components: Components;
2830
- /** {@link Disposable.onDisposed} */
2831
- readonly onDisposed: Event<unknown>;
2832
- /** The position of the mouse in the screen. */
2833
- readonly mouse: Mouse;
2834
- /**
2835
- * A reference to the Three.js Raycaster instance.
2836
- * This is used for raycasting operations.
2837
- */
2838
- readonly three: THREE.Raycaster;
2839
- /**
2840
- * A reference to the world instance to which this Raycaster belongs.
2841
- * This is used to access the camera and meshes.
2842
- */
2843
- world: World;
2844
- constructor(components: Components, world: World);
2845
- /** {@link Disposable.dispose} */
2846
- dispose(): void;
2847
- /**
2848
- * Throws a ray from the camera to the mouse or touch event point and returns
2849
- * the first item found. This also takes into account the clipping planes
2850
- * used by the renderer.
2851
- *
2852
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2853
- * to query. If not provided, it will query all the meshes stored in
2854
- * {@link Components.meshes}.
2855
- */
2856
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2857
- /**
2858
- * Casts a ray from a given origin in a given direction and returns the first item found.
2859
- * This method also takes into account the clipping planes used by the renderer.
2860
- *
2861
- * @param origin - The origin of the ray.
2862
- * @param direction - The direction of the ray.
2863
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2864
- * @returns The first intersection found or 'null' if no intersection was found.
2865
- */
2866
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
2867
- private intersect;
2868
- private filterClippingPlanes;
2869
- }
2870
- import * as THREE from "three";
2871
- import { Hideable, Event, World, Disposable } from "../../Types";
2872
- import { Components } from "../../Components";
2873
- /**
2874
- * Configuration interface for the {@link SimpleGrid} class.
2875
- */
2876
- export interface GridConfig {
2877
- /**
2878
- * The color of the grid lines.
2879
- */
2880
- color: THREE.Color;
2881
- /**
2882
- * The size of the primary grid lines.
2883
- */
2884
- size1: number;
2885
- /**
2886
- * The size of the secondary grid lines.
2887
- */
2888
- size2: number;
2889
- /**
2890
- * The distance at which the grid lines start to fade away.
2891
- */
2892
- distance: number;
2893
- }
2894
- /**
2895
- * 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).
2896
- */
2897
- export declare class SimpleGrid implements Hideable, Disposable {
2898
- /** {@link Disposable.onDisposed} */
2899
- readonly onDisposed: Event<unknown>;
2900
- /** The world instance to which this Raycaster belongs. */
2901
- world: World;
2902
- /** The components instance to which this grid belongs. */
2903
- components: Components;
2904
- /** {@link Hideable.visible} */
2905
- get visible(): boolean;
2906
- /** {@link Hideable.visible} */
2907
- set visible(visible: boolean);
2908
- /** The material of the grid. */
2909
- get material(): THREE.ShaderMaterial;
2910
- /**
2911
- * Whether the grid should fade away with distance. Recommended to be true for
2912
- * perspective cameras and false for orthographic cameras.
2913
- */
2914
- get fade(): boolean;
2915
- /**
2916
- * Whether the grid should fade away with distance. Recommended to be true for
2917
- * perspective cameras and false for orthographic cameras.
2918
- */
2919
- set fade(active: boolean);
2920
- /** The Three.js mesh that contains the infinite grid. */
2921
- readonly three: THREE.Mesh;
2922
- private _fade;
2923
- constructor(components: Components, world: World, config: GridConfig);
2924
- /** {@link Disposable.dispose} */
2925
- dispose(): void;
2926
- private setupEvents;
2927
- private updateZoom;
2928
- }
2929
- import * as THREE from "three";
2930
- import { Disposable, Event } from "../../Types";
2931
- /**
2932
- * 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.
2933
- */
2934
- export declare class Mouse implements Disposable {
2935
- dom: HTMLCanvasElement;
2936
- private _event?;
2937
- private _position;
2938
- /** {@link Disposable.onDisposed} */
2939
- readonly onDisposed: Event<unknown>;
2940
- constructor(dom: HTMLCanvasElement);
2941
- /**
2942
- * The real position of the mouse of the Three.js canvas.
2943
- */
2944
- get position(): THREE.Vector2;
2945
- /** {@link Disposable.dispose} */
2946
- dispose(): void;
2947
- private getPositionY;
2948
- private getPositionX;
2949
- private updateMouseInfo;
2950
- private setupEvents;
3110
+ /** {@link NavigationMode.id} */
3111
+ readonly id = "Plan";
3112
+ private mouseAction1?;
3113
+ private mouseAction2?;
3114
+ private mouseInitialized;
3115
+ private readonly defaultAzimuthSpeed;
3116
+ private readonly defaultPolarSpeed;
3117
+ constructor(camera: OrthoPerspectiveCamera);
3118
+ /** {@link NavigationMode.set} */
3119
+ set(active: boolean): void;
2951
3120
  }
2952
- import * as THREE from "three";
2953
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2954
- import { Components } from "../../Components";
2955
- import { Event, World, Disposable } from "../../Types";
3121
+ import { NavigationMode } from "./types";
3122
+ import { OrthoPerspectiveCamera } from "../index";
2956
3123
  /**
2957
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3124
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2958
3125
  */
2959
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2960
- /**
2961
- * Event triggered when the visibility of meshes is updated.
2962
- * Contains two sets: seen and unseen.
2963
- */
2964
- readonly onViewUpdated: Event<{
2965
- seen: Set<THREE.Mesh>;
2966
- unseen: Set<THREE.Mesh>;
2967
- }>;
2968
- /**
2969
- * Pixels in screen a geometry must occupy to be considered "seen".
2970
- * Default value is 100.
2971
- */
2972
- threshold: number;
2973
- /**
2974
- * Map of color code to THREE.InstancedMesh.
2975
- * Used to keep track of color-coded meshes.
2976
- */
2977
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2978
- /**
2979
- * Flag to indicate if the renderer is currently processing.
2980
- * Used to prevent concurrent processing.
2981
- */
2982
- isProcessing: boolean;
2983
- private _colorCodeMeshMap;
2984
- private _meshIDColorCodeMap;
2985
- private _currentVisibleMeshes;
2986
- private _recentlyHiddenMeshes;
2987
- private _intervalID;
2988
- private readonly _transparentMat;
2989
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2990
- /** {@link Disposable.dispose} */
2991
- dispose(): void;
2992
- /**
2993
- * 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.
2994
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2995
- * @returns {void}
2996
- */
2997
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2998
- /**
2999
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3000
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3001
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3002
- * @returns {void}
3003
- */
3004
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3005
- private handleWorkerMessage;
3006
- private getAvailableMaterial;
3126
+ export declare class FirstPersonMode implements NavigationMode {
3127
+ private camera;
3128
+ /** {@link NavigationMode.enabled} */
3129
+ enabled: boolean;
3130
+ /** {@link NavigationMode.id} */
3131
+ readonly id = "FirstPerson";
3132
+ constructor(camera: OrthoPerspectiveCamera);
3133
+ /** {@link NavigationMode.set} */
3134
+ set(active: boolean): void;
3135
+ private setupFirstPersonCamera;
3007
3136
  }
3008
3137
  import * as THREE from "three";
3009
- import { Components } from "../../Components";
3010
- import { AsyncEvent, Event, World } from "../../Types";
3138
+ import { BaseScene } from "./base-scene";
3139
+ import { BaseCamera } from "./base-camera";
3140
+ import { BaseRenderer } from "./base-renderer";
3141
+ import { Updateable, Disposable } from "./interfaces";
3011
3142
  /**
3012
- * Settings to configure the CullerRenderer.
3143
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3013
3144
  */
3014
- export interface CullerRendererSettings {
3015
- /**
3016
- * Interval in milliseconds at which the visibility check should be performed.
3017
- * Default value is 1000.
3018
- */
3019
- updateInterval?: number;
3020
- /**
3021
- * Width of the render target used for visibility checks.
3022
- * Default value is 512.
3023
- */
3024
- width?: number;
3025
- /**
3026
- * Height of the render target used for visibility checks.
3027
- * Default value is 512.
3028
- */
3029
- height?: number;
3145
+ export interface World extends Disposable, Updateable {
3030
3146
  /**
3031
- * Whether the visibility check should be performed automatically.
3032
- * Default value is true.
3147
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
3033
3148
  */
3034
- autoUpdate?: boolean;
3035
- }
3036
- /**
3037
- * A base renderer to determine visibility on screen.
3038
- */
3039
- export declare class CullerRenderer {
3040
- /** {@link Disposable.onDisposed} */
3041
- readonly onDisposed: Event<string>;
3042
- /**
3043
- * Fires after making the visibility check to the meshes. It lists the
3044
- * meshes that are currently visible, and the ones that were visible
3045
- * just before but not anymore.
3149
+ meshes: Set<THREE.Mesh>;
3150
+ /**
3151
+ * The base scene of the world.
3046
3152
  */
3047
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3153
+ scene: BaseScene;
3048
3154
  /**
3049
- * Whether this renderer is active or not. If not, it won't render anything.
3155
+ * The base camera of the world.
3050
3156
  */
3051
- enabled: boolean;
3157
+ camera: BaseCamera;
3052
3158
  /**
3053
- * Needs to check whether there are objects that need to be hidden or shown.
3054
- * You can bind this to the camera movement, to a certain interval, etc.
3159
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3055
3160
  */
3056
- needsUpdate: boolean;
3161
+ renderer: BaseRenderer | null;
3057
3162
  /**
3058
- * Render the internal scene used to determine the object visibility. Used
3059
- * for debugging purposes.
3163
+ * A unique identifier for the world.
3060
3164
  */
3061
- renderDebugFrame: boolean;
3062
- /** The components instance to which this renderer belongs. */
3063
- components: Components;
3064
- /** The world instance to which this renderer belongs. */
3065
- readonly world: World;
3066
- /** The THREE.js renderer used to make the visibility test. */
3067
- readonly renderer: THREE.WebGLRenderer;
3068
- protected autoUpdate: boolean;
3069
- protected updateInterval: number;
3070
- protected readonly worker: Worker;
3071
- protected readonly scene: THREE.Scene;
3072
- private _width;
3073
- private _height;
3074
- private _availableColor;
3075
- private readonly renderTarget;
3076
- private readonly bufferSize;
3077
- private readonly _buffer;
3078
- protected _isWorkerBusy: boolean;
3079
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3080
- /** {@link Disposable.dispose} */
3081
- dispose(): void;
3165
+ uuid: string;
3082
3166
  /**
3083
- * The function that the culler uses to reprocess the scene. Generally it's
3084
- * better to call needsUpdate, but you can also call this to force it.
3085
- * @param force if true, it will refresh the scene even if needsUpdate is
3086
- * not true.
3167
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3087
3168
  */
3088
- updateVisibility: (force?: boolean) => Promise<void>;
3089
- protected getAvailableColor(): {
3090
- r: number;
3091
- g: number;
3092
- b: number;
3093
- code: string;
3094
- };
3095
- protected increaseColor(): void;
3096
- protected decreaseColor(): void;
3097
- private applySettings;
3169
+ isDisposing: boolean;
3098
3170
  }
3099
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3100
3171
  import { NavigationMode } from "./types";
3101
3172
  import { OrthoPerspectiveCamera } from "../index";
3102
3173
  /**
@@ -3113,21 +3184,31 @@ export declare class OrbitMode implements NavigationMode {
3113
3184
  set(active: boolean): void;
3114
3185
  private activateOrbitControls;
3115
3186
  }
3116
- import { NavigationMode } from "./types";
3117
- import { OrthoPerspectiveCamera } from "../index";
3118
3187
  /**
3119
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3188
+ * The projection system of the camera.
3120
3189
  */
3121
- export declare class FirstPersonMode implements NavigationMode {
3122
- private camera;
3123
- /** {@link NavigationMode.enabled} */
3190
+ export type CameraProjection = "Perspective" | "Orthographic";
3191
+ /**
3192
+ * The extensible list of supported navigation modes.
3193
+ */
3194
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3195
+ /**
3196
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3197
+ */
3198
+ export interface NavigationMode {
3199
+ /** The unique ID of this navigation mode. */
3200
+ id: NavModeID;
3201
+ /**
3202
+ * Enable or disable this navigation mode.
3203
+ * When a new navigation mode is enabled, the previous navigation mode
3204
+ * must be disabled.
3205
+ *
3206
+ * @param active - whether to enable or disable this mode.
3207
+ * @param options - any additional data required to enable or disable it.
3208
+ * */
3209
+ set: (active: boolean, options?: any) => void;
3210
+ /** Whether this navigation mode is active or not. */
3124
3211
  enabled: boolean;
3125
- /** {@link NavigationMode.id} */
3126
- readonly id = "FirstPerson";
3127
- constructor(camera: OrthoPerspectiveCamera);
3128
- /** {@link NavigationMode.set} */
3129
- set(active: boolean): void;
3130
- private setupFirstPersonCamera;
3131
3212
  }
3132
3213
  import * as THREE from "three";
3133
3214
  import { CameraProjection } from "./types";
@@ -3174,52 +3255,6 @@ export declare class ProjectionManager {
3174
3255
  private getDistance;
3175
3256
  private setPerspectiveCamera;
3176
3257
  }
3177
- /**
3178
- * The projection system of the camera.
3179
- */
3180
- export type CameraProjection = "Perspective" | "Orthographic";
3181
- /**
3182
- * The extensible list of supported navigation modes.
3183
- */
3184
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3185
- /**
3186
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3187
- */
3188
- export interface NavigationMode {
3189
- /** The unique ID of this navigation mode. */
3190
- id: NavModeID;
3191
- /**
3192
- * Enable or disable this navigation mode.
3193
- * When a new navigation mode is enabled, the previous navigation mode
3194
- * must be disabled.
3195
- *
3196
- * @param active - whether to enable or disable this mode.
3197
- * @param options - any additional data required to enable or disable it.
3198
- * */
3199
- set: (active: boolean, options?: any) => void;
3200
- /** Whether this navigation mode is active or not. */
3201
- enabled: boolean;
3202
- }
3203
- import { NavigationMode } from "./types";
3204
- import { OrthoPerspectiveCamera } from "../index";
3205
- /**
3206
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3207
- */
3208
- export declare class PlanMode implements NavigationMode {
3209
- private camera;
3210
- /** {@link NavigationMode.enabled} */
3211
- enabled: boolean;
3212
- /** {@link NavigationMode.id} */
3213
- readonly id = "Plan";
3214
- private mouseAction1?;
3215
- private mouseAction2?;
3216
- private mouseInitialized;
3217
- private readonly defaultAzimuthSpeed;
3218
- private readonly defaultPolarSpeed;
3219
- constructor(camera: OrthoPerspectiveCamera);
3220
- /** {@link NavigationMode.set} */
3221
- set(active: boolean): void;
3222
- }
3223
3258
  import * as THREE from "three";
3224
3259
  import { Hideable, Disposable, Event, World } from "../../Types";
3225
3260
  import { Components } from "../../Components";
@@ -3317,32 +3352,6 @@ export declare class SimplePlane implements Disposable, Hideable {
3317
3352
  private newHelper;
3318
3353
  private static newPlaneMesh;
3319
3354
  }
3320
- import * as THREE from "three";
3321
- import * as WEBIFC from "web-ifc";
3322
- import * as FRAGS from "@thatopen/fragments";
3323
- export declare class CivilReader {
3324
- defLineMat: THREE.LineBasicMaterial;
3325
- read(webIfc: WEBIFC.IfcAPI): {
3326
- alignments: Map<number, FRAGS.Alignment>;
3327
- coordinationMatrix: THREE.Matrix4;
3328
- } | undefined;
3329
- get(civilItems: any): {
3330
- alignments: Map<number, FRAGS.Alignment>;
3331
- coordinationMatrix: THREE.Matrix4;
3332
- } | undefined;
3333
- private getCurves;
3334
- }
3335
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3336
- /**
3337
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3338
- */
3339
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3340
- /**
3341
- * Amount of properties to be streamed.
3342
- * Defaults to 100 properties.
3343
- */
3344
- propertiesSize: number;
3345
- }
3346
3355
  import * as WEBIFC from "web-ifc";
3347
3356
  export declare class IfcMetadataReader {
3348
3357
  getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
@@ -3364,44 +3373,31 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3364
3373
  */
3365
3374
  minAssetsSize: number;
3366
3375
  }
3367
- export type RelationsMap = Map<number, Map<number, number[]>>;
3368
- export interface ModelsRelationMap {
3369
- [modelID: string]: RelationsMap;
3370
- }
3376
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3371
3377
  /**
3372
- * Type alias for an array of inverse attribute names.
3378
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3373
3379
  */
3374
- export type InverseAttributes = [
3375
- "IsDecomposedBy",
3376
- "Decomposes",
3377
- "AssociatedTo",
3378
- "HasAssociations",
3379
- "ClassificationForObjects",
3380
- "IsGroupedBy",
3381
- "HasAssignments",
3382
- "IsDefinedBy",
3383
- "DefinesOcurrence",
3384
- "IsTypedBy",
3385
- "Types",
3386
- "Defines",
3387
- "ContainedInStructure",
3388
- "ContainsElements"
3389
- ];
3390
- export type InverseAttribute = InverseAttributes[number];
3391
- import { BufferGeometry } from "three";
3392
- import * as THREE from "three";
3393
- export declare class TransformHelper {
3394
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3380
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3381
+ /**
3382
+ * Amount of properties to be streamed.
3383
+ * Defaults to 100 properties.
3384
+ */
3385
+ propertiesSize: number;
3395
3386
  }
3396
- import * as WEBIFC from "web-ifc";
3397
3387
  import * as THREE from "three";
3398
- export declare class Units {
3399
- factor: number;
3400
- complement: number;
3401
- apply(matrix: THREE.Matrix4): void;
3402
- setUp(webIfc: WEBIFC.IfcAPI): void;
3403
- private getLengthUnits;
3404
- private getScaleMatrix;
3388
+ import * as WEBIFC from "web-ifc";
3389
+ import * as FRAGS from "@thatopen/fragments";
3390
+ export declare class CivilReader {
3391
+ defLineMat: THREE.LineBasicMaterial;
3392
+ read(webIfc: WEBIFC.IfcAPI): {
3393
+ alignments: Map<number, FRAGS.Alignment>;
3394
+ coordinationMatrix: THREE.Matrix4;
3395
+ } | undefined;
3396
+ get(civilItems: any): {
3397
+ alignments: Map<number, FRAGS.Alignment>;
3398
+ coordinationMatrix: THREE.Matrix4;
3399
+ } | undefined;
3400
+ private getCurves;
3405
3401
  }
3406
3402
  /**
3407
3403
  * 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.
@@ -3432,5 +3428,44 @@ export interface StreamedAsset {
3432
3428
  color: number[];
3433
3429
  }[];
3434
3430
  }
3431
+ import * as WEBIFC from "web-ifc";
3432
+ import * as THREE from "three";
3433
+ export declare class Units {
3434
+ factor: number;
3435
+ complement: number;
3436
+ apply(matrix: THREE.Matrix4): void;
3437
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3438
+ private getLengthUnits;
3439
+ private getScaleMatrix;
3440
+ }
3441
+ export type RelationsMap = Map<number, Map<number, number[]>>;
3442
+ export interface ModelsRelationMap {
3443
+ [modelID: string]: RelationsMap;
3444
+ }
3445
+ /**
3446
+ * Type alias for an array of inverse attribute names.
3447
+ */
3448
+ export type InverseAttributes = [
3449
+ "IsDecomposedBy",
3450
+ "Decomposes",
3451
+ "AssociatedTo",
3452
+ "HasAssociations",
3453
+ "ClassificationForObjects",
3454
+ "IsGroupedBy",
3455
+ "HasAssignments",
3456
+ "IsDefinedBy",
3457
+ "DefinesOcurrence",
3458
+ "IsTypedBy",
3459
+ "Types",
3460
+ "Defines",
3461
+ "ContainedInStructure",
3462
+ "ContainsElements"
3463
+ ];
3464
+ export type InverseAttribute = InverseAttributes[number];
3465
+ import { BufferGeometry } from "three";
3466
+ import * as THREE from "three";
3467
+ export declare class TransformHelper {
3468
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3469
+ }
3435
3470
 
3436
3471
  }