@thatopen/components 2.0.8 → 2.0.10

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.
Files changed (41) hide show
  1. package/dist/core/Clipper/index.d.ts +34 -6
  2. package/dist/core/Clipper/src/simple-plane.d.ts +40 -4
  3. package/dist/core/Components/index.d.ts +42 -18
  4. package/dist/core/Cullers/index.d.ts +23 -27
  5. package/dist/core/Cullers/src/culler-renderer.d.ts +26 -2
  6. package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +32 -4
  7. package/dist/core/Disposer/index.d.ts +6 -4
  8. package/dist/core/Grids/index.d.ts +35 -1
  9. package/dist/core/Grids/src/simple-grid.d.ts +3 -0
  10. package/dist/core/MiniMap/index.d.ts +31 -0
  11. package/dist/core/MiniMap/src/index.d.ts +55 -0
  12. package/dist/core/OrthoPerspectiveCamera/index.d.ts +19 -6
  13. package/dist/core/OrthoPerspectiveCamera/src/first-person-mode.d.ts +1 -2
  14. package/dist/core/OrthoPerspectiveCamera/src/orbit-mode.d.ts +1 -2
  15. package/dist/core/OrthoPerspectiveCamera/src/plan-mode.d.ts +1 -2
  16. package/dist/core/OrthoPerspectiveCamera/src/projections.d.ts +10 -2
  17. package/dist/core/OrthoPerspectiveCamera/src/types.d.ts +1 -2
  18. package/dist/core/Raycasters/index.d.ts +29 -0
  19. package/dist/core/Raycasters/src/simple-raycaster.d.ts +18 -0
  20. package/dist/core/Types/src/async-event.d.ts +1 -7
  21. package/dist/core/Types/src/base-camera.d.ts +18 -1
  22. package/dist/core/Types/src/base-renderer.d.ts +34 -9
  23. package/dist/core/Types/src/base-scene.d.ts +7 -0
  24. package/dist/core/Types/src/base-world-item.d.ts +8 -2
  25. package/dist/core/Types/src/base.d.ts +1 -1
  26. package/dist/core/Types/src/component.d.ts +1 -6
  27. package/dist/core/Types/src/event.d.ts +1 -7
  28. package/dist/core/Types/src/interfaces.d.ts +9 -24
  29. package/dist/core/Types/src/world.d.ts +21 -0
  30. package/dist/core/Worlds/index.d.ts +31 -15
  31. package/dist/core/Worlds/src/simple-camera.d.ts +22 -6
  32. package/dist/core/Worlds/src/simple-renderer.d.ts +25 -3
  33. package/dist/core/Worlds/src/simple-scene.d.ts +13 -4
  34. package/dist/core/Worlds/src/simple-world.d.ts +57 -6
  35. package/dist/fragments/BoundingBoxer/index.d.ts +1 -2
  36. package/dist/fragments/FragmentsManager/index.d.ts +22 -2
  37. package/dist/ifc/IfcRelationsIndexer/index.d.ts +2 -2
  38. package/dist/index.cjs +5 -5
  39. package/dist/index.mjs +1805 -1325
  40. package/dist/namespace.d.ts +1396 -894
  41. package/package.json +1 -1
