@thatopen/components 2.0.6 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,520 +1,395 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event, Components } from "../../core";
3
- export declare class Exploder extends Component implements Disposable {
4
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
5
- enabled: boolean;
6
- height: number;
7
- groupName: string;
8
- /** {@link Disposable.onDisposed} */
9
- readonly onDisposed: Event<unknown>;
10
- list: Set<string>;
11
- constructor(components: Components);
12
- dispose(): void;
13
- set(active: boolean): void;
14
- }
15
- import * as THREE from "three";
16
- import * as FRAGS from "@thatopen/fragments";
17
- import { FragmentsGroup } from "@thatopen/fragments";
18
- import { Component, Components, Disposable, Event } from "../../core";
2
+ import { Component, Disposable, Event } from "../Types";
19
3
  /**
20
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
21
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
4
+ * The entry point of the Components library.
5
+ * It can:
6
+ * - Create and access all the components of the library.
7
+ * - Update all the updatable components automatically.
8
+ * - Dispose all the components, preventing memory leaks.
22
9
  */
23
- export declare class BoundingBoxer extends Component implements Disposable {
24
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
25
- /** {@link Component.enabled} */
26
- enabled: boolean;
27
- /** {@link Disposable.onDisposed} */
28
- readonly onDisposed: Event<unknown>;
29
- private _absoluteMin;
30
- private _absoluteMax;
31
- private _meshes;
32
- constructor(components: Components);
33
- static getDimensions(bbox: THREE.Box3): {
34
- width: number;
35
- height: number;
36
- depth: number;
37
- center: THREE.Vector3;
38
- };
39
- static newBound(positive: boolean): THREE.Vector3;
40
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
41
- /** {@link Disposable.dispose} */
42
- dispose(): void;
43
- get(): THREE.Box3;
44
- getSphere(): THREE.Sphere;
45
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
46
- reset(): void;
47
- add(group: FragmentsGroup): void;
48
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
49
- private static getFragmentBounds;
50
- }
51
- import * as THREE from "three";
52
- import * as FRAGS from "@thatopen/fragments";
53
- import { Disposable, Component, Event, Components } from "../../core";
54
- export interface Classification {
55
- [system: string]: {
56
- [className: string]: FRAGS.FragmentIdMap;
57
- };
58
- }
59
- export declare class Classifier extends Component implements Disposable {
60
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
61
- /** {@link Component.enabled} */
62
- enabled: boolean;
63
- list: Classification;
64
- /** {@link Disposable.onDisposed} */
65
- readonly onDisposed: Event<unknown>;
66
- constructor(components: Components);
67
- private onFragmentsDisposed;
68
- dispose(): void;
69
- remove(guid: string): void;
70
- find(filter?: {
71
- [name: string]: string[];
72
- }): FRAGS.FragmentIdMap;
73
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
74
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
75
- byEntity(group: FRAGS.FragmentsGroup): void;
76
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
77
- bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
78
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
79
- resetColor(items: FRAGS.FragmentIdMap): void;
80
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
81
- }
82
- import * as FRAGS from "@thatopen/fragments";
83
- import { Components, Component } from "../../core";
84
- export declare class Hider extends Component {
85
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
86
- enabled: boolean;
87
- constructor(components: Components);
88
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
89
- isolate(items: FRAGS.FragmentIdMap): void;
90
- private updateCulledVisibility;
91
- }
92
- import * as WEBIFC from "web-ifc";
93
- import { Components, Disposable, Event, Component } from "../../core";
94
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
95
- export declare class IfcGeometryTiler extends Component implements Disposable {
96
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
97
- onGeometryStreamed: Event<{
98
- buffer: Uint8Array;
99
- data: StreamedGeometries;
100
- }>;
101
- onAssetStreamed: Event<StreamedAsset[]>;
102
- onProgress: Event<number>;
103
- onIfcLoaded: Event<Uint8Array>;
10
+ export declare class Components implements Disposable {
11
+ static readonly release = "1.4.21";
104
12
  /** {@link Disposable.onDisposed} */
105
- readonly onDisposed: Event<unknown>;
106
- settings: IfcStreamingSettings;
13
+ readonly onDisposed: Event<void>;
14
+ /** The list of components created in this app. */
15
+ readonly list: Map<string, Component>;
16
+ /** If disabled, the animation loop will be stopped. */
107
17
  enabled: boolean;
108
- webIfc: WEBIFC.IfcAPI;
109
- private _spatialTree;
110
- private _metaData;
111
- private _visitedGeometries;
112
- private _streamSerializer;
113
- private _geometries;
114
- private _geometryCount;
115
- private _civil;
116
- private _groupSerializer;
117
- private _assets;
118
- private _meshesWithHoles;
119
- constructor(components: Components);
18
+ private _clock;
19
+ add(uuid: string, instance: Component): void;
20
+ /**
21
+ * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
22
+ * doesn't exist, it will instance it automatically.
23
+ *
24
+ * @param Component - The component to get or create.
25
+ */
26
+ get<U extends Component>(Component: new (components: Components) => U): U;
27
+ constructor();
28
+ /**
29
+ * Initializes the library. It should be called at the start of the app after
30
+ * initializing the scene, the renderer and the
31
+ * camera. Additionally, if any component that need a raycaster is
32
+ * used, the {@link raycaster} will need to be initialized.
33
+ */
34
+ init(): void;
35
+ /**
36
+ * Disposes the memory of all the components and tools of this instance of
37
+ * the library. A memory leak will be created if:
38
+ *
39
+ * - An instance of the library ends up out of scope and this function isn't
40
+ * called. This is especially relevant in Single Page Applications (React,
41
+ * Angular, Vue, etc).
42
+ *
43
+ * - Any of the objects of this instance (meshes, geometries, etc) is
44
+ * referenced by a reference type (object or array).
45
+ *
46
+ * You can learn more about how Three.js handles memory leaks
47
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
48
+ *
49
+ */
120
50
  dispose(): void;
121
- streamFromBuffer(data: Uint8Array): Promise<void>;
122
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
123
- private readIfcFile;
124
- private streamIfcFile;
125
- private streamAllGeometries;
126
- private cleanUp;
127
- private getMesh;
128
- private getGeometry;
129
- private streamAssets;
130
- private streamGeometries;
51
+ private update;
52
+ private static setupBVH;
131
53
  }
132
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
133
54
  import * as THREE from "three";
134
- import * as FRAGS from "@thatopen/fragments";
135
- import { Component, Components, Event, Disposable } from "../../core";
136
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
55
+ import { Components } from "../Components";
56
+ import { Component } from "../Types";
137
57
  /**
138
- * Object that can efficiently load binary files that contain
139
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
58
+ * A tool to safely remove meshes and geometries from memory to
59
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
140
60
  */
141
- export declare class FragmentsManager extends Component implements Disposable {
142
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
143
- /** {@link Disposable.onDisposed} */
144
- readonly onDisposed: Event<unknown>;
145
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
146
- readonly onFragmentsDisposed: Event<{
147
- groupID: string;
148
- fragmentIDs: string[];
149
- }>;
150
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
151
- readonly list: Map<string, Fragment>;
152
- readonly groups: Map<string, FragmentsGroup>;
61
+ export declare class Disposer extends Component {
62
+ private _disposedComponents;
153
63
  /** {@link Component.enabled} */
154
64
  enabled: boolean;
155
- baseCoordinationModel: string;
156
- private _loader;
157
- /** The list of meshes of the created fragments. */
158
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
65
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
159
66
  constructor(components: Components);
160
- /** {@link Disposable.dispose} */
161
- dispose(): void;
162
- disposeGroup(group: FragmentsGroup): void;
163
67
  /**
164
- * Loads a binar file that contain fragment geometry.
165
- * @param data - The binary data to load.
166
- * @param config - Optional configuration for loading.
167
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
168
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
169
- * @returns The loaded FragmentsGroup.
68
+ * {@link Component.uuid}.
69
+ * @return the list of UUIDs of deleted components.
170
70
  */
171
- load(data: Uint8Array, config?: Partial<{
172
- coordinate: boolean;
173
- name: string;
174
- properties: FRAGS.IfcProperties;
175
- relationsMap: RelationsMap;
176
- }>): FragmentsGroup;
71
+ get(): Set<string>;
177
72
  /**
178
- * Export the specified fragments.
179
- * @param group - the fragments group to be exported.
180
- * @returns the exported data as binary buffer.
73
+ * Removes a mesh, its geometry and its materials from memory. If you are
74
+ * using any of these in other parts of the application, make sure that you
75
+ * remove them from the mesh before disposing it.
76
+ *
77
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
78
+ * to remove.
79
+ *
80
+ * @param materials - whether to dispose the materials of the mesh.
81
+ *
82
+ * @param recursive - whether to recursively dispose the children of the mesh.
181
83
  */
182
- export(group: FragmentsGroup): Uint8Array;
183
- coordinate(models?: FragmentsGroup[]): void;
84
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
85
+ /**
86
+ * Disposes a geometry from memory.
87
+ *
88
+ * @param geometry - the
89
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
90
+ * to remove.
91
+ */
92
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
93
+ private disposeGeometryAndMaterials;
94
+ private disposeChildren;
95
+ private static disposeMaterial;
184
96
  }
185
- import * as WEBIFC from "web-ifc";
186
- import * as FRAGS from "@thatopen/fragments";
187
- import { IfcFragmentSettings } from "./src";
188
- import { Component, Components, Event, Disposable } from "../../core";
189
- export declare class IfcLoader extends Component implements Disposable {
190
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
191
- readonly onIfcStartedLoading: Event<void>;
192
- readonly onSetup: Event<void>;
193
- /** {@link Disposable.onDisposed} */
194
- readonly onDisposed: Event<string>;
195
- settings: IfcFragmentSettings;
97
+ import { Component, Disposable, World, Event } from "../Types";
98
+ import { SimpleRaycaster } from "./src";
99
+ import { Components } from "../Components";
100
+ export declare class Raycasters extends Component implements Disposable {
101
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
196
102
  enabled: boolean;
197
- webIfc: WEBIFC.IfcAPI;
198
- private _material;
199
- private _spatialTree;
200
- private _metaData;
201
- private _fragmentInstances;
202
- private _civil;
203
- private _visitedFragments;
204
- private _materialT;
103
+ list: Map<string, SimpleRaycaster>;
104
+ onDisposed: Event<unknown>;
205
105
  constructor(components: Components);
106
+ get(world: World): SimpleRaycaster;
107
+ delete(world: World): void;
206
108
  dispose(): void;
207
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
208
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
209
- readIfcFile(data: Uint8Array): Promise<number>;
210
- private getAllGeometries;
211
- cleanUp(): void;
212
- private getMesh;
213
- private getGeometry;
214
- private autoSetWasm;
215
- }
216
- import * as WEBIFC from "web-ifc";
217
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
218
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
219
- export declare class IfcPropertiesTiler extends Component implements Disposable {
220
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
221
- onPropertiesStreamed: AsyncEvent<{
222
- type: number;
223
- data: {
224
- [id: number]: any;
225
- };
226
- }>;
227
- onProgress: AsyncEvent<number>;
228
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
229
- /** {@link Disposable.onDisposed} */
230
- readonly onDisposed: Event<string>;
231
- enabled: boolean;
232
- settings: PropertiesStreamingSettings;
233
- webIfc: WEBIFC.IfcAPI;
234
- dispose(): Promise<void>;
235
- streamFromBuffer(data: Uint8Array): Promise<void>;
236
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
237
- private readIfcFile;
238
- private streamIfcFile;
239
- private streamAllProperties;
240
- private cleanUp;
241
109
  }
242
- import * as WEBIFC from "web-ifc";
243
- import * as FRAG from "@thatopen/fragments";
244
- import { Component, Components } from "../../core";
245
- /**
246
- * Object to export all the properties from an IFC to a JS object.
247
- */
248
- export declare class IfcJsonExporter extends Component {
249
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
110
+ import { Component, Disposable, World, Event } from "../Types";
111
+ import { GridConfig, SimpleGrid } from "./src";
112
+ import { Components } from "../Components";
113
+ export declare class Grids extends Component implements Disposable {
114
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
115
+ list: Map<string, SimpleGrid>;
116
+ readonly onDisposed: Event<unknown>;
117
+ config: Required<GridConfig>;
250
118
  /** {@link Component.enabled} */
251
119
  enabled: boolean;
252
120
  constructor(components: Components);
121
+ create(world: World): SimpleGrid;
122
+ delete(world: World): void;
123
+ dispose(): void;
124
+ }
125
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
126
+ import { Components } from "../Components";
127
+ import { SimpleWorld } from "./src";
128
+ export declare class Worlds extends Component implements Updateable, Disposable {
129
+ /**
130
+ * A unique identifier for the component.
131
+ * This UUID is used to register the component within the Components system.
132
+ */
133
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
134
+ /**
135
+ * Event triggered after the update process of all worlds.
136
+ * Subscribers can listen to this event to perform actions post-update.
137
+ */
138
+ readonly onAfterUpdate: Event<unknown>;
253
139
  /**
254
- * Exports all the properties of an IFC into an array of JS objects.
255
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
256
- * @param modelID ID of the IFC model whose properties to extract.
257
- * @param indirect whether to get the indirect relationships as well.
258
- * @param recursiveSpatial whether to get the properties of spatial items recursively
259
- * to make the location data available (e.g. absolute position of building).
140
+ * Event triggered before the update process of all worlds.
141
+ * Subscribers can listen to this event to perform actions pre-update.
142
+ */
143
+ readonly onBeforeUpdate: Event<unknown>;
144
+ /**
145
+ * Event triggered when the Worlds component is disposed.
146
+ * Subscribers can listen to this event to perform cleanup actions.
147
+ */
148
+ readonly onDisposed: Event<unknown>;
149
+ readonly onWorldCreated: Event<World>;
150
+ readonly onWorldDeleted: Event<string>;
151
+ /**
152
+ * A collection of worlds managed by this component.
153
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
154
+ */
155
+ list: Map<string, World>;
156
+ /**
157
+ * A flag indicating whether the Worlds component is enabled.
158
+ * If false, the update process will be skipped.
260
159
  */
261
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
262
- }
263
- import * as WEBIFC from "web-ifc";
264
- import { FragmentsGroup } from "@thatopen/fragments";
265
- import { Component, Disposable, Event, Components } from "../../core";
266
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
267
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
268
- type NumericPropTypes = "IfcInteger" | "IfcReal";
269
- interface ChangeMap {
270
- [modelID: string]: Set<number>;
271
- }
272
- interface AttributeListener {
273
- [modelID: string]: {
274
- [expressID: number]: {
275
- [attributeName: string]: Event<String | Boolean | Number>;
276
- };
277
- };
278
- }
279
- export declare class IfcPropertiesManager extends Component implements Disposable {
280
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
281
- /** {@link Disposable.onDisposed} */
282
- readonly onDisposed: Event<string>;
283
- readonly onRequestFile: Event<unknown>;
284
- ifcToExport: ArrayBuffer | null;
285
- readonly onElementToPset: Event<{
286
- model: FragmentsGroup;
287
- psetID: number;
288
- elementID: number;
289
- }>;
290
- readonly onPropToPset: Event<{
291
- model: FragmentsGroup;
292
- psetID: number;
293
- propID: number;
294
- }>;
295
- readonly onPsetRemoved: Event<{
296
- model: FragmentsGroup;
297
- psetID: number;
298
- }>;
299
- readonly onDataChanged: Event<{
300
- model: FragmentsGroup;
301
- expressID: number;
302
- }>;
303
- wasm: {
304
- path: string;
305
- absolute: boolean;
306
- };
307
160
  enabled: boolean;
308
- attributeListeners: AttributeListener;
309
- selectedModel?: FragmentsGroup;
310
- changeMap: ChangeMap;
311
161
  constructor(components: Components);
162
+ /**
163
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
164
+ *
165
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
166
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
167
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
168
+ *
169
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
170
+ */
171
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
172
+ delete(world: World): void;
312
173
  dispose(): void;
313
- private increaseMaxID;
314
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
315
- private newGUID;
316
- private getOwnerHistory;
317
- private registerChange;
318
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
319
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
320
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
321
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
322
- }>;
323
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
324
- private newSingleProperty;
325
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
326
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
327
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
328
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
329
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
330
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
331
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
332
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
174
+ update(delta?: number): void | Promise<void>;
333
175
  }
334
- export {};
335
- import * as WEBIFC from "web-ifc";
336
- import { FragmentsGroup } from "@thatopen/fragments";
337
- import { Disposable, Event, Component, Components } from "../../core";
338
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
176
+ import * as THREE from "three";
177
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
178
+ import { SimplePlane } from "./src";
179
+ import { Components } from "../Components";
339
180
  /**
340
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
341
- * 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.
181
+ * A lightweight component to easily create and handle
182
+ * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
183
+ *
184
+ * @param components - the instance of {@link Components} used.
185
+ * E.g. {@link SimplePlane}.
342
186
  */
343
- export declare class IfcRelationsIndexer extends Component implements Disposable {
344
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
187
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
188
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
189
+ /** {@link Createable.onAfterCreate} */
190
+ readonly onAfterCreate: Event<SimplePlane>;
191
+ /** {@link Createable.onAfterDelete} */
192
+ readonly onAfterDelete: Event<SimplePlane>;
193
+ /** Event that fires when the user starts dragging a clipping plane. */
194
+ readonly onBeforeDrag: Event<void>;
195
+ /** Event that fires when the user stops dragging a clipping plane. */
196
+ readonly onAfterDrag: Event<void>;
197
+ readonly onBeforeCreate: Event<unknown>;
198
+ readonly onBeforeCancel: Event<unknown>;
199
+ readonly onAfterCancel: Event<unknown>;
200
+ readonly onBeforeDelete: Event<unknown>;
345
201
  /** {@link Disposable.onDisposed} */
346
202
  readonly onDisposed: Event<string>;
347
- enabled: boolean;
348
- readonly onRelationsIndexed: Event<{
349
- modelID: string;
350
- relationsMap: RelationsMap;
351
- }>;
352
- private _relToAttributesMap;
353
- private _inverseAttributes;
354
- private _ifcRels;
355
203
  /**
356
- * Holds the relationship mappings for each model processed by the indexer.
357
- * The structure is a map where each key is a model's UUID, and the value is another map.
358
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
359
- * representing a specific relation type, and the value is an array of expressIDs of entities
360
- * that are related through that relation type. This structure allows for efficient querying
361
- * of entity relationships within a model.
204
+ * Whether to force the clipping plane to be orthogonal in the Y direction
205
+ * (up). This is desirable when clipping a building horizontally and a
206
+ * clipping plane is created in its roof, which might have a slight
207
+ * slope for draining purposes.
362
208
  */
363
- readonly relationMaps: ModelsRelationMap;
209
+ orthogonalY: boolean;
210
+ /**
211
+ * The tolerance that determines whether an almost-horizontal clipping plane
212
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
213
+ * has to be 'true' for this to apply.
214
+ */
215
+ toleranceOrthogonalY: number;
216
+ Type: new (...args: any) => SimplePlane;
217
+ list: SimplePlane[];
218
+ /** The material used in all the clipping planes. */
219
+ private _material;
220
+ private _size;
221
+ private _enabled;
222
+ private _visible;
223
+ /** {@link Component.enabled} */
224
+ get enabled(): boolean;
225
+ /** {@link Component.enabled} */
226
+ set enabled(state: boolean);
227
+ /** {@link Hideable.visible } */
228
+ get visible(): boolean;
229
+ /** {@link Hideable.visible } */
230
+ set visible(state: boolean);
231
+ /** The material of the clipping plane representation. */
232
+ get material(): THREE.MeshBasicMaterial;
233
+ /** The material of the clipping plane representation. */
234
+ set material(material: THREE.MeshBasicMaterial);
235
+ /** The size of the geometric representation of the clippings planes. */
236
+ get size(): number;
237
+ /** The size of the geometric representation of the clippings planes. */
238
+ set size(size: number);
364
239
  constructor(components: Components);
365
- private onFragmentsDisposed;
240
+ /** {@link Disposable.dispose} */
241
+ dispose(): void;
242
+ /** {@link Createable.create} */
243
+ create(world: World): void;
366
244
  /**
367
- * Adds a relation map to the model's relations map.
368
- *
369
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
370
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
245
+ * Creates a plane in a certain place and with a certain orientation,
246
+ * without the need of the mouse.
371
247
  *
372
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
248
+ * @param world - the world where this plane should be created.
249
+ * @param normal - the orientation of the clipping plane.
250
+ * @param point - the position of the clipping plane.
251
+ * navigation.
373
252
  */
374
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
253
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
375
254
  /**
376
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
377
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
378
- * and maps them in a structured way to facilitate quick access to related entities.
379
- *
380
- * The process involves querying the model for each relation type associated with the inverse attributes
381
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
382
- * and contains a nested map where each key is an entity's expressID and its value is another map.
383
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
384
- * of entities that are related through that attribute.
255
+ * {@link Createable.delete}
385
256
  *
386
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
387
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
388
- * representation of the relations indexed by entity expressIDs and relation types.
389
- * @throws An error if the model does not have properties loaded.
257
+ * @param world - the world where the plane to delete is.
258
+ * @param plane - the plane to delete. If undefined, the first plane
259
+ * found under the cursor will be deleted.
390
260
  */
391
- process(model: FragmentsGroup): Promise<RelationsMap>;
261
+ delete(world: World, plane?: SimplePlane): void;
262
+ /** Deletes all the existing clipping planes. */
263
+ deleteAll(): void;
264
+ private deletePlane;
265
+ private pickPlane;
266
+ private getAllPlaneMeshes;
267
+ private createPlaneFromIntersection;
268
+ private getWorldNormal;
269
+ private normalizePlaneDirectionY;
270
+ private newPlane;
271
+ private updateMaterialsAndPlanes;
272
+ private _onStartDragging;
273
+ private _onEndDragging;
274
+ }
275
+ import { Components } from "../Components";
276
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
277
+ import { Component, Event, Disposable, World } from "../Types";
278
+ /**
279
+ * A tool to handle big scenes efficiently by automatically hiding the objects
280
+ * that are not visible to the camera.
281
+ */
282
+ export declare class Cullers extends Component implements Disposable {
392
283
  /**
393
- * Processes a given model from a WebIfc API to index its IFC entities relations.
394
- *
395
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
396
- * @param modelID - The unique identifier of the model within the WebIfc API.
397
- * @returns A promise that resolves to the relations map for the processed model.
398
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
284
+ * A unique identifier for the Cullers component.
399
285
  */
400
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
286
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
401
287
  /**
402
- * Retrieves the relations of a specific entity within a model based on the given relation name.
403
- * This method searches the indexed relation maps for the specified model and entity,
404
- * returning the IDs of related entities if a match is found.
405
- *
406
- * @param model The 'FragmentsGroup' model containing the entity.
407
- * @param expressID The unique identifier of the entity within the model.
408
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
409
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
410
- * or the specified relation name is not indexed.
288
+ * Indicates whether the Cullers component is enabled.
411
289
  */
412
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
290
+ private _enabled;
413
291
  /**
414
- * Serializes the relations of a given relation map into a JSON string.
415
- * 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,
416
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
417
- * The resulting object is then serialized into a JSON string.
418
- *
419
- * @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.
420
- * @returns A JSON string representing the serialized relations of the given relation map.
292
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
421
293
  */
422
- serializeRelations(relationMap: RelationsMap): string;
294
+ list: Map<string, MeshCullerRenderer>;
423
295
  /**
424
- * Serializes the relations of a specific model into a JSON string.
425
- * This method iterates through the relations indexed for the given model,
426
- * organizing them into a structured object where each key is an expressID of an entity,
427
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
428
- * The resulting object is then serialized into a JSON string.
429
- *
430
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
431
- * @returns A JSON string representing the serialized relations of the specified model.
432
- * If the model has no indexed relations, 'null' is returned.
296
+ * An event that is triggered when the Cullers component is disposed.
433
297
  */
434
- serializeModelRelations(model: FragmentsGroup): string | null;
298
+ readonly onDisposed: Event<unknown>;
435
299
  /**
436
- * Serializes all relations of every model processed by the indexer into a JSON string.
437
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
438
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
439
- * and its value is another object mapping entity expressIDs to their related entities, categorized
440
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
300
+ * Gets the enabled state of the Cullers component.
441
301
  *
442
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
443
- * If no relations have been indexed, an empty object is returned as a JSON string.
302
+ * @returns The current enabled state.
444
303
  */
445
- serializeAllRelations(): string;
304
+ get enabled(): boolean;
446
305
  /**
447
- * Converts a JSON string representing relations between entities into a structured map.
448
- * This method parses the JSON string to reconstruct the relations map that indexes
449
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
450
- * and the values are maps where each key is a relation type ID and its value is an array
451
- * of express IDs of entities related through that relation type.
306
+ * Sets the enabled state of the Cullers component.
307
+ * Also sets the enabled state of all MeshCullerRenderer instances.
452
308
  *
453
- * @param json The JSON string to be parsed into the relations map.
454
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
455
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
456
- * is an array of express IDs (as numbers) of entities related through that relation type.
309
+ * @param value - The new enabled state.
457
310
  */
458
- getRelationsMapFromJSON(json: string): RelationsMap;
311
+ set enabled(value: boolean);
312
+ constructor(components: Components);
459
313
  /**
460
- * Disposes the component, cleaning up resources and detaching event listeners.
461
- * This ensures that the component is properly cleaned up and does not leave behind any
462
- * references that could prevent garbage collection.
463
- */
314
+ * Creates a new MeshCullerRenderer for the given world.
315
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
316
+ *
317
+ * @param world - The world for which to create the MeshCullerRenderer.
318
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
319
+ *
320
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
321
+ */
322
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
323
+ delete(world: World): void;
324
+ /** {@link Disposable.dispose} */
464
325
  dispose(): void;
465
326
  }
466
- export type { InverseAttribute, RelationsMap } from "./src/types";
467
- import { Component, Disposable, Event } from "../Types";
327
+ import { MiniMap } from "./src";
328
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
329
+ import { Components } from "../Components";
330
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
331
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
332
+ readonly onAfterUpdate: Event<unknown>;
333
+ readonly onBeforeUpdate: Event<unknown>;
334
+ readonly onDisposed: Event<unknown>;
335
+ enabled: boolean;
336
+ list: Map<string, MiniMap>;
337
+ constructor(components: Components);
338
+ create(world: World): MiniMap;
339
+ delete(id: string): void;
340
+ dispose(): void;
341
+ update(): void;
342
+ }
343
+ import * as THREE from "three";
344
+ import { Components } from "../Components";
345
+ import { SimpleCamera } from "..";
346
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
468
347
  /**
469
- * The entry point of the Components library.
470
- * It can:
471
- * - Create and access all the components of the library.
472
- * - Update all the updatable components automatically.
473
- * - Dispose all the components, preventing memory leaks.
348
+ * A flexible camera that uses
349
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
350
+ * easily control the camera in 2D and 3D. It supports multiple navigation
351
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
474
352
  */
475
- export declare class Components implements Disposable {
476
- static readonly release = "1.4.21";
477
- /** {@link Disposable.onDisposed} */
478
- readonly onDisposed: Event<void>;
479
- /** The list of components created in this app. */
480
- readonly list: Map<string, Component>;
481
- /** If disabled, the animation loop will be stopped. */
482
- enabled: boolean;
483
- private _clock;
484
- add(uuid: string, instance: Component): void;
353
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
485
354
  /**
486
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
487
- * doesn't exist, it will instance it automatically.
488
- *
489
- * @param Component - The component to get or create.
355
+ * The current {@link NavigationMode}.
490
356
  */
491
- get<U extends Component>(Component: new (components: Components) => U): U;
492
- constructor();
357
+ _mode: NavigationMode | null;
358
+ readonly projection: ProjectionManager;
359
+ readonly threeOrtho: THREE.OrthographicCamera;
360
+ readonly threePersp: THREE.PerspectiveCamera;
361
+ protected readonly _userInputButtons: any;
362
+ protected readonly _frustumSize = 50;
363
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
364
+ private previousSize;
365
+ get mode(): NavigationMode;
366
+ constructor(components: Components);
367
+ /** {@link Disposable.dispose} */
368
+ dispose(): void;
493
369
  /**
494
- * Initializes the library. It should be called at the start of the app after
495
- * initializing the scene, the renderer and the
496
- * camera. Additionally, if any component that need a raycaster is
497
- * used, the {@link raycaster} will need to be initialized.
370
+ * Sets a new {@link NavigationMode} and disables the previous one.
371
+ *
372
+ * @param mode - The {@link NavigationMode} to set.
498
373
  */
499
- init(): void;
374
+ set(mode: NavModeID): void;
500
375
  /**
501
- * Disposes the memory of all the components and tools of this instance of
502
- * the library. A memory leak will be created if:
503
- *
504
- * - An instance of the library ends up out of scope and this function isn't
505
- * called. This is especially relevant in Single Page Applications (React,
506
- * Angular, Vue, etc).
507
- *
508
- * - Any of the objects of this instance (meshes, geometries, etc) is
509
- * referenced by a reference type (object or array).
376
+ * Make the camera view fit all the specified meshes.
510
377
  *
511
- * You can learn more about how Three.js handles memory leaks
512
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
378
+ * @param meshes the meshes to fit. If it is not defined, it will
379
+ * evaluate {@link Components.meshes}.
380
+ * @param offset the distance to the fit object
381
+ */
382
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
383
+ /**
384
+ * Allows or prevents all user input.
513
385
  *
386
+ * @param active - whether to enable or disable user inputs.
514
387
  */
515
- dispose(): void;
516
- private update;
517
- private static setupBVH;
388
+ setUserInput(active: boolean): void;
389
+ private disableUserInput;
390
+ private enableUserInput;
391
+ private newOrthoCamera;
392
+ private setOrthoPerspCameraAspect;
518
393
  }
519
394
  import * as THREE from "three";
520
395
  import { Component, Components } from "../../core";
@@ -541,113 +416,219 @@ export declare class MeasurementUtils extends Component {
541
416
  private round;
542
417
  }
543
418
  import * as THREE from "three";
544
- import { Components } from "../Components";
545
- import { Component } from "../Types";
419
+ import * as FRAGS from "@thatopen/fragments";
420
+ import { FragmentsGroup } from "@thatopen/fragments";
421
+ import { Component, Components, Disposable, Event } from "../../core";
422
+ /**
423
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
424
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
425
+ */
426
+ export declare class BoundingBoxer extends Component implements Disposable {
427
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
428
+ /** {@link Component.enabled} */
429
+ enabled: boolean;
430
+ /** {@link Disposable.onDisposed} */
431
+ readonly onDisposed: Event<unknown>;
432
+ private _absoluteMin;
433
+ private _absoluteMax;
434
+ private _meshes;
435
+ constructor(components: Components);
436
+ static getDimensions(bbox: THREE.Box3): {
437
+ width: number;
438
+ height: number;
439
+ depth: number;
440
+ center: THREE.Vector3;
441
+ };
442
+ static newBound(positive: boolean): THREE.Vector3;
443
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
444
+ /** {@link Disposable.dispose} */
445
+ dispose(): void;
446
+ get(): THREE.Box3;
447
+ getSphere(): THREE.Sphere;
448
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
449
+ reset(): void;
450
+ add(group: FragmentsGroup): void;
451
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
452
+ private static getFragmentBounds;
453
+ }
454
+ import * as THREE from "three";
455
+ import * as FRAGS from "@thatopen/fragments";
456
+ import { Disposable, Component, Event, Components } from "../../core";
457
+ export interface Classification {
458
+ [system: string]: {
459
+ [className: string]: FRAGS.FragmentIdMap;
460
+ };
461
+ }
462
+ export declare class Classifier extends Component implements Disposable {
463
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
464
+ /** {@link Component.enabled} */
465
+ enabled: boolean;
466
+ list: Classification;
467
+ /** {@link Disposable.onDisposed} */
468
+ readonly onDisposed: Event<unknown>;
469
+ constructor(components: Components);
470
+ private onFragmentsDisposed;
471
+ dispose(): void;
472
+ remove(guid: string): void;
473
+ find(filter?: {
474
+ [name: string]: string[];
475
+ }): FRAGS.FragmentIdMap;
476
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
477
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
478
+ byEntity(group: FRAGS.FragmentsGroup): void;
479
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
480
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
481
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
482
+ resetColor(items: FRAGS.FragmentIdMap): void;
483
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
484
+ }
485
+ import * as FRAGS from "@thatopen/fragments";
486
+ import { Components, Component } from "../../core";
487
+ export declare class Hider extends Component {
488
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
489
+ enabled: boolean;
490
+ constructor(components: Components);
491
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
492
+ isolate(items: FRAGS.FragmentIdMap): void;
493
+ private updateCulledVisibility;
494
+ }
495
+ import { Component, Disposable, Event, Components } from "../../core";
496
+ export declare class Exploder extends Component implements Disposable {
497
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
498
+ enabled: boolean;
499
+ height: number;
500
+ groupName: string;
501
+ /** {@link Disposable.onDisposed} */
502
+ readonly onDisposed: Event<unknown>;
503
+ list: Set<string>;
504
+ constructor(components: Components);
505
+ dispose(): void;
506
+ set(active: boolean): void;
507
+ }
508
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
509
+ import * as THREE from "three";
510
+ import * as FRAGS from "@thatopen/fragments";
511
+ import { Component, Components, Event, Disposable } from "../../core";
512
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
546
513
  /**
547
- * A tool to safely remove meshes and geometries from memory to
548
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
514
+ * Object that can efficiently load binary files that contain
515
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
549
516
  */
550
- export declare class Disposer extends Component {
551
- private _disposedComponents;
517
+ export declare class FragmentsManager extends Component implements Disposable {
518
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
519
+ /** {@link Disposable.onDisposed} */
520
+ readonly onDisposed: Event<unknown>;
521
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
522
+ readonly onFragmentsDisposed: Event<{
523
+ groupID: string;
524
+ fragmentIDs: string[];
525
+ }>;
526
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
527
+ readonly list: Map<string, Fragment>;
528
+ readonly groups: Map<string, FragmentsGroup>;
552
529
  /** {@link Component.enabled} */
553
530
  enabled: boolean;
554
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
531
+ baseCoordinationModel: string;
532
+ private _loader;
533
+ /** The list of meshes of the created fragments. */
534
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
555
535
  constructor(components: Components);
536
+ /** {@link Disposable.dispose} */
537
+ dispose(): void;
538
+ disposeGroup(group: FragmentsGroup): void;
556
539
  /**
557
- * {@link Component.uuid}.
558
- * @return the list of UUIDs of deleted components.
559
- */
560
- get(): Set<string>;
561
- /**
562
- * Removes a mesh, its geometry and its materials from memory. If you are
563
- * using any of these in other parts of the application, make sure that you
564
- * remove them from the mesh before disposing it.
565
- *
566
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
567
- * to remove.
568
- *
569
- * @param materials - whether to dispose the materials of the mesh.
570
- *
571
- * @param recursive - whether to recursively dispose the children of the mesh.
540
+ * Loads a binar file that contain fragment geometry.
541
+ * @param data - The binary data to load.
542
+ * @param config - Optional configuration for loading.
543
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
544
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
545
+ * @returns The loaded FragmentsGroup.
572
546
  */
573
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
547
+ load(data: Uint8Array, config?: Partial<{
548
+ coordinate: boolean;
549
+ name: string;
550
+ properties: FRAGS.IfcProperties;
551
+ relationsMap: RelationsMap;
552
+ }>): FragmentsGroup;
574
553
  /**
575
- * Disposes a geometry from memory.
576
- *
577
- * @param geometry - the
578
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
579
- * to remove.
554
+ * Export the specified fragments.
555
+ * @param group - the fragments group to be exported.
556
+ * @returns the exported data as binary buffer.
580
557
  */
581
- disposeGeometry(geometry: THREE.BufferGeometry): void;
582
- private disposeGeometryAndMaterials;
583
- private disposeChildren;
584
- private static disposeMaterial;
558
+ export(group: FragmentsGroup): Uint8Array;
559
+ coordinate(models?: FragmentsGroup[]): void;
585
560
  }
586
- import { Component, Disposable, World, Event } from "../Types";
587
- import { SimpleRaycaster } from "./src";
588
- import { Components } from "../Components";
589
- export declare class Raycasters extends Component implements Disposable {
590
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
561
+ import * as WEBIFC from "web-ifc";
562
+ import * as FRAGS from "@thatopen/fragments";
563
+ import { IfcFragmentSettings } from "./src";
564
+ import { Component, Components, Event, Disposable } from "../../core";
565
+ export declare class IfcLoader extends Component implements Disposable {
566
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
567
+ readonly onIfcStartedLoading: Event<void>;
568
+ readonly onSetup: Event<void>;
569
+ /** {@link Disposable.onDisposed} */
570
+ readonly onDisposed: Event<string>;
571
+ settings: IfcFragmentSettings;
591
572
  enabled: boolean;
592
- list: Map<string, SimpleRaycaster>;
593
- onDisposed: Event<unknown>;
573
+ webIfc: WEBIFC.IfcAPI;
574
+ private _material;
575
+ private _spatialTree;
576
+ private _metaData;
577
+ private _fragmentInstances;
578
+ private _civil;
579
+ private _visitedFragments;
580
+ private _materialT;
594
581
  constructor(components: Components);
595
- get(world: World): SimpleRaycaster;
596
- delete(world: World): void;
597
582
  dispose(): void;
583
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
584
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
585
+ readIfcFile(data: Uint8Array): Promise<number>;
586
+ private getAllGeometries;
587
+ cleanUp(): void;
588
+ private getMesh;
589
+ private getGeometry;
590
+ private autoSetWasm;
598
591
  }
599
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
600
- import { Components } from "../Components";
601
- import { SimpleWorld } from "./src";
602
- export declare class Worlds extends Component implements Updateable, Disposable {
603
- /**
604
- * A unique identifier for the component.
605
- * This UUID is used to register the component within the Components system.
606
- */
607
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
608
- /**
609
- * Event triggered after the update process of all worlds.
610
- * Subscribers can listen to this event to perform actions post-update.
611
- */
612
- readonly onAfterUpdate: Event<unknown>;
613
- /**
614
- * Event triggered before the update process of all worlds.
615
- * Subscribers can listen to this event to perform actions pre-update.
616
- */
617
- readonly onBeforeUpdate: Event<unknown>;
618
- /**
619
- * Event triggered when the Worlds component is disposed.
620
- * Subscribers can listen to this event to perform cleanup actions.
621
- */
592
+ import * as WEBIFC from "web-ifc";
593
+ import { Components, Disposable, Event, Component } from "../../core";
594
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
595
+ export declare class IfcGeometryTiler extends Component implements Disposable {
596
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
597
+ onGeometryStreamed: Event<{
598
+ buffer: Uint8Array;
599
+ data: StreamedGeometries;
600
+ }>;
601
+ onAssetStreamed: Event<StreamedAsset[]>;
602
+ onProgress: Event<number>;
603
+ onIfcLoaded: Event<Uint8Array>;
604
+ /** {@link Disposable.onDisposed} */
622
605
  readonly onDisposed: Event<unknown>;
623
- readonly onWorldCreated: Event<World>;
624
- readonly onWorldDeleted: Event<string>;
625
- /**
626
- * A collection of worlds managed by this component.
627
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
628
- */
629
- list: Map<string, World>;
630
- /**
631
- * A flag indicating whether the Worlds component is enabled.
632
- * If false, the update process will be skipped.
633
- */
606
+ settings: IfcStreamingSettings;
634
607
  enabled: boolean;
608
+ webIfc: WEBIFC.IfcAPI;
609
+ private _spatialTree;
610
+ private _metaData;
611
+ private _visitedGeometries;
612
+ private _streamSerializer;
613
+ private _geometries;
614
+ private _geometryCount;
615
+ private _civil;
616
+ private _groupSerializer;
617
+ private _assets;
618
+ private _meshesWithHoles;
635
619
  constructor(components: Components);
636
- /**
637
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
638
- *
639
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
640
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
641
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
642
- *
643
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
644
- */
645
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
646
- delete(world: World): void;
647
620
  dispose(): void;
648
- update(delta?: number): void | Promise<void>;
621
+ streamFromBuffer(data: Uint8Array): Promise<void>;
622
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
623
+ private readIfcFile;
624
+ private streamIfcFile;
625
+ private streamAllGeometries;
626
+ private cleanUp;
627
+ private getMesh;
628
+ private getGeometry;
629
+ private streamAssets;
630
+ private streamGeometries;
649
631
  }
650
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
651
632
  import * as THREE from "three";
652
633
  export declare function obbFromPoints(vertices: ArrayLike<number>): {
653
634
  center: THREE.Vector3;
@@ -655,6 +636,7 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
655
636
  rotation: THREE.Matrix3;
656
637
  transformation: THREE.Matrix4;
657
638
  };
639
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
658
640
  import * as THREE from "three";
659
641
  export declare class MaterialsUtils {
660
642
  static isTransparent(material: THREE.Material): boolean;
@@ -665,28 +647,6 @@ export declare class UUID {
665
647
  static create(): string;
666
648
  static validate(uuid: string): void;
667
649
  }
668
- import { Component, Disposable, World, Event } from "../Types";
669
- import { GridConfig, SimpleGrid } from "./src";
670
- import { Components } from "../Components";
671
- export declare class Grids extends Component implements Disposable {
672
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
673
- list: Map<string, SimpleGrid>;
674
- readonly onDisposed: Event<unknown>;
675
- config: Required<GridConfig>;
676
- /** {@link Component.enabled} */
677
- enabled: boolean;
678
- constructor(components: Components);
679
- create(world: World): SimpleGrid;
680
- delete(world: World): void;
681
- dispose(): void;
682
- }
683
- import * as WEBIFC from "web-ifc";
684
- export interface IfcItemsCategories {
685
- [itemID: number]: number;
686
- }
687
- export declare class IfcCategories {
688
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
689
- }
690
650
  import * as THREE from "three";
691
651
  import { Component, Components, Event, World } from "../core";
692
652
  export interface VertexPickerConfig {
@@ -715,269 +675,258 @@ export declare class VertexPicker extends Component {
715
675
  private getVertices;
716
676
  private getVertex;
717
677
  }
718
- export declare const IfcElements: {
719
- [key: number]: string;
720
- };
721
- import * as THREE from "three";
722
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
723
- import { SimplePlane } from "./src";
724
- import { Components } from "../Components";
725
- /**
726
- * A lightweight component to easily create and handle
727
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
728
- *
729
- * @param components - the instance of {@link Components} used.
730
- * E.g. {@link SimplePlane}.
731
- */
732
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
733
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
734
- /** {@link Createable.onAfterCreate} */
735
- readonly onAfterCreate: Event<SimplePlane>;
736
- /** {@link Createable.onAfterDelete} */
737
- readonly onAfterDelete: Event<SimplePlane>;
738
- /** Event that fires when the user starts dragging a clipping plane. */
739
- readonly onBeforeDrag: Event<void>;
740
- /** Event that fires when the user stops dragging a clipping plane. */
741
- readonly onAfterDrag: Event<void>;
742
- readonly onBeforeCreate: Event<unknown>;
743
- readonly onBeforeCancel: Event<unknown>;
744
- readonly onAfterCancel: Event<unknown>;
745
- readonly onBeforeDelete: Event<unknown>;
678
+ import * as WEBIFC from "web-ifc";
679
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
680
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
681
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
682
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
683
+ onPropertiesStreamed: AsyncEvent<{
684
+ type: number;
685
+ data: {
686
+ [id: number]: any;
687
+ };
688
+ }>;
689
+ onProgress: AsyncEvent<number>;
690
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
746
691
  /** {@link Disposable.onDisposed} */
747
692
  readonly onDisposed: Event<string>;
748
- /**
749
- * Whether to force the clipping plane to be orthogonal in the Y direction
750
- * (up). This is desirable when clipping a building horizontally and a
751
- * clipping plane is created in its roof, which might have a slight
752
- * slope for draining purposes.
753
- */
754
- orthogonalY: boolean;
755
- /**
756
- * The tolerance that determines whether an almost-horizontal clipping plane
757
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
758
- * has to be 'true' for this to apply.
759
- */
760
- toleranceOrthogonalY: number;
761
- Type: new (...args: any) => SimplePlane;
762
- list: SimplePlane[];
763
- /** The material used in all the clipping planes. */
764
- private _material;
765
- private _size;
766
- private _enabled;
767
- private _visible;
768
- /** {@link Component.enabled} */
769
- get enabled(): boolean;
693
+ enabled: boolean;
694
+ settings: PropertiesStreamingSettings;
695
+ webIfc: WEBIFC.IfcAPI;
696
+ dispose(): Promise<void>;
697
+ streamFromBuffer(data: Uint8Array): Promise<void>;
698
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
699
+ private readIfcFile;
700
+ private streamIfcFile;
701
+ private streamAllProperties;
702
+ private cleanUp;
703
+ }
704
+ import * as WEBIFC from "web-ifc";
705
+ import * as FRAG from "@thatopen/fragments";
706
+ import { Component, Components } from "../../core";
707
+ /**
708
+ * Object to export all the properties from an IFC to a JS object.
709
+ */
710
+ export declare class IfcJsonExporter extends Component {
711
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
770
712
  /** {@link Component.enabled} */
771
- set enabled(state: boolean);
772
- /** {@link Hideable.visible } */
773
- get visible(): boolean;
774
- /** {@link Hideable.visible } */
775
- set visible(state: boolean);
776
- /** The material of the clipping plane representation. */
777
- get material(): THREE.MeshBasicMaterial;
778
- /** The material of the clipping plane representation. */
779
- set material(material: THREE.MeshBasicMaterial);
780
- /** The size of the geometric representation of the clippings planes. */
781
- get size(): number;
782
- /** The size of the geometric representation of the clippings planes. */
783
- set size(size: number);
713
+ enabled: boolean;
784
714
  constructor(components: Components);
785
- /** {@link Disposable.dispose} */
786
- dispose(): void;
787
- /** {@link Createable.create} */
788
- create(world: World): void;
789
- /**
790
- * Creates a plane in a certain place and with a certain orientation,
791
- * without the need of the mouse.
792
- *
793
- * @param world - the world where this plane should be created.
794
- * @param normal - the orientation of the clipping plane.
795
- * @param point - the position of the clipping plane.
796
- * navigation.
797
- */
798
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
799
715
  /**
800
- * {@link Createable.delete}
801
- *
802
- * @param world - the world where the plane to delete is.
803
- * @param plane - the plane to delete. If undefined, the first plane
804
- * found under the cursor will be deleted.
716
+ * Exports all the properties of an IFC into an array of JS objects.
717
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
718
+ * @param modelID ID of the IFC model whose properties to extract.
719
+ * @param indirect whether to get the indirect relationships as well.
720
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
721
+ * to make the location data available (e.g. absolute position of building).
805
722
  */
806
- delete(world: World, plane?: SimplePlane): void;
807
- /** Deletes all the existing clipping planes. */
808
- deleteAll(): void;
809
- private deletePlane;
810
- private pickPlane;
811
- private getAllPlaneMeshes;
812
- private createPlaneFromIntersection;
813
- private getWorldNormal;
814
- private normalizePlaneDirectionY;
815
- private newPlane;
816
- private updateMaterialsAndPlanes;
817
- private _onStartDragging;
818
- private _onEndDragging;
723
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
819
724
  }
820
- import { Components } from "../Components";
821
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
822
- import { Component, Event, Disposable, World } from "../Types";
725
+ import * as WEBIFC from "web-ifc";
726
+ import { FragmentsGroup } from "@thatopen/fragments";
727
+ import { Disposable, Event, Component, Components } from "../../core";
728
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
823
729
  /**
824
- * A tool to handle big scenes efficiently by automatically hiding the objects
825
- * that are not visible to the camera.
730
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
731
+ * 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.
826
732
  */
827
- export declare class Cullers extends Component implements Disposable {
828
- /**
829
- * A unique identifier for the Cullers component.
830
- */
831
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
733
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
734
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
735
+ /** {@link Disposable.onDisposed} */
736
+ readonly onDisposed: Event<string>;
737
+ enabled: boolean;
738
+ readonly onRelationsIndexed: Event<{
739
+ modelID: string;
740
+ relationsMap: RelationsMap;
741
+ }>;
742
+ private _relToAttributesMap;
743
+ private _inverseAttributes;
744
+ private _ifcRels;
832
745
  /**
833
- * Indicates whether the Cullers component is enabled.
746
+ * Holds the relationship mappings for each model processed by the indexer.
747
+ * The structure is a map where each key is a model's UUID, and the value is another map.
748
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
749
+ * representing a specific relation type, and the value is an array of expressIDs of entities
750
+ * that are related through that relation type. This structure allows for efficient querying
751
+ * of entity relationships within a model.
834
752
  */
835
- private _enabled;
753
+ readonly relationMaps: ModelsRelationMap;
754
+ constructor(components: Components);
755
+ private onFragmentsDisposed;
756
+ private indexRelations;
836
757
  /**
837
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
758
+ * Adds a relation map to the model's relations map.
759
+ *
760
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
761
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
762
+ *
763
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
838
764
  */
839
- list: Map<string, MeshCullerRenderer>;
765
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
840
766
  /**
841
- * An event that is triggered when the Cullers component is disposed.
767
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
768
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
769
+ * and maps them in a structured way to facilitate quick access to related entities.
770
+ *
771
+ * The process involves querying the model for each relation type associated with the inverse attributes
772
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
773
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
774
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
775
+ * of entities that are related through that attribute.
776
+ *
777
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
778
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
779
+ * representation of the relations indexed by entity expressIDs and relation types.
780
+ * @throws An error if the model does not have properties loaded.
842
781
  */
843
- readonly onDisposed: Event<unknown>;
782
+ process(model: FragmentsGroup): Promise<RelationsMap>;
844
783
  /**
845
- * Gets the enabled state of the Cullers component.
784
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
846
785
  *
847
- * @returns The current enabled state.
786
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
787
+ * @param modelID - The unique identifier of the model within the WebIfc API.
788
+ * @returns A promise that resolves to the relations map for the processed model.
789
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
848
790
  */
849
- get enabled(): boolean;
791
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
850
792
  /**
851
- * Sets the enabled state of the Cullers component.
852
- * Also sets the enabled state of all MeshCullerRenderer instances.
793
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
794
+ * This method searches the indexed relation maps for the specified model and entity,
795
+ * returning the IDs of related entities if a match is found.
853
796
  *
854
- * @param value - The new enabled state.
797
+ * @param model The 'FragmentsGroup' model containing the entity.
798
+ * @param expressID The unique identifier of the entity within the model.
799
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
800
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
801
+ * or the specified relation name is not indexed.
855
802
  */
856
- set enabled(value: boolean);
857
- constructor(components: Components);
858
- /**
859
- * Creates a new MeshCullerRenderer for the given world.
860
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
861
- *
862
- * @param world - The world for which to create the MeshCullerRenderer.
863
- * @param config - Optional configuration settings for the MeshCullerRenderer.
864
- *
865
- * @returns The newly created or existing MeshCullerRenderer for the given world.
866
- */
867
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
868
- delete(world: World): void;
869
- /** {@link Disposable.dispose} */
870
- dispose(): void;
871
- }
872
- import { MiniMap } from "./src";
873
- import { Component, Updateable, World, Event, Disposable } from "../Types";
874
- import { Components } from "../Components";
875
- export declare class MiniMaps extends Component implements Updateable, Disposable {
876
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
877
- readonly onAfterUpdate: Event<unknown>;
878
- readonly onBeforeUpdate: Event<unknown>;
879
- readonly onDisposed: Event<unknown>;
880
- enabled: boolean;
881
- list: Map<string, MiniMap>;
882
- constructor(components: Components);
883
- create(world: World): MiniMap;
884
- delete(id: string): void;
885
- dispose(): void;
886
- update(): void;
887
- }
888
- import * as THREE from "three";
889
- import { Components } from "../Components";
890
- import { SimpleCamera } from "..";
891
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
892
- /**
893
- * A flexible camera that uses
894
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
895
- * easily control the camera in 2D and 3D. It supports multiple navigation
896
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
897
- */
898
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
803
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
899
804
  /**
900
- * The current {@link NavigationMode}.
805
+ * Serializes the relations of a given relation map into a JSON string.
806
+ * 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,
807
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
808
+ * The resulting object is then serialized into a JSON string.
809
+ *
810
+ * @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.
811
+ * @returns A JSON string representing the serialized relations of the given relation map.
901
812
  */
902
- _mode: NavigationMode | null;
903
- readonly projection: ProjectionManager;
904
- readonly threeOrtho: THREE.OrthographicCamera;
905
- readonly threePersp: THREE.PerspectiveCamera;
906
- protected readonly _userInputButtons: any;
907
- protected readonly _frustumSize = 50;
908
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
909
- private previousSize;
910
- get mode(): NavigationMode;
911
- constructor(components: Components);
912
- /** {@link Disposable.dispose} */
913
- dispose(): void;
813
+ serializeRelations(relationMap: RelationsMap): string;
914
814
  /**
915
- * Sets a new {@link NavigationMode} and disables the previous one.
815
+ * Serializes the relations of a specific model into a JSON string.
816
+ * This method iterates through the relations indexed for the given model,
817
+ * organizing them into a structured object where each key is an expressID of an entity,
818
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
819
+ * The resulting object is then serialized into a JSON string.
916
820
  *
917
- * @param mode - The {@link NavigationMode} to set.
821
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
822
+ * @returns A JSON string representing the serialized relations of the specified model.
823
+ * If the model has no indexed relations, 'null' is returned.
918
824
  */
919
- set(mode: NavModeID): void;
825
+ serializeModelRelations(model: FragmentsGroup): string | null;
920
826
  /**
921
- * Make the camera view fit all the specified meshes.
827
+ * Serializes all relations of every model processed by the indexer into a JSON string.
828
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
829
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
830
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
831
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
922
832
  *
923
- * @param meshes the meshes to fit. If it is not defined, it will
924
- * evaluate {@link Components.meshes}.
925
- * @param offset the distance to the fit object
833
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
834
+ * If no relations have been indexed, an empty object is returned as a JSON string.
926
835
  */
927
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
836
+ serializeAllRelations(): string;
928
837
  /**
929
- * Allows or prevents all user input.
838
+ * Converts a JSON string representing relations between entities into a structured map.
839
+ * This method parses the JSON string to reconstruct the relations map that indexes
840
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
841
+ * and the values are maps where each key is a relation type ID and its value is an array
842
+ * of express IDs of entities related through that relation type.
930
843
  *
931
- * @param active - whether to enable or disable user inputs.
844
+ * @param json The JSON string to be parsed into the relations map.
845
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
846
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
847
+ * is an array of express IDs (as numbers) of entities related through that relation type.
932
848
  */
933
- setUserInput(active: boolean): void;
934
- private disableUserInput;
935
- private enableUserInput;
936
- private newOrthoCamera;
937
- private setOrthoPerspCameraAspect;
849
+ getRelationsMapFromJSON(json: string): RelationsMap;
850
+ /**
851
+ * Disposes the component, cleaning up resources and detaching event listeners.
852
+ * This ensures that the component is properly cleaned up and does not leave behind any
853
+ * references that could prevent garbage collection.
854
+ */
855
+ dispose(): void;
938
856
  }
939
- import * as FRAGS from "@thatopen/fragments";
940
- export declare class IfcPropertiesUtils {
941
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
942
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
943
- [attribute: string]: any;
944
- } | null>;
945
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
946
- [relatingID: number]: number[];
857
+ export type { InverseAttribute, RelationsMap } from "./src/types";
858
+ import * as WEBIFC from "web-ifc";
859
+ import { FragmentsGroup } from "@thatopen/fragments";
860
+ import { Component, Disposable, Event, Components } from "../../core";
861
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
862
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
863
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
864
+ interface ChangeMap {
865
+ [modelID: string]: Set<number>;
866
+ }
867
+ interface AttributeListener {
868
+ [modelID: string]: {
869
+ [expressID: number]: {
870
+ [attributeName: string]: Event<String | Boolean | Number>;
871
+ };
872
+ };
873
+ }
874
+ export declare class IfcPropertiesManager extends Component implements Disposable {
875
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
876
+ /** {@link Disposable.onDisposed} */
877
+ readonly onDisposed: Event<string>;
878
+ readonly onRequestFile: Event<unknown>;
879
+ ifcToExport: ArrayBuffer | null;
880
+ readonly onElementToPset: Event<{
881
+ model: FragmentsGroup;
882
+ psetID: number;
883
+ elementID: number;
947
884
  }>;
948
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
949
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
950
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
951
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
952
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
953
- key: string | null;
954
- name: string | null;
885
+ readonly onPropToPset: Event<{
886
+ model: FragmentsGroup;
887
+ psetID: number;
888
+ propID: number;
955
889
  }>;
956
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
957
- key: string | null;
958
- value: number | null;
890
+ readonly onPsetRemoved: Event<{
891
+ model: FragmentsGroup;
892
+ psetID: number;
959
893
  }>;
960
- static isRel(expressID: number): boolean;
961
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
962
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
963
- }
964
- export declare const IfcCategoryMap: {
965
- [key: number]: string;
966
- };
967
- export declare const GeometryTypes: Set<number>;
968
- import { InverseAttribute } from "./types";
969
- export declare const relToAttributesMap: Map<number, {
970
- forRelating: InverseAttribute;
971
- forRelated: InverseAttribute;
972
- }>;
973
- import * as WEBIFC from "web-ifc";
974
- import { IfcItemsCategories } from "../../../ifc";
975
- export declare class SpatialStructure {
976
- itemsByFloor: IfcItemsCategories;
977
- private _units;
978
- setUp(webIfc: WEBIFC.IfcAPI): void;
979
- cleanUp(): void;
894
+ readonly onDataChanged: Event<{
895
+ model: FragmentsGroup;
896
+ expressID: number;
897
+ }>;
898
+ wasm: {
899
+ path: string;
900
+ absolute: boolean;
901
+ };
902
+ enabled: boolean;
903
+ attributeListeners: AttributeListener;
904
+ selectedModel?: FragmentsGroup;
905
+ changeMap: ChangeMap;
906
+ constructor(components: Components);
907
+ dispose(): void;
908
+ private increaseMaxID;
909
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
910
+ private newGUID;
911
+ private getOwnerHistory;
912
+ private registerChange;
913
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
914
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
915
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
916
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
917
+ }>;
918
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
919
+ private newSingleProperty;
920
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
921
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
922
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
923
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
924
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
925
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
926
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
927
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
980
928
  }
929
+ export {};
981
930
  import * as THREE from "three";
982
931
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
983
932
  export declare class MiniMap implements Resizeable, Updateable, Disposable {
@@ -1012,6 +961,53 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1012
961
  resize(size?: THREE.Vector2): void;
1013
962
  private updatePlanes;
1014
963
  }
964
+ export declare const GeometryTypes: Set<number>;
965
+ import * as WEBIFC from "web-ifc";
966
+ import { IfcItemsCategories } from "../../../ifc";
967
+ export declare class SpatialStructure {
968
+ itemsByFloor: IfcItemsCategories;
969
+ private _units;
970
+ setUp(webIfc: WEBIFC.IfcAPI): void;
971
+ cleanUp(): void;
972
+ }
973
+ import * as WEBIFC from "web-ifc";
974
+ export interface IfcItemsCategories {
975
+ [itemID: number]: number;
976
+ }
977
+ export declare class IfcCategories {
978
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
979
+ }
980
+ export declare const IfcElements: {
981
+ [key: number]: string;
982
+ };
983
+ export declare const IfcCategoryMap: {
984
+ [key: number]: string;
985
+ };
986
+ import * as FRAGS from "@thatopen/fragments";
987
+ export declare class IfcPropertiesUtils {
988
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
989
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
990
+ [attribute: string]: any;
991
+ } | null>;
992
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
993
+ [relatingID: number]: number[];
994
+ }>;
995
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
996
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
997
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
998
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
999
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1000
+ key: string | null;
1001
+ name: string | null;
1002
+ }>;
1003
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1004
+ key: string | null;
1005
+ value: number | null;
1006
+ }>;
1007
+ static isRel(expressID: number): boolean;
1008
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1009
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1010
+ }
1015
1011
  /**
1016
1012
  * Simple event handler by
1017
1013
  * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
@@ -1080,6 +1076,23 @@ export declare class AsyncEvent<T> {
1080
1076
  reset(): void;
1081
1077
  private handlers;
1082
1078
  }
1079
+ import { Base } from "./base";
1080
+ import { World } from "./world";
1081
+ import { Event } from "./event";
1082
+ import { Components } from "../../Components";
1083
+ /**
1084
+ * One of the elements that make a world. It can be either a scene, a camera
1085
+ * or a renderer.
1086
+ */
1087
+ export declare abstract class BaseWorldItem extends Base {
1088
+ readonly worlds: Map<string, World>;
1089
+ readonly onWorldChanged: Event<{
1090
+ world: World;
1091
+ action: "added" | "removed";
1092
+ }>;
1093
+ currentWorld: World | null;
1094
+ protected constructor(components: Components);
1095
+ }
1083
1096
  import * as THREE from "three";
