@thatopen/components 2.0.18 → 2.0.19

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,864 +1,1196 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
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
+ }
9
+ import * as THREE from "three";
10
+ export declare class MaterialsUtils {
11
+ static isTransparent(material: THREE.Material): boolean;
12
+ }
13
+ import * as THREE from "three";
14
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
15
+ center: THREE.Vector3;
16
+ halfSizes: THREE.Vector3;
17
+ rotation: THREE.Matrix3;
18
+ transformation: THREE.Matrix4;
19
+ };
20
+ import * as THREE from "three";
21
+ import { Component, Components, Disposable, Event, World } from "../core";
3
22
  /**
4
- * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
23
+ * Configuration interface for the VertexPicker component.
5
24
  */
6
- export declare class Components implements Disposable {
25
+ export interface VertexPickerConfig {
7
26
  /**
8
- * The version of the @thatopen/components library.
27
+ * If true, only vertices will be picked, not the closest point on the face.
28
+ */
29
+ showOnlyVertex: boolean;
30
+ /**
31
+ * The maximum distance for snapping to a vertex.
32
+ */
33
+ snapDistance: number;
34
+ /**
35
+ * The HTML element to use for previewing the picked vertex.
9
36
  */
10
- static readonly release = "2.0.18";
37
+ previewElement: HTMLElement;
38
+ }
39
+ /**
40
+ * A class that provides functionality for picking vertices in a 3D scene.
41
+ */
42
+ export declare class VertexPicker extends Component implements Disposable {
11
43
  /** {@link Disposable.onDisposed} */
12
- readonly onDisposed: Event<void>;
44
+ readonly onDisposed: Event<unknown>;
13
45
  /**
14
- * The list of components created in this app.
15
- * The keys are UUIDs and the values are instances of the components.
46
+ * An event that is triggered when a vertex is found.
47
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
16
48
  */
17
- readonly list: Map<string, Component>;
49
+ readonly onVertexFound: Event<THREE.Vector3>;
18
50
  /**
19
- * If disabled, the animation loop will be stopped.
20
- * Default value is false.
51
+ * An event that is triggered when a vertex is lost.
52
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
21
53
  */
22
- enabled: boolean;
23
- private _clock;
54
+ readonly onVertexLost: Event<THREE.Vector3>;
24
55
  /**
25
- * Adds a component to the list of components.
26
- * Throws an error if a component with the same UUID already exists.
27
- *
28
- * @param uuid - The unique identifier of the component.
29
- * @param instance - The instance of the component to be added.
30
- *
31
- * @throws Will throw an error if a component with the same UUID already exists.
32
- *
33
- * @internal
56
+ * A reference to the Components instance associated with this VertexPicker.
34
57
  */
35
- add(uuid: string, instance: Component): void;
58
+ components: Components;
36
59
  /**
37
- * Retrieves a component instance by its constructor function.
38
- * If the component does not exist in the list, it will be created and added.
60
+ * A reference to the working plane used for vertex picking.
61
+ * This plane is used to determine which vertices are considered valid for picking.
62
+ * If this value is null, all vertices are considered valid.
63
+ */
64
+ workingPlane: THREE.Plane | null;
65
+ private _pickedPoint;
66
+ private _config;
67
+ private _enabled;
68
+ /**
69
+ * Sets the enabled state of the VertexPicker.
70
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
71
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
39
72
  *
40
- * @template U - The type of the component to retrieve.
41
- * @param Component - The constructor function of the component to retrieve.
73
+ * @param value - The new enabled state.
74
+ */
75
+ set enabled(value: boolean);
76
+ /**
77
+ * Gets the current enabled state of the VertexPicker.
42
78
  *
43
- * @returns The instance of the requested component.
79
+ * @returns The current enabled state.
80
+ */
81
+ get enabled(): boolean;
82
+ /**
83
+ * Sets the configuration for the VertexPicker component.
44
84
  *
45
- * @throws Will throw an error if a component with the same UUID already exists.
85
+ * @param value - A Partial object containing the configuration properties to update.
86
+ * The properties not provided in the value object will retain their current values.
46
87
  *
47
- * @internal
88
+ * @example
89
+ * '''typescript
90
+ * vertexPicker.config = {
91
+ * snapDistance: 0.5,
92
+ * showOnlyVertex: true,
93
+ * };
94
+ * '''
48
95
  */
49
- get<U extends Component>(Component: new (components: Components) => U): U;
50
- constructor();
96
+ set config(value: Partial<VertexPickerConfig>);
51
97
  /**
52
- * Initializes the Components instance.
53
- * This method starts the animation loop, sets the enabled flag to true,
54
- * and calls the update method.
98
+ * Gets the current configuration for the VertexPicker component.
55
99
  *
56
- * @returns {void}
100
+ * @returns A copy of the current VertexPickerConfig object.
101
+ *
102
+ * @example
103
+ * '''typescript
104
+ * const currentConfig = vertexPicker.config;
105
+ * console.log(currentConfig.snapDistance); // Output: 0.25
106
+ * '''
57
107
  */
58
- init(): void;
108
+ get config(): Partial<VertexPickerConfig>;
109
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
110
+ /** {@link Disposable.dispose} */
111
+ dispose(): void;
59
112
  /**
60
- * Disposes the memory of all the components and tools of this instance of
61
- * the library. A memory leak will be created if:
62
- *
63
- * - An instance of the library ends up out of scope and this function isn't
64
- * called. This is especially relevant in Single Page Applications (React,
65
- * Angular, Vue, etc).
113
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
66
114
  *
67
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
68
- * referenced by a reference type (object or array).
115
+ * @param world - The World instance to use for raycasting.
69
116
  *
70
- * You can learn more about how Three.js handles memory leaks
71
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
117
+ * @returns The current picked point, or null if no point is picked.
72
118
  *
119
+ * @remarks
120
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
121
+ * If enabled, it performs raycasting to find the closest intersecting object.
122
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
123
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
124
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
125
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
73
126
  */
74
- dispose(): void;
75
- private update;
76
- private static setupBVH;
127
+ get(world: World): THREE.Vector3 | null;
128
+ private getClosestVertex;
129
+ private getVertices;
130
+ private getVertex;
77
131
  }
78
- import * as THREE from "three";
79
- import { Components } from "../Components";
80
- import { Component } from "../Types";
132
+ import * as WEBIFC from "web-ifc";
133
+ import { FragmentsGroup } from "@thatopen/fragments";
134
+ import { Disposable, Event, Component, Components } from "../../core";
135
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
136
+ export type { InverseAttribute, RelationsMap } from "./src/types";
81
137
  /**
82
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
138
+ * 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).
83
139
  */
84
- export declare class Disposer extends Component {
85
- private _disposedComponents;
86
- /** {@link Component.enabled} */
87
- enabled: boolean;
140
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
88
141
  /**
89
142
  * A unique identifier for the component.
90
143
  * This UUID is used to register the component within the Components system.
91
144
  */
92
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
93
- constructor(components: Components);
94
- /**
95
- * Return the UUIDs of all disposed components.
96
- */
97
- get(): Set<string>;
98
- /**
99
- * Removes a mesh, its geometry and its materials from memory. If you are
100
- * using any of these in other parts of the application, make sure that you
101
- * remove them from the mesh before disposing it.
102
- *
103
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
- * to remove.
105
- *
106
- * @param materials - whether to dispose the materials of the mesh.
107
- *
108
- * @param recursive - whether to recursively dispose the children of the mesh.
109
- */
110
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
145
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
146
+ /** {@link Disposable.onDisposed} */
147
+ readonly onDisposed: Event<string>;
111
148
  /**
112
- * Disposes a geometry from memory.
149
+ * Event triggered when relations for a model have been indexed.
150
+ * This event provides the model's UUID and the relations map generated for that model.
113
151
  *
114
- * @param geometry - the
115
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
- * to remove.
152
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
153
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
154
+ * 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.
117
155
  */
118
- disposeGeometry(geometry: THREE.BufferGeometry): void;
119
- private disposeGeometryAndMaterials;
120
- private disposeChildren;
121
- private static disposeMaterial;
122
- }
123
- import { Component, Disposable, World, Event } from "../Types";
124
- import { SimpleRaycaster } from "./src";
125
- import { Components } from "../Components";
126
- /**
127
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
128
- */
129
- export declare class Raycasters extends Component implements Disposable {
156
+ readonly onRelationsIndexed: Event<{
157
+ modelID: string;
158
+ relationsMap: RelationsMap;
159
+ }>;
130
160
  /**
131
- * A unique identifier for the component.
132
- * This UUID is used to register the component within the Components system.
161
+ * Holds the relationship mappings for each model processed by the indexer.
162
+ * The structure is a map where each key is a model's UUID, and the value is another map.
163
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
164
+ * representing a specific relation type, and the value is an array of expressIDs of entities
165
+ * that are related through that relation type. This structure allows for efficient querying
166
+ * of entity relationships within a model.
133
167
  */
134
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
168
+ readonly relationMaps: ModelsRelationMap;
135
169
  /** {@link Component.enabled} */
136
170
  enabled: boolean;
137
- /**
138
- * A Map that stores raycasters for each world.
139
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
140
- */
141
- list: Map<string, SimpleRaycaster>;
142
- /** {@link Disposable.onDisposed} */
143
- onDisposed: Event<unknown>;
171
+ private _relToAttributesMap;
172
+ private _inverseAttributes;
173
+ private _ifcRels;
144
174
  constructor(components: Components);
175
+ private onFragmentsDisposed;
176
+ private indexRelations;
145
177
  /**
146
- * Retrieves a SimpleRaycaster instance for the given world.
147
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
148
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
178
+ * Adds a relation map to the model's relations map.
149
179
  *
150
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
151
- * @returns The SimpleRaycaster instance for the given world.
180
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
181
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
182
+ *
183
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
152
184
  */
153
- get(world: World): SimpleRaycaster;
185
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
154
186
  /**
155
- * Deletes the SimpleRaycaster instance associated with the given world.
156
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
187
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
188
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
189
+ * and maps them in a structured way to facilitate quick access to related entities.
157
190
  *
158
- * @param world - The world for which to delete the SimpleRaycaster instance.
159
- * @returns {void}
191
+ * The process involves querying the model for each relation type associated with the inverse attributes
192
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
193
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
194
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
195
+ * of entities that are related through that attribute.
196
+ *
197
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
198
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
199
+ * representation of the relations indexed by entity expressIDs and relation types.
200
+ * @throws An error if the model does not have properties loaded.
160
201
  */
161
- delete(world: World): void;
162
- /** {@link Disposable.dispose} */
163
- dispose(): void;
164
- }
165
- import { Component, Disposable, World, Event } from "../Types";
166
- import { GridConfig, SimpleGrid } from "./src";
167
- import { Components } from "../Components";
168
- /**
169
- * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
170
- */
171
- export declare class Grids extends Component implements Disposable {
202
+ process(model: FragmentsGroup): Promise<RelationsMap>;
172
203
  /**
173
- * A unique identifier for the component.
174
- * This UUID is used to register the component within the Components system.
204
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
205
+ *
206
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
207
+ * @param modelID - The unique identifier of the model within the WebIfc API.
208
+ * @returns A promise that resolves to the relations map for the processed model.
209
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
175
210
  */
176
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
211
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
177
212
  /**
178
- * A map of world UUIDs to their corresponding grid instances.
213
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
214
+ * This method searches the indexed relation maps for the specified model and entity,
215
+ * returning the IDs of related entities if a match is found.
216
+ *
217
+ * @param model The 'FragmentsGroup' model containing the entity.
218
+ * @param expressID The unique identifier of the entity within the model.
219
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
220
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
221
+ * or the specified relation name is not indexed.
179
222
  */
180
- list: Map<string, SimpleGrid>;
223
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
181
224
  /**
182
- * The default configuration for grid creation.
225
+ * Serializes the relations of a given relation map into a JSON string.
226
+ * 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,
227
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
228
+ * The resulting object is then serialized into a JSON string.
229
+ *
230
+ * @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.
231
+ * @returns A JSON string representing the serialized relations of the given relation map.
183
232
  */
184
- config: Required<GridConfig>;
185
- /** {@link Disposable.onDisposed} */
186
- readonly onDisposed: Event<unknown>;
187
- /** {@link Component.enabled} */
188
- enabled: boolean;
189
- constructor(components: Components);
233
+ serializeRelations(relationMap: RelationsMap): string;
190
234
  /**
191
- * Creates a new grid for the given world.
192
- * Throws an error if a grid already exists for the world.
193
- *
194
- * @param world - The world to create the grid for.
195
- * @returns The newly created grid.
235
+ * Serializes the relations of a specific model into a JSON string.
236
+ * This method iterates through the relations indexed for the given model,
237
+ * organizing them into a structured object where each key is an expressID of an entity,
238
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
239
+ * The resulting object is then serialized into a JSON string.
196
240
  *
197
- * @throws Will throw an error if a grid already exists for the given world.
241
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
242
+ * @returns A JSON string representing the serialized relations of the specified model.
243
+ * If the model has no indexed relations, 'null' is returned.
198
244
  */
199
- create(world: World): SimpleGrid;
245
+ serializeModelRelations(model: FragmentsGroup): string | null;
200
246
  /**
201
- * Deletes the grid associated with the given world.
202
- * If a grid does not exist for the given world, this method does nothing.
247
+ * Serializes all relations of every model processed by the indexer into a JSON string.
248
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
249
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
250
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
251
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
203
252
  *
204
- * @param world - The world for which to delete the grid.
253
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
254
+ * If no relations have been indexed, an empty object is returned as a JSON string.
255
+ */
256
+ serializeAllRelations(): string;
257
+ /**
258
+ * Converts a JSON string representing relations between entities into a structured map.
259
+ * This method parses the JSON string to reconstruct the relations map that indexes
260
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
261
+ * and the values are maps where each key is a relation type ID and its value is an array
262
+ * of express IDs of entities related through that relation type.
205
263
  *
206
- * @remarks
207
- * This method will dispose of the grid and remove it from the internal list.
208
- * If the world is disposed before calling this method, the grid will be automatically deleted.
264
+ * @param json The JSON string to be parsed into the relations map.
265
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
266
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
267
+ * is an array of express IDs (as numbers) of entities related through that relation type.
209
268
  */
210
- delete(world: World): void;
269
+ getRelationsMapFromJSON(json: string): RelationsMap;
211
270
  /** {@link Disposable.dispose} */
212
271
  dispose(): void;
213
272
  }
214
- import * as THREE from "three";
215
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
216
- import { SimplePlane } from "./src";
217
- import { Components } from "../Components";
273
+ import * as WEBIFC from "web-ifc";
274
+ import { FragmentsGroup } from "@thatopen/fragments";
275
+ import { Component, Disposable, Event, Components } from "../../core";
218
276
  /**
219
- * 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).
220
- *
221
- * @param components - the instance of {@link Components} used.
222
- * E.g. {@link SimplePlane}.
277
+ * Types for boolean properties in IFC schema.
223
278
  */
224
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
279
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
280
+ /**
281
+ * Types for string properties in IFC schema.
282
+ */
283
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
284
+ /**
285
+ * Types for numeric properties in IFC schema.
286
+ */
287
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
288
+ /**
289
+ * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
290
+ */
291
+ export interface ChangeMap {
292
+ [modelID: string]: Set<number>;
293
+ }
294
+ /**
295
+ * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
296
+ */
297
+ export interface AttributeListener {
298
+ [modelID: string]: {
299
+ [expressID: number]: {
300
+ [attributeName: string]: Event<String | Boolean | Number>;
301
+ };
302
+ };
303
+ }
304
+ /**
305
+ * Component to manage and edit properties and Psets in IFC files.
306
+ */
307
+ export declare class IfcPropertiesManager extends Component implements Disposable {
225
308
  /**
226
309
  * A unique identifier for the component.
227
310
  * This UUID is used to register the component within the Components system.
228
311
  */
229
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
230
- /** Event that fires when the user starts dragging a clipping plane. */
231
- readonly onBeforeDrag: Event<void>;
232
- /** Event that fires when the user stops dragging a clipping plane. */
233
- readonly onAfterDrag: Event<void>;
312
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
313
+ /** {@link Disposable.onDisposed} */
314
+ readonly onDisposed: Event<string>;
234
315
  /**
235
- * Event that fires when the user starts creating a clipping plane.
316
+ * Event triggered when a file is requested for export.
236
317
  */
237
- readonly onBeforeCreate: Event<unknown>;
318
+ readonly onRequestFile: Event<unknown>;
238
319
  /**
239
- * Event that fires when the user cancels the creation of a clipping plane.
320
+ * ArrayBuffer containing the IFC data to be exported.
240
321
  */
241
- readonly onBeforeCancel: Event<unknown>;
322
+ ifcToExport: ArrayBuffer | null;
242
323
  /**
243
- * Event that fires after the user cancels the creation of a clipping plane.
324
+ * Event triggered when an element is added to a Pset.
244
325
  */
245
- readonly onAfterCancel: Event<unknown>;
326
+ readonly onElementToPset: Event<{
327
+ model: FragmentsGroup;
328
+ psetID: number;
329
+ elementID: number;
330
+ }>;
246
331
  /**
247
- * Event that fires when the user starts deleting a clipping plane.
332
+ * Event triggered when a property is added to a Pset.
248
333
  */
249
- readonly onBeforeDelete: Event<unknown>;
334
+ readonly onPropToPset: Event<{
335
+ model: FragmentsGroup;
336
+ psetID: number;
337
+ propID: number;
338
+ }>;
250
339
  /**
251
- * Event that fires after a clipping plane has been created.
252
- * @param plane - The newly created clipping plane.
340
+ * Event triggered when a Pset is removed.
253
341
  */
254
- readonly onAfterCreate: Event<SimplePlane>;
342
+ readonly onPsetRemoved: Event<{
343
+ model: FragmentsGroup;
344
+ psetID: number;
345
+ }>;
255
346
  /**
256
- * Event that fires after a clipping plane has been deleted.
257
- * @param plane - The deleted clipping plane.
347
+ * Event triggered when data in the model changes.
258
348
  */
259
- readonly onAfterDelete: Event<SimplePlane>;
260
- /** {@link Disposable.onDisposed} */
261
- readonly onDisposed: Event<string>;
349
+ readonly onDataChanged: Event<{
350
+ model: FragmentsGroup;
351
+ expressID: number;
352
+ }>;
262
353
  /**
263
- * Whether to force the clipping plane to be orthogonal in the Y direction
264
- * (up). This is desirable when clipping a building horizontally and a
265
- * clipping plane is created in its roof, which might have a slight
266
- * slope for draining purposes.
354
+ * Configuration for the WebAssembly module.
267
355
  */
268
- orthogonalY: boolean;
356
+ wasm: {
357
+ path: string;
358
+ absolute: boolean;
359
+ };
360
+ /** {@link Component.enabled} */
361
+ enabled: boolean;
269
362
  /**
270
- * The tolerance that determines whether an almost-horizontal clipping plane
271
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
272
- * has to be 'true' for this to apply.
363
+ * Map of attribute listeners.
273
364
  */
274
- toleranceOrthogonalY: number;
365
+ attributeListeners: AttributeListener;
275
366
  /**
276
- * The type of clipping plane to be created.
277
- * Default is {@link SimplePlane}.
367
+ * The currently selected model.
278
368
  */
279
- Type: new (...args: any) => SimplePlane;
369
+ selectedModel?: FragmentsGroup;
280
370
  /**
281
- * A list of all the clipping planes created by this component.
371
+ * Map of changed entities in the model.
282
372
  */
283
- list: SimplePlane[];
284
- /** The material used in all the clipping planes. */
285
- private _material;
286
- private _size;
287
- private _enabled;
288
- private _visible;
289
- /** {@link Component.enabled} */
290
- get enabled(): boolean;
291
- /** {@link Component.enabled} */
292
- set enabled(state: boolean);
293
- /** {@link Hideable.visible } */
294
- get visible(): boolean;
295
- /** {@link Hideable.visible } */
296
- set visible(state: boolean);
297
- /** The material of the clipping plane representation. */
298
- get material(): THREE.MeshBasicMaterial;
299
- /** The material of the clipping plane representation. */
300
- set material(material: THREE.MeshBasicMaterial);
301
- /** The size of the geometric representation of the clippings planes. */
302
- get size(): number;
303
- /** The size of the geometric representation of the clippings planes. */
304
- set size(size: number);
373
+ changeMap: ChangeMap;
305
374
  constructor(components: Components);
306
375
  /** {@link Disposable.dispose} */
307
376
  dispose(): void;
308
- /** {@link Createable.create} */
309
- create(world: World): void;
310
377
  /**
311
- * Creates a plane in a certain place and with a certain orientation,
312
- * without the need of the mouse.
378
+ * Static method to retrieve the IFC schema from a given model.
313
379
  *
314
- * @param world - the world where this plane should be created.
315
- * @param normal - the orientation of the clipping plane.
316
- * @param point - the position of the clipping plane.
317
- * navigation.
380
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
381
+ * @throws Will throw an error if the IFC schema is not found in the model.
382
+ * @returns The IFC schema associated with the given model.
318
383
  */
319
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
384
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
320
385
  /**
321
- * {@link Createable.delete}
386
+ * Method to set properties data in the model.
322
387
  *
323
- * @param world - the world where the plane to delete is.
324
- * @param plane - the plane to delete. If undefined, the first plane
325
- * found under the cursor will be deleted.
388
+ * @param model - The FragmentsGroup model in which to set the properties.
389
+ * @param dataToSave - An array of objects representing the properties to be saved.
390
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
391
+ * The rest of the properties will be set as the properties of the entity.
392
+ *
393
+ * @returns {Promise<void>} A promise that resolves when all the properties have been set.
394
+ *
395
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
326
396
  */
327
- delete(world: World, plane?: SimplePlane): void;
328
- /** Deletes all the existing clipping planes. */
329
- deleteAll(): void;
330
- private deletePlane;
331
- private pickPlane;
332
- private getAllPlaneMeshes;
333
- private createPlaneFromIntersection;
334
- private getWorldNormal;
335
- private normalizePlaneDirectionY;
336
- private newPlane;
337
- private updateMaterialsAndPlanes;
338
- private _onStartDragging;
339
- private _onEndDragging;
340
- }
341
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
342
- import { Components } from "../Components";
343
- import { SimpleWorld } from "./src";
344
- /**
345
- * 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).
346
- */
347
- export declare class Worlds extends Component implements Updateable, Disposable {
397
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
348
398
  /**
349
- * A unique identifier for the component.
350
- * This UUID is used to register the component within the Components system.
399
+ * Creates a new Property Set (Pset) in the given model.
400
+ *
401
+ * @param model - The FragmentsGroup model in which to create the Pset.
402
+ * @param name - The name of the Pset.
403
+ * @param description - (Optional) The description of the Pset.
404
+ *
405
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
406
+ *
407
+ * @throws Will throw an error if the IFC schema is not found in the model.
408
+ * @throws Will throw an error if no OwnerHistory is found in the model.
351
409
  */
352
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
353
- /** {@link Updateable.onAfterUpdate} */
354
- readonly onAfterUpdate: Event<unknown>;
355
- /** {@link Updateable.onBeforeUpdate} */
356
- readonly onBeforeUpdate: Event<unknown>;
357
- /** {@link Disposable.onDisposed} */
358
- readonly onDisposed: Event<unknown>;
410
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
411
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
412
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
413
+ }>;
359
414
  /**
360
- * An event that is triggered when a new world is created.
361
- * The event passes the newly created world as a parameter.
415
+ * Removes a Property Set (Pset) from the given model.
416
+ *
417
+ * @param model - The FragmentsGroup model from which to remove the Pset.
418
+ * @param psetID - The express IDs of the Psets to be removed.
419
+ *
420
+ * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
421
+ *
422
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
423
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
424
+ * @throws Will throw an error if no relation is found between the Pset and the model.
362
425
  */
363
- readonly onWorldCreated: Event<World>;
426
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
364
427
  /**
365
- * An event that is triggered when a world is deleted.
366
- * The event passes the UUID of the deleted world as a parameter.
428
+ * Creates a new single-value property of type string in the given model.
429
+ *
430
+ * @param model - The FragmentsGroup model in which to create the property.
431
+ * @param type - The type of the property value. Must be a string property type.
432
+ * @param name - The name of the property.
433
+ * @param value - The value of the property. Must be a string.
434
+ *
435
+ * @returns The newly created single-value property.
436
+ *
437
+ * @throws Will throw an error if the IFC schema is not found in the model.
438
+ * @throws Will throw an error if no OwnerHistory is found in the model.
367
439
  */
368
- readonly onWorldDeleted: Event<string>;
440
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
369
441
  /**
370
- * A collection of worlds managed by this component.
371
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
442
+ * Creates a new single-value property of type numeric in the given model.
443
+ *
444
+ * @param model - The FragmentsGroup model in which to create the property.
445
+ * @param type - The type of the property value. Must be a numeric property type.
446
+ * @param name - The name of the property.
447
+ * @param value - The value of the property. Must be a number.
448
+ *
449
+ * @returns The newly created single-value property.
450
+ *
451
+ * @throws Will throw an error if the IFC schema is not found in the model.
452
+ * @throws Will throw an error if no OwnerHistory is found in the model.
372
453
  */
373
- list: Map<string, World>;
374
- /** {@link Component.enabled} */
375
- enabled: boolean;
376
- constructor(components: Components);
454
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
377
455
  /**
378
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
456
+ * Creates a new single-value property of type boolean in the given model.
379
457
  *
380
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
381
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
382
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
458
+ * @param model - The FragmentsGroup model in which to create the property.
459
+ * @param type - The type of the property value. Must be a boolean property type.
460
+ * @param name - The name of the property.
461
+ * @param value - The value of the property. Must be a boolean.
383
462
  *
384
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
463
+ * @returns The newly created single-value property.
464
+ *
465
+ * @throws Will throw an error if the IFC schema is not found in the model.
466
+ * @throws Will throw an error if no OwnerHistory is found in the model.
385
467
  */
386
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
468
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
387
469
  /**
388
- * Deletes a world from the list of worlds.
470
+ * Removes a property from a Property Set (Pset) in the given model.
389
471
  *
390
- * @param {World} world - The world to be deleted.
472
+ * @param model - The FragmentsGroup model from which to remove the property.
473
+ * @param psetID - The express ID of the Pset from which to remove the property.
474
+ * @param propID - The express ID of the property to be removed.
391
475
  *
392
- * @throws {Error} - Throws an error if the provided world is not found in the list.
476
+ * @returns {Promise<void>} A promise that resolves when the property has been removed.
393
477
  *
394
- * @returns {void}
478
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
479
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
395
480
  */
396
- delete(world: World): void;
481
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
482
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
397
483
  /**
398
- * Disposes of the Worlds component and all its managed worlds.
399
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
400
- * and triggers the onDisposed event.
484
+ * Adds elements to a Property Set (Pset) in the given model.
401
485
  *
402
- * @returns {void}
486
+ * @param model - The FragmentsGroup model in which to add the elements.
487
+ * @param psetID - The express ID of the Pset to which to add the elements.
488
+ * @param elementID - The express IDs of the elements to be added.
489
+ *
490
+ * @returns {Promise<void>} A promise that resolves when all the elements have been added.
491
+ *
492
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
493
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
494
+ * @throws Will throw an error if no relation is found between the Pset and the model.
403
495
  */
404
- dispose(): void;
405
- /** {@link Updateable.update} */
406
- update(delta?: number): void | Promise<void>;
496
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
497
+ /**
498
+ * Saves the changes made to the model to a new IFC file.
499
+ *
500
+ * @param model - The FragmentsGroup model from which to save the changes.
501
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
502
+ *
503
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
504
+ *
505
+ * @throws Will throw an error if any issues occur during the saving process.
506
+ */
507
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
508
+ /**
509
+ * Sets an attribute listener for a specific attribute of an entity in the model.
510
+ * The listener will trigger an event whenever the attribute's value changes.
511
+ *
512
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
513
+ * @param expressID - The express ID of the entity for which to set the listener.
514
+ * @param attributeName - The name of the attribute for which to set the listener.
515
+ *
516
+ * @returns The event that will be triggered when the attribute's value changes.
517
+ *
518
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
519
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
520
+ * @throws Will throw an error if the attribute has a badly defined handle.
521
+ */
522
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
523
+ private increaseMaxID;
524
+ private newGUID;
525
+ private getOwnerHistory;
526
+ private registerChange;
527
+ private newSingleProperty;
407
528
  }
