@thatopen/components 2.1.12 → 2.1.13

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,1489 +1,1594 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event, Components } from "../../core";
2
+ import * as THREE from "three";
3
+ import { Components } from "../Components";
4
+ import { Component } from "../Types";
3
5
  /**
4
- * 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).
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).
5
7
  */
6
- export declare class Exploder extends Component implements Disposable {
7
- /**
8
- * A unique identifier for the component.
9
- * This UUID is used to register the component within the Components system.
10
- */
11
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
12
- /** {@link Disposable.onDisposed} */
13
- readonly onDisposed: Event<unknown>;
8
+ export declare class Disposer extends Component {
9
+ private _disposedComponents;
14
10
  /** {@link Component.enabled} */
15
11
  enabled: boolean;
16
12
  /**
17
- * The height of the explosion animation.
18
- * This property determines the vertical distance by which fragments are moved during the explosion.
19
- * Default value is 10.
20
- */
21
- height: number;
22
- /**
23
- * The group name used for the explosion animation.
24
- * This property specifies the group of fragments that will be affected by the explosion.
25
- * Default value is "storeys".
13
+ * A unique identifier for the component.
14
+ * This UUID is used to register the component within the Components system.
26
15
  */
27
- groupName: string;
16
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
17
+ constructor(components: Components);
28
18
  /**
29
- * A set of strings representing the exploded items.
30
- * This set is used to keep track of which items have been exploded.
19
+ * Return the UUIDs of all disposed components.
31
20
  */
32
- list: Set<string>;
33
- constructor(components: Components);
34
- /** {@link Disposable.dispose} */
35
- dispose(): void;
21
+ get(): Set<string>;
36
22
  /**
37
- * Sets the explosion state of the fragments.
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.
38
26
  *
39
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
27
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
+ * to remove.
40
29
  *
41
- * @remarks
42
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
43
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
44
- * If 'active' is false, the fragments are moved back to their original position.
30
+ * @param materials - whether to dispose the materials of the mesh.
45
31
  *
46
- * The method also keeps track of the exploded items using the 'list' set.
32
+ * @param recursive - whether to recursively dispose the children of the mesh.
33
+ */
34
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
35
+ /**
36
+ * Disposes a geometry from memory.
47
37
  *
48
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
38
+ * @param geometry - the
39
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
+ * to remove.
49
41
  */
50
- set(active: boolean): void;
42
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
43
+ private disposeGeometryAndMaterials;
44
+ private disposeChildren;
45
+ private static disposeMaterial;
51
46
  }
52
- import * as THREE from "three";
53
- import * as FRAGS from "@thatopen/fragments";
54
- import { FragmentsGroup } from "@thatopen/fragments";
55
- import { Component, Components, Disposable, Event } from "../../core";
47
+ import { Component, Disposable, Event } from "../Types";
56
48
  /**
57
- * 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).
49
+ * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
58
50
  */
59
- export declare class BoundingBoxer extends Component implements Disposable {
60
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
61
- /** {@link Component.enabled} */
62
- enabled: boolean;
51
+ export declare class Components implements Disposable {
52
+ /**
53
+ * The version of the @thatopen/components library.
54
+ */
55
+ static readonly release = "2.1.13";
63
56
  /** {@link Disposable.onDisposed} */
64
- readonly onDisposed: Event<unknown>;
65
- private _absoluteMin;
66
- private _absoluteMax;
67
- private _meshes;
68
- constructor(components: Components);
57
+ readonly onDisposed: Event<void>;
69
58
  /**
70
- * A static method to calculate the dimensions of a given bounding box.
71
- *
72
- * @param bbox - The bounding box to calculate the dimensions for.
73
- * @returns An object containing the width, height, depth, and center of the bounding box.
59
+ * The list of components created in this app.
60
+ * The keys are UUIDs and the values are instances of the components.
74
61
  */
75
- static getDimensions(bbox: THREE.Box3): {
76
- width: number;
77
- height: number;
78
- depth: number;
79
- center: THREE.Vector3;
80
- };
62
+ readonly list: Map<string, Component>;
81
63
  /**
82
- * A static method to create a new bounding box boundary.
83
- *
84
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
85
- * @returns A new THREE.Vector3 representing the boundary.
64
+ * If disabled, the animation loop will be stopped.
65
+ * Default value is false.
66
+ */
67
+ enabled: boolean;
68
+ private _clock;
69
+ /**
70
+ * Adds a component to the list of components.
71
+ * Throws an error if a component with the same UUID already exists.
86
72
  *
87
- * @remarks
88
- * This method is used to create a new boundary for calculating bounding boxes.
89
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
90
- * depending on the value of the 'positive' parameter.
73
+ * @param uuid - The unique identifier of the component.
74
+ * @param instance - The instance of the component to be added.
91
75
  *
92
- * @example
93
- * '''typescript
94
- * const positiveBound = BoundingBoxer.newBound(true);
95
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
76
+ * @throws Will throw an error if a component with the same UUID already exists.
96
77
  *
97
- * const negativeBound = BoundingBoxer.newBound(false);
98
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
99
- * '''
78
+ * @internal
100
79
  */
101
- static newBound(positive: boolean): THREE.Vector3;
80
+ add(uuid: string, instance: Component): void;
102
81
  /**
103
- * A static method to calculate the bounding box of a set of points.
82
+ * Retrieves a component instance by its constructor function.
83
+ * If the component does not exist in the list, it will be created and added.
104
84
  *
105
- * @param points - An array of THREE.Vector3 representing the points.
106
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
107
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
108
- * @returns A THREE.Box3 representing the bounding box of the given points.
85
+ * @template U - The type of the component to retrieve.
86
+ * @param Component - The constructor function of the component to retrieve.
109
87
  *
110
- * @remarks
111
- * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
112
- * 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.
88
+ * @returns The instance of the requested component.
113
89
  *
114
- * @example
115
- * '''typescript
116
- * const points = [
117
- * new THREE.Vector3(1, 2, 3),
118
- * new THREE.Vector3(4, 5, 6),
119
- * new THREE.Vector3(7, 8, 9),
120
- * ];
90
+ * @throws Will throw an error if a component with the same UUID already exists.
121
91
  *
122
- * const bbox = BoundingBoxer.getBounds(points);
123
- * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
124
- * '''
92
+ * @internal
125
93
  */
126
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
127
- /** {@link Disposable.dispose} */
128
- dispose(): void;
94
+ get<U extends Component>(Component: new (components: Components) => U): U;
95
+ constructor();
129
96
  /**
130
- * Returns the bounding box of the calculated fragments.
131
- *
132
- * @returns A new THREE.Box3 instance representing the bounding box.
133
- *
134
- * @remarks
135
- * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
136
- * The returned box represents the bounding box of the calculated fragments.
97
+ * Initializes the Components instance.
98
+ * This method starts the animation loop, sets the enabled flag to true,
99
+ * and calls the update method.
137
100
  *
138
- * @example
139
- * '''typescript
140
- * const boundingBox = boundingBoxer.get();
141
- * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
142
- * '''
101
+ * @returns {void}
143
102
  */
144
- get(): THREE.Box3;
103
+ init(): void;
145
104
  /**
146
- * Calculates and returns a sphere that encompasses the entire bounding box.
105
+ * Disposes the memory of all the components and tools of this instance of
106
+ * the library. A memory leak will be created if:
147
107
  *
148
- * @returns A new THREE.Sphere instance representing the calculated sphere.
108
+ * - An instance of the library ends up out of scope and this function isn't
109
+ * called. This is especially relevant in Single Page Applications (React,
110
+ * Angular, Vue, etc).
149
111
  *
150
- * @remarks
151
- * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
152
- * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
153
- * The radius is calculated as the distance from the center to the minimum bound.
112
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
113
+ * referenced by a reference type (object or array).
114
+ *
115
+ * You can learn more about how Three.js handles memory leaks
116
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
154
117
  *
155
- * @example
156
- * '''typescript
157
- * const boundingBoxer = components.get(BoundingBoxer);
158
- * boundingBoxer.add(fragmentsGroup);
159
- * const boundingSphere = boundingBoxer.getSphere();
160
- * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
161
- * '''
162
118
  */
163
- getSphere(): THREE.Sphere;
119
+ dispose(): void;
120
+ private update;
121
+ private static setupBVH;
122
+ }
123
+ import { Components } from "../Components";
124
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
125
+ import { Component, Event, Disposable, World } from "../Types";
126
+ /**
127
+ * 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).
128
+ */
129
+ export declare class Cullers extends Component implements Disposable {
164
130
  /**
165
- * Returns a THREE.Mesh instance representing the bounding box.
166
- *
167
- * @returns A new THREE.Mesh instance representing the bounding box.
131
+ * A unique identifier for the component.
132
+ * This UUID is used to register the component within the Components system.
133
+ */
134
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
135
+ /**
136
+ * An event that is triggered when the Cullers component is disposed.
137
+ */
138
+ readonly onDisposed: Event<unknown>;
139
+ private _enabled;
140
+ /**
141
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
142
+ */
143
+ list: Map<string, MeshCullerRenderer>;
144
+ /** {@link Component.enabled} */
145
+ get enabled(): boolean;
146
+ /** {@link Component.enabled} */
147
+ set enabled(value: boolean);
148
+ constructor(components: Components);
149
+ /**
150
+ * Creates a new MeshCullerRenderer for the given world.
151
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
168
152
  *
169
- * @remarks
170
- * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
171
- * It then creates a new THREE.BoxGeometry with the calculated dimensions.
172
- * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
173
- * The position of the mesh is set to the center of the bounding box.
153
+ * @param world - The world for which to create the MeshCullerRenderer.
154
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
174
155
  *
175
- * @example
176
- * '''typescript
177
- * const boundingBoxer = components.get(BoundingBoxer);
178
- * boundingBoxer.add(fragmentsGroup);
179
- * const boundingBoxMesh = boundingBoxer.getMesh();
180
- * scene.add(boundingBoxMesh);
181
- * '''
156
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
182
157
  */
183
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
158
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
184
159
  /**
185
- * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
186
- * This method is used to prepare the BoundingBoxer for a new set of fragments.
160
+ * Deletes the MeshCullerRenderer associated with the given world.
161
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
187
162
  *
188
- * @remarks
189
- * This method is called when a new set of fragments is added to the BoundingBoxer.
190
- * It ensures that the bounding box calculations are accurate and up-to-date.
191
- *
192
- * @example
193
- * '''typescript
194
- * const boundingBoxer = components.get(BoundingBoxer);
195
- * boundingBoxer.add(fragmentsGroup);
196
- * // ...
197
- * boundingBoxer.reset();
198
- * '''
199
- */
200
- reset(): void;
201
- /**
202
- * Adds a FragmentsGroup to the BoundingBoxer.
203
- *
204
- * @param group - The FragmentsGroup to add.
205
- *
206
- * @remarks
207
- * This method iterates through each fragment in the provided FragmentsGroup,
208
- * and calls the 'addMesh' method for each fragment's mesh.
209
- *
210
- * @example
211
- * '''typescript
212
- * const boundingBoxer = components.get(BoundingBoxer);
213
- * boundingBoxer.add(fragmentsGroup);
214
- * '''
215
- */
216
- add(group: FragmentsGroup): void;
217
- /**
218
- * Adds a mesh to the BoundingBoxer and calculates the bounding box.
219
- *
220
- * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
221
- * @param itemIDs - An optional iterable of numbers representing the item IDs.
222
- *
223
- * @remarks
224
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
225
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
226
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
227
- *
228
- * @example
229
- * '''typescript
230
- * const boundingBoxer = components.get(BoundingBoxer);
231
- * boundingBoxer.addMesh(mesh);
232
- * '''
233
- */
234
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
235
- /**
236
- * Uses a FragmentIdMap to add its meshes to the bb calculation.
237
- *
238
- * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
239
- * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
240
- *
241
- * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
242
- *
243
- * @remarks
244
- * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
245
- * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
163
+ * @param world - The world for which to delete the MeshCullerRenderer.
246
164
  *
247
- * @example
248
- * '''typescript
249
- * const boundingBoxer = components.get(BoundingBoxer);
250
- * const fragmentIdMap: FRAGS.FragmentIdMap = {
251
- * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
252
- * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
253
- * };
254
- * boundingBoxer.addFragmentIdMap(fragmentIdMap);
255
- * '''
165
+ * @returns {void}
256
166
  */
257
- addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
258
- private static getFragmentBounds;
167
+ delete(world: World): void;
168
+ /** {@link Disposable.dispose} */
169
+ dispose(): void;
259
170
  }
260
- import * as WEBIFC from "web-ifc";
261
- import { Components, Disposable, Event, Component } from "../../core";
262
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
171
+ import { MiniMap } from "./src";
172
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
173
+ import { Components } from "../Components";
263
174
  /**
264
- * 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).
175
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
265
176
  */
266
- export declare class IfcGeometryTiler extends Component implements Disposable {
177
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
267
178
  /**
268
179
  * A unique identifier for the component.
269
180
  * This UUID is used to register the component within the Components system.
270
181
  */
271
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
182
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
183
+ /** {@link Updateable.onAfterUpdate} */
184
+ readonly onAfterUpdate: Event<unknown>;
185
+ /** {@link Updateable.onBeforeUpdate} */
186
+ readonly onBeforeUpdate: Event<unknown>;
187
+ /** {@link Disposable.onDisposed} */
188
+ readonly onDisposed: Event<unknown>;
189
+ /** {@link Component.enabled} */
190
+ enabled: boolean;
272
191
  /**
273
- * Event triggered when geometry is streamed.
274
- * Contains the streamed geometry data and its buffer.
192
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
275
193
  */
276
- readonly onGeometryStreamed: Event<{
277
- buffer: Uint8Array;
278
- data: StreamedGeometries;
279
- }>;
194
+ list: Map<string, MiniMap>;
195
+ constructor(components: Components);
280
196
  /**
281
- * Event triggered when assets are streamed.
282
- * Contains the streamed assets.
197
+ * Creates a new {@link MiniMap} instance associated with the given world.
198
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
199
+ *
200
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
201
+ * @returns The newly created {@link MiniMap} instance.
202
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
283
203
  */
284
- readonly onAssetStreamed: Event<StreamedAsset[]>;
204
+ create(world: World): MiniMap;
285
205
  /**
286
- * Event triggered to indicate the progress of the streaming process.
287
- * Contains the progress percentage.
206
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
207
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
208
+ *
209
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
210
+ * @returns {void}
288
211
  */
289
- readonly onProgress: Event<number>;
212
+ delete(id: string): void;
213
+ /** {@link Disposable.dispose} */
214
+ dispose(): void;
215
+ /** {@link Updateable.update} */
216
+ update(): void;
217
+ }
218
+ import * as THREE from "three";
219
+ import { Components } from "../Components";
220
+ import { SimpleCamera } from "..";
221
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
222
+ /**
223
+ * 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).
224
+ */
225
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
290
226
  /**
291
- * Event triggered when the IFC file is loaded.
292
- * Contains the loaded IFC file data.
227
+ * A ProjectionManager instance that manages the projection modes of the camera.
293
228
  */
294
- readonly onIfcLoaded: Event<Uint8Array>;
295
- /** {@link Disposable.onDisposed} */
296
- readonly onDisposed: Event<unknown>;
229
+ readonly projection: ProjectionManager;
297
230
  /**
298
- * Settings for the IfcGeometryTiler.
231
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
232
+ * This camera is used when the projection mode is set to orthographic.
299
233
  */
300
- settings: IfcStreamingSettings;
301
- /** {@link Component.enabled} */
302
- enabled: boolean;
234
+ readonly threeOrtho: THREE.OrthographicCamera;
303
235
  /**
304
- * The WebIFC API instance used for IFC file processing.
236
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
237
+ * This camera is used when the projection mode is set to perspective.
305
238
  */
306
- webIfc: WEBIFC.IfcAPI;
307
- private _spatialTree;
308
- private _metaData;
309
- private _visitedGeometries;
310
- private _streamSerializer;
311
- private _geometries;
312
- private _geometryCount;
313
- private _civil;
314
- private _groupSerializer;
315
- private _assets;
316
- private _meshesWithHoles;
239
+ readonly threePersp: THREE.PerspectiveCamera;
240
+ protected readonly _userInputButtons: any;
241
+ protected readonly _frustumSize = 50;
242
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
243
+ protected _mode: NavigationMode | null;
244
+ private previousSize;
245
+ /**
246
+ * Getter for the current navigation mode.
247
+ * Throws an error if the mode is not found or the camera is not initialized.
248
+ *
249
+ * @returns {NavigationMode} The current navigation mode.
250
+ *
251
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
252
+ */
253
+ get mode(): NavigationMode;
317
254
  constructor(components: Components);
318
255
  /** {@link Disposable.dispose} */
319
256
  dispose(): void;
320
257
  /**
321
- * This method streams the IFC file from a given buffer.
322
- *
323
- * @param data - The Uint8Array containing the IFC file data.
324
- * @returns A Promise that resolves when the streaming process is complete.
325
- *
326
- * @remarks
327
- * This method cleans up any resources after the streaming process is complete.
258
+ * Sets a new {@link NavigationMode} and disables the previous one.
328
259
  *
329
- * @example
330
- * '''typescript
331
- * const ifcData = await fetch('path/to/ifc/file.ifc');
332
- * const rawBuffer = await response.arrayBuffer();
333
- * const ifcBuffer = new Uint8Array(rawBuffer);
334
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
335
- * '''
260
+ * @param mode - The {@link NavigationMode} to set.
336
261
  */
337
- streamFromBuffer(data: Uint8Array): Promise<void>;
262
+ set(mode: NavModeID): void;
338
263
  /**
339
- * This method streams the IFC file from a given callback.
340
- *
341
- * @param loadCallback - The callback function that will be used to load the IFC file.
342
- * @returns A Promise that resolves when the streaming process is complete.
264
+ * Make the camera view fit all the specified meshes.
343
265
  *
344
- * @remarks
345
- * This method cleans up any resources after the streaming process is complete.
266
+ * @param meshes the meshes to fit. If it is not defined, it will
267
+ * evaluate {@link Components.meshes}.
268
+ * @param offset the distance to the fit object
269
+ */
270
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
271
+ /**
272
+ * Allows or prevents all user input.
346
273
  *
274
+ * @param active - whether to enable or disable user inputs.
347
275
  */
348
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
349
- private readIfcFile;
350
- private streamIfcFile;
351
- private streamAllGeometries;
352
- private cleanUp;
353
- private getMesh;
354
- private getGeometry;
355
- private streamAssets;
356
- private streamGeometries;
276
+ setUserInput(active: boolean): void;
277
+ private disableUserInput;
278
+ private enableUserInput;
279
+ private newOrthoCamera;
280
+ private setOrthoPerspCameraAspect;
357
281
  }
358
- import * as FRAGS from "@thatopen/fragments";
359
- import { Components, Component } from "../../core";
282
+ import { Component, Disposable, World, Event } from "../Types";
283
+ import { SimpleRaycaster } from "./src";
284
+ import { Components } from "../Components";
360
285
  /**
361
- * 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).
286
+ * 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).
362
287
  */
363
- export declare class Hider extends Component {
288
+ export declare class Raycasters extends Component implements Disposable {
364
289
  /**
365
290
  * A unique identifier for the component.
366
291
  * This UUID is used to register the component within the Components system.
367
292
  */
368
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
293
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
369
294
  /** {@link Component.enabled} */
370
295
  enabled: boolean;
296
+ /**
297
+ * A Map that stores raycasters for each world.
298
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
299
+ */
300
+ list: Map<string, SimpleRaycaster>;
301
+ /** {@link Disposable.onDisposed} */
302
+ onDisposed: Event<unknown>;
371
303
  constructor(components: Components);
372
304
  /**
373
- * Sets the visibility of fragments within the 3D scene.
374
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
375
- * If 'items' is provided, only the specified fragments will be affected.
376
- *
377
- * @param visible - The visibility state to set for the fragments.
378
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
379
- * If not provided, all fragments will be affected.
305
+ * Retrieves a SimpleRaycaster instance for the given world.
306
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
307
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
380
308
  *
381
- * @returns {void}
309
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
310
+ * @returns The SimpleRaycaster instance for the given world.
382
311
  */
383
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
312
+ get(world: World): SimpleRaycaster;
384
313
  /**
385
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
386
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
387
- *
388
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
389
- * If not provided, all fragments will be isolated.
314
+ * Deletes the SimpleRaycaster instance associated with the given world.
315
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
390
316
  *
317
+ * @param world - The world for which to delete the SimpleRaycaster instance.
391
318
  * @returns {void}
392
319
  */
393
- isolate(items: FRAGS.FragmentIdMap): void;
394
- private updateCulledVisibility;
320
+ delete(world: World): void;
321
+ /** {@link Disposable.dispose} */
322
+ dispose(): void;
395
323
  }
396
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
397
324
  import * as THREE from "three";
398
- import * as FRAGS from "@thatopen/fragments";
399
- import { Component, Components, Event, Disposable } from "../../core";
400
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
325
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
326
+ import { SimplePlane } from "./src";
327
+ import { Components } from "../Components";
401
328
  /**
402
- * 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).
329
+ * 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).
330
+ *
331
+ * @param components - the instance of {@link Components} used.
332
+ * E.g. {@link SimplePlane}.
403
333
  */
404
- export declare class FragmentsManager extends Component implements Disposable {
334
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
405
335
  /**
406
336
  * A unique identifier for the component.
407
337
  * This UUID is used to register the component within the Components system.
408
338
  */
409
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
410
- /** {@link Disposable.onDisposed} */
411
- readonly onDisposed: Event<unknown>;
339
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
340
+ /** Event that fires when the user starts dragging a clipping plane. */
341
+ readonly onBeforeDrag: Event<void>;
342
+ /** Event that fires when the user stops dragging a clipping plane. */
343
+ readonly onAfterDrag: Event<void>;
412
344
  /**
413
- * Event triggered when fragments are loaded.
345
+ * Event that fires when the user starts creating a clipping plane.
414
346
  */
415
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
347
+ readonly onBeforeCreate: Event<unknown>;
416
348
  /**
417
- * Event triggered when fragments are disposed.
349
+ * Event that fires when the user cancels the creation of a clipping plane.
418
350
  */
419
- readonly onFragmentsDisposed: Event<{
420
- groupID: string;
421
- fragmentIDs: string[];
422
- }>;
351
+ readonly onBeforeCancel: Event<unknown>;
423
352
  /**
424
- * Map containing all loaded fragments.
425
- * The key is the fragment's unique identifier, and the value is the fragment itself.
353
+ * Event that fires after the user cancels the creation of a clipping plane.
426
354
  */
427
- readonly list: Map<string, Fragment>;
355
+ readonly onAfterCancel: Event<unknown>;
428
356
  /**
429
- * Map containing all loaded fragment groups.
430
- * The key is the group's unique identifier, and the value is the group itself.
357
+ * Event that fires when the user starts deleting a clipping plane.
431
358
  */
432
- readonly groups: Map<string, FragmentsGroup>;
433
- baseCoordinationModel: string;
434
- baseCoordinationMatrix: THREE.Matrix4;
435
- /** {@link Component.enabled} */
436
- enabled: boolean;
437
- private _loader;
359
+ readonly onBeforeDelete: Event<unknown>;
438
360
  /**
439
- * Getter for the meshes of all fragments in the FragmentsManager.
440
- * It iterates over the fragments in the list and pushes their meshes into an array.
441
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
361
+ * Event that fires after a clipping plane has been created.
362
+ * @param plane - The newly created clipping plane.
442
363
  */
443
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
444
- constructor(components: Components);
445
- /** {@link Disposable.dispose} */
446
- dispose(): void;
364
+ readonly onAfterCreate: Event<SimplePlane>;
447
365
  /**
448
- * Dispose of a specific fragment group.
449
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
450
- * disposes of the group, and triggers the onFragmentsDisposed event.
451
- *
452
- * @param group - The fragment group to be disposed.
366
+ * Event that fires after a clipping plane has been deleted.
367
+ * @param plane - The deleted clipping plane.
453
368
  */
454
- disposeGroup(group: FragmentsGroup): void;
369
+ readonly onAfterDelete: Event<SimplePlane>;
370
+ /** {@link Disposable.onDisposed} */
371
+ readonly onDisposed: Event<string>;
455
372
  /**
456
- * Loads a binary file that contain fragment geometry.
457
- * @param data - The binary data to load.
458
- * @param config - Optional configuration for loading.
459
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
460
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
461
- * @returns The loaded FragmentsGroup.
373
+ * Whether to force the clipping plane to be orthogonal in the Y direction
374
+ * (up). This is desirable when clipping a building horizontally and a
375
+ * clipping plane is created in its roof, which might have a slight
376
+ * slope for draining purposes.
462
377
  */
463
- load(data: Uint8Array, config?: Partial<{
464
- coordinate: boolean;
465
- name: string;
466
- properties: FRAGS.IfcProperties;
467
- relationsMap: RelationsMap;
468
- }>): FragmentsGroup;
378
+ orthogonalY: boolean;
469
379
  /**
470
- * Export the specified fragmentsgroup to binary data.
471
- * @param group - the fragments group to be exported.
472
- * @returns the exported data as binary buffer.
380
+ * The tolerance that determines whether an almost-horizontal clipping plane
381
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
382
+ * has to be 'true' for this to apply.
473
383
  */
474
- export(group: FragmentsGroup): Uint8Array;
384
+ toleranceOrthogonalY: number;
475
385
  /**
476
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
477
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
478
- * @returns A map of model IDs to sets of express IDs.
386
+ * The type of clipping plane to be created.
387
+ * Default is {@link SimplePlane}.
479
388
  */
480
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
481
- [modelID: string]: Set<number>;
482
- };
389
+ Type: new (...args: any) => SimplePlane;
483
390
  /**
484
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
485
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
486
- * @returns A fragment ID map.
487
- * @remarks
488
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
489
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
490
- * The fragment ID maps are then merged into a single map and returned.
491
- * 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.
391
+ * A list of all the clipping planes created by this component.
492
392
  */
493
- modelIdToFragmentIdMap(modelIdMap: {
494
- [modelID: string]: Set<number>;
495
- }): FRAGS.FragmentIdMap;
393
+ list: SimplePlane[];
394
+ /** The material used in all the clipping planes. */
395
+ private _material;
396
+ private _size;
397
+ private _enabled;
398
+ private _visible;
399
+ /** {@link Component.enabled} */
400
+ get enabled(): boolean;
401
+ /** {@link Component.enabled} */
402
+ set enabled(state: boolean);
403
+ /** {@link Hideable.visible } */
404
+ get visible(): boolean;
405
+ /** {@link Hideable.visible } */
406
+ set visible(state: boolean);
407
+ /** The material of the clipping plane representation. */
408
+ get material(): THREE.MeshBasicMaterial;
409
+ /** The material of the clipping plane representation. */
410
+ set material(material: THREE.MeshBasicMaterial);
411
+ /** The size of the geometric representation of the clippings planes. */
412
+ get size(): number;
413
+ /** The size of the geometric representation of the clippings planes. */
414
+ set size(size: number);
415
+ constructor(components: Components);
416
+ /** {@link Disposable.dispose} */
417
+ dispose(): void;
418
+ /** {@link Createable.create} */
419
+ create(world: World): SimplePlane | null;
496
420
  /**
497
- * Applies coordinate transformation to the provided models.
498
- * If no models are provided, all groups are used.
499
- * The first model in the list becomes the base model for coordinate transformation.
500
- * All other models are then transformed to match the base model's coordinate system.
421
+ * Creates a plane in a certain place and with a certain orientation,
422
+ * without the need of the mouse.
501
423
  *
502
- * @param models - The models to apply coordinate transformation to.
503
- * If not provided, all models are used.
424
+ * @param world - the world where this plane should be created.
425
+ * @param normal - the orientation of the clipping plane.
426
+ * @param point - the position of the clipping plane.
427
+ * navigation.
504
428
  */
505
- coordinate(models?: FragmentsGroup[]): void;
429
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
506
430
  /**
507
- * Applies the base coordinate system to the provided object.
508
- *
509
- * This function takes an object and its original coordinate system as input.
510
- * It then inverts the original coordinate system and applies the base coordinate system
511
- * to the object. This ensures that the object's position, rotation, and scale are
512
- * transformed to match the base coordinate system (which is taken from the first model loaded).
431
+ * {@link Createable.delete}
513
432
  *
514
- * @param object - The object to which the base coordinate system will be applied.
515
- * This should be an instance of THREE.Object3D.
433
+ * @param world - the world where the plane to delete is.
434
+ * @param plane - the plane to delete. If undefined, the first plane
435
+ * found under the cursor will be deleted.
436
+ */
437
+ delete(world: World, plane?: SimplePlane): void;
438
+ /**
439
+ * Deletes all the existing clipping planes.
516
440
  *
517
- * @param originalCoordinateSystem - The original coordinate system of the object.
518
- * This should be a THREE.Matrix4 representing the object's transformation matrix.
441
+ * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
519
442
  */
520
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
443
+ deleteAll(types?: Set<string>): void;
444
+ private deletePlane;
445
+ private pickPlane;
446
+ private getAllPlaneMeshes;
447
+ private createPlaneFromIntersection;
448
+ private getWorldNormal;
449
+ private normalizePlaneDirectionY;
450
+ private newPlane;
451
+ private updateMaterialsAndPlanes;
452
+ private _onStartDragging;
453
+ private _onEndDragging;
521
454
  }
522
- import * as WEBIFC from "web-ifc";
523
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
524
- import { PropertiesStreamingSettings } from "./src";
455
+ import { Component, Disposable, World, Event } from "../Types";
456
+ import { GridConfig, SimpleGrid } from "./src";
457
+ import { Components } from "../Components";
525
458
  /**
526
- * 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).
459
+ * 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).
527
460
  */
528
- export declare class IfcPropertiesTiler extends Component implements Disposable {
461
+ export declare class Grids extends Component implements Disposable {
529
462
  /**
530
463
  * A unique identifier for the component.
531
464
  * This UUID is used to register the component within the Components system.
532
465
  */
533
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
534
- /**
535
- * An event that is triggered when properties are streamed from the IFC file.
536
- * The event provides the type of the IFC entity and the corresponding data.
537
- */
538
- readonly onPropertiesStreamed: AsyncEvent<{
539
- type: number;
540
- data: {
541
- [id: number]: any;
542
- };
543
- }>;
466
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
544
467
  /**
545
- * An event that is triggered to indicate the progress of the streaming process.
546
- * The event provides a number between 0 and 1 representing the progress percentage.
468
+ * A map of world UUIDs to their corresponding grid instances.
547
469
  */
548
- readonly onProgress: AsyncEvent<number>;
470
+ list: Map<string, SimpleGrid>;
549
471
  /**
550
- * An event that is triggered when indices are streamed from the IFC file.
551
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
472
+ * The default configuration for grid creation.
552
473
  */
553
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
474
+ config: Required<GridConfig>;
554
475
  /** {@link Disposable.onDisposed} */
555
- readonly onDisposed: Event<string>;
476
+ readonly onDisposed: Event<unknown>;
556
477
  /** {@link Component.enabled} */
557
478
  enabled: boolean;
479
+ constructor(components: Components);
558
480
  /**
559
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
560
- */
561
- settings: PropertiesStreamingSettings;
562
- /**
563
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
481
+ * Creates a new grid for the given world.
482
+ * Throws an error if a grid already exists for the world.
483
+ *
484
+ * @param world - The world to create the grid for.
485
+ * @returns The newly created grid.
486
+ *
487
+ * @throws Will throw an error if a grid already exists for the given world.
564
488
  */
565
- webIfc: WEBIFC.IfcAPI;
566
- /** {@link Disposable.dispose} */
567
- dispose(): Promise<void>;
489
+ create(world: World): SimpleGrid;
568
490
  /**
569
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
491
+ * Deletes the grid associated with the given world.
492
+ * If a grid does not exist for the given world, this method does nothing.
570
493
  *
571
- * @param data - The Uint8Array containing the IFC file data.
572
- * @returns A Promise that resolves when the streaming process is complete.
573
- */
574
- streamFromBuffer(data: Uint8Array): Promise<void>;
575
- /**
576
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
494
+ * @param world - The world for which to delete the grid.
577
495
  *
578
- * @param loadCallback - A callback function that loads the IFC file data.
579
- * @returns A Promise that resolves when the streaming process is complete.
496
+ * @remarks
497
+ * This method will dispose of the grid and remove it from the internal list.
498
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
580
499
  */
581
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
582
- private readIfcFile;
583
- private streamIfcFile;
584
- private streamAllProperties;
585
- private cleanUp;
500
+ delete(world: World): void;
501
+ /** {@link Disposable.dispose} */
502
+ dispose(): void;
586
503
  }
587
- import * as WEBIFC from "web-ifc";
588
- import * as FRAGS from "@thatopen/fragments";
589
- import { IfcFragmentSettings } from "./src";
590
- import { Component, Components, Event, Disposable } from "../../core";
504
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
505
+ export declare class UUID {
506
+ private static _pattern;
507
+ private static _lut;
508
+ static create(): string;
509
+ static validate(uuid: string): void;
510
+ }
511
+ import * as THREE from "three";
512
+ export declare class MaterialsUtils {
513
+ static isTransparent(material: THREE.Material): boolean;
514
+ }
515
+ import * as THREE from "three";
516
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
517
+ center: THREE.Vector3;
518
+ halfSizes: THREE.Vector3;
519
+ rotation: THREE.Matrix3;
520
+ transformation: THREE.Matrix4;
521
+ };
522
+ import * as THREE from "three";
523
+ import { Component, Components, Disposable, Event, World } from "../core";
591
524
  /**
592
- * 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).
525
+ * Configuration interface for the VertexPicker component.
593
526
  */
594
- export declare class IfcLoader extends Component implements Disposable {
527
+ export interface VertexPickerConfig {
595
528
  /**
596
- * A unique identifier for the component.
597
- * This UUID is used to register the component within the Components system.
529
+ * If true, only vertices will be picked, not the closest point on the face.
598
530
  */
599
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
531
+ showOnlyVertex: boolean;
532
+ /**
533
+ * The maximum distance for snapping to a vertex.
534
+ */
535
+ snapDistance: number;
536
+ /**
537
+ * The HTML element to use for previewing the picked vertex.
538
+ */
539
+ previewElement: HTMLElement;
540
+ }
541
+ /**
542
+ * A class that provides functionality for picking vertices in a 3D scene.
543
+ */
544
+ export declare class VertexPicker extends Component implements Disposable {
600
545
  /** {@link Disposable.onDisposed} */
601
- readonly onDisposed: Event<string>;
546
+ readonly onDisposed: Event<unknown>;
602
547
  /**
603
- * An event triggered when the IFC file starts loading.
548
+ * An event that is triggered when a vertex is found.
549
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
604
550
  */
605
- readonly onIfcStartedLoading: Event<void>;
551
+ readonly onVertexFound: Event<THREE.Vector3>;
606
552
  /**
607
- * An event triggered when the setup process is completed.
553
+ * An event that is triggered when a vertex is lost.
554
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
608
555
  */
609
- readonly onSetup: Event<void>;
556
+ readonly onVertexLost: Event<THREE.Vector3>;
610
557
  /**
611
- * The settings for the IfcLoader.
612
- * It includes options for excluding categories, setting WASM paths, and more.
558
+ * An event that is triggered when the picker is enabled or disabled
613
559
  */
614
- settings: IfcFragmentSettings;
560
+ readonly onEnabled: Event<boolean>;
615
561
  /**
616
- * The instance of the Web-IFC library used for handling IFC data.
562
+ * A reference to the Components instance associated with this VertexPicker.
617
563
  */
618
- webIfc: WEBIFC.IfcAPI;
619
- /** {@link Component.enabled} */
620
- enabled: boolean;
621
- private _material;
622
- private _spatialTree;
623
- private _metaData;
624
- private _fragmentInstances;
625
- private _civil;
626
- private _visitedFragments;
627
- private _materialT;
628
- constructor(components: Components);
629
- /** {@link Disposable.dispose} */
630
- dispose(): void;
564
+ components: Components;
631
565
  /**
632
- * Sets up the IfcLoader component with the provided configuration.
633
- *
634
- * @param config - Optional configuration settings for the IfcLoader.
635
- * If not provided, the existing settings will be used.
636
- *
637
- * @returns A Promise that resolves when the setup process is completed.
638
- *
639
- * @remarks
640
- * If the 'autoSetWasm' option is enabled in the configuration,
641
- * the method will automatically set the WASM paths for the Web-IFC library.
566
+ * A reference to the working plane used for vertex picking.
567
+ * This plane is used to determine which vertices are considered valid for picking.
568
+ * If this value is null, all vertices are considered valid.
569
+ */
570
+ workingPlane: THREE.Plane | null;
571
+ private _pickedPoint;
572
+ private _config;
573
+ private _enabled;
574
+ /**
575
+ * Sets the enabled state of the VertexPicker.
576
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
577
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
642
578
  *
643
- * @example
644
- * '''typescript
645
- * const ifcLoader = new IfcLoader(components);
646
- * await ifcLoader.setup({ autoSetWasm: true });
647
- * '''
579
+ * @param value - The new enabled state.
648
580
  */
649
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
581
+ set enabled(value: boolean);
650
582
  /**
651
- * Loads an IFC file and processes it for 3D visualization.
583
+ * Gets the current enabled state of the VertexPicker.
652
584
  *
653
- * @param data - The Uint8Array containing the IFC file data.
654
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
585
+ * @returns The current enabled state.
586
+ */
587
+ get enabled(): boolean;
588
+ /**
589
+ * Sets the configuration for the VertexPicker component.
655
590
  *
656
- * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
591
+ * @param value - A Partial object containing the configuration properties to update.
592
+ * The properties not provided in the value object will retain their current values.
657
593
  *
658
594
  * @example
659
595
  * '''typescript
660
- * const ifcLoader = components.get(IfcLoader);
661
- * const group = await ifcLoader.load(ifcData);
596
+ * vertexPicker.config = {
597
+ * snapDistance: 0.5,
598
+ * showOnlyVertex: true,
599
+ * };
662
600
  * '''
663
601
  */
664
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
602
+ set config(value: Partial<VertexPickerConfig>);
665
603
  /**
666
- * Reads an IFC file and initializes the Web-IFC library.
667
- *
668
- * @param data - The Uint8Array containing the IFC file data.
669
- *
670
- * @returns A Promise that resolves when the IFC file is opened and initialized.
604
+ * Gets the current configuration for the VertexPicker component.
671
605
  *
672
- * @remarks
673
- * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
674
- * It also opens the IFC model using the provided data and settings.
606
+ * @returns A copy of the current VertexPickerConfig object.
675
607
  *
676
608
  * @example
677
609
  * '''typescript
678
- * const ifcLoader = components.get(IfcLoader);
679
- * await ifcLoader.readIfcFile(ifcData);
610
+ * const currentConfig = vertexPicker.config;
611
+ * console.log(currentConfig.snapDistance); // Output: 0.25
680
612
  * '''
681
613
  */
682
- readIfcFile(data: Uint8Array): Promise<number>;
614
+ get config(): Partial<VertexPickerConfig>;
615
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
616
+ /** {@link Disposable.dispose} */
617
+ dispose(): void;
683
618
  /**
684
- * Cleans up the IfcLoader component by resetting the Web-IFC library,
685
- * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
619
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
686
620
  *
687
- * @remarks
688
- * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
621
+ * @param world - The World instance to use for raycasting.
689
622
  *
690
- * @example
691
- * '''typescript
692
- * const ifcLoader = components.get(IfcLoader);
693
- * ifcLoader.cleanUp();
694
- * '''
623
+ * @returns The current picked point, or null if no point is picked.
624
+ *
625
+ * @remarks
626
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
627
+ * If enabled, it performs raycasting to find the closest intersecting object.
628
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
629
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
630
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
631
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
695
632
  */
696
- cleanUp(): void;
697
- private getAllGeometries;
698
- private getMesh;
699
- private getGeometry;
700
- private autoSetWasm;
633
+ get(world: World): THREE.Vector3 | null;
634
+ private getClosestVertex;
635
+ private getVertices;
636
+ private getVertex;
701
637
  }
702
638
  import * as THREE from "three";
703
- import { Components } from "../Components";
704
- import { Component } from "../Types";
639
+ import * as FRAGS from "@thatopen/fragments";
640
+ import { FragmentsGroup } from "@thatopen/fragments";
641
+ import { Component, Components, Disposable, Event } from "../../core";
705
642
  /**
706
- * 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).
643
+ * 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).
707
644
  */
708
- export declare class Disposer extends Component {
709
- private _disposedComponents;
645
+ export declare class BoundingBoxer extends Component implements Disposable {
646
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
710
647
  /** {@link Component.enabled} */
711
648
  enabled: boolean;
712
- /**
713
- * A unique identifier for the component.
714
- * This UUID is used to register the component within the Components system.
715
- */
716
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
649
+ /** {@link Disposable.onDisposed} */
650
+ readonly onDisposed: Event<unknown>;
651
+ private _absoluteMin;
652
+ private _absoluteMax;
653
+ private _meshes;
717
654
  constructor(components: Components);
718
655
  /**
719
- * Return the UUIDs of all disposed components.
656
+ * A static method to calculate the dimensions of a given bounding box.
657
+ *
658
+ * @param bbox - The bounding box to calculate the dimensions for.
659
+ * @returns An object containing the width, height, depth, and center of the bounding box.
720
660
  */
721
- get(): Set<string>;
661
+ static getDimensions(bbox: THREE.Box3): {
662
+ width: number;
663
+ height: number;
664
+ depth: number;
665
+ center: THREE.Vector3;
666
+ };
722
667
  /**
723
- * Removes a mesh, its geometry and its materials from memory. If you are
724
- * using any of these in other parts of the application, make sure that you
725
- * remove them from the mesh before disposing it.
668
+ * A static method to create a new bounding box boundary.
726
669
  *
727
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
728
- * to remove.
670
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
671
+ * @returns A new THREE.Vector3 representing the boundary.
729
672
  *
730
- * @param materials - whether to dispose the materials of the mesh.
673
+ * @remarks
674
+ * This method is used to create a new boundary for calculating bounding boxes.
675
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
676
+ * depending on the value of the 'positive' parameter.
731
677
  *
732
- * @param recursive - whether to recursively dispose the children of the mesh.
678
+ * @example
679
+ * '''typescript
680
+ * const positiveBound = BoundingBoxer.newBound(true);
681
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
682
+ *
683
+ * const negativeBound = BoundingBoxer.newBound(false);
684
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
685
+ * '''
733
686
  */
734
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
687
+ static newBound(positive: boolean): THREE.Vector3;
735
688
  /**
736
- * Disposes a geometry from memory.
689
+ * A static method to calculate the bounding box of a set of points.
737
690
  *
738
- * @param geometry - the
739
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
740
- * to remove.
741
- */
742
- disposeGeometry(geometry: THREE.BufferGeometry): void;
743
- private disposeGeometryAndMaterials;
744
- private disposeChildren;
745
- private static disposeMaterial;
746
- }
747
- import { Component, Disposable, World, Event } from "../Types";
748
- import { SimpleRaycaster } from "./src";
749
- import { Components } from "../Components";
750
- /**
751
- * 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).
752
- */
753
- export declare class Raycasters extends Component implements Disposable {
754
- /**
755
- * A unique identifier for the component.
756
- * This UUID is used to register the component within the Components system.
757
- */
758
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
759
- /** {@link Component.enabled} */
760
- enabled: boolean;
761
- /**
762
- * A Map that stores raycasters for each world.
763
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
764
- */
765
- list: Map<string, SimpleRaycaster>;
766
- /** {@link Disposable.onDisposed} */
767
- onDisposed: Event<unknown>;
768
- constructor(components: Components);
769
- /**
770
- * Retrieves a SimpleRaycaster instance for the given world.
771
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
772
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
691
+ * @param points - An array of THREE.Vector3 representing the points.
692
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
693
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
694
+ * @returns A THREE.Box3 representing the bounding box of the given points.
773
695
  *
774
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
775
- * @returns The SimpleRaycaster instance for the given world.
776
- */
777
- get(world: World): SimpleRaycaster;
778
- /**
779
- * Deletes the SimpleRaycaster instance associated with the given world.
780
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
696
+ * @remarks
697
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
698
+ * 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.
781
699
  *
782
- * @param world - The world for which to delete the SimpleRaycaster instance.
783
- * @returns {void}
784
- */
785
- delete(world: World): void;
786
- /** {@link Disposable.dispose} */
787
- dispose(): void;
788
- }
789
- import * as THREE from "three";
790
- import * as FRAGS from "@thatopen/fragments";
791
- import { Disposable, Component, Event, Components } from "../../core";
792
- /**
793
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
794
- */
795
- export interface Classification {
796
- /**
797
- * A system within the classification.
798
- * The key is the system name, and the value is an object representing the classes within the system.
799
- */
800
- [system: string]: {
801
- /**
802
- * A class within the system.
803
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
804
- */
805
- [className: string]: {
806
- map: FRAGS.FragmentIdMap;
807
- name: string;
808
- id: number | null;
809
- };
810
- };
811
- }
812
- /**
813
- * 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).
814
- */
815
- export declare class Classifier extends Component implements Disposable {
816
- /**
817
- * A unique identifier for the component.
818
- * This UUID is used to register the component within the Components system.
819
- */
820
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
821
- /** {@link Component.enabled} */
822
- enabled: boolean;
823
- /**
824
- * A map representing the classification systems.
825
- * The key is the system name, and the value is an object representing the classes within the system.
700
+ * @example
701
+ * '''typescript
702
+ * const points = [
703
+ * new THREE.Vector3(1, 2, 3),
704
+ * new THREE.Vector3(4, 5, 6),
705
+ * new THREE.Vector3(7, 8, 9),
706
+ * ];
707
+ *
708
+ * const bbox = BoundingBoxer.getBounds(points);
709
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
710
+ * '''
826
711
  */
827
- list: Classification;
828
- /** {@link Disposable.onDisposed} */
829
- readonly onDisposed: Event<unknown>;
830
- constructor(components: Components);
831
- private onFragmentsDisposed;
712
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
832
713
  /** {@link Disposable.dispose} */
833
714
  dispose(): void;
834
715
  /**
835
- * Removes a fragment from the classification based on its unique identifier (guid).
836
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
837
- *
838
- * @param guid - The unique identifier of the fragment to be removed.
839
- */
840
- remove(guid: string): void;
841
- /**
842
- * Finds and returns fragments based on the provided filter criteria.
843
- * If no filter is provided, it returns all fragments.
716
+ * Returns the bounding box of the calculated fragments.
844
717
  *
845
- * @param filter - An optional object containing filter criteria.
846
- * The keys of the object represent the classification system names,
847
- * and the values are arrays of class names to match.
718
+ * @returns A new THREE.Box3 instance representing the bounding box.
848
719
  *
849
- * @returns A map of fragment GUIDs to their respective express IDs,
850
- * where the express IDs are filtered based on the provided filter criteria.
720
+ * @remarks
721
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
722
+ * The returned box represents the bounding box of the calculated fragments.
851
723
  *
852
- * @throws Will throw an error if the fragments map is malformed.
724
+ * @example
725
+ * '''typescript
726
+ * const boundingBox = boundingBoxer.get();
727
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
728
+ * '''
853
729
  */
854
- find(filter?: {
855
- [name: string]: string[];
856
- }): FRAGS.FragmentIdMap;
730
+ get(): THREE.Box3;
857
731
  /**
858
- * Classifies fragments based on their modelID.
732
+ * Calculates and returns a sphere that encompasses the entire bounding box.
859
733
  *
860
- * @param modelID - The unique identifier of the model to classify fragments by.
861
- * @param group - The FragmentsGroup containing the fragments to be classified.
734
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
862
735
  *
863
736
  * @remarks
864
- * This method iterates through the fragments in the provided group,
865
- * and classifies them based on their modelID.
866
- * The classification is stored in the 'list.models' property,
867
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
737
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
738
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
739
+ * The radius is calculated as the distance from the center to the minimum bound.
868
740
  *
741
+ * @example
742
+ * '''typescript
743
+ * const boundingBoxer = components.get(BoundingBoxer);
744
+ * boundingBoxer.add(fragmentsGroup);
745
+ * const boundingSphere = boundingBoxer.getSphere();
746
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
747
+ * '''
869
748
  */
870
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
749
+ getSphere(): THREE.Sphere;
871
750
  /**
872
- * Classifies fragments based on their PredefinedType property.
751
+ * Returns a THREE.Mesh instance representing the bounding box.
873
752
  *
874
- * @param group - The FragmentsGroup containing the fragments to be classified.
753
+ * @returns A new THREE.Mesh instance representing the bounding box.
875
754
  *
876
755
  * @remarks
877
- * This method iterates through the properties of the fragments in the provided group,
878
- * and classifies them based on their PredefinedType property.
879
- * The classification is stored in the 'list.predefinedTypes' property,
880
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
756
+ * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
757
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
758
+ * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
759
+ * The position of the mesh is set to the center of the bounding box.
881
760
  *
882
- * @throws Will throw an error if the fragment ID is not found.
761
+ * @example
762
+ * '''typescript
763
+ * const boundingBoxer = components.get(BoundingBoxer);
764
+ * boundingBoxer.add(fragmentsGroup);
765
+ * const boundingBoxMesh = boundingBoxer.getMesh();
766
+ * scene.add(boundingBoxMesh);
767
+ * '''
883
768
  */
884
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
769
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
885
770
  /**
886
- * Classifies fragments based on their entity type.
887
- *
888
- * @param group - The FragmentsGroup containing the fragments to be classified.
771
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
772
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
889
773
  *
890
774
  * @remarks
891
- * This method iterates through the relations of the fragments in the provided group,
892
- * and classifies them based on their entity type.
893
- * The classification is stored in the 'list.entities' property,
894
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
775
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
776
+ * It ensures that the bounding box calculations are accurate and up-to-date.
895
777
  *
896
- * @throws Will throw an error if the fragment ID is not found.
778
+ * @example
779
+ * '''typescript
780
+ * const boundingBoxer = components.get(BoundingBoxer);
781
+ * boundingBoxer.add(fragmentsGroup);
782
+ * // ...
783
+ * boundingBoxer.reset();
784
+ * '''
897
785
  */
898
- byEntity(group: FRAGS.FragmentsGroup): void;
786
+ reset(): void;
899
787
  /**
900
- * Classifies fragments based on a specific IFC relationship.
788
+ * Adds a FragmentsGroup to the BoundingBoxer.
901
789
  *
902
- * @param group - The FragmentsGroup containing the fragments to be classified.
903
- * @param ifcRel - The IFC relationship number to classify fragments by.
904
- * @param systemName - The name of the classification system to store the classification.
790
+ * @param group - The FragmentsGroup to add.
905
791
  *
906
792
  * @remarks
907
- * This method iterates through the relations of the fragments in the provided group,
908
- * and classifies them based on the specified IFC relationship.
909
- * The classification is stored in the 'list' property under the specified system name,
910
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
793
+ * This method iterates through each fragment in the provided FragmentsGroup,
794
+ * and calls the 'addMesh' method for each fragment's mesh.
911
795
  *
912
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
796
+ * @example
797
+ * '''typescript
798
+ * const boundingBoxer = components.get(BoundingBoxer);
799
+ * boundingBoxer.add(fragmentsGroup);
800
+ * '''
913
801
  */
914
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
802
+ add(group: FragmentsGroup): void;
915
803
  /**
916
- * Classifies fragments based on their spatial structure in the IFC model.
804
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
917
805
  *
918
- * @param model - The FragmentsGroup containing the fragments to be classified.
919
- * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
920
- * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
921
- * the classifier just pick the WEBIFC categories provided.
806
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
807
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
922
808
  *
923
809
  * @remarks
924
- * This method iterates through the relations of the fragments in the provided group,
925
- * and classifies them based on their spatial structure in the IFC model.
926
- * The classification is stored in the 'list' property under the system name "spatialStructures",
927
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
810
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
811
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
812
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
928
813
  *
929
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
814
+ * @example
815
+ * '''typescript
816
+ * const boundingBoxer = components.get(BoundingBoxer);
817
+ * boundingBoxer.addMesh(mesh);
818
+ * '''
930
819
  */
931
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
932
- useProperties?: boolean;
933
- isolate?: Set<number>;
934
- }): Promise<void>;
820
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
935
821
  /**
936
- * Sets the color of the specified fragments.
822
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
937
823
  *
938
- * @param items - A map of fragment IDs to their respective express IDs.
939
- * @param color - The color to set for the fragments.
940
- * @param override - A boolean indicating whether to override the existing color of the fragments.
824
+ * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
825
+ * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
941
826
  *
942
- * @remarks
943
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
944
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
945
- *
946
- * @throws Will throw an error if the fragment with the specified ID is not found.
947
- */
948
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
949
- /**
950
- * Resets the color of the specified fragments to their original color.
951
- *
952
- * @param items - A map of fragment IDs to their respective express IDs.
827
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
953
828
  *
954
829
  * @remarks
955
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
956
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
830
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
831
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
957
832
  *
958
- * @throws Will throw an error if the fragment with the specified ID is not found.
833
+ * @example
834
+ * '''typescript
835
+ * const boundingBoxer = components.get(BoundingBoxer);
836
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
837
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
838
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
839
+ * };
840
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
841
+ * '''
959
842
  */
960
- resetColor(items: FRAGS.FragmentIdMap): void;
961
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
843
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
844
+ private static getFragmentBounds;
962
845
  }
963
- import { Component, Disposable, Event } from "../Types";
846
+ import { Component, Disposable, Event, Components } from "../../core";
964
847
  /**
965
- * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
848
+ * 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).
966
849
  */
967
- export declare class Components implements Disposable {
850
+ export declare class Exploder extends Component implements Disposable {
968
851
  /**
969
- * The version of the @thatopen/components library.
852
+ * A unique identifier for the component.
853
+ * This UUID is used to register the component within the Components system.
970
854
  */
971
- static readonly release = "2.1.12";
855
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
972
856
  /** {@link Disposable.onDisposed} */
973
- readonly onDisposed: Event<void>;
974
- /**
975
- * The list of components created in this app.
976
- * The keys are UUIDs and the values are instances of the components.
977
- */
978
- readonly list: Map<string, Component>;
979
- /**
980
- * If disabled, the animation loop will be stopped.
981
- * Default value is false.
982
- */
857
+ readonly onDisposed: Event<unknown>;
858
+ /** {@link Component.enabled} */
983
859
  enabled: boolean;
984
- private _clock;
985
860
  /**
986
- * Adds a component to the list of components.
987
- * Throws an error if a component with the same UUID already exists.
988
- *
989
- * @param uuid - The unique identifier of the component.
990
- * @param instance - The instance of the component to be added.
991
- *
992
- * @throws Will throw an error if a component with the same UUID already exists.
993
- *
994
- * @internal
861
+ * The height of the explosion animation.
862
+ * This property determines the vertical distance by which fragments are moved during the explosion.
863
+ * Default value is 10.
995
864
  */
996
- add(uuid: string, instance: Component): void;
865
+ height: number;
997
866
  /**
998
- * Retrieves a component instance by its constructor function.
999
- * If the component does not exist in the list, it will be created and added.
1000
- *
1001
- * @template U - The type of the component to retrieve.
1002
- * @param Component - The constructor function of the component to retrieve.
1003
- *
1004
- * @returns The instance of the requested component.
1005
- *
1006
- * @throws Will throw an error if a component with the same UUID already exists.
1007
- *
1008
- * @internal
867
+ * The group name used for the explosion animation.
868
+ * This property specifies the group of fragments that will be affected by the explosion.
869
+ * Default value is "storeys".
1009
870
  */
1010
- get<U extends Component>(Component: new (components: Components) => U): U;
1011
- constructor();
871
+ groupName: string;
1012
872
  /**
1013
- * Initializes the Components instance.
1014
- * This method starts the animation loop, sets the enabled flag to true,
1015
- * and calls the update method.
1016
- *
1017
- * @returns {void}
873
+ * A set of strings representing the exploded items.
874
+ * This set is used to keep track of which items have been exploded.
1018
875
  */
1019
- init(): void;
876
+ list: Set<string>;
877
+ constructor(components: Components);
878
+ /** {@link Disposable.dispose} */
879
+ dispose(): void;
1020
880
  /**
1021
- * Disposes the memory of all the components and tools of this instance of
1022
- * the library. A memory leak will be created if:
881
+ * Sets the explosion state of the fragments.
1023
882
  *
1024
- * - An instance of the library ends up out of scope and this function isn't
1025
- * called. This is especially relevant in Single Page Applications (React,
1026
- * Angular, Vue, etc).
883
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1027
884
  *
1028
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
1029
- * referenced by a reference type (object or array).
885
+ * @remarks
886
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
887
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
888
+ * If 'active' is false, the fragments are moved back to their original position.
1030
889
  *
1031
- * You can learn more about how Three.js handles memory leaks
1032
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
890
+ * The method also keeps track of the exploded items using the 'list' set.
1033
891
  *
892
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1034
893
  */
1035
- dispose(): void;
1036
- private update;
1037
- private static setupBVH;
1038
- }
1039
- import * as THREE from "three";
1040
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1041
- center: THREE.Vector3;
1042
- halfSizes: THREE.Vector3;
1043
- rotation: THREE.Matrix3;
1044
- transformation: THREE.Matrix4;
1045
- };
1046
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1047
- import * as THREE from "three";
1048
- export declare class MaterialsUtils {
1049
- static isTransparent(material: THREE.Material): boolean;
1050
- }
1051
- export declare class UUID {
1052
- private static _pattern;
1053
- private static _lut;
1054
- static create(): string;
1055
- static validate(uuid: string): void;
894
+ set(active: boolean): void;
1056
895
  }
1057
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
1058
- import { Components } from "../Components";
1059
- import { SimpleWorld } from "./src";
896
+ import * as WEBIFC from "web-ifc";
897
+ import * as FRAGS from "@thatopen/fragments";
898
+ import { IfcFragmentSettings } from "./src";
899
+ import { Component, Components, Event, Disposable } from "../../core";
1060
900
  /**
1061
- * 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).
901
+ * 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).
1062
902
  */
1063
- export declare class Worlds extends Component implements Updateable, Disposable {
903
+ export declare class IfcLoader extends Component implements Disposable {
1064
904
  /**
1065
905
  * A unique identifier for the component.
1066
906
  * This UUID is used to register the component within the Components system.
1067
907
  */
1068
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
1069
- /** {@link Updateable.onAfterUpdate} */
1070
- readonly onAfterUpdate: Event<unknown>;
1071
- /** {@link Updateable.onBeforeUpdate} */
1072
- readonly onBeforeUpdate: Event<unknown>;
908
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1073
909
  /** {@link Disposable.onDisposed} */
1074
- readonly onDisposed: Event<unknown>;
910
+ readonly onDisposed: Event<string>;
1075
911
  /**
1076
- * An event that is triggered when a new world is created.
1077
- * The event passes the newly created world as a parameter.
912
+ * An event triggered when the IFC file starts loading.
1078
913
  */
1079
- readonly onWorldCreated: Event<World>;
914
+ readonly onIfcStartedLoading: Event<void>;
1080
915
  /**
1081
- * An event that is triggered when a world is deleted.
1082
- * The event passes the UUID of the deleted world as a parameter.
916
+ * An event triggered when the setup process is completed.
1083
917
  */
1084
- readonly onWorldDeleted: Event<string>;
918
+ readonly onSetup: Event<void>;
1085
919
  /**
1086
- * A collection of worlds managed by this component.
1087
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
920
+ * The settings for the IfcLoader.
921
+ * It includes options for excluding categories, setting WASM paths, and more.
1088
922
  */
1089
- list: Map<string, World>;
923
+ settings: IfcFragmentSettings;
924
+ /**
925
+ * The instance of the Web-IFC library used for handling IFC data.
926
+ */
927
+ webIfc: WEBIFC.IfcAPI;
1090
928
  /** {@link Component.enabled} */
1091
929
  enabled: boolean;
930
+ private _material;
931
+ private _spatialTree;
932
+ private _metaData;
933
+ private _fragmentInstances;
934
+ private _civil;
935
+ private _visitedFragments;
936
+ private _materialT;
1092
937
  constructor(components: Components);
938
+ /** {@link Disposable.dispose} */
939
+ dispose(): void;
1093
940
  /**
1094
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
941
+ * Sets up the IfcLoader component with the provided configuration.
1095
942
  *
1096
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
1097
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
1098
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
943
+ * @param config - Optional configuration settings for the IfcLoader.
944
+ * If not provided, the existing settings will be used.
1099
945
  *
1100
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
946
+ * @returns A Promise that resolves when the setup process is completed.
947
+ *
948
+ * @remarks
949
+ * If the 'autoSetWasm' option is enabled in the configuration,
950
+ * the method will automatically set the WASM paths for the Web-IFC library.
951
+ *
952
+ * @example
953
+ * '''typescript
954
+ * const ifcLoader = new IfcLoader(components);
955
+ * await ifcLoader.setup({ autoSetWasm: true });
956
+ * '''
1101
957
  */
1102
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
958
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1103
959
  /**
1104
- * Deletes a world from the list of worlds.
960
+ * Loads an IFC file and processes it for 3D visualization.
1105
961
  *
1106
- * @param {World} world - The world to be deleted.
962
+ * @param data - The Uint8Array containing the IFC file data.
963
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1107
964
  *
1108
- * @throws {Error} - Throws an error if the provided world is not found in the list.
965
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1109
966
  *
1110
- * @returns {void}
967
+ * @example
968
+ * '''typescript
969
+ * const ifcLoader = components.get(IfcLoader);
970
+ * const group = await ifcLoader.load(ifcData);
971
+ * '''
1111
972
  */
1112
- delete(world: World): void;
973
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1113
974
  /**
1114
- * Disposes of the Worlds component and all its managed worlds.
1115
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
1116
- * and triggers the onDisposed event.
975
+ * Reads an IFC file and initializes the Web-IFC library.
1117
976
  *
1118
- * @returns {void}
1119
- */
1120
- dispose(): void;
1121
- /** {@link Updateable.update} */
1122
- update(delta?: number): void | Promise<void>;
1123
- }
1124
- import { Component, Disposable, World, Event } from "../Types";
1125
- import { GridConfig, SimpleGrid } from "./src";
1126
- import { Components } from "../Components";
1127
- /**
1128
- * 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).
1129
- */
1130
- export declare class Grids extends Component implements Disposable {
1131
- /**
1132
- * A unique identifier for the component.
1133
- * This UUID is used to register the component within the Components system.
977
+ * @param data - The Uint8Array containing the IFC file data.
978
+ *
979
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
980
+ *
981
+ * @remarks
982
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
983
+ * It also opens the IFC model using the provided data and settings.
984
+ *
985
+ * @example
986
+ * '''typescript
987
+ * const ifcLoader = components.get(IfcLoader);
988
+ * await ifcLoader.readIfcFile(ifcData);
989
+ * '''
1134
990
  */
1135
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
991
+ readIfcFile(data: Uint8Array): Promise<number>;
1136
992
  /**
1137
- * A map of world UUIDs to their corresponding grid instances.
1138
- */
1139
- list: Map<string, SimpleGrid>;
1140
- /**
1141
- * The default configuration for grid creation.
1142
- */
1143
- config: Required<GridConfig>;
1144
- /** {@link Disposable.onDisposed} */
1145
- readonly onDisposed: Event<unknown>;
1146
- /** {@link Component.enabled} */
1147
- enabled: boolean;
1148
- constructor(components: Components);
1149
- /**
1150
- * Creates a new grid for the given world.
1151
- * Throws an error if a grid already exists for the world.
1152
- *
1153
- * @param world - The world to create the grid for.
1154
- * @returns The newly created grid.
1155
- *
1156
- * @throws Will throw an error if a grid already exists for the given world.
1157
- */
1158
- create(world: World): SimpleGrid;
1159
- /**
1160
- * Deletes the grid associated with the given world.
1161
- * If a grid does not exist for the given world, this method does nothing.
1162
- *
1163
- * @param world - The world for which to delete the grid.
993
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
994
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1164
995
  *
1165
996
  * @remarks
1166
- * This method will dispose of the grid and remove it from the internal list.
1167
- * If the world is disposed before calling this method, the grid will be automatically deleted.
997
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
998
+ *
999
+ * @example
1000
+ * '''typescript
1001
+ * const ifcLoader = components.get(IfcLoader);
1002
+ * ifcLoader.cleanUp();
1003
+ * '''
1168
1004
  */
1169
- delete(world: World): void;
1170
- /** {@link Disposable.dispose} */
1171
- dispose(): void;
1005
+ cleanUp(): void;
1006
+ private getAllGeometries;
1007
+ private getMesh;
1008
+ private getGeometry;
1009
+ private autoSetWasm;
1172
1010
  }
1173
- import { MiniMap } from "./src";
1174
- import { Component, Updateable, World, Event, Disposable } from "../Types";
1175
- import { Components } from "../Components";
1011
+ import * as FRAGS from "@thatopen/fragments";
1012
+ import { Components, Component } from "../../core";
1176
1013
  /**
1177
- * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
1014
+ * 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).
1178
1015
  */
1179
- export declare class MiniMaps extends Component implements Updateable, Disposable {
1016
+ export declare class Hider extends Component {
1180
1017
  /**
1181
1018
  * A unique identifier for the component.
1182
1019
  * This UUID is used to register the component within the Components system.
1183
1020
  */
1184
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
1185
- /** {@link Updateable.onAfterUpdate} */
1186
- readonly onAfterUpdate: Event<unknown>;
1187
- /** {@link Updateable.onBeforeUpdate} */
1188
- readonly onBeforeUpdate: Event<unknown>;
1189
- /** {@link Disposable.onDisposed} */
1190
- readonly onDisposed: Event<unknown>;
1021
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1191
1022
  /** {@link Component.enabled} */
1192
1023
  enabled: boolean;
1193
- /**
1194
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
1195
- */
1196
- list: Map<string, MiniMap>;
1197
1024
  constructor(components: Components);
1198
1025
  /**
1199
- * Creates a new {@link MiniMap} instance associated with the given world.
1200
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
1026
+ * Sets the visibility of fragments within the 3D scene.
1027
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1028
+ * If 'items' is provided, only the specified fragments will be affected.
1201
1029
  *
1202
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
1203
- * @returns The newly created {@link MiniMap} instance.
1204
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
1030
+ * @param visible - The visibility state to set for the fragments.
1031
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1032
+ * If not provided, all fragments will be affected.
1033
+ *
1034
+ * @returns {void}
1205
1035
  */
1206
- create(world: World): MiniMap;
1036
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1207
1037
  /**
1208
- * Deletes a {@link MiniMap} instance associated with the given world ID.
1209
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
1038
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1039
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1040
+ *
1041
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1042
+ * If not provided, all fragments will be isolated.
1210
1043
  *
1211
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
1212
1044
  * @returns {void}
1213
1045
  */
1214
- delete(id: string): void;
1215
- /** {@link Disposable.dispose} */
1216
- dispose(): void;
1217
- /** {@link Updateable.update} */
1218
- update(): void;
1046
+ isolate(items: FRAGS.FragmentIdMap): void;
1047
+ private updateCulledVisibility;
1219
1048
  }
1220
- import * as WEBIFC from "web-ifc";
1221
- import * as FRAG from "@thatopen/fragments";
1222
- import { Component, Components } from "../../core";
1049
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1050
+ import * as THREE from "three";
1051
+ import * as FRAGS from "@thatopen/fragments";
1052
+ import { Component, Components, Event, Disposable } from "../../core";
1053
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1223
1054
  /**
1224
- * 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).
1055
+ * 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).
1225
1056
  */
1226
- export declare class IfcJsonExporter extends Component {
1057
+ export declare class FragmentsManager extends Component implements Disposable {
1227
1058
  /**
1228
1059
  * A unique identifier for the component.
1229
1060
  * This UUID is used to register the component within the Components system.
1230
1061
  */
1231
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1232
- /** {@link Component.enabled} */
1233
- enabled: boolean;
1234
- constructor(components: Components);
1062
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1063
+ /** {@link Disposable.onDisposed} */
1064
+ readonly onDisposed: Event<unknown>;
1235
1065
  /**
1236
- * Exports all the properties of an IFC into an array of JS objects.
1237
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1238
- * @param modelID ID of the IFC model whose properties to extract.
1239
- * @param indirect whether to get the indirect relationships as well.
1240
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1241
- * to make the location data available (e.g. absolute position of building).
1066
+ * Event triggered when fragments are loaded.
1242
1067
  */
1243
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1244
- }
1245
- import * as THREE from "three";
1246
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
1247
- import { SimplePlane } from "./src";
1248
- import { Components } from "../Components";
1249
- /**
1250
- * 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).
1251
- *
1252
- * @param components - the instance of {@link Components} used.
1253
- * E.g. {@link SimplePlane}.
1254
- */
1255
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
1068
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
1256
1069
  /**
1257
- * A unique identifier for the component.
1258
- * This UUID is used to register the component within the Components system.
1070
+ * Event triggered when fragments are disposed.
1259
1071
  */
1260
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
1261
- /** Event that fires when the user starts dragging a clipping plane. */
1262
- readonly onBeforeDrag: Event<void>;
1263
- /** Event that fires when the user stops dragging a clipping plane. */
1264
- readonly onAfterDrag: Event<void>;
1072
+ readonly onFragmentsDisposed: Event<{
1073
+ groupID: string;
1074
+ fragmentIDs: string[];
1075
+ }>;
1265
1076
  /**
1266
- * Event that fires when the user starts creating a clipping plane.
1077
+ * Map containing all loaded fragments.
1078
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1267
1079
  */
1268
- readonly onBeforeCreate: Event<unknown>;
1080
+ readonly list: Map<string, Fragment>;
1269
1081
  /**
1270
- * Event that fires when the user cancels the creation of a clipping plane.
1082
+ * Map containing all loaded fragment groups.
1083
+ * The key is the group's unique identifier, and the value is the group itself.
1271
1084
  */
1272
- readonly onBeforeCancel: Event<unknown>;
1085
+ readonly groups: Map<string, FragmentsGroup>;
1086
+ baseCoordinationModel: string;
1087
+ baseCoordinationMatrix: THREE.Matrix4;
1088
+ /** {@link Component.enabled} */
1089
+ enabled: boolean;
1090
+ private _loader;
1273
1091
  /**
1274
- * Event that fires after the user cancels the creation of a clipping plane.
1092
+ * Getter for the meshes of all fragments in the FragmentsManager.
1093
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1094
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1275
1095
  */
1276
- readonly onAfterCancel: Event<unknown>;
1096
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1097
+ constructor(components: Components);
1098
+ /** {@link Disposable.dispose} */
1099
+ dispose(): void;
1277
1100
  /**
1278
- * Event that fires when the user starts deleting a clipping plane.
1101
+ * Dispose of a specific fragment group.
1102
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1103
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1104
+ *
1105
+ * @param group - The fragment group to be disposed.
1279
1106
  */
1280
- readonly onBeforeDelete: Event<unknown>;
1107
+ disposeGroup(group: FragmentsGroup): void;
1281
1108
  /**
1282
- * Event that fires after a clipping plane has been created.
1283
- * @param plane - The newly created clipping plane.
1109
+ * Loads a binary file that contain fragment geometry.
1110
+ * @param data - The binary data to load.
1111
+ * @param config - Optional configuration for loading.
1112
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1113
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1114
+ * @returns The loaded FragmentsGroup.
1284
1115
  */
1285
- readonly onAfterCreate: Event<SimplePlane>;
1116
+ load(data: Uint8Array, config?: Partial<{
1117
+ coordinate: boolean;
1118
+ name: string;
1119
+ properties: FRAGS.IfcProperties;
1120
+ relationsMap: RelationsMap;
1121
+ }>): FragmentsGroup;
1286
1122
  /**
1287
- * Event that fires after a clipping plane has been deleted.
1288
- * @param plane - The deleted clipping plane.
1123
+ * Export the specified fragmentsgroup to binary data.
1124
+ * @param group - the fragments group to be exported.
1125
+ * @returns the exported data as binary buffer.
1289
1126
  */
1290
- readonly onAfterDelete: Event<SimplePlane>;
1291
- /** {@link Disposable.onDisposed} */
1292
- readonly onDisposed: Event<string>;
1127
+ export(group: FragmentsGroup): Uint8Array;
1293
1128
  /**
1294
- * Whether to force the clipping plane to be orthogonal in the Y direction
1295
- * (up). This is desirable when clipping a building horizontally and a
1296
- * clipping plane is created in its roof, which might have a slight
1297
- * slope for draining purposes.
1129
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1130
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1131
+ * @returns A map of model IDs to sets of express IDs.
1298
1132
  */
1299
- orthogonalY: boolean;
1133
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1134
+ [modelID: string]: Set<number>;
1135
+ };
1300
1136
  /**
1301
- * The tolerance that determines whether an almost-horizontal clipping plane
1302
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
1303
- * has to be 'true' for this to apply.
1137
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1138
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1139
+ * @returns A fragment ID map.
1140
+ * @remarks
1141
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1142
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1143
+ * The fragment ID maps are then merged into a single map and returned.
1144
+ * 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.
1304
1145
  */
1305
- toleranceOrthogonalY: number;
1146
+ modelIdToFragmentIdMap(modelIdMap: {
1147
+ [modelID: string]: Set<number>;
1148
+ }): FRAGS.FragmentIdMap;
1306
1149
  /**
1307
- * The type of clipping plane to be created.
1308
- * Default is {@link SimplePlane}.
1150
+ * Applies coordinate transformation to the provided models.
1151
+ * If no models are provided, all groups are used.
1152
+ * The first model in the list becomes the base model for coordinate transformation.
1153
+ * All other models are then transformed to match the base model's coordinate system.
1154
+ *
1155
+ * @param models - The models to apply coordinate transformation to.
1156
+ * If not provided, all models are used.
1309
1157
  */
1310
- Type: new (...args: any) => SimplePlane;
1158
+ coordinate(models?: FragmentsGroup[]): void;
1311
1159
  /**
1312
- * A list of all the clipping planes created by this component.
1160
+ * Applies the base coordinate system to the provided object.
1161
+ *
1162
+ * This function takes an object and its original coordinate system as input.
1163
+ * It then inverts the original coordinate system and applies the base coordinate system
1164
+ * to the object. This ensures that the object's position, rotation, and scale are
1165
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
1166
+ *
1167
+ * @param object - The object to which the base coordinate system will be applied.
1168
+ * This should be an instance of THREE.Object3D.
1169
+ *
1170
+ * @param originalCoordinateSystem - The original coordinate system of the object.
1171
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
1313
1172
  */
1314
- list: SimplePlane[];
1315
- /** The material used in all the clipping planes. */
1316
- private _material;
1317
- private _size;
1318
- private _enabled;
1319
- private _visible;
1173
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1174
+ }
1175
+ import * as WEBIFC from "web-ifc";
1176
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
1177
+ import { PropertiesStreamingSettings } from "./src";
1178
+ /**
1179
+ * 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).
1180
+ */
1181
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
1182
+ /**
1183
+ * A unique identifier for the component.
1184
+ * This UUID is used to register the component within the Components system.
1185
+ */
1186
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1187
+ /**
1188
+ * An event that is triggered when properties are streamed from the IFC file.
1189
+ * The event provides the type of the IFC entity and the corresponding data.
1190
+ */
1191
+ readonly onPropertiesStreamed: AsyncEvent<{
1192
+ type: number;
1193
+ data: {
1194
+ [id: number]: any;
1195
+ };
1196
+ }>;
1197
+ /**
1198
+ * An event that is triggered to indicate the progress of the streaming process.
1199
+ * The event provides a number between 0 and 1 representing the progress percentage.
1200
+ */
1201
+ readonly onProgress: AsyncEvent<number>;
1202
+ /**
1203
+ * An event that is triggered when indices are streamed from the IFC file.
1204
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1205
+ */
1206
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1207
+ /** {@link Disposable.onDisposed} */
1208
+ readonly onDisposed: Event<string>;
1320
1209
  /** {@link Component.enabled} */
1321
- get enabled(): boolean;
1210
+ enabled: boolean;
1211
+ /**
1212
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1213
+ */
1214
+ settings: PropertiesStreamingSettings;
1215
+ /**
1216
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1217
+ */
1218
+ webIfc: WEBIFC.IfcAPI;
1219
+ /** {@link Disposable.dispose} */
1220
+ dispose(): Promise<void>;
1221
+ /**
1222
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1223
+ *
1224
+ * @param data - The Uint8Array containing the IFC file data.
1225
+ * @returns A Promise that resolves when the streaming process is complete.
1226
+ */
1227
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1228
+ /**
1229
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1230
+ *
1231
+ * @param loadCallback - A callback function that loads the IFC file data.
1232
+ * @returns A Promise that resolves when the streaming process is complete.
1233
+ */
1234
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1235
+ private readIfcFile;
1236
+ private streamIfcFile;
1237
+ private streamAllProperties;
1238
+ private cleanUp;
1239
+ }
1240
+ import * as WEBIFC from "web-ifc";
1241
+ import * as FRAG from "@thatopen/fragments";
1242
+ import { Component, Components } from "../../core";
1243
+ /**
1244
+ * 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).
1245
+ */
1246
+ export declare class IfcJsonExporter extends Component {
1247
+ /**
1248
+ * A unique identifier for the component.
1249
+ * This UUID is used to register the component within the Components system.
1250
+ */
1251
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1322
1252
  /** {@link Component.enabled} */
1323
- set enabled(state: boolean);
1324
- /** {@link Hideable.visible } */
1325
- get visible(): boolean;
1326
- /** {@link Hideable.visible } */
1327
- set visible(state: boolean);
1328
- /** The material of the clipping plane representation. */
1329
- get material(): THREE.MeshBasicMaterial;
1330
- /** The material of the clipping plane representation. */
1331
- set material(material: THREE.MeshBasicMaterial);
1332
- /** The size of the geometric representation of the clippings planes. */
1333
- get size(): number;
1334
- /** The size of the geometric representation of the clippings planes. */
1335
- set size(size: number);
1253
+ enabled: boolean;
1254
+ constructor(components: Components);
1255
+ /**
1256
+ * Exports all the properties of an IFC into an array of JS objects.
1257
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1258
+ * @param modelID ID of the IFC model whose properties to extract.
1259
+ * @param indirect whether to get the indirect relationships as well.
1260
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1261
+ * to make the location data available (e.g. absolute position of building).
1262
+ */
1263
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1264
+ }
1265
+ import * as WEBIFC from "web-ifc";
1266
+ import { Components, Disposable, Event, Component } from "../../core";
1267
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1268
+ /**
1269
+ * 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).
1270
+ */
1271
+ export declare class IfcGeometryTiler extends Component implements Disposable {
1272
+ /**
1273
+ * A unique identifier for the component.
1274
+ * This UUID is used to register the component within the Components system.
1275
+ */
1276
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1277
+ /**
1278
+ * Event triggered when geometry is streamed.
1279
+ * Contains the streamed geometry data and its buffer.
1280
+ */
1281
+ readonly onGeometryStreamed: Event<{
1282
+ buffer: Uint8Array;
1283
+ data: StreamedGeometries;
1284
+ }>;
1285
+ /**
1286
+ * Event triggered when assets are streamed.
1287
+ * Contains the streamed assets.
1288
+ */
1289
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
1290
+ /**
1291
+ * Event triggered to indicate the progress of the streaming process.
1292
+ * Contains the progress percentage.
1293
+ */
1294
+ readonly onProgress: Event<number>;
1295
+ /**
1296
+ * Event triggered when the IFC file is loaded.
1297
+ * Contains the loaded IFC file data.
1298
+ */
1299
+ readonly onIfcLoaded: Event<Uint8Array>;
1300
+ /** {@link Disposable.onDisposed} */
1301
+ readonly onDisposed: Event<unknown>;
1302
+ /**
1303
+ * Settings for the IfcGeometryTiler.
1304
+ */
1305
+ settings: IfcStreamingSettings;
1306
+ /** {@link Component.enabled} */
1307
+ enabled: boolean;
1308
+ /**
1309
+ * The WebIFC API instance used for IFC file processing.
1310
+ */
1311
+ webIfc: WEBIFC.IfcAPI;
1312
+ private _spatialTree;
1313
+ private _metaData;
1314
+ private _visitedGeometries;
1315
+ private _streamSerializer;
1316
+ private _geometries;
1317
+ private _geometryCount;
1318
+ private _civil;
1319
+ private _groupSerializer;
1320
+ private _assets;
1321
+ private _meshesWithHoles;
1336
1322
  constructor(components: Components);
1337
1323
  /** {@link Disposable.dispose} */
1338
1324
  dispose(): void;
1339
- /** {@link Createable.create} */
1340
- create(world: World): SimplePlane | null;
1341
1325
  /**
1342
- * Creates a plane in a certain place and with a certain orientation,
1343
- * without the need of the mouse.
1326
+ * This method streams the IFC file from a given buffer.
1344
1327
  *
1345
- * @param world - the world where this plane should be created.
1346
- * @param normal - the orientation of the clipping plane.
1347
- * @param point - the position of the clipping plane.
1348
- * navigation.
1349
- */
1350
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
1351
- /**
1352
- * {@link Createable.delete}
1328
+ * @param data - The Uint8Array containing the IFC file data.
1329
+ * @returns A Promise that resolves when the streaming process is complete.
1353
1330
  *
1354
- * @param world - the world where the plane to delete is.
1355
- * @param plane - the plane to delete. If undefined, the first plane
1356
- * found under the cursor will be deleted.
1331
+ * @remarks
1332
+ * This method cleans up any resources after the streaming process is complete.
1333
+ *
1334
+ * @example
1335
+ * '''typescript
1336
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
1337
+ * const rawBuffer = await response.arrayBuffer();
1338
+ * const ifcBuffer = new Uint8Array(rawBuffer);
1339
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1340
+ * '''
1357
1341
  */
1358
- delete(world: World, plane?: SimplePlane): void;
1342
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1359
1343
  /**
1360
- * Deletes all the existing clipping planes.
1344
+ * This method streams the IFC file from a given callback.
1345
+ *
1346
+ * @param loadCallback - The callback function that will be used to load the IFC file.
1347
+ * @returns A Promise that resolves when the streaming process is complete.
1348
+ *
1349
+ * @remarks
1350
+ * This method cleans up any resources after the streaming process is complete.
1361
1351
  *
1362
- * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
1363
1352
  */
1364
- deleteAll(types?: Set<string>): void;
1365
- private deletePlane;
1366
- private pickPlane;
1367
- private getAllPlaneMeshes;
1368
- private createPlaneFromIntersection;
1369
- private getWorldNormal;
1370
- private normalizePlaneDirectionY;
1371
- private newPlane;
1372
- private updateMaterialsAndPlanes;
1373
- private _onStartDragging;
1374
- private _onEndDragging;
1353
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1354
+ private readIfcFile;
1355
+ private streamIfcFile;
1356
+ private streamAllGeometries;
1357
+ private cleanUp;
1358
+ private getMesh;
1359
+ private getGeometry;
1360
+ private streamAssets;
1361
+ private streamGeometries;
1375
1362
  }
1376
- import * as THREE from "three";
1377
- import { Components } from "../Components";
1378
- import { SimpleCamera } from "..";
1379
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
1363
+ import * as WEBIFC from "web-ifc";
1364
+ import { FragmentsGroup } from "@thatopen/fragments";
1365
+ import { Disposable, Event, Component, Components } from "../../core";
1366
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1367
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1380
1368
  /**
1381
- * 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).
1369
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1382
1370
  */
1383
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
1371
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1384
1372
  /**
1385
- * A ProjectionManager instance that manages the projection modes of the camera.
1373
+ * A unique identifier for the component.
1374
+ * This UUID is used to register the component within the Components system.
1386
1375
  */
1387
- readonly projection: ProjectionManager;
1376
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1377
+ /** {@link Disposable.onDisposed} */
1378
+ readonly onDisposed: Event<string>;
1388
1379
  /**
1389
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
1390
- * This camera is used when the projection mode is set to orthographic.
1380
+ * Event triggered when relations for a model have been indexed.
1381
+ * This event provides the model's UUID and the relations map generated for that model.
1382
+ *
1383
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
1384
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1385
+ * 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.
1391
1386
  */
1392
- readonly threeOrtho: THREE.OrthographicCamera;
1387
+ readonly onRelationsIndexed: Event<{
1388
+ modelID: string;
1389
+ relationsMap: RelationsMap;
1390
+ }>;
1393
1391
  /**
1394
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
1395
- * This camera is used when the projection mode is set to perspective.
1392
+ * Holds the relationship mappings for each model processed by the indexer.
1393
+ * The structure is a map where each key is a model's UUID, and the value is another map.
1394
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1395
+ * representing a specific relation type, and the value is an array of expressIDs of entities
1396
+ * that are related through that relation type. This structure allows for efficient querying
1397
+ * of entity relationships within a model.
1396
1398
  */
1397
- readonly threePersp: THREE.PerspectiveCamera;
1398
- protected readonly _userInputButtons: any;
1399
- protected readonly _frustumSize = 50;
1400
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
1401
- protected _mode: NavigationMode | null;
1402
- private previousSize;
1399
+ readonly relationMaps: ModelsRelationMap;
1400
+ /** {@link Component.enabled} */
1401
+ enabled: boolean;
1402
+ private _relToAttributesMap;
1403
+ private _inverseAttributes;
1404
+ private _ifcRels;
1405
+ constructor(components: Components);
1406
+ private onFragmentsDisposed;
1407
+ private indexRelations;
1408
+ private getAttributeIndex;
1403
1409
  /**
1404
- * Getter for the current navigation mode.
1405
- * Throws an error if the mode is not found or the camera is not initialized.
1410
+ * Adds a relation map to the model's relations map.
1406
1411
  *
1407
- * @returns {NavigationMode} The current navigation mode.
1412
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1413
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1408
1414
  *
1409
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
1415
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1410
1416
  */
1411
- get mode(): NavigationMode;
1412
- constructor(components: Components);
1413
- /** {@link Disposable.dispose} */
1414
- dispose(): void;
1417
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1415
1418
  /**
1416
- * Sets a new {@link NavigationMode} and disables the previous one.
1419
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1420
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1421
+ * and maps them in a structured way to facilitate quick access to related entities.
1417
1422
  *
1418
- * @param mode - The {@link NavigationMode} to set.
1423
+ * The process involves querying the model for each relation type associated with the inverse attributes
1424
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1425
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
1426
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1427
+ * of entities that are related through that attribute.
1428
+ *
1429
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1430
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1431
+ * representation of the relations indexed by entity expressIDs and relation types.
1432
+ * @throws An error if the model does not have properties loaded.
1419
1433
  */
1420
- set(mode: NavModeID): void;
1434
+ process(model: FragmentsGroup): Promise<RelationsMap>;
1421
1435
  /**
1422
- * Make the camera view fit all the specified meshes.
1436
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
1423
1437
  *
1424
- * @param meshes the meshes to fit. If it is not defined, it will
1425
- * evaluate {@link Components.meshes}.
1426
- * @param offset the distance to the fit object
1438
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1439
+ * @param modelID - The unique identifier of the model within the WebIfc API.
1440
+ * @returns A promise that resolves to the relations map for the processed model.
1441
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1442
+ */
1443
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1444
+ /**
1445
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
1446
+ * This method searches the indexed relation maps for the specified model and entity,
1447
+ * returning the IDs of related entities if a match is found.
1448
+ *
1449
+ * @param model The 'FragmentsGroup' model containing the entity.
1450
+ * @param expressID The unique identifier of the entity within the model.
1451
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1452
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1453
+ * or the specified relation name is not indexed.
1454
+ */
1455
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1456
+ /**
1457
+ * Serializes the relations of a given relation map into a JSON string.
1458
+ * 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,
1459
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1460
+ * The resulting object is then serialized into a JSON string.
1461
+ *
1462
+ * @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.
1463
+ * @returns A JSON string representing the serialized relations of the given relation map.
1464
+ */
1465
+ serializeRelations(relationMap: RelationsMap): string;
1466
+ /**
1467
+ * Serializes the relations of a specific model into a JSON string.
1468
+ * This method iterates through the relations indexed for the given model,
1469
+ * organizing them into a structured object where each key is an expressID of an entity,
1470
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1471
+ * The resulting object is then serialized into a JSON string.
1472
+ *
1473
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1474
+ * @returns A JSON string representing the serialized relations of the specified model.
1475
+ * If the model has no indexed relations, 'null' is returned.
1476
+ */
1477
+ serializeModelRelations(model: FragmentsGroup): string | null;
1478
+ /**
1479
+ * Serializes all relations of every model processed by the indexer into a JSON string.
1480
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1481
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1482
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
1483
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
1484
+ *
1485
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1486
+ * If no relations have been indexed, an empty object is returned as a JSON string.
1487
+ */
1488
+ serializeAllRelations(): string;
1489
+ /**
1490
+ * Converts a JSON string representing relations between entities into a structured map.
1491
+ * This method parses the JSON string to reconstruct the relations map that indexes
1492
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1493
+ * and the values are maps where each key is a relation type ID and its value is an array
1494
+ * of express IDs of entities related through that relation type.
1495
+ *
1496
+ * @param json The JSON string to be parsed into the relations map.
1497
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1498
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1499
+ * is an array of express IDs (as numbers) of entities related through that relation type.
1500
+ */
1501
+ getRelationsMapFromJSON(json: string): RelationsMap;
1502
+ /** {@link Disposable.dispose} */
1503
+ dispose(): void;
1504
+ /**
1505
+ * Adds relations between an entity and other entities in a BIM model.
1506
+ *
1507
+ * @param model - The BIM model to which the relations will be added.
1508
+ * @param expressID - The expressID of the entity within the model.
1509
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1510
+ * @param relIDs - The expressIDs of the related entities within the model.
1511
+ *
1512
+ * @throws An error if the relation name is not a valid relation name.
1427
1513
  */
1428
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
1514
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1429
1515
  /**
1430
- * Allows or prevents all user input.
1516
+ * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1431
1517
  *
1432
- * @param active - whether to enable or disable user inputs.
1518
+ * @param model The BIM model whose children to get.
1519
+ * @param expressID The expressID of the item whose children to get.
1520
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1521
+ *
1522
+ * @returns A 'Set' with the expressIDs of the found items.
1433
1523
  */
1434
- setUserInput(active: boolean): void;
1435
- private disableUserInput;
1436
- private enableUserInput;
1437
- private newOrthoCamera;
1438
- private setOrthoPerspCameraAspect;
1524
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1439
1525
  }
