@thatopen/components 2.1.9 → 2.1.11

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