408
- import { MiniMap } from "./src";
409
- import { Component, Updateable, World, Event, Disposable } from "../Types";
410
- import { Components } from "../Components";
529
+ import * as WEBIFC from "web-ifc";
530
+ import * as FRAG from "@thatopen/fragments";
531
+ import { Component, Components } from "../../core";
411
532
  /**
412
- * 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).
533
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
413
534
  */
414
- export declare class MiniMaps extends Component implements Updateable, Disposable {
535
+ export declare class IfcJsonExporter extends Component {
415
536
  /**
416
537
  * A unique identifier for the component.
417
538
  * This UUID is used to register the component within the Components system.
418
539
  */
419
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
420
- /** {@link Updateable.onAfterUpdate} */
421
- readonly onAfterUpdate: Event<unknown>;
422
- /** {@link Updateable.onBeforeUpdate} */
423
- readonly onBeforeUpdate: Event<unknown>;
424
- /** {@link Disposable.onDisposed} */
425
- readonly onDisposed: Event<unknown>;
540
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
426
541
  /** {@link Component.enabled} */
427
542
  enabled: boolean;
428
- /**
429
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
430
- */
431
- list: Map<string, MiniMap>;
432
543
  constructor(components: Components);
433
544
  /**
434
- * Creates a new {@link MiniMap} instance associated with the given world.
435
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
436
- *
437
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
438
- * @returns The newly created {@link MiniMap} instance.
439
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
440
- */
441
- create(world: World): MiniMap;
442
- /**
443
- * Deletes a {@link MiniMap} instance associated with the given world ID.
444
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
445
- *
446
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
447
- * @returns {void}
545
+ * Exports all the properties of an IFC into an array of JS objects.
546
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
547
+ * @param modelID ID of the IFC model whose properties to extract.
548
+ * @param indirect whether to get the indirect relationships as well.
549
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
550
+ * to make the location data available (e.g. absolute position of building).
448
551
  */
449
- delete(id: string): void;
450
- /** {@link Disposable.dispose} */
451
- dispose(): void;
452
- /** {@link Updateable.update} */
453
- update(): void;
552
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
454
553
  }
554
+ import * as THREE from "three";
455
555
  import { Components } from "../Components";
456
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
457
- import { Component, Event, Disposable, World } from "../Types";
556
+ import { Component } from "../Types";
458
557
  /**
459
- * 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).
558
+ * 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).
460
559
  */
461
- export declare class Cullers extends Component implements Disposable {
560
+ export declare class Disposer extends Component {
561
+ private _disposedComponents;
562
+ /** {@link Component.enabled} */
563
+ enabled: boolean;
462
564
  /**
463
565
  * A unique identifier for the component.
464
566
  * This UUID is used to register the component within the Components system.
465
567
  */
466
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
568
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
569
+ constructor(components: Components);
467
570
  /**
468
- * An event that is triggered when the Cullers component is disposed.
571
+ * Return the UUIDs of all disposed components.
469
572
  */
470
- readonly onDisposed: Event<unknown>;
471
- private _enabled;
573
+ get(): Set<string>;
472
574
  /**
473
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
474
- */
475
- list: Map<string, MeshCullerRenderer>;
476
- /** {@link Component.enabled} */
477
- get enabled(): boolean;
575
+ * Removes a mesh, its geometry and its materials from memory. If you are
576
+ * using any of these in other parts of the application, make sure that you
577
+ * remove them from the mesh before disposing it.
578
+ *
579
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
580
+ * to remove.
581
+ *
582
+ * @param materials - whether to dispose the materials of the mesh.
583
+ *
584
+ * @param recursive - whether to recursively dispose the children of the mesh.
585
+ */
586
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
587
+ /**
588
+ * Disposes a geometry from memory.
589
+ *
590
+ * @param geometry - the
591
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
592
+ * to remove.
593
+ */
594
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
595
+ private disposeGeometryAndMaterials;
596
+ private disposeChildren;
597
+ private static disposeMaterial;
598
+ }
599
+ import { Component, Disposable, World, Event } from "../Types";
600
+ import { SimpleRaycaster } from "./src";
601
+ import { Components } from "../Components";
602
+ /**
603
+ * 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).
604
+ */
605
+ export declare class Raycasters extends Component implements Disposable {
606
+ /**
607
+ * A unique identifier for the component.
608
+ * This UUID is used to register the component within the Components system.
609
+ */
610
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
478
611
  /** {@link Component.enabled} */
479
- set enabled(value: boolean);
612
+ enabled: boolean;
613
+ /**
614
+ * A Map that stores raycasters for each world.
615
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
616
+ */
617
+ list: Map<string, SimpleRaycaster>;
618
+ /** {@link Disposable.onDisposed} */
619
+ onDisposed: Event<unknown>;
480
620
  constructor(components: Components);
481
621
  /**
482
- * Creates a new MeshCullerRenderer for the given world.
483
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
484
- *
485
- * @param world - The world for which to create the MeshCullerRenderer.
486
- * @param config - Optional configuration settings for the MeshCullerRenderer.
622
+ * Retrieves a SimpleRaycaster instance for the given world.
623
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
624
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
487
625
  *
488
- * @returns The newly created or existing MeshCullerRenderer for the given world.
626
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
627
+ * @returns The SimpleRaycaster instance for the given world.
489
628
  */
490
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
629
+ get(world: World): SimpleRaycaster;
491
630
  /**
492
- * Deletes the MeshCullerRenderer associated with the given world.
493
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
494
- *
495
- * @param world - The world for which to delete the MeshCullerRenderer.
631
+ * Deletes the SimpleRaycaster instance associated with the given world.
632
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
496
633
  *
634
+ * @param world - The world for which to delete the SimpleRaycaster instance.
497
635
  * @returns {void}
498
636
  */
499
637
  delete(world: World): void;
500
638
  /** {@link Disposable.dispose} */
501
639
  dispose(): void;
502
640
  }
503
- import * as THREE from "three";
504
- import { Components } from "../Components";
505
- import { SimpleCamera } from "..";
506
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
641
+ import { Component, Disposable, Event } from "../Types";
507
642
  /**
508
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
643
+ * 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.
509
644
  */
510
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
645
+ export declare class Components implements Disposable {
511
646
  /**
512
- * A ProjectionManager instance that manages the projection modes of the camera.
647
+ * The version of the @thatopen/components library.
513
648
  */
514
- readonly projection: ProjectionManager;
649
+ static readonly release = "2.0.19";
650
+ /** {@link Disposable.onDisposed} */
651
+ readonly onDisposed: Event<void>;
515
652
  /**
516
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
517
- * This camera is used when the projection mode is set to orthographic.
653
+ * The list of components created in this app.
654
+ * The keys are UUIDs and the values are instances of the components.
518
655
  */
519
- readonly threeOrtho: THREE.OrthographicCamera;
656
+ readonly list: Map<string, Component>;
520
657
  /**
521
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
522
- * This camera is used when the projection mode is set to perspective.
658
+ * If disabled, the animation loop will be stopped.
659
+ * Default value is false.
523
660
  */
524
- readonly threePersp: THREE.PerspectiveCamera;
525
- protected readonly _userInputButtons: any;
526
- protected readonly _frustumSize = 50;
527
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
528
- protected _mode: NavigationMode | null;
529
- private previousSize;
661
+ enabled: boolean;
662
+ private _clock;
530
663
  /**
531
- * Getter for the current navigation mode.
532
- * Throws an error if the mode is not found or the camera is not initialized.
664
+ * Adds a component to the list of components.
665
+ * Throws an error if a component with the same UUID already exists.
533
666
  *
534
- * @returns {NavigationMode} The current navigation mode.
667
+ * @param uuid - The unique identifier of the component.
668
+ * @param instance - The instance of the component to be added.
535
669
  *
536
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
670
+ * @throws Will throw an error if a component with the same UUID already exists.
671
+ *
672
+ * @internal
537
673
  */
538
- get mode(): NavigationMode;
539
- constructor(components: Components);
540
- /** {@link Disposable.dispose} */
541
- dispose(): void;
674
+ add(uuid: string, instance: Component): void;
542
675
  /**
543
- * Sets a new {@link NavigationMode} and disables the previous one.
676
+ * Retrieves a component instance by its constructor function.
677
+ * If the component does not exist in the list, it will be created and added.
544
678
  *
545
- * @param mode - The {@link NavigationMode} to set.
679
+ * @template U - The type of the component to retrieve.
680
+ * @param Component - The constructor function of the component to retrieve.
681
+ *
682
+ * @returns The instance of the requested component.
683
+ *
684
+ * @throws Will throw an error if a component with the same UUID already exists.
685
+ *
686
+ * @internal
546
687
  */
547
- set(mode: NavModeID): void;
688
+ get<U extends Component>(Component: new (components: Components) => U): U;
689
+ constructor();
548
690
  /**
549
- * Make the camera view fit all the specified meshes.
691
+ * Initializes the Components instance.
692
+ * This method starts the animation loop, sets the enabled flag to true,
693
+ * and calls the update method.
550
694
  *
551
- * @param meshes the meshes to fit. If it is not defined, it will
552
- * evaluate {@link Components.meshes}.
553
- * @param offset the distance to the fit object
695
+ * @returns {void}
554
696
  */
555
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
697
+ init(): void;
556
698
  /**
557
- * Allows or prevents all user input.
699
+ * Disposes the memory of all the components and tools of this instance of
700
+ * the library. A memory leak will be created if:
701
+ *
702
+ * - An instance of the library ends up out of scope and this function isn't
703
+ * called. This is especially relevant in Single Page Applications (React,
704
+ * Angular, Vue, etc).
705
+ *
706
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
707
+ * referenced by a reference type (object or array).
708
+ *
709
+ * You can learn more about how Three.js handles memory leaks
710
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
558
711
  *
559
- * @param active - whether to enable or disable user inputs.
560
712
  */
561
- setUserInput(active: boolean): void;
562
- private disableUserInput;
563
- private enableUserInput;
564
- private newOrthoCamera;
565
- private setOrthoPerspCameraAspect;
566
- }
567
- import * as THREE from "three";
568
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
569
- center: THREE.Vector3;
570
- halfSizes: THREE.Vector3;
571
- rotation: THREE.Matrix3;
572
- transformation: THREE.Matrix4;
573
- };
574
- import * as THREE from "three";
575
- export declare class MaterialsUtils {
576
- static isTransparent(material: THREE.Material): boolean;
577
- }
578
- export declare class UUID {
579
- private static _pattern;
580
- private static _lut;
581
- static create(): string;
582
- static validate(uuid: string): void;
713
+ dispose(): void;
714
+ private update;
715
+ private static setupBVH;
583
716
  }
584
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
585
- import * as THREE from "three";
586
- import { Component, Components, Disposable, Event, World } from "../core";
717
+ import { MiniMap } from "./src";
718
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
719
+ import { Components } from "../Components";
587
720
  /**
588
- * Configuration interface for the VertexPicker component.
721
+ * 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).
589
722
  */
590
- export interface VertexPickerConfig {
723
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
591
724
  /**
592
- * If true, only vertices will be picked, not the closest point on the face.
725
+ * A unique identifier for the component.
726
+ * This UUID is used to register the component within the Components system.
593
727
  */
594
- showOnlyVertex: boolean;
728
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
729
+ /** {@link Updateable.onAfterUpdate} */
730
+ readonly onAfterUpdate: Event<unknown>;
731
+ /** {@link Updateable.onBeforeUpdate} */
732
+ readonly onBeforeUpdate: Event<unknown>;
733
+ /** {@link Disposable.onDisposed} */
734
+ readonly onDisposed: Event<unknown>;
735
+ /** {@link Component.enabled} */
736
+ enabled: boolean;
595
737
  /**
596
- * The maximum distance for snapping to a vertex.
738
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
597
739
  */
598
- snapDistance: number;
740
+ list: Map<string, MiniMap>;
741
+ constructor(components: Components);
599
742
  /**
600
- * The HTML element to use for previewing the picked vertex.
743
+ * Creates a new {@link MiniMap} instance associated with the given world.
744
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
745
+ *
746
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
747
+ * @returns The newly created {@link MiniMap} instance.
748
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
601
749
  */
602
- previewElement: HTMLElement;
750
+ create(world: World): MiniMap;
751
+ /**
752
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
753
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
754
+ *
755
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
756
+ * @returns {void}
757
+ */
758
+ delete(id: string): void;
759
+ /** {@link Disposable.dispose} */
760
+ dispose(): void;
761
+ /** {@link Updateable.update} */
762
+ update(): void;
603
763
  }
764
+ import * as THREE from "three";
765
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
766
+ import { SimplePlane } from "./src";
767
+ import { Components } from "../Components";
604
768
  /**
605
- * A class that provides functionality for picking vertices in a 3D scene.
769
+ * 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).
770
+ *
771
+ * @param components - the instance of {@link Components} used.
772
+ * E.g. {@link SimplePlane}.
606
773
  */
607
- export declare class VertexPicker extends Component implements Disposable {
608
- /** {@link Disposable.onDisposed} */
609
- readonly onDisposed: Event<unknown>;
774
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
610
775
  /**
611
- * An event that is triggered when a vertex is found.
612
- * The event passes a THREE.Vector3 representing the position of the found vertex.
776
+ * A unique identifier for the component.
777
+ * This UUID is used to register the component within the Components system.
613
778
  */
614
- readonly onVertexFound: Event<THREE.Vector3>;
779
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
780
+ /** Event that fires when the user starts dragging a clipping plane. */
781
+ readonly onBeforeDrag: Event<void>;
782
+ /** Event that fires when the user stops dragging a clipping plane. */
783
+ readonly onAfterDrag: Event<void>;
615
784
  /**
616
- * An event that is triggered when a vertex is lost.
617
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
785
+ * Event that fires when the user starts creating a clipping plane.
618
786
  */
619
- readonly onVertexLost: Event<THREE.Vector3>;
787
+ readonly onBeforeCreate: Event<unknown>;
620
788
  /**
621
- * A reference to the Components instance associated with this VertexPicker.
789
+ * Event that fires when the user cancels the creation of a clipping plane.
622
790
  */
623
- components: Components;
791
+ readonly onBeforeCancel: Event<unknown>;
624
792
  /**
625
- * A reference to the working plane used for vertex picking.
626
- * This plane is used to determine which vertices are considered valid for picking.
627
- * If this value is null, all vertices are considered valid.
793
+ * Event that fires after the user cancels the creation of a clipping plane.
628
794
  */
629
- workingPlane: THREE.Plane | null;
630
- private _pickedPoint;
631
- private _config;
632
- private _enabled;
795
+ readonly onAfterCancel: Event<unknown>;
633
796
  /**
634
- * Sets the enabled state of the VertexPicker.
635
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
636
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
637
- *
638
- * @param value - The new enabled state.
797
+ * Event that fires when the user starts deleting a clipping plane.
639
798
  */
640
- set enabled(value: boolean);
799
+ readonly onBeforeDelete: Event<unknown>;
641
800
  /**
642
- * Gets the current enabled state of the VertexPicker.
643
- *
644
- * @returns The current enabled state.
801
+ * Event that fires after a clipping plane has been created.
802
+ * @param plane - The newly created clipping plane.
645
803
  */
646
- get enabled(): boolean;
804
+ readonly onAfterCreate: Event<SimplePlane>;
647
805
  /**
648
- * Sets the configuration for the VertexPicker component.
649
- *
650
- * @param value - A Partial object containing the configuration properties to update.
651
- * The properties not provided in the value object will retain their current values.
652
- *
653
- * @example
654
- * '''typescript
655
- * vertexPicker.config = {
656
- * snapDistance: 0.5,
657
- * showOnlyVertex: true,
658
- * };
659
- * '''
806
+ * Event that fires after a clipping plane has been deleted.
807
+ * @param plane - The deleted clipping plane.
660
808
  */
661
- set config(value: Partial<VertexPickerConfig>);
809
+ readonly onAfterDelete: Event<SimplePlane>;
810
+ /** {@link Disposable.onDisposed} */
811
+ readonly onDisposed: Event<string>;
662
812
  /**
663
- * Gets the current configuration for the VertexPicker component.
664
- *
665
- * @returns A copy of the current VertexPickerConfig object.
666
- *
667
- * @example
668
- * '''typescript
669
- * const currentConfig = vertexPicker.config;
670
- * console.log(currentConfig.snapDistance); // Output: 0.25
671
- * '''
813
+ * Whether to force the clipping plane to be orthogonal in the Y direction
814
+ * (up). This is desirable when clipping a building horizontally and a
815
+ * clipping plane is created in its roof, which might have a slight
816
+ * slope for draining purposes.
672
817
  */
673
- get config(): Partial<VertexPickerConfig>;
674
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
818
+ orthogonalY: boolean;
819
+ /**
820
+ * The tolerance that determines whether an almost-horizontal clipping plane
821
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
822
+ * has to be 'true' for this to apply.
823
+ */
824
+ toleranceOrthogonalY: number;
825
+ /**
826
+ * The type of clipping plane to be created.
827
+ * Default is {@link SimplePlane}.
828
+ */
829
+ Type: new (...args: any) => SimplePlane;
830
+ /**
831
+ * A list of all the clipping planes created by this component.
832
+ */
833
+ list: SimplePlane[];
834
+ /** The material used in all the clipping planes. */
835
+ private _material;
836
+ private _size;
837
+ private _enabled;
838
+ private _visible;
839
+ /** {@link Component.enabled} */
840
+ get enabled(): boolean;
841
+ /** {@link Component.enabled} */
842
+ set enabled(state: boolean);
843
+ /** {@link Hideable.visible } */
844
+ get visible(): boolean;
845
+ /** {@link Hideable.visible } */
846
+ set visible(state: boolean);
847
+ /** The material of the clipping plane representation. */
848
+ get material(): THREE.MeshBasicMaterial;
849
+ /** The material of the clipping plane representation. */
850
+ set material(material: THREE.MeshBasicMaterial);
851
+ /** The size of the geometric representation of the clippings planes. */
852
+ get size(): number;
853
+ /** The size of the geometric representation of the clippings planes. */
854
+ set size(size: number);
855
+ constructor(components: Components);
675
856
  /** {@link Disposable.dispose} */
676
857
  dispose(): void;
858
+ /** {@link Createable.create} */
859
+ create(world: World): void;
677
860
  /**
678
- * Performs the vertex picking operation based on the current state of the VertexPicker.
679
- *
680
- * @param world - The World instance to use for raycasting.
861
+ * Creates a plane in a certain place and with a certain orientation,
862
+ * without the need of the mouse.
681
863
  *
682
- * @returns The current picked point, or null if no point is picked.
864
+ * @param world - the world where this plane should be created.
865
+ * @param normal - the orientation of the clipping plane.
866
+ * @param point - the position of the clipping plane.
867
+ * navigation.
868
+ */
869
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
870
+ /**
871
+ * {@link Createable.delete}
683
872
  *
684
- * @remarks
685
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
686
- * If enabled, it performs raycasting to find the closest intersecting object.
687
- * It then determines the closest vertex or point on the face, based on the configuration settings.
688
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
689
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
690
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
873
+ * @param world - the world where the plane to delete is.
874
+ * @param plane - the plane to delete. If undefined, the first plane
875
+ * found under the cursor will be deleted.
691
876
  */
692
- get(world: World): THREE.Vector3 | null;
693
- private getClosestVertex;
694
- private getVertices;
695
- private getVertex;
877
+ delete(world: World, plane?: SimplePlane): void;
878
+ /** Deletes all the existing clipping planes. */
879
+ deleteAll(): void;
880
+ private deletePlane;
881
+ private pickPlane;
882
+ private getAllPlaneMeshes;
883
+ private createPlaneFromIntersection;
884
+ private getWorldNormal;
885
+ private normalizePlaneDirectionY;
886
+ private newPlane;
887
+ private updateMaterialsAndPlanes;
888
+ private _onStartDragging;
889
+ private _onEndDragging;
696
890
  }
697
- import * as WEBIFC from "web-ifc";
698
- import { FragmentsGroup } from "@thatopen/fragments";
699
- import { Disposable, Event, Component, Components } from "../../core";
700
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
701
- export type { InverseAttribute, RelationsMap } from "./src/types";
891
+ import { Component, Disposable, World, Event } from "../Types";
892
+ import { GridConfig, SimpleGrid } from "./src";
893
+ import { Components } from "../Components";
702
894
  /**
703
- * 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).
895
+ * 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).
704
896
  */
705
- export declare class IfcRelationsIndexer extends Component implements Disposable {
897
+ export declare class Grids extends Component implements Disposable {
706
898
  /**
707
899
  * A unique identifier for the component.
708
900
  * This UUID is used to register the component within the Components system.
709
901
  */
710
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
711
- /** {@link Disposable.onDisposed} */
712
- readonly onDisposed: Event<string>;
902
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
713
903
  /**
714
- * Event triggered when relations for a model have been indexed.
715
- * This event provides the model's UUID and the relations map generated for that model.
716
- *
717
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
718
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
719
- * 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.
904
+ * A map of world UUIDs to their corresponding grid instances.
720
905
  */
721
- readonly onRelationsIndexed: Event<{
722
- modelID: string;
723
- relationsMap: RelationsMap;
724
- }>;
906
+ list: Map<string, SimpleGrid>;
725
907
  /**
726
- * Holds the relationship mappings for each model processed by the indexer.
727
- * The structure is a map where each key is a model's UUID, and the value is another map.
728
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
729
- * representing a specific relation type, and the value is an array of expressIDs of entities
730
- * that are related through that relation type. This structure allows for efficient querying
731
- * of entity relationships within a model.
908
+ * The default configuration for grid creation.
732
909
  */
733
- readonly relationMaps: ModelsRelationMap;
910
+ config: Required<GridConfig>;
911
+ /** {@link Disposable.onDisposed} */
912
+ readonly onDisposed: Event<unknown>;
734
913
  /** {@link Component.enabled} */
735
914
  enabled: boolean;
736
- private _relToAttributesMap;
737
- private _inverseAttributes;
738
- private _ifcRels;
739
915
  constructor(components: Components);
740
- private onFragmentsDisposed;
741
- private indexRelations;
742
916
  /**
743
- * Adds a relation map to the model's relations map.
917
+ * Creates a new grid for the given world.
918
+ * Throws an error if a grid already exists for the world.
744
919
  *
745
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
746
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
920
+ * @param world - The world to create the grid for.
921
+ * @returns The newly created grid.
747
922
  *
748
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
923
+ * @throws Will throw an error if a grid already exists for the given world.
749
924
  */
750
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
925
+ create(world: World): SimpleGrid;
751
926
  /**
752
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
753
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
754
- * and maps them in a structured way to facilitate quick access to related entities.
927
+ * Deletes the grid associated with the given world.
928
+ * If a grid does not exist for the given world, this method does nothing.
755
929
  *
756
- * The process involves querying the model for each relation type associated with the inverse attributes
757
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
758
- * and contains a nested map where each key is an entity's expressID and its value is another map.
759
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
760
- * of entities that are related through that attribute.
930
+ * @param world - The world for which to delete the grid.
761
931
  *
762
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
763
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
764
- * representation of the relations indexed by entity expressIDs and relation types.
765
- * @throws An error if the model does not have properties loaded.
932
+ * @remarks
933
+ * This method will dispose of the grid and remove it from the internal list.
934
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
766
935
  */
767
- process(model: FragmentsGroup): Promise<RelationsMap>;
936
+ delete(world: World): void;
937
+ /** {@link Disposable.dispose} */
938
+ dispose(): void;
939
+ }
940
+ import * as THREE from "three";
941
+ import { Components } from "../Components";
942
+ import { SimpleCamera } from "..";
943
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
944
+ /**
945
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
946
+ */
947
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
768
948
  /**
769
- * Processes a given model from a WebIfc API to index its IFC entities relations.
770
- *
771
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
772
- * @param modelID - The unique identifier of the model within the WebIfc API.
773
- * @returns A promise that resolves to the relations map for the processed model.
774
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
949
+ * A ProjectionManager instance that manages the projection modes of the camera.
775
950
  */
776
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
951
+ readonly projection: ProjectionManager;
777
952
  /**
778
- * Retrieves the relations of a specific entity within a model based on the given relation name.
779
- * This method searches the indexed relation maps for the specified model and entity,
780
- * returning the IDs of related entities if a match is found.
781
- *
782
- * @param model The 'FragmentsGroup' model containing the entity.
783
- * @param expressID The unique identifier of the entity within the model.
784
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
785
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
786
- * or the specified relation name is not indexed.
953
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
954
+ * This camera is used when the projection mode is set to orthographic.
787
955
  */
788
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
956
+ readonly threeOrtho: THREE.OrthographicCamera;
789
957
  /**
790
- * Serializes the relations of a given relation map into a JSON string.
791
- * 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,
792
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
793
- * The resulting object is then serialized into a JSON string.
794
- *
795
- * @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.
796
- * @returns A JSON string representing the serialized relations of the given relation map.
797
- */
798
- serializeRelations(relationMap: RelationsMap): string;
958
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
959
+ * This camera is used when the projection mode is set to perspective.
960
+ */
961
+ readonly threePersp: THREE.PerspectiveCamera;
962
+ protected readonly _userInputButtons: any;
963
+ protected readonly _frustumSize = 50;
964
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
965
+ protected _mode: NavigationMode | null;
966
+ private previousSize;
799
967
  /**
800
- * Serializes the relations of a specific model into a JSON string.
801
- * This method iterates through the relations indexed for the given model,
802
- * organizing them into a structured object where each key is an expressID of an entity,
803
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
804
- * The resulting object is then serialized into a JSON string.
968
+ * Getter for the current navigation mode.
969
+ * Throws an error if the mode is not found or the camera is not initialized.
805
970
  *
806
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
807
- * @returns A JSON string representing the serialized relations of the specified model.
808
- * If the model has no indexed relations, 'null' is returned.
971
+ * @returns {NavigationMode} The current navigation mode.
972
+ *
973
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
809
974
  */
810
- serializeModelRelations(model: FragmentsGroup): string | null;
975
+ get mode(): NavigationMode;
976
+ constructor(components: Components);
977
+ /** {@link Disposable.dispose} */
978
+ dispose(): void;
811
979
  /**
812
- * Serializes all relations of every model processed by the indexer into a JSON string.
813
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
814
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
815
- * and its value is another object mapping entity expressIDs to their related entities, categorized
816
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
980
+ * Sets a new {@link NavigationMode} and disables the previous one.
817
981
  *
818
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
819
- * If no relations have been indexed, an empty object is returned as a JSON string.
982
+ * @param mode - The {@link NavigationMode} to set.
820
983
  */
821
- serializeAllRelations(): string;
984
+ set(mode: NavModeID): void;
822
985
  /**
823
- * Converts a JSON string representing relations between entities into a structured map.
824
- * This method parses the JSON string to reconstruct the relations map that indexes
825
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
826
- * and the values are maps where each key is a relation type ID and its value is an array
827
- * of express IDs of entities related through that relation type.
986
+ * Make the camera view fit all the specified meshes.
828
987
  *
829
- * @param json The JSON string to be parsed into the relations map.
830
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
831
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
832
- * is an array of express IDs (as numbers) of entities related through that relation type.
988
+ * @param meshes the meshes to fit. If it is not defined, it will
989
+ * evaluate {@link Components.meshes}.
990
+ * @param offset the distance to the fit object
833
991
  */
834
- getRelationsMapFromJSON(json: string): RelationsMap;
992
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
993
+ /**
994
+ * Allows or prevents all user input.
995
+ *
996
+ * @param active - whether to enable or disable user inputs.
997
+ */
998
+ setUserInput(active: boolean): void;
999
+ private disableUserInput;
1000
+ private enableUserInput;
1001
+ private newOrthoCamera;
1002
+ private setOrthoPerspCameraAspect;
1003
+ }
1004
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
1005
+ import { Components } from "../Components";
1006
+ import { SimpleWorld } from "./src";
1007
+ /**
1008
+ * 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).
1009
+ */
1010
+ export declare class Worlds extends Component implements Updateable, Disposable {
1011
+ /**
1012
+ * A unique identifier for the component.
1013
+ * This UUID is used to register the component within the Components system.
1014
+ */
1015
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
1016
+ /** {@link Updateable.onAfterUpdate} */
1017
+ readonly onAfterUpdate: Event<unknown>;
1018
+ /** {@link Updateable.onBeforeUpdate} */
1019
+ readonly onBeforeUpdate: Event<unknown>;
1020
+ /** {@link Disposable.onDisposed} */
1021
+ readonly onDisposed: Event<unknown>;
1022
+ /**
1023
+ * An event that is triggered when a new world is created.
1024
+ * The event passes the newly created world as a parameter.
1025
+ */
1026
+ readonly onWorldCreated: Event<World>;
1027
+ /**
1028
+ * An event that is triggered when a world is deleted.
1029
+ * The event passes the UUID of the deleted world as a parameter.
1030
+ */
1031
+ readonly onWorldDeleted: Event<string>;
1032
+ /**
1033
+ * A collection of worlds managed by this component.
1034
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
1035
+ */
1036
+ list: Map<string, World>;
1037
+ /** {@link Component.enabled} */
1038
+ enabled: boolean;
1039
+ constructor(components: Components);
1040
+ /**
1041
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
1042
+ *
1043
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
1044
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
1045
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
1046
+ *
1047
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
1048
+ */
1049
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
1050
+ /**
1051
+ * Deletes a world from the list of worlds.
1052
+ *
1053
+ * @param {World} world - The world to be deleted.
1054
+ *
1055
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
1056
+ *
1057
+ * @returns {void}
1058
+ */
1059
+ delete(world: World): void;
1060
+ /**
1061
+ * Disposes of the Worlds component and all its managed worlds.
1062
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
1063
+ * and triggers the onDisposed event.
1064
+ *
1065
+ * @returns {void}
1066
+ */
1067
+ dispose(): void;
1068
+ /** {@link Updateable.update} */
1069
+ update(delta?: number): void | Promise<void>;
1070
+ }
1071
+ import { Components } from "../Components";
1072
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
1073
+ import { Component, Event, Disposable, World } from "../Types";
1074
+ /**
1075
+ * 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).
1076
+ */
1077
+ export declare class Cullers extends Component implements Disposable {
1078
+ /**
1079
+ * A unique identifier for the component.
1080
+ * This UUID is used to register the component within the Components system.
1081
+ */
1082
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
1083
+ /**
1084
+ * An event that is triggered when the Cullers component is disposed.
1085
+ */
1086
+ readonly onDisposed: Event<unknown>;
1087
+ private _enabled;
1088
+ /**
1089
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
1090
+ */
1091
+ list: Map<string, MeshCullerRenderer>;
1092
+ /** {@link Component.enabled} */
1093
+ get enabled(): boolean;
1094
+ /** {@link Component.enabled} */
1095
+ set enabled(value: boolean);
1096
+ constructor(components: Components);
1097
+ /**
1098
+ * Creates a new MeshCullerRenderer for the given world.
1099
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
1100
+ *
1101
+ * @param world - The world for which to create the MeshCullerRenderer.
1102
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
1103
+ *
1104
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
1105
+ */
1106
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
1107
+ /**
1108
+ * Deletes the MeshCullerRenderer associated with the given world.
1109
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
1110
+ *
1111
+ * @param world - The world for which to delete the MeshCullerRenderer.
1112
+ *
1113
+ * @returns {void}
1114
+ */
1115
+ delete(world: World): void;
835
1116
  /** {@link Disposable.dispose} */
836
1117
  dispose(): void;
837
1118
  }
838
- import * as WEBIFC from "web-ifc";
839
- import * as FRAG from "@thatopen/fragments";
1119
+ import * as THREE from "three";
840
1120
  import { Component, Components } from "../../core";
841
1121
  /**
842
- * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1122
+ * Represents an edge measurement result.
843
1123
  */
844
- export declare class IfcJsonExporter extends Component {
1124
+ export interface MeasureEdge {
1125
+ /**
1126
+ * The distance between the two points of the edge.
1127
+ */
1128
+ distance: number;
1129
+ /**
1130
+ * The two points that define the edge.
1131
+ */
1132
+ points: THREE.Vector3[];
1133
+ }
1134
+ /**
1135
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1136
+ */
1137
+ export declare class MeasurementUtils extends Component {
845
1138
  /**
846
1139
  * A unique identifier for the component.
847
1140
  * This UUID is used to register the component within the Components system.
848
1141
  */
849
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1142
+ static uuid: string;
850
1143
  /** {@link Component.enabled} */
851
1144
  enabled: boolean;
852
1145
  constructor(components: Components);
853
1146
  /**
854
- * Exports all the properties of an IFC into an array of JS objects.
855
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
856
- * @param modelID ID of the IFC model whose properties to extract.
857
- * @param indirect whether to get the indirect relationships as well.
858
- * @param recursiveSpatial whether to get the properties of spatial items recursively
859
- * to make the location data available (e.g. absolute position of building).
1147
+ * Utility method to calculate the distance from a point to a line segment.
1148
+ *
1149
+ * @param point - The point from which to calculate the distance.
1150
+ * @param lineStart - The start point of the line segment.
1151
+ * @param lineEnd - The end point of the line segment.
1152
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
1153
+ * @returns The distance from the point to the line segment.
860
1154
  */
861
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1155
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1156
+ /**
1157
+ * Method to get the face of a mesh that contains a given triangle index.
1158
+ * It also returns the edges of the found face and their indices.
1159
+ *
1160
+ * @param mesh - The mesh to get the face from. It must be indexed.
1161
+ * @param triangleIndex - The index of the triangle within the mesh.
1162
+ * @param instance - The instance of the mesh (optional).
1163
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1164
+ */
1165
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1166
+ edges: MeasureEdge[];
1167
+ indices: Set<number>;
1168
+ } | null;
1169
+ /**
1170
+ * Method to get the vertices and normal of a mesh face at a given index.
1171
+ * It also applies instance transformation if provided.
1172
+ *
1173
+ * @param mesh - The mesh to get the face from. It must be indexed.
1174
+ * @param faceIndex - The index of the face within the mesh.
1175
+ * @param instance - The instance of the mesh (optional).
1176
+ * @returns An object containing the vertices and normal of the face.
1177
+ * @throws Will throw an error if the geometry is not indexed.
1178
+ */
1179
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1180
+ p1: THREE.Vector3;
1181
+ p2: THREE.Vector3;
1182
+ p3: THREE.Vector3;
1183
+ faceNormal: THREE.Vector3;
1184
+ };
1185
+ /**
1186
+ * Method to round the vector's components to a specified number of decimal places.
1187
+ * This is used to ensure numerical precision in edge detection.
1188
+ *
1189
+ * @param vector - The vector to round.
1190
+ * @returns The vector with rounded components.
1191
+ */
1192
+ round(vector: THREE.Vector3): void;
1193
+ private getFaceData;
862
1194
  }