1526
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
1440
1527
  import { Components } from "../Components";
1441
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
1442
- import { Component, Event, Disposable, World } from "../Types";
1528
+ import { SimpleWorld } from "./src";
1443
1529
  /**
1444
- * 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).
1530
+ * 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).
1445
1531
  */
1446
- export declare class Cullers extends Component implements Disposable {
1532
+ export declare class Worlds extends Component implements Updateable, Disposable {
1447
1533
  /**
1448
1534
  * A unique identifier for the component.
1449
1535
  * This UUID is used to register the component within the Components system.
1450
1536
  */
1451
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
1537
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
1538
+ /** {@link Updateable.onAfterUpdate} */
1539
+ readonly onAfterUpdate: Event<unknown>;
1540
+ /** {@link Updateable.onBeforeUpdate} */
1541
+ readonly onBeforeUpdate: Event<unknown>;
1542
+ /** {@link Disposable.onDisposed} */
1543
+ readonly onDisposed: Event<unknown>;
1452
1544
  /**
1453
- * An event that is triggered when the Cullers component is disposed.
1545
+ * An event that is triggered when a new world is created.
1546
+ * The event passes the newly created world as a parameter.
1454
1547
  */
1455
- readonly onDisposed: Event<unknown>;
1456
- private _enabled;
1548
+ readonly onWorldCreated: Event<World>;
1457
1549
  /**
1458
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
1550
+ * An event that is triggered when a world is deleted.
1551
+ * The event passes the UUID of the deleted world as a parameter.
1459
1552
  */
1460
- list: Map<string, MeshCullerRenderer>;
1461
- /** {@link Component.enabled} */
1462
- get enabled(): boolean;
1553
+ readonly onWorldDeleted: Event<string>;
1554
+ /**
1555
+ * A collection of worlds managed by this component.
1556
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
1557
+ */
1558
+ list: Map<string, World>;
1463
1559
  /** {@link Component.enabled} */
1464
- set enabled(value: boolean);
1560
+ enabled: boolean;
1465
1561
  constructor(components: Components);
1466
1562
  /**
1467
- * Creates a new MeshCullerRenderer for the given world.
1468
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
1563
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
1469
1564
  *
1470
- * @param world - The world for which to create the MeshCullerRenderer.
1471
- * @param config - Optional configuration settings for the MeshCullerRenderer.
1565
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
1566
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
1567
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
1472
1568
  *
1473
- * @returns The newly created or existing MeshCullerRenderer for the given world.
1569
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
1474
1570
  */
1475
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
1571
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
1476
1572
  /**
1477
- * Deletes the MeshCullerRenderer associated with the given world.
1478
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
1573
+ * Deletes a world from the list of worlds.
1479
1574
  *
1480
- * @param world - The world for which to delete the MeshCullerRenderer.
1575
+ * @param {World} world - The world to be deleted.
1576
+ *
1577
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
1481
1578
  *
1482
1579
  * @returns {void}
1483
1580
  */
1484
1581
  delete(world: World): void;
1485
- /** {@link Disposable.dispose} */
1582
+ /**
1583
+ * Disposes of the Worlds component and all its managed worlds.
1584
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
1585
+ * and triggers the onDisposed event.
1586
+ *
1587
+ * @returns {void}
1588
+ */
1486
1589
  dispose(): void;
1590
+ /** {@link Updateable.update} */
1591
+ update(delta?: number): void | Promise<void>;
1487
1592
  }
1488
1593
  import * as WEBIFC from "web-ifc";
1489
1594
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1690,381 +1795,230 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1690
1795
  *
1691
1796
  * @returns A promise that resolves when the property has been removed.
1692
1797
  *
1693
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1694
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1695
- */
1696
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1697
- addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
1698
- /**
1699
- * Adds elements to a Property Set (Pset) in the given model.
1700
- *
1701
- * @param model - The FragmentsGroup model in which to add the elements.
1702
- * @param psetID - The express ID of the Pset to which to add the elements.
1703
- * @param elementID - The express IDs of the elements to be added.
1704
- *
1705
- * @returns A promise that resolves when all the elements have been added.
1706
- *
1707
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1708
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1709
- * @throws Will throw an error if no relation is found between the Pset and the model.
1710
- */
1711
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1712
- /**
1713
- * Saves the changes made to the model to a new IFC file.
1714
- *
1715
- * @param model - The FragmentsGroup model from which to save the changes.
1716
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1717
- *
1718
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1719
- *
1720
- * @throws Will throw an error if any issues occur during the saving process.
1721
- */
1722
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1723
- /**
1724
- * Sets an attribute listener for a specific attribute of an entity in the model.
1725
- * The listener will trigger an event whenever the attribute's value changes.
1726
- *
1727
- * @param model - The FragmentsGroup model in which to set the attribute listener.
1728
- * @param expressID - The express ID of the entity for which to set the listener.
1729
- * @param attributeName - The name of the attribute for which to set the listener.
1730
- *
1731
- * @returns The event that will be triggered when the attribute's value changes.
1732
- *
1733
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
1734
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1735
- * @throws Will throw an error if the attribute has a badly defined handle.
1736
- */
1737
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1738
- private increaseMaxID;
1739
- private newGUID;
1740
- private getOwnerHistory;
1741
- private registerChange;
1742
- private newSingleProperty;
1743
- }
1744
- import * as WEBIFC from "web-ifc";
1745
- import { FragmentsGroup } from "@thatopen/fragments";
1746
- import { Disposable, Event, Component, Components } from "../../core";
1747
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1748
- export type { InverseAttribute, RelationsMap } from "./src/types";
1749
- /**
1750
- * 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).
1751
- */
1752
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1753
- /**
1754
- * A unique identifier for the component.
1755
- * This UUID is used to register the component within the Components system.
1756
- */
1757
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1758
- /** {@link Disposable.onDisposed} */
1759
- readonly onDisposed: Event<string>;
1760
- /**
1761
- * Event triggered when relations for a model have been indexed.
1762
- * This event provides the model's UUID and the relations map generated for that model.
1763
- *
1764
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1765
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1766
- * 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.
1767
- */
1768
- readonly onRelationsIndexed: Event<{
1769
- modelID: string;
1770
- relationsMap: RelationsMap;
1771
- }>;
1772
- /**
1773
- * Holds the relationship mappings for each model processed by the indexer.
1774
- * The structure is a map where each key is a model's UUID, and the value is another map.
1775
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1776
- * representing a specific relation type, and the value is an array of expressIDs of entities
1777
- * that are related through that relation type. This structure allows for efficient querying
1778
- * of entity relationships within a model.
1779
- */
1780
- readonly relationMaps: ModelsRelationMap;
1781
- /** {@link Component.enabled} */
1782
- enabled: boolean;
1783
- private _relToAttributesMap;
1784
- private _inverseAttributes;
1785
- private _ifcRels;
1786
- constructor(components: Components);
1787
- private onFragmentsDisposed;
1788
- private indexRelations;
1789
- private getAttributeIndex;
1790
- /**
1791
- * Adds a relation map to the model's relations map.
1792
- *
1793
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1794
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1795
- *
1796
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1797
- */
1798
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1799
- /**
1800
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1801
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1802
- * and maps them in a structured way to facilitate quick access to related entities.
1803
- *
1804
- * The process involves querying the model for each relation type associated with the inverse attributes
1805
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1806
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1807
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1808
- * of entities that are related through that attribute.
1809
- *
1810
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1811
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1812
- * representation of the relations indexed by entity expressIDs and relation types.
1813
- * @throws An error if the model does not have properties loaded.
1814
- */
1815
- process(model: FragmentsGroup): Promise<RelationsMap>;
1816
- /**
1817
- * Processes a given model from a WebIfc API to index its IFC entities relations.
1818
- *
1819
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1820
- * @param modelID - The unique identifier of the model within the WebIfc API.
1821
- * @returns A promise that resolves to the relations map for the processed model.
1822
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1823
- */
1824
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1825
- /**
1826
- * Retrieves the relations of a specific entity within a model based on the given relation name.
1827
- * This method searches the indexed relation maps for the specified model and entity,
1828
- * returning the IDs of related entities if a match is found.
1829
- *
1830
- * @param model The 'FragmentsGroup' model containing the entity.
1831
- * @param expressID The unique identifier of the entity within the model.
1832
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1833
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1834
- * or the specified relation name is not indexed.
1835
- */
1836
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1837
- /**
1838
- * Serializes the relations of a given relation map into a JSON string.
1839
- * 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,
1840
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1841
- * The resulting object is then serialized into a JSON string.
1842
- *
1843
- * @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.
1844
- * @returns A JSON string representing the serialized relations of the given relation map.
1845
- */
1846
- serializeRelations(relationMap: RelationsMap): string;
1847
- /**
1848
- * Serializes the relations of a specific model into a JSON string.
1849
- * This method iterates through the relations indexed for the given model,
1850
- * organizing them into a structured object where each key is an expressID of an entity,
1851
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1852
- * The resulting object is then serialized into a JSON string.
1853
- *
1854
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1855
- * @returns A JSON string representing the serialized relations of the specified model.
1856
- * If the model has no indexed relations, 'null' is returned.
1857
- */
1858
- serializeModelRelations(model: FragmentsGroup): string | null;
1859
- /**
1860
- * Serializes all relations of every model processed by the indexer into a JSON string.
1861
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1862
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1863
- * and its value is another object mapping entity expressIDs to their related entities, categorized
1864
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1865
- *
1866
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1867
- * If no relations have been indexed, an empty object is returned as a JSON string.
1798
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1799
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1868
1800
  */