@@ -1,273 +1,104 @@
1
1
  declare namespace OBC {
2
- import * as WEBIFC from "web-ifc";
3
- import { FragmentsGroup } from "@thatopen/fragments";
4
- import { Disposable, Event, Component, Components } from "../../core";
5
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
2
+ import * as THREE from "three";
3
+ import { Components } from "../Components";
4
+ import { Component } from "../Types";
6
5
  /**
7
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
8
- * 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.
6
+ * A tool to safely remove meshes and geometries from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
9
7
  */
10
- export declare class IfcRelationsIndexer extends Component implements Disposable {
11
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
12
- /** {@link Disposable.onDisposed} */
13
- readonly onDisposed: Event<string>;
8
+ export declare class Disposer extends Component {
9
+ private _disposedComponents;
10
+ /** {@link Component.enabled} */
14
11
  enabled: boolean;
15
- readonly onRelationsIndexed: Event<{
16
- modelID: string;
17
- relationsMap: RelationsMap;
18
- }>;
19
- private _relToAttributesMap;
20
- private _inverseAttributes;
21
- private _ifcRels;
22
12
  /**
23
- * Holds the relationship mappings for each model processed by the indexer.
24
- * The structure is a map where each key is a model's UUID, and the value is another map.
25
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
26
- * representing a specific relation type, and the value is an array of expressIDs of entities
27
- * that are related through that relation type. This structure allows for efficient querying
28
- * of entity relationships within a model.
13
+ * A unique identifier for the component.
14
+ * This UUID is used to register the component within the Components system.
29
15
  */
30
- readonly relationMaps: ModelsRelationMap;
16
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
31
17
  constructor(components: Components);
32
- private onFragmentsDisposed;
33
- /**
34
- * Adds a relation map to the model's relations map.
35
- *
36
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
37
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
38
- *
39
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
40
- */
41
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
42
- /**
43
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
44
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
45
- * and maps them in a structured way to facilitate quick access to related entities.
46
- *
47
- * The process involves querying the model for each relation type associated with the inverse attributes
48
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
49
- * and contains a nested map where each key is an entity's expressID and its value is another map.
50
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
51
- * of entities that are related through that attribute.
52
- *
53
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
54
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
55
- * representation of the relations indexed by entity expressIDs and relation types.
56
- * @throws An error if the model does not have properties loaded.
57
- */
58
- process(model: FragmentsGroup): Promise<RelationsMap>;
59
- /**
60
- * Processes a given model from a WebIfc API to index its IFC entities relations.
61
- *
62
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
63
- * @param modelID - The unique identifier of the model within the WebIfc API.
64
- * @returns A promise that resolves to the relations map for the processed model.
65
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
66
- */
67
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
68
18
  /**
69
- * Retrieves the relations of a specific entity within a model based on the given relation name.
70
- * This method searches the indexed relation maps for the specified model and entity,
71
- * returning the IDs of related entities if a match is found.
72
- *
73
- * @param model The 'FragmentsGroup' model containing the entity.
74
- * @param expressID The unique identifier of the entity within the model.
75
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
76
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
77
- * or the specified relation name is not indexed.
19
+ * Return the UUIDs of all disposed components.
78
20
  */
79
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
21
+ get(): Set<string>;
80
22
  /**
81
- * Serializes the relations of a given relation map into a JSON string.
82
- * 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,
83
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
84
- * The resulting object is then serialized into a JSON string.
23
+ * Removes a mesh, its geometry and its materials from memory. If you are
24
+ * using any of these in other parts of the application, make sure that you
25
+ * remove them from the mesh before disposing it.
85
26
  *
86
- * @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.
87
- * @returns A JSON string representing the serialized relations of the given relation map.
88
- */
89
- serializeRelations(relationMap: RelationsMap): string;
90
- /**
91
- * Serializes the relations of a specific model into a JSON string.
92
- * This method iterates through the relations indexed for the given model,
93
- * organizing them into a structured object where each key is an expressID of an entity,
94
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
95
- * The resulting object is then serialized into a JSON string.
27
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
+ * to remove.
96
29
  *
97
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
98
- * @returns A JSON string representing the serialized relations of the specified model.
99
- * If the model has no indexed relations, 'null' is returned.
100
- */
101
- serializeModelRelations(model: FragmentsGroup): string | null;
102
- /**
103
- * Serializes all relations of every model processed by the indexer into a JSON string.
104
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
105
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
106
- * and its value is another object mapping entity expressIDs to their related entities, categorized
107
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
30
+ * @param materials - whether to dispose the materials of the mesh.
108
31
  *
109
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
110
- * If no relations have been indexed, an empty object is returned as a JSON string.
32
+ * @param recursive - whether to recursively dispose the children of the mesh.
111
33
  */
112
- serializeAllRelations(): string;
34
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
113
35
  /**
114
- * Converts a JSON string representing relations between entities into a structured map.
115
- * This method parses the JSON string to reconstruct the relations map that indexes
116
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
117
- * and the values are maps where each key is a relation type ID and its value is an array
118
- * of express IDs of entities related through that relation type.
36
+ * Disposes a geometry from memory.
119
37
  *
120
- * @param json The JSON string to be parsed into the relations map.
121
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
122
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
123
- * is an array of express IDs (as numbers) of entities related through that relation type.
124
- */
125
- getRelationsMapFromJSON(json: string): RelationsMap;
126
- /**
127
- * Disposes the component, cleaning up resources and detaching event listeners.
128
- * This ensures that the component is properly cleaned up and does not leave behind any
129
- * references that could prevent garbage collection.
130
- */
131
- dispose(): void;
132
- }
133
- export type { InverseAttribute, RelationsMap } from "./src/types";
134
- import * as WEBIFC from "web-ifc";
135
- import * as FRAG from "@thatopen/fragments";
136
- import { Component, Components } from "../../core";
137
- /**
138
- * Object to export all the properties from an IFC to a JS object.
139
- */
140
- export declare class IfcJsonExporter extends Component {
141
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
142
- /** {@link Component.enabled} */
143
- enabled: boolean;
144
- constructor(components: Components);
145
- /**
146
- * Exports all the properties of an IFC into an array of JS objects.
147
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
148
- * @param modelID ID of the IFC model whose properties to extract.
149
- * @param indirect whether to get the indirect relationships as well.
150
- * @param recursiveSpatial whether to get the properties of spatial items recursively
151
- * to make the location data available (e.g. absolute position of building).
38
+ * @param geometry - the
39
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
+ * to remove.
152
41
  */
153
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
154
- }
155
- import { Component, Disposable, World, Event } from "../Types";
156
- import { SimpleRaycaster } from "./src";
157
- import { Components } from "../Components";
158
- export declare class Raycasters extends Component implements Disposable {
159
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
160
- enabled: boolean;
161
- list: Map<string, SimpleRaycaster>;
162
- onDisposed: Event<unknown>;
163
- constructor(components: Components);
164
- get(world: World): SimpleRaycaster;
165
- delete(world: World): void;
166
- dispose(): void;
167
- }
168
- import * as WEBIFC from "web-ifc";
169
- import { FragmentsGroup } from "@thatopen/fragments";
170
- import { Component, Disposable, Event, Components } from "../../core";
171
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
172
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
173
- type NumericPropTypes = "IfcInteger" | "IfcReal";
174
- interface ChangeMap {
175
- [modelID: string]: Set<number>;
176
- }
177
- interface AttributeListener {
178
- [modelID: string]: {
179
- [expressID: number]: {
180
- [attributeName: string]: Event<String | Boolean | Number>;
181
- };
182
- };
183
- }
184
- export declare class IfcPropertiesManager extends Component implements Disposable {
185
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
186
- /** {@link Disposable.onDisposed} */
187
- readonly onDisposed: Event<string>;
188
- readonly onRequestFile: Event<unknown>;
189
- ifcToExport: ArrayBuffer | null;
190
- readonly onElementToPset: Event<{
191
- model: FragmentsGroup;
192
- psetID: number;
193
- elementID: number;
194
- }>;
195
- readonly onPropToPset: Event<{
196
- model: FragmentsGroup;
197
- psetID: number;
198
- propID: number;
199
- }>;
200
- readonly onPsetRemoved: Event<{
201
- model: FragmentsGroup;
202
- psetID: number;
203
- }>;
204
- readonly onDataChanged: Event<{
205
- model: FragmentsGroup;
206
- expressID: number;
207
- }>;
208
- wasm: {
209
- path: string;
210
- absolute: boolean;
211
- };
212
- enabled: boolean;
213
- attributeListeners: AttributeListener;
214
- selectedModel?: FragmentsGroup;
215
- changeMap: ChangeMap;
216
- constructor(components: Components);
217
- dispose(): void;
218
- private increaseMaxID;
219
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
220
- private newGUID;
221
- private getOwnerHistory;
222
- private registerChange;
223
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
224
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
225
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
226
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
227
- }>;
228
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
229
- private newSingleProperty;
230
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
231
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
232
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
233
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
234
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
235
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
236
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
237
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
42
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
43
+ private disposeGeometryAndMaterials;
44
+ private disposeChildren;
45
+ private static disposeMaterial;
238
46
  }
239
- export {};
240
47
  import { Component, Disposable, Event } from "../Types";
241
48
  /**
242
- * The entry point of the Components library.
243
- * It can:
244
- * - Create and access all the components of the library.
245
- * - Update all the updatable components automatically.
246
- * - Dispose all the components, preventing memory leaks.
49
+ * The entry point of the Components library. It can create and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
247
50
  */
248
51
  export declare class Components implements Disposable {
249
- static readonly release = "1.4.21";
52
+ /**
53
+ * The version of the @thatopen/components library.
54
+ */
55
+ static readonly release = "2.0.8";
250
56
  /** {@link Disposable.onDisposed} */
251
57
  readonly onDisposed: Event<void>;
252
- /** The list of components created in this app. */
58
+ /**
59
+ * The list of components created in this app.
60
+ * The keys are UUIDs and the values are instances of the components.
61
+ */
253
62
  readonly list: Map<string, Component>;
254
- /** If disabled, the animation loop will be stopped. */
63
+ /**
64
+ * If disabled, the animation loop will be stopped.
65
+ * Default value is false.
66
+ */
255
67
  enabled: boolean;
256
68
  private _clock;
69
+ /**
70
+ * Adds a component to the list of components.
71
+ * Throws an error if a component with the same UUID already exists.
72
+ *
73
+ * @param uuid - The unique identifier of the component.
74
+ * @param instance - The instance of the component to be added.
75
+ *
76
+ * @throws Will throw an error if a component with the same UUID already exists.
77
+ *
78
+ * @internal
79
+ */
257
80
  add(uuid: string, instance: Component): void;
258
81
  /**
259
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
260
- * doesn't exist, it will instance it automatically.
261
- *
262
- * @param Component - The component to get or create.
263
- */
82
+ * Retrieves a component instance by its constructor function.
83
+ * If the component does not exist in the list, it will be created and added.
84
+ *
85
+ * @template U - The type of the component to retrieve.
86
+ * @param Component - The constructor function of the component to retrieve.
87
+ *
88
+ * @returns The instance of the requested component.
89
+ *
90
+ * @throws Will throw an error if a component with the same UUID already exists.
91
+ *
92
+ * @internal
93
+ */
264
94
  get<U extends Component>(Component: new (components: Components) => U): U;
265
95
  constructor();
266
96
  /**
267
- * Initializes the library. It should be called at the start of the app after
268
- * initializing the scene, the renderer and the
269
- * camera. Additionally, if any component that need a raycaster is
270
- * used, the {@link raycaster} will need to be initialized.
97
+ * Initializes the Components instance.
98
+ * This method starts the animation loop, sets the enabled flag to true,
99
+ * and calls the update method.
100
+ *
101
+ * @returns {void}
271
102
  */
272
103
  init(): void;
273
104
  /**
@@ -278,7 +109,7 @@ export declare class Components implements Disposable {
278
109
  * called. This is especially relevant in Single Page Applications (React,
279
110
  * Angular, Vue, etc).
280
111
  *
281
- * - Any of the objects of this instance (meshes, geometries, etc) is
112
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
282
113
  * referenced by a reference type (object or array).
283
114
  *
284
115
  * You can learn more about how Three.js handles memory leaks
@@ -289,108 +120,82 @@ export declare class Components implements Disposable {
289
120
  private update;
290
121
  private static setupBVH;
291
122
  }
292
- import * as THREE from "three";
123
+ import { Component, Disposable, World, Event } from "../Types";
124
+ import { SimpleRaycaster } from "./src";
293
125
  import { Components } from "../Components";
294
- import { Component } from "../Types";
295
126
  /**
296
- * A tool to safely remove meshes and geometries from memory to
297
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
127
+ * A component that manages raycasters for different worlds. It uses a Map to store raycasters for each world, and automatically disposes them when the world is disposed.
298
128
  */
299
- export declare class Disposer extends Component {
300
- private _disposedComponents;
129
+ export declare class Raycasters extends Component implements Disposable {
130
+ /**
131
+ * A unique identifier for the component.
132
+ * This UUID is used to register the component within the Components system.
133
+ */
134
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
301
135
  /** {@link Component.enabled} */
302
136
  enabled: boolean;
303
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
304
- constructor(components: Components);
305
137
  /**
306
- * {@link Component.uuid}.
307
- * @return the list of UUIDs of deleted components.
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.
308
140
  */
309
- get(): Set<string>;
141
+ list: Map<string, SimpleRaycaster>;
142
+ /** {@link Disposable.onDisposed} */
143
+ onDisposed: Event<unknown>;
144
+ constructor(components: Components);
310
145
  /**
311
- * Removes a mesh, its geometry and its materials from memory. If you are
312
- * using any of these in other parts of the application, make sure that you
313
- * remove them from the mesh before disposing it.
314
- *
315
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
316
- * to remove.
317
- *
318
- * @param materials - whether to dispose the materials of the mesh.
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.
319
149
  *
320
- * @param recursive - whether to recursively dispose the children of the mesh.
150
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
151
+ * @returns The SimpleRaycaster instance for the given world.
321
152
  */
322
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
153
+ get(world: World): SimpleRaycaster;
323
154
  /**
324
- * Disposes a geometry from memory.
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.
325
157
  *
326
- * @param geometry - the
327
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
328
- * to remove.
158
+ * @param world - The world for which to delete the SimpleRaycaster instance.
159
+ * @returns {void}
329
160
  */
330
- disposeGeometry(geometry: THREE.BufferGeometry): void;
331
- private disposeGeometryAndMaterials;
332
- private disposeChildren;
333
- private static disposeMaterial;
334
- }
335
- import * as THREE from "three";
336
- import { Component, Components } from "../../core";
337
- export interface MeasureEdge {
338
- distance: number;
339
- points: THREE.Vector3[];
340
- }
341
- export declare class MeasurementUtils extends Component {
342
- enabled: boolean;
343
- static uuid: string;
344
- constructor(components: Components);
345
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
346
- edges: MeasureEdge[];
347
- indices: Set<number>;
348
- } | null;
349
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
350
- private getFaceData;
351
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
352
- p1: THREE.Vector3;
353
- p2: THREE.Vector3;
354
- p3: THREE.Vector3;
355
- faceNormal: THREE.Vector3;
356
- };
357
- private round;
161
+ delete(world: World): void;
162
+ /** {@link Disposable.dispose} */
163
+ dispose(): void;
358
164
  }
359
165
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
360
166
  import { Components } from "../Components";
361
167
  import { SimpleWorld } from "./src";
168
+ /**
169
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds.
170
+ */
362
171
  export declare class Worlds extends Component implements Updateable, Disposable {
363
172
  /**
364
173
  * A unique identifier for the component.
365
174
  * This UUID is used to register the component within the Components system.
366
175
  */
367
176
  static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
368
- /**
369
- * Event triggered after the update process of all worlds.
370
- * Subscribers can listen to this event to perform actions post-update.
371
- */
177
+ /** {@link Updateable.onAfterUpdate} */
372
178
  readonly onAfterUpdate: Event<unknown>;
373
- /**
374
- * Event triggered before the update process of all worlds.
375
- * Subscribers can listen to this event to perform actions pre-update.
376
- */
179
+ /** {@link Updateable.onBeforeUpdate} */
377
180
  readonly onBeforeUpdate: Event<unknown>;
181
+ /** {@link Disposable.onDisposed} */
182
+ readonly onDisposed: Event<unknown>;
378
183
  /**
379
- * Event triggered when the Worlds component is disposed.
380
- * Subscribers can listen to this event to perform cleanup actions.
184
+ * An event that is triggered when a new world is created.
185
+ * The event passes the newly created world as a parameter.
381
186
  */
382
- readonly onDisposed: Event<unknown>;
383
187
  readonly onWorldCreated: Event<World>;
188
+ /**
189
+ * An event that is triggered when a world is deleted.
190
+ * The event passes the UUID of the deleted world as a parameter.
191
+ */
384
192
  readonly onWorldDeleted: Event<string>;
385
193
  /**
386
194
  * A collection of worlds managed by this component.
387
195
  * The key is the unique identifier (UUID) of the world, and the value is the World instance.
388
196
  */
389
197
  list: Map<string, World>;
390
- /**
391
- * A flag indicating whether the Worlds component is enabled.
392
- * If false, the update process will be skipped.
393
- */
198
+ /** {@link Component.enabled} */
394
199
  enabled: boolean;
395
200
  constructor(components: Components);
396
201
  /**
@@ -403,81 +208,122 @@ export declare class Worlds extends Component implements Updateable, Disposable
403
208
  * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
404
209
  */
405
210
  create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
211
+ /**
212
+ * Deletes a world from the list of worlds.
213
+ *
214
+ * @param {World} world - The world to be deleted.
215
+ *
216
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
217
+ *
218
+ * @returns {void}
219
+ */
406
220
  delete(world: World): void;
221
+ /**
222
+ * Disposes of the Worlds component and all its managed worlds.
223
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
224
+ * and triggers the onDisposed event.
225
+ *
226
+ * @returns {void}
227
+ */
407
228
  dispose(): void;
229
+ /** {@link Updateable.update} */
408
230
  update(delta?: number): void | Promise<void>;
409
231
  }
410
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
411
- import * as THREE from "three";
412
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
413
- center: THREE.Vector3;
414
- halfSizes: THREE.Vector3;
415
- rotation: THREE.Matrix3;
416
- transformation: THREE.Matrix4;
417
- };
418
- import * as THREE from "three";
419
- export declare class MaterialsUtils {
420
- static isTransparent(material: THREE.Material): boolean;
421
- }
422
- export declare class UUID {
423
- private static _pattern;
424
- private static _lut;
425
- static create(): string;
426
- static validate(uuid: string): void;
427
- }
428
- import * as THREE from "three";
429
- import { Component, Components, Event, World } from "../core";
430
- export interface VertexPickerConfig {
431
- showOnlyVertex: boolean;
432
- snapDistance: number;
433
- previewElement: HTMLElement;
434
- }
435
- export declare class VertexPicker extends Component {
436
- onVertexFound: Event<THREE.Vector3>;
437
- onVertexLost: Event<THREE.Vector3>;
438
- components: Components;
439
- private _pickedPoint;
440
- private _config;
441
- private _enabled;
442
- private _workingPlane;
443
- set enabled(value: boolean);
444
- get enabled(): boolean;
445
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
446
- set workingPlane(plane: THREE.Plane | null);
447
- get workingPlane(): THREE.Plane | null;
448
- set config(value: Partial<VertexPickerConfig>);
449
- get config(): Partial<VertexPickerConfig>;
232
+ import { Component, Disposable, World, Event } from "../Types";
233
+ import { GridConfig, SimpleGrid } from "./src";
234
+ import { Components } from "../Components";
235
+ /**
236
+ * A component that manages and provides access to multiple grid instances. Each grid is associated with a unique world.
237
+ */
238
+ export declare class Grids extends Component implements Disposable {
239
+ /**
240
+ * A unique identifier for the component.
241
+ * This UUID is used to register the component within the Components system.
242
+ */
243
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
244
+ /**
245
+ * A map of world UUIDs to their corresponding grid instances.
246
+ */
247
+ list: Map<string, SimpleGrid>;
248
+ /**
249
+ * The default configuration for grid creation.
250
+ */
251
+ config: Required<GridConfig>;
252
+ /** {@link Disposable.onDisposed} */
253
+ readonly onDisposed: Event<unknown>;
254
+ /** {@link Component.enabled} */
255
+ enabled: boolean;
256
+ constructor(components: Components);
257
+ /**
258
+ * Creates a new grid for the given world.
259
+ * Throws an error if a grid already exists for the world.
260
+ *
261
+ * @param world - The world to create the grid for.
262
+ * @returns The newly created grid.
263
+ *
264
+ * @throws Will throw an error if a grid already exists for the given world.
265
+ */
266
+ create(world: World): SimpleGrid;
267
+ /**
268
+ * Deletes the grid associated with the given world.
269
+ * If a grid does not exist for the given world, this method does nothing.
270
+ *
271
+ * @param world - The world for which to delete the grid.
272
+ *
273
+ * @remarks
274
+ * This method will dispose of the grid and remove it from the internal list.
275
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
276
+ */
277
+ delete(world: World): void;
278
+ /** {@link Disposable.dispose} */
450
279
  dispose(): void;
451
- get(world: World): THREE.Vector3 | null;
452
- private getClosestVertex;
453
- private getVertices;
454
- private getVertex;
455
280
  }
456
281
  import * as THREE from "three";
457
282
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
458
283
  import { SimplePlane } from "./src";
459
284
  import { Components } from "../Components";
460
285
  /**
461
- * A lightweight component to easily create and handle
462
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
286
+ * A lightweight component to easily create and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
463
287
  *
464
288
  * @param components - the instance of {@link Components} used.
465
289
  * E.g. {@link SimplePlane}.
466
290
  */
467
291
  export declare class Clipper extends Component implements Createable, Disposable, Hideable {
292
+ /**
293
+ * A unique identifier for the component.
294
+ * This UUID is used to register the component within the Components system.
295
+ */
468
296
  static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
469
- /** {@link Createable.onAfterCreate} */
470
- readonly onAfterCreate: Event<SimplePlane>;
471
- /** {@link Createable.onAfterDelete} */
472
- readonly onAfterDelete: Event<SimplePlane>;
473
297
  /** Event that fires when the user starts dragging a clipping plane. */
474
298
  readonly onBeforeDrag: Event<void>;
475
299
  /** Event that fires when the user stops dragging a clipping plane. */
476
300
  readonly onAfterDrag: Event<void>;
301
+ /**
302
+ * Event that fires when the user starts creating a clipping plane.
303
+ */
477
304
  readonly onBeforeCreate: Event<unknown>;
305
+ /**
306
+ * Event that fires when the user cancels the creation of a clipping plane.
307
+ */
478
308
  readonly onBeforeCancel: Event<unknown>;
309
+ /**
310
+ * Event that fires after the user cancels the creation of a clipping plane.
311
+ */
479
312
  readonly onAfterCancel: Event<unknown>;
313
+ /**
314
+ * Event that fires when the user starts deleting a clipping plane.
315
+ */
480
316
  readonly onBeforeDelete: Event<unknown>;
317
+ /**
318
+ * Event that fires after a clipping plane has been created.
319
+ * @param plane - The newly created clipping plane.
320
+ */
321
+ readonly onAfterCreate: Event<SimplePlane>;
322
+ /**
323
+ * Event that fires after a clipping plane has been deleted.
324
+ * @param plane - The deleted clipping plane.
325
+ */
326
+ readonly onAfterDelete: Event<SimplePlane>;
481
327
  /** {@link Disposable.onDisposed} */
482
328
  readonly onDisposed: Event<string>;
483
329
  /**
@@ -493,7 +339,14 @@ export declare class Clipper extends Component implements Createable, Disposable
493
339
  * has to be 'true' for this to apply.
494
340
  */
495
341
  toleranceOrthogonalY: number;
342
+ /**
343
+ * The type of clipping plane to be created.
344
+ * Default is {@link SimplePlane}.
345
+ */
496
346
  Type: new (...args: any) => SimplePlane;
347
+ /**
348
+ * A list of all the clipping planes created by this component.
349
+ */
497
350
  list: SimplePlane[];
498
351
  /** The material used in all the clipping planes. */
499
352
  private _material;
@@ -552,69 +405,96 @@ export declare class Clipper extends Component implements Createable, Disposable
552
405
  private _onStartDragging;
553
406
  private _onEndDragging;
554
407
  }
555
- import { Component, Disposable, World, Event } from "../Types";
556
- import { GridConfig, SimpleGrid } from "./src";
557
- import { Components } from "../Components";
558
- export declare class Grids extends Component implements Disposable {
559
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
560
- list: Map<string, SimpleGrid>;
561
- readonly onDisposed: Event<unknown>;
562
- config: Required<GridConfig>;
563
- /** {@link Component.enabled} */
564
- enabled: boolean;
565
- constructor(components: Components);
566
- create(world: World): SimpleGrid;
567
- delete(world: World): void;
408
+ import * as THREE from "three";
409
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
410
+ center: THREE.Vector3;
411
+ halfSizes: THREE.Vector3;
412
+ rotation: THREE.Matrix3;
413
+ transformation: THREE.Matrix4;
414
+ };
415
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
416
+ import * as THREE from "three";
417
+ export declare class MaterialsUtils {
418
+ static isTransparent(material: THREE.Material): boolean;
419
+ }
420
+ export declare class UUID {
421
+ private static _pattern;
422
+ private static _lut;
423
+ static create(): string;
424
+ static validate(uuid: string): void;
425
+ }
426
+ import * as THREE from "three";
427
+ import { Component, Components, Event, World } from "../core";
428
+ export interface VertexPickerConfig {
429
+ showOnlyVertex: boolean;
430
+ snapDistance: number;
431
+ previewElement: HTMLElement;
432
+ }
433
+ export declare class VertexPicker extends Component {
434
+ onVertexFound: Event<THREE.Vector3>;
435
+ onVertexLost: Event<THREE.Vector3>;
436
+ components: Components;
437
+ private _pickedPoint;
438
+ private _config;
439
+ private _enabled;
440
+ private _workingPlane;
441
+ set enabled(value: boolean);
442
+ get enabled(): boolean;
443
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
444
+ set workingPlane(plane: THREE.Plane | null);
445
+ get workingPlane(): THREE.Plane | null;
446
+ set config(value: Partial<VertexPickerConfig>);
447
+ get config(): Partial<VertexPickerConfig>;
568
448
  dispose(): void;
449
+ get(world: World): THREE.Vector3 | null;
450
+ private getClosestVertex;
451
+ private getVertices;
452
+ private getVertex;
569
453
  }
570
454
  import { Components } from "../Components";
571
455
  import { MeshCullerRenderer, CullerRendererSettings } from "./src";
572
456
  import { Component, Event, Disposable, World } from "../Types";
573
457
  /**
574
- * A tool to handle big scenes efficiently by automatically hiding the objects
575
- * that are not visible to the camera.
458
+ * A component that manages and provides culling functionality for meshes in a 3D scene.
576
459
  */
577
460
  export declare class Cullers extends Component implements Disposable {
578
461
  /**
579
- * A unique identifier for the Cullers component.
462
+ * A unique identifier for the component.
463
+ * This UUID is used to register the component within the Components system.
580
464
  */
581
465
  static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
582
466
  /**
583
- * Indicates whether the Cullers component is enabled.
584
- */
585
- private _enabled;
586
- /**
587
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
588
- */
589
- list: Map<string, MeshCullerRenderer>;
590
- /**
591
- * An event that is triggered when the Cullers component is disposed.
592
- */
467
+ * An event that is triggered when the Cullers component is disposed.
468
+ */
593
469
  readonly onDisposed: Event<unknown>;
470
+ private _enabled;
594
471
  /**
595
- * Gets the enabled state of the Cullers component.
596
- *
597
- * @returns The current enabled state.
472
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
598
473
  */
474
+ list: Map<string, MeshCullerRenderer>;
475
+ /** {@link Component.enabled} */
599
476
  get enabled(): boolean;
600
- /**
601
- * Sets the enabled state of the Cullers component.
602
- * Also sets the enabled state of all MeshCullerRenderer instances.
603
- *
604
- * @param value - The new enabled state.
605
- */
477
+ /** {@link Component.enabled} */
606
478
  set enabled(value: boolean);
607
479
  constructor(components: Components);
608
480
  /**
609
- * Creates a new MeshCullerRenderer for the given world.
610
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
611
- *
612
- * @param world - The world for which to create the MeshCullerRenderer.
613
- * @param config - Optional configuration settings for the MeshCullerRenderer.
614
- *
615
- * @returns The newly created or existing MeshCullerRenderer for the given world.
616
- */
481
+ * Creates a new MeshCullerRenderer for the given world.
482
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
483
+ *
484
+ * @param world - The world for which to create the MeshCullerRenderer.
485
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
486
+ *
487
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
488
+ */
617
489
  create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
490
+ /**
491
+ * Deletes the MeshCullerRenderer associated with the given world.
492
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
493
+ *
494
+ * @param world - The world for which to delete the MeshCullerRenderer.
495
+ *
496
+ * @returns {void}
497
+ */
618
498
  delete(world: World): void;
619
499
  /** {@link Disposable.dispose} */
620
500
  dispose(): void;
@@ -622,17 +502,48 @@ export declare class Cullers extends Component implements Disposable {
622
502
  import { MiniMap } from "./src";
623
503
  import { Component, Updateable, World, Event, Disposable } from "../Types";
624
504
  import { Components } from "../Components";
505
+ /**
506
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID.
507
+ */
625
508
  export declare class MiniMaps extends Component implements Updateable, Disposable {
509
+ /**
510
+ * A unique identifier for the component.
511
+ * This UUID is used to register the component within the Components system.
512
+ */
626
513
  static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
514
+ /** {@link Updateable.onAfterUpdate} */
627
515
  readonly onAfterUpdate: Event<unknown>;
516
+ /** {@link Updateable.onBeforeUpdate} */
628
517
  readonly onBeforeUpdate: Event<unknown>;
518
+ /** {@link Disposable.onDisposed} */
629
519
  readonly onDisposed: Event<unknown>;
520
+ /** {@link Component.enabled} */
630
521
  enabled: boolean;
522
+ /**
523
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
524
+ */
631
525
  list: Map<string, MiniMap>;
632
526
  constructor(components: Components);
527
+ /**
528
+ * Creates a new {@link MiniMap} instance associated with the given world.
529
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
530
+ *
531
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
532
+ * @returns The newly created {@link MiniMap} instance.
533
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
534
+ */
633
535
  create(world: World): MiniMap;
536
+ /**
537
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
538
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
539
+ *
540
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
541
+ * @returns {void}
542
+ */
634
543
  delete(id: string): void;
544
+ /** {@link Disposable.dispose} */
635
545
  dispose(): void;
546
+ /** {@link Updateable.update} */
636
547
  update(): void;
637
548
  }
638
549
  import * as THREE from "three";
@@ -640,23 +551,36 @@ import { Components } from "../Components";
640
551
  import { SimpleCamera } from "..";
641
552
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
642
553
  /**
643
- * A flexible camera that uses
644
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
645
- * easily control the camera in 2D and 3D. It supports multiple navigation
646
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
554
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to easily 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.
647
555
  */
648
556
  export declare class OrthoPerspectiveCamera extends SimpleCamera {
649
557
  /**
650
- * The current {@link NavigationMode}.
558
+ * A ProjectionManager instance that manages the projection modes of the camera.
651
559
  */
652
- _mode: NavigationMode | null;
653
560
  readonly projection: ProjectionManager;
561
+ /**
562
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
563
+ * This camera is used when the projection mode is set to orthographic.
564
+ */
654
565
  readonly threeOrtho: THREE.OrthographicCamera;
566
+ /**
567
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
568
+ * This camera is used when the projection mode is set to perspective.
569
+ */
655
570
  readonly threePersp: THREE.PerspectiveCamera;
656
571
  protected readonly _userInputButtons: any;
657
572
  protected readonly _frustumSize = 50;
658
573
  protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
574
+ protected _mode: NavigationMode | null;
659
575
  private previousSize;
576
+ /**
577
+ * Getter for the current navigation mode.
578
+ * Throws an error if the mode is not found or the camera is not initialized.
579
+ *
580
+ * @returns {NavigationMode} The current navigation mode.
581
+ *
582
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
583
+ */
660
584
  get mode(): NavigationMode;
661
585
  constructor(components: Components);
662
586
  /** {@link Disposable.dispose} */
@@ -674,25 +598,290 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
674
598
  * evaluate {@link Components.meshes}.
675
599
  * @param offset the distance to the fit object
676
600
  */
677
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
601
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
602
+ /**
603
+ * Allows or prevents all user input.
604
+ *
605
+ * @param active - whether to enable or disable user inputs.
606
+ */
607
+ setUserInput(active: boolean): void;
608
+ private disableUserInput;
609
+ private enableUserInput;
610
+ private newOrthoCamera;
611
+ private setOrthoPerspCameraAspect;
612
+ }
613
+ import * as WEBIFC from "web-ifc";
614
+ import * as FRAG from "@thatopen/fragments";
615
+ import { Component, Components } from "../../core";
616
+ /**
617
+ * Object to export all the properties from an IFC to a JS object.
618
+ */
619
+ export declare class IfcJsonExporter extends Component {
620
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
621
+ /** {@link Component.enabled} */
622
+ enabled: boolean;
623
+ constructor(components: Components);
624
+ /**
625
+ * Exports all the properties of an IFC into an array of JS objects.
626
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
627
+ * @param modelID ID of the IFC model whose properties to extract.
628
+ * @param indirect whether to get the indirect relationships as well.
629
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
630
+ * to make the location data available (e.g. absolute position of building).
631
+ */
632
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
633
+ }
634
+ import * as WEBIFC from "web-ifc";
635
+ import { FragmentsGroup } from "@thatopen/fragments";
636
+ import { Component, Disposable, Event, Components } from "../../core";
637
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
638
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
639
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
640
+ interface ChangeMap {
641
+ [modelID: string]: Set<number>;
642
+ }
643
+ interface AttributeListener {
644
+ [modelID: string]: {
645
+ [expressID: number]: {
646
+ [attributeName: string]: Event<String | Boolean | Number>;
647
+ };
648
+ };
649
+ }
650
+ export declare class IfcPropertiesManager extends Component implements Disposable {
651
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
652
+ /** {@link Disposable.onDisposed} */
653
+ readonly onDisposed: Event<string>;
654
+ readonly onRequestFile: Event<unknown>;
655
+ ifcToExport: ArrayBuffer | null;
656
+ readonly onElementToPset: Event<{
657
+ model: FragmentsGroup;
658
+ psetID: number;
659
+ elementID: number;
660
+ }>;
661
+ readonly onPropToPset: Event<{
662
+ model: FragmentsGroup;
663
+ psetID: number;
664
+ propID: number;
665
+ }>;
666
+ readonly onPsetRemoved: Event<{
667
+ model: FragmentsGroup;
668
+ psetID: number;
669
+ }>;
670
+ readonly onDataChanged: Event<{
671
+ model: FragmentsGroup;
672
+ expressID: number;
673
+ }>;
674
+ wasm: {
675
+ path: string;
676
+ absolute: boolean;
677
+ };
678
+ enabled: boolean;
679
+ attributeListeners: AttributeListener;
680
+ selectedModel?: FragmentsGroup;
681
+ changeMap: ChangeMap;
682
+ constructor(components: Components);
683
+ dispose(): void;
684
+ private increaseMaxID;
685
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
686
+ private newGUID;
687
+ private getOwnerHistory;
688
+ private registerChange;
689
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
690
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
691
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
692
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
693
+ }>;
694
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
695
+ private newSingleProperty;
696
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
697
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
698
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
699
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
700
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
701
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
702
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
703
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
704
+ }
705
+ export {};
706
+ import * as WEBIFC from "web-ifc";
707
+ import { FragmentsGroup } from "@thatopen/fragments";
708
+ import { Disposable, Event, Component, Components } from "../../core";
709
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
710
+ /**
711
+ * Indexer 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.
712
+ */
713
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
714
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
715
+ /** {@link Disposable.onDisposed} */
716
+ readonly onDisposed: Event<string>;
717
+ enabled: boolean;
718
+ readonly onRelationsIndexed: Event<{
719
+ modelID: string;
720
+ relationsMap: RelationsMap;
721
+ }>;
722
+ private _relToAttributesMap;
723
+ private _inverseAttributes;
724
+ private _ifcRels;
725
+ /**
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.
732
+ */
733
+ readonly relationMaps: ModelsRelationMap;
734
+ constructor(components: Components);
735
+ private onFragmentsDisposed;
736
+ private indexRelations;
737
+ /**
738
+ * Adds a relation map to the model's relations map.
739
+ *
740
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
741
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
742
+ *
743
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
744
+ */
745
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
746
+ /**
747
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
748
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
749
+ * and maps them in a structured way to facilitate quick access to related entities.
750
+ *
751
+ * The process involves querying the model for each relation type associated with the inverse attributes
752
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
753
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
754
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
755
+ * of entities that are related through that attribute.
756
+ *
757
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
758
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
759
+ * representation of the relations indexed by entity expressIDs and relation types.
760
+ * @throws An error if the model does not have properties loaded.
761
+ */
762
+ process(model: FragmentsGroup): Promise<RelationsMap>;
763
+ /**
764
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
765
+ *
766
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
767
+ * @param modelID - The unique identifier of the model within the WebIfc API.
768
+ * @returns A promise that resolves to the relations map for the processed model.
769
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
770
+ */
771
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
772
+ /**
773
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
774
+ * This method searches the indexed relation maps for the specified model and entity,
775
+ * returning the IDs of related entities if a match is found.
776
+ *
777
+ * @param model The 'FragmentsGroup' model containing the entity.
778
+ * @param expressID The unique identifier of the entity within the model.
779
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
780
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
781
+ * or the specified relation name is not indexed.
782
+ */
783
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
784
+ /**
785
+ * Serializes the relations of a given relation map into a JSON string.
786
+ * 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,
787
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
788
+ * The resulting object is then serialized into a JSON string.
789
+ *
790
+ * @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.
791
+ * @returns A JSON string representing the serialized relations of the given relation map.
792
+ */
793
+ serializeRelations(relationMap: RelationsMap): string;
794
+ /**
795
+ * Serializes the relations of a specific model into a JSON string.
796
+ * This method iterates through the relations indexed for the given model,
797
+ * organizing them into a structured object where each key is an expressID of an entity,
798
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
799
+ * The resulting object is then serialized into a JSON string.
800
+ *
801
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
802
+ * @returns A JSON string representing the serialized relations of the specified model.
803
+ * If the model has no indexed relations, 'null' is returned.
804
+ */
805
+ serializeModelRelations(model: FragmentsGroup): string | null;
806
+ /**
807
+ * Serializes all relations of every model processed by the indexer into a JSON string.
808
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
809
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
810
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
811
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
812
+ *
813
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
814
+ * If no relations have been indexed, an empty object is returned as a JSON string.
815
+ */
816
+ serializeAllRelations(): string;
678
817
  /**
679
- * Allows or prevents all user input.
818
+ * Converts a JSON string representing relations between entities into a structured map.
819
+ * This method parses the JSON string to reconstruct the relations map that indexes
820
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
821
+ * and the values are maps where each key is a relation type ID and its value is an array
822
+ * of express IDs of entities related through that relation type.
680
823
  *
681
- * @param active - whether to enable or disable user inputs.
824
+ * @param json The JSON string to be parsed into the relations map.
825
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
826
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
827
+ * is an array of express IDs (as numbers) of entities related through that relation type.
682
828
  */
683
- setUserInput(active: boolean): void;
684
- private disableUserInput;
685
- private enableUserInput;
686
- private newOrthoCamera;
687
- private setOrthoPerspCameraAspect;
829
+ getRelationsMapFromJSON(json: string): RelationsMap;
830
+ /**
831
+ * Disposes the component, cleaning up resources and detaching event listeners.
832
+ * This ensures that the component is properly cleaned up and does not leave behind any
833
+ * references that could prevent garbage collection.
834
+ */
835
+ dispose(): void;
836
+ }
837
+ export type { InverseAttribute, RelationsMap } from "./src/types";
838
+ import * as THREE from "three";
839
+ import * as FRAGS from "@thatopen/fragments";
840
+ import { Disposable, Component, Event, Components } from "../../core";
841
+ export interface Classification {
842
+ [system: string]: {
843
+ [className: string]: FRAGS.FragmentIdMap;
844
+ };
845
+ }
846
+ export declare class Classifier extends Component implements Disposable {
847
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
848
+ /** {@link Component.enabled} */
849
+ enabled: boolean;
850
+ list: Classification;
851
+ /** {@link Disposable.onDisposed} */
852
+ readonly onDisposed: Event<unknown>;
853
+ constructor(components: Components);
854
+ private onFragmentsDisposed;
855
+ dispose(): void;
856
+ remove(guid: string): void;
857
+ find(filter?: {
858
+ [name: string]: string[];
859
+ }): FRAGS.FragmentIdMap;
860
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
861
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
862
+ byEntity(group: FRAGS.FragmentsGroup): void;
863
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
864
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
865
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
866
+ resetColor(items: FRAGS.FragmentIdMap): void;
867
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
868
+ }
869
+ import * as FRAGS from "@thatopen/fragments";
870
+ import { Components, Component } from "../../core";
871
+ export declare class Hider extends Component {
872
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
873
+ enabled: boolean;
874
+ constructor(components: Components);
875
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
876
+ isolate(items: FRAGS.FragmentIdMap): void;
877
+ private updateCulledVisibility;
688
878
  }
689
879
  import * as THREE from "three";
690
880
  import * as FRAGS from "@thatopen/fragments";
691
881
  import { FragmentsGroup } from "@thatopen/fragments";
692
882
  import { Component, Components, Disposable, Event } from "../../core";
693
883
  /**
694
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
695
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
884
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
696
885
  */
697
886
  export declare class BoundingBoxer extends Component implements Disposable {
698
887
  static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
@@ -722,37 +911,6 @@ export declare class BoundingBoxer extends Component implements Disposable {
722
911
  addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
723
912
  private static getFragmentBounds;
724
913
  }
725
- import * as THREE from "three";
726
- import * as FRAGS from "@thatopen/fragments";
727
- import { Disposable, Component, Event, Components } from "../../core";
728
- export interface Classification {
729
- [system: string]: {
730
- [className: string]: FRAGS.FragmentIdMap;
731
- };
732
- }
733
- export declare class Classifier extends Component implements Disposable {
734
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
735
- /** {@link Component.enabled} */
736
- enabled: boolean;
737
- list: Classification;
738
- /** {@link Disposable.onDisposed} */
739
- readonly onDisposed: Event<unknown>;
740
- constructor(components: Components);
741
- private onFragmentsDisposed;
742
- dispose(): void;
743
- remove(guid: string): void;
744
- find(filter?: {
745
- [name: string]: string[];
746
- }): FRAGS.FragmentIdMap;
747
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
748
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
749
- byEntity(group: FRAGS.FragmentsGroup): void;
750
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
751
- bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
752
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
753
- resetColor(items: FRAGS.FragmentIdMap): void;
754
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
755
- }
756
914
  import { Component, Disposable, Event, Components } from "../../core";
757
915
  export declare class Exploder extends Component implements Disposable {
758
916
  static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
@@ -797,24 +955,13 @@ export declare class IfcLoader extends Component implements Disposable {
797
955
  private getGeometry;
798
956
  private autoSetWasm;
799
957
  }
800
- import * as FRAGS from "@thatopen/fragments";
801
- import { Components, Component } from "../../core";
802
- export declare class Hider extends Component {
803
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
804
- enabled: boolean;
805
- constructor(components: Components);
806
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
807
- isolate(items: FRAGS.FragmentIdMap): void;
808
- private updateCulledVisibility;
809
- }
810
958
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
811
959
  import * as THREE from "three";
812
960
  import * as FRAGS from "@thatopen/fragments";
813
961
  import { Component, Components, Event, Disposable } from "../../core";
814
962
  import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
815
963
  /**
816
- * Object that can efficiently load binary files that contain
817
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
964
+ * Object that can efficiently load binary files that contain [fragment geometry](https://github.com/ThatOpen/engine_fragment).
818
965
  */
819
966
  export declare class FragmentsManager extends Component implements Disposable {
820
967
  static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
@@ -858,47 +1005,29 @@ export declare class FragmentsManager extends Component implements Disposable {
858
1005
  * @returns the exported data as binary buffer.
859
1006
  */
860
1007
  export(group: FragmentsGroup): Uint8Array;
1008
+ /**
1009
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1010
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1011
+ * @returns A map of model IDs to sets of express IDs.
1012
+ */
1013
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1014
+ [modelID: string]: Set<number>;
1015
+ };
1016
+ /**
1017
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1018
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1019
+ * @returns A fragment ID map.
1020
+ * @remarks
1021
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1022
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1023
+ * The fragment ID maps are then merged into a single map and returned.
1024
+ * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1025
+ */
1026
+ modelIdToFragmentIdMap(modelIdMap: {
1027
+ [modelID: string]: Set<number>;
1028
+ }): FRAGS.FragmentIdMap;
861
1029
  coordinate(models?: FragmentsGroup[]): void;
862
1030
  }
863
- export declare const IfcElements: {
864
- [key: number]: string;
865
- };
866
- import * as WEBIFC from "web-ifc";
867
- export interface IfcItemsCategories {
868
- [itemID: number]: number;
869
- }
870
- export declare class IfcCategories {
871
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
872
- }
873
- import * as FRAGS from "@thatopen/fragments";
874
- export declare class IfcPropertiesUtils {
875
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
876
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
877
- [attribute: string]: any;
878
- } | null>;
879
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
880
- [relatingID: number]: number[];
881
- }>;
882
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
883
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
884
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
885
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
886
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
887
- key: string | null;
888
- name: string | null;
889
- }>;
890
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
891
- key: string | null;
892
- value: number | null;
893
- }>;
894
- static isRel(expressID: number): boolean;
895
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
896
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
897
- }
898
- export declare const IfcCategoryMap: {
899
- [key: number]: string;
900
- };
901
- export declare const GeometryTypes: Set<number>;
902
1031
  import * as WEBIFC from "web-ifc";