863
1195
  import * as THREE from "three";
864
1196
  import * as FRAGS from "@thatopen/fragments";
@@ -1045,299 +1377,169 @@ export declare class BoundingBoxer extends Component implements Disposable {
1045
1377
  addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1046
1378
  private static getFragmentBounds;
1047
1379
  }
1048
- import * as WEBIFC from "web-ifc";
1049
- import { FragmentsGroup } from "@thatopen/fragments";
1050
- import { Component, Disposable, Event, Components } from "../../core";
1051
- /**
1052
- * Types for boolean properties in IFC schema.
1053
- */
1054
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1055
- /**
1056
- * Types for string properties in IFC schema.
1057
- */
1058
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1059
- /**
1060
- * Types for numeric properties in IFC schema.
1061
- */
1062
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
1063
- /**
1064
- * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
1065
- */
1066
- export interface ChangeMap {
1067
- [modelID: string]: Set<number>;
1068
- }
1380
+ import * as THREE from "three";
1381
+ import * as FRAGS from "@thatopen/fragments";
1382
+ import { Disposable, Component, Event, Components } from "../../core";
1069
1383
  /**
1070
- * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
1384
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
1071
1385
  */
1072
- export interface AttributeListener {
1073
- [modelID: string]: {
1074
- [expressID: number]: {
1075
- [attributeName: string]: Event<String | Boolean | Number>;
1076
- };
1386
+ export interface Classification {
1387
+ /**
1388
+ * A system within the classification.
1389
+ * The key is the system name, and the value is an object representing the classes within the system.
1390
+ */
1391
+ [system: string]: {
1392
+ /**
1393
+ * A class within the system.
1394
+ * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
1395
+ */
1396
+ [className: string]: FRAGS.FragmentIdMap;
1077
1397
  };
1078
1398
  }
1079
1399
  /**
1080
- * Component to manage and edit properties and Psets in IFC files.
1400
+ * 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).
1081
1401
  */
1082
- export declare class IfcPropertiesManager extends Component implements Disposable {
1402
+ export declare class Classifier extends Component implements Disposable {
1083
1403
  /**
1084
1404
  * A unique identifier for the component.
1085
1405
  * This UUID is used to register the component within the Components system.
1086
1406
  */
1087
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1088
- /** {@link Disposable.onDisposed} */
1089
- readonly onDisposed: Event<string>;
1090
- /**
1091
- * Event triggered when a file is requested for export.
1092
- */
1093
- readonly onRequestFile: Event<unknown>;
1094
- /**
1095
- * ArrayBuffer containing the IFC data to be exported.
1096
- */
1097
- ifcToExport: ArrayBuffer | null;
1098
- /**
1099
- * Event triggered when an element is added to a Pset.
1100
- */
1101
- readonly onElementToPset: Event<{
1102
- model: FragmentsGroup;
1103
- psetID: number;
1104
- elementID: number;
1105
- }>;
1106
- /**
1107
- * Event triggered when a property is added to a Pset.
1108
- */
1109
- readonly onPropToPset: Event<{
1110
- model: FragmentsGroup;
1111
- psetID: number;
1112
- propID: number;
1113
- }>;
1114
- /**
1115
- * Event triggered when a Pset is removed.
1116
- */
1117
- readonly onPsetRemoved: Event<{
1118
- model: FragmentsGroup;
1119
- psetID: number;
1120
- }>;
1121
- /**
1122
- * Event triggered when data in the model changes.
1123
- */
1124
- readonly onDataChanged: Event<{
1125
- model: FragmentsGroup;
1126
- expressID: number;
1127
- }>;
1128
- /**
1129
- * Configuration for the WebAssembly module.
1130
- */
1131
- wasm: {
1132
- path: string;
1133
- absolute: boolean;
1134
- };
1407
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1135
1408
  /** {@link Component.enabled} */
1136
1409
  enabled: boolean;
1137
1410
  /**
1138
- * Map of attribute listeners.
1139
- */
1140
- attributeListeners: AttributeListener;
1141
- /**
1142
- * The currently selected model.
1143
- */
1144
- selectedModel?: FragmentsGroup;
1145
- /**
1146
- * Map of changed entities in the model.
1411
+ * A map representing the classification systems.
1412
+ * The key is the system name, and the value is an object representing the classes within the system.
1147
1413
  */
1148
- changeMap: ChangeMap;
1414
+ list: Classification;
1415
+ /** {@link Disposable.onDisposed} */
1416
+ readonly onDisposed: Event<unknown>;
1149
1417
  constructor(components: Components);
1418
+ private onFragmentsDisposed;
1150
1419
  /** {@link Disposable.dispose} */
1151
1420
  dispose(): void;
1152
1421
  /**
1153
- * Static method to retrieve the IFC schema from a given model.
1422
+ * Removes a fragment from the classification based on its unique identifier (guid).
1423
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1154
1424
  *
1155
- * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1156
- * @throws Will throw an error if the IFC schema is not found in the model.
1157
- * @returns The IFC schema associated with the given model.
1425
+ * @param guid - The unique identifier of the fragment to be removed.
1158
1426
  */
1159
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1427
+ remove(guid: string): void;
1160
1428
  /**
1161
- * Method to set properties data in the model.
1429
+ * Finds and returns fragments based on the provided filter criteria.
1430
+ * If no filter is provided, it returns all fragments.
1162
1431
  *
1163
- * @param model - The FragmentsGroup model in which to set the properties.
1164
- * @param dataToSave - An array of objects representing the properties to be saved.
1165
- * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1166
- * The rest of the properties will be set as the properties of the entity.
1432
+ * @param filter - An optional object containing filter criteria.
1433
+ * The keys of the object represent the classification system names,
1434
+ * and the values are arrays of class names to match.
1167
1435
  *
1168
- * @returns {Promise<void>} A promise that resolves when all the properties have been set.
1436
+ * @returns A map of fragment GUIDs to their respective express IDs,
1437
+ * where the express IDs are filtered based on the provided filter criteria.
1169
1438
  *
1170
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1439
+ * @throws Will throw an error if the fragments map is malformed.
1171
1440
  */
1172
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1441
+ find(filter?: {
1442
+ [name: string]: string[];
1443
+ }): FRAGS.FragmentIdMap;
1173
1444
  /**
1174
- * Creates a new Property Set (Pset) in the given model.
1445
+ * Classifies fragments based on their modelID.
1175
1446
  *
1176
- * @param model - The FragmentsGroup model in which to create the Pset.
1177
- * @param name - The name of the Pset.
1178
- * @param description - (Optional) The description of the Pset.
1447
+ * @param modelID - The unique identifier of the model to classify fragments by.
1448
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1179
1449
  *
1180
- * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1450
+ * @remarks
1451
+ * This method iterates through the fragments in the provided group,
1452
+ * and classifies them based on their modelID.
1453
+ * The classification is stored in the 'list.models' property,
1454
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1181
1455
  *
1182
- * @throws Will throw an error if the IFC schema is not found in the model.
1183
- * @throws Will throw an error if no OwnerHistory is found in the model.
1184
1456
  */
1185
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1186
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1187
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1188
- }>;
1457
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1189
1458
  /**
1190
- * Removes a Property Set (Pset) from the given model.
1459
+ * Classifies fragments based on their PredefinedType property.
1191
1460
  *
1192
- * @param model - The FragmentsGroup model from which to remove the Pset.
1193
- * @param psetID - The express IDs of the Psets to be removed.
1461
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1194
1462
  *
1195
- * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
1463
+ * @remarks
1464
+ * This method iterates through the properties of the fragments in the provided group,
1465
+ * and classifies them based on their PredefinedType property.
1466
+ * The classification is stored in the 'list.predefinedTypes' property,
1467
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1196
1468
  *
1197
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1198
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1199
- * @throws Will throw an error if no relation is found between the Pset and the model.
1469
+ * @throws Will throw an error if the fragment ID is not found.
1200
1470
  */
1201
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1471
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1202
1472
  /**
1203
- * Creates a new single-value property of type string in the given model.
1473
+ * Classifies fragments based on their entity type.
1204
1474
  *
1205
- * @param model - The FragmentsGroup model in which to create the property.
1206
- * @param type - The type of the property value. Must be a string property type.
1207
- * @param name - The name of the property.
1208
- * @param value - The value of the property. Must be a string.
1475
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1209
1476
  *
1210
- * @returns The newly created single-value property.
1477
+ * @remarks
1478
+ * This method iterates through the relations of the fragments in the provided group,
1479
+ * and classifies them based on their entity type.
1480
+ * The classification is stored in the 'list.entities' property,
1481
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1211
1482
  *
1212
- * @throws Will throw an error if the IFC schema is not found in the model.
1213
- * @throws Will throw an error if no OwnerHistory is found in the model.
1483
+ * @throws Will throw an error if the fragment ID is not found.
1214
1484
  */
1215
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1485
+ byEntity(group: FRAGS.FragmentsGroup): void;
1216
1486
  /**
1217
- * Creates a new single-value property of type numeric in the given model.
1487
+ * Classifies fragments based on a specific IFC relationship.
1218
1488
  *
1219
- * @param model - The FragmentsGroup model in which to create the property.
1220
- * @param type - The type of the property value. Must be a numeric property type.
1221
- * @param name - The name of the property.
1222
- * @param value - The value of the property. Must be a number.
1489
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1490
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1491
+ * @param systemName - The name of the classification system to store the classification.
1223
1492
  *
1224
- * @returns The newly created single-value property.
1493
+ * @remarks
1494
+ * This method iterates through the relations of the fragments in the provided group,
1495
+ * and classifies them based on the specified IFC relationship.
1496
+ * The classification is stored in the 'list' property under the specified system name,
1497
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1225
1498
  *
1226
- * @throws Will throw an error if the IFC schema is not found in the model.
1227
- * @throws Will throw an error if no OwnerHistory is found in the model.
1499
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1228
1500
  */
1229
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1501
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1230
1502
  /**
1231
- * Creates a new single-value property of type boolean in the given model.
1503
+ * Classifies fragments based on their spatial structure in the IFC model.
1232
1504
  *
1233
- * @param model - The FragmentsGroup model in which to create the property.
1234
- * @param type - The type of the property value. Must be a boolean property type.
1235
- * @param name - The name of the property.
1236
- * @param value - The value of the property. Must be a boolean.
1505
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1237
1506
  *
1238
- * @returns The newly created single-value property.
1507
+ * @remarks
1508
+ * This method iterates through the relations of the fragments in the provided group,
1509
+ * and classifies them based on their spatial structure in the IFC model.
1510
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1511
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1239
1512
  *
1240
- * @throws Will throw an error if the IFC schema is not found in the model.
1241
- * @throws Will throw an error if no OwnerHistory is found in the model.
1513
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1242
1514
  */
1243
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
1515
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
1244
1516
  /**
1245
- * Removes a property from a Property Set (Pset) in the given model.
1517
+ * Sets the color of the specified fragments.
1246
1518
  *
1247
- * @param model - The FragmentsGroup model from which to remove the property.
1248
- * @param psetID - The express ID of the Pset from which to remove the property.
1249
- * @param propID - The express ID of the property to be removed.
1519
+ * @param items - A map of fragment IDs to their respective express IDs.
1520
+ * @param color - The color to set for the fragments.
1521
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1250
1522
  *
1251
- * @returns {Promise<void>} A promise that resolves when the property has been removed.
1523
+ * @remarks
1524
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1525
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1252
1526
  *
1253
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1254
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1527
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1255
1528
  */
1256
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1257
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
1529
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1258
1530
  /**
1259
- * Adds elements to a Property Set (Pset) in the given model.
1531
+ * Resets the color of the specified fragments to their original color.
1260
1532
  *
1261
- * @param model - The FragmentsGroup model in which to add the elements.
1262
- * @param psetID - The express ID of the Pset to which to add the elements.
1263
- * @param elementID - The express IDs of the elements to be added.
1533
+ * @param items - A map of fragment IDs to their respective express IDs.
1264
1534
  *
1265
- * @returns {Promise<void>} A promise that resolves when all the elements have been added.
1535
+ * @remarks
1536
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1537
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1266
1538
  *
1267
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1268
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1269
- * @throws Will throw an error if no relation is found between the Pset and the model.
1270
- */
1271
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1272
- /**
1273
- * Saves the changes made to the model to a new IFC file.
1274
- *
1275
- * @param model - The FragmentsGroup model from which to save the changes.
1276
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1277
- *
1278
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1279
- *
1280
- * @throws Will throw an error if any issues occur during the saving process.
1281
- */
1282
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1283
- /**
1284
- * Sets an attribute listener for a specific attribute of an entity in the model.
1285
- * The listener will trigger an event whenever the attribute's value changes.
1286
- *
1287
- * @param model - The FragmentsGroup model in which to set the attribute listener.
1288
- * @param expressID - The express ID of the entity for which to set the listener.
1289
- * @param attributeName - The name of the attribute for which to set the listener.
1290
- *
1291
- * @returns The event that will be triggered when the attribute's value changes.
1292
- *
1293
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
1294
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1295
- * @throws Will throw an error if the attribute has a badly defined handle.
1296
- */
1297
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1298
- private increaseMaxID;
1299
- private newGUID;
1300
- private getOwnerHistory;
1301
- private registerChange;
1302
- private newSingleProperty;
1303
- }
1304
- import * as FRAGS from "@thatopen/fragments";
1305
- import { Components, Component } from "../../core";
1306
- /**
1307
- * 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).
1308
- */
1309
- export declare class Hider extends Component {
1310
- /**
1311
- * A unique identifier for the component.
1312
- * This UUID is used to register the component within the Components system.
1313
- */
1314
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1315
- /** {@link Component.enabled} */
1316
- enabled: boolean;
1317
- constructor(components: Components);
1318
- /**
1319
- * Sets the visibility of fragments within the 3D scene.
1320
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1321
- * If 'items' is provided, only the specified fragments will be affected.
1322
- *
1323
- * @param visible - The visibility state to set for the fragments.
1324
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1325
- * If not provided, all fragments will be affected.
1326
- *
1327
- * @returns {void}
1328
- */
1329
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1330
- /**
1331
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1332
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1333
- *
1334
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1335
- * If not provided, all fragments will be isolated.
1336
- *
1337
- * @returns {void}
1539
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1338
1540
  */
1339
- isolate(items: FRAGS.FragmentIdMap): void;
1340
- private updateCulledVisibility;
1541
+ resetColor(items: FRAGS.FragmentIdMap): void;
1542
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
1341
1543
  }
1342
1544
  import { Component, Disposable, Event, Components } from "../../core";
1343
1545
  /**
@@ -1389,169 +1591,43 @@ export declare class Exploder extends Component implements Disposable {
1389
1591
  */
1390
1592
  set(active: boolean): void;
1391
1593
  }
1392
- import * as THREE from "three";
1393
1594
  import * as FRAGS from "@thatopen/fragments";
1394
- import { Disposable, Component, Event, Components } from "../../core";
1395
- /**
1396
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
1397
- */
1398
- export interface Classification {
1399
- /**
1400
- * A system within the classification.
1401
- * The key is the system name, and the value is an object representing the classes within the system.
1402
- */
1403
- [system: string]: {
1404
- /**
1405
- * A class within the system.
1406
- * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
1407
- */
1408
- [className: string]: FRAGS.FragmentIdMap;
1409
- };
1410
- }
1595
+ import { Components, Component } from "../../core";
1411
1596
  /**
1412
- * 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).
1597
+ * 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).
1413
1598
  */
1414
- export declare class Classifier extends Component implements Disposable {
1599
+ export declare class Hider extends Component {
1415
1600
  /**
1416
1601
  * A unique identifier for the component.
1417
1602
  * This UUID is used to register the component within the Components system.
1418
1603
  */
1419
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1604
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1420
1605
  /** {@link Component.enabled} */
1421
1606
  enabled: boolean;
1422
- /**
1423
- * A map representing the classification systems.
1424
- * The key is the system name, and the value is an object representing the classes within the system.
1425
- */
1426
- list: Classification;
1427
- /** {@link Disposable.onDisposed} */
1428
- readonly onDisposed: Event<unknown>;
1429
1607
  constructor(components: Components);
1430
- private onFragmentsDisposed;
1431
- /** {@link Disposable.dispose} */
1432
- dispose(): void;
1433
- /**
1434
- * Removes a fragment from the classification based on its unique identifier (guid).
1435
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1436
- *
1437
- * @param guid - The unique identifier of the fragment to be removed.
1438
- */
1439
- remove(guid: string): void;
1440
- /**
1441
- * Finds and returns fragments based on the provided filter criteria.
1442
- * If no filter is provided, it returns all fragments.
1443
- *
1444
- * @param filter - An optional object containing filter criteria.
1445
- * The keys of the object represent the classification system names,
1446
- * and the values are arrays of class names to match.
1447
- *
1448
- * @returns A map of fragment GUIDs to their respective express IDs,
1449
- * where the express IDs are filtered based on the provided filter criteria.
1450
- *
1451
- * @throws Will throw an error if the fragments map is malformed.
1452
- */
1453
- find(filter?: {
1454
- [name: string]: string[];
1455
- }): FRAGS.FragmentIdMap;
1456
- /**
1457
- * Classifies fragments based on their modelID.
1458
- *
1459
- * @param modelID - The unique identifier of the model to classify fragments by.
1460
- * @param group - The FragmentsGroup containing the fragments to be classified.
1461
- *
1462
- * @remarks
1463
- * This method iterates through the fragments in the provided group,
1464
- * and classifies them based on their modelID.
1465
- * The classification is stored in the 'list.models' property,
1466
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1467
- *
1468
- */
1469
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1470
- /**
1471
- * Classifies fragments based on their PredefinedType property.
1472
- *
1473
- * @param group - The FragmentsGroup containing the fragments to be classified.
1474
- *
1475
- * @remarks
1476
- * This method iterates through the properties of the fragments in the provided group,
1477
- * and classifies them based on their PredefinedType property.
1478
- * The classification is stored in the 'list.predefinedTypes' property,
1479
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1480
- *
1481
- * @throws Will throw an error if the fragment ID is not found.
1482
- */
1483
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1484
- /**
1485
- * Classifies fragments based on their entity type.
1486
- *
1487
- * @param group - The FragmentsGroup containing the fragments to be classified.
1488
- *
1489
- * @remarks
1490
- * This method iterates through the relations of the fragments in the provided group,
1491
- * and classifies them based on their entity type.
1492
- * The classification is stored in the 'list.entities' property,
1493
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1494
- *
1495
- * @throws Will throw an error if the fragment ID is not found.
1496
- */
1497
- byEntity(group: FRAGS.FragmentsGroup): void;
1498
- /**
1499
- * Classifies fragments based on a specific IFC relationship.
1500
- *
1501
- * @param group - The FragmentsGroup containing the fragments to be classified.
1502
- * @param ifcRel - The IFC relationship number to classify fragments by.
1503
- * @param systemName - The name of the classification system to store the classification.
1504
- *
1505
- * @remarks
1506
- * This method iterates through the relations of the fragments in the provided group,
1507
- * and classifies them based on the specified IFC relationship.
1508
- * The classification is stored in the 'list' property under the specified system name,
1509
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1510
- *
1511
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1512
- */
1513
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1514
1608
  /**
1515
- * Classifies fragments based on their spatial structure in the IFC model.
1516
- *
1517
- * @param model - The FragmentsGroup containing the fragments to be classified.
1518
- *
1519
- * @remarks
1520
- * This method iterates through the relations of the fragments in the provided group,
1521
- * and classifies them based on their spatial structure in the IFC model.
1522
- * The classification is stored in the 'list' property under the system name "spatialStructures",
1523
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1524
- *
1525
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1526
- */
1527
- bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
1528
- /**
1529
- * Sets the color of the specified fragments.
1530
- *
1531
- * @param items - A map of fragment IDs to their respective express IDs.
1532
- * @param color - The color to set for the fragments.
1533
- * @param override - A boolean indicating whether to override the existing color of the fragments.
1609
+ * Sets the visibility of fragments within the 3D scene.
1610
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1611
+ * If 'items' is provided, only the specified fragments will be affected.
1534
1612
  *
1535
- * @remarks
1536
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1537
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
1613
+ * @param visible - The visibility state to set for the fragments.
1614
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1615
+ * If not provided, all fragments will be affected.
1538
1616
  *
1539
- * @throws Will throw an error if the fragment with the specified ID is not found.
1617
+ * @returns {void}
1540
1618
  */
1541
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1619
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1542
1620
  /**
1543
- * Resets the color of the specified fragments to their original color.
1544
- *
1545
- * @param items - A map of fragment IDs to their respective express IDs.
1621
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1622
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1546
1623
  *
1547
- * @remarks
1548
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1549
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1624
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1625
+ * If not provided, all fragments will be isolated.
1550
1626
  *
1551
- * @throws Will throw an error if the fragment with the specified ID is not found.
1627
+ * @returns {void}
1552
1628
  */
1553
- resetColor(items: FRAGS.FragmentIdMap): void;
1554
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
1629
+ isolate(items: FRAGS.FragmentIdMap): void;
1630
+ private updateCulledVisibility;
1555
1631
  }
1556
1632
  import * as WEBIFC from "web-ifc";
1557
1633
  import * as FRAGS from "@thatopen/fragments";
@@ -1780,147 +1856,55 @@ export declare class FragmentsManager extends Component implements Disposable {
1780
1856
  */
1781
1857
  coordinate(models?: FragmentsGroup[]): void;
1782
1858
  }
1783
- import * as THREE from "three";
1784
- import { Component, Components } from "../../core";
1785
1859
  /**
1786
- * Represents an edge measurement result.
1860
+ * 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.
1861
+ *
1862
+ * @remarks
1863
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
1864
+ * It is useful for identifying and processing different types of IFC elements in a project.
1865
+ *
1787
1866
  */
1788
- export interface MeasureEdge {
1789
- /**
1790
- * The distance between the two points of the edge.
1791
- */
1792
- distance: number;
1793
- /**
1794
- * The two points that define the edge.
1795
- */
1796
- points: THREE.Vector3[];
1797
- }
1798
- /**
1799
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1800
- */
1801
- export declare class MeasurementUtils extends Component {
1802
- /**
1803
- * A unique identifier for the component.
1804
- * This UUID is used to register the component within the Components system.
1805
- */
1806
- static uuid: string;
1807
- /** {@link Component.enabled} */
1808
- enabled: boolean;
1809
- constructor(components: Components);
1810
- /**
1811
- * Utility method to calculate the distance from a point to a line segment.
1812
- *
1813
- * @param point - The point from which to calculate the distance.
1814
- * @param lineStart - The start point of the line segment.
1815
- * @param lineEnd - The end point of the line segment.
1816
- * @param clamp - If true, the distance will be clamped to the line segment's length.
1817
- * @returns The distance from the point to the line segment.
1818
- */
1819
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1820
- /**
1821
- * Method to get the face of a mesh that contains a given triangle index.
1822
- * It also returns the edges of the found face and their indices.
1823
- *
1824
- * @param mesh - The mesh to get the face from. It must be indexed.
1825
- * @param triangleIndex - The index of the triangle within the mesh.
1826
- * @param instance - The instance of the mesh (optional).
1827
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1828
- */
1829
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1830
- edges: MeasureEdge[];
1831
- indices: Set<number>;
1832
- } | null;
1833
- /**
1834
- * Method to get the vertices and normal of a mesh face at a given index.
1835
- * It also applies instance transformation if provided.
1836
- *
1837
- * @param mesh - The mesh to get the face from. It must be indexed.
1838
- * @param faceIndex - The index of the face within the mesh.
1839
- * @param instance - The instance of the mesh (optional).
1840
- * @returns An object containing the vertices and normal of the face.
1841
- * @throws Will throw an error if the geometry is not indexed.
1842
- */
1843
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1844
- p1: THREE.Vector3;
1845
- p2: THREE.Vector3;
1846
- p3: THREE.Vector3;
1847
- faceNormal: THREE.Vector3;
1848
- };
1849
- /**
1850
- * Method to round the vector's components to a specified number of decimal places.
1851
- * This is used to ensure numerical precision in edge detection.
1852
- *
1853
- * @param vector - The vector to round.
1854
- * @returns The vector with rounded components.
1855
- */
1856
- round(vector: THREE.Vector3): void;
1857
- private getFaceData;
1867
+ export declare const IfcElements: {
1868
+ [key: number]: string;
1869
+ };
1870
+ import * as FRAGS from "@thatopen/fragments";
1871
+ export declare class IfcPropertiesUtils {
1872
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
1873
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
1874
+ [attribute: string]: any;
1875
+ } | null>;
1876
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
1877
+ [relatingID: number]: number[];
1878
+ }>;
1879
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
1880
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
1881
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
1882
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
1883
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1884
+ key: string | null;
1885
+ name: string | null;
1886
+ }>;
1887
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1888
+ key: string | null;
1889
+ value: number | null;
1890
+ }>;
1891
+ static isRel(expressID: number): boolean;
1892
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1893
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1858
1894
  }
