@thatopen/components 2.1.14 → 2.1.16

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,757 +1,887 @@
1
1
  declare namespace OBC {
2
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
3
+ export declare class UUID {
4
+ private static _pattern;
5
+ private static _lut;
6
+ static create(): string;
7
+ static validate(uuid: string): void;
8
+ }
2
9
  import * as THREE from "three";
3
- import { Components } from "../Components";
4
- import { Component } from "../Types";
10
+ import * as FRAGS from "@thatopen/fragments";
11
+ import { Disposable, Component, Event, Components } from "../../core";
5
12
  /**
6
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
13
+ * 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.
7
14
  */
8
- export declare class Disposer extends Component {
9
- private _disposedComponents;
10
- /** {@link Component.enabled} */
11
- enabled: boolean;
12
- /**
13
- * A unique identifier for the component.
14
- * This UUID is used to register the component within the Components system.
15
- */
16
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
17
- constructor(components: Components);
18
- /**
19
- * Return the UUIDs of all disposed components.
20
- */
21
- get(): Set<string>;
22
- /**
23
- * Removes a mesh, its geometry and its materials from memory. If you are
24
- * using any of these in other parts of the application, make sure that you
25
- * remove them from the mesh before disposing it.
26
- *
27
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
- * to remove.
29
- *
30
- * @param materials - whether to dispose the materials of the mesh.
31
- *
32
- * @param recursive - whether to recursively dispose the children of the mesh.
33
- */
34
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
15
+ export interface Classification {
35
16
  /**
36
- * Disposes a geometry from memory.
37
- *
38
- * @param geometry - the
39
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
- * to remove.
17
+ * A system within the classification.
18
+ * The key is the system name, and the value is an object representing the classes within the system.
41
19
  */
42
- disposeGeometry(geometry: THREE.BufferGeometry): void;
43
- private disposeGeometryAndMaterials;
44
- private disposeChildren;
45
- private static disposeMaterial;
20
+ [system: string]: {
21
+ /**
22
+ * A class within the system.
23
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
24
+ */
25
+ [className: string]: {
26
+ map: FRAGS.FragmentIdMap;
27
+ name: string;
28
+ id: number | null;
29
+ };
30
+ };
46
31
  }
47
- import { Component, Disposable, World, Event } from "../Types";
48
- import { SimpleRaycaster } from "./src";
49
- import { Components } from "../Components";
50
32
  /**
51
- * 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).
33
+ * 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).
52
34
  */
53
- export declare class Raycasters extends Component implements Disposable {
35
+ export declare class Classifier extends Component implements Disposable {
54
36
  /**
55
37
  * A unique identifier for the component.
56
38
  * This UUID is used to register the component within the Components system.
57
39
  */
58
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
40
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
59
41
  /** {@link Component.enabled} */
60
42
  enabled: boolean;
61
43
  /**
62
- * A Map that stores raycasters for each world.
63
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
44
+ * A map representing the classification systems.
45
+ * The key is the system name, and the value is an object representing the classes within the system.
64
46
  */
65
- list: Map<string, SimpleRaycaster>;
47
+ list: Classification;
66
48
  /** {@link Disposable.onDisposed} */
67
- onDisposed: Event<unknown>;
49
+ readonly onDisposed: Event<unknown>;
68
50
  constructor(components: Components);
51
+ private onFragmentsDisposed;
52
+ /** {@link Disposable.dispose} */
53
+ dispose(): void;
69
54
  /**
70
- * Retrieves a SimpleRaycaster instance for the given world.
71
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
72
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
55
+ * Removes a fragment from the classification based on its unique identifier (guid).
56
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
73
57
  *
74
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
75
- * @returns The SimpleRaycaster instance for the given world.
58
+ * @param guid - The unique identifier of the fragment to be removed.
76
59
  */
77
- get(world: World): SimpleRaycaster;
60
+ remove(guid: string): void;
78
61
  /**
79
- * Deletes the SimpleRaycaster instance associated with the given world.
80
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
62
+ * Finds and returns fragments based on the provided filter criteria.
63
+ * If no filter is provided, it returns all fragments.
81
64
  *
82
- * @param world - The world for which to delete the SimpleRaycaster instance.
83
- * @returns {void}
65
+ * @param filter - An optional object containing filter criteria.
66
+ * The keys of the object represent the classification system names,
67
+ * and the values are arrays of class names to match.
68
+ *
69
+ * @returns A map of fragment GUIDs to their respective express IDs,
70
+ * where the express IDs are filtered based on the provided filter criteria.
71
+ *
72
+ * @throws Will throw an error if the fragments map is malformed.
84
73
  */
85
- delete(world: World): void;
86
- /** {@link Disposable.dispose} */
87
- dispose(): void;
88
- }
89
- import { Component, Disposable, Event } from "../Types";
90
- /**
91
- * 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.
92
- */
93
- export declare class Components implements Disposable {
74
+ find(filter?: {
75
+ [name: string]: string[];
76
+ }): FRAGS.FragmentIdMap;
94
77
  /**
95
- * The version of the @thatopen/components library.
78
+ * Classifies fragments based on their modelID.
79
+ *
80
+ * @param modelID - The unique identifier of the model to classify fragments by.
81
+ * @param group - The FragmentsGroup containing the fragments to be classified.
82
+ *
83
+ * @remarks
84
+ * This method iterates through the fragments in the provided group,
85
+ * and classifies them based on their modelID.
86
+ * The classification is stored in the 'list.models' property,
87
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
88
+ *
96
89
  */
97
- static readonly release = "2.1.14";
98
- /** {@link Disposable.onDisposed} */
99
- readonly onDisposed: Event<void>;
90
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
100
91
  /**
101
- * The list of components created in this app.
102
- * The keys are UUIDs and the values are instances of the components.
92
+ * Classifies fragments based on their PredefinedType property.
93
+ *
94
+ * @param group - The FragmentsGroup containing the fragments to be classified.
95
+ *
96
+ * @remarks
97
+ * This method iterates through the properties of the fragments in the provided group,
98
+ * and classifies them based on their PredefinedType property.
99
+ * The classification is stored in the 'list.predefinedTypes' property,
100
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
101
+ *
102
+ * @throws Will throw an error if the fragment ID is not found.
103
103
  */
104
- readonly list: Map<string, Component>;
104
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
105
105
  /**
106
- * If disabled, the animation loop will be stopped.
107
- * Default value is false.
106
+ * Classifies fragments based on their entity type.
107
+ *
108
+ * @param group - The FragmentsGroup containing the fragments to be classified.
109
+ *
110
+ * @remarks
111
+ * This method iterates through the relations of the fragments in the provided group,
112
+ * and classifies them based on their entity type.
113
+ * The classification is stored in the 'list.entities' property,
114
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
115
+ *
116
+ * @throws Will throw an error if the fragment ID is not found.
108
117
  */
109
- enabled: boolean;
110
- private _clock;
118
+ byEntity(group: FRAGS.FragmentsGroup): void;
111
119
  /**
112
- * Adds a component to the list of components.
113
- * Throws an error if a component with the same UUID already exists.
120
+ * Classifies fragments based on a specific IFC relationship.
114
121
  *
115
- * @param uuid - The unique identifier of the component.
116
- * @param instance - The instance of the component to be added.
122
+ * @param group - The FragmentsGroup containing the fragments to be classified.
123
+ * @param ifcRel - The IFC relationship number to classify fragments by.
124
+ * @param systemName - The name of the classification system to store the classification.
117
125
  *
118
- * @throws Will throw an error if a component with the same UUID already exists.
126
+ * @remarks
127
+ * This method iterates through the relations of the fragments in the provided group,
128
+ * and classifies them based on the specified IFC relationship.
129
+ * The classification is stored in the 'list' property under the specified system name,
130
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
119
131
  *
120
- * @internal
132
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
121
133
  */
122
- add(uuid: string, instance: Component): void;
134
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
123
135
  /**
124
- * Retrieves a component instance by its constructor function.
125
- * If the component does not exist in the list, it will be created and added.
126
- *
127
- * @template U - The type of the component to retrieve.
128
- * @param Component - The constructor function of the component to retrieve.
136
+ * Classifies fragments based on their spatial structure in the IFC model.
129
137
  *
130
- * @returns The instance of the requested component.
138
+ * @param model - The FragmentsGroup containing the fragments to be classified.
139
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
140
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
141
+ * the classifier just pick the WEBIFC categories provided.
131
142
  *
132
- * @throws Will throw an error if a component with the same UUID already exists.
143
+ * @remarks
144
+ * This method iterates through the relations of the fragments in the provided group,
145
+ * and classifies them based on their spatial structure in the IFC model.
146
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
147
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
133
148
  *
134
- * @internal
149
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
135
150
  */
136
- get<U extends Component>(Component: new (components: Components) => U): U;
137
- constructor();
151
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
152
+ useProperties?: boolean;
153
+ isolate?: Set<number>;
154
+ }): Promise<void>;
138
155
  /**
139
- * Initializes the Components instance.
140
- * This method starts the animation loop, sets the enabled flag to true,
141
- * and calls the update method.
156
+ * Sets the color of the specified fragments.
142
157
  *
143
- * @returns {void}
158
+ * @param items - A map of fragment IDs to their respective express IDs.
159
+ * @param color - The color to set for the fragments.
160
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
161
+ *
162
+ * @remarks
163
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
164
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
165
+ *
166
+ * @throws Will throw an error if the fragment with the specified ID is not found.
144
167
  */
145
- init(): void;
168
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
146
169
  /**
147
- * Disposes the memory of all the components and tools of this instance of
148
- * the library. A memory leak will be created if:
149
- *
150
- * - An instance of the library ends up out of scope and this function isn't
151
- * called. This is especially relevant in Single Page Applications (React,
152
- * Angular, Vue, etc).
170
+ * Resets the color of the specified fragments to their original color.
153
171
  *
154
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
155
- * referenced by a reference type (object or array).
172
+ * @param items - A map of fragment IDs to their respective express IDs.
156
173
  *
157
- * You can learn more about how Three.js handles memory leaks
158
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
174
+ * @remarks
175
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
176
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
159
177
  *
178
+ * @throws Will throw an error if the fragment with the specified ID is not found.
160
179
  */
161
- dispose(): void;
162
- private update;
163
- private static setupBVH;
180
+ resetColor(items: FRAGS.FragmentIdMap): void;
181
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
164
182
  }
165
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
166
- import { Components } from "../Components";
167
- import { SimpleWorld } from "./src";
183
+ import * as WEBIFC from "web-ifc";
184
+ import { Components, Disposable, Event, Component } from "../../core";
185
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
168
186
  /**
169
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
187
+ * 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).
170
188
  */
171
- export declare class Worlds extends Component implements Updateable, Disposable {
189
+ export declare class IfcGeometryTiler extends Component implements Disposable {
172
190
  /**
173
191
  * A unique identifier for the component.
174
192
  * This UUID is used to register the component within the Components system.
175
193
  */
176
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
177
- /** {@link Updateable.onAfterUpdate} */
178
- readonly onAfterUpdate: Event<unknown>;
179
- /** {@link Updateable.onBeforeUpdate} */
180
- readonly onBeforeUpdate: Event<unknown>;
181
- /** {@link Disposable.onDisposed} */
182
- readonly onDisposed: Event<unknown>;
194
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
183
195
  /**
184
- * An event that is triggered when a new world is created.
185
- * The event passes the newly created world as a parameter.
196
+ * Event triggered when geometry is streamed.
197
+ * Contains the streamed geometry data and its buffer.
186
198
  */
187
- readonly onWorldCreated: Event<World>;
199
+ readonly onGeometryStreamed: Event<{
200
+ buffer: Uint8Array;
201
+ data: StreamedGeometries;
202
+ }>;
188
203
  /**
189
- * An event that is triggered when a world is deleted.
190
- * The event passes the UUID of the deleted world as a parameter.
204
+ * Event triggered when assets are streamed.
205
+ * Contains the streamed assets.
191
206
  */
192
- readonly onWorldDeleted: Event<string>;
207
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
193
208
  /**
194
- * A collection of worlds managed by this component.
195
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
209
+ * Event triggered to indicate the progress of the streaming process.
210
+ * Contains the progress percentage.
196
211
  */
197
- list: Map<string, World>;
212
+ readonly onProgress: Event<number>;
213
+ /**
214
+ * Event triggered when the IFC file is loaded.
215
+ * Contains the loaded IFC file data.
216
+ */
217
+ readonly onIfcLoaded: Event<Uint8Array>;
218
+ /** {@link Disposable.onDisposed} */
219
+ readonly onDisposed: Event<unknown>;
220
+ /**
221
+ * Settings for the IfcGeometryTiler.
222
+ */
223
+ settings: IfcStreamingSettings;
198
224
  /** {@link Component.enabled} */
199
225
  enabled: boolean;
200
- constructor(components: Components);
201
226
  /**
202
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
203
- *
204
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
205
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
206
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
207
- *
208
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
227
+ * The WebIFC API instance used for IFC file processing.
209
228
  */
210
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
229
+ webIfc: WEBIFC.IfcAPI;
230
+ private _spatialTree;
231
+ private _metaData;
232
+ private _visitedGeometries;
233
+ private _streamSerializer;
234
+ private _geometries;
235
+ private _geometryCount;
236
+ private _civil;
237
+ private _groupSerializer;
238
+ private _assets;
239
+ private _meshesWithHoles;
240
+ constructor(components: Components);
241
+ /** {@link Disposable.dispose} */
242
+ dispose(): void;
211
243
  /**
212
- * Deletes a world from the list of worlds.
244
+ * This method streams the IFC file from a given buffer.
213
245
  *
214
- * @param {World} world - The world to be deleted.
246
+ * @param data - The Uint8Array containing the IFC file data.
247
+ * @returns A Promise that resolves when the streaming process is complete.
215
248
  *
216
- * @throws {Error} - Throws an error if the provided world is not found in the list.
249
+ * @remarks
250
+ * This method cleans up any resources after the streaming process is complete.
217
251
  *
218
- * @returns {void}
252
+ * @example
253
+ * '''typescript
254
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
255
+ * const rawBuffer = await response.arrayBuffer();
256
+ * const ifcBuffer = new Uint8Array(rawBuffer);
257
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
258
+ * '''
219
259
  */
220
- delete(world: World): void;
260
+ streamFromBuffer(data: Uint8Array): Promise<void>;
221
261
  /**
222
- * Disposes of the Worlds component and all its managed worlds.
223
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
224
- * and triggers the onDisposed event.
262
+ * This method streams the IFC file from a given callback.
263
+ *
264
+ * @param loadCallback - The callback function that will be used to load the IFC file.
265
+ * @returns A Promise that resolves when the streaming process is complete.
266
+ *
267
+ * @remarks
268
+ * This method cleans up any resources after the streaming process is complete.
225
269
  *
226
- * @returns {void}
227
270
  */
228
- dispose(): void;
229
- /** {@link Updateable.update} */
230
- update(delta?: number): void | Promise<void>;
271
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
272
+ private readIfcFile;
273
+ private streamIfcFile;
274
+ private streamAllGeometries;
275
+ private cleanUp;
276
+ private getMesh;
277
+ private getGeometry;
278
+ private streamAssets;
279
+ private streamGeometries;
231
280
  }
281
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
232
282
  import * as THREE from "three";
233
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
234
- import { SimplePlane } from "./src";
235
- import { Components } from "../Components";
283
+ import * as FRAGS from "@thatopen/fragments";
284
+ import { Component, Components, Event, Disposable } from "../../core";
285
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
236
286
  /**
237
- * 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).
238
- *
239
- * @param components - the instance of {@link Components} used.
240
- * E.g. {@link SimplePlane}.
287
+ * 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).
241
288
  */
242
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
289
+ export declare class FragmentsManager extends Component implements Disposable {
243
290
  /**
244
291
  * A unique identifier for the component.
245
292
  * This UUID is used to register the component within the Components system.
246
293
  */
247
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
248
- /** Event that fires when the user starts dragging a clipping plane. */
249
- readonly onBeforeDrag: Event<void>;
250
- /** Event that fires when the user stops dragging a clipping plane. */
251
- readonly onAfterDrag: Event<void>;
294
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
295
+ /** {@link Disposable.onDisposed} */
296
+ readonly onDisposed: Event<unknown>;
252
297
  /**
253
- * Event that fires when the user starts creating a clipping plane.
298
+ * Event triggered when fragments are loaded.
254
299
  */
255
- readonly onBeforeCreate: Event<unknown>;
300
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
256
301
  /**
257
- * Event that fires when the user cancels the creation of a clipping plane.
302
+ * Event triggered when fragments are disposed.
258
303
  */
259
- readonly onBeforeCancel: Event<unknown>;
304
+ readonly onFragmentsDisposed: Event<{
305
+ groupID: string;
306
+ fragmentIDs: string[];
307
+ }>;
260
308
  /**
261
- * Event that fires after the user cancels the creation of a clipping plane.
309
+ * Map containing all loaded fragments.
310
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
262
311
  */
263
- readonly onAfterCancel: Event<unknown>;
312
+ readonly list: Map<string, Fragment>;
264
313
  /**
265
- * Event that fires when the user starts deleting a clipping plane.
314
+ * Map containing all loaded fragment groups.
315
+ * The key is the group's unique identifier, and the value is the group itself.
266
316
  */
267
- readonly onBeforeDelete: Event<unknown>;
317
+ readonly groups: Map<string, FragmentsGroup>;
318
+ baseCoordinationModel: string;
319
+ baseCoordinationMatrix: THREE.Matrix4;
320
+ /** {@link Component.enabled} */
321
+ enabled: boolean;
322
+ private _loader;
268
323
  /**
269
- * Event that fires after a clipping plane has been created.
270
- * @param plane - The newly created clipping plane.
324
+ * Getter for the meshes of all fragments in the FragmentsManager.
325
+ * It iterates over the fragments in the list and pushes their meshes into an array.
326
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
271
327
  */
272
- readonly onAfterCreate: Event<SimplePlane>;
328
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
329
+ constructor(components: Components);
330
+ /** {@link Disposable.dispose} */
331
+ dispose(): void;
273
332
  /**
274
- * Event that fires after a clipping plane has been deleted.
275
- * @param plane - The deleted clipping plane.
333
+ * Dispose of a specific fragment group.
334
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
335
+ * disposes of the group, and triggers the onFragmentsDisposed event.
336
+ *
337
+ * @param group - The fragment group to be disposed.
276
338
  */
277
- readonly onAfterDelete: Event<SimplePlane>;
278
- /** {@link Disposable.onDisposed} */
279
- readonly onDisposed: Event<string>;
339
+ disposeGroup(group: FragmentsGroup): void;
280
340
  /**
281
- * Whether to force the clipping plane to be orthogonal in the Y direction
282
- * (up). This is desirable when clipping a building horizontally and a
283
- * clipping plane is created in its roof, which might have a slight
284
- * slope for draining purposes.
341
+ * Loads a binary file that contain fragment geometry.
342
+ * @param data - The binary data to load.
343
+ * @param config - Optional configuration for loading.
344
+ * @param config.isStreamed - Optional setting to determine whether this model is streamed or not.
345
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
346
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
347
+ * @returns The loaded FragmentsGroup.
285
348
  */
286
- orthogonalY: boolean;
349
+ load(data: Uint8Array, config?: Partial<{
350
+ coordinate: boolean;
351
+ name: string;
352
+ properties: FRAGS.IfcProperties;
353
+ relationsMap: RelationsMap;
354
+ isStreamed?: boolean;
355
+ }>): FragmentsGroup;
287
356
  /**
288
- * The tolerance that determines whether an almost-horizontal clipping plane
289
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
290
- * has to be 'true' for this to apply.
357
+ * Export the specified fragmentsgroup to binary data.
358
+ * @param group - the fragments group to be exported.
359
+ * @returns the exported data as binary buffer.
291
360
  */
292
- toleranceOrthogonalY: number;
361
+ export(group: FragmentsGroup): Uint8Array;
293
362
  /**
294
- * The type of clipping plane to be created.
295
- * Default is {@link SimplePlane}.
363
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
364
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
365
+ * @returns A map of model IDs to sets of express IDs.
296
366
  */
297
- Type: new (...args: any) => SimplePlane;
367
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
368
+ [modelID: string]: Set<number>;
369
+ };
298
370
  /**
299
- * A list of all the clipping planes created by this component.
371
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
372
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
373
+ * @returns A fragment ID map.
374
+ * @remarks
375
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
376
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
377
+ * The fragment ID maps are then merged into a single map and returned.
378
+ * 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.
300
379
  */
301
- list: SimplePlane[];
302
- /** The material used in all the clipping planes. */
303
- private _material;
304
- private _size;
305
- private _enabled;
306
- private _visible;
307
- /** {@link Component.enabled} */
308
- get enabled(): boolean;
309
- /** {@link Component.enabled} */
310
- set enabled(state: boolean);
311
- /** {@link Hideable.visible } */
312
- get visible(): boolean;
313
- /** {@link Hideable.visible } */
314
- set visible(state: boolean);
315
- /** The material of the clipping plane representation. */
316
- get material(): THREE.MeshBasicMaterial;
317
- /** The material of the clipping plane representation. */
318
- set material(material: THREE.MeshBasicMaterial);
319
- /** The size of the geometric representation of the clippings planes. */
320
- get size(): number;
321
- /** The size of the geometric representation of the clippings planes. */
322
- set size(size: number);
323
- constructor(components: Components);
324
- /** {@link Disposable.dispose} */
325
- dispose(): void;
326
- /** {@link Createable.create} */
327
- create(world: World): SimplePlane | null;
380
+ modelIdToFragmentIdMap(modelIdMap: {
381
+ [modelID: string]: Set<number>;
382
+ }): FRAGS.FragmentIdMap;
328
383
  /**
329
- * Creates a plane in a certain place and with a certain orientation,
330
- * without the need of the mouse.
384
+ * Applies coordinate transformation to the provided models.
385
+ * If no models are provided, all groups are used.
386
+ * The first model in the list becomes the base model for coordinate transformation.
387
+ * All other models are then transformed to match the base model's coordinate system.
331
388
  *
332
- * @param world - the world where this plane should be created.
333
- * @param normal - the orientation of the clipping plane.
334
- * @param point - the position of the clipping plane.
335
- * navigation.
389
+ * @param models - The models to apply coordinate transformation to.
390
+ * If not provided, all models are used.
336
391
  */
337
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
392
+ coordinate(models?: FragmentsGroup[]): void;
338
393
  /**
339
- * {@link Createable.delete}
394
+ * Applies the base coordinate system to the provided object.
340
395
  *
341
- * @param world - the world where the plane to delete is.
342
- * @param plane - the plane to delete. If undefined, the first plane
343
- * found under the cursor will be deleted.
344
- */
345
- delete(world: World, plane?: SimplePlane): void;
346
- /**
347
- * Deletes all the existing clipping planes.
396
+ * This function takes an object and its original coordinate system as input.
397
+ * It then inverts the original coordinate system and applies the base coordinate system
398
+ * to the object. This ensures that the object's position, rotation, and scale are
399
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
348
400
  *
349
- * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
401
+ * @param object - The object to which the base coordinate system will be applied.
402
+ * This should be an instance of THREE.Object3D.
403
+ *
404
+ * @param originalCoordinateSystem - The original coordinate system of the object.
405
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
350
406
  */
351
- deleteAll(types?: Set<string>): void;
352
- private deletePlane;
353
- private pickPlane;
354
- private getAllPlaneMeshes;
355
- private createPlaneFromIntersection;
356
- private getWorldNormal;
357
- private normalizePlaneDirectionY;
358
- private newPlane;
359
- private updateMaterialsAndPlanes;
360
- private _onStartDragging;
361
- private _onEndDragging;
407
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
362
408
  }
363
- import * as THREE from "three";
364
- import { Components } from "../Components";
365
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
366
- import { Component, Event, Disposable, World } from "../Types";
409
+ import * as WEBIFC from "web-ifc";
410
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
411
+ import { PropertiesStreamingSettings } from "./src";
367
412
  /**
368
- * 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).
413
+ * 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).
369
414
  */
370
- export declare class Cullers extends Component implements Disposable {
415
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
371
416
  /**
372
417
  * A unique identifier for the component.
373
418
  * This UUID is used to register the component within the Components system.
374
419
  */
375
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
420
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
376
421
  /**
377
- * An event that is triggered when the Cullers component is disposed.
422
+ * An event that is triggered when properties are streamed from the IFC file.
423
+ * The event provides the type of the IFC entity and the corresponding data.
378
424
  */
379
- readonly onDisposed: Event<unknown>;
380
- private _enabled;
425
+ readonly onPropertiesStreamed: AsyncEvent<{
426
+ type: number;
427
+ data: {
428
+ [id: number]: any;
429
+ };
430
+ }>;
381
431
  /**
382
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
432
+ * An event that is triggered to indicate the progress of the streaming process.
433
+ * The event provides a number between 0 and 1 representing the progress percentage.
383
434
  */
384
- list: Map<string, MeshCullerRenderer>;
385
- /** {@link Component.enabled} */
386
- get enabled(): boolean;
435
+ readonly onProgress: AsyncEvent<number>;
436
+ /**
437
+ * An event that is triggered when indices are streamed from the IFC file.
438
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
439
+ */
440
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
441
+ /** {@link Disposable.onDisposed} */
442
+ readonly onDisposed: Event<string>;
387
443
  /** {@link Component.enabled} */
388
- set enabled(value: boolean);
389
- constructor(components: Components);
444
+ enabled: boolean;
390
445
  /**
391
- * Creates a new MeshCullerRenderer for the given world.
392
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
393
- *
394
- * @param world - The world for which to create the MeshCullerRenderer.
395
- * @param config - Optional configuration settings for the MeshCullerRenderer.
396
- *
397
- * @returns The newly created or existing MeshCullerRenderer for the given world.
446
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
398
447
  */
399
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
448
+ settings: PropertiesStreamingSettings;
400
449
  /**
401
- * Deletes the MeshCullerRenderer associated with the given world.
402
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
403
- *
404
- * @param world - The world for which to delete the MeshCullerRenderer.
405
- *
406
- * @returns {void}
450
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
407
451
  */
408
- delete(world: World): void;
452
+ webIfc: WEBIFC.IfcAPI;
409
453
  /** {@link Disposable.dispose} */
410
- dispose(): void;
454
+ dispose(): Promise<void>;
411
455
  /**
412
- * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
456
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
413
457
  *
414
- * @param meshes - The meshes to update.
458
+ * @param data - The Uint8Array containing the IFC file data.
459
+ * @returns A Promise that resolves when the streaming process is complete.
460
+ */
461
+ streamFromBuffer(data: Uint8Array): Promise<void>;
462
+ /**
463
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
415
464
  *
416
- * @returns {void}
465
+ * @param loadCallback - A callback function that loads the IFC file data.
466
+ * @returns A Promise that resolves when the streaming process is complete.
417
467
  */
418
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
468
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
469
+ private readIfcFile;
470
+ private streamIfcFile;
471
+ private streamAllProperties;
472
+ private cleanUp;
419
473
  }
420
- import { Component, Disposable, World, Event } from "../Types";
421
- import { GridConfig, SimpleGrid } from "./src";
422
- import { Components } from "../Components";
474
+ import * as THREE from "three";
475
+ import * as FRAGS from "@thatopen/fragments";
476
+ import { FragmentsGroup } from "@thatopen/fragments";
477
+ import { Component, Components, Disposable, Event } from "../../core";
423
478
  /**
424
- * 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).
479
+ * 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).
425
480
  */
426
- export declare class Grids extends Component implements Disposable {
427
- /**
428
- * A unique identifier for the component.
429
- * This UUID is used to register the component within the Components system.
430
- */
431
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
432
- /**
433
- * A map of world UUIDs to their corresponding grid instances.
434
- */
435
- list: Map<string, SimpleGrid>;
436
- /**
437
- * The default configuration for grid creation.
438
- */
439
- config: Required<GridConfig>;
440
- /** {@link Disposable.onDisposed} */
441
- readonly onDisposed: Event<unknown>;
481
+ export declare class BoundingBoxer extends Component implements Disposable {
482
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
442
483
  /** {@link Component.enabled} */
443
484
  enabled: boolean;
485
+ /** {@link Disposable.onDisposed} */
486
+ readonly onDisposed: Event<unknown>;
487
+ private _absoluteMin;
488
+ private _absoluteMax;
489
+ private _meshes;
444
490
  constructor(components: Components);
445
491
  /**
446
- * Creates a new grid for the given world.
447
- * Throws an error if a grid already exists for the world.
448
- *
449
- * @param world - The world to create the grid for.
450
- * @returns The newly created grid.
492
+ * A static method to calculate the dimensions of a given bounding box.
451
493
  *
452
- * @throws Will throw an error if a grid already exists for the given world.
494
+ * @param bbox - The bounding box to calculate the dimensions for.
495
+ * @returns An object containing the width, height, depth, and center of the bounding box.
453
496
  */
454
- create(world: World): SimpleGrid;
497
+ static getDimensions(bbox: THREE.Box3): {
498
+ width: number;
499
+ height: number;
500
+ depth: number;
501
+ center: THREE.Vector3;
502
+ };
455
503
  /**
456
- * Deletes the grid associated with the given world.
457
- * If a grid does not exist for the given world, this method does nothing.
504
+ * A static method to create a new bounding box boundary.
458
505
  *
459
- * @param world - The world for which to delete the grid.
506
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
507
+ * @returns A new THREE.Vector3 representing the boundary.
460
508
  *
461
509
  * @remarks
462
- * This method will dispose of the grid and remove it from the internal list.
463
- * If the world is disposed before calling this method, the grid will be automatically deleted.
464
- */
465
- delete(world: World): void;
466
- /** {@link Disposable.dispose} */
467
- dispose(): void;
468
- }
469
- import * as THREE from "three";
470
- import { Components } from "../Components";
471
- import { SimpleCamera } from "..";
472
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
473
- /**
474
- * 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).
475
- */
476
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
477
- /**
478
- * A ProjectionManager instance that manages the projection modes of the camera.
479
- */
480
- readonly projection: ProjectionManager;
481
- /**
482
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
483
- * This camera is used when the projection mode is set to orthographic.
484
- */
485
- readonly threeOrtho: THREE.OrthographicCamera;
486
- /**
487
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
488
- * This camera is used when the projection mode is set to perspective.
510
+ * This method is used to create a new boundary for calculating bounding boxes.
511
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
512
+ * depending on the value of the 'positive' parameter.
513
+ *
514
+ * @example
515
+ * '''typescript
516
+ * const positiveBound = BoundingBoxer.newBound(true);
517
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
518
+ *
519
+ * const negativeBound = BoundingBoxer.newBound(false);
520
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
521
+ * '''
489
522
  */
490
- readonly threePersp: THREE.PerspectiveCamera;
491
- protected readonly _userInputButtons: any;
492
- protected readonly _frustumSize = 50;
493
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
494
- protected _mode: NavigationMode | null;
495
- private previousSize;
523
+ static newBound(positive: boolean): THREE.Vector3;
496
524
  /**
497
- * Getter for the current navigation mode.
498
- * Throws an error if the mode is not found or the camera is not initialized.
525
+ * A static method to calculate the bounding box of a set of points.
499
526
  *
500
- * @returns {NavigationMode} The current navigation mode.
527
+ * @param points - An array of THREE.Vector3 representing the points.
528
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
529
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
530
+ * @returns A THREE.Box3 representing the bounding box of the given points.
501
531
  *
502
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
532
+ * @remarks
533
+ * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
534
+ * 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.
535
+ *
536
+ * @example
537
+ * '''typescript
538
+ * const points = [
539
+ * new THREE.Vector3(1, 2, 3),
540
+ * new THREE.Vector3(4, 5, 6),
541
+ * new THREE.Vector3(7, 8, 9),
542
+ * ];
543
+ *
544
+ * const bbox = BoundingBoxer.getBounds(points);
545
+ * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
546
+ * '''
503
547
  */
504
- get mode(): NavigationMode;
505
- constructor(components: Components);
548
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
506
549
  /** {@link Disposable.dispose} */
507
550
  dispose(): void;
508
551
  /**
509
- * Sets a new {@link NavigationMode} and disables the previous one.
552
+ * Returns the bounding box of the calculated fragments.
510
553
  *
511
- * @param mode - The {@link NavigationMode} to set.
512
- */
513
- set(mode: NavModeID): void;
514
- /**
515
- * Make the camera view fit all the specified meshes.
554
+ * @returns A new THREE.Box3 instance representing the bounding box.
516
555
  *
517
- * @param meshes the meshes to fit. If it is not defined, it will
518
- * evaluate {@link Components.meshes}.
519
- * @param offset the distance to the fit object
520
- */
521
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
522
- /**
523
- * Allows or prevents all user input.
556
+ * @remarks
557
+ * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
558
+ * The returned box represents the bounding box of the calculated fragments.
524
559
  *
525
- * @param active - whether to enable or disable user inputs.
560
+ * @example
561
+ * '''typescript
562
+ * const boundingBox = boundingBoxer.get();
563
+ * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
564
+ * '''
526
565
  */
527
- setUserInput(active: boolean): void;
528
- private disableUserInput;
529
- private enableUserInput;
530
- private newOrthoCamera;
531
- private setOrthoPerspCameraAspect;
566
+ get(): THREE.Box3;
567
+ /**
568
+ * Calculates and returns a sphere that encompasses the entire bounding box.
569
+ *
570
+ * @returns A new THREE.Sphere instance representing the calculated sphere.
571
+ *
572
+ * @remarks
573
+ * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
574
+ * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
575
+ * The radius is calculated as the distance from the center to the minimum bound.
576
+ *
577
+ * @example
578
+ * '''typescript
579
+ * const boundingBoxer = components.get(BoundingBoxer);
580
+ * boundingBoxer.add(fragmentsGroup);
581
+ * const boundingSphere = boundingBoxer.getSphere();
582
+ * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
583
+ * '''
584
+ */
585
+ getSphere(): THREE.Sphere;
586
+ /**
587
+ * Returns a THREE.Mesh instance representing the bounding box.
588
+ *
589
+ * @returns A new THREE.Mesh instance representing the bounding box.
590
+ *
591
+ * @remarks
592
+ * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
593
+ * It then creates a new THREE.BoxGeometry with the calculated dimensions.
594
+ * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
595
+ * The position of the mesh is set to the center of the bounding box.
596
+ *
597
+ * @example
598
+ * '''typescript
599
+ * const boundingBoxer = components.get(BoundingBoxer);
600
+ * boundingBoxer.add(fragmentsGroup);
601
+ * const boundingBoxMesh = boundingBoxer.getMesh();
602
+ * scene.add(boundingBoxMesh);
603
+ * '''
604
+ */
605
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
606
+ /**
607
+ * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
608
+ * This method is used to prepare the BoundingBoxer for a new set of fragments.
609
+ *
610
+ * @remarks
611
+ * This method is called when a new set of fragments is added to the BoundingBoxer.
612
+ * It ensures that the bounding box calculations are accurate and up-to-date.
613
+ *
614
+ * @example
615
+ * '''typescript
616
+ * const boundingBoxer = components.get(BoundingBoxer);
617
+ * boundingBoxer.add(fragmentsGroup);
618
+ * // ...
619
+ * boundingBoxer.reset();
620
+ * '''
621
+ */
622
+ reset(): void;
623
+ /**
624
+ * Adds a FragmentsGroup to the BoundingBoxer.
625
+ *
626
+ * @param group - The FragmentsGroup to add.
627
+ *
628
+ * @remarks
629
+ * This method iterates through each fragment in the provided FragmentsGroup,
630
+ * and calls the 'addMesh' method for each fragment's mesh.
631
+ *
632
+ * @example
633
+ * '''typescript
634
+ * const boundingBoxer = components.get(BoundingBoxer);
635
+ * boundingBoxer.add(fragmentsGroup);
636
+ * '''
637
+ */
638
+ add(group: FragmentsGroup): void;
639
+ /**
640
+ * Adds a mesh to the BoundingBoxer and calculates the bounding box.
641
+ *
642
+ * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
643
+ * @param itemIDs - An optional iterable of numbers representing the item IDs.
644
+ *
645
+ * @remarks
646
+ * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
647
+ * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
648
+ * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
649
+ *
650
+ * @example
651
+ * '''typescript
652
+ * const boundingBoxer = components.get(BoundingBoxer);
653
+ * boundingBoxer.addMesh(mesh);
654
+ * '''
655
+ */
656
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
657
+ /**
658
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
659
+ *
660
+ * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
661
+ * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
662
+ *
663
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
664
+ *
665
+ * @remarks
666
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
667
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
668
+ *
669
+ * @example
670
+ * '''typescript
671
+ * const boundingBoxer = components.get(BoundingBoxer);
672
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
673
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
674
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
675
+ * };
676
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
677
+ * '''
678
+ */
679
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
680
+ private static getFragmentBounds;
532
681
  }
533
- import { MiniMap } from "./src";
534
- import { Component, Updateable, World, Event, Disposable } from "../Types";
535
- import { Components } from "../Components";
682
+ import { Component, Disposable, Event, Components } from "../../core";
536
683
  /**
537
- * 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).
684
+ * 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).
538
685
  */
539
- export declare class MiniMaps extends Component implements Updateable, Disposable {
686
+ export declare class Exploder extends Component implements Disposable {
540
687
  /**
541
688
  * A unique identifier for the component.
542
689
  * This UUID is used to register the component within the Components system.
543
690
  */
544
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
545
- /** {@link Updateable.onAfterUpdate} */
546
- readonly onAfterUpdate: Event<unknown>;
547
- /** {@link Updateable.onBeforeUpdate} */
548
- readonly onBeforeUpdate: Event<unknown>;
691
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
549
692
  /** {@link Disposable.onDisposed} */
550
693
  readonly onDisposed: Event<unknown>;
551
694
  /** {@link Component.enabled} */
552
695
  enabled: boolean;
553
696
  /**
554
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
697
+ * The height of the explosion animation.
698
+ * This property determines the vertical distance by which fragments are moved during the explosion.
699
+ * Default value is 10.
555
700
  */
556
- list: Map<string, MiniMap>;
557
- constructor(components: Components);
701
+ height: number;
558
702
  /**
559
- * Creates a new {@link MiniMap} instance associated with the given world.
560
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
561
- *
562
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
563
- * @returns The newly created {@link MiniMap} instance.
564
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
703
+ * The group name used for the explosion animation.
704
+ * This property specifies the group of fragments that will be affected by the explosion.
705
+ * Default value is "storeys".
565
706
  */
566
- create(world: World): MiniMap;
707
+ groupName: string;
567
708
  /**
568
- * Deletes a {@link MiniMap} instance associated with the given world ID.
569
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
570
- *
571
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
572
- * @returns {void}
709
+ * A set of strings representing the exploded items.
710
+ * This set is used to keep track of which items have been exploded.
573
711
  */
574
- delete(id: string): void;
712
+ list: Set<string>;
713
+ constructor(components: Components);
575
714
  /** {@link Disposable.dispose} */
576
715
  dispose(): void;
577
- /** {@link Updateable.update} */
578
- update(): void;
716
+ /**
717
+ * Sets the explosion state of the fragments.
718
+ *
719
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
720
+ *
721
+ * @remarks
722
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
723
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
724
+ * If 'active' is false, the fragments are moved back to their original position.
725
+ *
726
+ * The method also keeps track of the exploded items using the 'list' set.
727
+ *
728
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
729
+ */
730
+ set(active: boolean): void;
579
731
  }
580
- import * as WEBIFC from "web-ifc";
581
- import { FragmentsGroup } from "@thatopen/fragments";
582
- import { Disposable, Event, Component, Components } from "../../core";
583
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
584
- export type { InverseAttribute, RelationsMap } from "./src/types";
732
+ import * as FRAGS from "@thatopen/fragments";
733
+ import { Components, Component } from "../../core";
585
734
  /**
586
- * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
735
+ * 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).
587
736
  */
588
- export declare class IfcRelationsIndexer extends Component implements Disposable {
737
+ export declare class Hider extends Component {
589
738
  /**
590
739
  * A unique identifier for the component.
591
740
  * This UUID is used to register the component within the Components system.
592
741
  */
593
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
594
- /** {@link Disposable.onDisposed} */
595
- readonly onDisposed: Event<string>;
596
- /**
597
- * Event triggered when relations for a model have been indexed.
598
- * This event provides the model's UUID and the relations map generated for that model.
599
- *
600
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
601
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
602
- * 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.
603
- */
604
- readonly onRelationsIndexed: Event<{
605
- modelID: string;
606
- relationsMap: RelationsMap;
607
- }>;
608
- /**
609
- * Holds the relationship mappings for each model processed by the indexer.
610
- * The structure is a map where each key is a model's UUID, and the value is another map.
611
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
612
- * representing a specific relation type, and the value is an array of expressIDs of entities
613
- * that are related through that relation type. This structure allows for efficient querying
614
- * of entity relationships within a model.
615
- */
616
- readonly relationMaps: ModelsRelationMap;
742
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
617
743
  /** {@link Component.enabled} */
618
744
  enabled: boolean;
619
- private _relToAttributesMap;
620
- private _inverseAttributes;
621
- private _ifcRels;
622
745
  constructor(components: Components);
623
- private onFragmentsDisposed;
624
- private indexRelations;
625
- private getAttributeIndex;
626
746
  /**
627
- * Adds a relation map to the model's relations map.
747
+ * Sets the visibility of fragments within the 3D scene.
748
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
749
+ * If 'items' is provided, only the specified fragments will be affected.
628
750
  *
629
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
630
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
751
+ * @param visible - The visibility state to set for the fragments.
752
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
753
+ * If not provided, all fragments will be affected.
631
754
  *
632
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
755
+ * @returns {void}
633
756
  */
634
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
757
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
635
758
  /**
636
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
637
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
638
- * and maps them in a structured way to facilitate quick access to related entities.
759
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
760
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
639
761
  *
640
- * The process involves querying the model for each relation type associated with the inverse attributes
641
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
642
- * and contains a nested map where each key is an entity's expressID and its value is another map.
643
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
644
- * of entities that are related through that attribute.
762
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
763
+ * If not provided, all fragments will be isolated.
645
764
  *
646
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
647
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
648
- * representation of the relations indexed by entity expressIDs and relation types.
649
- * @throws An error if the model does not have properties loaded.
765
+ * @returns {void}
650
766
  */
651
- process(model: FragmentsGroup): Promise<RelationsMap>;
767
+ isolate(items: FRAGS.FragmentIdMap): void;
768
+ private updateCulledVisibility;
769
+ }
770
+ import * as WEBIFC from "web-ifc";
771
+ import * as FRAGS from "@thatopen/fragments";
772
+ import { IfcFragmentSettings } from "./src";
773
+ import { Component, Components, Event, Disposable } from "../../core";
774
+ /**
775
+ * 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).
776
+ */
777
+ export declare class IfcLoader extends Component implements Disposable {
652
778
  /**
653
- * Processes a given model from a WebIfc API to index its IFC entities relations.
654
- *
655
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
656
- * @param modelID - The unique identifier of the model within the WebIfc API.
657
- * @returns A promise that resolves to the relations map for the processed model.
658
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
779
+ * A unique identifier for the component.
780
+ * This UUID is used to register the component within the Components system.
659
781
  */
660
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
782
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
783
+ /** {@link Disposable.onDisposed} */
784
+ readonly onDisposed: Event<string>;
661
785
  /**
662
- * Retrieves the relations of a specific entity within a model based on the given relation name.
663
- * This method searches the indexed relation maps for the specified model and entity,
664
- * returning the IDs of related entities if a match is found.
665
- *
666
- * @param model The 'FragmentsGroup' model containing the entity.
667
- * @param expressID The unique identifier of the entity within the model.
668
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
669
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
670
- * or the specified relation name is not indexed.
786
+ * An event triggered when the IFC file starts loading.
671
787
  */
672
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
788
+ readonly onIfcStartedLoading: Event<void>;
673
789
  /**
674
- * Serializes the relations of a given relation map into a JSON string.
675
- * 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,
676
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
677
- * The resulting object is then serialized into a JSON string.
678
- *
679
- * @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.
680
- * @returns A JSON string representing the serialized relations of the given relation map.
790
+ * An event triggered when the setup process is completed.
791
+ */
792
+ readonly onSetup: Event<void>;
793
+ /**
794
+ * The settings for the IfcLoader.
795
+ * It includes options for excluding categories, setting WASM paths, and more.
681
796
  */
682
- serializeRelations(relationMap: RelationsMap): string;
797
+ settings: IfcFragmentSettings;
683
798
  /**
684
- * Serializes the relations of a specific model into a JSON string.
685
- * This method iterates through the relations indexed for the given model,
686
- * organizing them into a structured object where each key is an expressID of an entity,
687
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
688
- * The resulting object is then serialized into a JSON string.
689
- *
690
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
691
- * @returns A JSON string representing the serialized relations of the specified model.
692
- * If the model has no indexed relations, 'null' is returned.
799
+ * The instance of the Web-IFC library used for handling IFC data.
693
800
  */
694
- serializeModelRelations(model: FragmentsGroup): string | null;
801
+ webIfc: WEBIFC.IfcAPI;
802
+ /** {@link Component.enabled} */
803
+ enabled: boolean;
804
+ private _material;
805
+ private _spatialTree;
806
+ private _metaData;
807
+ private _fragmentInstances;
808
+ private _civil;
809
+ private _visitedFragments;
810
+ private _materialT;
811
+ constructor(components: Components);
812
+ /** {@link Disposable.dispose} */
813
+ dispose(): void;
695
814
  /**
696
- * Serializes all relations of every model processed by the indexer into a JSON string.
697
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
698
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
699
- * and its value is another object mapping entity expressIDs to their related entities, categorized
700
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
815
+ * Sets up the IfcLoader component with the provided configuration.
701
816
  *
702
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
703
- * If no relations have been indexed, an empty object is returned as a JSON string.
817
+ * @param config - Optional configuration settings for the IfcLoader.
818
+ * If not provided, the existing settings will be used.
819
+ *
820
+ * @returns A Promise that resolves when the setup process is completed.
821
+ *
822
+ * @remarks
823
+ * If the 'autoSetWasm' option is enabled in the configuration,
824
+ * the method will automatically set the WASM paths for the Web-IFC library.
825
+ *
826
+ * @example
827
+ * '''typescript
828
+ * const ifcLoader = new IfcLoader(components);
829
+ * await ifcLoader.setup({ autoSetWasm: true });
830
+ * '''
704
831
  */
705
- serializeAllRelations(): string;
832
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
706
833
  /**
707
- * Converts a JSON string representing relations between entities into a structured map.
708
- * This method parses the JSON string to reconstruct the relations map that indexes
709
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
710
- * and the values are maps where each key is a relation type ID and its value is an array
711
- * of express IDs of entities related through that relation type.
834
+ * Loads an IFC file and processes it for 3D visualization.
712
835
  *
713
- * @param json The JSON string to be parsed into the relations map.
714
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
715
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
716
- * is an array of express IDs (as numbers) of entities related through that relation type.
836
+ * @param data - The Uint8Array containing the IFC file data.
837
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
838
+ *
839
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
840
+ *
841
+ * @example
842
+ * '''typescript
843
+ * const ifcLoader = components.get(IfcLoader);
844
+ * const group = await ifcLoader.load(ifcData);
845
+ * '''
717
846
  */
718
- getRelationsMapFromJSON(json: string): RelationsMap;
719
- /** {@link Disposable.dispose} */
720
- dispose(): void;
847
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
721
848
  /**
722
- * Adds relations between an entity and other entities in a BIM model.
849
+ * Reads an IFC file and initializes the Web-IFC library.
723
850
  *
724
- * @param model - The BIM model to which the relations will be added.
725
- * @param expressID - The expressID of the entity within the model.
726
- * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
727
- * @param relIDs - The expressIDs of the related entities within the model.
851
+ * @param data - The Uint8Array containing the IFC file data.
728
852
  *
729
- * @throws An error if the relation name is not a valid relation name.
853
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
854
+ *
855
+ * @remarks
856
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
857
+ * It also opens the IFC model using the provided data and settings.
858
+ *
859
+ * @example
860
+ * '''typescript
861
+ * const ifcLoader = components.get(IfcLoader);
862
+ * await ifcLoader.readIfcFile(ifcData);
863
+ * '''
730
864
  */
731
- addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
865
+ readIfcFile(data: Uint8Array): Promise<number>;
732
866
  /**
733
- * 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.
867
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
868
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
734
869
  *
735
- * @param model The BIM model whose children to get.
736
- * @param expressID The expressID of the item whose children to get.
737
- * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
870
+ * @remarks
871
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
738
872
  *
739
- * @returns A 'Set' with the expressIDs of the found items.
873
+ * @example
874
+ * '''typescript
875
+ * const ifcLoader = components.get(IfcLoader);
876
+ * ifcLoader.cleanUp();
877
+ * '''
740
878
  */
741
- getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
742
- }
743
- import * as THREE from "three";
744
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
745
- center: THREE.Vector3;
746
- halfSizes: THREE.Vector3;
747
- rotation: THREE.Matrix3;
748
- transformation: THREE.Matrix4;
749
- };
750
- import * as THREE from "three";
751
- export declare class MaterialsUtils {
752
- static isTransparent(material: THREE.Material): boolean;
879
+ cleanUp(): void;
880
+ private getAllGeometries;
881
+ private getMesh;
882
+ private getGeometry;
883
+ private autoSetWasm;
753
884
  }
754
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
755
885
  import * as THREE from "three";
756
886
  import { Component, Components, Disposable, Event, World } from "../core";
757
887
  /**
@@ -868,12 +998,17 @@ export declare class VertexPicker extends Component implements Disposable {
868
998
  private getVertices;
869
999
  private getVertex;
870
1000
  }
871
- export declare class UUID {
872
- private static _pattern;
873
- private static _lut;
874
- static create(): string;
875
- static validate(uuid: string): void;
1001
+ import * as THREE from "three";
1002
+ export declare class MaterialsUtils {
1003
+ static isTransparent(material: THREE.Material): boolean;
876
1004
  }
1005
+ import * as THREE from "three";
1006
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1007
+ center: THREE.Vector3;
1008
+ halfSizes: THREE.Vector3;
1009
+ rotation: THREE.Matrix3;
1010
+ transformation: THREE.Matrix4;
1011
+ };
877
1012
  import * as WEBIFC from "web-ifc";
878
1013
  import * as FRAG from "@thatopen/fragments";
879
1014
  import { Component, Components } from "../../core";
@@ -1155,213 +1290,81 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1155
1290
  private registerChange;
1156
1291
  private newSingleProperty;
1157
1292
  }
1158
- import * as THREE from "three";
1159
- import * as FRAGS from "@thatopen/fragments";
1160
- import { FragmentsGroup } from "@thatopen/fragments";
1161
- import { Component, Components, Disposable, Event } from "../../core";
1293
+ import { Component, Disposable, Event } from "../Types";
1162
1294
  /**
1163
- * 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).
1295
+ * 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.
1164
1296
  */
1165
- export declare class BoundingBoxer extends Component implements Disposable {
1166
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
1167
- /** {@link Component.enabled} */
1168
- enabled: boolean;
1169
- /** {@link Disposable.onDisposed} */
1170
- readonly onDisposed: Event<unknown>;
1171
- private _absoluteMin;
1172
- private _absoluteMax;
1173
- private _meshes;
1174
- constructor(components: Components);
1175
- /**
1176
- * A static method to calculate the dimensions of a given bounding box.
1177
- *
1178
- * @param bbox - The bounding box to calculate the dimensions for.
1179
- * @returns An object containing the width, height, depth, and center of the bounding box.
1180
- */
1181
- static getDimensions(bbox: THREE.Box3): {
1182
- width: number;
1183
- height: number;
1184
- depth: number;
1185
- center: THREE.Vector3;
1186
- };
1187
- /**
1188
- * A static method to create a new bounding box boundary.
1189
- *
1190
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
1191
- * @returns A new THREE.Vector3 representing the boundary.
1192
- *
1193
- * @remarks
1194
- * This method is used to create a new boundary for calculating bounding boxes.
1195
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
1196
- * depending on the value of the 'positive' parameter.
1197
- *
1198
- * @example
1199
- * '''typescript
1200
- * const positiveBound = BoundingBoxer.newBound(true);
1201
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
1202
- *
1203
- * const negativeBound = BoundingBoxer.newBound(false);
1204
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
1205
- * '''
1206
- */
1207
- static newBound(positive: boolean): THREE.Vector3;
1297
+ export declare class Components implements Disposable {
1208
1298
  /**
1209
- * A static method to calculate the bounding box of a set of points.
1210
- *
1211
- * @param points - An array of THREE.Vector3 representing the points.
1212
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
1213
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
1214
- * @returns A THREE.Box3 representing the bounding box of the given points.
1215
- *
1216
- * @remarks
1217
- * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
1218
- * 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.
1219
- *
1220
- * @example
1221
- * '''typescript
1222
- * const points = [
1223
- * new THREE.Vector3(1, 2, 3),
1224
- * new THREE.Vector3(4, 5, 6),
1225
- * new THREE.Vector3(7, 8, 9),
1226
- * ];
1227
- *
1228
- * const bbox = BoundingBoxer.getBounds(points);
1229
- * console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
1230
- * '''
1299
+ * The version of the @thatopen/components library.
1231
1300
  */
1232
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
1233
- /** {@link Disposable.dispose} */
1234
- dispose(): void;
1301
+ static readonly release = "2.1.16";
1302
+ /** {@link Disposable.onDisposed} */
1303
+ readonly onDisposed: Event<void>;
1235
1304
  /**
1236
- * Returns the bounding box of the calculated fragments.
1237
- *
1238
- * @returns A new THREE.Box3 instance representing the bounding box.
1239
- *
1240
- * @remarks
1241
- * This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
1242
- * The returned box represents the bounding box of the calculated fragments.
1243
- *
1244
- * @example
1245
- * '''typescript
1246
- * const boundingBox = boundingBoxer.get();
1247
- * console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
1248
- * '''
1305
+ * The list of components created in this app.
1306
+ * The keys are UUIDs and the values are instances of the components.
1249
1307
  */
1250
- get(): THREE.Box3;
1308
+ readonly list: Map<string, Component>;
1251
1309
  /**
1252
- * Calculates and returns a sphere that encompasses the entire bounding box.
1253
- *
1254
- * @returns A new THREE.Sphere instance representing the calculated sphere.
1255
- *
1256
- * @remarks
1257
- * This method calculates the center and radius of a sphere that encompasses the entire bounding box.
1258
- * The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
1259
- * The radius is calculated as the distance from the center to the minimum bound.
1260
- *
1261
- * @example
1262
- * '''typescript
1263
- * const boundingBoxer = components.get(BoundingBoxer);
1264
- * boundingBoxer.add(fragmentsGroup);
1265
- * const boundingSphere = boundingBoxer.getSphere();
1266
- * console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
1267
- * '''
1310
+ * If disabled, the animation loop will be stopped.
1311
+ * Default value is false.
1268
1312
  */
1269
- getSphere(): THREE.Sphere;
1313
+ enabled: boolean;
1314
+ private _clock;
1270
1315
  /**
1271
- * Returns a THREE.Mesh instance representing the bounding box.
1316
+ * Adds a component to the list of components.
1317
+ * Throws an error if a component with the same UUID already exists.
1272
1318
  *
1273
- * @returns A new THREE.Mesh instance representing the bounding box.
1319
+ * @param uuid - The unique identifier of the component.
1320
+ * @param instance - The instance of the component to be added.
1274
1321
  *
1275
- * @remarks
1276
- * This method calculates the dimensions of the bounding box using the 'getDimensions' method.
1277
- * It then creates a new THREE.BoxGeometry with the calculated dimensions.
1278
- * A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
1279
- * The position of the mesh is set to the center of the bounding box.
1322
+ * @throws Will throw an error if a component with the same UUID already exists.
1280
1323
  *
1281
- * @example
1282
- * '''typescript
1283
- * const boundingBoxer = components.get(BoundingBoxer);
1284
- * boundingBoxer.add(fragmentsGroup);
1285
- * const boundingBoxMesh = boundingBoxer.getMesh();
1286
- * scene.add(boundingBoxMesh);
1287
- * '''
1324
+ * @internal
1288
1325
  */
1289
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1326
+ add(uuid: string, instance: Component): void;
1290
1327
  /**
1291
- * Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
1292
- * This method is used to prepare the BoundingBoxer for a new set of fragments.
1293
- *
1294
- * @remarks
1295
- * This method is called when a new set of fragments is added to the BoundingBoxer.
1296
- * It ensures that the bounding box calculations are accurate and up-to-date.
1328
+ * Retrieves a component instance by its constructor function.
1329
+ * If the component does not exist in the list, it will be created and added.
1297
1330
  *
1298
- * @example
1299
- * '''typescript
1300
- * const boundingBoxer = components.get(BoundingBoxer);
1301
- * boundingBoxer.add(fragmentsGroup);
1302
- * // ...
1303
- * boundingBoxer.reset();
1304
- * '''
1305
- */
1306
- reset(): void;
1307
- /**
1308
- * Adds a FragmentsGroup to the BoundingBoxer.
1331
+ * @template U - The type of the component to retrieve.
1332
+ * @param Component - The constructor function of the component to retrieve.
1309
1333
  *
1310
- * @param group - The FragmentsGroup to add.
1334
+ * @returns The instance of the requested component.
1311
1335
  *
1312
- * @remarks
1313
- * This method iterates through each fragment in the provided FragmentsGroup,
1314
- * and calls the 'addMesh' method for each fragment's mesh.
1336
+ * @throws Will throw an error if a component with the same UUID already exists.
1315
1337
  *
1316
- * @example
1317
- * '''typescript
1318
- * const boundingBoxer = components.get(BoundingBoxer);
1319
- * boundingBoxer.add(fragmentsGroup);
1320
- * '''
1338
+ * @internal
1321
1339
  */
1322
- add(group: FragmentsGroup): void;
1340
+ get<U extends Component>(Component: new (components: Components) => U): U;
1341
+ constructor();
1323
1342
  /**
1324
- * Adds a mesh to the BoundingBoxer and calculates the bounding box.
1325
- *
1326
- * @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
1327
- * @param itemIDs - An optional iterable of numbers representing the item IDs.
1328
- *
1329
- * @remarks
1330
- * This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
1331
- * If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
1332
- * If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
1343
+ * Initializes the Components instance.
1344
+ * This method starts the animation loop, sets the enabled flag to true,
1345
+ * and calls the update method.
1333
1346
  *
1334
- * @example
1335
- * '''typescript
1336
- * const boundingBoxer = components.get(BoundingBoxer);
1337
- * boundingBoxer.addMesh(mesh);
1338
- * '''
1347
+ * @returns {void}
1339
1348
  */
1340
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1349
+ init(): void;
1341
1350
  /**
1342
- * Uses a FragmentIdMap to add its meshes to the bb calculation.
1351
+ * Disposes the memory of all the components and tools of this instance of
1352
+ * the library. A memory leak will be created if:
1343
1353
  *
1344
- * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1345
- * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
1354
+ * - An instance of the library ends up out of scope and this function isn't
1355
+ * called. This is especially relevant in Single Page Applications (React,
1356
+ * Angular, Vue, etc).
1346
1357
  *
1347
- * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
1358
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
1359
+ * referenced by a reference type (object or array).
1348
1360
  *
1349
- * @remarks
1350
- * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1351
- * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
1361
+ * You can learn more about how Three.js handles memory leaks
1362
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1352
1363
  *
1353
- * @example
1354
- * '''typescript
1355
- * const boundingBoxer = components.get(BoundingBoxer);
1356
- * const fragmentIdMap: FRAGS.FragmentIdMap = {
1357
- * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1358
- * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1359
- * };
1360
- * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1361
- * '''
1362
1364
  */
1363
- addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1364
- private static getFragmentBounds;
1365
+ dispose(): void;
1366
+ private update;
1367
+ private static setupBVH;
1365
1368
  }
1366
1369
  import * as THREE from "three";
1367
1370
  import * as FRAGS from "@thatopen/fragments";
@@ -1468,625 +1471,695 @@ export declare class MeasurementUtils extends Component {
1468
1471
  private getVolumeOfMesh;
1469
1472
  private getSignedVolumeOfTriangle;
1470
1473
  }
1471
- import * as THREE from "three";
1472
- import * as FRAGS from "@thatopen/fragments";
1473
- import { Disposable, Component, Event, Components } from "../../core";
1474
- /**
1475
- * 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.
1476
- */
1477
- export interface Classification {
1478
- /**
1479
- * A system within the classification.
1480
- * The key is the system name, and the value is an object representing the classes within the system.
1481
- */
1482
- [system: string]: {
1483
- /**
1484
- * A class within the system.
1485
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1486
- */
1487
- [className: string]: {
1488
- map: FRAGS.FragmentIdMap;
1489
- name: string;
1490
- id: number | null;
1491
- };
1492
- };
1493
- }
1474
+ import { Component, Disposable, World, Event } from "../Types";
1475
+ import { SimpleRaycaster } from "./src";
1476
+ import { Components } from "../Components";
1494
1477
  /**
1495
- * 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).
1478
+ * 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).
1496
1479
  */
1497
- export declare class Classifier extends Component implements Disposable {
1480
+ export declare class Raycasters extends Component implements Disposable {
1498
1481
  /**
1499
1482
  * A unique identifier for the component.
1500
1483
  * This UUID is used to register the component within the Components system.
1501
1484
  */
1502
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1485
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
1503
1486
  /** {@link Component.enabled} */
1504
1487
  enabled: boolean;
1505
1488
  /**
1506
- * A map representing the classification systems.
1507
- * The key is the system name, and the value is an object representing the classes within the system.
1489
+ * A Map that stores raycasters for each world.
1490
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
1508
1491
  */
1509
- list: Classification;
1492
+ list: Map<string, SimpleRaycaster>;
1510
1493
  /** {@link Disposable.onDisposed} */
1511
- readonly onDisposed: Event<unknown>;
1494
+ onDisposed: Event<unknown>;
1512
1495
  constructor(components: Components);
1513
- private onFragmentsDisposed;
1514
- /** {@link Disposable.dispose} */
1515
- dispose(): void;
1516
1496
  /**
1517
- * Removes a fragment from the classification based on its unique identifier (guid).
1518
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1497
+ * Retrieves a SimpleRaycaster instance for the given world.
1498
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
1499
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
1519
1500
  *
1520
- * @param guid - The unique identifier of the fragment to be removed.
1501
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
1502
+ * @returns The SimpleRaycaster instance for the given world.
1521
1503
  */
1522
- remove(guid: string): void;
1504
+ get(world: World): SimpleRaycaster;
1523
1505
  /**
1524
- * Finds and returns fragments based on the provided filter criteria.
1525
- * If no filter is provided, it returns all fragments.
1526
- *
1527
- * @param filter - An optional object containing filter criteria.
1528
- * The keys of the object represent the classification system names,
1529
- * and the values are arrays of class names to match.
1530
- *
1531
- * @returns A map of fragment GUIDs to their respective express IDs,
1532
- * where the express IDs are filtered based on the provided filter criteria.
1506
+ * Deletes the SimpleRaycaster instance associated with the given world.
1507
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
1533
1508
  *
1534
- * @throws Will throw an error if the fragments map is malformed.
1509
+ * @param world - The world for which to delete the SimpleRaycaster instance.
1510
+ * @returns {void}
1535
1511
  */
1536
- find(filter?: {
1537
- [name: string]: string[];
1538
- }): FRAGS.FragmentIdMap;
1512
+ delete(world: World): void;
1513
+ /** {@link Disposable.dispose} */
1514
+ dispose(): void;
1515
+ }
1516
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
1517
+ import { Components } from "../Components";
1518
+ import { SimpleWorld } from "./src";
1519
+ /**
1520
+ * 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).
1521
+ */
1522
+ export declare class Worlds extends Component implements Updateable, Disposable {
1539
1523
  /**
1540
- * Classifies fragments based on their modelID.
1541
- *
1542
- * @param modelID - The unique identifier of the model to classify fragments by.
1543
- * @param group - The FragmentsGroup containing the fragments to be classified.
1544
- *
1545
- * @remarks
1546
- * This method iterates through the fragments in the provided group,
1547
- * and classifies them based on their modelID.
1548
- * The classification is stored in the 'list.models' property,
1549
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1550
- *
1524
+ * A unique identifier for the component.
1525
+ * This UUID is used to register the component within the Components system.
1551
1526
  */
1552
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1527
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
1528
+ /** {@link Updateable.onAfterUpdate} */
1529
+ readonly onAfterUpdate: Event<unknown>;
1530
+ /** {@link Updateable.onBeforeUpdate} */
1531
+ readonly onBeforeUpdate: Event<unknown>;
1532
+ /** {@link Disposable.onDisposed} */
1533
+ readonly onDisposed: Event<unknown>;
1553
1534
  /**
1554
- * Classifies fragments based on their PredefinedType property.
1555
- *
1556
- * @param group - The FragmentsGroup containing the fragments to be classified.
1557
- *
1558
- * @remarks
1559
- * This method iterates through the properties of the fragments in the provided group,
1560
- * and classifies them based on their PredefinedType property.
1561
- * The classification is stored in the 'list.predefinedTypes' property,
1562
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1563
- *
1564
- * @throws Will throw an error if the fragment ID is not found.
1535
+ * An event that is triggered when a new world is created.
1536
+ * The event passes the newly created world as a parameter.
1565
1537
  */
1566
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1538
+ readonly onWorldCreated: Event<World>;
1567
1539
  /**
1568
- * Classifies fragments based on their entity type.
1569
- *
1570
- * @param group - The FragmentsGroup containing the fragments to be classified.
1571
- *
1572
- * @remarks
1573
- * This method iterates through the relations of the fragments in the provided group,
1574
- * and classifies them based on their entity type.
1575
- * The classification is stored in the 'list.entities' property,
1576
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1577
- *
1578
- * @throws Will throw an error if the fragment ID is not found.
1540
+ * An event that is triggered when a world is deleted.
1541
+ * The event passes the UUID of the deleted world as a parameter.
1579
1542
  */
1580
- byEntity(group: FRAGS.FragmentsGroup): void;
1543
+ readonly onWorldDeleted: Event<string>;
1581
1544
  /**
1582
- * Classifies fragments based on a specific IFC relationship.
1583
- *
1584
- * @param group - The FragmentsGroup containing the fragments to be classified.
1585
- * @param ifcRel - The IFC relationship number to classify fragments by.
1586
- * @param systemName - The name of the classification system to store the classification.
1545
+ * A collection of worlds managed by this component.
1546
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
1547
+ */
1548
+ list: Map<string, World>;
1549
+ /** {@link Component.enabled} */
1550
+ enabled: boolean;
1551
+ constructor(components: Components);
1552
+ /**
1553
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
1587
1554
  *
1588
- * @remarks
1589
- * This method iterates through the relations of the fragments in the provided group,
1590
- * and classifies them based on the specified IFC relationship.
1591
- * The classification is stored in the 'list' property under the specified system name,
1592
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1555
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
1556
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
1557
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
1593
1558
  *
1594
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1559
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
1595
1560
  */
1596
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1561
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
1597
1562
  /**
1598
- * Classifies fragments based on their spatial structure in the IFC model.
1563
+ * Deletes a world from the list of worlds.
1599
1564
  *
1600
- * @param model - The FragmentsGroup containing the fragments to be classified.
1601
- * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1602
- * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1603
- * the classifier just pick the WEBIFC categories provided.
1565
+ * @param {World} world - The world to be deleted.
1604
1566
  *
1605
- * @remarks
1606
- * This method iterates through the relations of the fragments in the provided group,
1607
- * and classifies them based on their spatial structure in the IFC model.
1608
- * The classification is stored in the 'list' property under the system name "spatialStructures",
1609
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1567
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
1610
1568
  *
1611
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1569
+ * @returns {void}
1612
1570
  */
1613
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1614
- useProperties?: boolean;
1615
- isolate?: Set<number>;
1616
- }): Promise<void>;
1571
+ delete(world: World): void;
1617
1572
  /**
1618
- * Sets the color of the specified fragments.
1573
+ * Disposes of the Worlds component and all its managed worlds.
1574
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
1575
+ * and triggers the onDisposed event.
1619
1576
  *
1620
- * @param items - A map of fragment IDs to their respective express IDs.
1621
- * @param color - The color to set for the fragments.
1622
- * @param override - A boolean indicating whether to override the existing color of the fragments.
1577
+ * @returns {void}
1578
+ */
1579
+ dispose(): void;
1580
+ /** {@link Updateable.update} */
1581
+ update(delta?: number): void | Promise<void>;
1582
+ }
1583
+ import { Component, Disposable, World, Event } from "../Types";
1584
+ import { GridConfig, SimpleGrid } from "./src";
1585
+ import { Components } from "../Components";
1586
+ /**
1587
+ * 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).
1588
+ */
1589
+ export declare class Grids extends Component implements Disposable {
1590
+ /**
1591
+ * A unique identifier for the component.
1592
+ * This UUID is used to register the component within the Components system.
1593
+ */
1594
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
1595
+ /**
1596
+ * A map of world UUIDs to their corresponding grid instances.
1597
+ */
1598
+ list: Map<string, SimpleGrid>;
1599
+ /**
1600
+ * The default configuration for grid creation.
1601
+ */
1602
+ config: Required<GridConfig>;
1603
+ /** {@link Disposable.onDisposed} */
1604
+ readonly onDisposed: Event<unknown>;
1605
+ /** {@link Component.enabled} */
1606
+ enabled: boolean;
1607
+ constructor(components: Components);
1608
+ /**
1609
+ * Creates a new grid for the given world.
1610
+ * Throws an error if a grid already exists for the world.
1623
1611
  *
1624
- * @remarks
1625
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1626
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
1612
+ * @param world - The world to create the grid for.
1613
+ * @returns The newly created grid.
1627
1614
  *
1628
- * @throws Will throw an error if the fragment with the specified ID is not found.
1615
+ * @throws Will throw an error if a grid already exists for the given world.
1629
1616
  */
1630
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1617
+ create(world: World): SimpleGrid;
1631
1618
  /**
1632
- * Resets the color of the specified fragments to their original color.
1619
+ * Deletes the grid associated with the given world.
1620
+ * If a grid does not exist for the given world, this method does nothing.
1633
1621
  *
1634
- * @param items - A map of fragment IDs to their respective express IDs.
1622
+ * @param world - The world for which to delete the grid.
1635
1623
  *
1636
1624
  * @remarks
1637
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1638
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1639
- *
1640
- * @throws Will throw an error if the fragment with the specified ID is not found.
1625
+ * This method will dispose of the grid and remove it from the internal list.
1626
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
1641
1627
  */
1642
- resetColor(items: FRAGS.FragmentIdMap): void;
1643
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1628
+ delete(world: World): void;
1629
+ /** {@link Disposable.dispose} */
1630
+ dispose(): void;
1644
1631
  }
1645
- import * as WEBIFC from "web-ifc";
1646
- import * as FRAGS from "@thatopen/fragments";
1647
- import { IfcFragmentSettings } from "./src";
1648
- import { Component, Components, Event, Disposable } from "../../core";
1632
+ import * as THREE from "three";
1633
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
1634
+ import { SimplePlane } from "./src";
1635
+ import { Components } from "../Components";
1649
1636
  /**
1650
- * 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).
1637
+ * 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).
1638
+ *
1639
+ * @param components - the instance of {@link Components} used.
1640
+ * E.g. {@link SimplePlane}.
1651
1641
  */
1652
- export declare class IfcLoader extends Component implements Disposable {
1642
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
1653
1643
  /**
1654
1644
  * A unique identifier for the component.
1655
1645
  * This UUID is used to register the component within the Components system.
1656
1646
  */
1657
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1647
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
1648
+ /** Event that fires when the user starts dragging a clipping plane. */
1649
+ readonly onBeforeDrag: Event<void>;
1650
+ /** Event that fires when the user stops dragging a clipping plane. */
1651
+ readonly onAfterDrag: Event<void>;
1652
+ /**
1653
+ * Event that fires when the user starts creating a clipping plane.
1654
+ */
1655
+ readonly onBeforeCreate: Event<unknown>;
1656
+ /**
1657
+ * Event that fires when the user cancels the creation of a clipping plane.
1658
+ */
1659
+ readonly onBeforeCancel: Event<unknown>;
1660
+ /**
1661
+ * Event that fires after the user cancels the creation of a clipping plane.
1662
+ */
1663
+ readonly onAfterCancel: Event<unknown>;
1664
+ /**
1665
+ * Event that fires when the user starts deleting a clipping plane.
1666
+ */
1667
+ readonly onBeforeDelete: Event<unknown>;
1668
+ /**
1669
+ * Event that fires after a clipping plane has been created.
1670
+ * @param plane - The newly created clipping plane.
1671
+ */
1672
+ readonly onAfterCreate: Event<SimplePlane>;
1673
+ /**
1674
+ * Event that fires after a clipping plane has been deleted.
1675
+ * @param plane - The deleted clipping plane.
1676
+ */
1677
+ readonly onAfterDelete: Event<SimplePlane>;
1658
1678
  /** {@link Disposable.onDisposed} */
1659
1679
  readonly onDisposed: Event<string>;
1660
1680
  /**
1661
- * An event triggered when the IFC file starts loading.
1681
+ * Whether to force the clipping plane to be orthogonal in the Y direction
1682
+ * (up). This is desirable when clipping a building horizontally and a
1683
+ * clipping plane is created in its roof, which might have a slight
1684
+ * slope for draining purposes.
1662
1685
  */
1663
- readonly onIfcStartedLoading: Event<void>;
1686
+ orthogonalY: boolean;
1664
1687
  /**
1665
- * An event triggered when the setup process is completed.
1688
+ * The tolerance that determines whether an almost-horizontal clipping plane
1689
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
1690
+ * has to be 'true' for this to apply.
1666
1691
  */
1667
- readonly onSetup: Event<void>;
1692
+ toleranceOrthogonalY: number;
1668
1693
  /**
1669
- * The settings for the IfcLoader.
1670
- * It includes options for excluding categories, setting WASM paths, and more.
1694
+ * The type of clipping plane to be created.
1695
+ * Default is {@link SimplePlane}.
1671
1696
  */
1672
- settings: IfcFragmentSettings;
1697
+ Type: new (...args: any) => SimplePlane;
1673
1698
  /**
1674
- * The instance of the Web-IFC library used for handling IFC data.
1699
+ * A list of all the clipping planes created by this component.
1675
1700
  */
1676
- webIfc: WEBIFC.IfcAPI;
1677
- /** {@link Component.enabled} */
1678
- enabled: boolean;
1701
+ list: SimplePlane[];
1702
+ /** The material used in all the clipping planes. */
1679
1703
  private _material;
1680
- private _spatialTree;
1681
- private _metaData;
1682
- private _fragmentInstances;
1683
- private _civil;
1684
- private _visitedFragments;
1685
- private _materialT;
1704
+ private _size;
1705
+ private _enabled;
1706
+ private _visible;
1707
+ /** {@link Component.enabled} */
1708
+ get enabled(): boolean;
1709
+ /** {@link Component.enabled} */
1710
+ set enabled(state: boolean);
1711
+ /** {@link Hideable.visible } */
1712
+ get visible(): boolean;
1713
+ /** {@link Hideable.visible } */
1714
+ set visible(state: boolean);
1715
+ /** The material of the clipping plane representation. */
1716
+ get material(): THREE.MeshBasicMaterial;
1717
+ /** The material of the clipping plane representation. */
1718
+ set material(material: THREE.MeshBasicMaterial);
1719
+ /** The size of the geometric representation of the clippings planes. */
1720
+ get size(): number;
1721
+ /** The size of the geometric representation of the clippings planes. */
1722
+ set size(size: number);
1686
1723
  constructor(components: Components);
1687
1724
  /** {@link Disposable.dispose} */
1688
1725
  dispose(): void;
1726
+ /** {@link Createable.create} */
1727
+ create(world: World): SimplePlane | null;
1689
1728
  /**
1690
- * Sets up the IfcLoader component with the provided configuration.
1691
- *
1692
- * @param config - Optional configuration settings for the IfcLoader.
1693
- * If not provided, the existing settings will be used.
1694
- *
1695
- * @returns A Promise that resolves when the setup process is completed.
1696
- *
1697
- * @remarks
1698
- * If the 'autoSetWasm' option is enabled in the configuration,
1699
- * the method will automatically set the WASM paths for the Web-IFC library.
1700
- *
1701
- * @example
1702
- * '''typescript
1703
- * const ifcLoader = new IfcLoader(components);
1704
- * await ifcLoader.setup({ autoSetWasm: true });
1705
- * '''
1706
- */
1707
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1708
- /**
1709
- * Loads an IFC file and processes it for 3D visualization.
1710
- *
1711
- * @param data - The Uint8Array containing the IFC file data.
1712
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1713
- *
1714
- * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1715
- *
1716
- * @example
1717
- * '''typescript
1718
- * const ifcLoader = components.get(IfcLoader);
1719
- * const group = await ifcLoader.load(ifcData);
1720
- * '''
1721
- */
1722
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1723
- /**
1724
- * Reads an IFC file and initializes the Web-IFC library.
1725
- *
1726
- * @param data - The Uint8Array containing the IFC file data.
1727
- *
1728
- * @returns A Promise that resolves when the IFC file is opened and initialized.
1729
- *
1730
- * @remarks
1731
- * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1732
- * It also opens the IFC model using the provided data and settings.
1729
+ * Creates a plane in a certain place and with a certain orientation,
1730
+ * without the need of the mouse.
1733
1731
  *
1734
- * @example
1735
- * '''typescript
1736
- * const ifcLoader = components.get(IfcLoader);
1737
- * await ifcLoader.readIfcFile(ifcData);
1738
- * '''
1732
+ * @param world - the world where this plane should be created.
1733
+ * @param normal - the orientation of the clipping plane.
1734
+ * @param point - the position of the clipping plane.
1735
+ * navigation.
1739
1736
  */
1740
- readIfcFile(data: Uint8Array): Promise<number>;
1737
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
1741
1738
  /**
1742
- * Cleans up the IfcLoader component by resetting the Web-IFC library,
1743
- * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1739
+ * {@link Createable.delete}
1744
1740
  *
1745
- * @remarks
1746
- * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1741
+ * @param world - the world where the plane to delete is.
1742
+ * @param plane - the plane to delete. If undefined, the first plane
1743
+ * found under the cursor will be deleted.
1744
+ */
1745
+ delete(world: World, plane?: SimplePlane): void;
1746
+ /**
1747
+ * Deletes all the existing clipping planes.
1747
1748
  *
1748
- * @example
1749
- * '''typescript
1750
- * const ifcLoader = components.get(IfcLoader);
1751
- * ifcLoader.cleanUp();
1752
- * '''
1749
+ * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
1753
1750
  */
1754
- cleanUp(): void;
1755
- private getAllGeometries;
1756
- private getMesh;
1757
- private getGeometry;
1758
- private autoSetWasm;
1751
+ deleteAll(types?: Set<string>): void;
1752
+ private deletePlane;
1753
+ private pickPlane;
1754
+ private getAllPlaneMeshes;
1755
+ private createPlaneFromIntersection;
1756
+ private getWorldNormal;
1757
+ private normalizePlaneDirectionY;
1758
+ private newPlane;
1759
+ private updateMaterialsAndPlanes;
1760
+ private _onStartDragging;
1761
+ private _onEndDragging;
1759
1762
  }
1760
- import * as FRAGS from "@thatopen/fragments";
1761
- import { Components, Component } from "../../core";
1763
+ import * as THREE from "three";
1764
+ import { Components } from "../Components";
1765
+ import { Component } from "../Types";
1762
1766
  /**
1763
- * 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).
1767
+ * 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).
1764
1768
  */
1765
- export declare class Hider extends Component {
1769
+ export declare class Disposer extends Component {
1770
+ private _disposedComponents;
1771
+ /** {@link Component.enabled} */
1772
+ enabled: boolean;
1766
1773
  /**
1767
1774
  * A unique identifier for the component.
1768
1775
  * This UUID is used to register the component within the Components system.
1769
1776
  */
1770
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1771
- /** {@link Component.enabled} */
1772
- enabled: boolean;
1777
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
1773
1778
  constructor(components: Components);
1774
1779
  /**
1775
- * Sets the visibility of fragments within the 3D scene.
1776
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1777
- * If 'items' is provided, only the specified fragments will be affected.
1780
+ * Return the UUIDs of all disposed components.
1781
+ */
1782
+ get(): Set<string>;
1783
+ /**
1784
+ * Removes a mesh, its geometry and its materials from memory. If you are
1785
+ * using any of these in other parts of the application, make sure that you
1786
+ * remove them from the mesh before disposing it.
1778
1787
  *
1779
- * @param visible - The visibility state to set for the fragments.
1780
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1781
- * If not provided, all fragments will be affected.
1788
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
1789
+ * to remove.
1782
1790
  *
1783
- * @returns {void}
1791
+ * @param materials - whether to dispose the materials of the mesh.
1792
+ *
1793
+ * @param recursive - whether to recursively dispose the children of the mesh.
1784
1794
  */
1785
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1795
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
1786
1796
  /**
1787
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1788
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1789
- *
1790
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1791
- * If not provided, all fragments will be isolated.
1797
+ * Disposes a geometry from memory.
1792
1798
  *
1793
- * @returns {void}
1799
+ * @param geometry - the
1800
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
1801
+ * to remove.
1794
1802
  */
1795
- isolate(items: FRAGS.FragmentIdMap): void;
1796
- private updateCulledVisibility;
1803
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
1804
+ private disposeGeometryAndMaterials;
1805
+ private disposeChildren;
1806
+ private static disposeMaterial;
1797
1807
  }
1798
- import { Component, Disposable, Event, Components } from "../../core";
1808
+ import * as THREE from "three";
1809
+ import { Components } from "../Components";
1810
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
1811
+ import { Component, Event, Disposable, World } from "../Types";
1799
1812
  /**
1800
- * 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).
1813
+ * 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).
1801
1814
  */
1802
- export declare class Exploder extends Component implements Disposable {
1815
+ export declare class Cullers extends Component implements Disposable {
1803
1816
  /**
1804
1817
  * A unique identifier for the component.
1805
1818
  * This UUID is used to register the component within the Components system.
1806
1819
  */
1807
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1808
- /** {@link Disposable.onDisposed} */
1820
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
1821
+ /**
1822
+ * An event that is triggered when the Cullers component is disposed.
1823
+ */
1809
1824
  readonly onDisposed: Event<unknown>;
1810
- /** {@link Component.enabled} */
1811
- enabled: boolean;
1825
+ private _enabled;
1812
1826
  /**
1813
- * The height of the explosion animation.
1814
- * This property determines the vertical distance by which fragments are moved during the explosion.
1815
- * Default value is 10.
1827
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
1816
1828
  */
1817
- height: number;
1829
+ list: Map<string, MeshCullerRenderer>;
1830
+ /** {@link Component.enabled} */
1831
+ get enabled(): boolean;
1832
+ /** {@link Component.enabled} */
1833
+ set enabled(value: boolean);
1834
+ constructor(components: Components);
1818
1835
  /**
1819
- * The group name used for the explosion animation.
1820
- * This property specifies the group of fragments that will be affected by the explosion.
1821
- * Default value is "storeys".
1836
+ * Creates a new MeshCullerRenderer for the given world.
1837
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
1838
+ *
1839
+ * @param world - The world for which to create the MeshCullerRenderer.
1840
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
1841
+ *
1842
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
1822
1843
  */
1823
- groupName: string;
1844
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
1824
1845
  /**
1825
- * A set of strings representing the exploded items.
1826
- * This set is used to keep track of which items have been exploded.
1846
+ * Deletes the MeshCullerRenderer associated with the given world.
1847
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
1848
+ *
1849
+ * @param world - The world for which to delete the MeshCullerRenderer.
1850
+ *
1851
+ * @returns {void}
1827
1852
  */
1828
- list: Set<string>;
1829
- constructor(components: Components);
1853
+ delete(world: World): void;
1830
1854
  /** {@link Disposable.dispose} */
1831
1855
  dispose(): void;
1832
1856
  /**
1833
- * Sets the explosion state of the fragments.
1834
- *
1835
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1836
- *
1837
- * @remarks
1838
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1839
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1840
- * If 'active' is false, the fragments are moved back to their original position.
1857
+ * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
1841
1858
  *
1842
- * The method also keeps track of the exploded items using the 'list' set.
1859
+ * @param meshes - The meshes to update.
1843
1860
  *
1844
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1861
+ * @returns {void}
1845
1862
  */
1846
- set(active: boolean): void;
1863
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
1847
1864
  }
1848
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1849
- import * as THREE from "three";
1850
- import * as FRAGS from "@thatopen/fragments";
1851
- import { Component, Components, Event, Disposable } from "../../core";
1852
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1865
+ import * as WEBIFC from "web-ifc";
1866
+ import { FragmentsGroup } from "@thatopen/fragments";
1867
+ import { Disposable, Event, Component, Components } from "../../core";
1868
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1869
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1853
1870
  /**
1854
- * 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).
1871
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1855
1872
  */
1856
- export declare class FragmentsManager extends Component implements Disposable {
1873
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1857
1874
  /**
1858
1875
  * A unique identifier for the component.
1859
1876
  * This UUID is used to register the component within the Components system.
1860
1877
  */
1861
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1878
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1862
1879
  /** {@link Disposable.onDisposed} */
1863
- readonly onDisposed: Event<unknown>;
1880
+ readonly onDisposed: Event<string>;
1864
1881
  /**
1865
- * Event triggered when fragments are loaded.
1882
+ * Event triggered when relations for a model have been indexed.
1883
+ * This event provides the model's UUID and the relations map generated for that model.
1884
+ *
1885
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
1886
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1887
+ * 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.
1866
1888
  */
1867
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
1889
+ readonly onRelationsIndexed: Event<{
1890
+ modelID: string;
1891
+ relationsMap: RelationsMap;
1892
+ }>;
1868
1893
  /**
1869
- * Event triggered when fragments are disposed.
1894
+ * Holds the relationship mappings for each model processed by the indexer.
1895
+ * The structure is a map where each key is a model's UUID, and the value is another map.
1896
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1897
+ * representing a specific relation type, and the value is an array of expressIDs of entities
1898
+ * that are related through that relation type. This structure allows for efficient querying
1899
+ * of entity relationships within a model.
1870
1900
  */
1871
- readonly onFragmentsDisposed: Event<{
1872
- groupID: string;
1873
- fragmentIDs: string[];
1874
- }>;
1901
+ readonly relationMaps: ModelsRelationMap;
1902
+ /** {@link Component.enabled} */
1903
+ enabled: boolean;
1904
+ private _relToAttributesMap;
1905
+ private _inverseAttributes;
1906
+ private _ifcRels;
1907
+ constructor(components: Components);
1908
+ private onFragmentsDisposed;
1909
+ private indexRelations;
1910
+ private getAttributeIndex;
1875
1911
  /**
1876
- * Map containing all loaded fragments.
1877
- * The key is the fragment's unique identifier, and the value is the fragment itself.
1912
+ * Adds a relation map to the model's relations map.
1913
+ *
1914
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1915
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1916
+ *
1917
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1878
1918
  */
1879
- readonly list: Map<string, Fragment>;
1919
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1880
1920
  /**
1881
- * Map containing all loaded fragment groups.
1882
- * The key is the group's unique identifier, and the value is the group itself.
1921
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1922
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1923
+ * and maps them in a structured way to facilitate quick access to related entities.
1924
+ *
1925
+ * The process involves querying the model for each relation type associated with the inverse attributes
1926
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1927
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
1928
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1929
+ * of entities that are related through that attribute.
1930
+ *
1931
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1932
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1933
+ * representation of the relations indexed by entity expressIDs and relation types.
1934
+ * @throws An error if the model does not have properties loaded.
1883
1935
  */
1884
- readonly groups: Map<string, FragmentsGroup>;
1885
- baseCoordinationModel: string;
1886
- baseCoordinationMatrix: THREE.Matrix4;
1887
- /** {@link Component.enabled} */
1888
- enabled: boolean;
1889
- private _loader;
1936
+ process(model: FragmentsGroup): Promise<RelationsMap>;
1890
1937
  /**
1891
- * Getter for the meshes of all fragments in the FragmentsManager.
1892
- * It iterates over the fragments in the list and pushes their meshes into an array.
1893
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1938
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
1939
+ *
1940
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1941
+ * @param modelID - The unique identifier of the model within the WebIfc API.
1942
+ * @returns A promise that resolves to the relations map for the processed model.
1943
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1894
1944
  */
1895
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1896
- constructor(components: Components);
1897
- /** {@link Disposable.dispose} */
1898
- dispose(): void;
1945
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1899
1946
  /**
1900
- * Dispose of a specific fragment group.
1901
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
1902
- * disposes of the group, and triggers the onFragmentsDisposed event.
1947
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
1948
+ * This method searches the indexed relation maps for the specified model and entity,
1949
+ * returning the IDs of related entities if a match is found.
1903
1950
  *
1904
- * @param group - The fragment group to be disposed.
1951
+ * @param model The 'FragmentsGroup' model containing the entity.
1952
+ * @param expressID The unique identifier of the entity within the model.
1953
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1954
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1955
+ * or the specified relation name is not indexed.
1905
1956
  */
1906
- disposeGroup(group: FragmentsGroup): void;
1957
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1907
1958
  /**
1908
- * Loads a binary file that contain fragment geometry.
1909
- * @param data - The binary data to load.
1910
- * @param config - Optional configuration for loading.
1911
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1912
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1913
- * @returns The loaded FragmentsGroup.
1959
+ * Serializes the relations of a given relation map into a JSON string.
1960
+ * 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,
1961
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1962
+ * The resulting object is then serialized into a JSON string.
1963
+ *
1964
+ * @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.
1965
+ * @returns A JSON string representing the serialized relations of the given relation map.
1914
1966
  */
1915
- load(data: Uint8Array, config?: Partial<{
1916
- coordinate: boolean;
1917
- name: string;
1918
- properties: FRAGS.IfcProperties;
1919
- relationsMap: RelationsMap;
1920
- }>): FragmentsGroup;
1967
+ serializeRelations(relationMap: RelationsMap): string;
1921
1968
  /**
1922
- * Export the specified fragmentsgroup to binary data.
1923
- * @param group - the fragments group to be exported.
1924
- * @returns the exported data as binary buffer.
1969
+ * Serializes the relations of a specific model into a JSON string.
1970
+ * This method iterates through the relations indexed for the given model,
1971
+ * organizing them into a structured object where each key is an expressID of an entity,
1972
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1973
+ * The resulting object is then serialized into a JSON string.
1974
+ *
1975
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1976
+ * @returns A JSON string representing the serialized relations of the specified model.
1977
+ * If the model has no indexed relations, 'null' is returned.
1925
1978
  */
1926
- export(group: FragmentsGroup): Uint8Array;
1979
+ serializeModelRelations(model: FragmentsGroup): string | null;
1927
1980
  /**
1928
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1929
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1930
- * @returns A map of model IDs to sets of express IDs.
1981
+ * Serializes all relations of every model processed by the indexer into a JSON string.
1982
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1983
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1984
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
1985
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
1986
+ *
1987
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1988
+ * If no relations have been indexed, an empty object is returned as a JSON string.
1931
1989
  */
1932
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1933
- [modelID: string]: Set<number>;
1934
- };
1990
+ serializeAllRelations(): string;
1935
1991
  /**
1936
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1937
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1938
- * @returns A fragment ID map.
1939
- * @remarks
1940
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1941
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1942
- * The fragment ID maps are then merged into a single map and returned.
1943
- * 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.
1992
+ * Converts a JSON string representing relations between entities into a structured map.
1993
+ * This method parses the JSON string to reconstruct the relations map that indexes
1994
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1995
+ * and the values are maps where each key is a relation type ID and its value is an array
1996
+ * of express IDs of entities related through that relation type.
1997
+ *
1998
+ * @param json The JSON string to be parsed into the relations map.
1999
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
2000
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
2001
+ * is an array of express IDs (as numbers) of entities related through that relation type.
1944
2002
  */
1945
- modelIdToFragmentIdMap(modelIdMap: {
1946
- [modelID: string]: Set<number>;
1947
- }): FRAGS.FragmentIdMap;
2003
+ getRelationsMapFromJSON(json: string): RelationsMap;
2004
+ /** {@link Disposable.dispose} */
2005
+ dispose(): void;
1948
2006
  /**
1949
- * Applies coordinate transformation to the provided models.
1950
- * If no models are provided, all groups are used.
1951
- * The first model in the list becomes the base model for coordinate transformation.
1952
- * All other models are then transformed to match the base model's coordinate system.
2007
+ * Adds relations between an entity and other entities in a BIM model.
1953
2008
  *
1954
- * @param models - The models to apply coordinate transformation to.
1955
- * If not provided, all models are used.
2009
+ * @param model - The BIM model to which the relations will be added.
2010
+ * @param expressID - The expressID of the entity within the model.
2011
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
2012
+ * @param relIDs - The expressIDs of the related entities within the model.
2013
+ *
2014
+ * @throws An error if the relation name is not a valid relation name.
1956
2015
  */
1957
- coordinate(models?: FragmentsGroup[]): void;
2016
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1958
2017
  /**
1959
- * Applies the base coordinate system to the provided object.
1960
- *
1961
- * This function takes an object and its original coordinate system as input.
1962
- * It then inverts the original coordinate system and applies the base coordinate system
1963
- * to the object. This ensures that the object's position, rotation, and scale are
1964
- * transformed to match the base coordinate system (which is taken from the first model loaded).
2018
+ * 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.
1965
2019
  *
1966
- * @param object - The object to which the base coordinate system will be applied.
1967
- * This should be an instance of THREE.Object3D.
2020
+ * @param model The BIM model whose children to get.
2021
+ * @param expressID The expressID of the item whose children to get.
2022
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1968
2023
  *
1969
- * @param originalCoordinateSystem - The original coordinate system of the object.
1970
- * This should be a THREE.Matrix4 representing the object's transformation matrix.
2024
+ * @returns A 'Set' with the expressIDs of the found items.
1971
2025
  */
1972
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1973
- }
1974
- import * as WEBIFC from "web-ifc";
1975
- export interface IfcItemsCategories {
1976
- [itemID: number]: number;
1977
- }
1978
- export declare class IfcCategories {
1979
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2026
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1980
2027
  }
2028
+ import { MiniMap } from "./src";
2029
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
2030
+ import { Components } from "../Components";
1981
2031
  /**
1982
- * 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.
1983
- *
1984
- * @remarks
1985
- * This map is used to provide a mapping between IFC entity type numbers and their names.
1986
- * It is useful for identifying and processing different types of IFC elements in a project.
1987
- *
1988
- */
1989
- export declare const IfcElements: {
1990
- [key: number]: string;
1991
- };
1992
- import * as WEBIFC from "web-ifc";
1993
- import { Components, Disposable, Event, Component } from "../../core";
1994
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1995
- /**
1996
- * 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).
2032
+ * 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).
1997
2033
  */
1998
- export declare class IfcGeometryTiler extends Component implements Disposable {
2034
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
1999
2035
  /**
2000
2036
  * A unique identifier for the component.
2001
2037
  * This UUID is used to register the component within the Components system.
2002
2038
  */
2003
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
2039
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
2040
+ /** {@link Updateable.onAfterUpdate} */
2041
+ readonly onAfterUpdate: Event<unknown>;
2042
+ /** {@link Updateable.onBeforeUpdate} */
2043
+ readonly onBeforeUpdate: Event<unknown>;
2044
+ /** {@link Disposable.onDisposed} */
2045
+ readonly onDisposed: Event<unknown>;
2046
+ /** {@link Component.enabled} */
2047
+ enabled: boolean;
2004
2048
  /**
2005
- * Event triggered when geometry is streamed.
2006
- * Contains the streamed geometry data and its buffer.
2049
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
2007
2050
  */
2008
- readonly onGeometryStreamed: Event<{
2009
- buffer: Uint8Array;
2010
- data: StreamedGeometries;
2011
- }>;
2051
+ list: Map<string, MiniMap>;
2052
+ constructor(components: Components);
2012
2053
  /**
2013
- * Event triggered when assets are streamed.
2014
- * Contains the streamed assets.
2054
+ * Creates a new {@link MiniMap} instance associated with the given world.
2055
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
2056
+ *
2057
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
2058
+ * @returns The newly created {@link MiniMap} instance.
2059
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
2015
2060
  */
2016
- readonly onAssetStreamed: Event<StreamedAsset[]>;
2061
+ create(world: World): MiniMap;
2017
2062
  /**
2018
- * Event triggered to indicate the progress of the streaming process.
2019
- * Contains the progress percentage.
2063
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
2064
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
2065
+ *
2066
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
2067
+ * @returns {void}
2020
2068
  */
2021
- readonly onProgress: Event<number>;
2069
+ delete(id: string): void;
2070
+ /** {@link Disposable.dispose} */
2071
+ dispose(): void;
2072
+ /** {@link Updateable.update} */
2073
+ update(): void;
2074
+ }
2075
+ import * as THREE from "three";
2076
+ import { Components } from "../Components";
2077
+ import { SimpleCamera } from "..";
2078
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
2079
+ /**
2080
+ * 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).
2081
+ */
2082
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
2022
2083
  /**
2023
- * Event triggered when the IFC file is loaded.
2024
- * Contains the loaded IFC file data.
2084
+ * A ProjectionManager instance that manages the projection modes of the camera.
2025
2085
  */
2026
- readonly onIfcLoaded: Event<Uint8Array>;
2027
- /** {@link Disposable.onDisposed} */
2028
- readonly onDisposed: Event<unknown>;
2086
+ readonly projection: ProjectionManager;
2029
2087
  /**
2030
- * Settings for the IfcGeometryTiler.
2088
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
2089
+ * This camera is used when the projection mode is set to orthographic.
2031
2090
  */
2032
- settings: IfcStreamingSettings;
2033
- /** {@link Component.enabled} */
2034
- enabled: boolean;
2091
+ readonly threeOrtho: THREE.OrthographicCamera;
2035
2092
  /**
2036
- * The WebIFC API instance used for IFC file processing.
2093
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
2094
+ * This camera is used when the projection mode is set to perspective.
2037
2095
  */
2038
- webIfc: WEBIFC.IfcAPI;
2039
- private _spatialTree;
2040
- private _metaData;
2041
- private _visitedGeometries;
2042
- private _streamSerializer;
2043
- private _geometries;
2044
- private _geometryCount;
2045
- private _civil;
2046
- private _groupSerializer;
2047
- private _assets;
2048
- private _meshesWithHoles;
2096
+ readonly threePersp: THREE.PerspectiveCamera;
2097
+ protected readonly _userInputButtons: any;
2098
+ protected readonly _frustumSize = 50;
2099
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
2100
+ protected _mode: NavigationMode | null;
2101
+ private previousSize;
2102
+ /**
2103
+ * Getter for the current navigation mode.
2104
+ * Throws an error if the mode is not found or the camera is not initialized.
2105
+ *
2106
+ * @returns {NavigationMode} The current navigation mode.
2107
+ *
2108
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
2109
+ */
2110
+ get mode(): NavigationMode;
2049
2111
  constructor(components: Components);
2050
2112
  /** {@link Disposable.dispose} */
2051
2113
  dispose(): void;
2052
2114
  /**
2053
- * This method streams the IFC file from a given buffer.
2054
- *
2055
- * @param data - The Uint8Array containing the IFC file data.
2056
- * @returns A Promise that resolves when the streaming process is complete.
2057
- *
2058
- * @remarks
2059
- * This method cleans up any resources after the streaming process is complete.
2115
+ * Sets a new {@link NavigationMode} and disables the previous one.
2060
2116
  *
2061
- * @example
2062
- * '''typescript
2063
- * const ifcData = await fetch('path/to/ifc/file.ifc');
2064
- * const rawBuffer = await response.arrayBuffer();
2065
- * const ifcBuffer = new Uint8Array(rawBuffer);
2066
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
2067
- * '''
2117
+ * @param mode - The {@link NavigationMode} to set.
2068
2118
  */
2069
- streamFromBuffer(data: Uint8Array): Promise<void>;
2119
+ set(mode: NavModeID): void;
2070
2120
  /**
2071
- * This method streams the IFC file from a given callback.
2072
- *
2073
- * @param loadCallback - The callback function that will be used to load the IFC file.
2074
- * @returns A Promise that resolves when the streaming process is complete.
2121
+ * Make the camera view fit all the specified meshes.
2075
2122
  *
2076
- * @remarks
2077
- * This method cleans up any resources after the streaming process is complete.
2123
+ * @param meshes the meshes to fit. If it is not defined, it will
2124
+ * evaluate {@link Components.meshes}.
2125
+ * @param offset the distance to the fit object
2126
+ */
2127
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
2128
+ /**
2129
+ * Allows or prevents all user input.
2078
2130
  *
2131
+ * @param active - whether to enable or disable user inputs.
2079
2132
  */
2080
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2081
- private readIfcFile;
2082
- private streamIfcFile;
2083
- private streamAllGeometries;
2084
- private cleanUp;
2085
- private getMesh;
2086
- private getGeometry;
2087
- private streamAssets;
2088
- private streamGeometries;
2133
+ setUserInput(active: boolean): void;
2134
+ private disableUserInput;
2135
+ private enableUserInput;
2136
+ private newOrthoCamera;
2137
+ private setOrthoPerspCameraAspect;
2138
+ }
2139
+ import * as FRAGS from "@thatopen/fragments";
2140
+ import * as WEBIFC from "web-ifc";
2141
+ export declare class SpatialIdsFinder {
2142
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2143
+ }
2144
+ import * as WEBIFC from "web-ifc";
2145
+ import { IfcItemsCategories } from "../../../ifc";
2146
+ export declare class SpatialStructure {
2147
+ itemsByFloor: IfcItemsCategories;
2148
+ private _units;
2149
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2150
+ cleanUp(): void;
2089
2151
  }
2152
+ /**
2153
+ * 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.
2154
+ *
2155
+ * @remarks
2156
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2157
+ * It is useful for identifying and processing different types of IFC elements in a project.
2158
+ *
2159
+ */
2160
+ export declare const IfcElements: {
2161
+ [key: number]: string;
2162
+ };
2090
2163
  /**
2091
2164
  * 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.
2092
2165
  */
@@ -2119,70 +2192,62 @@ export declare class IfcPropertiesUtils {
2119
2192
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2120
2193
  }
2121
2194
  import * as WEBIFC from "web-ifc";
2122
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
2123
- import { PropertiesStreamingSettings } from "./src";
2124
- /**
2125
- * 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).
2126
- */
2127
- export declare class IfcPropertiesTiler extends Component implements Disposable {
2128
- /**
2129
- * A unique identifier for the component.
2130
- * This UUID is used to register the component within the Components system.
2131
- */
2132
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
2133
- /**
2134
- * An event that is triggered when properties are streamed from the IFC file.
2135
- * The event provides the type of the IFC entity and the corresponding data.
2136
- */
2137
- readonly onPropertiesStreamed: AsyncEvent<{
2138
- type: number;
2139
- data: {
2140
- [id: number]: any;
2141
- };
2142
- }>;
2143
- /**
2144
- * An event that is triggered to indicate the progress of the streaming process.
2145
- * The event provides a number between 0 and 1 representing the progress percentage.
2146
- */
2147
- readonly onProgress: AsyncEvent<number>;
2148
- /**
2149
- * An event that is triggered when indices are streamed from the IFC file.
2150
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
2151
- */
2152
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
2153
- /** {@link Disposable.onDisposed} */
2154
- readonly onDisposed: Event<string>;
2155
- /** {@link Component.enabled} */
2156
- enabled: boolean;
2157
- /**
2158
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
2159
- */
2160
- settings: PropertiesStreamingSettings;
2195
+ /** Configuration of the IFC-fragment conversion. */
2196
+ export declare class IfcFragmentSettings {
2197
+ /** Whether to extract the IFC properties into a JSON. */
2198
+ includeProperties: boolean;
2161
2199
  /**
2162
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
2200
+ * Generate the geometry for categories that are not included by default,
2201
+ * like IFCSPACE.
2163
2202
  */
2164
- webIfc: WEBIFC.IfcAPI;
2165
- /** {@link Disposable.dispose} */
2166
- dispose(): Promise<void>;
2203
+ optionalCategories: number[];
2204
+ /** Whether to use the coordination data coming from the IFC files. */
2205
+ coordinate: boolean;
2206
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2207
+ wasm: {
2208
+ path: string;
2209
+ absolute: boolean;
2210
+ logLevel?: WEBIFC.LogLevel;
2211
+ };
2212
+ /** List of categories that won't be converted to fragments. */
2213
+ excludedCategories: Set<number>;
2214
+ /** Whether to save the absolute location of all IFC items. */
2215
+ saveLocations: boolean;
2216
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2217
+ webIfc: WEBIFC.LoaderSettings;
2167
2218
  /**
2168
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
2169
- *
2170
- * @param data - The Uint8Array containing the IFC file data.
2171
- * @returns A Promise that resolves when the streaming process is complete.
2219
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2220
+ * If set to true, the path will be set to the default path of the WASM file.
2221
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2222
+ * Default value is true.
2172
2223
  */
2173
- streamFromBuffer(data: Uint8Array): Promise<void>;
2224
+ autoSetWasm: boolean;
2174
2225
  /**
2175
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2226
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2227
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2228
+ * If set to null, the default file location handler will be used.
2176
2229
  *
2177
- * @param loadCallback - A callback function that loads the IFC file data.
2178
- * @returns A Promise that resolves when the streaming process is complete.
2230
+ * @param url - The URL of the file to locate.
2231
+ * @returns The absolute path of the file.
2179
2232
  */
2180
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2181
- private readIfcFile;
2182
- private streamIfcFile;
2183
- private streamAllProperties;
2184
- private cleanUp;
2233
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2234
+ }
2235
+ import * as WEBIFC from "web-ifc";
2236
+ export interface IfcItemsCategories {
2237
+ [itemID: number]: number;
2238
+ }
2239
+ export declare class IfcCategories {
2240
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2185
2241
  }
2242
+ /**
2243
+ * A Set of unique numbers representing different types of IFC geometries.
2244
+ */
2245
+ export declare const GeometryTypes: Set<number>;
2246
+ import { InverseAttribute } from "./types";
2247
+ export declare const relToAttributesMap: Map<number, {
2248
+ forRelating: InverseAttribute;
2249
+ forRelated: InverseAttribute;
2250
+ }>;
2186
2251
  import * as THREE from "three";
2187
2252
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2188
2253
  /**
@@ -2248,66 +2313,190 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2248
2313
  */
2249
2314
  set lockRotation(active: boolean);
2250
2315
  /**
2251
- * Gets the current zoom level of the minimap.
2252
- * The zoom level determines how much of the world is visible on the minimap.
2253
- * @returns The current zoom level of the minimap.
2316
+ * Gets the current zoom level of the minimap.
2317
+ * The zoom level determines how much of the world is visible on the minimap.
2318
+ * @returns The current zoom level of the minimap.
2319
+ */
2320
+ get zoom(): number;
2321
+ /**
2322
+ * Sets the zoom level of the minimap.
2323
+ * The zoom level determines how much of the world is visible on the minimap.
2324
+ * @param value - The new zoom level of the minimap.
2325
+ */
2326
+ set zoom(value: number);
2327
+ constructor(world: World);
2328
+ /** {@link Disposable.dispose} */
2329
+ dispose(): void;
2330
+ /** Returns the camera used by the MiniMap */
2331
+ get(): THREE.OrthographicCamera;
2332
+ /** {@link Updateable.update} */
2333
+ update(): void;
2334
+ /** {@link Resizeable.getSize} */
2335
+ getSize(): THREE.Vector2;
2336
+ /** {@link Resizeable.resize} */
2337
+ resize(size?: THREE.Vector2): void;
2338
+ private updatePlanes;
2339
+ }
2340
+ import * as THREE from "three";
2341
+ import * as WEBIFC from "web-ifc";
2342
+ import * as FRAGS from "@thatopen/fragments";
2343
+ export declare class CivilReader {
2344
+ defLineMat: THREE.LineBasicMaterial;
2345
+ read(webIfc: WEBIFC.IfcAPI): {
2346
+ alignments: Map<number, FRAGS.Alignment>;
2347
+ coordinationMatrix: THREE.Matrix4;
2348
+ } | undefined;
2349
+ get(civilItems: any): {
2350
+ alignments: Map<number, FRAGS.Alignment>;
2351
+ coordinationMatrix: THREE.Matrix4;
2352
+ } | undefined;
2353
+ private getCurves;
2354
+ }
2355
+ import * as WEBIFC from "web-ifc";
2356
+ export declare class IfcMetadataReader {
2357
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2358
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2359
+ }
2360
+ /**
2361
+ * 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.
2362
+ */
2363
+ export interface StreamedGeometries {
2364
+ [id: number]: {
2365
+ /** The bounding box of the geometry as a Float32Array. */
2366
+ boundingBox: Float32Array;
2367
+ /** A boolean indicating whether the geometry has holes. */
2368
+ hasHoles: boolean;
2369
+ /** An optional file path for the geometry data. */
2370
+ geometryFile?: string;
2371
+ };
2372
+ }
2373
+ /**
2374
+ * 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.
2375
+ */
2376
+ export interface StreamedAsset {
2377
+ /** The unique identifier of the asset. */
2378
+ id: number;
2379
+ /** An array of geometries associated with the asset. */
2380
+ geometries: {
2381
+ /** The unique identifier of the geometry. */
2382
+ geometryID: number;
2383
+ /** The transformation matrix of the geometry as a number array. */
2384
+ transformation: number[];
2385
+ /** The color of the geometry as a number array. */
2386
+ color: number[];
2387
+ }[];
2388
+ }
2389
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2390
+ /**
2391
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
2392
+ */
2393
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
2394
+ /**
2395
+ * Minimum number of geometries to be streamed.
2396
+ * Defaults to 10 geometries.
2397
+ */
2398
+ minGeometrySize: number;
2399
+ /**
2400
+ * Minimum amount of assets to be streamed.
2401
+ * Defaults to 1000 assets.
2402
+ */
2403
+ minAssetsSize: number;
2404
+ }
2405
+ import * as WEBIFC from "web-ifc";
2406
+ import * as THREE from "three";
2407
+ export declare class Units {
2408
+ factor: number;
2409
+ complement: number;
2410
+ apply(matrix: THREE.Matrix4): void;
2411
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2412
+ private getLengthUnits;
2413
+ private getScaleMatrix;
2414
+ }
2415
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2416
+ /**
2417
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2418
+ */
2419
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2420
+ /**
2421
+ * Amount of properties to be streamed.
2422
+ * Defaults to 100 properties.
2254
2423
  */
2255
- get zoom(): number;
2424
+ propertiesSize: number;
2425
+ }
2426
+ import * as THREE from "three";
2427
+ import { Disposable, Event } from "../../Types";
2428
+ /**
2429
+ * 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.
2430
+ */
2431
+ export declare class Mouse implements Disposable {
2432
+ dom: HTMLCanvasElement;
2433
+ private _event?;
2434
+ private _position;
2435
+ /** {@link Disposable.onDisposed} */
2436
+ readonly onDisposed: Event<unknown>;
2437
+ constructor(dom: HTMLCanvasElement);
2256
2438
  /**
2257
- * Sets the zoom level of the minimap.
2258
- * The zoom level determines how much of the world is visible on the minimap.
2259
- * @param value - The new zoom level of the minimap.
2439
+ * The real position of the mouse of the Three.js canvas.
2260
2440
  */
2261
- set zoom(value: number);
2262
- constructor(world: World);
2441
+ get position(): THREE.Vector2;
2263
2442
  /** {@link Disposable.dispose} */
2264
2443
  dispose(): void;
2265
- /** Returns the camera used by the MiniMap */
2266
- get(): THREE.OrthographicCamera;
2267
- /** {@link Updateable.update} */
2268
- update(): void;
2269
- /** {@link Resizeable.getSize} */
2270
- getSize(): THREE.Vector2;
2271
- /** {@link Resizeable.resize} */
2272
- resize(size?: THREE.Vector2): void;
2273
- private updatePlanes;
2444
+ private getPositionY;
2445
+ private getPositionX;
2446
+ private updateMouseInfo;
2447
+ private setupEvents;
2274
2448
  }