903
1032
  import { Components, Disposable, Event, Component } from "../../core";
904
1033
  import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
@@ -965,24 +1094,112 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
965
1094
  private streamAllProperties;
966
1095
  private cleanUp;
967
1096
  }
968
- import { InverseAttribute } from "./types";
969
- export declare const relToAttributesMap: Map<number, {
970
- forRelating: InverseAttribute;
971
- forRelated: InverseAttribute;
972
- }>;
1097
+ import * as THREE from "three";
1098
+ import { Component, Components } from "../../core";
1099
+ export interface MeasureEdge {
1100
+ distance: number;
1101
+ points: THREE.Vector3[];
1102
+ }
1103
+ export declare class MeasurementUtils extends Component {
1104
+ enabled: boolean;
1105
+ static uuid: string;
1106
+ constructor(components: Components);
1107
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1108
+ edges: MeasureEdge[];
1109
+ indices: Set<number>;
1110
+ } | null;
1111
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1112
+ private getFaceData;
1113
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1114
+ p1: THREE.Vector3;
1115
+ p2: THREE.Vector3;
1116
+ p3: THREE.Vector3;
1117
+ faceNormal: THREE.Vector3;
1118
+ };
1119
+ private round;
1120
+ }
1121
+ import * as WEBIFC from "web-ifc";
1122
+ export interface IfcItemsCategories {
1123
+ [itemID: number]: number;
1124
+ }
1125
+ export declare class IfcCategories {
1126
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1127
+ }
1128
+ export declare const IfcElements: {
1129
+ [key: number]: string;
1130
+ };
1131
+ import * as FRAGS from "@thatopen/fragments";
1132
+ export declare class IfcPropertiesUtils {
1133
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
1134
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
1135
+ [attribute: string]: any;
1136
+ } | null>;
1137
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
1138
+ [relatingID: number]: number[];
1139
+ }>;
1140
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
1141
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
1142
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
1143
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
1144
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1145
+ key: string | null;
1146
+ name: string | null;
1147
+ }>;
1148
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1149
+ key: string | null;
1150
+ value: number | null;
1151
+ }>;
1152
+ static isRel(expressID: number): boolean;
1153
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1154
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1155
+ }
1156
+ export declare const IfcCategoryMap: {
1157
+ [key: number]: string;
1158
+ };
973
1159
  import * as THREE from "three";