1859
1895
  import * as WEBIFC from "web-ifc";
1860
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1861
- import { PropertiesStreamingSettings } from "./src";
1896
+ export interface IfcItemsCategories {
1897
+ [itemID: number]: number;
1898
+ }
1899
+ export declare class IfcCategories {
1900
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1901
+ }
1862
1902
  /**
1863
- * 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).
1903
+ * 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.
1864
1904
  */
1865
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1866
- /**
1867
- * A unique identifier for the component.
1868
- * This UUID is used to register the component within the Components system.
1869
- */
1870
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1871
- /**
1872
- * An event that is triggered when properties are streamed from the IFC file.
1873
- * The event provides the type of the IFC entity and the corresponding data.
1874
- */
1875
- readonly onPropertiesStreamed: AsyncEvent<{
1876
- type: number;
1877
- data: {
1878
- [id: number]: any;
1879
- };
1880
- }>;
1881
- /**
1882
- * An event that is triggered to indicate the progress of the streaming process.
1883
- * The event provides a number between 0 and 1 representing the progress percentage.
1884
- */
1885
- readonly onProgress: AsyncEvent<number>;
1886
- /**
1887
- * An event that is triggered when indices are streamed from the IFC file.
1888
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1889
- */
1890
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1891
- /** {@link Disposable.onDisposed} */
1892
- readonly onDisposed: Event<string>;
1893
- /** {@link Component.enabled} */
1894
- enabled: boolean;
1895
- /**
1896
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1897
- */
1898
- settings: PropertiesStreamingSettings;
1899
- /**
1900
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1901
- */
1902
- webIfc: WEBIFC.IfcAPI;
1903
- /** {@link Disposable.dispose} */
1904
- dispose(): Promise<void>;
1905
- /**
1906
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1907
- *
1908
- * @param data - The Uint8Array containing the IFC file data.
1909
- * @returns A Promise that resolves when the streaming process is complete.
1910
- */
1911
- streamFromBuffer(data: Uint8Array): Promise<void>;
1912
- /**
1913
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1914
- *
1915
- * @param loadCallback - A callback function that loads the IFC file data.
1916
- * @returns A Promise that resolves when the streaming process is complete.
1917
- */
1918
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1919
- private readIfcFile;
1920
- private streamIfcFile;
1921
- private streamAllProperties;
1922
- private cleanUp;
1923
- }
1905
+ export declare const IfcCategoryMap: {
1906
+ [key: number]: string;
1907
+ };
1924
1908
  import * as WEBIFC from "web-ifc";