1084
1097
  import CameraControls from "camera-controls";
1085
1098
  import { Event } from "./event";
@@ -1195,48 +1208,13 @@ export interface Configurable<T extends Record<string, any>> {
1195
1208
  */
1196
1209
  export interface BVHGeometry extends THREE.BufferGeometry {
1197
1210
  boundsTree: Object | undefined;
1198
- disposeBoundsTree: () => void;
1199
- }
1200
- /**
1201
- * Whether a camera uses the Camera Controls library.
1202
- */
1203
- export interface CameraControllable {
1204
- controls: CameraControls;
1205
- }
1206
- import { Base } from "./base";
1207
- import { World } from "./world";
1208
- import { Event } from "./event";
1209
- import { Components } from "../../Components";
1210
- /**
1211
- * One of the elements that make a world. It can be either a scene, a camera
1212
- * or a renderer.
1213
- */
1214
- export declare abstract class BaseWorldItem extends Base {
1215
- readonly worlds: Map<string, World>;
1216
- readonly onWorldChanged: Event<{
1217
- world: World;
1218
- action: "added" | "removed";
1219
- }>;
1220
- currentWorld: World | null;
1221
- protected constructor(components: Components);
1222
- }
1223
- import { Base } from "./base";
1224
- /**
1225
- * Components are the building blocks of this library. Components are singleton
1226
- * elements that contain specific functionality. For instance, the SimpleClipper
1227
- * Component can create, delete and handle 3D clipping planes. Components must be
1228
- * unique (they can't be instanced more than once), and have a static UUID that
1229
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1230
- * instance.
1231
- */
1232
- export declare abstract class Component extends Base {
1233
- /**
1234
- * Whether this component is active or not. The behaviour can vary depending
1235
- * on the type of component. E.g. a disabled dimension tool will stop creating
1236
- * dimensions, while a disabled camera will stop moving. A disabled component
1237
- * will not be updated automatically each frame.
1238
- */
1239
- abstract enabled: boolean;
1211
+ disposeBoundsTree: () => void;
1212
+ }
1213
+ /**
1214
+ * Whether a camera uses the Camera Controls library.
1215
+ */
1216
+ export interface CameraControllable {
1217
+ controls: CameraControls;
1240
1218
  }
1241
1219
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1242
1220
  import { Components } from "../../Components";
@@ -1257,6 +1235,40 @@ export declare abstract class Base {
1257
1235
  /** Whether is component is {@link Configurable}. */
1258
1236
  isConfigurable: () => this is Configurable<any>;
1259
1237
  }
1238
+ import { InverseAttribute } from "./types";
1239
+ export declare const relToAttributesMap: Map<number, {
1240
+ forRelating: InverseAttribute;
1241
+ forRelated: InverseAttribute;
1242
+ }>;
1243
+ import { Base } from "./base";
1244
+ /**
1245
+ * Components are the building blocks of this library. Components are singleton
1246
+ * elements that contain specific functionality. For instance, the SimpleClipper
1247
+ * Component can create, delete and handle 3D clipping planes. Components must be
1248
+ * unique (they can't be instanced more than once), and have a static UUID that
1249
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1250
+ * instance.
1251
+ */
1252
+ export declare abstract class Component extends Base {
1253
+ /**
1254
+ * Whether this component is active or not. The behaviour can vary depending
1255
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1256
+ * dimensions, while a disabled camera will stop moving. A disabled component
1257
+ * will not be updated automatically each frame.
1258
+ */
1259
+ abstract enabled: boolean;
1260
+ }
1261
+ import * as THREE from "three";
1262
+ import CameraControls from "camera-controls";
1263
+ import { BaseWorldItem } from "./base-world-item";
1264
+ import { CameraControllable } from "./interfaces";
1265
+ export declare abstract class BaseCamera extends BaseWorldItem {
1266
+ abstract enabled: boolean;
1267
+ abstract three: THREE.Camera;
1268
+ abstract controls?: CameraControls;
1269
+ /** Whether is instance is {@link CameraControllable}. */
1270
+ hasCameraControls: () => this is CameraControllable;
1271
+ }
1260
1272
  import * as THREE from "three";
1261
1273
  import { Vector2 } from "three";
1262
1274
  import { Event } from "./event";
@@ -1298,15 +1310,17 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1298
1310
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1299
1311
  }