1869
- serializeAllRelations(): string;
1801
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1802
+ addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
1870
1803
  /**
1871
- * Converts a JSON string representing relations between entities into a structured map.
1872
- * This method parses the JSON string to reconstruct the relations map that indexes
1873
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1874
- * and the values are maps where each key is a relation type ID and its value is an array
1875
- * of express IDs of entities related through that relation type.
1804
+ * Adds elements to a Property Set (Pset) in the given model.
1876
1805
  *
1877
- * @param json The JSON string to be parsed into the relations map.
1878
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1879
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1880
- * is an array of express IDs (as numbers) of entities related through that relation type.
1806
+ * @param model - The FragmentsGroup model in which to add the elements.
1807
+ * @param psetID - The express ID of the Pset to which to add the elements.
1808
+ * @param elementID - The express IDs of the elements to be added.
1809
+ *
1810
+ * @returns A promise that resolves when all the elements have been added.
1811
+ *
1812
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1813
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1814
+ * @throws Will throw an error if no relation is found between the Pset and the model.
1881
1815
  */
1882
- getRelationsMapFromJSON(json: string): RelationsMap;
1883
- /** {@link Disposable.dispose} */
1884
- dispose(): void;
1816
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1885
1817
  /**
1886
- * Adds relations between an entity and other entities in a BIM model.
1818
+ * Saves the changes made to the model to a new IFC file.
1887
1819
  *
1888
- * @param model - The BIM model to which the relations will be added.
1889
- * @param expressID - The expressID of the entity within the model.
1890
- * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1891
- * @param relIDs - The expressIDs of the related entities within the model.
1820
+ * @param model - The FragmentsGroup model from which to save the changes.
1821
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1892
1822
  *
1893
- * @throws An error if the relation name is not a valid relation name.
1823
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1824
+ *
1825
+ * @throws Will throw an error if any issues occur during the saving process.
1894
1826
  */