1925
1909
  import { Components, Disposable, Event, Component } from "../../core";
1926
1910
  import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
@@ -2020,192 +2004,584 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
2020
2004
  private streamGeometries;
2021
2005
  }
2022
2006
  import * as WEBIFC from "web-ifc";
2023
- export interface IfcItemsCategories {
2024
- [itemID: number]: number;
2025
- }
2026
- export declare class IfcCategories {
2027
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2028
- }
2007
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
2008
+ import { PropertiesStreamingSettings } from "./src";
2029
2009
  /**
2030
- * 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.
2031
- *
2032
- * @remarks
2033
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2034
- * It is useful for identifying and processing different types of IFC elements in a project.
2035
- *
2010
+ * 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).
2036
2011
  */
2037
- export declare const IfcElements: {
2038
- [key: number]: string;
2039
- };
2040
- import * as FRAGS from "@thatopen/fragments";
2041
- export declare class IfcPropertiesUtils {
2042
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2043
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2044
- [attribute: string]: any;
2045
- } | null>;
2046
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2047
- [relatingID: number]: number[];
2048
- }>;
2049
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2050
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2051
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2052
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2053
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2054
- key: string | null;
2055
- name: string | null;
2056
- }>;
2057
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2058
- key: string | null;
2059
- value: number | null;
2012
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
2013
+ /**
2014
+ * A unique identifier for the component.
2015
+ * This UUID is used to register the component within the Components system.
2016
+ */
2017
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
2018
+ /**
2019
+ * An event that is triggered when properties are streamed from the IFC file.
2020
+ * The event provides the type of the IFC entity and the corresponding data.
2021
+ */
2022
+ readonly onPropertiesStreamed: AsyncEvent<{
2023
+ type: number;
2024
+ data: {
2025
+ [id: number]: any;
2026
+ };
2060
2027
  }>;
2061
- static isRel(expressID: number): boolean;
2062
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2063
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2064
- }
2065
- /**
2066
- * A Set of unique numbers representing different types of IFC geometries.
2067
- */
2068
- export declare const GeometryTypes: Set<number>;
2069
- /**
2070
- * 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.
2071
- */
2072
- export declare const IfcCategoryMap: {
2073
- [key: number]: string;
2074
- };
2075
- import * as THREE from "three";
2076
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2077
- /**
2078
- * A class representing a 2D minimap of a 3D world.
2079
- */
2080
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2028
+ /**
2029
+ * An event that is triggered to indicate the progress of the streaming process.
2030
+ * The event provides a number between 0 and 1 representing the progress percentage.
2031
+ */
2032
+ readonly onProgress: AsyncEvent<number>;
2033
+ /**
2034
+ * An event that is triggered when indices are streamed from the IFC file.
2035
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
2036
+ */
2037
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
2081
2038
  /** {@link Disposable.onDisposed} */