2449
+ import * as THREE from "three";
2450
+ import { Components } from "../../Components";
2451
+ import { Event, World, Disposable } from "../../Types";
2452
+ import { Mouse } from "./mouse";
2275
2453
  /**
2276
- * A Set of unique numbers representing different types of IFC geometries.
2277
- */
2278
- export declare const GeometryTypes: Set<number>;
2279
- import { InverseAttribute } from "./types";
2280
- export declare const relToAttributesMap: Map<number, {
2281
- forRelating: InverseAttribute;
2282
- forRelated: InverseAttribute;
2283
- }>;
2284
- /**
2285
- * 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.
2454
+ * 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.
2286
2455
  */
2287
- export declare class AsyncEvent<T> {
2456
+ export declare class SimpleRaycaster implements Disposable {
2457
+ /** {@link Component.enabled} */
2458
+ enabled: boolean;
2459
+ /** The components instance to which this Raycaster belongs. */
2460
+ components: Components;
2461
+ /** {@link Disposable.onDisposed} */
2462
+ readonly onDisposed: Event<unknown>;
2463
+ /** The position of the mouse in the screen. */
2464
+ readonly mouse: Mouse;
2288
2465
  /**
2289
- * Add a callback to this event instance.
2290
- * @param handler - the callback to be added to this event.
2466
+ * A reference to the Three.js Raycaster instance.
2467
+ * This is used for raycasting operations.
2291
2468
  */
2292
- add(handler: T extends void ? {
2293
- (): Promise<void>;
2294
- } : {
2295
- (data: T): Promise<void>;
2296
- }): void;
2469
+ readonly three: THREE.Raycaster;
2297
2470
  /**
2298
- * Removes a callback from this event instance.
2299
- * @param handler - the callback to be removed from this event.
2471
+ * A reference to the world instance to which this Raycaster belongs.
2472
+ * This is used to access the camera and meshes.
2300
2473
  */
2301
- remove(handler: T extends void ? {
2302
- (): Promise<void>;
2303
- } : {
2304
- (data: T): Promise<void>;
2305
- }): void;
2306
- /** Triggers all the callbacks assigned to this event. */
2307
- trigger: (data?: T) => Promise<void>;
2308
- /** Gets rid of all the suscribed events. */
2309
- reset(): void;
2310
- private handlers;
2474
+ world: World;
2475
+ constructor(components: Components, world: World);
2476
+ /** {@link Disposable.dispose} */
2477
+ dispose(): void;
2478
+ /**
2479
+ * Throws a ray from the camera to the mouse or touch event point and returns
2480
+ * the first item found. This also takes into account the clipping planes
2481
+ * used by the renderer.
2482
+ *
2483
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2484
+ * to query. If not provided, it will query all the meshes stored in
2485
+ * {@link Components.meshes}.
2486
+ */
2487
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2488
+ /**
2489
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2490
+ * This method also takes into account the clipping planes used by the renderer.
2491
+ *
2492
+ * @param origin - The origin of the ray.
2493
+ * @param direction - The direction of the ray.
2494
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2495
+ * @returns The first intersection found or 'null' if no intersection was found.
2496
+ */
2497
+ 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;
2498
+ private intersect;
2499
+ private filterClippingPlanes;
2311
2500
  }
2312
2501
  /**
2313
2502
  * 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.
@@ -2337,48 +2526,6 @@ export declare class Event<T> {
2337
2526
  reset(): void;
2338
2527
  private handlers;
2339
2528
  }
2340
- import { Base } from "./base";
2341
- import { World } from "./world";
2342
- import { Event } from "./event";
2343
- import { Components } from "../../Components";
2344
- /**
2345
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2346
- */
2347
- export declare abstract class BaseWorldItem extends Base {
2348
- readonly worlds: Map<string, World>;
2349
- /**
2350
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2351
- * The event payload contains the world instance and the action ("added" or "removed").
2352
- */
2353
- readonly onWorldChanged: Event<{
2354
- world: World;
2355
- action: "added" | "removed";
2356
- }>;
2357
- /**
2358
- * The current world this item is associated with. It can be null if no world is currently active.
2359
- */
2360
- currentWorld: World | null;
2361
- protected constructor(components: Components);
2362
- }
2363
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2364
- import { Components } from "../../Components";
2365
- /**
2366
- * Base class of the library. Useful for finding out the interfaces something implements.
2367
- */
2368
- export declare abstract class Base {
2369
- components: Components;
2370
- constructor(components: Components);
2371
- /** Whether is component is {@link Disposable}. */
2372
- isDisposeable: () => this is Disposable;
2373
- /** Whether is component is {@link Resizeable}. */
2374
- isResizeable: () => this is Resizeable;
2375
- /** Whether is component is {@link Updateable}. */
2376
- isUpdateable: () => this is Updateable;
2377
- /** Whether is component is {@link Hideable}. */
2378
- isHideable: () => this is Hideable;
2379
- /** Whether is component is {@link Configurable}. */
2380
- isConfigurable: () => this is Configurable<any>;
2381
- }
2382
2529
  import * as THREE from "three";
2383
2530
  import CameraControls from "camera-controls";
2384
2531
  import { Event } from "./event";
@@ -2450,42 +2597,148 @@ export interface Createable {
2450
2597
  /** Creates a new instance of an element (e.g. a new Dimension). */
2451
2598
  create: (data: any) => void;
2452
2599
  /**
2453
- * Finish the creation process of the component, successfully creating an
2454
- * instance of whatever the component creates.
2600
+ * Finish the creation process of the component, successfully creating an
2601
+ * instance of whatever the component creates.
2602
+ */
2603
+ endCreation?: (data: any) => void;
2604
+ /**
2605
+ * Cancels the creation process of the component, going back to the state
2606
+ * before starting to create.
2607
+ */
2608
+ cancelCreation?: (data: any) => void;
2609
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
2610
+ delete: (data: any) => void;
2611
+ }
2612
+ /**
2613
+ * Whether this component supports to be configured.
2614
+ */
2615
+ export interface Configurable<T extends Record<string, any>> {
2616
+ /** Wether this components has been already configured. */
2617
+ isSetup: boolean;
2618
+ /** Use the provided configuration to setup the tool. */
2619
+ setup: (config?: Partial<T>) => void | Promise<void>;
2620
+ /** Fired after successfully calling {@link Configurable.setup()} */
2621
+ readonly onSetup: Event<any>;
2622
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2623
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
2624
+ */
2625
+ config: Required<T>;
2626
+ }
2627
+ /**
2628
+ * Whether a camera uses the Camera Controls library.
2629
+ */
2630
+ export interface CameraControllable {
2631
+ /**
2632
+ * An instance of CameraControls that provides camera control functionalities.
2633
+ * This instance is used to manipulate the camera.
2634
+ */
2635
+ controls: CameraControls;
2636
+ }
2637
+ /**
2638
+ * 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.
2639
+ */
2640
+ export declare class AsyncEvent<T> {
2641
+ /**
2642
+ * Add a callback to this event instance.
2643
+ * @param handler - the callback to be added to this event.
2644
+ */
2645
+ add(handler: T extends void ? {
2646
+ (): Promise<void>;
2647
+ } : {
2648
+ (data: T): Promise<void>;
2649
+ }): void;
2650
+ /**
2651
+ * Removes a callback from this event instance.
2652
+ * @param handler - the callback to be removed from this event.
2653
+ */
2654
+ remove(handler: T extends void ? {
2655
+ (): Promise<void>;
2656
+ } : {
2657
+ (data: T): Promise<void>;
2658
+ }): void;
2659
+ /** Triggers all the callbacks assigned to this event. */
2660
+ trigger: (data?: T) => Promise<void>;
2661
+ /** Gets rid of all the suscribed events. */
2662
+ reset(): void;
2663
+ private handlers;
2664
+ }
2665
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2666
+ import { Components } from "../../Components";
2667
+ /**
2668
+ * Base class of the library. Useful for finding out the interfaces something implements.
2669
+ */
2670
+ export declare abstract class Base {
2671
+ components: Components;
2672
+ constructor(components: Components);
2673
+ /** Whether is component is {@link Disposable}. */
2674
+ isDisposeable: () => this is Disposable;
2675
+ /** Whether is component is {@link Resizeable}. */
2676
+ isResizeable: () => this is Resizeable;
2677
+ /** Whether is component is {@link Updateable}. */
2678
+ isUpdateable: () => this is Updateable;
2679
+ /** Whether is component is {@link Hideable}. */
2680
+ isHideable: () => this is Hideable;
2681
+ /** Whether is component is {@link Configurable}. */
2682
+ isConfigurable: () => this is Configurable<any>;
2683
+ }
2684
+ import * as THREE from "three";
2685
+ import { Hideable, Event, World, Disposable } from "../../Types";
2686
+ import { Components } from "../../Components";
2687
+ /**
2688
+ * Configuration interface for the {@link SimpleGrid} class.
2689
+ */
2690
+ export interface GridConfig {
2691
+ /**
2692
+ * The color of the grid lines.
2693
+ */
2694
+ color: THREE.Color;
2695
+ /**
2696
+ * The size of the primary grid lines.
2455
2697
  */
2456
- endCreation?: (data: any) => void;
2698
+ size1: number;
2457
2699
  /**
2458
- * Cancels the creation process of the component, going back to the state
2459
- * before starting to create.
2700
+ * The size of the secondary grid lines.
2460
2701
  */
2461
- cancelCreation?: (data: any) => void;
2462
- /** Deletes an existing instance of an element (e.g. a Dimension). */
2463
- delete: (data: any) => void;
2464
- }
2465
- /**
2466
- * Whether this component supports to be configured.
2467
- */
2468
- export interface Configurable<T extends Record<string, any>> {
2469
- /** Wether this components has been already configured. */
2470
- isSetup: boolean;
2471
- /** Use the provided configuration to setup the tool. */
2472
- setup: (config?: Partial<T>) => void | Promise<void>;
2473
- /** Fired after successfully calling {@link Configurable.setup()} */
2474
- readonly onSetup: Event<any>;
2475
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2476
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
2702
+ size2: number;
2703
+ /**
2704
+ * The distance at which the grid lines start to fade away.
2477
2705
  */
2478
- config: Required<T>;
2706
+ distance: number;
2479
2707
  }
2480
2708
  /**
2481
- * Whether a camera uses the Camera Controls library.
2709
+ * 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).
2482
2710
  */
2483
- export interface CameraControllable {
2711
+ export declare class SimpleGrid implements Hideable, Disposable {
2712
+ /** {@link Disposable.onDisposed} */
2713
+ readonly onDisposed: Event<unknown>;
2714
+ /** The world instance to which this Raycaster belongs. */
2715
+ world: World;
2716
+ /** The components instance to which this grid belongs. */
2717
+ components: Components;
2718
+ /** {@link Hideable.visible} */
2719
+ get visible(): boolean;
2720
+ /** {@link Hideable.visible} */
2721
+ set visible(visible: boolean);
2722
+ /** The material of the grid. */
2723
+ get material(): THREE.ShaderMaterial;
2484
2724
  /**
2485
- * An instance of CameraControls that provides camera control functionalities.
2486
- * This instance is used to manipulate the camera.
2725
+ * Whether the grid should fade away with distance. Recommended to be true for
2726
+ * perspective cameras and false for orthographic cameras.
2487
2727
  */
2488
- controls: CameraControls;
2728
+ get fade(): boolean;
2729
+ /**
2730
+ * Whether the grid should fade away with distance. Recommended to be true for
2731
+ * perspective cameras and false for orthographic cameras.
2732
+ */
2733
+ set fade(active: boolean);
2734
+ /** The Three.js mesh that contains the infinite grid. */
2735
+ readonly three: THREE.Mesh;
2736
+ private _fade;
2737
+ constructor(components: Components, world: World, config: GridConfig);
2738
+ /** {@link Disposable.dispose} */
2739
+ dispose(): void;
2740
+ private setupEvents;
2741
+ private updateZoom;
2489
2742
  }
2490
2743
  import { Base } from "./base";
2491
2744
  /**
@@ -2500,25 +2753,56 @@ export declare abstract class Component extends Base {
2500
2753
  */
2501
2754
  abstract enabled: boolean;
2502
2755
  }
2503
- import * as THREE from "three";
2504
- import { Disposable } from "./interfaces";
2756
+ import { Base } from "./base";
2757
+ import { World } from "./world";
2505
2758
  import { Event } from "./event";
2506
2759
  import { Components } from "../../Components";
2507
- import { BaseWorldItem } from "./base-world-item";
2508
2760
  /**
2509
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2761
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2510
2762
  */
2511
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2512
- /** {@link Disposable.onDisposed} */
2513
- readonly onDisposed: Event<unknown>;
2763
+ export declare abstract class BaseWorldItem extends Base {
2764
+ readonly worlds: Map<string, World>;
2514
2765
  /**
2515
- * Abstract property representing the three.js object associated with this scene.
2516
- * It should be implemented by subclasses.
2766
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2767
+ * The event payload contains the world instance and the action ("added" or "removed").
2517
2768
  */
2518
- abstract three: THREE.Object3D;
2769
+ readonly onWorldChanged: Event<{
2770
+ world: World;
2771
+ action: "added" | "removed";
2772
+ }>;
2773
+ /**
2774
+ * The current world this item is associated with. It can be null if no world is currently active.
2775
+ */
2776
+ currentWorld: World | null;
2519
2777
  protected constructor(components: Components);
2520
- /** {@link Disposable.dispose} */
2521
- dispose(): void;
2778
+ }
2779
+ import * as THREE from "three";
2780
+ import CameraControls from "camera-controls";
2781
+ import { BaseWorldItem } from "./base-world-item";
2782
+ import { CameraControllable } from "./interfaces";
2783
+ /**
2784
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2785
+ */
2786
+ export declare abstract class BaseCamera extends BaseWorldItem {
2787
+ /**
2788
+ * Whether the camera is enabled or not.
2789
+ */
2790
+ abstract enabled: boolean;
2791
+ /**
2792
+ * The Three.js camera instance.
2793
+ */
2794
+ abstract three: THREE.Camera;
2795
+ /**
2796
+ * Optional CameraControls instance for controlling the camera.
2797
+ * This property is only available if the camera is controllable.
2798
+ */
2799
+ abstract controls?: CameraControls;
2800
+ /**
2801
+ * Checks whether the instance is {@link CameraControllable}.
2802
+ *
2803
+ * @returns True if the instance is controllable, false otherwise.
2804
+ */
2805
+ hasCameraControls: () => this is CameraControllable;
2522
2806
  }
2523
2807
  import * as THREE from "three";
2524
2808
  import { Vector2 } from "three";
@@ -2586,114 +2870,23 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2586
2870
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2587
2871
  }