1895
- addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1827
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1896
1828
  /**
1897
- * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1829
+ * Sets an attribute listener for a specific attribute of an entity in the model.
1830
+ * The listener will trigger an event whenever the attribute's value changes.
1898
1831
  *
1899
- * @param model The BIM model whose children to get.
1900
- * @param expressID The expressID of the item whose children to get.
1901
- * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1832
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
1833
+ * @param expressID - The express ID of the entity for which to set the listener.
1834
+ * @param attributeName - The name of the attribute for which to set the listener.
1902
1835
  *
1903
- * @returns A 'Set' with the expressIDs of the found items.
1836
+ * @returns The event that will be triggered when the attribute's value changes.
1837
+ *
1838
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
1839
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1840
+ * @throws Will throw an error if the attribute has a badly defined handle.
1904
1841
  */
1905
- getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1842
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1843
+ private increaseMaxID;
1844
+ private newGUID;
1845
+ private getOwnerHistory;
1846
+ private registerChange;
1847
+ private newSingleProperty;
1906
1848
  }
1907
1849
  import * as THREE from "three";
1908
- import { Component, Components, Disposable, Event, World } from "../core";
1850
+ import * as FRAGS from "@thatopen/fragments";
1851
+ import { Disposable, Component, Event, Components } from "../../core";
1909
1852
  /**
1910
- * Configuration interface for the VertexPicker component.
1853
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
1911
1854
  */