974
1160
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
1161
+ /**
1162
+ * A class representing a 2D minimap in a 3D world.
1163
+ */
975
1164
  export declare class MiniMap implements Resizeable, Updateable, Disposable {
976
1165
  /** {@link Disposable.onDisposed} */
977
1166
  readonly onDisposed: Event<unknown>;
1167
+ /** {@link Updateable.onAfterUpdate} */
978
1168
  readonly onAfterUpdate: Event<unknown>;
1169
+ /** {@link Updateable.onBeforeUpdate} */
979
1170
  readonly onBeforeUpdate: Event<unknown>;
1171
+ /** {@link Resizeable.onResize} */
980
1172
  readonly onResize: Event<THREE.Vector2>;
1173
+ /**
1174
+ * The front offset of the minimap.
1175
+ * It determines how much the minimap's view is offset from the camera's view.
1176
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1177
+ */
981
1178
  frontOffset: number;
1179
+ /**
1180
+ * The override material for the minimap.
1181
+ * It is used to render the depth information of the world onto the minimap.
1182
+ */
982
1183
  overrideMaterial: THREE.MeshDepthMaterial;
1184
+ /**
1185
+ * The background color of the minimap.
1186
+ * It is used to set the background color of the minimap's renderer.
1187
+ */
983
1188
  backgroundColor: THREE.Color;
1189
+ /**
1190
+ * The WebGL renderer for the minimap.
1191
+ * It is used to render the minimap onto the screen.
1192
+ */
984
1193
  renderer: THREE.WebGLRenderer;
1194
+ /**
1195
+ * A flag indicating whether the minimap is enabled.
1196
+ * If disabled, the minimap will not update or render.
1197
+ */
985
1198
  enabled: boolean;
1199
+ /**
1200
+ * The world in which the minimap is displayed.
1201
+ * It provides access to the 3D scene, camera, and other relevant world elements.
1202
+ */
986
1203
  world: World;
987
1204
  private _lockRotation;
988
1205
  private _camera;
@@ -992,69 +1209,94 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
992
1209
  private _tempVector2;
993
1210
  private _tempTarget;
994
1211
  private readonly down;
1212
+ /**
1213
+ * Gets or sets whether the minimap rotation is locked.
1214
+ * When rotation is locked, the minimap will always face the same direction as the camera.
1215
+ */
995
1216
  get lockRotation(): boolean;
1217
+ /**
1218
+ * Sets whether the minimap rotation is locked.
1219
+ * When rotation is locked, the minimap will always face the same direction as the camera.
1220
+ * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
1221
+ */
996
1222
  set lockRotation(active: boolean);
1223
+ /**
1224
+ * Gets the current zoom level of the minimap.
1225
+ * The zoom level determines how much of the world is visible on the minimap.
1226
+ * @returns The current zoom level of the minimap.
1227
+ */
997
1228
  get zoom(): number;
1229
+ /**
1230
+ * Sets the zoom level of the minimap.
1231
+ * The zoom level determines how much of the world is visible on the minimap.
1232
+ * @param value - The new zoom level of the minimap.
1233
+ */
998
1234
  set zoom(value: number);
999
1235
  constructor(world: World);
1236
+ /** {@link Disposable.dispose} */
1000
1237
  dispose(): void;
1238
+ /** Returns the camera used by the MiniMap */
1001
1239
  get(): THREE.OrthographicCamera;
1240
+ /** {@link Updateable.update} */
1002
1241
  update(): void;
1242
+ /** {@link Resizeable.getSize} */
1003
1243
  getSize(): THREE.Vector2;
1244
+ /** {@link Resizeable.resize} */
1004
1245
  resize(size?: THREE.Vector2): void;
1005
1246
  private updatePlanes;
1006
1247
  }