2588
2872
  import * as THREE from "three";
2589
- import CameraControls from "camera-controls";
2873
+ import { Disposable } from "./interfaces";
2874
+ import { Event } from "./event";
2875
+ import { Components } from "../../Components";
2590
2876
  import { BaseWorldItem } from "./base-world-item";
2591
- import { CameraControllable } from "./interfaces";
2592
2877
  /**
2593
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2878
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2594
2879
  */
2595
- export declare abstract class BaseCamera extends BaseWorldItem {
2596
- /**
2597
- * Whether the camera is enabled or not.
2598
- */
2599
- abstract enabled: boolean;
2600
- /**
2601
- * The Three.js camera instance.
2602
- */
2603
- abstract three: THREE.Camera;
2604
- /**
2605
- * Optional CameraControls instance for controlling the camera.
2606
- * This property is only available if the camera is controllable.
2607
- */
2608
- abstract controls?: CameraControls;
2609
- /**
2610
- * Checks whether the instance is {@link CameraControllable}.
2611
- *
2612
- * @returns True if the instance is controllable, false otherwise.
2613
- */
2614
- hasCameraControls: () => this is CameraControllable;
2615
- }
2616
- import * as WEBIFC from "web-ifc";
2617
- import { IfcItemsCategories } from "../../../ifc";
2618
- export declare class SpatialStructure {
2619
- itemsByFloor: IfcItemsCategories;
2620
- private _units;
2621
- setUp(webIfc: WEBIFC.IfcAPI): void;
2622
- cleanUp(): void;
2623
- }
2624
- import * as WEBIFC from "web-ifc";
2625
- /** Configuration of the IFC-fragment conversion. */
2626
- export declare class IfcFragmentSettings {
2627
- /** Whether to extract the IFC properties into a JSON. */
2628
- includeProperties: boolean;
2629
- /**
2630
- * Generate the geometry for categories that are not included by default,
2631
- * like IFCSPACE.
2632
- */
2633
- optionalCategories: number[];
2634
- /** Whether to use the coordination data coming from the IFC files. */
2635
- coordinate: boolean;
2636
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2637
- wasm: {
2638
- path: string;
2639
- absolute: boolean;
2640
- logLevel?: WEBIFC.LogLevel;
2641
- };
2642
- /** List of categories that won't be converted to fragments. */
2643
- excludedCategories: Set<number>;
2644
- /** Whether to save the absolute location of all IFC items. */
2645
- saveLocations: boolean;
2646
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2647
- webIfc: WEBIFC.LoaderSettings;
2648
- /**
2649
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2650
- * If set to true, the path will be set to the default path of the WASM file.
2651
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2652
- * Default value is true.
2653
- */
2654
- autoSetWasm: boolean;
2880
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2881
+ /** {@link Disposable.onDisposed} */
2882
+ readonly onDisposed: Event<unknown>;
2655
2883
  /**
2656
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2657
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2658
- * If set to null, the default file location handler will be used.
2659
- *
2660
- * @param url - The URL of the file to locate.
2661
- * @returns The absolute path of the file.
2884
+ * Abstract property representing the three.js object associated with this scene.
2885
+ * It should be implemented by subclasses.
2662
2886
  */
2663
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2664
- }
2665
- import * as FRAGS from "@thatopen/fragments";
2666
- import * as WEBIFC from "web-ifc";
2667
- export declare class SpatialIdsFinder {
2668
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2669
- }
2670
- import { Event } from "./event";
2671
- export declare class DataMap<K, V> extends Map<K, V> {
2672
- readonly onItemSet: Event<{
2673
- key: K;
2674
- value: V;
2675
- }>;
2676
- readonly onItemUpdated: Event<{
2677
- key: K;
2678
- value: V;
2679
- }>;
2680
- readonly onItemDeleted: Event<unknown>;
2681
- readonly onCleared: Event<unknown>;
2682
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
2683
- clear(): void;
2684
- set(key: K, value: V): this;
2685
- delete(key: K): boolean;
2686
- dispose(): void;
2687
- }
2688
- import { Event } from "./event";
2689
- export declare class DataSet<T> extends Set<T> {
2690
- readonly onItemAdded: Event<T>;
2691
- readonly onItemDeleted: Event<unknown>;
2692
- readonly onCleared: Event<unknown>;
2693
- constructor(iterable?: Iterable<T> | null);
2694
- clear(): void;
2695
- add(value: T): this;
2696
- delete(value: T): boolean;
2887
+ abstract three: THREE.Object3D;
2888
+ protected constructor(components: Components);
2889
+ /** {@link Disposable.dispose} */
2697
2890
  dispose(): void;
2698
2891
  }