1300
1312
  import * as THREE from "three";
1301
- import CameraControls from "camera-controls";
1313
+ import { Disposable } from "./interfaces";
1314
+ import { Event } from "./event";
1315
+ import { Components } from "../../Components";
1302
1316
  import { BaseWorldItem } from "./base-world-item";
1303
- import { CameraControllable } from "./interfaces";
1304
- export declare abstract class BaseCamera extends BaseWorldItem {
1305
- abstract enabled: boolean;
1306
- abstract three: THREE.Camera;
1307
- abstract controls?: CameraControls;
1308
- /** Whether is instance is {@link CameraControllable}. */
1309
- hasCameraControls: () => this is CameraControllable;
1317
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1318
+ /** {@link Disposable.onDisposed} */
1319
+ readonly onDisposed: Event<unknown>;
1320
+ abstract three: THREE.Object3D;
1321
+ protected constructor(components: Components);
1322
+ /** {@link Disposable.dispose} */
1323
+ dispose(): void;
1310
1324
  }
1311
1325
  import * as THREE from "three";
1312
1326
  import { BaseScene } from "./base-scene";
@@ -1322,19 +1336,6 @@ export interface World extends Disposable, Updateable {
1322
1336
  isDisposing: boolean;
1323
1337
  }
1324
1338
  import * as THREE from "three";