2082
- readonly onDisposed: Event<unknown>;
2083
- /** {@link Updateable.onAfterUpdate} */
2084
- readonly onAfterUpdate: Event<unknown>;
2085
- /** {@link Updateable.onBeforeUpdate} */
2086
- readonly onBeforeUpdate: Event<unknown>;
2087
- /** {@link Resizeable.onResize} */
2088
- readonly onResize: Event<THREE.Vector2>;
2039
+ readonly onDisposed: Event<string>;
2040
+ /** {@link Component.enabled} */
2041
+ enabled: boolean;
2089
2042
  /**
2090
- * The front offset of the minimap.
2043
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
2044
+ */
2045
+ settings: PropertiesStreamingSettings;
2046
+ /**
2047
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
2048
+ */
2049
+ webIfc: WEBIFC.IfcAPI;
2050
+ /** {@link Disposable.dispose} */
2051
+ dispose(): Promise<void>;
2052
+ /**
2053
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
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
+ streamFromBuffer(data: Uint8Array): Promise<void>;
2059
+ /**
2060
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2061
+ *
2062
+ * @param loadCallback - A callback function that loads the IFC file data.
2063
+ * @returns A Promise that resolves when the streaming process is complete.
2064
+ */
2065
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2066
+ private readIfcFile;
2067
+ private streamIfcFile;
2068
+ private streamAllProperties;
2069
+ private cleanUp;
2070
+ }
2071
+ /**
2072
+ * A Set of unique numbers representing different types of IFC geometries.
2073
+ */
2074
+ export declare const GeometryTypes: Set<number>;
2075
+ import { InverseAttribute } from "./types";
2076
+ export declare const relToAttributesMap: Map<number, {
2077
+ forRelating: InverseAttribute;
2078
+ forRelated: InverseAttribute;
2079
+ }>;
2080
+ import * as THREE from "three";
2081
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2082
+ /**
2083
+ * A class representing a 2D minimap of a 3D world.
2084
+ */
2085
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2086
+ /** {@link Disposable.onDisposed} */
2087
+ readonly onDisposed: Event<unknown>;
2088
+ /** {@link Updateable.onAfterUpdate} */
2089
+ readonly onAfterUpdate: Event<unknown>;
2090
+ /** {@link Updateable.onBeforeUpdate} */
2091
+ readonly onBeforeUpdate: Event<unknown>;
2092
+ /** {@link Resizeable.onResize} */
2093
+ readonly onResize: Event<THREE.Vector2>;
2094
+ /**
2095
+ * The front offset of the minimap.
2091
2096
  * It determines how much the minimap's view is offset from the camera's view.
2092
2097
  * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2093
2098
  */
2094
- frontOffset: number;
2099
+ frontOffset: number;
2100
+ /**
2101
+ * The override material for the minimap.
2102
+ * It is used to render the depth information of the world onto the minimap.
2103
+ */
2104
+ overrideMaterial: THREE.MeshDepthMaterial;
2105
+ /**
2106
+ * The background color of the minimap.
2107
+ * It is used to set the background color of the minimap's renderer.
2108
+ */
2109
+ backgroundColor: THREE.Color;
2110
+ /**
2111
+ * The WebGL renderer for the minimap.
2112
+ * It is used to render the minimap onto the screen.
2113
+ */
2114
+ renderer: THREE.WebGLRenderer;
2115
+ /**
2116
+ * A flag indicating whether the minimap is enabled.
2117
+ * If disabled, the minimap will not update or render.
2118
+ */
2119
+ enabled: boolean;
2120
+ /**
2121
+ * The world in which the minimap is displayed.
2122
+ * It provides access to the 3D scene, camera, and other relevant world elements.
2123
+ */
2124
+ world: World;
2125
+ private _lockRotation;
2126
+ private _camera;
2127
+ private _plane;
2128
+ private _size;
2129
+ private _tempVector1;
2130
+ private _tempVector2;
2131
+ private _tempTarget;
2132
+ private readonly down;
2133
+ /**
2134
+ * Gets or sets whether the minimap rotation is locked.
2135
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2136
+ */
2137
+ get lockRotation(): boolean;
2138
+ /**
2139
+ * Sets whether the minimap rotation is locked.
2140
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2141
+ * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2142
+ */
2143
+ set lockRotation(active: boolean);
2144
+ /**
2145
+ * Gets the current zoom level of the minimap.
2146
+ * The zoom level determines how much of the world is visible on the minimap.
2147
+ * @returns The current zoom level of the minimap.
2148
+ */
2149
+ get zoom(): number;
2150
+ /**
2151
+ * Sets the zoom level of the minimap.
2152
+ * The zoom level determines how much of the world is visible on the minimap.
2153
+ * @param value - The new zoom level of the minimap.
2154
+ */
2155
+ set zoom(value: number);
2156
+ constructor(world: World);
2157
+ /** {@link Disposable.dispose} */
2158
+ dispose(): void;
2159
+ /** Returns the camera used by the MiniMap */
2160
+ get(): THREE.OrthographicCamera;
2161
+ /** {@link Updateable.update} */
2162
+ update(): void;
2163
+ /** {@link Resizeable.getSize} */
2164
+ getSize(): THREE.Vector2;
2165
+ /** {@link Resizeable.resize} */
2166
+ resize(size?: THREE.Vector2): void;
2167
+ private updatePlanes;
2168
+ }
2169
+ import * as WEBIFC from "web-ifc";
2170
+ /** Configuration of the IFC-fragment conversion. */
2171
+ export declare class IfcFragmentSettings {
2172
+ /** Whether to extract the IFC properties into a JSON. */
2173
+ includeProperties: boolean;
2174
+ /**
2175
+ * Generate the geometry for categories that are not included by default,
2176
+ * like IFCSPACE.
2177
+ */
2178
+ optionalCategories: number[];
2179
+ /** Whether to use the coordination data coming from the IFC files. */
2180
+ coordinate: boolean;
2181
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2182
+ wasm: {
2183
+ path: string;
2184
+ absolute: boolean;
2185
+ logLevel?: WEBIFC.LogLevel;
2186
+ };
2187
+ /** List of categories that won't be converted to fragments. */
2188
+ excludedCategories: Set<number>;
2189
+ /** Whether to save the absolute location of all IFC items. */
2190
+ saveLocations: boolean;
2191
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2192
+ webIfc: WEBIFC.LoaderSettings;
2193
+ /**
2194
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2195
+ * If set to true, the path will be set to the default path of the WASM file.
2196
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2197
+ * Default value is true.
2198
+ */
2199
+ autoSetWasm: boolean;
2200
+ /**
2201
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2202
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2203
+ * If set to null, the default file location handler will be used.
2204
+ *
2205
+ * @param url - The URL of the file to locate.
2206
+ * @returns The absolute path of the file.
2207
+ */
2208
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2209
+ }
2210
+ import * as THREE from "three";
2211
+ import { Components } from "../../Components";
2212
+ import { Event, World, Disposable } from "../../Types";
2213
+ import { Mouse } from "./mouse";
2214
+ /**
2215
+ * 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.
2216
+ */
2217
+ export declare class SimpleRaycaster implements Disposable {
2218
+ /** {@link Component.enabled} */
2219
+ enabled: boolean;
2220
+ /** The components instance to which this Raycaster belongs. */
2221
+ components: Components;
2222
+ /** {@link Disposable.onDisposed} */
2223
+ readonly onDisposed: Event<unknown>;
2224
+ /** The position of the mouse in the screen. */
2225
+ readonly mouse: Mouse;
2226
+ /**
2227
+ * A reference to the Three.js Raycaster instance.
2228
+ * This is used for raycasting operations.
2229
+ */
2230
+ readonly three: THREE.Raycaster;
2231
+ /**
2232
+ * A reference to the world instance to which this Raycaster belongs.
2233
+ * This is used to access the camera and meshes.
2234
+ */
2235
+ world: World;
2236
+ constructor(components: Components, world: World);
2237
+ /** {@link Disposable.dispose} */
2238
+ dispose(): void;
2239
+ /**
2240
+ * Throws a ray from the camera to the mouse or touch event point and returns
2241
+ * the first item found. This also takes into account the clipping planes
2242
+ * used by the renderer.
2243
+ *
2244
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2245
+ * to query. If not provided, it will query all the meshes stored in
2246
+ * {@link Components.meshes}.
2247
+ */
2248
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2249
+ /**
2250
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2251
+ * This method also takes into account the clipping planes used by the renderer.
2252
+ *
2253
+ * @param origin - The origin of the ray.
2254
+ * @param direction - The direction of the ray.
2255
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2256
+ * @returns The first intersection found or 'null' if no intersection was found.
2257
+ */
2258
+ 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;
2259
+ private intersect;
2260
+ private filterClippingPlanes;
2261
+ }
2262
+ import * as WEBIFC from "web-ifc";
2263
+ import { IfcItemsCategories } from "../../../ifc";
2264
+ export declare class SpatialStructure {
2265
+ itemsByFloor: IfcItemsCategories;
2266
+ private _units;
2267
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2268
+ cleanUp(): void;
2269
+ }
2270
+ import * as THREE from "three";
2271
+ import { Hideable, Event, World, Disposable } from "../../Types";
2272
+ import { Components } from "../../Components";
2273
+ /**
2274
+ * Configuration interface for the {@link SimpleGrid} class.
2275
+ */
2276
+ export interface GridConfig {
2277
+ /**
2278
+ * The color of the grid lines.
2279
+ */
2280
+ color: THREE.Color;
2281
+ /**
2282
+ * The size of the primary grid lines.
2283
+ */
2284
+ size1: number;
2285
+ /**
2286
+ * The size of the secondary grid lines.
2287
+ */
2288
+ size2: number;
2289
+ /**
2290
+ * The distance at which the grid lines start to fade away.
2291
+ */
2292
+ distance: number;
2293
+ }
2294
+ /**
2295
+ * 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).
2296
+ */
2297
+ export declare class SimpleGrid implements Hideable, Disposable {
2298
+ /** {@link Disposable.onDisposed} */
2299
+ readonly onDisposed: Event<unknown>;
2300
+ /** The world instance to which this Raycaster belongs. */
2301
+ world: World;
2302
+ /** The components instance to which this grid belongs. */
2303
+ components: Components;
2304
+ /** {@link Hideable.visible} */
2305
+ get visible(): boolean;
2306
+ /** {@link Hideable.visible} */
2307
+ set visible(visible: boolean);
2308
+ /** The material of the grid. */
2309
+ get material(): THREE.ShaderMaterial;
2310
+ /**
2311
+ * Whether the grid should fade away with distance. Recommended to be true for
2312
+ * perspective cameras and false for orthographic cameras.
2313
+ */
2314
+ get fade(): boolean;
2315
+ /**
2316
+ * Whether the grid should fade away with distance. Recommended to be true for
2317
+ * perspective cameras and false for orthographic cameras.
2318
+ */
2319
+ set fade(active: boolean);
2320
+ /** The Three.js mesh that contains the infinite grid. */
2321
+ readonly three: THREE.Mesh;
2322
+ private _fade;
2323
+ constructor(components: Components, world: World, config: GridConfig);
2324
+ /** {@link Disposable.dispose} */
2325
+ dispose(): void;
2326
+ private setupEvents;
2327
+ private updateZoom;
2328
+ }
2329
+ import * as THREE from "three";
2330
+ import { Disposable, Event } from "../../Types";
2331
+ /**
2332
+ * 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.
2333
+ */
2334
+ export declare class Mouse implements Disposable {
2335
+ dom: HTMLCanvasElement;
2336
+ private _event?;
2337
+ private _position;
2338
+ /** {@link Disposable.onDisposed} */
2339
+ readonly onDisposed: Event<unknown>;
2340
+ constructor(dom: HTMLCanvasElement);
2341
+ /**
2342
+ * The real position of the mouse of the Three.js canvas.
2343
+ */
2344
+ get position(): THREE.Vector2;
2345
+ /** {@link Disposable.dispose} */
2346
+ dispose(): void;
2347
+ private getPositionY;
2348
+ private getPositionX;
2349
+ private updateMouseInfo;
2350
+ private setupEvents;
2351
+ }
2352
+ import * as THREE from "three";
2353
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2354
+ /**
2355
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2356
+ *
2357
+ * @template T - The type of the scene. Default is BaseScene.
2358
+ * @template U - The type of the camera. Default is BaseCamera.
2359
+ * @template S - The type of the renderer. Default is BaseRenderer.
2360
+ */
2361
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2362
+ /**
2363
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2364
+ */
2365
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2366
+ /** {@link Updateable.onAfterUpdate} */
2367
+ readonly onAfterUpdate: Event<unknown>;
2368
+ /** {@link Updateable.onBeforeUpdate} */
2369
+ readonly onBeforeUpdate: Event<unknown>;
2370
+ /** {@link Disposable.onDisposed} */
2371
+ readonly onDisposed: Event<unknown>;
2372
+ /**
2373
+ * 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.
2374
+ */
2375
+ isDisposing: boolean;
2376
+ /**
2377
+ * Indicates whether the world is currently enabled.
2378
+ * When disabled, the world will not be updated.
2379
+ */
2380
+ enabled: boolean;
2381
+ /**
2382
+ * A unique identifier for the world.
2383
+ */
2384
+ uuid: string;
2385
+ /**
2386
+ * An optional name for the world.
2387
+ */
2388
+ name?: string;
2389
+ private _scene?;
2390
+ private _camera?;
2391
+ private _renderer;
2392
+ /**
2393
+ * Getter for the scene. If no scene is initialized, it throws an error.
2394
+ * @returns The current scene.
2395
+ */
2396
+ get scene(): T;
2095
2397
  /**
2096
- * The override material for the minimap.
2097
- * It is used to render the depth information of the world onto the minimap.
2398
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2399
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2400
+ * @param scene - The new scene to be set.
2098
2401
  */
2099
- overrideMaterial: THREE.MeshDepthMaterial;
2402
+ set scene(scene: T);
2100
2403
  /**
2101
- * The background color of the minimap.
2102
- * It is used to set the background color of the minimap's renderer.
2404
+ * Getter for the camera. If no camera is initialized, it throws an error.
2405
+ * @returns The current camera.
2103
2406
  */
2104
- backgroundColor: THREE.Color;
2407
+ get camera(): U;
2105
2408
  /**
2106
- * The WebGL renderer for the minimap.
2107
- * It is used to render the minimap onto the screen.
2409
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2410
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2411
+ * @param camera - The new camera to be set.
2108
2412
  */
2109
- renderer: THREE.WebGLRenderer;
2413
+ set camera(camera: U);
2110
2414
  /**
2111
- * A flag indicating whether the minimap is enabled.
2112
- * If disabled, the minimap will not update or render.
2415
+ * Getter for the renderer.
2416
+ * @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).
2113
2417
  */
2114
- enabled: boolean;
2418
+ get renderer(): S | null;
2115
2419
  /**
2116
- * The world in which the minimap is displayed.
2117
- * It provides access to the 3D scene, camera, and other relevant world elements.
2420
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2421
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2422
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2423
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
2118
2424
  */
2119
- world: World;
2120
- private _lockRotation;
2121
- private _camera;
2122
- private _plane;
2123
- private _size;
2124
- private _tempVector1;
2125
- private _tempVector2;
2126
- private _tempTarget;
2127
- private readonly down;
2425
+ set renderer(renderer: S | null);
2426
+ /** {@link Updateable.update} */
2427
+ update(delta?: number): void;
2428
+ /** {@link Disposable.dispose} */
2429
+ dispose(disposeResources?: boolean): void;
2430
+ }
2431
+ import * as THREE from "three";
2432
+ import { BaseRenderer, Event } from "../../Types";
2433
+ import { Components } from "../../Components";
2434
+ /**
2435
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2436
+ */
2437
+ export declare class SimpleRenderer extends BaseRenderer {
2128
2438
  /**
2129
- * Gets or sets whether the minimap rotation is locked.
2130
- * When rotation is locked, the minimap will always face the same direction as the camera.
2439
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2440
+ * Default is 'true'.
2131
2441
  */
2132
- get lockRotation(): boolean;
2442
+ enabled: boolean;
2133
2443
  /**
2134
- * Sets whether the minimap rotation is locked.
2135
- * When rotation is locked, the minimap will always face the same direction as the camera.
2136
- * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2444
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2137
2445
  */
2138
- set lockRotation(active: boolean);
2446
+ container: HTMLElement;
2139
2447
  /**
2140
- * Gets the current zoom level of the minimap.
2141
- * The zoom level determines how much of the world is visible on the minimap.
2142
- * @returns The current zoom level of the minimap.
2448
+ * The THREE.js WebGLRenderer instance.
2143
2449
  */
2144
- get zoom(): number;
2450
+ three: THREE.WebGLRenderer;
2451
+ protected _canvas: HTMLCanvasElement;
2452
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2453
+ protected _resizeObserver: ResizeObserver | null;
2454
+ protected onContainerUpdated: Event<unknown>;
2455
+ private _resizing;
2145
2456
  /**
2146
- * Sets the zoom level of the minimap.
2147
- * The zoom level determines how much of the world is visible on the minimap.
2148
- * @param value - The new zoom level of the minimap.
2457
+ * Constructor for the SimpleRenderer class.
2458
+ *
2459
+ * @param components - The components instance.
2460
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
2461
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2149
2462
  */
2150
- set zoom(value: number);
2151
- constructor(world: World);
2152
- /** {@link Disposable.dispose} */
2153
- dispose(): void;
2154
- /** Returns the camera used by the MiniMap */
2155
- get(): THREE.OrthographicCamera;
2463
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2156
2464
  /** {@link Updateable.update} */
2157
2465
  update(): void;
2158
- /** {@link Resizeable.getSize} */
2466
+ /** {@link Disposable.dispose} */
2467
+ dispose(): void;
2468
+ /** {@link Resizeable.getSize}. */
2159
2469
  getSize(): THREE.Vector2;
2160
2470
  /** {@link Resizeable.resize} */
2161
- resize(size?: THREE.Vector2): void;
2162
- private updatePlanes;
2163
- }
2164
- import { InverseAttribute } from "./types";
2165
- export declare const relToAttributesMap: Map<number, {
2166
- forRelating: InverseAttribute;
2167
- forRelated: InverseAttribute;
2168
- }>;
2169
- import * as WEBIFC from "web-ifc";
2170
- /** Configuration of the IFC-fragment conversion. */
2171
- export declare class IfcFragmentSettings {
2172
- /** Whether to extract the IFC properties into a JSON. */
2173
- includeProperties: boolean;
2471
+ resize: (size?: THREE.Vector2) => void;
2174
2472
  /**
2175
- * Generate the geometry for categories that are not included by default,
2176
- * like IFCSPACE.
2473
+ * Sets up and manages the event listeners for the renderer.
2474
+ *
2475
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2476
+ *
2477
+ * @throws Will throw an error if the renderer does not have an HTML container.
2177
2478
  */
2178
- optionalCategories: number[];
2179
- /** Whether to use the coordination data coming from the IFC files. */
2180
- coordinate: boolean;
2181
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2182
- wasm: {
2183
- path: string;
2184
- absolute: boolean;
2185
- logLevel?: WEBIFC.LogLevel;
2479
+ setupEvents(active: boolean): void;
2480
+ private resizeEvent;
2481
+ private setupRenderer;
2482
+ private onContextLost;
2483
+ private onContextBack;
2484
+ }
2485
+ import * as THREE from "three";
2486
+ import { BaseScene, Configurable, Event } from "../../Types";
2487
+ import { Components } from "../../Components";
2488
+ /**
2489
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2490
+ */
2491
+ export interface SimpleSceneConfig {
2492
+ directionalLight: {
2493
+ color: THREE.Color;
2494
+ intensity: number;
2495
+ position: THREE.Vector3;
2186
2496
  };
2187
- /** List of categories that won't be converted to fragments. */
2188
- excludedCategories: Set<number>;
2189
- /** Whether to save the absolute location of all IFC items. */
2190
- saveLocations: boolean;
2191
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2192
- webIfc: WEBIFC.LoaderSettings;
2497
+ ambientLight: {
2498
+ color: THREE.Color;
2499
+ intensity: number;
2500
+ };
2501
+ }
2502
+ /**
2503
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2504
+ */
2505
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2506
+ /** {@link Configurable.isSetup} */
2507
+ isSetup: boolean;
2193
2508
  /**
2194
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2195
- * If set to true, the path will be set to the default path of the WASM file.
2196
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2197
- * Default value is true.
2509
+ * The underlying Three.js scene object.
2510
+ * It is used to define the 3D space containing objects, lights, and cameras.
2198
2511
  */
2199
- autoSetWasm: boolean;
2512
+ three: THREE.Scene;
2513
+ /** {@link Configurable.onSetup} */
2514
+ readonly onSetup: Event<SimpleScene>;
2200
2515
  /**
2201
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2202
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2203
- * If set to null, the default file location handler will be used.
2516
+ * Configuration interface for the {@link SimpleScene}.
2517
+ * Defines properties for directional and ambient lights.
2518
+ */
2519
+ config: Required<SimpleSceneConfig>;
2520
+ constructor(components: Components);
2521
+ /** {@link Configurable.setup} */
2522
+ setup(config?: Partial<SimpleSceneConfig>): void;
2523
+ }
2524
+ import * as THREE from "three";
2525
+ import CameraControls from "camera-controls";
2526
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2527
+ import { Components } from "../../Components";
2528
+ /**
2529
+ * 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.
2530
+ */
2531
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2532
+ /** {@link Updateable.onBeforeUpdate} */
2533
+ readonly onBeforeUpdate: Event<SimpleCamera>;
2534
+ /** {@link Updateable.onAfterUpdate} */
2535
+ readonly onAfterUpdate: Event<SimpleCamera>;
2536
+ /**
2537
+ * Event that is triggered when the aspect of the camera has been updated.
2538
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2539
+ */
2540
+ readonly onAspectUpdated: Event<unknown>;
2541
+ /** {@link Disposable.onDisposed} */
2542
+ readonly onDisposed: Event<string>;
2543
+ /**
2544
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
2545
+ * This camera is used for rendering the scene.
2546
+ */
2547
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2548
+ private _allControls;
2549
+ /**
2550
+ * The object that controls the camera. An instance of
2551
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2552
+ * Transforming the camera directly will have no effect: you need to use this
2553
+ * object to move, rotate, look at objects, etc.
2554
+ */
2555
+ get controls(): CameraControls;
2556
+ /**
2557
+ * Getter for the enabled state of the camera controls.
2558
+ * If the current world is null, it returns false.
2559
+ * Otherwise, it returns the enabled state of the camera controls.
2204
2560
  *
2205
- * @param url - The URL of the file to locate.
2206
- * @returns The absolute path of the file.
2561
+ * @returns {boolean} The enabled state of the camera controls.
2207
2562
  */