2699
2892
  import * as THREE from "three";
@@ -2730,6 +2923,35 @@ export interface World extends Disposable, Updateable {
2730
2923
  */
2731
2924
  isDisposing: boolean;
2732
2925
  }
2926
+ import { Event } from "./event";
2927
+ export declare class DataMap<K, V> extends Map<K, V> {
2928
+ readonly onItemSet: Event<{
2929
+ key: K;
2930
+ value: V;
2931
+ }>;
2932
+ readonly onItemUpdated: Event<{
2933
+ key: K;
2934
+ value: V;
2935
+ }>;
2936
+ readonly onItemDeleted: Event<unknown>;
2937
+ readonly onCleared: Event<unknown>;
2938
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
2939
+ clear(): void;
2940
+ set(key: K, value: V): this;
2941
+ delete(key: K): boolean;
2942
+ dispose(): void;
2943
+ }
2944
+ import { Event } from "./event";
2945
+ export declare class DataSet<T> extends Set<T> {
2946
+ readonly onItemAdded: Event<T>;
2947
+ readonly onItemDeleted: Event<unknown>;
2948
+ readonly onCleared: Event<unknown>;
2949
+ constructor(iterable?: Iterable<T> | null);
2950
+ clear(): void;
2951
+ add(value: T): this;
2952
+ delete(value: T): boolean;
2953
+ dispose(): void;
2954
+ }
2733
2955
  import * as THREE from "three";