1912
- export interface VertexPickerConfig {
1913
- /**
1914
- * If true, only vertices will be picked, not the closest point on the face.
1915
- */
1916
- showOnlyVertex: boolean;
1917
- /**
1918
- * The maximum distance for snapping to a vertex.
1919
- */
1920
- snapDistance: number;
1855
+ export interface Classification {
1921
1856
  /**
1922
- * The HTML element to use for previewing the picked vertex.
1857
+ * A system within the classification.
1858
+ * The key is the system name, and the value is an object representing the classes within the system.
1923
1859
  */
1924
- previewElement: HTMLElement;
1860
+ [system: string]: {
1861
+ /**
1862
+ * A class within the system.
1863
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1864
+ */
1865
+ [className: string]: {
1866
+ map: FRAGS.FragmentIdMap;
1867
+ name: string;
1868
+ id: number | null;
1869
+ };
1870
+ };
1925
1871
  }
1926
1872
  /**
1927
- * A class that provides functionality for picking vertices in a 3D scene.
1873
+ * 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).
1928
1874
  */
1929
- export declare class VertexPicker extends Component implements Disposable {
1930
- /** {@link Disposable.onDisposed} */
1931
- readonly onDisposed: Event<unknown>;
1932
- /**
1933
- * An event that is triggered when a vertex is found.
1934
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1935
- */
1936
- readonly onVertexFound: Event<THREE.Vector3>;
1937
- /**
1938
- * An event that is triggered when a vertex is lost.
1939
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1940
- */
1941
- readonly onVertexLost: Event<THREE.Vector3>;
1875
+ export declare class Classifier extends Component implements Disposable {
1942
1876
  /**
1943
- * An event that is triggered when the picker is enabled or disabled
1877
+ * A unique identifier for the component.
1878
+ * This UUID is used to register the component within the Components system.
1944
1879
  */
1945
- readonly onEnabled: Event<boolean>;
1880
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1881
+ /** {@link Component.enabled} */
1882
+ enabled: boolean;
1946
1883
  /**
1947
- * A reference to the Components instance associated with this VertexPicker.
1884
+ * A map representing the classification systems.
1885
+ * The key is the system name, and the value is an object representing the classes within the system.
1948
1886
  */
1949
- components: Components;
1887
+ list: Classification;
1888
+ /** {@link Disposable.onDisposed} */
1889
+ readonly onDisposed: Event<unknown>;
1890
+ constructor(components: Components);
1891
+ private onFragmentsDisposed;
1892
+ /** {@link Disposable.dispose} */
1893
+ dispose(): void;
1950
1894
  /**
1951
- * A reference to the working plane used for vertex picking.
1952
- * This plane is used to determine which vertices are considered valid for picking.
1953
- * If this value is null, all vertices are considered valid.
1895
+ * Removes a fragment from the classification based on its unique identifier (guid).
1896
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1897
+ *
1898
+ * @param guid - The unique identifier of the fragment to be removed.
1954
1899
  */
1955
- workingPlane: THREE.Plane | null;
1956
- private _pickedPoint;
1957
- private _config;
1958
- private _enabled;
1900
+ remove(guid: string): void;
1959
1901
  /**
1960
- * Sets the enabled state of the VertexPicker.
1961
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1962
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1902
+ * Finds and returns fragments based on the provided filter criteria.
1903
+ * If no filter is provided, it returns all fragments.
1963
1904
  *
1964
- * @param value - The new enabled state.
1905
+ * @param filter - An optional object containing filter criteria.
1906
+ * The keys of the object represent the classification system names,
1907
+ * and the values are arrays of class names to match.
1908
+ *
1909
+ * @returns A map of fragment GUIDs to their respective express IDs,
1910
+ * where the express IDs are filtered based on the provided filter criteria.
1911
+ *
1912
+ * @throws Will throw an error if the fragments map is malformed.
1965
1913
  */
1966
- set enabled(value: boolean);
1914
+ find(filter?: {
1915
+ [name: string]: string[];
1916
+ }): FRAGS.FragmentIdMap;
1967
1917
  /**
1968
- * Gets the current enabled state of the VertexPicker.
1918
+ * Classifies fragments based on their modelID.
1919
+ *
1920
+ * @param modelID - The unique identifier of the model to classify fragments by.
1921
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1922
+ *
1923
+ * @remarks
1924
+ * This method iterates through the fragments in the provided group,
1925
+ * and classifies them based on their modelID.
1926
+ * The classification is stored in the 'list.models' property,
1927
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1969
1928
  *
1970
- * @returns The current enabled state.
1971
1929
  */
1972
- get enabled(): boolean;
1930
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1973
1931
  /**
1974
- * Sets the configuration for the VertexPicker component.
1932
+ * Classifies fragments based on their PredefinedType property.
1975
1933
  *
1976
- * @param value - A Partial object containing the configuration properties to update.
1977
- * The properties not provided in the value object will retain their current values.
1934
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1978
1935
  *
1979
- * @example
1980
- * '''typescript
1981
- * vertexPicker.config = {
1982
- * snapDistance: 0.5,
1983
- * showOnlyVertex: true,
1984
- * };
1985
- * '''
1936
+ * @remarks
1937
+ * This method iterates through the properties of the fragments in the provided group,
1938
+ * and classifies them based on their PredefinedType property.
1939
+ * The classification is stored in the 'list.predefinedTypes' property,
1940
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1941
+ *
1942
+ * @throws Will throw an error if the fragment ID is not found.
1986
1943
  */
1987
- set config(value: Partial<VertexPickerConfig>);
1944
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1988
1945
  /**
1989
- * Gets the current configuration for the VertexPicker component.
1946
+ * Classifies fragments based on their entity type.
1990
1947
  *
1991
- * @returns A copy of the current VertexPickerConfig object.
1948
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1992
1949
  *
1993
- * @example
1994
- * '''typescript
1995
- * const currentConfig = vertexPicker.config;
1996
- * console.log(currentConfig.snapDistance); // Output: 0.25
1997
- * '''
1950
+ * @remarks
1951
+ * This method iterates through the relations of the fragments in the provided group,
1952
+ * and classifies them based on their entity type.
1953
+ * The classification is stored in the 'list.entities' property,
1954
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1955
+ *
1956
+ * @throws Will throw an error if the fragment ID is not found.
1998
1957
  */
1999
- get config(): Partial<VertexPickerConfig>;
2000
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
2001
- /** {@link Disposable.dispose} */
2002
- dispose(): void;
1958
+ byEntity(group: FRAGS.FragmentsGroup): void;
2003
1959
  /**
2004
- * Performs the vertex picking operation based on the current state of the VertexPicker.
2005
- *
2006
- * @param world - The World instance to use for raycasting.
1960
+ * Classifies fragments based on a specific IFC relationship.
2007
1961
  *
2008
- * @returns The current picked point, or null if no point is picked.
1962
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1963
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1964
+ * @param systemName - The name of the classification system to store the classification.
2009
1965
  *
2010
1966
  * @remarks
2011
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2012
- * If enabled, it performs raycasting to find the closest intersecting object.
2013
- * It then determines the closest vertex or point on the face, based on the configuration settings.
2014
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2015
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2016
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1967
+ * This method iterates through the relations of the fragments in the provided group,
1968
+ * and classifies them based on the specified IFC relationship.
1969
+ * The classification is stored in the 'list' property under the specified system name,
1970
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1971
+ *
1972
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
2017
1973
  */
2018
- get(world: World): THREE.Vector3 | null;
2019
- private getClosestVertex;
2020
- private getVertices;
2021
- private getVertex;
2022
- }
2023
- import * as WEBIFC from "web-ifc";
2024
- /** Configuration of the IFC-fragment conversion. */
2025
- export declare class IfcFragmentSettings {
2026
- /** Whether to extract the IFC properties into a JSON. */
2027
- includeProperties: boolean;
1974
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
2028
1975
  /**
2029
- * Generate the geometry for categories that are not included by default,
2030
- * like IFCSPACE.
1976
+ * Classifies fragments based on their spatial structure in the IFC model.
1977
+ *
1978
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1979
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1980
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1981
+ * the classifier just pick the WEBIFC categories provided.
1982
+ *
1983
+ * @remarks
1984
+ * This method iterates through the relations of the fragments in the provided group,
1985
+ * and classifies them based on their spatial structure in the IFC model.
1986
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1987
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1988
+ *
1989
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
2031
1990
  */
2032
- optionalCategories: number[];
2033
- /** Whether to use the coordination data coming from the IFC files. */
2034
- coordinate: boolean;
2035
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2036
- wasm: {
2037
- path: string;
2038
- absolute: boolean;
2039
- logLevel?: WEBIFC.LogLevel;
2040
- };
2041
- /** List of categories that won't be converted to fragments. */
2042
- excludedCategories: Set<number>;
2043
- /** Whether to save the absolute location of all IFC items. */
2044
- saveLocations: boolean;
2045
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2046
- webIfc: WEBIFC.LoaderSettings;
1991
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1992
+ useProperties?: boolean;
1993
+ isolate?: Set<number>;
1994
+ }): Promise<void>;
2047
1995
  /**
2048
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2049
- * If set to true, the path will be set to the default path of the WASM file.
2050
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2051
- * Default value is true.
1996
+ * Sets the color of the specified fragments.
1997
+ *
1998
+ * @param items - A map of fragment IDs to their respective express IDs.
1999
+ * @param color - The color to set for the fragments.
2000
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
2001
+ *
2002
+ * @remarks
2003
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
2004
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
2005
+ *
2006
+ * @throws Will throw an error if the fragment with the specified ID is not found.
2052
2007
  */
2053
- autoSetWasm: boolean;
2008
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
2054
2009
  /**
2055
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2056
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2057
- * If set to null, the default file location handler will be used.
2010
+ * Resets the color of the specified fragments to their original color.
2058
2011
  *
2059
- * @param url - The URL of the file to locate.
2060
- * @returns The absolute path of the file.
2012
+ * @param items - A map of fragment IDs to their respective express IDs.
2013
+ *
2014
+ * @remarks
2015
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
2016
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
2017
+ *
2018
+ * @throws Will throw an error if the fragment with the specified ID is not found.
2061
2019
  */
2062
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2063
- }
2064
- import * as FRAGS from "@thatopen/fragments";
2065
- import * as WEBIFC from "web-ifc";
2066
- export declare class SpatialIdsFinder {
2067
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2020
+ resetColor(items: FRAGS.FragmentIdMap): void;
2021
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
2068
2022
  }