1325
- import { Disposable } from "./interfaces";
1326
- import { Event } from "./event";
1327
- import { Components } from "../../Components";
1328
- import { BaseWorldItem } from "./base-world-item";
1329
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1330
- /** {@link Disposable.onDisposed} */
1331
- readonly onDisposed: Event<unknown>;
1332
- abstract three: THREE.Object3D;
1333
- protected constructor(components: Components);
1334
- /** {@link Disposable.dispose} */
1335
- dispose(): void;
1336
- }
1337
- import * as THREE from "three";
1338
1339
  import { Disposable, Event } from "../../Types";
1339
1340
  /**
1340
1341
  * A helper to easily get the real position of the mouse in the Three.js canvas
@@ -1361,50 +1362,6 @@ export declare class Mouse implements Disposable {
1361
1362
  private setupEvents;
1362
1363
  }
1363
1364
  import * as THREE from "three";
1364
- import { Hideable, Event, World, Disposable } from "../../Types";
1365
- import { Components } from "../../Components";
1366
- export interface GridConfig {
1367
- color: THREE.Color;
1368
- size1: number;
1369
- size2: number;
1370
- distance: number;
1371
- }
1372
- /**
1373
- * An infinite grid. Created by
1374
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1375
- * and translated to typescript by
1376
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1377
- */
1378
- export declare class SimpleGrid implements Hideable, Disposable {
1379
- /** {@link Disposable.onDisposed} */
1380
- readonly onDisposed: Event<unknown>;
1381
- world: World;
1382
- components: Components;
1383
- /** {@link Hideable.visible} */
1384
- get visible(): boolean;
1385
- /** {@link Hideable.visible} */
1386
- set visible(visible: boolean);
1387
- /** The material of the grid. */
1388
- get material(): THREE.ShaderMaterial;
1389
- /**
1390
- * Whether the grid should fade away with distance. Recommended to be true for
1391
- * perspective cameras and false for orthographic cameras.
1392
- */
1393
- get fade(): boolean;
1394
- /**
1395
- * Whether the grid should fade away with distance. Recommended to be true for
1396
- * perspective cameras and false for orthographic cameras.
1397
- */
1398
- set fade(active: boolean);
1399
- readonly three: THREE.Mesh;
1400
- private _fade;
1401
- constructor(components: Components, world: World, config: GridConfig);
1402
- /** {@link Disposable.dispose} */
1403
- dispose(): void;
1404
- private setupEvents;
1405
- private updateZoom;
1406
- }
1407
- import * as THREE from "three";
1408
1365
  import { Components } from "../../Components";