2734
2956
  import { BaseScene, Configurable, Event } from "../../Types";
2735
2957
  import { Components } from "../../Components";
@@ -2770,147 +2992,6 @@ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2770
2992
  setup(config?: Partial<SimpleSceneConfig>): void;
2771
2993
  }
2772
2994
  import * as THREE from "three";
2773
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2774
- /**
2775
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2776
- *
2777
- * @template T - The type of the scene. Default is BaseScene.
2778
- * @template U - The type of the camera. Default is BaseCamera.
2779
- * @template S - The type of the renderer. Default is BaseRenderer.
2780
- */
2781
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2782
- /**
2783
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2784
- */
2785
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2786
- /** {@link Updateable.onAfterUpdate} */
2787
- readonly onAfterUpdate: Event<unknown>;
2788
- /** {@link Updateable.onBeforeUpdate} */
2789
- readonly onBeforeUpdate: Event<unknown>;
2790
- /** {@link Disposable.onDisposed} */
2791
- readonly onDisposed: Event<unknown>;
2792
- /**
2793
- * 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.
2794
- */
2795
- isDisposing: boolean;
2796
- /**
2797
- * Indicates whether the world is currently enabled.
2798
- * When disabled, the world will not be updated.
2799
- */
2800
- enabled: boolean;
2801
- /**
2802
- * A unique identifier for the world.
2803
- */
2804
- uuid: string;
2805
- /**
2806
- * An optional name for the world.
2807
- */
2808
- name?: string;
2809
- private _scene?;
2810
- private _camera?;
2811
- private _renderer;
2812
- /**
2813
- * Getter for the scene. If no scene is initialized, it throws an error.
2814
- * @returns The current scene.
2815
- */
2816
- get scene(): T;
2817
- /**
2818
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2819
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2820
- * @param scene - The new scene to be set.
2821
- */
2822
- set scene(scene: T);
2823
- /**
2824
- * Getter for the camera. If no camera is initialized, it throws an error.
2825
- * @returns The current camera.
2826
- */
2827
- get camera(): U;
2828
- /**
2829
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2830
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2831
- * @param camera - The new camera to be set.
2832
- */
2833
- set camera(camera: U);
2834
- /**
2835
- * Getter for the renderer.
2836
- * @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).
2837
- */
2838
- get renderer(): S | null;
2839
- /**
2840
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2841
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2842
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2843
- * @param renderer - The new renderer to be set or null to remove the current renderer.
2844
- */
2845
- set renderer(renderer: S | null);
2846
- /** {@link Updateable.update} */
2847
- update(delta?: number): void;
2848
- /** {@link Disposable.dispose} */
2849
- dispose(disposeResources?: boolean): void;
2850
- }
2851
- import * as THREE from "three";
2852
- import CameraControls from "camera-controls";
2853
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2854
- import { Components } from "../../Components";
2855
- /**
2856
- * 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.
2857
- */
2858
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2859
- /** {@link Updateable.onBeforeUpdate} */
2860
- readonly onBeforeUpdate: Event<SimpleCamera>;
2861
- /** {@link Updateable.onAfterUpdate} */
2862
- readonly onAfterUpdate: Event<SimpleCamera>;
2863
- /**
2864
- * Event that is triggered when the aspect of the camera has been updated.
2865
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2866
- */
2867
- readonly onAspectUpdated: Event<unknown>;
2868
- /** {@link Disposable.onDisposed} */
2869
- readonly onDisposed: Event<string>;
2870
- /**
2871
- * A three.js PerspectiveCamera or OrthographicCamera instance.
2872
- * This camera is used for rendering the scene.
2873
- */
2874
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2875
- private _allControls;
2876
- /**
2877
- * The object that controls the camera. An instance of
2878
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2879
- * Transforming the camera directly will have no effect: you need to use this
2880
- * object to move, rotate, look at objects, etc.
2881
- */
2882
- get controls(): CameraControls;
2883
- /**
2884
- * Getter for the enabled state of the camera controls.
2885
- * If the current world is null, it returns false.
2886
- * Otherwise, it returns the enabled state of the camera controls.
2887
- *
2888
- * @returns {boolean} The enabled state of the camera controls.
2889
- */
2890
- get enabled(): boolean;
2891
- /**
2892
- * Setter for the enabled state of the camera controls.
2893
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2894
- *
2895
- * @param {boolean} enabled - The new enabled state of the camera controls.
2896
- */
2897
- set enabled(enabled: boolean);
2898
- constructor(components: Components);
2899
- /** {@link Disposable.dispose} */
2900
- dispose(): void;
2901
- /** {@link Updateable.update} */
2902
- update(_delta: number): void;
2903
- /**
2904
- * Updates the aspect of the camera to match the size of the
2905
- * {@link Components.renderer}.
2906
- */
2907
- updateAspect: () => void;
2908
- private setupCamera;
2909
- private newCameraControls;
2910
- private setupEvents;
2911
- private static getSubsetOfThree;
2912
- }
2913
- import * as THREE from "three";
2914
2995
  import { BaseRenderer, Event } from "../../Types";