2208
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2563
+ get enabled(): boolean;
2564
+ /**
2565
+ * Setter for the enabled state of the camera controls.
2566
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2567
+ *
2568
+ * @param {boolean} enabled - The new enabled state of the camera controls.
2569
+ */
2570
+ set enabled(enabled: boolean);
2571
+ constructor(components: Components);
2572
+ /** {@link Disposable.dispose} */
2573
+ dispose(): void;
2574
+ /** {@link Updateable.update} */
2575
+ update(_delta: number): void;
2576
+ /**
2577
+ * Updates the aspect of the camera to match the size of the
2578
+ * {@link Components.renderer}.
2579
+ */
2580
+ updateAspect: () => void;
2581
+ private setupCamera;
2582
+ private newCameraControls;
2583
+ private setupEvents;
2584
+ private static getSubsetOfThree;
2209
2585
  }
2210
2586
  /**
2211
2587
  * 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.
@@ -2371,14 +2747,6 @@ export interface CameraControllable {
2371
2747
  */
2372
2748
  controls: CameraControls;
2373
2749
  }
2374
- import * as WEBIFC from "web-ifc";
2375
- import { IfcItemsCategories } from "../../../ifc";
2376
- export declare class SpatialStructure {
2377
- itemsByFloor: IfcItemsCategories;
2378
- private _units;
2379
- setUp(webIfc: WEBIFC.IfcAPI): void;
2380
- cleanUp(): void;
2381
- }
2382
2750
  import { Base } from "./base";
2383
2751
  /**
2384
2752
  * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
@@ -2392,28 +2760,24 @@ export declare abstract class Component extends Base {
2392
2760
  */
2393
2761
  abstract enabled: boolean;
2394
2762
  }
2395
- import { Base } from "./base";
2396
- import { World } from "./world";
2397
- import { Event } from "./event";
2763
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2398
2764
  import { Components } from "../../Components";
2399
2765
  /**
2400
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2766
+ * Base class of the library. Useful for finding out the interfaces something implements.
2401
2767
  */
2402
- export declare abstract class BaseWorldItem extends Base {
2403
- readonly worlds: Map<string, World>;
2404
- /**
2405
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2406
- * The event payload contains the world instance and the action ("added" or "removed").
2407
- */
2408
- readonly onWorldChanged: Event<{
2409
- world: World;
2410
- action: "added" | "removed";
2411
- }>;
2412
- /**
2413
- * The current world this item is associated with. It can be null if no world is currently active.
2414
- */
2415
- currentWorld: World | null;
2416
- protected constructor(components: Components);
2768
+ export declare abstract class Base {
2769
+ components: Components;
2770
+ constructor(components: Components);
2771
+ /** Whether is component is {@link Disposable}. */
2772
+ isDisposeable: () => this is Disposable;
2773
+ /** Whether is component is {@link Resizeable}. */
2774
+ isResizeable: () => this is Resizeable;
2775
+ /** Whether is component is {@link Updateable}. */
2776
+ isUpdateable: () => this is Updateable;
2777
+ /** Whether is component is {@link Hideable}. */
2778
+ isHideable: () => this is Hideable;
2779
+ /** Whether is component is {@link Configurable}. */
2780
+ isConfigurable: () => this is Configurable<any>;
2417
2781
  }
2418
2782
  import * as THREE from "three";
2419
2783
  import CameraControls from "camera-controls";
@@ -2443,58 +2807,48 @@ export declare abstract class BaseCamera extends BaseWorldItem {
2443
2807
  */
2444
2808
  hasCameraControls: () => this is CameraControllable;
2445
2809
  }
2446
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2810
+ import { Base } from "./base";
2811
+ import { World } from "./world";
2812
+ import { Event } from "./event";
2447
2813
  import { Components } from "../../Components";
2448
2814
  /**
2449
- * Base class of the library. Useful for finding out the interfaces something implements.
2450
- */
2451
- export declare abstract class Base {
2452
- components: Components;
2453
- constructor(components: Components);
2454
- /** Whether is component is {@link Disposable}. */
2455
- isDisposeable: () => this is Disposable;
2456
- /** Whether is component is {@link Resizeable}. */
2457
- isResizeable: () => this is Resizeable;
2458
- /** Whether is component is {@link Updateable}. */
2459
- isUpdateable: () => this is Updateable;
2460
- /** Whether is component is {@link Hideable}. */
2461
- isHideable: () => this is Hideable;
2462
- /** Whether is component is {@link Configurable}. */
2463
- isConfigurable: () => this is Configurable<any>;
2464
- }
2465
- import * as THREE from "three";
2466
- import { BaseScene } from "./base-scene";
2467
- import { BaseCamera } from "./base-camera";
2468
- import { BaseRenderer } from "./base-renderer";
2469
- import { Updateable, Disposable } from "./interfaces";
2470
- /**
2471
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2815
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2472
2816
  */
2473
- export interface World extends Disposable, Updateable {
2474
- /**
2475
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2476
- */
2477
- meshes: Set<THREE.Mesh>;
2478
- /**
2479
- * The base scene of the world.
2480
- */
2481
- scene: BaseScene;
2482
- /**
2483
- * The base camera of the world.
2484
- */
2485
- camera: BaseCamera;
2817
+ export declare abstract class BaseWorldItem extends Base {
2818
+ readonly worlds: Map<string, World>;
2486
2819
  /**
2487
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2820
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2821
+ * The event payload contains the world instance and the action ("added" or "removed").
2488
2822
  */
2489
- renderer: BaseRenderer | null;
2823
+ readonly onWorldChanged: Event<{
2824
+ world: World;
2825
+ action: "added" | "removed";
2826
+ }>;
2490
2827
  /**
2491
- * A unique identifier for the world.
2828
+ * The current world this item is associated with. It can be null if no world is currently active.
2492
2829
  */
2493
- uuid: string;
2830
+ currentWorld: World | null;
2831
+ protected constructor(components: Components);
2832
+ }
2833
+ import * as THREE from "three";
2834
+ import { Disposable } from "./interfaces";
2835
+ import { Event } from "./event";
2836
+ import { Components } from "../../Components";
2837
+ import { BaseWorldItem } from "./base-world-item";
2838
+ /**
2839
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2840
+ */
2841
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2842
+ /** {@link Disposable.onDisposed} */
2843
+ readonly onDisposed: Event<unknown>;
2494
2844
  /**
2495
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2845
+ * Abstract property representing the three.js object associated with this scene.
2846
+ * It should be implemented by subclasses.
2496
2847
  */
2497
- isDisposing: boolean;
2848
+ abstract three: THREE.Object3D;
2849
+ protected constructor(components: Components);
2850
+ /** {@link Disposable.dispose} */
2851
+ dispose(): void;
2498
2852
  }
2499
2853
  import * as THREE from "three";
2500
2854
  import { Vector2 } from "three";
@@ -2562,196 +2916,94 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2562
2916
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2563
2917
  }
2564
2918
  import * as THREE from "three";
2565
- import { Disposable } from "./interfaces";
2566
- import { Event } from "./event";
2567
- import { Components } from "../../Components";
2568
- import { BaseWorldItem } from "./base-world-item";
2919
+ import { BaseScene } from "./base-scene";
2920
+ import { BaseCamera } from "./base-camera";
2921
+ import { BaseRenderer } from "./base-renderer";
2922
+ import { Updateable, Disposable } from "./interfaces";
2569
2923
  /**
2570
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2924
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2571
2925
  */
2572
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2573
- /** {@link Disposable.onDisposed} */
2574
- readonly onDisposed: Event<unknown>;
2926
+ export interface World extends Disposable, Updateable {
2575
2927
  /**
2576
- * Abstract property representing the three.js object associated with this scene.
2577
- * It should be implemented by subclasses.
2928
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2578
2929
  */
2579
- abstract three: THREE.Object3D;
2580
- protected constructor(components: Components);
2581
- /** {@link Disposable.dispose} */
2582
- dispose(): void;
2583
- }
2584
- import * as THREE from "three";
2585
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2586
- /**
2587
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2588
- *
2589
- * @template T - The type of the scene. Default is BaseScene.
2590
- * @template U - The type of the camera. Default is BaseCamera.
2591
- * @template S - The type of the renderer. Default is BaseRenderer.
2592
- */
2593
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2930
+ meshes: Set<THREE.Mesh>;
2594
2931
  /**
2595
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2932
+ * The base scene of the world.
2596
2933
  */
2597
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2598
- /** {@link Updateable.onAfterUpdate} */
2599
- readonly onAfterUpdate: Event<unknown>;
2600
- /** {@link Updateable.onBeforeUpdate} */
2601
- readonly onBeforeUpdate: Event<unknown>;
2602
- /** {@link Disposable.onDisposed} */
2603
- readonly onDisposed: Event<unknown>;
2934
+ scene: BaseScene;
2604
2935
  /**
2605
- * 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.
2936
+ * The base camera of the world.
2606
2937
  */
2607
- isDisposing: boolean;
2938
+ camera: BaseCamera;
2608
2939
  /**
2609
- * Indicates whether the world is currently enabled.
2610
- * When disabled, the world will not be updated.
2940
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2611
2941
  */
2612
- enabled: boolean;
2942
+ renderer: BaseRenderer | null;
2613
2943
  /**
2614
2944
  * A unique identifier for the world.
2615
2945
  */
2616
2946
  uuid: string;
2617
2947
  /**
2618
- * An optional name for the world.
2619
- */
2620
- name?: string;
2621
- private _scene?;
2622
- private _camera?;
2623
- private _renderer;
2624
- /**
2625
- * Getter for the scene. If no scene is initialized, it throws an error.
2626
- * @returns The current scene.
2627
- */
2628
- get scene(): T;
2629
- /**
2630
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2631
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2632
- * @param scene - The new scene to be set.
2633
- */
2634
- set scene(scene: T);
2635
- /**
2636
- * Getter for the camera. If no camera is initialized, it throws an error.
2637
- * @returns The current camera.
2638
- */
2639
- get camera(): U;
2640
- /**
2641
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2642
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2643
- * @param camera - The new camera to be set.
2644
- */
2645
- set camera(camera: U);
2646
- /**
2647
- * Getter for the renderer.
2648
- * @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).
2649
- */
2650
- get renderer(): S | null;
2651
- /**
2652
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2653
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2654
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2655
- * @param renderer - The new renderer to be set or null to remove the current renderer.
2656
- */
2657
- set renderer(renderer: S | null);
2658
- /** {@link Updateable.update} */
2659
- update(delta?: number): void;
2660
- /** {@link Disposable.dispose} */
2661
- dispose(disposeResources?: boolean): void;
2662
- }
2663
- import * as THREE from "three";
2664
- import { BaseScene, Configurable, Event } from "../../Types";
2665
- import { Components } from "../../Components";
2666
- /**
2667
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2668
- */
2669
- export interface SimpleSceneConfig {
2670
- directionalLight: {
2671
- color: THREE.Color;
2672
- intensity: number;
2673
- position: THREE.Vector3;
2674
- };
2675
- ambientLight: {
2676
- color: THREE.Color;
2677
- intensity: number;
2678
- };
2679
- }
2680
- /**
2681
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2682
- */
2683
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2684
- /** {@link Configurable.isSetup} */
2685
- isSetup: boolean;
2686
- /**
2687
- * The underlying Three.js scene object.
2688
- * It is used to define the 3D space containing objects, lights, and cameras.
2689
- */
2690
- three: THREE.Scene;
2691
- /** {@link Configurable.onSetup} */
2692
- readonly onSetup: Event<SimpleScene>;
2693
- /**
2694
- * Configuration interface for the {@link SimpleScene}.
2695
- * Defines properties for directional and ambient lights.
2948
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2696
2949
  */
2697
- config: Required<SimpleSceneConfig>;
2698
- constructor(components: Components);
2699
- /** {@link Configurable.setup} */
2700
- setup(config?: Partial<SimpleSceneConfig>): void;
2950
+ isDisposing: boolean;
2701
2951
  }
2702
2952
  import * as THREE from "three";
2703
- import { BaseRenderer, Event } from "../../Types";
2953
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2704
2954
  import { Components } from "../../Components";
2955
+ import { Event, World, Disposable } from "../../Types";
2705
2956
  /**
2706
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2957
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2707
2958
  */
2708
- export declare class SimpleRenderer extends BaseRenderer {
2959
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2709
2960
  /**
2710
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2711
- * Default is 'true'.
2961
+ * Event triggered when the visibility of meshes is updated.
2962
+ * Contains two sets: seen and unseen.
2712
2963
  */
2713
- enabled: boolean;
2964
+ readonly onViewUpdated: Event<{
2965
+ seen: Set<THREE.Mesh>;
2966
+ unseen: Set<THREE.Mesh>;
2967
+ }>;
2714
2968
  /**
2715
- * The HTML container of the THREE.js canvas where the scene is rendered.
2969
+ * Pixels in screen a geometry must occupy to be considered "seen".
2970
+ * Default value is 100.
2716
2971
  */
2717
- container: HTMLElement;
2972
+ threshold: number;
2718
2973
  /**
2719
- * The THREE.js WebGLRenderer instance.
2974
+ * Map of color code to THREE.InstancedMesh.
2975
+ * Used to keep track of color-coded meshes.
2720
2976
  */
2721
- three: THREE.WebGLRenderer;
2722
- protected _canvas: HTMLCanvasElement;
2723
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2724
- protected _resizeObserver: ResizeObserver | null;
2725
- protected onContainerUpdated: Event<unknown>;
2726
- private _resizing;
2977
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2727
2978
  /**
2728
- * Constructor for the SimpleRenderer class.
2729
- *
2730
- * @param components - The components instance.
2731
- * @param container - The HTML container where the THREE.js canvas will be rendered.
2732
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2979
+ * Flag to indicate if the renderer is currently processing.
2980
+ * Used to prevent concurrent processing.
2733
2981
  */
2734
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2735
- /** {@link Updateable.update} */
2736
- update(): void;
2982
+ isProcessing: boolean;
2983
+ private _colorCodeMeshMap;
2984
+ private _meshIDColorCodeMap;
2985
+ private _currentVisibleMeshes;
2986
+ private _recentlyHiddenMeshes;
2987
+ private _intervalID;
2988
+ private readonly _transparentMat;
2989
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2737
2990
  /** {@link Disposable.dispose} */
2738
2991
  dispose(): void;
2739
- /** {@link Resizeable.getSize}. */
2740
- getSize(): THREE.Vector2;
2741
- /** {@link Resizeable.resize} */
2742
- resize: (size?: THREE.Vector2) => void;
2743
2992
  /**
2744
- * Sets up and manages the event listeners for the renderer.
2745
- *
2746
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2747
- *
2748
- * @throws Will throw an error if the renderer does not have an HTML container.
2993
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2994
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2995
+ * @returns {void}
2749
2996
  */
2750
- setupEvents(active: boolean): void;
2751
- private resizeEvent;
2752
- private setupRenderer;
2753
- private onContextLost;
2754
- private onContextBack;
2997
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2998
+ /**
2999
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3000
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3001
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3002
+ * @returns {void}
3003
+ */
3004
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3005
+ private handleWorkerMessage;
3006
+ private getAvailableMaterial;
2755
3007
  }
2756
3008
  import * as THREE from "three";
2757
3009
  import { Components } from "../../Components";
@@ -2845,206 +3097,103 @@ export declare class CullerRenderer {
2845
3097
  private applySettings;
2846
3098
  }
2847
3099
  import * as THREE from "three";
2848
- import CameraControls from "camera-controls";
2849
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3100
+ import { Hideable, Disposable, Event, World } from "../../Types";
2850
3101
  import { Components } from "../../Components";
2851
3102
  /**
2852
- * 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.
3103
+ * Each of the clipping planes created by the clipper.
2853
3104
  */