1409
1366
  import { Event, World, Disposable } from "../../Types";
1410
1367
  import { Mouse } from "./mouse";
@@ -1469,36 +1426,6 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
1469
1426
  dispose(disposeResources?: boolean): void;
1470
1427
  }
1471
1428
  import * as THREE from "three";
1472
- import { BaseScene, Configurable, Event } from "../../Types";
1473
- import { Components } from "../../Components";
1474
- export interface SimpleSceneConfig {
1475
- directionalLight: {
1476
- color: THREE.Color;
1477
- intensity: number;
1478
- position: THREE.Vector3;
1479
- };
1480
- ambientLight: {
1481
- color: THREE.Color;
1482
- intensity: number;
1483
- };
1484
- }
1485
- /**
1486
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1487
- * objects hierarchically, and easily dispose them when you are finished with it.
1488
- * @noInheritDoc
1489
- */
1490
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1491
- /** {@link Configurable.isSetup} */
1492
- isSetup: boolean;
1493
- three: THREE.Scene;
1494
- /** {@link Configurable.onSetup} */
1495
- readonly onSetup: Event<SimpleScene>;
1496
- config: Required<SimpleSceneConfig>;
1497
- constructor(components: Components);
1498
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1499
- setup(config?: Partial<SimpleSceneConfig>): void;
1500
- }
1501
- import * as THREE from "three";
1502
1429
  import { BaseRenderer, Event } from "../../Types";