2915
2996
  import { Components } from "../../Components";
2916
2997
  /**
@@ -2965,95 +3046,66 @@ export declare class SimpleRenderer extends BaseRenderer {
2965
3046
  private onContextBack;
2966
3047
  }
2967
3048
  import * as THREE from "three";
3049
+ import CameraControls from "camera-controls";
3050
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2968
3051
  import { Components } from "../../Components";
2969
- import { AsyncEvent, Event, World } from "../../Types";
2970
3052
  /**
2971
- * Settings to configure the CullerRenderer.
3053
+ * 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.
2972
3054
  */
2973
- export interface CullerRendererSettings {
2974
- /**
2975
- * Interval in milliseconds at which the visibility check should be performed.
2976
- * Default value is 1000.
2977
- */
2978
- updateInterval?: number;
2979
- /**
2980
- * Width of the render target used for visibility checks.
2981
- * Default value is 512.
2982
- */
2983
- width?: number;
2984
- /**
2985
- * Height of the render target used for visibility checks.
2986
- * Default value is 512.
2987
- */
2988
- height?: number;
3055
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3056
+ /** {@link Updateable.onBeforeUpdate} */
3057
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3058
+ /** {@link Updateable.onAfterUpdate} */
3059
+ readonly onAfterUpdate: Event<SimpleCamera>;
2989
3060
  /**
2990
- * Whether the visibility check should be performed automatically.
2991
- * Default value is true.
3061
+ * Event that is triggered when the aspect of the camera has been updated.
3062
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2992
3063
  */
2993
- autoUpdate?: boolean;
2994
- }
2995
- /**
2996
- * A base renderer to determine visibility on screen.
2997
- */
2998
- export declare class CullerRenderer {
3064
+ readonly onAspectUpdated: Event<unknown>;
2999
3065
  /** {@link Disposable.onDisposed} */
3000
3066
  readonly onDisposed: Event<string>;
3001
3067
  /**
3002
- * Fires after making the visibility check to the meshes. It lists the
3003
- * meshes that are currently visible, and the ones that were visible
3004
- * just before but not anymore.
3068
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3069
+ * This camera is used for rendering the scene.
3005
3070
  */
3006
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3071
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3072
+ private _allControls;
3007
3073
  /**
3008
- * Whether this renderer is active or not. If not, it won't render anything.
3074
+ * The object that controls the camera. An instance of
3075
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3076
+ * Transforming the camera directly will have no effect: you need to use this
3077
+ * object to move, rotate, look at objects, etc.
3009
3078
  */
3010
- enabled: boolean;
3079
+ get controls(): CameraControls;
3011
3080
  /**
3012
- * Needs to check whether there are objects that need to be hidden or shown.
3013
- * You can bind this to the camera movement, to a certain interval, etc.
3081
+ * Getter for the enabled state of the camera controls.
3082
+ * If the current world is null, it returns false.
3083
+ * Otherwise, it returns the enabled state of the camera controls.
3084
+ *
3085
+ * @returns {boolean} The enabled state of the camera controls.
3014
3086
  */
3015
- needsUpdate: boolean;
3087
+ get enabled(): boolean;
3016
3088
  /**
3017
- * Render the internal scene used to determine the object visibility. Used
3018
- * for debugging purposes.
3089
+ * Setter for the enabled state of the camera controls.
3090
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3091
+ *
3092
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3019
3093
  */
3020
- renderDebugFrame: boolean;
3021
- /** The components instance to which this renderer belongs. */
3022
- components: Components;
3023
- /** The world instance to which this renderer belongs. */
3024
- readonly world: World;
3025
- /** The THREE.js renderer used to make the visibility test. */
3026
- readonly renderer: THREE.WebGLRenderer;
3027
- protected autoUpdate: boolean;
3028
- protected updateInterval: number;
3029
- protected readonly worker: Worker;
3030
- protected readonly scene: THREE.Scene;
3031
- private _width;
3032
- private _height;
3033
- private _availableColor;
3034
- private readonly renderTarget;
3035
- private readonly bufferSize;
3036
- private readonly _buffer;
3037
- protected _isWorkerBusy: boolean;
3038
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3094
+ set enabled(enabled: boolean);
3095
+ constructor(components: Components);
3039
3096
  /** {@link Disposable.dispose} */
3040
- dispose(): void;
3041
- /**
3042
- * The function that the culler uses to reprocess the scene. Generally it's
3043
- * better to call needsUpdate, but you can also call this to force it.
3044
- * @param force if true, it will refresh the scene even if needsUpdate is
3045
- * not true.
3046
- */
3047
- updateVisibility: (force?: boolean) => Promise<void>;
3048
- protected getAvailableColor(): {
3049
- r: number;
3050
- g: number;
3051
- b: number;
3052
- code: string;
3053
- };
3054
- protected increaseColor(): void;
3055
- protected decreaseColor(): void;
3056
- private applySettings;
3097
+ dispose(): void;
3098
+ /** {@link Updateable.update} */
3099
+ update(_delta: number): void;
3100
+ /**
3101
+ * Updates the aspect of the camera to match the size of the
3102
+ * {@link Components.renderer}.
3103
+ */
3104
+ updateAspect: () => void;
3105
+ private setupCamera;
3106
+ private newCameraControls;
3107
+ private setupEvents;
3108
+ private static getSubsetOfThree;
3057
3109
  }