2069
2023
  import * as THREE from "three";
2070
2024
  import * as FRAGS from "@thatopen/fragments";
@@ -2171,10 +2125,52 @@ export declare class MeasurementUtils extends Component {
2171
2125
  private getVolumeOfMesh;
2172
2126
  private getSignedVolumeOfTriangle;
2173
2127
  }
2174
- /**
2175
- * A Set of unique numbers representing different types of IFC geometries.
2176
- */
2177
- export declare const GeometryTypes: Set<number>;
2128
+ import * as WEBIFC from "web-ifc";
2129
+ /** Configuration of the IFC-fragment conversion. */
2130
+ export declare class IfcFragmentSettings {
2131
+ /** Whether to extract the IFC properties into a JSON. */
2132
+ includeProperties: boolean;
2133
+ /**
2134
+ * Generate the geometry for categories that are not included by default,
2135
+ * like IFCSPACE.
2136
+ */
2137
+ optionalCategories: number[];
2138
+ /** Whether to use the coordination data coming from the IFC files. */
2139
+ coordinate: boolean;
2140
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2141
+ wasm: {
2142
+ path: string;
2143
+ absolute: boolean;
2144
+ logLevel?: WEBIFC.LogLevel;
2145
+ };
2146
+ /** List of categories that won't be converted to fragments. */
2147
+ excludedCategories: Set<number>;
2148
+ /** Whether to save the absolute location of all IFC items. */
2149
+ saveLocations: boolean;
2150
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2151
+ webIfc: WEBIFC.LoaderSettings;
2152
+ /**
2153
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2154
+ * If set to true, the path will be set to the default path of the WASM file.
2155
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2156
+ * Default value is true.
2157
+ */
2158
+ autoSetWasm: boolean;
2159
+ /**
2160
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2161
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2162
+ * If set to null, the default file location handler will be used.
2163
+ *
2164
+ * @param url - The URL of the file to locate.
2165
+ * @returns The absolute path of the file.
2166
+ */
2167
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2168
+ }
2169
+ import * as FRAGS from "@thatopen/fragments";
2170
+ import * as WEBIFC from "web-ifc";
2171
+ export declare class SpatialIdsFinder {
2172
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2173
+ }
2178
2174
  import * as THREE from "three";
2179
2175
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2180
2176
  /**
@@ -2279,12 +2275,6 @@ export interface IfcItemsCategories {
2279
2275
  export declare class IfcCategories {
2280
2276
  getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2281
2277
  }
2282
- /**
2283
- * 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.
2284
- */
2285
- export declare const IfcCategoryMap: {
2286
- [key: number]: string;
2287
- };
2288
2278
  import * as FRAGS from "@thatopen/fragments";