1503
1430
  import { Components } from "../../Components";
1504
1431
  /**
@@ -1531,6 +1458,36 @@ export declare class SimpleRenderer extends BaseRenderer {
1531
1458
  private onContextBack;
1532
1459
  }
1533
1460
  import * as THREE from "three";
1461
+ import { BaseScene, Configurable, Event } from "../../Types";
1462
+ import { Components } from "../../Components";
1463
+ export interface SimpleSceneConfig {
1464
+ directionalLight: {
1465
+ color: THREE.Color;
1466
+ intensity: number;
1467
+ position: THREE.Vector3;
1468
+ };
1469
+ ambientLight: {
1470
+ color: THREE.Color;
1471
+ intensity: number;
1472
+ };
1473
+ }
1474
+ /**
1475
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1476
+ * objects hierarchically, and easily dispose them when you are finished with it.
1477
+ * @noInheritDoc
1478
+ */
1479
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1480
+ /** {@link Configurable.isSetup} */
1481
+ isSetup: boolean;
1482
+ three: THREE.Scene;
1483
+ /** {@link Configurable.onSetup} */
1484
+ readonly onSetup: Event<SimpleScene>;
1485
+ config: Required<SimpleSceneConfig>;
1486
+ constructor(components: Components);
1487
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1488
+ setup(config?: Partial<SimpleSceneConfig>): void;
1489
+ }
1490
+ import * as THREE from "three";
1534
1491
  import CameraControls from "camera-controls";