3058
3110
  import * as THREE from "three";
3059
3111
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
@@ -3121,235 +3173,173 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
3121
3173
  }
3122
3174
  import * as THREE from "three";
3123
3175
  import { Components } from "../../Components";
3124
- import { Event, World, Disposable } from "../../Types";
3125
- import { Mouse } from "./mouse";
3176
+ import { AsyncEvent, Event, World } from "../../Types";
3126
3177
  /**
3127
- * 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.
3178
+ * Settings to configure the CullerRenderer.
3128
3179
  */
3129
- export declare class SimpleRaycaster implements Disposable {
3130
- /** {@link Component.enabled} */
3131
- enabled: boolean;
3132
- /** The components instance to which this Raycaster belongs. */
3133
- components: Components;
3134
- /** {@link Disposable.onDisposed} */
3135
- readonly onDisposed: Event<unknown>;
3136
- /** The position of the mouse in the screen. */
3137
- readonly mouse: Mouse;
3180
+ export interface CullerRendererSettings {
3138
3181
  /**
3139
- * A reference to the Three.js Raycaster instance.
3140
- * This is used for raycasting operations.
3182
+ * Interval in milliseconds at which the visibility check should be performed.
3183
+ * Default value is 1000.
3141
3184
  */
3142
- readonly three: THREE.Raycaster;
3185
+ updateInterval?: number;
3143
3186
  /**
3144
- * A reference to the world instance to which this Raycaster belongs.
3145
- * This is used to access the camera and meshes.
3187
+ * Width of the render target used for visibility checks.
3188
+ * Default value is 512.
3146
3189
  */
3147
- world: World;
3148
- constructor(components: Components, world: World);
3149
- /** {@link Disposable.dispose} */
3150
- dispose(): void;
3190
+ width?: number;
3151
3191
  /**
3152
- * Throws a ray from the camera to the mouse or touch event point and returns
3153
- * the first item found. This also takes into account the clipping planes
3154
- * used by the renderer.
3155
- *
3156
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3157
- * to query. If not provided, it will query all the meshes stored in
3158
- * {@link Components.meshes}.
3192
+ * Height of the render target used for visibility checks.
3193
+ * Default value is 512.
3159
3194
  */
3160
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3195
+ height?: number;
3161
3196
  /**
3162
- * Casts a ray from a given origin in a given direction and returns the first item found.
3163
- * This method also takes into account the clipping planes used by the renderer.
3164
- *
3165
- * @param origin - The origin of the ray.
3166
- * @param direction - The direction of the ray.
3167
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3168
- * @returns The first intersection found or 'null' if no intersection was found.
3197
+ * Whether the visibility check should be performed automatically.
3198
+ * Default value is true.
3169
3199
  */
3170
- 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;
3171
- private intersect;
3172
- private filterClippingPlanes;
3200
+ autoUpdate?: boolean;
3173
3201
  }
3174
- import * as THREE from "three";
3175
- import { Disposable, Event } from "../../Types";
3176
3202
  /**
3177
- * 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.
3203
+ * A base renderer to determine visibility on screen.
3178
3204
  */
3179
- export declare class Mouse implements Disposable {
3180
- dom: HTMLCanvasElement;
3181
- private _event?;
3182
- private _position;
3205
+ export declare class CullerRenderer {
3183
3206
  /** {@link Disposable.onDisposed} */
3184
- readonly onDisposed: Event<unknown>;
3185
- constructor(dom: HTMLCanvasElement);
3207
+ readonly onDisposed: Event<string>;
3186
3208
  /**
3187
- * The real position of the mouse of the Three.js canvas.
3209
+ * Fires after making the visibility check to the meshes. It lists the
3210
+ * meshes that are currently visible, and the ones that were visible
3211
+ * just before but not anymore.
3188
3212
  */
3189
- get position(): THREE.Vector2;
3190
- /** {@link Disposable.dispose} */
3191
- dispose(): void;
3192
- private getPositionY;
3193
- private getPositionX;
3194
- private updateMouseInfo;
3195
- private setupEvents;
3196
- }
3197
- import * as THREE from "three";
3198
- import { Hideable, Event, World, Disposable } from "../../Types";
3199
- import { Components } from "../../Components";
3200
- /**
3201
- * Configuration interface for the {@link SimpleGrid} class.
3202
- */
3203
- export interface GridConfig {
3213
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3204
3214
  /**
3205
- * The color of the grid lines.
3215
+ * Whether this renderer is active or not. If not, it won't render anything.
3206
3216
  */
3207
- color: THREE.Color;
3217
+ enabled: boolean;
3208
3218
  /**
3209
- * The size of the primary grid lines.
3219
+ * Needs to check whether there are objects that need to be hidden or shown.
3220
+ * You can bind this to the camera movement, to a certain interval, etc.
3210
3221
  */
3211
- size1: number;
3222
+ needsUpdate: boolean;
3212
3223
  /**
3213
- * The size of the secondary grid lines.
3224
+ * Render the internal scene used to determine the object visibility. Used
3225
+ * for debugging purposes.
3214
3226
  */
3215
- size2: number;
3227
+ renderDebugFrame: boolean;
3228
+ /** The components instance to which this renderer belongs. */
3229
+ components: Components;
3230
+ /** The world instance to which this renderer belongs. */
3231
+ readonly world: World;
3232
+ /** The THREE.js renderer used to make the visibility test. */
3233
+ readonly renderer: THREE.WebGLRenderer;
3234
+ protected autoUpdate: boolean;
3235
+ protected updateInterval: number;
3236
+ protected readonly worker: Worker;
3237
+ protected readonly scene: THREE.Scene;
3238
+ private _width;
3239
+ private _height;
3240
+ private _availableColor;
3241
+ private readonly renderTarget;
3242
+ private readonly bufferSize;
3243
+ private readonly _buffer;
3244
+ protected _isWorkerBusy: boolean;
3245
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3246
+ /** {@link Disposable.dispose} */
3247
+ dispose(): void;
3216
3248
  /**
3217
- * The distance at which the grid lines start to fade away.
3249
+ * The function that the culler uses to reprocess the scene. Generally it's
3250
+ * better to call needsUpdate, but you can also call this to force it.
3251
+ * @param force if true, it will refresh the scene even if needsUpdate is
3252
+ * not true.
3218
3253
  */
3219
- distance: number;
3254
+ updateVisibility: (force?: boolean) => Promise<void>;
3255
+ protected getAvailableColor(): {
3256
+ r: number;
3257
+ g: number;
3258
+ b: number;
3259
+ code: string;
3260
+ };
3261
+ protected increaseColor(): void;
3262
+ protected decreaseColor(): void;
3263
+ private applySettings;
3220
3264
  }
3265
+ import * as THREE from "three";
3266
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3221
3267
  /**
3222
- * 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).
3268
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3269
+ *
3270
+ * @template T - The type of the scene. Default is BaseScene.
3271
+ * @template U - The type of the camera. Default is BaseCamera.
3272
+ * @template S - The type of the renderer. Default is BaseRenderer.
3223
3273
  */
3224
- export declare class SimpleGrid implements Hideable, Disposable {
3225
- /** {@link Disposable.onDisposed} */
3226
- readonly onDisposed: Event<unknown>;
3227
- /** The world instance to which this Raycaster belongs. */
3228
- world: World;
3229
- /** The components instance to which this grid belongs. */
3230
- components: Components;
3231
- /** {@link Hideable.visible} */
3232
- get visible(): boolean;
3233
- /** {@link Hideable.visible} */
3234
- set visible(visible: boolean);
3235
- /** The material of the grid. */
3236
- get material(): THREE.ShaderMaterial;
3274
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3237
3275
  /**
3238
- * Whether the grid should fade away with distance. Recommended to be true for
3239
- * perspective cameras and false for orthographic cameras.
3276
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3240
3277
  */
3241
- get fade(): boolean;
3278
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3279
+ /** {@link Updateable.onAfterUpdate} */
3280
+ readonly onAfterUpdate: Event<unknown>;
3281
+ /** {@link Updateable.onBeforeUpdate} */
3282
+ readonly onBeforeUpdate: Event<unknown>;
3283
+ /** {@link Disposable.onDisposed} */
3284
+ readonly onDisposed: Event<unknown>;
3242
3285
  /**
3243
- * Whether the grid should fade away with distance. Recommended to be true for
3244
- * perspective cameras and false for orthographic cameras.
3245
- */
3246
- set fade(active: boolean);
3247
- /** The Three.js mesh that contains the infinite grid. */
3248
- readonly three: THREE.Mesh;
3249
- private _fade;
3250
- constructor(components: Components, world: World, config: GridConfig);
3251
- /** {@link Disposable.dispose} */
3252
- dispose(): void;
3253
- private setupEvents;
3254
- private updateZoom;
3255
- }
3256
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3257
- import { NavigationMode } from "./types";
3258
- import { OrthoPerspectiveCamera } from "../index";
3259
- /**
3260
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3261
- */
3262
- export declare class FirstPersonMode implements NavigationMode {
3263
- private camera;
3264
- /** {@link NavigationMode.enabled} */
3265
- enabled: boolean;
3266
- /** {@link NavigationMode.id} */
3267
- readonly id = "FirstPerson";
3268
- constructor(camera: OrthoPerspectiveCamera);
3269
- /** {@link NavigationMode.set} */
3270
- set(active: boolean): void;
3271
- private setupFirstPersonCamera;
3272
- }
3273
- import { NavigationMode } from "./types";
3274
- import { OrthoPerspectiveCamera } from "../index";
3275
- /**
3276
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3277
- */
3278
- export declare class OrbitMode implements NavigationMode {
3279
- camera: OrthoPerspectiveCamera;
3280
- /** {@link NavigationMode.enabled} */
3281
- enabled: boolean;
3282
- /** {@link NavigationMode.id} */
3283
- readonly id = "Orbit";
3284
- constructor(camera: OrthoPerspectiveCamera);
3285
- /** {@link NavigationMode.set} */
3286
- set(active: boolean): void;
3287
- private activateOrbitControls;
3288
- }
3289
- import { NavigationMode } from "./types";
3290
- import { OrthoPerspectiveCamera } from "../index";
3291
- /**
3292
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3293
- */
3294
- export declare class PlanMode implements NavigationMode {
3295
- private camera;
3296
- /** {@link NavigationMode.enabled} */
3297
- enabled: boolean;
3298
- /** {@link NavigationMode.id} */
3299
- readonly id = "Plan";
3300
- private mouseAction1?;
3301
- private mouseAction2?;
3302
- private mouseInitialized;
3303
- private readonly defaultAzimuthSpeed;
3304
- private readonly defaultPolarSpeed;
3305
- constructor(camera: OrthoPerspectiveCamera);
3306
- /** {@link NavigationMode.set} */
3307
- set(active: boolean): void;
3308
- }
3309
- import * as THREE from "three";
3310
- import { CameraProjection } from "./types";
3311
- import { Event } from "../../Types";
3312
- import { OrthoPerspectiveCamera } from "../index";
3313
- /**
3314
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3315
- */
3316
- export declare class ProjectionManager {
3286
+ * 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.
3287
+ */
3288
+ isDisposing: boolean;
3317
3289
  /**
3318
- * Event that fires when the {@link CameraProjection} changes.
3290
+ * Indicates whether the world is currently enabled.
3291
+ * When disabled, the world will not be updated.
3319
3292
  */
3320
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3293
+ enabled: boolean;
3321
3294
  /**
3322
- * Current projection mode of the camera.
3323
- * Default is "Perspective".
3295
+ * A unique identifier for the world.
3324
3296
  */
3325
- current: CameraProjection;
3297
+ uuid: string;
3326
3298
  /**
3327
- * The camera controlled by this ProjectionManager.
3328
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3299
+ * An optional name for the world.
3329
3300
  */
3330
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3331
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3332
- matchOrthoDistanceEnabled: boolean;
3333
- private _component;
3334
- private _previousDistance;
3335
- constructor(camera: OrthoPerspectiveCamera);
3301
+ name?: string;
3302
+ private _scene?;
3303
+ private _camera?;
3304
+ private _renderer;
3336
3305
  /**
3337
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3338
- *
3339
- * @param projection - the new projection to set. If it is the current projection,
3340
- * it will have no effect.
3306
+ * Getter for the scene. If no scene is initialized, it throws an error.
3307
+ * @returns The current scene.
3341
3308
  */
3342
- set(projection: CameraProjection): Promise<void>;
3309
+ get scene(): T;
3343
3310
  /**
3344
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3345
- * and vice versa.
3311
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3312
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3313
+ * @param scene - The new scene to be set.
3346
3314
  */
3347
- toggle(): Promise<void>;
3348
- private setOrthoCamera;
3349
- private getPerspectiveDims;
3350
- private setupOrthoCamera;
3351
- private getDistance;
3352
- private setPerspectiveCamera;
3315
+ set scene(scene: T);
3316
+ /**
3317
+ * Getter for the camera. If no camera is initialized, it throws an error.
3318
+ * @returns The current camera.
3319
+ */
3320
+ get camera(): U;
3321
+ /**
3322
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3323
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3324
+ * @param camera - The new camera to be set.
3325
+ */
3326
+ set camera(camera: U);
3327
+ /**
3328
+ * Getter for the renderer.
3329
+ * @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).
3330
+ */
3331
+ get renderer(): S | null;
3332
+ /**
3333
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3334
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3335
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3336
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3337
+ */
3338
+ set renderer(renderer: S | null);
3339
+ /** {@link Updateable.update} */
3340
+ update(delta?: number): void;
3341
+ /** {@link Disposable.dispose} */
3342
+ dispose(disposeResources?: boolean): void;
3353
3343
  }
3354
3344
  import * as THREE from "three";
3355
3345
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3450,6 +3440,59 @@ export declare class SimplePlane implements Disposable, Hideable {
3450
3440
  private newHelper;
3451
3441
  private static newPlaneMesh;
3452
3442
  }
3443
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3444
+ import { NavigationMode } from "./types";
3445
+ import { OrthoPerspectiveCamera } from "../index";
3446
+ /**
3447
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3448
+ */
3449
+ export declare class OrbitMode implements NavigationMode {
3450
+ camera: OrthoPerspectiveCamera;
3451
+ /** {@link NavigationMode.enabled} */
3452
+ enabled: boolean;
3453
+ /** {@link NavigationMode.id} */
3454
+ readonly id = "Orbit";
3455
+ constructor(camera: OrthoPerspectiveCamera);
3456
+ /** {@link NavigationMode.set} */
3457
+ set(active: boolean): void;
3458
+ private activateOrbitControls;
3459
+ }
3460
+ import { NavigationMode } from "./types";
3461
+ import { OrthoPerspectiveCamera } from "../index";
3462
+ /**
3463
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3464
+ */
3465
+ export declare class FirstPersonMode implements NavigationMode {
3466
+ private camera;
3467
+ /** {@link NavigationMode.enabled} */
3468
+ enabled: boolean;
3469
+ /** {@link NavigationMode.id} */
3470
+ readonly id = "FirstPerson";
3471
+ constructor(camera: OrthoPerspectiveCamera);
3472
+ /** {@link NavigationMode.set} */
3473
+ set(active: boolean): void;
3474
+ private setupFirstPersonCamera;
3475
+ }
3476
+ import { NavigationMode } from "./types";
3477
+ import { OrthoPerspectiveCamera } from "../index";
3478
+ /**
3479
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3480
+ */
3481
+ export declare class PlanMode implements NavigationMode {
3482
+ private camera;
3483
+ /** {@link NavigationMode.enabled} */
3484
+ enabled: boolean;
3485
+ /** {@link NavigationMode.id} */
3486
+ readonly id = "Plan";
3487
+ private mouseAction1?;
3488
+ private mouseAction2?;
3489
+ private mouseInitialized;
3490
+ private readonly defaultAzimuthSpeed;
3491
+ private readonly defaultPolarSpeed;
3492
+ constructor(camera: OrthoPerspectiveCamera);
3493
+ /** {@link NavigationMode.set} */
3494
+ set(active: boolean): void;
3495
+ }
3453
3496
  /**
3454
3497
  * The projection system of the camera.
3455
3498
  */
@@ -3476,92 +3519,6 @@ export interface NavigationMode {
3476
3519
  /** Whether this navigation mode is active or not. */
3477
3520
  enabled: boolean;
3478
3521
  }
3479
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3480
- /**
3481
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3482
- */
3483
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3484
- /**
3485
- * Amount of properties to be streamed.
3486
- * Defaults to 100 properties.
3487
- */
3488
- propertiesSize: number;
3489
- }
3490
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3491
- /**
3492
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3493
- */
3494
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3495
- /**
3496
- * Minimum number of geometries to be streamed.
3497
- * Defaults to 10 geometries.
3498
- */
3499
- minGeometrySize: number;
3500
- /**
3501
- * Minimum amount of assets to be streamed.
3502
- * Defaults to 1000 assets.
3503
- */
3504
- minAssetsSize: number;
3505
- }
3506
- import * as THREE from "three";
3507
- import * as WEBIFC from "web-ifc";
3508
- import * as FRAGS from "@thatopen/fragments";
3509
- export declare class CivilReader {
3510
- defLineMat: THREE.LineBasicMaterial;
3511
- read(webIfc: WEBIFC.IfcAPI): {
3512
- alignments: Map<number, FRAGS.Alignment>;
3513
- coordinationMatrix: THREE.Matrix4;
3514
- } | undefined;
3515
- get(civilItems: any): {
3516
- alignments: Map<number, FRAGS.Alignment>;
3517
- coordinationMatrix: THREE.Matrix4;
3518
- } | undefined;
3519
- private getCurves;
3520
- }
3521
- /**
3522
- * 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.
3523
- */
3524
- export interface StreamedGeometries {
3525
- [id: number]: {
3526
- /** The bounding box of the geometry as a Float32Array. */
3527
- boundingBox: Float32Array;
3528
- /** A boolean indicating whether the geometry has holes. */
3529
- hasHoles: boolean;
3530
- /** An optional file path for the geometry data. */
3531
- geometryFile?: string;
3532
- };
3533
- }
3534
- /**
3535
- * 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.
3536
- */
3537
- export interface StreamedAsset {
3538
- /** The unique identifier of the asset. */
3539
- id: number;
3540
- /** An array of geometries associated with the asset. */
3541
- geometries: {
3542
- /** The unique identifier of the geometry. */
3543
- geometryID: number;
3544
- /** The transformation matrix of the geometry as a number array. */
3545
- transformation: number[];
3546
- /** The color of the geometry as a number array. */
3547
- color: number[];
3548
- }[];
3549
- }
3550
- import * as WEBIFC from "web-ifc";
3551
- export declare class IfcMetadataReader {
3552
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3553
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3554
- }
3555
- import * as WEBIFC from "web-ifc";
3556
- import * as THREE from "three";
3557
- export declare class Units {
3558
- factor: number;
3559
- complement: number;
3560
- apply(matrix: THREE.Matrix4): void;
3561
- setUp(webIfc: WEBIFC.IfcAPI): void;
3562
- private getLengthUnits;
3563
- private getScaleMatrix;
3564
- }
3565
3522
  export type RelationsMap = Map<number, Map<number, number[]>>;