2854
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2855
- /** {@link Updateable.onBeforeUpdate} */
2856
- readonly onBeforeUpdate: Event<SimpleCamera>;
2857
- /** {@link Updateable.onAfterUpdate} */
2858
- readonly onAfterUpdate: Event<SimpleCamera>;
2859
- /**
2860
- * Event that is triggered when the aspect of the camera has been updated.
2861
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2862
- */
2863
- readonly onAspectUpdated: Event<unknown>;
3105
+ export declare class SimplePlane implements Disposable, Hideable {
3106
+ /** Event that fires when the user starts dragging a clipping plane. */
3107
+ readonly onDraggingStarted: Event<unknown>;
3108
+ /** Event that fires when the user stops dragging a clipping plane. */
3109
+ readonly onDraggingEnded: Event<unknown>;
2864
3110
  /** {@link Disposable.onDisposed} */
2865
- readonly onDisposed: Event<string>;
2866
- /**
2867
- * A three.js PerspectiveCamera or OrthographicCamera instance.
2868
- * This camera is used for rendering the scene.
2869
- */
2870
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2871
- private _allControls;
2872
- /**
2873
- * The object that controls the camera. An instance of
2874
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2875
- * Transforming the camera directly will have no effect: you need to use this
2876
- * object to move, rotate, look at objects, etc.
2877
- */
2878
- get controls(): CameraControls;
2879
- /**
2880
- * Getter for the enabled state of the camera controls.
2881
- * If the current world is null, it returns false.
2882
- * Otherwise, it returns the enabled state of the camera controls.
2883
- *
2884
- * @returns {boolean} The enabled state of the camera controls.
2885
- */
2886
- get enabled(): boolean;
2887
- /**
2888
- * Setter for the enabled state of the camera controls.
2889
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2890
- *
2891
- * @param {boolean} enabled - The new enabled state of the camera controls.
2892
- */
2893
- set enabled(enabled: boolean);
2894
- constructor(components: Components);
2895
- /** {@link Disposable.dispose} */
2896
- dispose(): void;
2897
- /** {@link Updateable.update} */
2898
- update(_delta: number): void;
2899
- /**
2900
- * Updates the aspect of the camera to match the size of the
2901
- * {@link Components.renderer}.
2902
- */
2903
- updateAspect: () => void;
2904
- private setupCamera;
2905
- private newCameraControls;
2906
- private setupEvents;
2907
- private static getSubsetOfThree;
2908
- }
2909
- import * as THREE from "three";
2910
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2911
- import { Components } from "../../Components";
2912
- import { Event, World, Disposable } from "../../Types";
2913
- /**
2914
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2915
- */
2916
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2917
- /**
2918
- * Event triggered when the visibility of meshes is updated.
2919
- * Contains two sets: seen and unseen.
2920
- */
2921
- readonly onViewUpdated: Event<{
2922
- seen: Set<THREE.Mesh>;
2923
- unseen: Set<THREE.Mesh>;
2924
- }>;
2925
- /**
2926
- * Pixels in screen a geometry must occupy to be considered "seen".
2927
- * Default value is 100.
2928
- */
2929
- threshold: number;
2930
- /**
2931
- * Map of color code to THREE.InstancedMesh.
2932
- * Used to keep track of color-coded meshes.
2933
- */
2934
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2935
- /**
2936
- * Flag to indicate if the renderer is currently processing.
2937
- * Used to prevent concurrent processing.
2938
- */
2939
- isProcessing: boolean;
2940
- private _colorCodeMeshMap;
2941
- private _meshIDColorCodeMap;
2942
- private _currentVisibleMeshes;
2943
- private _recentlyHiddenMeshes;
2944
- private _intervalID;
2945
- private readonly _transparentMat;
2946
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2947
- /** {@link Disposable.dispose} */
2948
- dispose(): void;
2949
- /**
2950
- * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2951
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2952
- * @returns {void}
2953
- */
2954
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3111
+ readonly onDisposed: Event<unknown>;
2955
3112
  /**
2956
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2957
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2958
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2959
- * @returns {void}
3113
+ * The normal vector of the clipping plane.
2960
3114
  */
2961
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2962
- private handleWorkerMessage;
2963
- private getAvailableMaterial;
2964
- }
2965
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2966
- import * as THREE from "three";
2967
- import { Hideable, Event, World, Disposable } from "../../Types";
2968
- import { Components } from "../../Components";
2969
- /**
2970
- * Configuration interface for the {@link SimpleGrid} class.
2971
- */
2972
- export interface GridConfig {
3115
+ readonly normal: THREE.Vector3;
2973
3116
  /**
2974
- * The color of the grid lines.
3117
+ * The origin point of the clipping plane.
2975
3118
  */
2976
- color: THREE.Color;
3119
+ readonly origin: THREE.Vector3;
2977
3120
  /**
2978
- * The size of the primary grid lines.
3121
+ * The THREE.js Plane object representing the clipping plane.
2979
3122
  */
2980
- size1: number;
3123
+ readonly three: THREE.Plane;
3124
+ /** The components instance to which this plane belongs. */
3125
+ components: Components;
3126
+ /** The world instance to which this plane belongs. */
3127
+ world: World;
3128
+ protected readonly _helper: THREE.Object3D;
3129
+ protected _visible: boolean;
3130
+ protected _enabled: boolean;
3131
+ private _controlsActive;
3132
+ private readonly _arrowBoundBox;
3133
+ private readonly _planeMesh;
3134
+ private readonly _controls;
3135
+ private readonly _hiddenMaterial;
2981
3136
  /**
2982
- * The size of the secondary grid lines.
3137
+ * Getter for the enabled state of the clipping plane.
3138
+ * @returns {boolean} The current enabled state.
2983
3139
  */
2984
- size2: number;
3140
+ get enabled(): boolean;
2985
3141
  /**
2986
- * The distance at which the grid lines start to fade away.
3142
+ * Setter for the enabled state of the clipping plane.
3143
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3144
+ * @param {boolean} state - The new enabled state.
2987
3145
  */
2988
- distance: number;
2989
- }
2990
- /**
2991
- * 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).
2992
- */
2993
- export declare class SimpleGrid implements Hideable, Disposable {
2994
- /** {@link Disposable.onDisposed} */
2995
- readonly onDisposed: Event<unknown>;
2996
- /** The world instance to which this Raycaster belongs. */
2997
- world: World;
2998
- /** The components instance to which this grid belongs. */
2999
- components: Components;
3000
- /** {@link Hideable.visible} */
3146
+ set enabled(state: boolean);
3147
+ /** {@link Hideable.visible } */
3001
3148
  get visible(): boolean;
3002
- /** {@link Hideable.visible} */
3003
- set visible(visible: boolean);
3004
- /** The material of the grid. */
3005
- get material(): THREE.ShaderMaterial;
3006
- /**
3007
- * Whether the grid should fade away with distance. Recommended to be true for
3008
- * perspective cameras and false for orthographic cameras.
3009
- */
3010
- get fade(): boolean;
3149
+ /** {@link Hideable.visible } */
3150
+ set visible(state: boolean);
3151
+ /** The meshes used for raycasting */
3152
+ get meshes(): THREE.Mesh[];
3153
+ /** The material of the clipping plane representation. */
3154
+ get planeMaterial(): THREE.Material | THREE.Material[];
3155
+ /** The material of the clipping plane representation. */
3156
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
3157
+ /** The size of the clipping plane representation. */
3158
+ get size(): number;
3159
+ /** Sets the size of the clipping plane representation. */
3160
+ set size(size: number);
3011
3161
  /**
3012
- * Whether the grid should fade away with distance. Recommended to be true for
3013
- * perspective cameras and false for orthographic cameras.
3162
+ * Getter for the helper object of the clipping plane.
3163
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3164
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3165
+ *
3166
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
3014
3167
  */
3015
- set fade(active: boolean);
3016
- /** The Three.js mesh that contains the infinite grid. */
3017
- readonly three: THREE.Mesh;
3018
- private _fade;
3019
- constructor(components: Components, world: World, config: GridConfig);
3020
- /** {@link Disposable.dispose} */
3021
- dispose(): void;
3022
- private setupEvents;
3023
- private updateZoom;
3024
- }
3025
- import * as THREE from "three";
3026
- import { Disposable, Event } from "../../Types";
3027
- /**
3028
- * 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.
3029
- */
3030
- export declare class Mouse implements Disposable {
3031
- dom: HTMLCanvasElement;
3032
- private _event?;
3033
- private _position;
3034
- /** {@link Disposable.onDisposed} */
3035
- readonly onDisposed: Event<unknown>;
3036
- constructor(dom: HTMLCanvasElement);
3168
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3169
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3037
3170
  /**
3038
- * The real position of the mouse of the Three.js canvas.
3171
+ * Sets the clipping plane's normal and origin from the given normal and point.
3172
+ * This method resets the clipping plane's state, updates the normal and origin,
3173
+ * and positions the helper object accordingly.
3174
+ *
3175
+ * @param normal - The new normal vector for the clipping plane.
3176
+ * @param point - The new origin point for the clipping plane.
3177
+ *
3178
+ * @returns {void}
3039
3179
  */
3040
- get position(): THREE.Vector2;
3180
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3181
+ /** {@link Updateable.update} */
3182
+ update: () => void;
3041
3183
  /** {@link Disposable.dispose} */
3042
3184
  dispose(): void;
3043
- private getPositionY;
3044
- private getPositionX;
3045
- private updateMouseInfo;
3046
- private setupEvents;
3185
+ private reset;
3186
+ protected toggleControls(state: boolean): void;
3187
+ private newTransformControls;
3188
+ private initializeControls;
3189
+ private createArrowBoundingBox;
3190
+ private changeDrag;
3191
+ private notifyDraggingChanged;
3192
+ private preventCameraMovement;
3193
+ private newHelper;
3194
+ private static newPlaneMesh;
3047
3195
  }
3196
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3048
3197
  import { NavigationMode } from "./types";
3049
3198
  import { OrthoPerspectiveCamera } from "../index";
3050
3199
  /**
@@ -3061,57 +3210,21 @@ export declare class FirstPersonMode implements NavigationMode {
3061
3210
  set(active: boolean): void;
3062
3211
  private setupFirstPersonCamera;
3063
3212
  }
3064
- import * as THREE from "three";
3065
- import { Components } from "../../Components";
3066
- import { Event, World, Disposable } from "../../Types";
3067
- import { Mouse } from "./mouse";
3213
+ import { NavigationMode } from "./types";
3214
+ import { OrthoPerspectiveCamera } from "../index";
3068
3215
  /**
3069
- * 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.
3216
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3070
3217
  */
3071
- export declare class SimpleRaycaster implements Disposable {
3072
- /** {@link Component.enabled} */
3218
+ export declare class OrbitMode implements NavigationMode {
3219
+ camera: OrthoPerspectiveCamera;
3220
+ /** {@link NavigationMode.enabled} */
3073
3221
  enabled: boolean;
3074
- /** The components instance to which this Raycaster belongs. */
3075
- components: Components;
3076
- /** {@link Disposable.onDisposed} */
3077
- readonly onDisposed: Event<unknown>;
3078
- /** The position of the mouse in the screen. */
3079
- readonly mouse: Mouse;
3080
- /**
3081
- * A reference to the Three.js Raycaster instance.
3082
- * This is used for raycasting operations.
3083
- */
3084
- readonly three: THREE.Raycaster;
3085
- /**
3086
- * A reference to the world instance to which this Raycaster belongs.
3087
- * This is used to access the camera and meshes.
3088
- */
3089
- world: World;
3090
- constructor(components: Components, world: World);
3091
- /** {@link Disposable.dispose} */
3092
- dispose(): void;
3093
- /**
3094
- * Throws a ray from the camera to the mouse or touch event point and returns
3095
- * the first item found. This also takes into account the clipping planes
3096
- * used by the renderer.
3097
- *
3098
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3099
- * to query. If not provided, it will query all the meshes stored in
3100
- * {@link Components.meshes}.
3101
- */
3102
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3103
- /**
3104
- * Casts a ray from a given origin in a given direction and returns the first item found.
3105
- * This method also takes into account the clipping planes used by the renderer.
3106
- *
3107
- * @param origin - The origin of the ray.
3108
- * @param direction - The direction of the ray.
3109
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3110
- * @returns The first intersection found or 'null' if no intersection was found.
3111
- */
3112
- 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;
3113
- private intersect;
3114
- private filterClippingPlanes;
3222
+ /** {@link NavigationMode.id} */
3223
+ readonly id = "Orbit";
3224
+ constructor(camera: OrthoPerspectiveCamera);
3225
+ /** {@link NavigationMode.set} */
3226
+ set(active: boolean): void;
3227
+ private activateOrbitControls;
3115
3228
  }
3116
3229
  import { NavigationMode } from "./types";
3117
3230
  import { OrthoPerspectiveCamera } from "../index";
@@ -3133,22 +3246,6 @@ export declare class PlanMode implements NavigationMode {
3133
3246
  /** {@link NavigationMode.set} */
3134
3247
  set(active: boolean): void;
3135
3248
  }
3136
- import { NavigationMode } from "./types";
3137
- import { OrthoPerspectiveCamera } from "../index";
3138
- /**
3139
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3140
- */
3141
- export declare class OrbitMode implements NavigationMode {
3142
- camera: OrthoPerspectiveCamera;
3143
- /** {@link NavigationMode.enabled} */
3144
- enabled: boolean;
3145
- /** {@link NavigationMode.id} */
3146
- readonly id = "Orbit";
3147
- constructor(camera: OrthoPerspectiveCamera);
3148
- /** {@link NavigationMode.set} */
3149
- set(active: boolean): void;
3150
- private activateOrbitControls;
3151
- }
3152
3249
  import * as THREE from "three";
3153
3250
  import { CameraProjection } from "./types";
3154
3251
  import { Event } from "../../Types";
@@ -3220,103 +3317,6 @@ export interface NavigationMode {
3220
3317
  /** Whether this navigation mode is active or not. */
3221
3318
  enabled: boolean;
3222
3319
  }
3223
- import * as THREE from "three";
3224
- import { Hideable, Disposable, Event, World } from "../../Types";
3225
- import { Components } from "../../Components";
3226
- /**
3227
- * Each of the clipping planes created by the clipper.
3228
- */
3229
- export declare class SimplePlane implements Disposable, Hideable {
3230
- /** Event that fires when the user starts dragging a clipping plane. */
3231
- readonly onDraggingStarted: Event<unknown>;
3232
- /** Event that fires when the user stops dragging a clipping plane. */
3233
- readonly onDraggingEnded: Event<unknown>;
3234
- /** {@link Disposable.onDisposed} */
3235
- readonly onDisposed: Event<unknown>;
3236
- /**
3237
- * The normal vector of the clipping plane.
3238
- */
3239
- readonly normal: THREE.Vector3;
3240
- /**
3241
- * The origin point of the clipping plane.
3242
- */
3243
- readonly origin: THREE.Vector3;
3244
- /**
3245
- * The THREE.js Plane object representing the clipping plane.
3246
- */
3247
- readonly three: THREE.Plane;
3248
- /** The components instance to which this plane belongs. */
3249
- components: Components;
3250
- /** The world instance to which this plane belongs. */
3251
- world: World;
3252
- protected readonly _helper: THREE.Object3D;
3253
- protected _visible: boolean;
3254
- protected _enabled: boolean;
3255
- private _controlsActive;
3256
- private readonly _arrowBoundBox;
3257
- private readonly _planeMesh;
3258
- private readonly _controls;
3259
- private readonly _hiddenMaterial;
3260
- /**
3261
- * Getter for the enabled state of the clipping plane.
3262
- * @returns {boolean} The current enabled state.
3263
- */
3264
- get enabled(): boolean;
3265
- /**
3266
- * Setter for the enabled state of the clipping plane.
3267
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3268
- * @param {boolean} state - The new enabled state.
3269
- */
3270
- set enabled(state: boolean);
3271
- /** {@link Hideable.visible } */
3272
- get visible(): boolean;
3273
- /** {@link Hideable.visible } */
3274
- set visible(state: boolean);
3275
- /** The meshes used for raycasting */
3276
- get meshes(): THREE.Mesh[];
3277
- /** The material of the clipping plane representation. */
3278
- get planeMaterial(): THREE.Material | THREE.Material[];
3279
- /** The material of the clipping plane representation. */
3280
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3281
- /** The size of the clipping plane representation. */
3282
- get size(): number;
3283
- /** Sets the size of the clipping plane representation. */
3284
- set size(size: number);
3285
- /**
3286
- * Getter for the helper object of the clipping plane.
3287
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3288
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3289
- *
3290
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3291
- */
3292
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3293
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3294
- /**
3295
- * Sets the clipping plane's normal and origin from the given normal and point.
3296
- * This method resets the clipping plane's state, updates the normal and origin,
3297
- * and positions the helper object accordingly.
3298
- *
3299
- * @param normal - The new normal vector for the clipping plane.
3300
- * @param point - The new origin point for the clipping plane.
3301
- *
3302
- * @returns {void}
3303
- */
3304
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3305
- /** {@link Updateable.update} */
3306
- update: () => void;
3307
- /** {@link Disposable.dispose} */
3308
- dispose(): void;
3309
- private reset;
3310
- protected toggleControls(state: boolean): void;
3311
- private newTransformControls;
3312
- private initializeControls;
3313
- private createArrowBoundingBox;
3314
- private changeDrag;
3315
- private notifyDraggingChanged;
3316
- private preventCameraMovement;
3317
- private newHelper;
3318
- private static newPlaneMesh;
3319
- }
3320
3320
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3321
3321
  /**
3322
3322
  * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3343,6 +3343,11 @@ export declare class CivilReader {
3343
3343
  } | undefined;
3344
3344
  private getCurves;
3345
3345
  }
3346
+ import * as WEBIFC from "web-ifc";
3347
+ export declare class IfcMetadataReader {
3348
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3349
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3350
+ }
3346
3351
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3347
3352
  /**
3348
3353
  * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3360,11 +3365,6 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3360
3365
  minAssetsSize: number;
3361
3366
  }
3362
3367
  import * as WEBIFC from "web-ifc";
3363
- export declare class IfcMetadataReader {
3364
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3365
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3366
- }
3367
- import * as WEBIFC from "web-ifc";
3368
3368
  import * as THREE from "three";
3369
3369
  export declare class Units {
3370
3370
  factor: number;
@@ -3403,11 +3403,6 @@ export interface StreamedAsset {
3403
3403
  color: number[];
3404
3404
  }[];
3405
3405
  }
3406
- import { BufferGeometry } from "three";
3407
- import * as THREE from "three";
3408
- export declare class TransformHelper {
3409
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3410
- }
3411
3406
  export type RelationsMap = Map<number, Map<number, number[]>>;
3412
3407
  export interface ModelsRelationMap {
3413
3408
  [modelID: string]: RelationsMap;
@@ -3432,5 +3427,10 @@ export type InverseAttributes = [
3432
3427
  "ContainsElements"
3433
3428
  ];
3434
3429
  export type InverseAttribute = InverseAttributes[number];
3430
+ import { BufferGeometry } from "three";
3431
+ import * as THREE from "three";
3432
+ export declare class TransformHelper {
3433
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3434
+ }
3435
3435
 
3436
3436
  }