1007
- import * as WEBIFC from "web-ifc";
1008
- import { IfcItemsCategories } from "../../../ifc";
1009
- export declare class SpatialStructure {
1010
- itemsByFloor: IfcItemsCategories;
1011
- private _units;
1012
- setUp(webIfc: WEBIFC.IfcAPI): void;
1013
- cleanUp(): void;
1014
- }
1248
+ export declare const GeometryTypes: Set<number>;
1249
+ import { InverseAttribute } from "./types";
1250
+ export declare const relToAttributesMap: Map<number, {
1251
+ forRelating: InverseAttribute;
1252
+ forRelated: InverseAttribute;
1253
+ }>;
1015
1254
  /**
1016
- * Simple event handler by
1017
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1018
- * Keep in mind that:
1019
- * - If you want to remove it later, you might want to declare the callback as
1020
- * an object.
1021
- * - If you want to maintain the reference to 'this', you will need to declare
1022
- * the callback as an arrow function.
1255
+ * 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.
1023
1256
  */
1024
- export declare class AsyncEvent<T> {
1257
+ export declare class Event<T> {
1025
1258
  /**
1026
1259
  * Add a callback to this event instance.
1027
1260
  * @param handler - the callback to be added to this event.
1028
1261
  */
1029
1262
  add(handler: T extends void ? {
1030
- (): Promise<void>;
1263
+ (): void;
1031
1264
  } : {
1032
- (data: T): Promise<void>;
1265
+ (data: T): void;
1033
1266
  }): void;
1034
1267
  /**
1035
1268
  * Removes a callback from this event instance.
1036
1269
  * @param handler - the callback to be removed from this event.
1037
1270
  */
1038
1271
  remove(handler: T extends void ? {
1039
- (): Promise<void>;
1272
+ (): void;
1040
1273
  } : {
1041
- (data: T): Promise<void>;
1274
+ (data: T): void;
1042
1275
  }): void;
1043
1276
  /** Triggers all the callbacks assigned to this event. */
1044
- trigger: (data?: T) => Promise<void>;
1277
+ trigger: (data?: T) => void;
1045
1278
  /** Gets rid of all the suscribed events. */
1046
1279
  reset(): void;
1047
1280
  private handlers;
1048
1281
  }
1282
+ import { Base } from "./base";
1283
+ /**
1284
+ * 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.
1285
+ */
1286
+ export declare abstract class Component extends Base {
1287
+ /**
1288
+ * Whether this component is active or not. The behaviour can vary depending
1289
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1290
+ * dimensions, while a disabled camera will stop moving. A disabled component
1291
+ * will not be updated automatically each frame.
1292
+ */
1293
+ abstract enabled: boolean;
1294
+ }
1049
1295
  import * as THREE from "three";
1050
1296
  import CameraControls from "camera-controls";
1051
1297
  import { Event } from "./event";
1052
1298
  /**
1053
- * Whether this component has to be manually destroyed once you are done with
1054
- * it to prevent
1055
- * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1056
- * This also ensures that the DOM events created by that component will be
1057
- * cleaned up.
1299
+ * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
1058
1300
  */
1059
1301
  export interface Disposable {
1060
1302
  /**
@@ -1062,13 +1304,11 @@ export interface Disposable {
1062
1304
  * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1063
1305
  */
1064
1306
  dispose: () => void | Promise<void>;
1065
- /** Fired after the tool has been {@link Disposable.dispose()} */
1307
+ /** Fired after the tool has been disposed. */
1066
1308
  readonly onDisposed: Event<any>;
1067
1309
  }
1068
1310
  /**
1069
- * Whether the geometric representation of this component can be
1070
- * hidden or shown in the
1071
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1311
+ * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1072
1312
  */
1073
1313
  export interface Hideable {
1074
1314
  /**
@@ -1079,11 +1319,7 @@ export interface Hideable {
1079
1319
  visible: boolean;
1080
1320
  }
1081
1321
  /**
1082
- * Whether this component can be resized. The meaning of this can vary depending
1083
- * on the component: resizing a
1084
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1085
- * component could mean changing its resolution, whereas resizing a
1086
- * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1322
+ * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1087
1323
  */
1088
1324
  export interface Resizeable {
1089
1325
  /**
@@ -1121,9 +1357,7 @@ export interface Progress {
1121
1357
  total: number;
1122
1358
  }
1123
1359
  /**
1124
- * Whether this component supports create and destroy operations. This generally
1125
- * applies for components that work with instances, such as clipping planes or
1126
- * dimensions.
1360
+ * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
1127
1361
  */
1128
1362
  export interface Createable {
1129
1363
  /** Creates a new instance of an element (e.g. a new Dimension). */
@@ -1156,104 +1390,91 @@ export interface Configurable<T extends Record<string, any>> {
1156
1390
  */
1157
1391
  config: Required<T>;
1158
1392
  }
1159
- /**
1160
- * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1161
- */
1162
- export interface BVHGeometry extends THREE.BufferGeometry {
1163
- boundsTree: Object | undefined;
1164
- disposeBoundsTree: () => void;
1165
- }
1166
1393
  /**
1167
1394
  * Whether a camera uses the Camera Controls library.
1168
1395
  */
1169
1396
  export interface CameraControllable {
1397
+ /**
1398
+ * An instance of CameraControls that provides camera control functionalities.
1399
+ * This instance is used to manipulate the camera.
1400
+ */
1170
1401
  controls: CameraControls;
1171
1402
  }
1172
- import { Base } from "./base";
1403
+ import * as WEBIFC from "web-ifc";
1404
+ import { IfcItemsCategories } from "../../../ifc";
1405
+ export declare class SpatialStructure {
1406
+ itemsByFloor: IfcItemsCategories;
1407
+ private _units;
1408
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1409
+ cleanUp(): void;
1410
+ }
1411
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1412
+ import { Components } from "../../Components";
1173
1413
  /**
1174
- * Components are the building blocks of this library. Components are singleton
1175
- * elements that contain specific functionality. For instance, the SimpleClipper
1176
- * Component can create, delete and handle 3D clipping planes. Components must be
1177
- * unique (they can't be instanced more than once), and have a static UUID that
1178
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1179
- * instance.
1414
+ * Base class of the library. Useful for finding out the interfaces something implements.
1180
1415
  */
1181
- export declare abstract class Component extends Base {
1182
- /**
1183
- * Whether this component is active or not. The behaviour can vary depending
1184
- * on the type of component. E.g. a disabled dimension tool will stop creating
1185
- * dimensions, while a disabled camera will stop moving. A disabled component
1186
- * will not be updated automatically each frame.
1187
- */
1188
- abstract enabled: boolean;
1416
+ export declare abstract class Base {
1417
+ components: Components;
1418
+ constructor(components: Components);
1419
+ /** Whether is component is {@link Disposable}. */
1420
+ isDisposeable: () => this is Disposable;
1421
+ /** Whether is component is {@link Resizeable}. */
1422
+ isResizeable: () => this is Resizeable;
1423
+ /** Whether is component is {@link Updateable}. */
1424
+ isUpdateable: () => this is Updateable;
1425
+ /** Whether is component is {@link Hideable}. */
1426
+ isHideable: () => this is Hideable;
1427
+ /** Whether is component is {@link Configurable}. */
1428
+ isConfigurable: () => this is Configurable<any>;
1189
1429
  }
1190
1430
  /**
1191
- * Simple event handler by
1192
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1193
- * Keep in mind that:
1194
- * - If you want to remove it later, you might want to declare the callback as
1195
- * an object.
1196
- * - If you want to maintain the reference to 'this', you will need to declare
1197
- * the callback as an arrow function.
1431
+ * 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.
1198
1432
  */
1199
- export declare class Event<T> {
1433
+ export declare class AsyncEvent<T> {
1200
1434
  /**
1201
1435
  * Add a callback to this event instance.
1202
1436
  * @param handler - the callback to be added to this event.
1203
1437
  */
1204
1438
  add(handler: T extends void ? {
1205
- (): void;
1439
+ (): Promise<void>;
1206
1440
  } : {
1207
- (data: T): void;
1441
+ (data: T): Promise<void>;
1208
1442
  }): void;
1209
1443
  /**
1210
1444
  * Removes a callback from this event instance.
1211
1445
  * @param handler - the callback to be removed from this event.
1212
1446
  */
1213
1447
  remove(handler: T extends void ? {
1214
- (): void;
1448
+ (): Promise<void>;
1215
1449
  } : {
1216
- (data: T): void;
1450
+ (data: T): Promise<void>;
1217
1451
  }): void;
1218
1452
  /** Triggers all the callbacks assigned to this event. */
1219
- trigger: (data?: T) => void;
1453
+ trigger: (data?: T) => Promise<void>;
1220
1454
  /** Gets rid of all the suscribed events. */
1221
1455
  reset(): void;
1222
1456
  private handlers;
1223
1457
  }
1224
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1225
- import { Components } from "../../Components";
1226
- /**
1227
- * Base class of the library. Useful for finding out the interfaces it implements.
1228
- */
1229
- export declare abstract class Base {
1230
- components: Components;
1231
- constructor(components: Components);
1232
- /** Whether is component is {@link Disposable}. */
1233
- isDisposeable: () => this is Disposable;
1234
- /** Whether is component is {@link Resizeable}. */
1235
- isResizeable: () => this is Resizeable;
1236
- /** Whether is component is {@link Updateable}. */
1237
- isUpdateable: () => this is Updateable;
1238
- /** Whether is component is {@link Hideable}. */
1239
- isHideable: () => this is Hideable;
1240
- /** Whether is component is {@link Configurable}. */
1241
- isConfigurable: () => this is Configurable<any>;
1242
- }
1243
1458
  import { Base } from "./base";
1244
1459
  import { World } from "./world";
1245
1460
  import { Event } from "./event";
1246
1461
  import { Components } from "../../Components";
1247
1462
  /**
1248
- * One of the elements that make a world. It can be either a scene, a camera
1249
- * or a renderer.
1463
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
1250
1464
  */
1251
1465
  export declare abstract class BaseWorldItem extends Base {
1252
1466
  readonly worlds: Map<string, World>;
1467
+ /**
1468
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
1469
+ * The event payload contains the world instance and the action ("added" or "removed").
1470
+ */
1253
1471
  readonly onWorldChanged: Event<{
1254
1472
  world: World;
1255
1473
  action: "added" | "removed";
1256
1474
  }>;
1475
+ /**
1476
+ * The current world this item is associated with. It can be null if no world is currently active.
1477
+ */
1257
1478
  currentWorld: World | null;
1258
1479
  protected constructor(components: Components);
1259
1480
  }
@@ -1261,11 +1482,28 @@ import * as THREE from "three";
1261
1482
  import CameraControls from "camera-controls";
1262
1483
  import { BaseWorldItem } from "./base-world-item";
1263
1484
  import { CameraControllable } from "./interfaces";
1485
+ /**
1486
+ * Abstract class representing a camera in the 3D world. All cameras should use this class as a base.
1487
+ */
1264
1488
  export declare abstract class BaseCamera extends BaseWorldItem {
1489
+ /**
1490
+ * Whether the camera is enabled or not.
1491
+ */
1265
1492
  abstract enabled: boolean;
1493
+ /**
1494
+ * The Three.js camera instance.
1495
+ */
1266
1496
  abstract three: THREE.Camera;
1497
+ /**
1498
+ * Optional CameraControls instance for controlling the camera.
1499
+ * This property is only available if the camera is controllable.
1500
+ */
1267
1501
  abstract controls?: CameraControls;
1268
- /** Whether is instance is {@link CameraControllable}. */
1502
+ /**
1503
+ * Checks whether the instance is {@link CameraControllable}.
1504
+ *
1505
+ * @returns True if the instance is controllable, false otherwise.
1506
+ */
1269
1507
  hasCameraControls: () => this is CameraControllable;
1270
1508
  }
1271
1509
  import * as THREE from "three";
@@ -1273,7 +1511,16 @@ import { Vector2 } from "three";
1273
1511
  import { Event } from "./event";
1274
1512
  import { BaseWorldItem } from "./base-world-item";
1275
1513
  import { Disposable, Resizeable, Updateable } from "./interfaces";
1514
+ /**
1515
+ * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
1516
+ */
1276
1517
  export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1518
+ /**
1519
+ * The three.js WebGLRenderer instance associated with this renderer.
1520
+ *
1521
+ * @abstract
1522
+ * @type {THREE.WebGLRenderer}
1523
+ */
1277
1524
  abstract three: THREE.WebGLRenderer;
1278
1525
  /** {@link Updateable.onBeforeUpdate} */
1279
1526
  onAfterUpdate: Event<unknown>;
@@ -1281,31 +1528,47 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1281
1528
  onBeforeUpdate: Event<unknown>;
1282
1529
  /** {@link Disposable.onDisposed} */
1283
1530
  readonly onDisposed: Event<undefined>;
1531
+ /** {@link Resizeable.onResize} */
1284
1532
  readonly onResize: Event<THREE.Vector2>;
1285
1533
  /**
1286
1534
  * Event that fires when there has been a change to the list of clipping
1287
1535
  * planes used by the active renderer.
1288
1536
  */
1289
1537
  readonly onClippingPlanesUpdated: Event<unknown>;
1538
+ /** {@link Updateable.update} */
1290
1539
  abstract update(delta?: number): void | Promise<void>;
1540
+ /** {@link Disposable.dispose} */
1291
1541
  abstract dispose(): void;
1542
+ /** {@link Resizeable.getSize} */
1292
1543
  abstract getSize(): Vector2;
1544
+ /** {@link Resizeable.resize} */
1293
1545
  abstract resize(size: Vector2 | undefined): void;
1294
1546
  /**
1295
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1296
- * instance of the renderer.
1547
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
1297
1548
  */
1298
1549
  clippingPlanes: THREE.Plane[];
1299
1550
  /**
1300
- * Forces the update of the clipping planes and all components that depend
1301
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1302
- */
1551
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
1552
+ *
1553
+ * @remarks
1554
+ * This method is typically called when there is a change to the list of clipping planes
1555
+ * used by the active renderer.
1556
+ */
1303
1557
  updateClippingPlanes(): void;
1304
1558
  /**
1305
- * Adds or removes a
1306
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1307
- * to the renderer.
1308
- */
1559
+ * Sets or removes a clipping plane from the renderer.
1560
+ *
1561
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
1562
+ * @param plane - The clipping plane to be added or removed.
1563
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
1564
+ *
1565
+ * @remarks
1566
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
1567
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
1568
+ * If 'active' is 'false' and the plane is in the array, it is removed.
1569
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
1570
+ * excluding any planes marked as local.
1571
+ */
1309
1572
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1310
1573
  }
1311
1574
  import * as THREE from "three";
@@ -1313,9 +1576,16 @@ import { Disposable } from "./interfaces";
1313
1576
  import { Event } from "./event";
1314
1577
  import { Components } from "../../Components";
1315
1578
  import { BaseWorldItem } from "./base-world-item";
1579
+ /**
1580
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
1581
+ */
1316
1582
  export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1317
1583
  /** {@link Disposable.onDisposed} */
1318
1584
  readonly onDisposed: Event<unknown>;
1585
+ /**
1586
+ * Abstract property representing the three.js object associated with this scene.
1587
+ * It should be implemented by subclasses.
1588
+ */
1319
1589
  abstract three: THREE.Object3D;
1320
1590
  protected constructor(components: Components);
1321
1591
  /** {@link Disposable.dispose} */
@@ -1326,17 +1596,185 @@ import { BaseScene } from "./base-scene";
1326
1596
  import { BaseCamera } from "./base-camera";
1327
1597
  import { BaseRenderer } from "./base-renderer";
1328
1598
  import { Updateable, Disposable } from "./interfaces";
1599
+ /**
1600
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
1601
+ */
1329
1602
  export interface World extends Disposable, Updateable {
1603
+ /**
1604
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
1605
+ */
1330
1606
  meshes: Set<THREE.Mesh>;
1607
+ /**
1608
+ * The base scene of the world.
1609
+ */
1331
1610
  scene: BaseScene;
1611
+ /**
1612
+ * The base camera of the world.
1613
+ */
1332
1614
  camera: BaseCamera;
1615
+ /**
1616
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
1617
+ */
1333
1618
  renderer: BaseRenderer | null;
1619
+ /**
1620
+ * A unique identifier for the world.
1621
+ */
1334
1622
  uuid: string;
1623
+ /**
1624
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
1625
+ */
1335
1626
  isDisposing: boolean;
1336
1627
  }
1337
1628
  import * as THREE from "three";
1629
+ import { Hideable, Disposable, Event, World } from "../../Types";
1630
+ import { Components } from "../../Components";
1631
+ /**
1632
+ * Each of the planes created by the clipper.
1633
+ */
1634
+ export declare class SimplePlane implements Disposable, Hideable {
1635
+ /** Event that fires when the user starts dragging a clipping plane. */
1636
+ readonly onDraggingStarted: Event<unknown>;
1637
+ /** Event that fires when the user stops dragging a clipping plane. */
1638
+ readonly onDraggingEnded: Event<unknown>;
1639
+ /** {@link Disposable.onDisposed} */
1640
+ readonly onDisposed: Event<unknown>;
1641
+ /**
1642
+ * The normal vector of the clipping plane.
1643
+ */
1644
+ readonly normal: THREE.Vector3;
1645
+ /**
1646
+ * The origin point of the clipping plane.
1647
+ */
1648
+ readonly origin: THREE.Vector3;
1649
+ /**
1650
+ * The THREE.js Plane object representing the clipping plane.
1651
+ */
1652
+ readonly three: THREE.Plane;
1653
+ /** The components instance to which this plane belongs. */
1654
+ components: Components;
1655
+ /** The world instance to which this plane belongs. */
1656
+ world: World;
1657
+ protected readonly _helper: THREE.Object3D;
1658
+ protected _visible: boolean;
1659
+ protected _enabled: boolean;
1660
+ private _controlsActive;
1661
+ private readonly _arrowBoundBox;
1662
+ private readonly _planeMesh;
1663
+ private readonly _controls;
1664
+ private readonly _hiddenMaterial;
1665
+ /**
1666
+ * Getter for the enabled state of the clipping plane.
1667
+ * @returns {boolean} The current enabled state.
1668
+ */
1669
+ get enabled(): boolean;
1670
+ /**
1671
+ * Setter for the enabled state of the clipping plane.
1672
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
1673
+ * @param {boolean} state - The new enabled state.
1674
+ */
1675
+ set enabled(state: boolean);
1676
+ /** {@link Hideable.visible } */
1677
+ get visible(): boolean;
1678
+ /** {@link Hideable.visible } */
1679
+ set visible(state: boolean);
1680
+ /** The meshes used for raycasting */
1681
+ get meshes(): THREE.Mesh[];
1682
+ /** The material of the clipping plane representation. */
1683
+ get planeMaterial(): THREE.Material | THREE.Material[];
1684
+ /** The material of the clipping plane representation. */
1685
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
1686
+ /** The size of the clipping plane representation. */
1687
+ get size(): number;
1688
+ /** Sets the size of the clipping plane representation. */
1689
+ set size(size: number);
1690
+ /**
1691
+ * Getter for the helper object of the clipping plane.
1692
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
1693
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
1694
+ *
1695
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
1696
+ */
1697
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1698
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1699
+ /**
1700
+ * Sets the clipping plane's normal and origin from the given normal and point.
1701
+ * This method resets the clipping plane's state, updates the normal and origin,
1702
+ * and positions the helper object accordingly.
1703
+ *
1704
+ * @param normal - The new normal vector for the clipping plane.
1705
+ * @param point - The new origin point for the clipping plane.
1706
+ *
1707
+ * @returns {void}
1708
+ */
1709
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1710
+ /** {@link Updateable.update} */
1711
+ update: () => void;
1712
+ /** {@link Disposable.dispose} */
1713
+ dispose(): void;
1714
+ private reset;
1715
+ protected toggleControls(state: boolean): void;
1716
+ private newTransformControls;
1717
+ private initializeControls;
1718
+ private createArrowBoundingBox;
1719
+ private changeDrag;
1720
+ private notifyDraggingChanged;
1721
+ private preventCameraMovement;
1722
+ private newHelper;
1723
+ private static newPlaneMesh;
1724
+ }
1725
+ import * as THREE from "three";
1726
+ import { Hideable, Event, World, Disposable } from "../../Types";
1727
+ import { Components } from "../../Components";
1728
+ export interface GridConfig {
1729
+ color: THREE.Color;
1730
+ size1: number;
1731
+ size2: number;
1732
+ distance: number;
1733
+ }
1734
+ /**
1735
+ * An infinite grid. Created by
1736
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1737
+ * and translated to typescript by
1738
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1739
+ */
1740
+ export declare class SimpleGrid implements Hideable, Disposable {
1741
+ /** {@link Disposable.onDisposed} */
1742
+ readonly onDisposed: Event<unknown>;
1743
+ /** The world instance to which this Raycaster belongs. */
1744
+ world: World;
1745
+ /** The components instance to which this grid belongs. */
1746
+ components: Components;
1747
+ /** {@link Hideable.visible} */
1748
+ get visible(): boolean;
1749
+ /** {@link Hideable.visible} */
1750
+ set visible(visible: boolean);
1751
+ /** The material of the grid. */
1752
+ get material(): THREE.ShaderMaterial;
1753
+ /**
1754
+ * Whether the grid should fade away with distance. Recommended to be true for
1755
+ * perspective cameras and false for orthographic cameras.
1756
+ */
1757
+ get fade(): boolean;
1758
+ /**
1759
+ * Whether the grid should fade away with distance. Recommended to be true for
1760
+ * perspective cameras and false for orthographic cameras.
1761
+ */
1762
+ set fade(active: boolean);
1763
+ /** The Three.js mesh that contains the infinite grid. */
1764
+ readonly three: THREE.Mesh;
1765
+ private _fade;
1766
+ constructor(components: Components, world: World, config: GridConfig);
1767
+ /** {@link Disposable.dispose} */
1768
+ dispose(): void;
1769
+ private setupEvents;
1770
+ private updateZoom;
1771
+ }
1772
+ import * as THREE from "three";
1338
1773
  import { BaseScene, Configurable, Event } from "../../Types";
1339
1774
  import { Components } from "../../Components";
1775
+ /**
1776
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
1777
+ */
1340
1778
  export interface SimpleSceneConfig {
1341
1779
  directionalLight: {
1342
1780
  color: THREE.Color;
@@ -1349,143 +1787,129 @@ export interface SimpleSceneConfig {
1349
1787
  };
1350
1788
  }
1351
1789
  /**
1352
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1353
- * objects hierarchically, and easily dispose them when you are finished with it.
1354
- * @noInheritDoc
1790
+ * 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.
1355
1791
  */
1356
1792
  export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1357
1793
  /** {@link Configurable.isSetup} */
1358
1794
  isSetup: boolean;
1795
+ /**
1796
+ * The underlying Three.js scene object.
1797
+ * It is used to define the 3D space containing objects, lights, and cameras.
1798
+ */
1359
1799
  three: THREE.Scene;
1360
1800
  /** {@link Configurable.onSetup} */
1361
1801
  readonly onSetup: Event<SimpleScene>;
1802
+ /**
1803
+ * Configuration interface for the {@link SimpleScene}.
1804
+ * Defines properties for directional and ambient lights.
1805
+ */
1362
1806
  config: Required<SimpleSceneConfig>;
1363
1807
  constructor(components: Components);
1364
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1808
+ /** {@link Configurable.setup} */
1365
1809
  setup(config?: Partial<SimpleSceneConfig>): void;
1366
1810
  }
1367
1811
  import * as THREE from "three";
1368
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1369
- import { Components } from "../../Components";
1370
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1812
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
1813
+ /**
1814
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
1815
+ *
1816
+ * @template T - The type of the scene. Default is BaseScene.
1817
+ * @template U - The type of the camera. Default is BaseCamera.
1818
+ * @template S - The type of the renderer. Default is BaseRenderer.
1819
+ */
1820
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
1371
1821
  /**
1372
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1822
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
1373
1823
  */
1374
1824
  readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1825
+ /** {@link Updateable.onAfterUpdate} */
1375
1826
  readonly onAfterUpdate: Event<unknown>;
1827
+ /** {@link Updateable.onBeforeUpdate} */
1376
1828
  readonly onBeforeUpdate: Event<unknown>;
1829
+ /** {@link Disposable.onDisposed} */
1830
+ readonly onDisposed: Event<unknown>;
1831
+ /**
1832
+ * 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.
1833
+ */
1377
1834
  isDisposing: boolean;
1835
+ /**
1836
+ * Indicates whether the world is currently enabled.
1837
+ * When disabled, the world will not be updated.
1838
+ */
1378
1839
  enabled: boolean;
1840
+ /**
1841
+ * A unique identifier for the world.
1842
+ */
1379
1843
  uuid: string;
1844
+ /**
1845
+ * An optional name for the world.
1846
+ */
1380
1847
  name?: string;
1381
- readonly onDisposed: Event<unknown>;
1382
1848
  private _scene?;
1383
1849
  private _camera?;
1384
1850
  private _renderer;
1851
+ /**
1852
+ * Getter for the scene. If no scene is initialized, it throws an error.
1853
+ * @returns The current scene.
1854
+ */
1385
1855
  get scene(): T;
1856
+ /**
1857
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
1858
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
1859
+ * @param scene - The new scene to be set.
1860
+ */
1386
1861
  set scene(scene: T);
1862
+ /**
1863
+ * Getter for the camera. If no camera is initialized, it throws an error.
1864
+ * @returns The current camera.
1865
+ */
1387
1866
  get camera(): U;
1867
+ /**
1868
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
1869
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
1870
+ * @param camera - The new camera to be set.
1871
+ */
1388
1872
  set camera(camera: U);
1389
- get renderer(): S | null;
1390
- set renderer(renderer: S | null);
1391
- constructor(components: Components);
1392
- update(delta?: number): void;
1393
- dispose(disposeResources?: boolean): void;
1394
- }
1395
- import * as THREE from "three";
1396
- import { BaseRenderer, Event } from "../../Types";
1397
- import { Components } from "../../Components";
1398
- /**
1399
- * A basic renderer capable of rendering
1400
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1401
- */
1402
- export declare class SimpleRenderer extends BaseRenderer {
1403
- enabled: boolean;
1404
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1405
- container: HTMLElement;
1406
- three: THREE.WebGLRenderer;
1407
- protected _canvas: HTMLCanvasElement;
1408
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1409
- protected _resizeObserver: ResizeObserver | null;
1410
- protected onContainerUpdated: Event<unknown>;
1411
- private _resizing;
1412
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1413
- /** {@link Updateable.update} */
1414
- update(): void;
1415
- /** {@link Disposable.dispose} */
1416
- dispose(): void;
1417
- /** {@link Resizeable.getSize}. */
1418
- getSize(): THREE.Vector2;
1419
- /** {@link Resizeable.resize} */
1420
- resize: (size?: THREE.Vector2) => void;
1421
- setupEvents(active: boolean): void;
1422
- private resizeEvent;
1423
- private setupRenderer;
1424
- private onContextLost;
1425
- private onContextBack;
1426
- }
1427
- import * as THREE from "three";
1428
- import { Hideable, Event, World, Disposable } from "../../Types";
1429
- import { Components } from "../../Components";
1430
- export interface GridConfig {
1431
- color: THREE.Color;
1432
- size1: number;
1433
- size2: number;
1434
- distance: number;
1435
- }
1436
- /**
1437
- * An infinite grid. Created by
1438
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1439
- * and translated to typescript by
1440
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1441
- */
1442
- export declare class SimpleGrid implements Hideable, Disposable {
1443
- /** {@link Disposable.onDisposed} */
1444
- readonly onDisposed: Event<unknown>;
1445
- world: World;
1446
- components: Components;
1447
- /** {@link Hideable.visible} */
1448
- get visible(): boolean;
1449
- /** {@link Hideable.visible} */
1450
- set visible(visible: boolean);
1451
- /** The material of the grid. */
1452
- get material(): THREE.ShaderMaterial;
1453
1873
  /**
1454
- * Whether the grid should fade away with distance. Recommended to be true for
1455
- * perspective cameras and false for orthographic cameras.
1874
+ * Getter for the renderer.
1875
+ * @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).
1456
1876
  */
1457
- get fade(): boolean;
1877
+ get renderer(): S | null;
1458
1878
  /**
1459
- * Whether the grid should fade away with distance. Recommended to be true for
1460
- * perspective cameras and false for orthographic cameras.
1879
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
1880
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
1881
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
1882
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
1461
1883
  */
1462
- set fade(active: boolean);
1463
- readonly three: THREE.Mesh;
1464
- private _fade;
1465
- constructor(components: Components, world: World, config: GridConfig);
1884
+ set renderer(renderer: S | null);
1885
+ /** {@link Updateable.update} */
1886
+ update(delta?: number): void;
1466
1887
  /** {@link Disposable.dispose} */
1467
- dispose(): void;
1468
- private setupEvents;
1469
- private updateZoom;
1888
+ dispose(disposeResources?: boolean): void;
1470
1889
  }
1471
1890
  import * as THREE from "three";
1472
1891
  import CameraControls from "camera-controls";
1473
1892
  import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1474
1893
  import { Components } from "../../Components";
1475
1894
  /**
1476
- * A basic camera that uses
1477
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1478
- * easily control the camera in 2D and 3D. Check out it's API to find out
1479
- * what features it offers.
1895
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to easily control the camera in 2D and 3D. Check out it's API to find out what features it offers.
1480
1896
  */
1481
1897
  export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1482
1898
  /** {@link Updateable.onBeforeUpdate} */
1483
1899
  readonly onBeforeUpdate: Event<SimpleCamera>;
1484
1900
  /** {@link Updateable.onAfterUpdate} */
1485
1901
  readonly onAfterUpdate: Event<SimpleCamera>;
1902
+ /**
1903
+ * Event that is triggered when the aspect of the camera has been updated.
1904
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
1905
+ */
1486
1906
  readonly onAspectUpdated: Event<unknown>;
1487
1907
  /** {@link Disposable.onDisposed} */
1488
1908
  readonly onDisposed: Event<string>;
1909
+ /**
1910
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
1911
+ * This camera is used for rendering the scene.
1912
+ */
1489
1913
  three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1490
1914
  private _allControls;
1491
1915
  /**
@@ -1495,9 +1919,20 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
1495
1919
  * object to move, rotate, look at objects, etc.
1496
1920
  */
1497
1921
  get controls(): CameraControls;
1498
- /** {@link Component.enabled} */
1922
+ /**
1923
+ * Getter for the enabled state of the camera controls.
1924
+ * If the current world is null, it returns false.
1925
+ * Otherwise, it returns the enabled state of the camera controls.
1926
+ *
1927
+ * @returns {boolean} The enabled state of the camera controls.
1928
+ */
1499
1929
  get enabled(): boolean;
1500
- /** {@link Component.enabled} */
1930
+ /**
1931
+ * Setter for the enabled state of the camera controls.
1932
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
1933
+ *
1934
+ * @param {boolean} enabled - The new enabled state of the camera controls.
1935
+ */
1501
1936
  set enabled(enabled: boolean);
1502
1937
  constructor(components: Components);
1503
1938
  /** {@link Disposable.dispose} */
@@ -1514,124 +1949,59 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
1514
1949
  private setupEvents;
1515
1950
  private static getSubsetOfThree;
1516
1951
  }
1517
- import { NavigationMode } from "./types";
1518
- import { OrthoPerspectiveCamera } from "../index";
1519
- /**
1520
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1521
- * like many BIM tools.
1522
- */
1523
- export declare class PlanMode implements NavigationMode {
1524
- private camera;
1525
- /** {@link NavigationMode.enabled} */
1526
- enabled: boolean;
1527
- /** {@link NavigationMode.id} */
1528
- readonly id = "Plan";
1529
- private mouseAction1?;
1530
- private mouseAction2?;
1531
- private mouseInitialized;
1532
- private readonly defaultAzimuthSpeed;
1533
- private readonly defaultPolarSpeed;
1534
- constructor(camera: OrthoPerspectiveCamera);
1535
- /** {@link NavigationMode.set} */
1536
- set(active: boolean): void;
1537
- }
1538
- import { NavigationMode } from "./types";
1539
- import { OrthoPerspectiveCamera } from "../index";
1540
- /**
1541
- * A {@link NavigationMode} that allows 3D navigation and panning
1542
- * like in many 3D and CAD softwares.
1543
- */
1544
- export declare class OrbitMode implements NavigationMode {
1545
- camera: OrthoPerspectiveCamera;
1546
- /** {@link NavigationMode.enabled} */
1547
- enabled: boolean;
1548
- /** {@link NavigationMode.id} */
1549
- readonly id = "Orbit";
1550
- constructor(camera: OrthoPerspectiveCamera);
1551
- /** {@link NavigationMode.set} */
1552
- set(active: boolean): void;
1553
- private activateOrbitControls;
1554
- }
1555
- import { NavigationMode } from "./types";
1556
- import { OrthoPerspectiveCamera } from "../index";
1557
- /**
1558
- * A {@link NavigationMode} that allows first person navigation,
1559
- * simulating FPS video games.
1560
- */
1561
- export declare class FirstPersonMode implements NavigationMode {
1562
- private camera;
1563
- /** {@link NavigationMode.enabled} */
1564
- enabled: boolean;
1565
- /** {@link NavigationMode.id} */
1566
- readonly id = "FirstPerson";
1567
- constructor(camera: OrthoPerspectiveCamera);
1568
- /** {@link NavigationMode.set} */
1569
- set(active: boolean): void;
1570
- private setupFirstPersonCamera;
1571
- }
1572
1952
  import * as THREE from "three";
1573
- import { CameraProjection } from "./types";
1574
- import { Event } from "../../Types";
1575
- import { OrthoPerspectiveCamera } from "../index";
1953
+ import { BaseRenderer, Event } from "../../Types";
1954
+ import { Components } from "../../Components";
1576
1955
  /**
1577
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1956
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1578
1957
  */
1579
- export declare class ProjectionManager {
1958
+ export declare class SimpleRenderer extends BaseRenderer {
1580
1959
  /**
1581
- * Event that fires when the {@link CameraProjection} changes.
1960
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
1961
+ * Default is 'true'.
1582
1962
  */
1583
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1584
- current: CameraProjection;
1585
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1586
- private _component;
1587
- private _previousDistance;
1588
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1589
- matchOrthoDistanceEnabled: boolean;
1590
- constructor(camera: OrthoPerspectiveCamera);
1963
+ enabled: boolean;
1591
1964
  /**
1592
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1593
- *
1594
- * @param projection - the new projection to set. If it is the current projection,
1595
- * it will have no effect.
1965
+ * The HTML container of the THREE.js canvas where the scene is rendered.
1596
1966
  */
1597
- set(projection: CameraProjection): Promise<void>;
1967
+ container: HTMLElement;
1598
1968
  /**
1599
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1600
- * and vice versa.
1969
+ * The THREE.js WebGLRenderer instance.
1601
1970
  */
1602
- toggle(): Promise<void>;
1603
- private setOrthoCamera;
1604
- private getPerspectiveDims;
1605
- private setupOrthoCamera;
1606
- private getDistance;
1607
- private setPerspectiveCamera;
1608
- }
1609
- /**
1610
- * The projection system of the camera.
1611
- */
1612
- export type CameraProjection = "Perspective" | "Orthographic";
1613
- /**
1614
- * The extensible list of supported navigation modes.
1615
- */
1616
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1617
- /**
1618
- * An object that determines the behavior of the camera controls
1619
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1620
- */
1621
- export interface NavigationMode {
1622
- /** The unique ID of this navigation mode. */
1623
- id: NavModeID;
1971
+ three: THREE.WebGLRenderer;
1972
+ protected _canvas: HTMLCanvasElement;
1973
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1974
+ protected _resizeObserver: ResizeObserver | null;
1975
+ protected onContainerUpdated: Event<unknown>;
1976
+ private _resizing;
1624
1977
  /**
1625
- * Enable or disable this navigation mode.
1626
- * When a new navigation mode is enabled, the previous navigation mode
1627
- * must be disabled.
1978
+ * Constructor for the SimpleRenderer class.
1628
1979
  *
1629
- * @param active - whether to enable or disable this mode.
1630
- * @param options - any additional data required to enable or disable it.
1631
- * */
1632
- set: (active: boolean, options?: any) => void;
1633
- /** Whether this navigation mode is active or not. */
1634
- enabled: boolean;
1980
+ * @param components - The components instance.
1981
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
1982
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
1983
+ */
1984
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1985
+ /** {@link Updateable.update} */
1986
+ update(): void;
1987
+ /** {@link Disposable.dispose} */
1988
+ dispose(): void;
1989
+ /** {@link Resizeable.getSize}. */
1990
+ getSize(): THREE.Vector2;
1991
+ /** {@link Resizeable.resize} */
1992
+ resize: (size?: THREE.Vector2) => void;
1993
+ /**
1994
+ * Sets up and manages the event listeners for the renderer.
1995
+ *
1996
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
1997
+ *
1998
+ * @throws Will throw an error if the renderer does not have an HTML container.
1999
+ */
2000
+ setupEvents(active: boolean): void;
2001
+ private resizeEvent;
2002
+ private setupRenderer;
2003
+ private onContextLost;
2004
+ private onContextBack;
1635
2005
  }
1636
2006
  import * as THREE from "three";
1637
2007
  import { Disposable, Event } from "../../Types";
@@ -1671,12 +2041,21 @@ import { Mouse } from "./mouse";
1671
2041
  export declare class SimpleRaycaster implements Disposable {
1672
2042
  /** {@link Component.enabled} */
1673
2043
  enabled: boolean;
2044
+ /** The components instance to which this Raycaster belongs. */
1674
2045
  components: Components;
1675
2046
  /** {@link Disposable.onDisposed} */
1676
2047
  readonly onDisposed: Event<unknown>;
1677
2048
  /** The position of the mouse in the screen. */
1678
2049
  readonly mouse: Mouse;
2050
+ /**
2051
+ * A reference to the Three.js Raycaster instance.
2052
+ * This is used for raycasting operations.
2053
+ */
1679
2054
  readonly three: THREE.Raycaster;
2055
+ /**
2056
+ * A reference to the world instance to which this Raycaster belongs.
2057
+ * This is used to access the camera and meshes.
2058
+ */
1680
2059
  world: World;
1681
2060
  constructor(components: Components, world: World);
1682
2061
  /** {@link Disposable.dispose} */
@@ -1691,6 +2070,15 @@ export declare class SimpleRaycaster implements Disposable {
1691
2070
  * {@link Components.meshes}.
1692
2071
  */
1693
2072
  castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2073
+ /**
2074
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2075
+ * This method also takes into account the clipping planes used by the renderer.
2076
+ *
2077
+ * @param origin - The origin of the ray.
2078
+ * @param direction - The direction of the ray.
2079
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2080
+ * @returns The first intersection found or 'null' if no intersection was found.
2081
+ */
1694
2082
  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;
1695
2083
  private intersect;
1696
2084
  private filterClippingPlanes;
@@ -1698,14 +2086,33 @@ export declare class SimpleRaycaster implements Disposable {
1698
2086
  import * as THREE from "three";
1699
2087
  import { Components } from "../../Components";
1700
2088
  import { AsyncEvent, Event, World } from "../../Types";
2089
+ /**
2090
+ * Interface for settings to configure the CullerRenderer.
2091
+ */
1701
2092
  export interface CullerRendererSettings {
2093
+ /**
2094
+ * Interval in milliseconds at which the visibility check should be performed.
2095
+ * Default value is 1000.
2096
+ */
1702
2097
  updateInterval?: number;
2098
+ /**
2099
+ * Width of the render target used for visibility checks.
2100
+ * Default value is 512.
2101
+ */
1703
2102
  width?: number;
2103
+ /**
2104
+ * Height of the render target used for visibility checks.
2105
+ * Default value is 512.
2106
+ */
1704
2107
  height?: number;
2108
+ /**
2109
+ * Whether the visibility check should be performed automatically.
2110
+ * Default value is true.
2111
+ */
1705
2112
  autoUpdate?: boolean;
1706
2113
  }
1707
2114
  /**
1708
- * A base renderer to determine visibility on screen
2115
+ * A base renderer to determine visibility on screen.
1709
2116
  */
1710
2117
  export declare class CullerRenderer {
1711
2118
  /** {@link Disposable.onDisposed} */
@@ -1716,7 +2123,9 @@ export declare class CullerRenderer {
1716
2123
  * just before but not anymore.
1717
2124
  */
1718
2125
  readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1719
- /** {@link Component.enabled} */
2126
+ /**
2127
+ * Whether this renderer is active or not. If not, it won't render anything.
2128
+ */
1720
2129
  enabled: boolean;
1721
2130
  /**
1722
2131
  * Needs to check whether there are objects that need to be hidden or shown.
@@ -1728,8 +2137,11 @@ export declare class CullerRenderer {
1728
2137
  * for debugging purposes.
1729
2138
  */
1730
2139
  renderDebugFrame: boolean;
2140
+ /** The components instance to which this renderer belongs. */
1731
2141
  components: Components;
2142
+ /** The world instance to which this renderer belongs. */
1732
2143
  readonly world: World;
2144
+ /** The THREE.js renderer used to make the visibility test. */
1733
2145
  readonly renderer: THREE.WebGLRenderer;
1734
2146
  protected autoUpdate: boolean;
1735
2147
  protected updateInterval: number;
@@ -1762,21 +2174,36 @@ export declare class CullerRenderer {
1762
2174
  protected decreaseColor(): void;
1763
2175
  private applySettings;
1764
2176
  }
1765
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1766
2177
  import * as THREE from "three";
1767
2178
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1768
2179
  import { Components } from "../../Components";
1769
- import { Event, World } from "../../Types";
2180
+ import { Event, World, Disposable } from "../../Types";
1770
2181
  /**
1771
- * A renderer to determine a mesh visibility on screen
2182
+ * A renderer to determine a mesh visibility on screen.
1772
2183
  */
1773
- export declare class MeshCullerRenderer extends CullerRenderer {
1774
- threshold: number;
2184
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2185
+ /**
2186
+ * Event triggered when the visibility of meshes is updated.
2187
+ * Contains two sets: seen and unseen.
2188
+ */
1775
2189
  readonly onViewUpdated: Event<{
1776
2190
  seen: Set<THREE.Mesh>;
1777
2191
  unseen: Set<THREE.Mesh>;
1778
2192
  }>;
2193
+ /**
2194
+ * Pixels in screen a geometry must occupy to be considered "seen".
2195
+ * Default value is 100.
2196
+ */
2197
+ threshold: number;
2198
+ /**
2199
+ * Map of color code to THREE.InstancedMesh.
2200
+ * Used to keep track of color-coded meshes.
2201
+ */
1779
2202
  colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2203
+ /**
2204
+ * Flag to indicate if the renderer is currently processing.
2205
+ * Used to prevent concurrent processing.
2206
+ */
1780
2207
  isProcessing: boolean;
1781
2208
  private _colorCodeMeshMap;
1782
2209
  private _meshIDColorCodeMap;
@@ -1785,72 +2212,162 @@ export declare class MeshCullerRenderer extends CullerRenderer {
1785
2212
  private _intervalID;
1786
2213
  private readonly _transparentMat;
1787
2214
  constructor(components: Components, world: World, settings?: CullerRendererSettings);
2215
+ /** {@link Disposable.dispose} */
1788
2216
  dispose(): void;
2217
+ /**
2218
+ * 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.
2219
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2220
+ * @returns {void}
2221
+ */
1789
2222
  add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2223
+ /**
2224
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2225
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2226
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2227
+ * @returns {void}
2228
+ */
1790
2229
  remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1791
2230
  private handleWorkerMessage;
1792
2231
  private getAvailableMaterial;
1793
2232
  }
2233
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2234
+ import { NavigationMode } from "./types";
2235
+ import { OrthoPerspectiveCamera } from "../index";
2236
+ /**
2237
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2238
+ */
2239
+ export declare class FirstPersonMode implements NavigationMode {
2240
+ private camera;
2241
+ /** {@link NavigationMode.enabled} */
2242
+ enabled: boolean;
2243
+ /** {@link NavigationMode.id} */
2244
+ readonly id = "FirstPerson";
2245
+ constructor(camera: OrthoPerspectiveCamera);
2246
+ /** {@link NavigationMode.set} */
2247
+ set(active: boolean): void;
2248
+ private setupFirstPersonCamera;
2249
+ }
2250
+ import { NavigationMode } from "./types";
2251
+ import { OrthoPerspectiveCamera } from "../index";
2252
+ /**
2253
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2254
+ */
2255
+ export declare class OrbitMode implements NavigationMode {
2256
+ camera: OrthoPerspectiveCamera;
2257
+ /** {@link NavigationMode.enabled} */
2258
+ enabled: boolean;
2259
+ /** {@link NavigationMode.id} */
2260
+ readonly id = "Orbit";
2261
+ constructor(camera: OrthoPerspectiveCamera);
2262
+ /** {@link NavigationMode.set} */
2263
+ set(active: boolean): void;
2264
+ private activateOrbitControls;
2265
+ }
2266
+ import { NavigationMode } from "./types";
2267
+ import { OrthoPerspectiveCamera } from "../index";
2268
+ /**
2269
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2270
+ */
2271
+ export declare class PlanMode implements NavigationMode {
2272
+ private camera;
2273
+ /** {@link NavigationMode.enabled} */
2274
+ enabled: boolean;
2275
+ /** {@link NavigationMode.id} */
2276
+ readonly id = "Plan";
2277
+ private mouseAction1?;
2278
+ private mouseAction2?;
2279
+ private mouseInitialized;
2280
+ private readonly defaultAzimuthSpeed;
2281
+ private readonly defaultPolarSpeed;
2282
+ constructor(camera: OrthoPerspectiveCamera);
2283
+ /** {@link NavigationMode.set} */
2284
+ set(active: boolean): void;
2285
+ }
1794
2286
  import * as THREE from "three";
1795
- import { Hideable, Disposable, Event, World } from "../../Types";
1796
- import { Components } from "../../Components";
2287
+ import { CameraProjection } from "./types";
2288
+ import { Event } from "../../Types";
2289
+ import { OrthoPerspectiveCamera } from "../index";
1797
2290
  /**
1798
- * Each of the planes created by {@link SimpleClipper}.
2291
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1799
2292
  */
1800
- export declare class SimplePlane implements Disposable, Hideable {
1801
- /** Event that fires when the user starts dragging a clipping plane. */
1802
- readonly onDraggingStarted: Event<unknown>;
1803
- /** Event that fires when the user stops dragging a clipping plane. */
1804
- readonly onDraggingEnded: Event<unknown>;
1805
- /** {@link Disposable.onDisposed} */
1806
- readonly onDisposed: Event<unknown>;
1807
- readonly normal: THREE.Vector3;
1808
- readonly origin: THREE.Vector3;
1809
- readonly three: THREE.Plane;
1810
- protected readonly _helper: THREE.Object3D;
1811
- protected _visible: boolean;
1812
- protected _enabled: boolean;
1813
- components: Components;
1814
- world: World;
1815
- private _controlsActive;
1816
- private readonly _arrowBoundBox;
1817
- private readonly _planeMesh;
1818
- private readonly _controls;
1819
- private readonly _hiddenMaterial;
1820
- get enabled(): boolean;
1821
- /** {@link Component.enabled} */
1822
- set enabled(state: boolean);
1823
- /** {@link Hideable.visible } */
1824
- get visible(): boolean;
1825
- /** {@link Hideable.visible } */
1826
- set visible(state: boolean);
1827
- /** The meshes used for raycasting */
1828
- get meshes(): THREE.Mesh[];
1829
- /** The material of the clipping plane representation. */
1830
- get planeMaterial(): THREE.Material | THREE.Material[];
1831
- /** The material of the clipping plane representation. */
1832
- set planeMaterial(material: THREE.Material | THREE.Material[]);
1833
- /** The size of the clipping plane representation. */
1834
- get size(): number;
1835
- /** Sets the size of the clipping plane representation. */
1836
- set size(size: number);
1837
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1838
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1839
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1840
- /** {@link Updateable.update} */
1841
- update: () => void;
1842
- /** {@link Disposable.dispose} */
1843
- dispose(): void;
1844
- private reset;
1845
- protected toggleControls(state: boolean): void;
1846
- private newTransformControls;
1847
- private initializeControls;
1848
- private createArrowBoundingBox;
1849
- private changeDrag;
1850
- private notifyDraggingChanged;
1851
- private preventCameraMovement;
1852
- private newHelper;
1853
- private static newPlaneMesh;
2293
+ export declare class ProjectionManager {
2294
+ /**
2295
+ * Event that fires when the {@link CameraProjection} changes.
2296
+ */
2297
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
2298
+ /**
2299
+ * Current projection mode of the camera.
2300
+ * Default is "Perspective".
2301
+ */
2302
+ current: CameraProjection;
2303
+ /**
2304
+ * The camera controlled by this ProjectionManager.
2305
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
2306
+ */
2307
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2308
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
2309
+ matchOrthoDistanceEnabled: boolean;
2310
+ private _component;
2311
+ private _previousDistance;
2312
+ constructor(camera: OrthoPerspectiveCamera);
2313
+ /**
2314
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2315
+ *
2316
+ * @param projection - the new projection to set. If it is the current projection,
2317
+ * it will have no effect.
2318
+ */
2319
+ set(projection: CameraProjection): Promise<void>;
2320
+ /**
2321
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
2322
+ * and vice versa.
2323
+ */
2324
+ toggle(): Promise<void>;
2325
+ private setOrthoCamera;
2326
+ private getPerspectiveDims;
2327
+ private setupOrthoCamera;
2328
+ private getDistance;
2329
+ private setPerspectiveCamera;
2330
+ }
2331
+ /**
2332
+ * The projection system of the camera.
2333
+ */
2334
+ export type CameraProjection = "Perspective" | "Orthographic";
2335
+ /**
2336
+ * The extensible list of supported navigation modes.
2337
+ */
2338
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
2339
+ /**
2340
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
2341
+ */
2342
+ export interface NavigationMode {
2343
+ /** The unique ID of this navigation mode. */
2344
+ id: NavModeID;
2345
+ /**
2346
+ * Enable or disable this navigation mode.
2347
+ * When a new navigation mode is enabled, the previous navigation mode
2348
+ * must be disabled.
2349
+ *
2350
+ * @param active - whether to enable or disable this mode.
2351
+ * @param options - any additional data required to enable or disable it.
2352
+ * */
2353
+ set: (active: boolean, options?: any) => void;
2354
+ /** Whether this navigation mode is active or not. */
2355
+ enabled: boolean;
2356
+ }
2357
+ import * as THREE from "three";
2358
+ import * as WEBIFC from "web-ifc";
2359
+ import * as FRAGS from "@thatopen/fragments";
2360
+ export declare class CivilReader {
2361
+ defLineMat: THREE.LineBasicMaterial;
2362
+ read(webIfc: WEBIFC.IfcAPI): {
2363
+ alignments: Map<number, FRAGS.Alignment>;
2364
+ coordinationMatrix: THREE.Matrix4;
2365
+ } | undefined;
2366
+ get(civilItems: any): {
2367
+ alignments: Map<number, FRAGS.Alignment>;
2368
+ coordinationMatrix: THREE.Matrix4;
2369
+ } | undefined;
2370
+ private getCurves;
1854
2371
  }
1855
2372
  import * as WEBIFC from "web-ifc";
1856
2373
  /** Configuration of the IFC-fragment conversion. */
@@ -1879,21 +2396,6 @@ export declare class IfcFragmentSettings {
1879
2396
  autoSetWasm: boolean;
1880
2397
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1881
2398
  }
1882
- import * as THREE from "three";
1883
- import * as WEBIFC from "web-ifc";
1884
- import * as FRAGS from "@thatopen/fragments";
1885
- export declare class CivilReader {
1886
- defLineMat: THREE.LineBasicMaterial;
1887
- read(webIfc: WEBIFC.IfcAPI): {
1888
- alignments: Map<number, FRAGS.Alignment>;
1889
- coordinationMatrix: THREE.Matrix4;
1890
- } | undefined;
1891
- get(civilItems: any): {
1892
- alignments: Map<number, FRAGS.Alignment>;
1893
- coordinationMatrix: THREE.Matrix4;
1894
- } | undefined;
1895
- private getCurves;
1896
- }
1897
2399
  import * as WEBIFC from "web-ifc";
1898
2400
  export declare class IfcMetadataReader {
1899
2401
  getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
@@ -1925,16 +2427,6 @@ export interface StreamedAsset {
1925
2427
  }[];
1926
2428
  }
1927
2429
  import * as WEBIFC from "web-ifc";
1928
- import * as THREE from "three";
1929
- export declare class Units {
1930
- factor: number;
1931
- complement: number;
1932
- apply(matrix: THREE.Matrix4): void;
1933
- setUp(webIfc: WEBIFC.IfcAPI): void;
1934
- private getLengthUnits;
1935
- private getScaleMatrix;
1936
- }
1937
- import * as WEBIFC from "web-ifc";
1938
2430
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1939
2431
  import { PropertiesStreamingSettings } from "./streaming-settings";
1940
2432
  export declare class FragmentPropsStreamConverter extends Component implements Disposable {
@@ -1985,6 +2477,16 @@ export type InverseAttributes = [
1985
2477
  "ContainsElements"
1986
2478
  ];
1987
2479
  export type InverseAttribute = InverseAttributes[number];
2480
+ import * as WEBIFC from "web-ifc";
2481
+ import * as THREE from "three";
2482
+ export declare class Units {
2483
+ factor: number;
2484
+ complement: number;
2485
+ apply(matrix: THREE.Matrix4): void;
2486
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2487
+ private getLengthUnits;
2488
+ private getScaleMatrix;
2489
+ }
1988
2490
  import { BufferGeometry } from "three";
1989
2491
  import * as THREE from "three";
1990
2492
  export declare class TransformHelper {