3566
3523
  export interface ModelsRelationMap {
3567
3524
  [modelID: string]: RelationsMap;
@@ -3583,9 +3540,58 @@ export type InverseAttributes = [
3583
3540
  "Types",
3584
3541
  "Defines",
3585
3542
  "ContainedInStructure",
3586
- "ContainsElements"
3543
+ "ContainsElements",
3544
+ "HasControlElements",
3545
+ "AssignedToFlowElement",
3546
+ "ConnectedTo",
3547
+ "ConnectedFrom"
3587
3548
  ];
3588
3549
  export type InverseAttribute = InverseAttributes[number];
3550
+ import * as THREE from "three";
3551
+ import { CameraProjection } from "./types";
3552
+ import { Event } from "../../Types";
3553
+ import { OrthoPerspectiveCamera } from "../index";
3554
+ /**
3555
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3556
+ */
3557
+ export declare class ProjectionManager {
3558
+ /**
3559
+ * Event that fires when the {@link CameraProjection} changes.
3560
+ */
3561
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3562
+ /**
3563
+ * Current projection mode of the camera.
3564
+ * Default is "Perspective".
3565
+ */
3566
+ current: CameraProjection;
3567
+ /**
3568
+ * The camera controlled by this ProjectionManager.
3569
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3570
+ */
3571
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3572
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3573
+ matchOrthoDistanceEnabled: boolean;
3574
+ private _component;
3575
+ private _previousDistance;
3576
+ constructor(camera: OrthoPerspectiveCamera);
3577
+ /**
3578
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3579
+ *
3580
+ * @param projection - the new projection to set. If it is the current projection,
3581
+ * it will have no effect.
3582
+ */
3583
+ set(projection: CameraProjection): Promise<void>;
3584
+ /**
3585
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3586
+ * and vice versa.
3587
+ */
3588
+ toggle(): Promise<void>;
3589
+ private setOrthoCamera;
3590
+ private getPerspectiveDims;
3591
+ private setupOrthoCamera;
3592
+ private getDistance;
3593
+ private setPerspectiveCamera;
3594
+ }
3589
3595
  import { BufferGeometry } from "three";
3590
3596
  import * as THREE from "three";
3591
3597
  export declare class TransformHelper {