@thatopen/components 2.1.2 → 2.1.4

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