2289
2279
  export declare class IfcPropertiesUtils {
2290
2280
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -2321,80 +2311,106 @@ export declare class IfcPropertiesUtils {
2321
2311
  export declare const IfcElements: {
2322
2312
  [key: number]: string;
2323
2313
  };
2314
+ /**
2315
+ * 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.
2316
+ */
2317
+ export declare const IfcCategoryMap: {
2318
+ [key: number]: string;
2319
+ };
2320
+ /**
2321
+ * A Set of unique numbers representing different types of IFC geometries.
2322
+ */
2323
+ export declare const GeometryTypes: Set<number>;
2324
2324
  import * as THREE from "three";
2325
- import { Disposable, Event } from "../../Types";
2325
+ import { Components } from "../../Components";
2326
+ import { AsyncEvent, Event, World } from "../../Types";
2326
2327
  /**
2327
- * 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.
2328
+ * Settings to configure the CullerRenderer.
2328
2329
  */
2329
- export declare class Mouse implements Disposable {
2330
- dom: HTMLCanvasElement;
2331
- private _event?;
2332
- private _position;
2333
- /** {@link Disposable.onDisposed} */
2334
- readonly onDisposed: Event<unknown>;
2335
- constructor(dom: HTMLCanvasElement);
2330
+ export interface CullerRendererSettings {
2336
2331
  /**
2337
- * The real position of the mouse of the Three.js canvas.
2332
+ * Interval in milliseconds at which the visibility check should be performed.
2333
+ * Default value is 1000.
2338
2334
  */
2339
- get position(): THREE.Vector2;
2340
- /** {@link Disposable.dispose} */
2341
- dispose(): void;
2342
- private getPositionY;
2343
- private getPositionX;
2344
- private updateMouseInfo;
2345
- private setupEvents;
2335
+ updateInterval?: number;
2336
+ /**
2337
+ * Width of the render target used for visibility checks.
2338
+ * Default value is 512.
2339
+ */
2340
+ width?: number;
2341
+ /**
2342
+ * Height of the render target used for visibility checks.
2343
+ * Default value is 512.
2344
+ */
2345
+ height?: number;
2346
+ /**
2347
+ * Whether the visibility check should be performed automatically.
2348
+ * Default value is true.
2349
+ */
2350
+ autoUpdate?: boolean;
2346
2351
  }
2347
- import * as THREE from "three";
2348
- import { Components } from "../../Components";
2349
- import { Event, World, Disposable } from "../../Types";
2350
- import { Mouse } from "./mouse";
2351
2352
  /**
2352
- * 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.
2353
+ * A base renderer to determine visibility on screen.
2353
2354
  */
2354
- export declare class SimpleRaycaster implements Disposable {
2355
- /** {@link Component.enabled} */
2356
- enabled: boolean;
2357
- /** The components instance to which this Raycaster belongs. */
2358
- components: Components;
2355
+ export declare class CullerRenderer {
2359
2356
  /** {@link Disposable.onDisposed} */
2360
- readonly onDisposed: Event<unknown>;
2361
- /** The position of the mouse in the screen. */
2362
- readonly mouse: Mouse;
2357
+ readonly onDisposed: Event<string>;
2363
2358
  /**
2364
- * A reference to the Three.js Raycaster instance.
2365
- * This is used for raycasting operations.
2359
+ * Fires after making the visibility check to the meshes. It lists the
2360
+ * meshes that are currently visible, and the ones that were visible
2361
+ * just before but not anymore.
2366
2362
  */
2367
- readonly three: THREE.Raycaster;
2363
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2368
2364
  /**
2369
- * A reference to the world instance to which this Raycaster belongs.
2370
- * This is used to access the camera and meshes.
2365
+ * Whether this renderer is active or not. If not, it won't render anything.
2371
2366
  */
2372
- world: World;
2373
- constructor(components: Components, world: World);
2374
- /** {@link Disposable.dispose} */
2375
- dispose(): void;
2367
+ enabled: boolean;
2376
2368
  /**
2377
- * Throws a ray from the camera to the mouse or touch event point and returns
2378
- * the first item found. This also takes into account the clipping planes
2379
- * used by the renderer.
2380
- *
2381
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2382
- * to query. If not provided, it will query all the meshes stored in
2383
- * {@link Components.meshes}.
2369
+ * Needs to check whether there are objects that need to be hidden or shown.
2370
+ * You can bind this to the camera movement, to a certain interval, etc.
2384
2371
  */
2385
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2372
+ needsUpdate: boolean;
2386
2373
  /**
2387
- * Casts a ray from a given origin in a given direction and returns the first item found.
2388
- * This method also takes into account the clipping planes used by the renderer.
2389
- *
2390
- * @param origin - The origin of the ray.
2391
- * @param direction - The direction of the ray.
2392
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2393
- * @returns The first intersection found or 'null' if no intersection was found.
2374
+ * Render the internal scene used to determine the object visibility. Used
2375
+ * for debugging purposes.
2394
2376
  */
2395
- 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;
2396
- private intersect;
2397
- private filterClippingPlanes;
2377
+ renderDebugFrame: boolean;
2378
+ /** The components instance to which this renderer belongs. */
2379
+ components: Components;
2380
+ /** The world instance to which this renderer belongs. */
2381
+ readonly world: World;
2382
+ /** The THREE.js renderer used to make the visibility test. */
2383
+ readonly renderer: THREE.WebGLRenderer;
2384
+ protected autoUpdate: boolean;
2385
+ protected updateInterval: number;
2386
+ protected readonly worker: Worker;
2387
+ protected readonly scene: THREE.Scene;
2388
+ private _width;
2389
+ private _height;
2390
+ private _availableColor;
2391
+ private readonly renderTarget;
2392
+ private readonly bufferSize;
2393
+ private readonly _buffer;
2394
+ protected _isWorkerBusy: boolean;
2395
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2396
+ /** {@link Disposable.dispose} */
2397
+ dispose(): void;
2398
+ /**
2399
+ * The function that the culler uses to reprocess the scene. Generally it's
2400
+ * better to call needsUpdate, but you can also call this to force it.
2401
+ * @param force if true, it will refresh the scene even if needsUpdate is
2402
+ * not true.
2403
+ */
2404
+ updateVisibility: (force?: boolean) => Promise<void>;
2405
+ protected getAvailableColor(): {
2406
+ r: number;
2407
+ g: number;
2408
+ b: number;
2409
+ code: string;
2410
+ };
2411
+ protected increaseColor(): void;
2412
+ protected decreaseColor(): void;
2413
+ private applySettings;
2398
2414
  }
2399
2415
  import * as THREE from "three";
2400
2416
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
@@ -2453,16 +2469,18 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
2453
2469
  private getAvailableMaterial;
2454
2470
  }
2455
2471
  export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2456
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2472
+ import { Base } from "./base";
2457
2473
  /**
2458
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2474
+ * 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.
2459
2475
  */
2460
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2476
+ export declare abstract class Component extends Base {
2461
2477
  /**
2462
- * Amount of properties to be streamed.
2463
- * Defaults to 100 properties.
2478
+ * Whether this component is active or not. The behaviour can vary depending
2479
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2480
+ * dimensions, while a disabled camera will stop moving. A disabled component
2481
+ * will not be updated automatically each frame.
2464
2482
  */
2465
- propertiesSize: number;
2483
+ abstract enabled: boolean;
2466
2484
  }
2467
2485
  import { InverseAttribute } from "./types";
2468
2486
  export declare const relToAttributesMap: Map<number, {
@@ -2472,27 +2490,27 @@ export declare const relToAttributesMap: Map<number, {
2472
2490
  /**
2473
2491
  * 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.
2474
2492
  */
2475
- export declare class Event<T> {
2493
+ export declare class AsyncEvent<T> {
2476
2494
  /**
2477
2495
  * Add a callback to this event instance.
2478
2496
  * @param handler - the callback to be added to this event.
2479
2497
  */
2480
2498
  add(handler: T extends void ? {
2481
- (): void;
2499
+ (): Promise<void>;
2482
2500
  } : {
2483
- (data: T): void;
2501
+ (data: T): Promise<void>;
2484
2502
  }): void;
2485
2503
  /**
2486
2504
  * Removes a callback from this event instance.
2487
2505
  * @param handler - the callback to be removed from this event.
2488
2506
  */
2489
2507
  remove(handler: T extends void ? {
2490
- (): void;
2508
+ (): Promise<void>;
2491
2509
  } : {
2492
- (data: T): void;
2510
+ (data: T): Promise<void>;
2493
2511
  }): void;
2494
2512
  /** Triggers all the callbacks assigned to this event. */
2495
- trigger: (data?: T) => void;
2513
+ trigger: (data?: T) => Promise<void>;
2496
2514
  /** Gets rid of all the suscribed events. */
2497
2515
  reset(): void;
2498
2516
  private handlers;
@@ -2500,122 +2518,31 @@ export declare class Event<T> {
2500
2518
  /**
2501
2519
  * 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.
2502
2520
  */
2503
- export declare class AsyncEvent<T> {
2521
+ export declare class Event<T> {
2504
2522
  /**
2505
2523
  * Add a callback to this event instance.
2506
2524
  * @param handler - the callback to be added to this event.
2507
2525
  */
2508
2526
  add(handler: T extends void ? {
2509
- (): Promise<void>;
2527
+ (): void;
2510
2528
  } : {
2511
- (data: T): Promise<void>;
2529
+ (data: T): void;
2512
2530
  }): void;
2513
2531
  /**
2514
2532
  * Removes a callback from this event instance.
2515
2533
  * @param handler - the callback to be removed from this event.
2516
2534
  */
2517
2535
  remove(handler: T extends void ? {
2518
- (): Promise<void>;
2536
+ (): void;
2519
2537
  } : {
2520
- (data: T): Promise<void>;
2538
+ (data: T): void;
2521
2539
  }): void;
2522
2540
  /** Triggers all the callbacks assigned to this event. */
2523
- trigger: (data?: T) => Promise<void>;
2541
+ trigger: (data?: T) => void;
2524
2542
  /** Gets rid of all the suscribed events. */
2525
2543
  reset(): void;
2526
2544
  private handlers;
2527
2545
  }
2528
- import * as THREE from "three";
2529
- import { Components } from "../../Components";
2530
- import { AsyncEvent, Event, World } from "../../Types";
2531
- /**
2532
- * Settings to configure the CullerRenderer.
2533
- */
2534
- export interface CullerRendererSettings {
2535
- /**
2536
- * Interval in milliseconds at which the visibility check should be performed.
2537
- * Default value is 1000.
2538
- */
2539
- updateInterval?: number;
2540
- /**
2541
- * Width of the render target used for visibility checks.
2542
- * Default value is 512.
2543
- */
2544
- width?: number;
2545
- /**
2546
- * Height of the render target used for visibility checks.
2547
- * Default value is 512.
2548
- */
2549
- height?: number;
2550
- /**
2551
- * Whether the visibility check should be performed automatically.
2552
- * Default value is true.
2553
- */
2554
- autoUpdate?: boolean;
2555
- }
2556
- /**
2557
- * A base renderer to determine visibility on screen.
2558
- */
2559
- export declare class CullerRenderer {
2560
- /** {@link Disposable.onDisposed} */
2561
- readonly onDisposed: Event<string>;
2562
- /**
2563
- * Fires after making the visibility check to the meshes. It lists the
2564
- * meshes that are currently visible, and the ones that were visible
2565
- * just before but not anymore.
2566
- */
2567
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2568
- /**
2569
- * Whether this renderer is active or not. If not, it won't render anything.
2570
- */
2571
- enabled: boolean;
2572
- /**
2573
- * Needs to check whether there are objects that need to be hidden or shown.
2574
- * You can bind this to the camera movement, to a certain interval, etc.
2575
- */
2576
- needsUpdate: boolean;
2577
- /**
2578
- * Render the internal scene used to determine the object visibility. Used
2579
- * for debugging purposes.
2580
- */
2581
- renderDebugFrame: boolean;
2582
- /** The components instance to which this renderer belongs. */
2583
- components: Components;
2584
- /** The world instance to which this renderer belongs. */
2585
- readonly world: World;
2586
- /** The THREE.js renderer used to make the visibility test. */
2587
- readonly renderer: THREE.WebGLRenderer;
2588
- protected autoUpdate: boolean;
2589
- protected updateInterval: number;
2590
- protected readonly worker: Worker;
2591
- protected readonly scene: THREE.Scene;
2592
- private _width;
2593
- private _height;
2594
- private _availableColor;
2595
- private readonly renderTarget;
2596
- private readonly bufferSize;
2597
- private readonly _buffer;
2598
- protected _isWorkerBusy: boolean;
2599
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2600
- /** {@link Disposable.dispose} */
2601
- dispose(): void;
2602
- /**
2603
- * The function that the culler uses to reprocess the scene. Generally it's
2604
- * better to call needsUpdate, but you can also call this to force it.
2605
- * @param force if true, it will refresh the scene even if needsUpdate is
2606
- * not true.
2607
- */
2608
- updateVisibility: (force?: boolean) => Promise<void>;
2609
- protected getAvailableColor(): {
2610
- r: number;
2611
- g: number;
2612
- b: number;
2613
- code: string;
2614
- };
2615
- protected increaseColor(): void;
2616
- protected decreaseColor(): void;
2617
- private applySettings;
2618
- }
2619
2546
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2620
2547
  import { Components } from "../../Components";
2621
2548
  /**
@@ -2635,70 +2562,6 @@ export declare abstract class Base {
2635
2562
  /** Whether is component is {@link Configurable}. */
2636
2563
  isConfigurable: () => this is Configurable<any>;
2637
2564
  }
2638
- import { Base } from "./base";
2639
- import { World } from "./world";
2640
- import { Event } from "./event";
2641
- import { Components } from "../../Components";
2642
- /**
2643
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2644
- */
2645
- export declare abstract class BaseWorldItem extends Base {
2646
- readonly worlds: Map<string, World>;
2647
- /**
2648
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2649
- * The event payload contains the world instance and the action ("added" or "removed").
2650
- */
2651
- readonly onWorldChanged: Event<{
2652
- world: World;
2653
- action: "added" | "removed";
2654
- }>;
2655
- /**
2656
- * The current world this item is associated with. It can be null if no world is currently active.
2657
- */
2658
- currentWorld: World | null;
2659
- protected constructor(components: Components);
2660
- }
2661
- import { Base } from "./base";
2662
- /**
2663
- * 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.
2664
- */
2665
- export declare abstract class Component extends Base {
2666
- /**
2667
- * Whether this component is active or not. The behaviour can vary depending
2668
- * on the type of component. E.g. a disabled dimension tool will stop creating
2669
- * dimensions, while a disabled camera will stop moving. A disabled component
2670
- * will not be updated automatically each frame.
2671
- */
2672
- abstract enabled: boolean;
2673
- }
2674
- import * as THREE from "three";
2675
- import CameraControls from "camera-controls";
2676
- import { BaseWorldItem } from "./base-world-item";
2677
- import { CameraControllable } from "./interfaces";
2678
- /**
2679
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2680
- */
2681
- export declare abstract class BaseCamera extends BaseWorldItem {
2682
- /**
2683
- * Whether the camera is enabled or not.
2684
- */
2685
- abstract enabled: boolean;
2686
- /**
2687
- * The Three.js camera instance.
2688
- */
2689
- abstract three: THREE.Camera;
2690
- /**
2691
- * Optional CameraControls instance for controlling the camera.
2692
- * This property is only available if the camera is controllable.
2693
- */
2694
- abstract controls?: CameraControls;
2695
- /**
2696
- * Checks whether the instance is {@link CameraControllable}.
2697
- *
2698
- * @returns True if the instance is controllable, false otherwise.
2699
- */
2700
- hasCameraControls: () => this is CameraControllable;
2701
- }
2702
2565
  import * as THREE from "three";
2703
2566
  import CameraControls from "camera-controls";
2704
2567
  import { Event } from "./event";
@@ -2808,6 +2671,34 @@ export interface CameraControllable {
2808
2671
  controls: CameraControls;
2809
2672
  }
2810
2673
  import * as THREE from "three";
2674
+ import CameraControls from "camera-controls";
2675
+ import { BaseWorldItem } from "./base-world-item";
2676
+ import { CameraControllable } from "./interfaces";
2677
+ /**
2678
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2679
+ */
2680
+ export declare abstract class BaseCamera extends BaseWorldItem {
2681
+ /**
2682
+ * Whether the camera is enabled or not.
2683
+ */
2684
+ abstract enabled: boolean;
2685
+ /**
2686
+ * The Three.js camera instance.
2687
+ */
2688
+ abstract three: THREE.Camera;
2689
+ /**
2690
+ * Optional CameraControls instance for controlling the camera.
2691
+ * This property is only available if the camera is controllable.
2692
+ */
2693
+ abstract controls?: CameraControls;
2694
+ /**
2695
+ * Checks whether the instance is {@link CameraControllable}.
2696
+ *
2697
+ * @returns True if the instance is controllable, false otherwise.
2698
+ */
2699
+ hasCameraControls: () => this is CameraControllable;
2700
+ }
2701
+ import * as THREE from "three";
2811
2702
  import { Vector2 } from "three";
2812
2703
  import { Event } from "./event";
2813
2704
  import { BaseWorldItem } from "./base-world-item";
@@ -2870,7 +2761,50 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2870
2761
  * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2871
2762
  * excluding any planes marked as local.
2872
2763
  */
2873
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2764
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2765
+ }
2766
+ import * as THREE from "three";
2767
+ import { Disposable } from "./interfaces";
2768
+ import { Event } from "./event";
2769
+ import { Components } from "../../Components";
2770
+ import { BaseWorldItem } from "./base-world-item";
2771
+ /**
2772
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2773
+ */
2774
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2775
+ /** {@link Disposable.onDisposed} */
2776
+ readonly onDisposed: Event<unknown>;
2777
+ /**
2778
+ * Abstract property representing the three.js object associated with this scene.
2779
+ * It should be implemented by subclasses.
2780
+ */
2781
+ abstract three: THREE.Object3D;
2782
+ protected constructor(components: Components);
2783
+ /** {@link Disposable.dispose} */
2784
+ dispose(): void;
2785
+ }
2786
+ import { Base } from "./base";
2787
+ import { World } from "./world";
2788
+ import { Event } from "./event";
2789
+ import { Components } from "../../Components";
2790
+ /**
2791
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2792
+ */
2793
+ export declare abstract class BaseWorldItem extends Base {
2794
+ readonly worlds: Map<string, World>;
2795
+ /**
2796
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2797
+ * The event payload contains the world instance and the action ("added" or "removed").
2798
+ */
2799
+ readonly onWorldChanged: Event<{
2800
+ world: World;
2801
+ action: "added" | "removed";
2802
+ }>;
2803
+ /**
2804
+ * The current world this item is associated with. It can be null if no world is currently active.
2805
+ */
2806
+ currentWorld: World | null;
2807
+ protected constructor(components: Components);
2874
2808
  }
2875
2809
  import * as THREE from "three";
2876
2810
  import { BaseScene } from "./base-scene";
@@ -2965,100 +2899,83 @@ export declare class SimpleGrid implements Hideable, Disposable {
2965
2899
  private setupEvents;
2966
2900
  private updateZoom;
2967
2901
  }
2968
- import * as THREE from "three";
2969
- import { Disposable } from "./interfaces";
2970
- import { Event } from "./event";
2971
- import { Components } from "../../Components";
2972
- import { BaseWorldItem } from "./base-world-item";
2902
+ import { NavigationMode } from "./types";
2903
+ import { OrthoPerspectiveCamera } from "../index";
2973
2904
  /**
2974
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2905
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2975
2906
  */
2976
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2977
- /** {@link Disposable.onDisposed} */
2978
- readonly onDisposed: Event<unknown>;
2979
- /**
2980
- * Abstract property representing the three.js object associated with this scene.
2981
- * It should be implemented by subclasses.
2982
- */
2983
- abstract three: THREE.Object3D;
2984
- protected constructor(components: Components);
2985
- /** {@link Disposable.dispose} */
2986
- dispose(): void;
2987
- }
2988
- import * as WEBIFC from "web-ifc";
2989
- export declare class IfcMetadataReader {
2990
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2991
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2992
- }
2993
- import * as THREE from "three";
2994
- import * as WEBIFC from "web-ifc";
2995
- import * as FRAGS from "@thatopen/fragments";
2996
- export declare class CivilReader {
2997
- defLineMat: THREE.LineBasicMaterial;
2998
- read(webIfc: WEBIFC.IfcAPI): {
2999
- alignments: Map<number, FRAGS.Alignment>;
3000
- coordinationMatrix: THREE.Matrix4;
3001
- } | undefined;
3002
- get(civilItems: any): {
3003
- alignments: Map<number, FRAGS.Alignment>;
3004
- coordinationMatrix: THREE.Matrix4;
3005
- } | undefined;
3006
- private getCurves;
3007
- }
3008
- import * as WEBIFC from "web-ifc";
3009
- import * as THREE from "three";
3010
- export declare class Units {
3011
- factor: number;
3012
- complement: number;
3013
- apply(matrix: THREE.Matrix4): void;
3014
- setUp(webIfc: WEBIFC.IfcAPI): void;
3015
- private getLengthUnits;
3016
- private getScaleMatrix;
2907
+ export declare class FirstPersonMode implements NavigationMode {
2908
+ private camera;
2909
+ /** {@link NavigationMode.enabled} */
2910
+ enabled: boolean;
2911
+ /** {@link NavigationMode.id} */
2912
+ readonly id = "FirstPerson";
2913
+ constructor(camera: OrthoPerspectiveCamera);
2914
+ /** {@link NavigationMode.set} */
2915
+ set(active: boolean): void;
2916
+ private setupFirstPersonCamera;
3017
2917
  }
3018
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2918
+ import { NavigationMode } from "./types";
2919
+ import { OrthoPerspectiveCamera } from "../index";
3019
2920
  /**
3020
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
2921
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3021
2922
  */
3022
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3023
- /**
3024
- * Minimum number of geometries to be streamed.
3025
- * Defaults to 10 geometries.
3026
- */
3027
- minGeometrySize: number;
3028
- /**
3029
- * Minimum amount of assets to be streamed.
3030
- * Defaults to 1000 assets.
3031
- */
3032
- minAssetsSize: number;
2923
+ export declare class OrbitMode implements NavigationMode {
2924
+ camera: OrthoPerspectiveCamera;
2925
+ /** {@link NavigationMode.enabled} */
2926
+ enabled: boolean;
2927
+ /** {@link NavigationMode.id} */
2928
+ readonly id = "Orbit";
2929
+ constructor(camera: OrthoPerspectiveCamera);
2930
+ /** {@link NavigationMode.set} */
2931
+ set(active: boolean): void;
2932
+ private activateOrbitControls;
3033
2933
  }
2934
+ import { NavigationMode } from "./types";
2935
+ import { OrthoPerspectiveCamera } from "../index";
3034
2936
  /**
3035
- * 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.
2937
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3036
2938
  */
3037
- export interface StreamedGeometries {
3038
- [id: number]: {
3039
- /** The bounding box of the geometry as a Float32Array. */
3040
- boundingBox: Float32Array;
3041
- /** A boolean indicating whether the geometry has holes. */
3042
- hasHoles: boolean;
3043
- /** An optional file path for the geometry data. */
3044
- geometryFile?: string;
3045
- };
2939
+ export declare class PlanMode implements NavigationMode {
2940
+ private camera;
2941
+ /** {@link NavigationMode.enabled} */
2942
+ enabled: boolean;
2943
+ /** {@link NavigationMode.id} */
2944
+ readonly id = "Plan";
2945
+ private mouseAction1?;
2946
+ private mouseAction2?;
2947
+ private mouseInitialized;
2948
+ private readonly defaultAzimuthSpeed;
2949
+ private readonly defaultPolarSpeed;
2950
+ constructor(camera: OrthoPerspectiveCamera);
2951
+ /** {@link NavigationMode.set} */
2952
+ set(active: boolean): void;
3046
2953
  }
3047
2954
  /**
3048
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
2955
+ * The projection system of the camera.
3049
2956
  */
3050
- export interface StreamedAsset {
3051
- /** The unique identifier of the asset. */
3052
- id: number;
3053
- /** An array of geometries associated with the asset. */
3054
- geometries: {
3055
- /** The unique identifier of the geometry. */
3056
- geometryID: number;
3057
- /** The transformation matrix of the geometry as a number array. */
3058
- transformation: number[];
3059
- /** The color of the geometry as a number array. */
3060
- color: number[];
3061
- }[];
2957
+ export type CameraProjection = "Perspective" | "Orthographic";
2958
+ /**
2959
+ * The extensible list of supported navigation modes.
2960
+ */
2961
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
2962
+ /**
2963
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
2964
+ */
2965
+ export interface NavigationMode {
2966
+ /** The unique ID of this navigation mode. */
2967
+ id: NavModeID;
2968
+ /**
2969
+ * Enable or disable this navigation mode.
2970
+ * When a new navigation mode is enabled, the previous navigation mode
2971
+ * must be disabled.
2972
+ *
2973
+ * @param active - whether to enable or disable this mode.
2974
+ * @param options - any additional data required to enable or disable it.
2975
+ * */
2976
+ set: (active: boolean, options?: any) => void;
2977
+ /** Whether this navigation mode is active or not. */
2978
+ enabled: boolean;
3062
2979
  }
3063
2980
  import * as THREE from "three";
3064
2981
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
@@ -3126,117 +3043,18 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
3126
3043
  * Getter for the renderer.
3127
3044
  * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3128
3045
  */
3129
- get renderer(): S | null;
3130
- /**
3131
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3132
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3133
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3134
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3135
- */
3136
- set renderer(renderer: S | null);
3137
- /** {@link Updateable.update} */
3138
- update(delta?: number): void;
3139
- /** {@link Disposable.dispose} */
3140
- dispose(disposeResources?: boolean): void;
3141
- }
3142
- import * as THREE from "three";
3143
- import { Hideable, Disposable, Event, World } from "../../Types";
3144
- import { Components } from "../../Components";
3145
- /**
3146
- * Each of the clipping planes created by the clipper.
3147
- */
3148
- export declare class SimplePlane implements Disposable, Hideable {
3149
- /** Event that fires when the user starts dragging a clipping plane. */
3150
- readonly onDraggingStarted: Event<unknown>;
3151
- /** Event that fires when the user stops dragging a clipping plane. */
3152
- readonly onDraggingEnded: Event<unknown>;
3153
- /** {@link Disposable.onDisposed} */
3154
- readonly onDisposed: Event<unknown>;
3155
- /**
3156
- * The normal vector of the clipping plane.
3157
- */
3158
- readonly normal: THREE.Vector3;
3159
- /**
3160
- * The origin point of the clipping plane.
3161
- */
3162
- readonly origin: THREE.Vector3;
3163
- /**
3164
- * The THREE.js Plane object representing the clipping plane.
3165
- */
3166
- readonly three: THREE.Plane;
3167
- /** The components instance to which this plane belongs. */
3168
- components: Components;
3169
- /** The world instance to which this plane belongs. */
3170
- world: World;
3171
- /** A custom string to identify what this plane is used for. */
3172
- type: string;
3173
- protected readonly _helper: THREE.Object3D;
3174
- protected _visible: boolean;
3175
- protected _enabled: boolean;
3176
- private _controlsActive;
3177
- private readonly _arrowBoundBox;
3178
- private readonly _planeMesh;
3179
- private readonly _controls;
3180
- private readonly _hiddenMaterial;
3181
- /**
3182
- * Getter for the enabled state of the clipping plane.
3183
- * @returns {boolean} The current enabled state.
3184
- */
3185
- get enabled(): boolean;
3186
- /**
3187
- * Setter for the enabled state of the clipping plane.
3188
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3189
- * @param {boolean} state - The new enabled state.
3190
- */
3191
- set enabled(state: boolean);
3192
- /** {@link Hideable.visible } */
3193
- get visible(): boolean;
3194
- /** {@link Hideable.visible } */
3195
- set visible(state: boolean);
3196
- /** The meshes used for raycasting */
3197
- get meshes(): THREE.Mesh[];
3198
- /** The material of the clipping plane representation. */
3199
- get planeMaterial(): THREE.Material | THREE.Material[];
3200
- /** The material of the clipping plane representation. */
3201
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3202
- /** The size of the clipping plane representation. */
3203
- get size(): number;
3204
- /** Sets the size of the clipping plane representation. */
3205
- set size(size: number);
3206
- /**
3207
- * Getter for the helper object of the clipping plane.
3208
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3209
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3210
- *
3211
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3212
- */
3213
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3214
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3215
- /**
3216
- * Sets the clipping plane's normal and origin from the given normal and point.
3217
- * This method resets the clipping plane's state, updates the normal and origin,
3218
- * and positions the helper object accordingly.
3219
- *
3220
- * @param normal - The new normal vector for the clipping plane.
3221
- * @param point - The new origin point for the clipping plane.
3222
- *
3223
- * @returns {void}
3046
+ get renderer(): S | null;
3047
+ /**
3048
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3049
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3050
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3051
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3224
3052
  */
3225
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3053
+ set renderer(renderer: S | null);
3226
3054
  /** {@link Updateable.update} */
3227
- update: () => void;
3055
+ update(delta?: number): void;
3228
3056
  /** {@link Disposable.dispose} */
3229
- dispose(): void;
3230
- private reset;
3231
- protected toggleControls(state: boolean): void;
3232
- private newTransformControls;
3233
- private initializeControls;
3234
- private createArrowBoundingBox;
3235
- private changeDrag;
3236
- private notifyDraggingChanged;
3237
- private preventCameraMovement;
3238
- private newHelper;
3239
- private static newPlaneMesh;
3057
+ dispose(disposeResources?: boolean): void;
3240
3058
  }
3241
3059
  import * as THREE from "three";
3242
3060
  import { BaseRenderer, Event } from "../../Types";
@@ -3292,21 +3110,89 @@ export declare class SimpleRenderer extends BaseRenderer {
3292
3110
  private onContextLost;
3293
3111
  private onContextBack;
3294
3112
  }
3295
- import { NavigationMode } from "./types";
3113
+ import * as THREE from "three";
3114
+ import { CameraProjection } from "./types";
3115
+ import { Event } from "../../Types";
3296
3116
  import { OrthoPerspectiveCamera } from "../index";
3297
3117
  /**
3298
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3118
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3299
3119
  */
3300
- export declare class OrbitMode implements NavigationMode {
3301
- camera: OrthoPerspectiveCamera;
3302
- /** {@link NavigationMode.enabled} */
3303
- enabled: boolean;
3304
- /** {@link NavigationMode.id} */
3305
- readonly id = "Orbit";
3120
+ export declare class ProjectionManager {
3121
+ /**
3122
+ * Event that fires when the {@link CameraProjection} changes.
3123
+ */
3124
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3125
+ /**
3126
+ * Current projection mode of the camera.
3127
+ * Default is "Perspective".
3128
+ */
3129
+ current: CameraProjection;
3130
+ /**
3131
+ * The camera controlled by this ProjectionManager.
3132
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3133
+ */
3134
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3135
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3136
+ matchOrthoDistanceEnabled: boolean;
3137
+ private _component;
3138
+ private _previousDistance;
3306
3139
  constructor(camera: OrthoPerspectiveCamera);
3307
- /** {@link NavigationMode.set} */
3308
- set(active: boolean): void;
3309
- private activateOrbitControls;
3140
+ /**
3141
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3142
+ *
3143
+ * @param projection - the new projection to set. If it is the current projection,
3144
+ * it will have no effect.
3145
+ */
3146
+ set(projection: CameraProjection): Promise<void>;
3147
+ /**
3148
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3149
+ * and vice versa.
3150
+ */
3151
+ toggle(): Promise<void>;
3152
+ private setOrthoCamera;
3153
+ private getPerspectiveDims;
3154
+ private setupOrthoCamera;
3155
+ private getDistance;
3156
+ private setPerspectiveCamera;
3157
+ }
3158
+ import * as THREE from "three";
3159
+ import { BaseScene, Configurable, Event } from "../../Types";
3160
+ import { Components } from "../../Components";
3161
+ /**
3162
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3163
+ */
3164
+ export interface SimpleSceneConfig {
3165
+ directionalLight: {
3166
+ color: THREE.Color;
3167
+ intensity: number;
3168
+ position: THREE.Vector3;
3169
+ };
3170
+ ambientLight: {
3171
+ color: THREE.Color;
3172
+ intensity: number;
3173
+ };
3174
+ }
3175
+ /**
3176
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
3177
+ */
3178
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3179
+ /** {@link Configurable.isSetup} */
3180
+ isSetup: boolean;
3181
+ /**
3182
+ * The underlying Three.js scene object.
3183
+ * It is used to define the 3D space containing objects, lights, and cameras.
3184
+ */
3185
+ three: THREE.Scene;
3186
+ /** {@link Configurable.onSetup} */
3187
+ readonly onSetup: Event<SimpleScene>;
3188
+ /**
3189
+ * Configuration interface for the {@link SimpleScene}.
3190
+ * Defines properties for directional and ambient lights.
3191
+ */
3192
+ config: Required<SimpleSceneConfig>;
3193
+ constructor(components: Components);
3194
+ /** {@link Configurable.setup} */
3195
+ setup(config?: Partial<SimpleSceneConfig>): void;
3310
3196
  }
3311
3197
  import * as THREE from "three";
3312
3198
  import CameraControls from "camera-controls";
@@ -3341,180 +3227,299 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3341
3227
  */
3342
3228
  get controls(): CameraControls;
3343
3229
  /**
3344
- * Getter for the enabled state of the camera controls.
3345
- * If the current world is null, it returns false.
3346
- * Otherwise, it returns the enabled state of the camera controls.
3230
+ * Getter for the enabled state of the camera controls.
3231
+ * If the current world is null, it returns false.
3232
+ * Otherwise, it returns the enabled state of the camera controls.
3233
+ *
3234
+ * @returns {boolean} The enabled state of the camera controls.
3235
+ */
3236
+ get enabled(): boolean;
3237
+ /**
3238
+ * Setter for the enabled state of the camera controls.
3239
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3240
+ *
3241
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3242
+ */
3243
+ set enabled(enabled: boolean);
3244
+ constructor(components: Components);
3245
+ /** {@link Disposable.dispose} */
3246
+ dispose(): void;
3247
+ /** {@link Updateable.update} */
3248
+ update(_delta: number): void;
3249
+ /**
3250
+ * Updates the aspect of the camera to match the size of the
3251
+ * {@link Components.renderer}.
3252
+ */
3253
+ updateAspect: () => void;
3254
+ private setupCamera;
3255
+ private newCameraControls;
3256
+ private setupEvents;
3257
+ private static getSubsetOfThree;
3258
+ }
3259
+ import * as THREE from "three";
3260
+ import * as WEBIFC from "web-ifc";
3261
+ import * as FRAGS from "@thatopen/fragments";
3262
+ export declare class CivilReader {
3263
+ defLineMat: THREE.LineBasicMaterial;
3264
+ read(webIfc: WEBIFC.IfcAPI): {
3265
+ alignments: Map<number, FRAGS.Alignment>;
3266
+ coordinationMatrix: THREE.Matrix4;
3267
+ } | undefined;
3268
+ get(civilItems: any): {
3269
+ alignments: Map<number, FRAGS.Alignment>;
3270
+ coordinationMatrix: THREE.Matrix4;
3271
+ } | undefined;
3272
+ private getCurves;
3273
+ }
3274
+ import * as WEBIFC from "web-ifc";
3275
+ import * as THREE from "three";
3276
+ export declare class Units {
3277
+ factor: number;
3278
+ complement: number;
3279
+ apply(matrix: THREE.Matrix4): void;
3280
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3281
+ private getLengthUnits;
3282
+ private getScaleMatrix;
3283
+ }
3284
+ import * as WEBIFC from "web-ifc";
3285
+ export declare class IfcMetadataReader {
3286
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3287
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3288
+ }
3289
+ import * as THREE from "three";
3290
+ import { Disposable, Event } from "../../Types";
3291
+ /**
3292
+ * 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.
3293
+ */
3294
+ export declare class Mouse implements Disposable {
3295
+ dom: HTMLCanvasElement;
3296
+ private _event?;
3297
+ private _position;
3298
+ /** {@link Disposable.onDisposed} */
3299
+ readonly onDisposed: Event<unknown>;
3300
+ constructor(dom: HTMLCanvasElement);
3301
+ /**
3302
+ * The real position of the mouse of the Three.js canvas.
3303
+ */
3304
+ get position(): THREE.Vector2;
3305
+ /** {@link Disposable.dispose} */
3306
+ dispose(): void;
3307
+ private getPositionY;
3308
+ private getPositionX;
3309
+ private updateMouseInfo;
3310
+ private setupEvents;
3311
+ }
3312
+ import * as THREE from "three";
3313
+ import { Hideable, Disposable, Event, World } from "../../Types";
3314
+ import { Components } from "../../Components";
3315
+ /**
3316
+ * Each of the clipping planes created by the clipper.
3317
+ */
3318
+ export declare class SimplePlane implements Disposable, Hideable {
3319
+ /** Event that fires when the user starts dragging a clipping plane. */
3320
+ readonly onDraggingStarted: Event<unknown>;
3321
+ /** Event that fires when the user stops dragging a clipping plane. */
3322
+ readonly onDraggingEnded: Event<unknown>;
3323
+ /** {@link Disposable.onDisposed} */
3324
+ readonly onDisposed: Event<unknown>;
3325
+ /**
3326
+ * The normal vector of the clipping plane.
3327
+ */
3328
+ readonly normal: THREE.Vector3;
3329
+ /**
3330
+ * The origin point of the clipping plane.
3331
+ */
3332
+ readonly origin: THREE.Vector3;
3333
+ /**
3334
+ * The THREE.js Plane object representing the clipping plane.
3335
+ */
3336
+ readonly three: THREE.Plane;
3337
+ /** The components instance to which this plane belongs. */
3338
+ components: Components;
3339
+ /** The world instance to which this plane belongs. */
3340
+ world: World;
3341
+ /** A custom string to identify what this plane is used for. */
3342
+ type: string;
3343
+ protected readonly _helper: THREE.Object3D;
3344
+ protected _visible: boolean;
3345
+ protected _enabled: boolean;
3346
+ private _controlsActive;
3347
+ private readonly _arrowBoundBox;
3348
+ private readonly _planeMesh;
3349
+ private readonly _controls;
3350
+ private readonly _hiddenMaterial;
3351
+ /**
3352
+ * Getter for the enabled state of the clipping plane.
3353
+ * @returns {boolean} The current enabled state.
3354
+ */
3355
+ get enabled(): boolean;
3356
+ /**
3357
+ * Setter for the enabled state of the clipping plane.
3358
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3359
+ * @param {boolean} state - The new enabled state.
3360
+ */
3361
+ set enabled(state: boolean);
3362
+ /** {@link Hideable.visible } */
3363
+ get visible(): boolean;
3364
+ /** {@link Hideable.visible } */
3365
+ set visible(state: boolean);
3366
+ /** The meshes used for raycasting */
3367
+ get meshes(): THREE.Mesh[];
3368
+ /** The material of the clipping plane representation. */
3369
+ get planeMaterial(): THREE.Material | THREE.Material[];
3370
+ /** The material of the clipping plane representation. */
3371
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
3372
+ /** The size of the clipping plane representation. */
3373
+ get size(): number;
3374
+ /** Sets the size of the clipping plane representation. */
3375
+ set size(size: number);
3376
+ /**
3377
+ * Getter for the helper object of the clipping plane.
3378
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3379
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3347
3380
  *
3348
- * @returns {boolean} The enabled state of the camera controls.
3381
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
3349
3382
  */
3350
- get enabled(): boolean;
3383
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3384
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3351
3385
  /**
3352
- * Setter for the enabled state of the camera controls.
3353
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3386
+ * Sets the clipping plane's normal and origin from the given normal and point.
3387
+ * This method resets the clipping plane's state, updates the normal and origin,
3388
+ * and positions the helper object accordingly.
3354
3389
  *
3355
- * @param {boolean} enabled - The new enabled state of the camera controls.
3390
+ * @param normal - The new normal vector for the clipping plane.
3391
+ * @param point - The new origin point for the clipping plane.
3392
+ *
3393
+ * @returns {void}
3356
3394
  */
3357
- set enabled(enabled: boolean);
3358
- constructor(components: Components);
3395
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3396
+ /** {@link Updateable.update} */
3397
+ update: () => void;
3359
3398
  /** {@link Disposable.dispose} */
3360
3399
  dispose(): void;
3361
- /** {@link Updateable.update} */
3362
- update(_delta: number): void;
3363
- /**
3364
- * Updates the aspect of the camera to match the size of the
3365
- * {@link Components.renderer}.
3366
- */
3367
- updateAspect: () => void;
3368
- private setupCamera;
3369
- private newCameraControls;
3370
- private setupEvents;
3371
- private static getSubsetOfThree;
3372
- }
3373
- import * as THREE from "three";
3374
- import { BaseScene, Configurable, Event } from "../../Types";
3375
- import { Components } from "../../Components";
3376
- /**
3377
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3378
- */
3379
- export interface SimpleSceneConfig {
3380
- directionalLight: {
3381
- color: THREE.Color;
3382
- intensity: number;
3383
- position: THREE.Vector3;
3384
- };
3385
- ambientLight: {
3386
- color: THREE.Color;
3387
- intensity: number;
3388
- };
3400
+ private reset;
3401
+ protected toggleControls(state: boolean): void;
3402
+ private newTransformControls;
3403
+ private initializeControls;
3404
+ private createArrowBoundingBox;
3405
+ private changeDrag;
3406
+ private notifyDraggingChanged;
3407
+ private preventCameraMovement;
3408
+ private newHelper;
3409
+ private static newPlaneMesh;
3389
3410
  }
3411
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3390
3412
  /**
3391
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
3413
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3392
3414
  */
3393
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3394
- /** {@link Configurable.isSetup} */
3395
- isSetup: boolean;
3415
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3396
3416
  /**
3397
- * The underlying Three.js scene object.
3398
- * It is used to define the 3D space containing objects, lights, and cameras.
3417
+ * Minimum number of geometries to be streamed.
3418
+ * Defaults to 10 geometries.
3399
3419
  */
3400
- three: THREE.Scene;
3401
- /** {@link Configurable.onSetup} */
3402
- readonly onSetup: Event<SimpleScene>;
3420
+ minGeometrySize: number;
3403
3421
  /**
3404
- * Configuration interface for the {@link SimpleScene}.
3405
- * Defines properties for directional and ambient lights.
3422
+ * Minimum amount of assets to be streamed.
3423
+ * Defaults to 1000 assets.
3406
3424
  */
3407
- config: Required<SimpleSceneConfig>;
3408
- constructor(components: Components);
3409
- /** {@link Configurable.setup} */
3410
- setup(config?: Partial<SimpleSceneConfig>): void;
3425
+ minAssetsSize: number;
3411
3426
  }
3412
- import { NavigationMode } from "./types";
3413
- import { OrthoPerspectiveCamera } from "../index";
3427
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3414
3428
  /**
3415
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3429
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3416
3430
  */
3417
- export declare class PlanMode implements NavigationMode {
3418
- private camera;
3419
- /** {@link NavigationMode.enabled} */
3420
- enabled: boolean;
3421
- /** {@link NavigationMode.id} */
3422
- readonly id = "Plan";
3423
- private mouseAction1?;
3424
- private mouseAction2?;
3425
- private mouseInitialized;
3426
- private readonly defaultAzimuthSpeed;
3427
- private readonly defaultPolarSpeed;
3428
- constructor(camera: OrthoPerspectiveCamera);
3429
- /** {@link NavigationMode.set} */
3430
- set(active: boolean): void;
3431
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3432
+ /**
3433
+ * Amount of properties to be streamed.
3434
+ * Defaults to 100 properties.
3435
+ */
3436
+ propertiesSize: number;
3431
3437
  }
3432
- import { NavigationMode } from "./types";
3433
- import { OrthoPerspectiveCamera } from "../index";
3434
- /**
3435
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3436
- */
3437
- export declare class FirstPersonMode implements NavigationMode {
3438
- private camera;
3439
- /** {@link NavigationMode.enabled} */
3440
- enabled: boolean;
3441
- /** {@link NavigationMode.id} */
3442
- readonly id = "FirstPerson";
3443
- constructor(camera: OrthoPerspectiveCamera);
3444
- /** {@link NavigationMode.set} */
3445
- set(active: boolean): void;
3446
- private setupFirstPersonCamera;
3438
+ import { BufferGeometry } from "three";
3439
+ import * as THREE from "three";
3440
+ export declare class TransformHelper {
3441
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3447
3442
  }
3448
3443
  /**
3449
- * The projection system of the camera.
3450
- */
3451
- export type CameraProjection = "Perspective" | "Orthographic";
3452
- /**
3453
- * The extensible list of supported navigation modes.
3444
+ * 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.
3454
3445
  */
3455
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3446
+ export interface StreamedGeometries {
3447
+ [id: number]: {
3448
+ /** The bounding box of the geometry as a Float32Array. */
3449
+ boundingBox: Float32Array;
3450
+ /** A boolean indicating whether the geometry has holes. */
3451
+ hasHoles: boolean;
3452
+ /** An optional file path for the geometry data. */
3453
+ geometryFile?: string;
3454
+ };
3455
+ }
3456
3456
  /**
3457
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3457
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3458
3458
  */
3459
- export interface NavigationMode {
3460
- /** The unique ID of this navigation mode. */
3461
- id: NavModeID;
3462
- /**
3463
- * Enable or disable this navigation mode.
3464
- * When a new navigation mode is enabled, the previous navigation mode
3465
- * must be disabled.
3466
- *
3467
- * @param active - whether to enable or disable this mode.
3468
- * @param options - any additional data required to enable or disable it.
3469
- * */
3470
- set: (active: boolean, options?: any) => void;
3471
- /** Whether this navigation mode is active or not. */
3472
- enabled: boolean;
3459
+ export interface StreamedAsset {
3460
+ /** The unique identifier of the asset. */
3461
+ id: number;
3462
+ /** An array of geometries associated with the asset. */
3463
+ geometries: {
3464
+ /** The unique identifier of the geometry. */
3465
+ geometryID: number;
3466
+ /** The transformation matrix of the geometry as a number array. */
3467
+ transformation: number[];
3468
+ /** The color of the geometry as a number array. */
3469
+ color: number[];
3470
+ }[];
3473
3471
  }
3474
3472
  import * as THREE from "three";
3475
- import { CameraProjection } from "./types";
3476
- import { Event } from "../../Types";
3477
- import { OrthoPerspectiveCamera } from "../index";
3473
+ import { Components } from "../../Components";
3474
+ import { Event, World, Disposable } from "../../Types";
3475
+ import { Mouse } from "./mouse";
3478
3476
  /**
3479
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3477
+ * 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.
3480
3478
  */
3481
- export declare class ProjectionManager {
3482
- /**
3483
- * Event that fires when the {@link CameraProjection} changes.
3484
- */
3485
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3479
+ export declare class SimpleRaycaster implements Disposable {
3480
+ /** {@link Component.enabled} */
3481
+ enabled: boolean;
3482
+ /** The components instance to which this Raycaster belongs. */
3483
+ components: Components;
3484
+ /** {@link Disposable.onDisposed} */
3485
+ readonly onDisposed: Event<unknown>;
3486
+ /** The position of the mouse in the screen. */
3487
+ readonly mouse: Mouse;
3486
3488
  /**
3487
- * Current projection mode of the camera.
3488
- * Default is "Perspective".
3489
+ * A reference to the Three.js Raycaster instance.
3490
+ * This is used for raycasting operations.
3489
3491
  */
3490
- current: CameraProjection;
3492
+ readonly three: THREE.Raycaster;
3491
3493
  /**
3492
- * The camera controlled by this ProjectionManager.
3493
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3494
+ * A reference to the world instance to which this Raycaster belongs.
3495
+ * This is used to access the camera and meshes.
3494
3496
  */
3495
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3496
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3497
- matchOrthoDistanceEnabled: boolean;
3498
- private _component;
3499
- private _previousDistance;
3500
- constructor(camera: OrthoPerspectiveCamera);
3497
+ world: World;
3498
+ constructor(components: Components, world: World);
3499
+ /** {@link Disposable.dispose} */
3500
+ dispose(): void;
3501
3501
  /**
3502
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3502
+ * Throws a ray from the camera to the mouse or touch event point and returns
3503
+ * the first item found. This also takes into account the clipping planes
3504
+ * used by the renderer.
3503
3505
  *
3504
- * @param projection - the new projection to set. If it is the current projection,
3505
- * it will have no effect.
3506
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3507
+ * to query. If not provided, it will query all the meshes stored in
3508
+ * {@link Components.meshes}.
3506
3509
  */
3507
- set(projection: CameraProjection): Promise<void>;
3510
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3508
3511
  /**
3509
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3510
- * and vice versa.
3512
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3513
+ * This method also takes into account the clipping planes used by the renderer.
3514
+ *
3515
+ * @param origin - The origin of the ray.
3516
+ * @param direction - The direction of the ray.
3517
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3518
+ * @returns The first intersection found or 'null' if no intersection was found.
3511
3519
  */
3512
- toggle(): Promise<void>;
3513
- private setOrthoCamera;
3514
- private getPerspectiveDims;
3515
- private setupOrthoCamera;
3516
- private getDistance;
3517
- private setPerspectiveCamera;
3520
+ 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;
3521
+ private intersect;
3522
+ private filterClippingPlanes;
3518
3523
  }
3519
3524
  export type RelationsMap = Map<number, Map<number, number[]>>;
3520
3525
  export interface ModelsRelationMap {
@@ -3540,10 +3545,5 @@ export type InverseAttributes = [
3540
3545
  "ContainsElements"
3541
3546
  ];
3542
3547
  export type InverseAttribute = InverseAttributes[number];
3543
- import { BufferGeometry } from "three";
3544
- import * as THREE from "three";
3545
- export declare class TransformHelper {
3546
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3547
- }
3548
3548
 
3549
3549
  }