1535
1492
  import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1536
1493
  import { Components } from "../../Components";
@@ -1577,52 +1534,145 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
1577
1534
  private static getSubsetOfThree;
1578
1535
  }
1579
1536
  import * as THREE from "three";
1580
- import * as WEBIFC from "web-ifc";
1581
- import * as FRAGS from "@thatopen/fragments";
1582
- export declare class CivilReader {
1583
- defLineMat: THREE.LineBasicMaterial;
1584
- read(webIfc: WEBIFC.IfcAPI): {
1585
- alignments: Map<number, FRAGS.Alignment>;
1586
- coordinationMatrix: THREE.Matrix4;
1587
- } | undefined;
1588
- get(civilItems: any): {
1589
- alignments: Map<number, FRAGS.Alignment>;
1590
- coordinationMatrix: THREE.Matrix4;
1591
- } | undefined;
1592
- private getCurves;
1537
+ import { Hideable, Event, World, Disposable } from "../../Types";
1538
+ import { Components } from "../../Components";
1539
+ export interface GridConfig {
1540
+ color: THREE.Color;
1541
+ size1: number;
1542
+ size2: number;
1543
+ distance: number;
1593
1544
  }
1594
- import * as WEBIFC from "web-ifc";
1595
- /** Configuration of the IFC-fragment conversion. */
1596
- export declare class IfcFragmentSettings {
1597
- /** Whether to extract the IFC properties into a JSON. */
1598
- includeProperties: boolean;
1545
+ /**
1546
+ * An infinite grid. Created by
1547
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1548
+ * and translated to typescript by
1549
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1550
+ */
1551
+ export declare class SimpleGrid implements Hideable, Disposable {
1552
+ /** {@link Disposable.onDisposed} */
1553
+ readonly onDisposed: Event<unknown>;
1554
+ world: World;
1555
+ components: Components;
1556
+ /** {@link Hideable.visible} */
1557
+ get visible(): boolean;
1558
+ /** {@link Hideable.visible} */
1559
+ set visible(visible: boolean);
1560
+ /** The material of the grid. */
1561
+ get material(): THREE.ShaderMaterial;
1562
+ /**
1563
+ * Whether the grid should fade away with distance. Recommended to be true for
1564
+ * perspective cameras and false for orthographic cameras.
1565
+ */
1566
+ get fade(): boolean;
1567
+ /**
1568
+ * Whether the grid should fade away with distance. Recommended to be true for
1569
+ * perspective cameras and false for orthographic cameras.
1570
+ */
1571
+ set fade(active: boolean);
1572
+ readonly three: THREE.Mesh;
1573
+ private _fade;
1574
+ constructor(components: Components, world: World, config: GridConfig);
1575
+ /** {@link Disposable.dispose} */
1576
+ dispose(): void;
1577
+ private setupEvents;
1578
+ private updateZoom;
1579
+ }
1580
+ import * as THREE from "three";
1581
+ import { Components } from "../../Components";
1582
+ import { AsyncEvent, Event, World } from "../../Types";
1583
+ export interface CullerRendererSettings {
1584
+ updateInterval?: number;
1585
+ width?: number;
1586
+ height?: number;
1587
+ autoUpdate?: boolean;
1588
+ }
1589
+ /**
1590
+ * A base renderer to determine visibility on screen
1591
+ */
1592
+ export declare class CullerRenderer {
1593
+ /** {@link Disposable.onDisposed} */
1594
+ readonly onDisposed: Event<string>;
1595
+ /**
1596
+ * Fires after making the visibility check to the meshes. It lists the
1597
+ * meshes that are currently visible, and the ones that were visible
1598
+ * just before but not anymore.
1599
+ */
1600
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1601
+ /** {@link Component.enabled} */
1602
+ enabled: boolean;
1599
1603
  /**
1600
- * Generate the geometry for categories that are not included by default,
1601
- * like IFCSPACE.
1604
+ * Needs to check whether there are objects that need to be hidden or shown.
1605
+ * You can bind this to the camera movement, to a certain interval, etc.
1602
1606
  */
1603
- optionalCategories: number[];
1604
- /** Whether to use the coordination data coming from the IFC files. */
1605
- coordinate: boolean;
1606
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1607
- wasm: {
1608
- path: string;
1609
- absolute: boolean;
1610
- logLevel?: WEBIFC.LogLevel;
1607
+ needsUpdate: boolean;
1608
+ /**
1609
+ * Render the internal scene used to determine the object visibility. Used
1610
+ * for debugging purposes.
1611
+ */
1612
+ renderDebugFrame: boolean;
1613
+ components: Components;
1614
+ readonly world: World;
1615
+ readonly renderer: THREE.WebGLRenderer;
1616
+ protected autoUpdate: boolean;
1617
+ protected updateInterval: number;
1618
+ protected readonly worker: Worker;
1619
+ protected readonly scene: THREE.Scene;
1620
+ private _width;
1621
+ private _height;
1622
+ private _availableColor;
1623
+ private readonly renderTarget;
1624
+ private readonly bufferSize;
1625
+ private readonly _buffer;
1626
+ protected _isWorkerBusy: boolean;
1627
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1628
+ /** {@link Disposable.dispose} */
1629
+ dispose(): void;
1630
+ /**
1631
+ * The function that the culler uses to reprocess the scene. Generally it's
1632
+ * better to call needsUpdate, but you can also call this to force it.
1633
+ * @param force if true, it will refresh the scene even if needsUpdate is
1634
+ * not true.
1635
+ */
1636
+ updateVisibility: (force?: boolean) => Promise<void>;
1637
+ protected getAvailableColor(): {
1638
+ r: number;
1639
+ g: number;
1640
+ b: number;
1641
+ code: string;
1611
1642
  };
1612
- /** List of categories that won't be converted to fragments. */
1613
- excludedCategories: Set<number>;
1614
- /** Whether to save the absolute location of all IFC items. */
1615
- saveLocations: boolean;
1616
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1617
- webIfc: WEBIFC.LoaderSettings;
1618
- autoSetWasm: boolean;
1619
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1643
+ protected increaseColor(): void;
1644
+ protected decreaseColor(): void;
1645
+ private applySettings;
1620
1646
  }
1621
- import * as WEBIFC from "web-ifc";
1622
- export declare class IfcMetadataReader {
1623
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
1624
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
1647
+ import * as THREE from "three";
1648
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1649
+ import { Components } from "../../Components";
1650
+ import { Event, World } from "../../Types";
1651
+ /**
1652
+ * A renderer to determine a mesh visibility on screen
1653
+ */
1654
+ export declare class MeshCullerRenderer extends CullerRenderer {
1655
+ threshold: number;
1656
+ readonly onViewUpdated: Event<{
1657
+ seen: Set<THREE.Mesh>;
1658
+ unseen: Set<THREE.Mesh>;
1659
+ }>;
1660
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1661
+ isProcessing: boolean;
1662
+ private _colorCodeMeshMap;
1663
+ private _meshIDColorCodeMap;
1664
+ private _currentVisibleMeshes;
1665
+ private _recentlyHiddenMeshes;
1666
+ private _intervalID;
1667
+ private readonly _transparentMat;
1668
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1669
+ dispose(): void;
1670
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1671
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1672
+ private handleWorkerMessage;
1673
+ private getAvailableMaterial;
1625
1674
  }
1675
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1626
1676
  import { IfcFragmentSettings } from "../../IfcLoader/src";
1627
1677
  /** Configuration of the IFC-fragment streaming. */
1628
1678
  export declare class IfcStreamingSettings extends IfcFragmentSettings {
@@ -1675,16 +1725,6 @@ export interface StreamedAsset {
1675
1725
  color: number[];
1676
1726
  }[];
1677
1727
  }
1678
- import * as WEBIFC from "web-ifc";
1679
- import * as THREE from "three";
1680
- export declare class Units {
1681
- factor: number;
1682
- complement: number;
1683
- apply(matrix: THREE.Matrix4): void;
1684
- setUp(webIfc: WEBIFC.IfcAPI): void;
1685
- private getLengthUnits;
1686
- private getScaleMatrix;
1687
- }
1688
1728
  import * as THREE from "three";
1689
1729
  import { Hideable, Disposable, Event, World } from "../../Types";
1690
1730
  import { Components } from "../../Components";
@@ -1746,6 +1786,53 @@ export declare class SimplePlane implements Disposable, Hideable {
1746
1786
  private newHelper;
1747
1787
  private static newPlaneMesh;
1748
1788
  }
1789
+ import * as WEBIFC from "web-ifc";
1790
+ export declare class IfcMetadataReader {
1791
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
1792
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
1793
+ }
1794
+ import * as WEBIFC from "web-ifc";
1795
+ /** Configuration of the IFC-fragment conversion. */
1796
+ export declare class IfcFragmentSettings {
1797
+ /** Whether to extract the IFC properties into a JSON. */
1798
+ includeProperties: boolean;
1799
+ /**
1800
+ * Generate the geometry for categories that are not included by default,
1801
+ * like IFCSPACE.
1802
+ */
1803
+ optionalCategories: number[];
1804
+ /** Whether to use the coordination data coming from the IFC files. */
1805
+ coordinate: boolean;
1806
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1807
+ wasm: {
1808
+ path: string;
1809
+ absolute: boolean;
1810
+ logLevel?: WEBIFC.LogLevel;
1811
+ };
1812
+ /** List of categories that won't be converted to fragments. */
1813
+ excludedCategories: Set<number>;
1814
+ /** Whether to save the absolute location of all IFC items. */
1815
+ saveLocations: boolean;
1816
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1817
+ webIfc: WEBIFC.LoaderSettings;
1818
+ autoSetWasm: boolean;
1819
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1820
+ }
1821
+ import * as THREE from "three";
1822
+ import * as WEBIFC from "web-ifc";
1823
+ import * as FRAGS from "@thatopen/fragments";
1824
+ export declare class CivilReader {
1825
+ defLineMat: THREE.LineBasicMaterial;
1826
+ read(webIfc: WEBIFC.IfcAPI): {
1827
+ alignments: Map<number, FRAGS.Alignment>;
1828
+ coordinationMatrix: THREE.Matrix4;
1829
+ } | undefined;
1830
+ get(civilItems: any): {
1831
+ alignments: Map<number, FRAGS.Alignment>;
1832
+ coordinationMatrix: THREE.Matrix4;
1833
+ } | undefined;
1834
+ private getCurves;
1835
+ }
1749
1836
  import { NavigationMode } from "./types";
1750
1837
  import { OrthoPerspectiveCamera } from "../index";
1751
1838
  /**
@@ -1865,102 +1952,6 @@ export interface NavigationMode {
1865
1952
  /** Whether this navigation mode is active or not. */
1866
1953
  enabled: boolean;
1867
1954
  }
1868
- import * as THREE from "three";
1869
- import { Components } from "../../Components";
1870
- import { AsyncEvent, Event, World } from "../../Types";
1871
- export interface CullerRendererSettings {
1872
- updateInterval?: number;
1873
- width?: number;
1874
- height?: number;
1875
- autoUpdate?: boolean;
1876
- }
1877
- /**
1878
- * A base renderer to determine visibility on screen
1879
- */
1880
- export declare class CullerRenderer {
1881
- /** {@link Disposable.onDisposed} */
1882
- readonly onDisposed: Event<string>;
1883
- /**
1884
- * Fires after making the visibility check to the meshes. It lists the
1885
- * meshes that are currently visible, and the ones that were visible
1886
- * just before but not anymore.
1887
- */
1888
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1889
- /** {@link Component.enabled} */
1890
- enabled: boolean;
1891
- /**
1892
- * Needs to check whether there are objects that need to be hidden or shown.
1893
- * You can bind this to the camera movement, to a certain interval, etc.
1894
- */
1895
- needsUpdate: boolean;
1896
- /**
1897
- * Render the internal scene used to determine the object visibility. Used
1898
- * for debugging purposes.
1899
- */
1900
- renderDebugFrame: boolean;
1901
- components: Components;
1902
- readonly world: World;
1903
- readonly renderer: THREE.WebGLRenderer;
1904
- protected autoUpdate: boolean;
1905
- protected updateInterval: number;
1906
- protected readonly worker: Worker;
1907
- protected readonly scene: THREE.Scene;
1908
- private _width;
1909
- private _height;
1910
- private _availableColor;
1911
- private readonly renderTarget;
1912
- private readonly bufferSize;
1913
- private readonly _buffer;
1914
- protected _isWorkerBusy: boolean;
1915
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1916
- /** {@link Disposable.dispose} */
1917
- dispose(): void;
1918
- /**
1919
- * The function that the culler uses to reprocess the scene. Generally it's
1920
- * better to call needsUpdate, but you can also call this to force it.
1921
- * @param force if true, it will refresh the scene even if needsUpdate is
1922
- * not true.
1923
- */
1924
- updateVisibility: (force?: boolean) => Promise<void>;
1925
- protected getAvailableColor(): {
1926
- r: number;
1927
- g: number;
1928
- b: number;
1929
- code: string;
1930
- };
1931
- protected increaseColor(): void;
1932
- protected decreaseColor(): void;
1933
- private applySettings;
1934
- }
1935
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1936
- import * as THREE from "three";
1937
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1938
- import { Components } from "../../Components";
1939
- import { Event, World } from "../../Types";
1940
- /**
1941
- * A renderer to determine a mesh visibility on screen
1942
- */
1943
- export declare class MeshCullerRenderer extends CullerRenderer {
1944
- threshold: number;
1945
- readonly onViewUpdated: Event<{
1946
- seen: Set<THREE.Mesh>;
1947
- unseen: Set<THREE.Mesh>;
1948
- }>;
1949
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1950
- isProcessing: boolean;
1951
- private _colorCodeMeshMap;
1952
- private _meshIDColorCodeMap;
1953
- private _currentVisibleMeshes;
1954
- private _recentlyHiddenMeshes;
1955
- private _intervalID;
1956
- private readonly _transparentMat;
1957
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1958
- dispose(): void;
1959
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1960
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1961
- private handleWorkerMessage;
1962
- private getAvailableMaterial;
1963
- }
1964
1955
  export type RelationsMap = Map<number, Map<number, number[]>>;
1965
1956
  export interface ModelsRelationMap {
1966
1957
  [modelID: string]: RelationsMap;
@@ -1985,6 +1976,16 @@ export type InverseAttributes = [
1985
1976
  "ContainsElements"
1986
1977
  ];
1987
1978
  export type InverseAttribute = InverseAttributes[number];
1979
+ import * as WEBIFC from "web-ifc";
1980
+ import * as THREE from "three";
1981
+ export declare class Units {
1982
+ factor: number;
1983
+ complement: number;
1984
+ apply(matrix: THREE.Matrix4): void;
1985
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1986
+ private getLengthUnits;
1987
+ private getScaleMatrix;
1988
+ }
1988
1989
  import { BufferGeometry } from "three";
1989
1990
  import * as THREE from "three";
1990
1991
  export declare class TransformHelper {