@thatopen/components 2.0.0-alpha.16 → 2.0.0-alpha.17

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,239 +1,514 @@
1
1
  declare namespace OBC {
2
2
  import * as THREE from "three";
3
- import { Components } from "../Components";
4
- import { Component } from "../Types";
5
- /**
6
- * A tool to safely remove meshes and geometries from memory to
7
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
8
- */
9
- export declare class Disposer extends Component {
10
- private _disposedComponents;
11
- /** {@link Component.enabled} */
3
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
4
+ center: THREE.Vector3;
5
+ halfSizes: THREE.Vector3;
6
+ rotation: THREE.Matrix3;
7
+ transformation: THREE.Matrix4;
8
+ };
9
+ import * as THREE from "three";
10
+ export declare class MaterialsUtils {
11
+ static isTransparent(material: THREE.Material): boolean;
12
+ }
13
+ import * as FRAGS from "@thatopen/fragments";
14
+ import { Components, Component } from "../../core";
15
+ export declare class FragmentHider extends Component {
16
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
12
17
  enabled: boolean;
13
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
14
18
  constructor(components: Components);
15
- /**
16
- * {@link Component.uuid}.
17
- * @return the list of UUIDs of deleted components.
18
- */
19
- get(): Set<string>;
20
- /**
21
- * Removes a mesh, its geometry and its materials from memory. If you are
22
- * using any of these in other parts of the application, make sure that you
23
- * remove them from the mesh before disposing it.
24
- *
25
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
26
- * to remove.
27
- *
28
- * @param materials - whether to dispose the materials of the mesh.
29
- *
30
- * @param recursive - whether to recursively dispose the children of the mesh.
31
- */
32
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
33
- /**
34
- * Disposes a geometry from memory.
35
- *
36
- * @param geometry - the
37
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
38
- * to remove.
39
- */
40
- disposeGeometry(geometry: THREE.BufferGeometry): void;
41
- private disposeGeometryAndMaterials;
42
- private disposeChildren;
43
- private static disposeMaterial;
19
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
20
+ isolate(items: FRAGS.FragmentIdMap): void;
21
+ private updateCulledVisibility;
44
22
  }
45
- import { Component, Disposable, World, Event } from "../Types";
46
- import { SimpleRaycaster } from "./src";
47
- import { Components } from "../Components";
48
- export declare class Raycasters extends Component implements Disposable {
49
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
23
+ import { Component, Disposable, Event, Components } from "../../core";
24
+ export declare class Exploder extends Component implements Disposable {
25
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
50
26
  enabled: boolean;
51
- list: Map<string, SimpleRaycaster>;
52
- onDisposed: Event<unknown>;
27
+ height: number;
28
+ groupName: string;
29
+ /** {@link Disposable.onDisposed} */
30
+ readonly onDisposed: Event<unknown>;
31
+ list: Set<string>;
53
32
  constructor(components: Components);
54
- get(world: World): SimpleRaycaster;
55
- delete(world: World): void;
56
33
  dispose(): void;
34
+ set(active: boolean): void;
57
35
  }
58
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
59
- import { Components } from "../Components";
60
- import { SimpleWorld } from "./src";
61
- export declare class Worlds extends Component implements Updateable, Disposable {
62
- /**
63
- * A unique identifier for the component.
64
- * This UUID is used to register the component within the Components system.
65
- */
66
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
67
- /**
68
- * Event triggered after the update process of all worlds.
69
- * Subscribers can listen to this event to perform actions post-update.
70
- */
71
- readonly onAfterUpdate: Event<unknown>;
72
- /**
73
- * Event triggered before the update process of all worlds.
74
- * Subscribers can listen to this event to perform actions pre-update.
75
- */
76
- readonly onBeforeUpdate: Event<unknown>;
77
- /**
78
- * Event triggered when the Worlds component is disposed.
79
- * Subscribers can listen to this event to perform cleanup actions.
80
- */
81
- readonly onDisposed: Event<unknown>;
82
- /**
83
- * A collection of worlds managed by this component.
84
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
85
- */
86
- list: Map<string, World>;
87
- /**
88
- * A flag indicating whether the Worlds component is enabled.
89
- * If false, the update process will be skipped.
90
- */
36
+ import * as THREE from "three";
37
+ import * as FRAGS from "@thatopen/fragments";
38
+ import { Disposable, Component, Event, Components } from "../../core";
39
+ export interface Classification {
40
+ [system: string]: {
41
+ [className: string]: FRAGS.FragmentIdMap;
42
+ };
43
+ }
44
+ export declare class Classifier extends Component implements Disposable {
45
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
46
+ /** {@link Component.enabled} */
91
47
  enabled: boolean;
48
+ list: Classification;
49
+ /** {@link Disposable.onDisposed} */
50
+ readonly onDisposed: Event<unknown>;
92
51
  constructor(components: Components);
93
- /**
94
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
95
- *
96
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
97
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
98
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
99
- *
100
- * @returns {SimpleWorld<T, U, S>} - The newly created SimpleWorld instance.
101
- *
102
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
103
- */
104
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
105
- delete(world: World): void;
52
+ private onFragmentsDisposed;
106
53
  dispose(): void;
107
- update(delta?: number): void | Promise<void>;
54
+ remove(guid: string): void;
55
+ find(filter?: {
56
+ [name: string]: string[];
57
+ }): FRAGS.FragmentIdMap;
58
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
59
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
60
+ byEntity(group: FRAGS.FragmentsGroup): void;
61
+ byStorey(group: FRAGS.FragmentsGroup): void;
62
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
63
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
64
+ resetColor(items: FRAGS.FragmentIdMap): void;
65
+ private saveItem;
108
66
  }
109
- import { MiniMap } from "./src";
110
- import { Component, Updateable, World, Event, Disposable } from "../Types";
111
- import { Components } from "../Components";
112
- export declare class MiniMaps extends Component implements Updateable, Disposable {
113
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
114
- readonly onAfterUpdate: Event<unknown>;
115
- readonly onBeforeUpdate: Event<unknown>;
116
- readonly onDisposed: Event<unknown>;
67
+ import * as THREE from "three";
68
+ import * as FRAGS from "@thatopen/fragments";
69
+ import { FragmentsGroup } from "@thatopen/fragments";
70
+ import { Component, Components, Disposable, Event } from "../../core";
71
+ /**
72
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
73
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
74
+ */
75
+ export declare class BoundingBoxer extends Component implements Disposable {
76
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
77
+ /** {@link Component.enabled} */
117
78
  enabled: boolean;
118
- list: Map<string, MiniMap>;
79
+ /** {@link Disposable.onDisposed} */
80
+ readonly onDisposed: Event<unknown>;
81
+ private _absoluteMin;
82
+ private _absoluteMax;
83
+ private _meshes;
119
84
  constructor(components: Components);
120
- create(world: World): MiniMap;
121
- delete(id: string): void;
85
+ static getDimensions(bbox: THREE.Box3): {
86
+ width: number;
87
+ height: number;
88
+ depth: number;
89
+ center: THREE.Vector3;
90
+ };
91
+ static newBound(positive: boolean): THREE.Vector3;
92
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
93
+ /** {@link Disposable.dispose} */
122
94
  dispose(): void;
123
- update(): void;
95
+ get(): THREE.Box3;
96
+ getSphere(): THREE.Sphere;
97
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
98
+ reset(): void;
99
+ add(group: FragmentsGroup): void;
100
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
101
+ private static getFragmentBounds;
124
102
  }
125
- import { Component, Disposable, World, Event } from "../Types";
126
- import { GridConfig, SimpleGrid } from "./src";
127
- export declare class Grids extends Component implements Disposable {
128
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
129
- list: Map<string, SimpleGrid>;
130
- onDisposed: Event<unknown>;
131
- config: Required<GridConfig>;
132
- /** {@link Component.enabled} */
103
+ import * as WEBIFC from "web-ifc";
104
+ import { Components, Disposable, Event, Component } from "../../core";
105
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
106
+ export declare class IfcGeometryTiler extends Component implements Disposable {
107
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
108
+ onGeometryStreamed: Event<{
109
+ buffer: Uint8Array;
110
+ data: StreamedGeometries;
111
+ }>;
112
+ onAssetStreamed: Event<StreamedAsset[]>;
113
+ onProgress: Event<number>;
114
+ onIfcLoaded: Event<Uint8Array>;
115
+ /** {@link Disposable.onDisposed} */
116
+ readonly onDisposed: Event<unknown>;
117
+ settings: IfcStreamingSettings;
133
118
  enabled: boolean;
134
- create(world: World): SimpleGrid;
135
- delete(world: World): void;
119
+ webIfc: WEBIFC.IfcAPI;
120
+ private _spatialTree;
121
+ private _metaData;
122
+ private _visitedGeometries;
123
+ private _streamSerializer;
124
+ private _geometries;
125
+ private _geometryCount;
126
+ private _civil;
127
+ private _groupSerializer;
128
+ private _assets;
129
+ private _meshesWithHoles;
130
+ constructor(components: Components);
136
131
  dispose(): void;
132
+ streamFromBuffer(data: Uint8Array): Promise<void>;
133
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
134
+ private readIfcFile;
135
+ private streamIfcFile;
136
+ private streamAllGeometries;
137
+ private cleanUp;
138
+ private getMesh;
139
+ private getGeometry;
140
+ private streamAssets;
141
+ private streamGeometries;
137
142
  }
143
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
138
144
  import * as THREE from "three";
139
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
140
- import { SimplePlane } from "./src";
141
- import { Components } from "../Components";
145
+ import * as FRAGS from "@thatopen/fragments";
146
+ import { Component, Components, Event, Disposable } from "../../core";
147
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
142
148
  /**
143
- * A lightweight component to easily create and handle
144
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
145
- *
146
- * @param components - the instance of {@link Components} used.
147
- * E.g. {@link SimplePlane}.
149
+ * Object that can efficiently load binary files that contain
150
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
148
151
  */
149
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
150
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
151
- /** {@link Createable.onAfterCreate} */
152
- readonly onAfterCreate: Event<SimplePlane>;
153
- /** {@link Createable.onAfterDelete} */
154
- readonly onAfterDelete: Event<SimplePlane>;
155
- /** Event that fires when the user starts dragging a clipping plane. */
156
- readonly onBeforeDrag: Event<void>;
157
- /** Event that fires when the user stops dragging a clipping plane. */
158
- readonly onAfterDrag: Event<void>;
159
- readonly onBeforeCreate: Event<unknown>;
160
- readonly onBeforeCancel: Event<unknown>;
161
- readonly onAfterCancel: Event<unknown>;
162
- readonly onBeforeDelete: Event<unknown>;
152
+ export declare class FragmentsManager extends Component implements Disposable {
153
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
163
154
  /** {@link Disposable.onDisposed} */
164
- readonly onDisposed: Event<string>;
155
+ readonly onDisposed: Event<unknown>;
156
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
157
+ readonly onFragmentsDisposed: Event<{
158
+ groupID: string;
159
+ fragmentIDs: string[];
160
+ }>;
161
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
162
+ readonly list: Map<string, Fragment>;
163
+ readonly groups: Map<string, FragmentsGroup>;
164
+ /** {@link Component.enabled} */
165
+ enabled: boolean;
166
+ baseCoordinationModel: string;
167
+ private _loader;
168
+ /** The list of meshes of the created fragments. */
169
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
170
+ constructor(components: Components);
171
+ /** {@link Disposable.dispose} */
172
+ dispose(): void;
173
+ disposeGroup(group: FragmentsGroup): void;
165
174
  /**
166
- * Whether to force the clipping plane to be orthogonal in the Y direction
167
- * (up). This is desirable when clipping a building horizontally and a
168
- * clipping plane is created in its roof, which might have a slight
169
- * slope for draining purposes.
175
+ * Loads a binar file that contain fragment geometry.
176
+ * @param data - The binary data to load.
177
+ * @param config - Optional configuration for loading.
178
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
179
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
180
+ * @returns The loaded FragmentsGroup.
170
181
  */
171
- orthogonalY: boolean;
182
+ load(data: Uint8Array, config?: Partial<{
183
+ coordinate: boolean;
184
+ properties: FRAGS.IfcProperties;
185
+ relationsMap: RelationsMap;
186
+ }>): FragmentsGroup;
172
187
  /**
173
- * The tolerance that determines whether an almost-horizontal clipping plane
174
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
175
- * has to be 'true' for this to apply.
188
+ * Export the specified fragments.
189
+ * @param group - the fragments group to be exported.
190
+ * @returns the exported data as binary buffer.
176
191
  */
177
- toleranceOrthogonalY: number;
178
- Type: new (...args: any) => SimplePlane;
179
- list: SimplePlane[];
180
- /** The material used in all the clipping planes. */
192
+ export(group: FragmentsGroup): Uint8Array;
193
+ coordinate(models?: FragmentsGroup[]): void;
194
+ }
195
+ import * as WEBIFC from "web-ifc";
196
+ import * as FRAGS from "@thatopen/fragments";
197
+ import { IfcFragmentSettings } from "./src";
198
+ import { Component, Components, Event, Disposable } from "../../core";
199
+ export declare class IfcLoader extends Component implements Disposable {
200
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
201
+ readonly onIfcStartedLoading: Event<void>;
202
+ readonly onSetup: Event<void>;
203
+ /** {@link Disposable.onDisposed} */
204
+ readonly onDisposed: Event<string>;
205
+ settings: IfcFragmentSettings;
206
+ enabled: boolean;
207
+ webIfc: WEBIFC.IfcAPI;
181
208
  private _material;
182
- private _size;
209
+ private _spatialTree;
210
+ private _metaData;
211
+ private _fragmentInstances;
212
+ private _civil;
213
+ private _visitedFragments;
214
+ private _materialT;
215
+ constructor(components: Components);
216
+ dispose(): void;
217
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
218
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
219
+ readIfcFile(data: Uint8Array): Promise<number>;
220
+ private getAllGeometries;
221
+ cleanUp(): void;
222
+ private getMesh;
223
+ private getGeometry;
224
+ private autoSetWasm;
225
+ }
226
+ import * as WEBIFC from "web-ifc";
227
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
228
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
229
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
230
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
231
+ onPropertiesStreamed: AsyncEvent<{
232
+ type: number;
233
+ data: {
234
+ [id: number]: any;
235
+ };
236
+ }>;
237
+ onProgress: AsyncEvent<number>;
238
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
239
+ /** {@link Disposable.onDisposed} */
240
+ readonly onDisposed: Event<string>;
241
+ enabled: boolean;
242
+ settings: PropertiesStreamingSettings;
243
+ webIfc: WEBIFC.IfcAPI;
244
+ dispose(): Promise<void>;
245
+ streamFromBuffer(data: Uint8Array): Promise<void>;
246
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
247
+ private readIfcFile;
248
+ private streamIfcFile;
249
+ private streamAllProperties;
250
+ private cleanUp;
251
+ }
252
+ export declare class UUID {
253
+ private static _pattern;
254
+ private static _lut;
255
+ static create(): string;
256
+ static validate(uuid: string): void;
257
+ }
258
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
259
+ import * as THREE from "three";
260
+ import { Component, Components, Event, World } from "../core";
261
+ export interface VertexPickerConfig {
262
+ showOnlyVertex: boolean;
263
+ snapDistance: number;
264
+ previewElement: HTMLElement;
265
+ }
266
+ export declare class VertexPicker extends Component {
267
+ onVertexFound: Event<THREE.Vector3>;
268
+ onVertexLost: Event<THREE.Vector3>;
269
+ components: Components;
270
+ private _pickedPoint;
271
+ private _config;
183
272
  private _enabled;
184
- private _visible;
185
- /** {@link Component.enabled} */
273
+ private _workingPlane;
274
+ set enabled(value: boolean);
186
275
  get enabled(): boolean;
276
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
277
+ set workingPlane(plane: THREE.Plane | null);
278
+ get workingPlane(): THREE.Plane | null;
279
+ set config(value: Partial<VertexPickerConfig>);
280
+ get config(): Partial<VertexPickerConfig>;
281
+ dispose(): void;
282
+ get(world: World): THREE.Vector3 | null;
283
+ private getClosestVertex;
284
+ private getVertices;
285
+ private getVertex;
286
+ }
287
+ import * as WEBIFC from "web-ifc";
288
+ import * as FRAG from "@thatopen/fragments";
289
+ import { Component, Components } from "../../core";
290
+ /**
291
+ * Object to export all the properties from an IFC to a JS object.
292
+ */
293
+ export declare class IfcJsonExporter extends Component {
294
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
187
295
  /** {@link Component.enabled} */
188
- set enabled(state: boolean);
189
- /** {@link Hideable.visible } */
190
- get visible(): boolean;
191
- /** {@link Hideable.visible } */
192
- set visible(state: boolean);
193
- /** The material of the clipping plane representation. */
194
- get material(): THREE.MeshBasicMaterial;
195
- /** The material of the clipping plane representation. */
196
- set material(material: THREE.MeshBasicMaterial);
197
- /** The size of the geometric representation of the clippings planes. */
198
- get size(): number;
199
- /** The size of the geometric representation of the clippings planes. */
200
- set size(size: number);
296
+ enabled: boolean;
297
+ constructor(components: Components);
298
+ /**
299
+ * Exports all the properties of an IFC into an array of JS objects.
300
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
301
+ * @param modelID ID of the IFC model whose properties to extract.
302
+ * @param indirect whether to get the indirect relationships as well.
303
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
304
+ * to make the location data available (e.g. absolute position of building).
305
+ */
306
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
307
+ }
308
+ import * as WEBIFC from "web-ifc";
309
+ import { FragmentsGroup } from "@thatopen/fragments";
310
+ import { Component, Disposable, Event, Components } from "../../core";
311
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
312
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
313
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
314
+ interface ChangeMap {
315
+ [modelID: string]: Set<number>;
316
+ }
317
+ interface AttributeListener {
318
+ [modelID: string]: {
319
+ [expressID: number]: {
320
+ [attributeName: string]: Event<String | Boolean | Number>;
321
+ };
322
+ };
323
+ }
324
+ export declare class IfcPropertiesManager extends Component implements Disposable {
325
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
326
+ /** {@link Disposable.onDisposed} */
327
+ readonly onDisposed: Event<string>;
328
+ readonly onRequestFile: Event<unknown>;
329
+ ifcToExport: ArrayBuffer | null;
330
+ readonly onElementToPset: Event<{
331
+ model: FragmentsGroup;
332
+ psetID: number;
333
+ elementID: number;
334
+ }>;
335
+ readonly onPropToPset: Event<{
336
+ model: FragmentsGroup;
337
+ psetID: number;
338
+ propID: number;
339
+ }>;
340
+ readonly onPsetRemoved: Event<{
341
+ model: FragmentsGroup;
342
+ psetID: number;
343
+ }>;
344
+ readonly onDataChanged: Event<{
345
+ model: FragmentsGroup;
346
+ expressID: number;
347
+ }>;
348
+ wasm: {
349
+ path: string;
350
+ absolute: boolean;
351
+ };
352
+ enabled: boolean;
353
+ attributeListeners: AttributeListener;
354
+ selectedModel?: FragmentsGroup;
355
+ changeMap: ChangeMap;
201
356
  constructor(components: Components);
202
- /** {@link Disposable.dispose} */
203
357
  dispose(): void;
204
- /** {@link Createable.create} */
205
- create(world: World): void;
358
+ private increaseMaxID;
359
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
360
+ private newGUID;
361
+ private getOwnerHistory;
362
+ private registerChange;
363
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
364
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
365
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
366
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
367
+ }>;
368
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
369
+ private newSingleProperty;
370
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
371
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
372
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
373
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
374
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
375
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
376
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
377
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
378
+ }
379
+ export {};
380
+ import * as WEBIFC from "web-ifc";
381
+ import { FragmentsGroup } from "@thatopen/fragments";
382
+ import { Disposable, Event, Component, Components } from "../../core";
383
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
384
+ /**
385
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
386
+ * 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.
387
+ */
388
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
389
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
390
+ /** {@link Disposable.onDisposed} */
391
+ readonly onDisposed: Event<string>;
392
+ enabled: boolean;
393
+ readonly onRelationsIndexed: Event<{
394
+ modelID: string;
395
+ relationsMap: RelationsMap;
396
+ }>;
397
+ private _relToAttributesMap;
398
+ private _inverseAttributes;
399
+ private _ifcRels;
206
400
  /**
207
- * Creates a plane in a certain place and with a certain orientation,
208
- * without the need of the mouse.
401
+ * Holds the relationship mappings for each model processed by the indexer.
402
+ * The structure is a map where each key is a model's UUID, and the value is another map.
403
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
404
+ * representing a specific relation type, and the value is an array of expressIDs of entities
405
+ * that are related through that relation type. This structure allows for efficient querying
406
+ * of entity relationships within a model.
407
+ */
408
+ readonly relationMaps: ModelsRelationMap;
409
+ constructor(components: Components);
410
+ private onFragmentsDisposed;
411
+ /**
412
+ * Adds a relation map to the model's relations map.
209
413
  *
210
- * @param world - the world where this plane should be created.
211
- * @param normal - the orientation of the clipping plane.
212
- * @param point - the position of the clipping plane.
213
- * navigation.
414
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
415
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
416
+ *
417
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
214
418
  */
215
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
419
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
216
420
  /**
217
- * {@link Createable.delete}
421
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
422
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
423
+ * and maps them in a structured way to facilitate quick access to related entities.
218
424
  *
219
- * @param world - the world where the plane to delete is.
220
- * @param plane - the plane to delete. If undefined, the first plane
221
- * found under the cursor will be deleted.
425
+ * The process involves querying the model for each relation type associated with the inverse attributes
426
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
427
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
428
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
429
+ * of entities that are related through that attribute.
430
+ *
431
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
432
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
433
+ * representation of the relations indexed by entity expressIDs and relation types.
434
+ * @throws An error if the model does not have properties loaded.
222
435
  */
223
- delete(world: World, plane?: SimplePlane): void;
224
- /** Deletes all the existing clipping planes. */
225
- deleteAll(): void;
226
- private deletePlane;
227
- private pickPlane;
228
- private getAllPlaneMeshes;
229
- private createPlaneFromIntersection;
230
- private getWorldNormal;
231
- private normalizePlaneDirectionY;
232
- private newPlane;
233
- private updateMaterialsAndPlanes;
234
- private _onStartDragging;
235
- private _onEndDragging;
436
+ process(model: FragmentsGroup): Promise<RelationsMap>;
437
+ /**
438
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
439
+ *
440
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
441
+ * @param modelID - The unique identifier of the model within the WebIfc API.
442
+ * @returns A promise that resolves to the relations map for the processed model.
443
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
444
+ */
445
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
446
+ /**
447
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
448
+ * This method searches the indexed relation maps for the specified model and entity,
449
+ * returning the IDs of related entities if a match is found.
450
+ *
451
+ * @param model The 'FragmentsGroup' model containing the entity.
452
+ * @param expressID The unique identifier of the entity within the model.
453
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
454
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
455
+ * or the specified relation name is not indexed.
456
+ */
457
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
458
+ /**
459
+ * Serializes the relations of a given relation map into a JSON string.
460
+ * 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,
461
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
462
+ * The resulting object is then serialized into a JSON string.
463
+ *
464
+ * @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.
465
+ * @returns A JSON string representing the serialized relations of the given relation map.
466
+ */
467
+ serializeRelations(relationMap: RelationsMap): string;
468
+ /**
469
+ * Serializes the relations of a specific model into a JSON string.
470
+ * This method iterates through the relations indexed for the given model,
471
+ * organizing them into a structured object where each key is an expressID of an entity,
472
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
473
+ * The resulting object is then serialized into a JSON string.
474
+ *
475
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
476
+ * @returns A JSON string representing the serialized relations of the specified model.
477
+ * If the model has no indexed relations, 'null' is returned.
478
+ */
479
+ serializeModelRelations(model: FragmentsGroup): string | null;
480
+ /**
481
+ * Serializes all relations of every model processed by the indexer into a JSON string.
482
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
483
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
484
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
485
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
486
+ *
487
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
488
+ * If no relations have been indexed, an empty object is returned as a JSON string.
489
+ */
490
+ serializeAllRelations(): string;
491
+ /**
492
+ * Converts a JSON string representing relations between entities into a structured map.
493
+ * This method parses the JSON string to reconstruct the relations map that indexes
494
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
495
+ * and the values are maps where each key is a relation type ID and its value is an array
496
+ * of express IDs of entities related through that relation type.
497
+ *
498
+ * @param json The JSON string to be parsed into the relations map.
499
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
500
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
501
+ * is an array of express IDs (as numbers) of entities related through that relation type.
502
+ */
503
+ getRelationsMapFromJSON(json: string): RelationsMap;
504
+ /**
505
+ * Disposes the component, cleaning up resources and detaching event listeners.
506
+ * This ensures that the component is properly cleaned up and does not leave behind any
507
+ * references that could prevent garbage collection.
508
+ */
509
+ dispose(): void;
236
510
  }
511
+ export type { InverseAttribute } from "./src/types";
237
512
  import { Component, Disposable, Event } from "../Types";
238
513
  /**
239
514
  * The entry point of the Components library.
@@ -281,496 +556,358 @@ export declare class Components implements Disposable {
281
556
  * You can learn more about how Three.js handles memory leaks
282
557
  * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
283
558
  *
284
- */
285
- dispose(): void;
286
- private update;
287
- private static setupBVH;
288
- }
289
- import { Components } from "../Components";
290
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
291
- import { Component, Event, Disposable, World } from "../Types";
292
- /**
293
- * A tool to handle big scenes efficiently by automatically hiding the objects
294
- * that are not visible to the camera.
295
- */
296
- export declare class Cullers extends Component implements Disposable {
297
- /**
298
- * A unique identifier for the Cullers component.
299
- */
300
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
301
- /**
302
- * Indicates whether the Cullers component is enabled.
303
- */
304
- private _enabled;
305
- /**
306
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
307
- */
308
- list: Map<string, MeshCullerRenderer>;
309
- /**
310
- * An event that is triggered when the Cullers component is disposed.
311
- */
312
- readonly onDisposed: Event<unknown>;
313
- /**
314
- * Gets the enabled state of the Cullers component.
315
- *
316
- * @returns The current enabled state.
317
- */
318
- get enabled(): boolean;
319
- /**
320
- * Sets the enabled state of the Cullers component.
321
- * Also sets the enabled state of all MeshCullerRenderer instances.
322
- *
323
- * @param value - The new enabled state.
324
- */
325
- set enabled(value: boolean);
326
- constructor(components: Components);
327
- /**
328
- * Creates a new MeshCullerRenderer for the given world.
329
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
330
- *
331
- * @param world - The world for which to create the MeshCullerRenderer.
332
- * @param config - Optional configuration settings for the MeshCullerRenderer.
333
- *
334
- * @returns The newly created or existing MeshCullerRenderer for the given world.
335
- */
336
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
337
- delete(world: World): void;
338
- /** {@link Disposable.dispose} */
559
+ */
339
560
  dispose(): void;
561
+ private update;
562
+ private static setupBVH;
340
563
  }
341
564
  import * as THREE from "three";
342
565
  import { Components } from "../Components";
343
- import { SimpleCamera } from "..";
344
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
566
+ import { Component } from "../Types";
345
567
  /**
346
- * A flexible camera that uses
347
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
348
- * easily control the camera in 2D and 3D. It supports multiple navigation
349
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
568
+ * A tool to safely remove meshes and geometries from memory to
569
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
350
570
  */
351
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
352
- /**
353
- * The current {@link NavigationMode}.
354
- */
355
- _mode: NavigationMode | null;
356
- readonly projection: ProjectionManager;
357
- readonly threeOrtho: THREE.OrthographicCamera;
358
- readonly threePersp: THREE.PerspectiveCamera;
359
- protected readonly _userInputButtons: any;
360
- protected readonly _frustumSize = 50;
361
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
362
- get mode(): NavigationMode;
571
+ export declare class Disposer extends Component {
572
+ private _disposedComponents;
573
+ /** {@link Component.enabled} */
574
+ enabled: boolean;
575
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
363
576
  constructor(components: Components);
364
- /** {@link Disposable.dispose} */
365
- dispose(): void;
366
577
  /**
367
- * Sets a new {@link NavigationMode} and disables the previous one.
368
- *
369
- * @param mode - The {@link NavigationMode} to set.
578
+ * {@link Component.uuid}.
579
+ * @return the list of UUIDs of deleted components.
370
580
  */
371
- set(mode: NavModeID): void;
581
+ get(): Set<string>;
372
582
  /**
373
- * Make the camera view fit all the specified meshes.
583
+ * Removes a mesh, its geometry and its materials from memory. If you are
584
+ * using any of these in other parts of the application, make sure that you
585
+ * remove them from the mesh before disposing it.
374
586
  *
375
- * @param meshes the meshes to fit. If it is not defined, it will
376
- * evaluate {@link Components.meshes}.
377
- * @param offset the distance to the fit object
587
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
588
+ * to remove.
589
+ *
590
+ * @param materials - whether to dispose the materials of the mesh.
591
+ *
592
+ * @param recursive - whether to recursively dispose the children of the mesh.
378
593
  */
379
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
594
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
380
595
  /**
381
- * Allows or prevents all user input.
596
+ * Disposes a geometry from memory.
382
597
  *
383
- * @param active - whether to enable or disable user inputs.
598
+ * @param geometry - the
599
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
600
+ * to remove.
384
601
  */
385
- setUserInput(active: boolean): void;
386
- private disableUserInput;
387
- private enableUserInput;
388
- private newOrthoCamera;
389
- private setOrthoCameraAspect;
390
- }
391
- import * as THREE from "three";
392
- import * as FRAGS from "@thatopen/fragments";
393
- import { FragmentsGroup } from "@thatopen/fragments";
394
- import { Component, Components, Disposable, Event } from "../../core";
395
- /**
396
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
397
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
398
- */
399
- export declare class BoundingBoxer extends Component implements Disposable {
400
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
401
- /** {@link Component.enabled} */
402
- enabled: boolean;
403
- /** {@link Disposable.onDisposed} */
404
- readonly onDisposed: Event<unknown>;
405
- private _absoluteMin;
406
- private _absoluteMax;
407
- private _meshes;
408
- constructor(components: Components);
409
- static getDimensions(bbox: THREE.Box3): {
410
- width: number;
411
- height: number;
412
- depth: number;
413
- center: THREE.Vector3;
414
- };
415
- static newBound(positive: boolean): THREE.Vector3;
416
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
417
- /** {@link Disposable.dispose} */
418
- dispose(): void;
419
- get(): THREE.Box3;
420
- getSphere(): THREE.Sphere;
421
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
422
- reset(): void;
423
- add(group: FragmentsGroup): void;
424
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
425
- private static getFragmentBounds;
426
- }
427
- import * as THREE from "three";
428
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
429
- center: THREE.Vector3;
430
- halfSizes: THREE.Vector3;
431
- rotation: THREE.Matrix3;
432
- transformation: THREE.Matrix4;
433
- };
434
- import * as FRAGS from "@thatopen/fragments";
435
- import { Components, Component } from "../../core";
436
- export declare class FragmentHider extends Component {
437
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
438
- enabled: boolean;
439
- constructor(components: Components);
440
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
441
- isolate(items: FRAGS.FragmentIdMap): void;
442
- private updateCulledVisibility;
443
- }
444
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
445
- import * as THREE from "three";
446
- export declare class MaterialsUtils {
447
- static isTransparent(material: THREE.Material): boolean;
448
- }
449
- import * as THREE from "three";
450
- import * as FRAGS from "@thatopen/fragments";
451
- import { Disposable, Component, Event, Components } from "../../core";
452
- export interface Classification {
453
- [system: string]: {
454
- [className: string]: FRAGS.FragmentIdMap;
455
- };
602
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
603
+ private disposeGeometryAndMaterials;
604
+ private disposeChildren;
605
+ private static disposeMaterial;
456
606
  }
457
- export declare class Classifier extends Component implements Disposable {
458
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
459
- /** {@link Component.enabled} */
607
+ import { Component, Disposable, World, Event } from "../Types";
608
+ import { SimpleRaycaster } from "./src";
609
+ import { Components } from "../Components";
610
+ export declare class Raycasters extends Component implements Disposable {
611
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
460
612
  enabled: boolean;
461
- list: Classification;
462
- /** {@link Disposable.onDisposed} */
463
- readonly onDisposed: Event<unknown>;
613
+ list: Map<string, SimpleRaycaster>;
614
+ onDisposed: Event<unknown>;
464
615
  constructor(components: Components);
465
- private onFragmentsDisposed;
616
+ get(world: World): SimpleRaycaster;
617
+ delete(world: World): void;
466
618
  dispose(): void;
467
- remove(guid: string): void;
468
- find(filter?: {
469
- [name: string]: string[];
470
- }): FRAGS.FragmentIdMap;
471
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
472
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
473
- byEntity(group: FRAGS.FragmentsGroup): void;
474
- byStorey(group: FRAGS.FragmentsGroup): void;
475
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
476
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
477
- resetColor(items: FRAGS.FragmentIdMap): void;
478
- private saveItem;
479
619
  }
480
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
481
620
  import * as THREE from "three";
482
- import * as FRAGS from "@thatopen/fragments";
483
- import { Component, Components, Event, Disposable } from "../../core";
484
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
621
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
622
+ import { SimplePlane } from "./src";
623
+ import { Components } from "../Components";
485
624
  /**
486
- * Object that can efficiently load binary files that contain
487
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
625
+ * A lightweight component to easily create and handle
626
+ * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
627
+ *
628
+ * @param components - the instance of {@link Components} used.
629
+ * E.g. {@link SimplePlane}.
488
630
  */
489
- export declare class FragmentsManager extends Component implements Disposable {
490
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
631
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
632
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
633
+ /** {@link Createable.onAfterCreate} */
634
+ readonly onAfterCreate: Event<SimplePlane>;
635
+ /** {@link Createable.onAfterDelete} */
636
+ readonly onAfterDelete: Event<SimplePlane>;
637
+ /** Event that fires when the user starts dragging a clipping plane. */
638
+ readonly onBeforeDrag: Event<void>;
639
+ /** Event that fires when the user stops dragging a clipping plane. */
640
+ readonly onAfterDrag: Event<void>;
641
+ readonly onBeforeCreate: Event<unknown>;
642
+ readonly onBeforeCancel: Event<unknown>;
643
+ readonly onAfterCancel: Event<unknown>;
644
+ readonly onBeforeDelete: Event<unknown>;
491
645
  /** {@link Disposable.onDisposed} */
492
- readonly onDisposed: Event<unknown>;
493
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
494
- readonly onFragmentsDisposed: Event<{
495
- groupID: string;
496
- fragmentIDs: string[];
497
- }>;
498
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
499
- readonly list: Map<string, Fragment>;
500
- readonly groups: Map<string, FragmentsGroup>;
646
+ readonly onDisposed: Event<string>;
647
+ /**
648
+ * Whether to force the clipping plane to be orthogonal in the Y direction
649
+ * (up). This is desirable when clipping a building horizontally and a
650
+ * clipping plane is created in its roof, which might have a slight
651
+ * slope for draining purposes.
652
+ */
653
+ orthogonalY: boolean;
654
+ /**
655
+ * The tolerance that determines whether an almost-horizontal clipping plane
656
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
657
+ * has to be 'true' for this to apply.
658
+ */
659
+ toleranceOrthogonalY: number;
660
+ Type: new (...args: any) => SimplePlane;
661
+ list: SimplePlane[];
662
+ /** The material used in all the clipping planes. */
663
+ private _material;
664
+ private _size;
665
+ private _enabled;
666
+ private _visible;
501
667
  /** {@link Component.enabled} */
502
- enabled: boolean;
503
- baseCoordinationModel: string;
504
- private _loader;
505
- /** The list of meshes of the created fragments. */
506
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
668
+ get enabled(): boolean;
669
+ /** {@link Component.enabled} */
670
+ set enabled(state: boolean);
671
+ /** {@link Hideable.visible } */
672
+ get visible(): boolean;
673
+ /** {@link Hideable.visible } */
674
+ set visible(state: boolean);
675
+ /** The material of the clipping plane representation. */
676
+ get material(): THREE.MeshBasicMaterial;
677
+ /** The material of the clipping plane representation. */
678
+ set material(material: THREE.MeshBasicMaterial);
679
+ /** The size of the geometric representation of the clippings planes. */
680
+ get size(): number;
681
+ /** The size of the geometric representation of the clippings planes. */
682
+ set size(size: number);
507
683
  constructor(components: Components);
508
684
  /** {@link Disposable.dispose} */
509
685
  dispose(): void;
510
- disposeGroup(group: FragmentsGroup): void;
686
+ /** {@link Createable.create} */
687
+ create(world: World): void;
511
688
  /**
512
- * Loads a binar file that contain fragment geometry.
513
- * @param data - The binary data to load.
514
- * @param config - Optional configuration for loading.
515
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
516
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
517
- * @returns The loaded FragmentsGroup.
689
+ * Creates a plane in a certain place and with a certain orientation,
690
+ * without the need of the mouse.
691
+ *
692
+ * @param world - the world where this plane should be created.
693
+ * @param normal - the orientation of the clipping plane.
694
+ * @param point - the position of the clipping plane.
695
+ * navigation.
518
696
  */
519
- load(data: Uint8Array, config?: Partial<{
520
- coordinate: boolean;
521
- properties: FRAGS.IfcProperties;
522
- relationsMap: RelationsMap;
523
- }>): FragmentsGroup;
697
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
524
698
  /**
525
- * Export the specified fragments.
526
- * @param group - the fragments group to be exported.
527
- * @returns the exported data as binary buffer.
699
+ * {@link Createable.delete}
700
+ *
701
+ * @param world - the world where the plane to delete is.
702
+ * @param plane - the plane to delete. If undefined, the first plane
703
+ * found under the cursor will be deleted.
528
704
  */
529
- export(group: FragmentsGroup): Uint8Array;
530
- coordinate(models?: FragmentsGroup[]): void;
705
+ delete(world: World, plane?: SimplePlane): void;
706
+ /** Deletes all the existing clipping planes. */
707
+ deleteAll(): void;
708
+ private deletePlane;
709
+ private pickPlane;
710
+ private getAllPlaneMeshes;
711
+ private createPlaneFromIntersection;
712
+ private getWorldNormal;
713
+ private normalizePlaneDirectionY;
714
+ private newPlane;
715
+ private updateMaterialsAndPlanes;
716
+ private _onStartDragging;
717
+ private _onEndDragging;
531
718
  }
532
- import { Component, Disposable, Event, Components } from "../../core";
533
- export declare class Exploder extends Component implements Disposable {
534
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
535
- enabled: boolean;
536
- height: number;
537
- groupName: string;
538
- /** {@link Disposable.onDisposed} */
719
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
720
+ import { Components } from "../Components";
721
+ import { SimpleWorld } from "./src";
722
+ export declare class Worlds extends Component implements Updateable, Disposable {
723
+ /**
724
+ * A unique identifier for the component.
725
+ * This UUID is used to register the component within the Components system.
726
+ */
727
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
728
+ /**
729
+ * Event triggered after the update process of all worlds.
730
+ * Subscribers can listen to this event to perform actions post-update.
731
+ */
732
+ readonly onAfterUpdate: Event<unknown>;
733
+ /**
734
+ * Event triggered before the update process of all worlds.
735
+ * Subscribers can listen to this event to perform actions pre-update.
736
+ */
737
+ readonly onBeforeUpdate: Event<unknown>;
738
+ /**
739
+ * Event triggered when the Worlds component is disposed.
740
+ * Subscribers can listen to this event to perform cleanup actions.
741
+ */
539
742
  readonly onDisposed: Event<unknown>;
540
- list: Set<string>;
541
- constructor(components: Components);
542
- dispose(): void;
543
- set(active: boolean): void;
544
- }
545
- import * as WEBIFC from "web-ifc";
546
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
547
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
548
- export declare class IfcPropertiesTiler extends Component implements Disposable {
549
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
550
- onPropertiesStreamed: AsyncEvent<{
551
- type: number;
552
- data: {
553
- [id: number]: any;
554
- };
555
- }>;
556
- onProgress: AsyncEvent<number>;
557
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
558
- /** {@link Disposable.onDisposed} */
559
- readonly onDisposed: Event<string>;
560
- enabled: boolean;
561
- settings: PropertiesStreamingSettings;
562
- webIfc: WEBIFC.IfcAPI;
563
- dispose(): Promise<void>;
564
- streamFromBuffer(data: Uint8Array): Promise<void>;
565
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
566
- private readIfcFile;
567
- private streamIfcFile;
568
- private streamAllProperties;
569
- private cleanUp;
570
- }
571
- import * as WEBIFC from "web-ifc";
572
- import * as FRAGS from "@thatopen/fragments";
573
- import { IfcFragmentSettings } from "./src";
574
- import { Component, Components, Event, Disposable } from "../../core";
575
- export declare class IfcLoader extends Component implements Disposable {
576
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
577
- readonly onIfcStartedLoading: Event<void>;
578
- readonly onSetup: Event<void>;
579
- /** {@link Disposable.onDisposed} */
580
- readonly onDisposed: Event<string>;
581
- settings: IfcFragmentSettings;
743
+ /**
744
+ * A collection of worlds managed by this component.
745
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
746
+ */
747
+ list: Map<string, World>;
748
+ /**
749
+ * A flag indicating whether the Worlds component is enabled.
750
+ * If false, the update process will be skipped.
751
+ */
582
752
  enabled: boolean;
583
- webIfc: WEBIFC.IfcAPI;
584
- private _material;
585
- private _spatialTree;
586
- private _metaData;
587
- private _fragmentInstances;
588
- private _civil;
589
- private _visitedFragments;
590
- private _materialT;
591
753
  constructor(components: Components);
754
+ /**
755
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
756
+ *
757
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
758
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
759
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
760
+ *
761
+ * @returns {SimpleWorld<T, U, S>} - The newly created SimpleWorld instance.
762
+ *
763
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
764
+ */
765
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
766
+ delete(world: World): void;
592
767
  dispose(): void;
593
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
594
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
595
- readIfcFile(data: Uint8Array): Promise<number>;
596
- private getAllGeometries;
597
- cleanUp(): void;
598
- private getMesh;
599
- private getGeometry;
600
- private autoSetWasm;
768
+ update(delta?: number): void | Promise<void>;
601
769
  }
602
- import * as WEBIFC from "web-ifc";
603
- import { Components, Disposable, Event, Component } from "../../core";
604
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
605
- export declare class IfcGeometryTiler extends Component implements Disposable {
606
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
607
- onGeometryStreamed: Event<{
608
- buffer: Uint8Array;
609
- data: StreamedGeometries;
610
- }>;
611
- onAssetStreamed: Event<StreamedAsset[]>;
612
- onProgress: Event<number>;
613
- onIfcLoaded: Event<Uint8Array>;
614
- /** {@link Disposable.onDisposed} */
615
- readonly onDisposed: Event<unknown>;
616
- settings: IfcStreamingSettings;
770
+ import { Component, Disposable, World, Event } from "../Types";
771
+ import { GridConfig, SimpleGrid } from "./src";
772
+ export declare class Grids extends Component implements Disposable {
773
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
774
+ list: Map<string, SimpleGrid>;
775
+ onDisposed: Event<unknown>;
776
+ config: Required<GridConfig>;
777
+ /** {@link Component.enabled} */
617
778
  enabled: boolean;
618
- webIfc: WEBIFC.IfcAPI;
619
- private _spatialTree;
620
- private _metaData;
621
- private _visitedGeometries;
622
- private _streamSerializer;
623
- private _geometries;
624
- private _geometryCount;
625
- private _civil;
626
- private _groupSerializer;
627
- private _assets;
628
- private _meshesWithHoles;
629
- constructor(components: Components);
779
+ create(world: World): SimpleGrid;
780
+ delete(world: World): void;
630
781
  dispose(): void;
631
- streamFromBuffer(data: Uint8Array): Promise<void>;
632
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
633
- private readIfcFile;
634
- private streamIfcFile;
635
- private streamAllGeometries;
636
- private cleanUp;
637
- private getMesh;
638
- private getGeometry;
639
- private streamAssets;
640
- private streamGeometries;
641
782
  }
642
- import * as WEBIFC from "web-ifc";
643
- import { FragmentsGroup } from "@thatopen/fragments";
644
- import { Disposable, Event, Component, Components } from "../../core";
645
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
783
+ import { Components } from "../Components";
784
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
785
+ import { Component, Event, Disposable, World } from "../Types";
646
786
  /**
647
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
648
- * 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.
787
+ * A tool to handle big scenes efficiently by automatically hiding the objects
788
+ * that are not visible to the camera.
649
789
  */
650
- export declare class IfcRelationsIndexer extends Component implements Disposable {
651
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
652
- /** {@link Disposable.onDisposed} */
653
- readonly onDisposed: Event<string>;
654
- enabled: boolean;
655
- readonly onRelationsIndexed: Event<{
656
- modelID: string;
657
- relationsMap: RelationsMap;
658
- }>;
659
- private _relToAttributesMap;
660
- private _inverseAttributes;
661
- private _ifcRels;
790
+ export declare class Cullers extends Component implements Disposable {
662
791
  /**
663
- * Holds the relationship mappings for each model processed by the indexer.
664
- * The structure is a map where each key is a model's UUID, and the value is another map.
665
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
666
- * representing a specific relation type, and the value is an array of expressIDs of entities
667
- * that are related through that relation type. This structure allows for efficient querying
668
- * of entity relationships within a model.
792
+ * A unique identifier for the Cullers component.
669
793
  */
670
- readonly relationMaps: ModelsRelationMap;
671
- constructor(components: Components);
672
- private onFragmentsDisposed;
794
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
673
795
  /**
674
- * Adds a relation map to the model's relations map.
675
- *
676
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
677
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
678
- *
679
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
796
+ * Indicates whether the Cullers component is enabled.
680
797
  */
681
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
798
+ private _enabled;
682
799
  /**
683
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
684
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
685
- * and maps them in a structured way to facilitate quick access to related entities.
686
- *
687
- * The process involves querying the model for each relation type associated with the inverse attributes
688
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
689
- * and contains a nested map where each key is an entity's expressID and its value is another map.
690
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
691
- * of entities that are related through that attribute.
692
- *
693
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
694
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
695
- * representation of the relations indexed by entity expressIDs and relation types.
696
- * @throws An error if the model does not have properties loaded.
800
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
697
801
  */
698
- process(model: FragmentsGroup): Promise<RelationsMap>;
699
- /**
700
- * Processes a given model from a WebIfc API to index its IFC entities relations.
701
- *
702
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
703
- * @param modelID - The unique identifier of the model within the WebIfc API.
704
- * @returns A promise that resolves to the relations map for the processed model.
705
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
802
+ list: Map<string, MeshCullerRenderer>;
803
+ /**
804
+ * An event that is triggered when the Cullers component is disposed.
706
805
  */
707
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
806
+ readonly onDisposed: Event<unknown>;
708
807
  /**
709
- * Retrieves the relations of a specific entity within a model based on the given relation name.
710
- * This method searches the indexed relation maps for the specified model and entity,
711
- * returning the IDs of related entities if a match is found.
808
+ * Gets the enabled state of the Cullers component.
712
809
  *
713
- * @param model The 'FragmentsGroup' model containing the entity.
714
- * @param expressID The unique identifier of the entity within the model.
715
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
716
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
717
- * or the specified relation name is not indexed.
810
+ * @returns The current enabled state.
718
811
  */
719
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
812
+ get enabled(): boolean;
720
813
  /**
721
- * Serializes the relations of a given relation map into a JSON string.
722
- * 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,
723
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
724
- * The resulting object is then serialized into a JSON string.
814
+ * Sets the enabled state of the Cullers component.
815
+ * Also sets the enabled state of all MeshCullerRenderer instances.
725
816
  *
726
- * @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.
727
- * @returns A JSON string representing the serialized relations of the given relation map.
817
+ * @param value - The new enabled state.
728
818
  */
729
- serializeRelations(relationMap: RelationsMap): string;
819
+ set enabled(value: boolean);
820
+ constructor(components: Components);
730
821
  /**
731
- * Serializes the relations of a specific model into a JSON string.
732
- * This method iterates through the relations indexed for the given model,
733
- * organizing them into a structured object where each key is an expressID of an entity,
734
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
735
- * The resulting object is then serialized into a JSON string.
736
- *
737
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
738
- * @returns A JSON string representing the serialized relations of the specified model.
739
- * If the model has no indexed relations, 'null' is returned.
822
+ * Creates a new MeshCullerRenderer for the given world.
823
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
824
+ *
825
+ * @param world - The world for which to create the MeshCullerRenderer.
826
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
827
+ *
828
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
829
+ */
830
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
831
+ delete(world: World): void;
832
+ /** {@link Disposable.dispose} */
833
+ dispose(): void;
834
+ }
835
+ import { MiniMap } from "./src";
836
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
837
+ import { Components } from "../Components";
838
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
839
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
840
+ readonly onAfterUpdate: Event<unknown>;
841
+ readonly onBeforeUpdate: Event<unknown>;
842
+ readonly onDisposed: Event<unknown>;
843
+ enabled: boolean;
844
+ list: Map<string, MiniMap>;
845
+ constructor(components: Components);
846
+ create(world: World): MiniMap;
847
+ delete(id: string): void;
848
+ dispose(): void;
849
+ update(): void;
850
+ }
851
+ import * as WEBIFC from "web-ifc";
852
+ export interface IfcItemsCategories {
853
+ [itemID: number]: number;
854
+ }
855
+ export declare class IfcCategories {
856
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
857
+ }
858
+ import * as THREE from "three";
859
+ import { Components } from "../Components";
860
+ import { SimpleCamera } from "..";
861
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
862
+ /**
863
+ * A flexible camera that uses
864
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
865
+ * easily control the camera in 2D and 3D. It supports multiple navigation
866
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
867
+ */
868
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
869
+ /**
870
+ * The current {@link NavigationMode}.
740
871
  */
741
- serializeModelRelations(model: FragmentsGroup): string | null;
872
+ _mode: NavigationMode | null;
873
+ readonly projection: ProjectionManager;
874
+ readonly threeOrtho: THREE.OrthographicCamera;
875
+ readonly threePersp: THREE.PerspectiveCamera;
876
+ protected readonly _userInputButtons: any;
877
+ protected readonly _frustumSize = 50;
878
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
879
+ get mode(): NavigationMode;
880
+ constructor(components: Components);
881
+ /** {@link Disposable.dispose} */
882
+ dispose(): void;
742
883
  /**
743
- * Serializes all relations of every model processed by the indexer into a JSON string.
744
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
745
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
746
- * and its value is another object mapping entity expressIDs to their related entities, categorized
747
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
884
+ * Sets a new {@link NavigationMode} and disables the previous one.
748
885
  *
749
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
750
- * If no relations have been indexed, an empty object is returned as a JSON string.
886
+ * @param mode - The {@link NavigationMode} to set.
751
887
  */
752
- serializeAllRelations(): string;
888
+ set(mode: NavModeID): void;
753
889
  /**
754
- * Converts a JSON string representing relations between entities into a structured map.
755
- * This method parses the JSON string to reconstruct the relations map that indexes
756
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
757
- * and the values are maps where each key is a relation type ID and its value is an array
758
- * of express IDs of entities related through that relation type.
890
+ * Make the camera view fit all the specified meshes.
759
891
  *
760
- * @param json The JSON string to be parsed into the relations map.
761
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
762
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
763
- * is an array of express IDs (as numbers) of entities related through that relation type.
892
+ * @param meshes the meshes to fit. If it is not defined, it will
893
+ * evaluate {@link Components.meshes}.
894
+ * @param offset the distance to the fit object
764
895
  */
765
- getRelationsMapFromJSON(json: string): RelationsMap;
896
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
766
897
  /**
767
- * Disposes the component, cleaning up resources and detaching event listeners.
768
- * This ensures that the component is properly cleaned up and does not leave behind any
769
- * references that could prevent garbage collection.
898
+ * Allows or prevents all user input.
899
+ *
900
+ * @param active - whether to enable or disable user inputs.
770
901
  */
771
- dispose(): void;
902
+ setUserInput(active: boolean): void;
903
+ private disableUserInput;
904
+ private enableUserInput;
905
+ private newOrthoCamera;
906
+ private setOrthoPerspCameraAspect;
772
907
  }
773
- export type { InverseAttribute } from "./src/types";
908
+ export declare const IfcElements: {
909
+ [key: number]: string;
910
+ };
774
911
  import * as THREE from "three";
775
912
  import { Component, Components } from "../../core";
776
913
  export interface MeasureEdge {
@@ -795,213 +932,385 @@ export declare class MeasurementUtils extends Component {
795
932
  };
796
933
  private round;
797
934
  }
935
+ export declare const IfcCategoryMap: {
936
+ [key: number]: string;
937
+ };
938
+ import * as FRAGS from "@thatopen/fragments";
939
+ export declare class IfcPropertiesUtils {
940
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
941
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
942
+ [attribute: string]: any;
943
+ } | null>;
944
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
945
+ [relatingID: number]: number[];
946
+ }>;
947
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
948
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
949
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
950
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
951
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
952
+ key: string | null;
953
+ name: string | null;
954
+ }>;
955
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
956
+ key: string | null;
957
+ value: number | null;
958
+ }>;
959
+ static isRel(expressID: number): boolean;
960
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
961
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
962
+ }
798
963
  import * as WEBIFC from "web-ifc";
799
- import * as FRAG from "@thatopen/fragments";
800
- import { Component, Components } from "../../core";
964
+ import { IfcItemsCategories } from "../../../ifc";
965
+ export declare class SpatialStructure {
966
+ itemsByFloor: IfcItemsCategories;
967
+ private _units;
968
+ setUp(webIfc: WEBIFC.IfcAPI): void;
969
+ cleanUp(): void;
970
+ }
971
+ export declare const GeometryTypes: Set<number>;
972
+ import { InverseAttribute } from "./types";
973
+ export declare const relToAttributesMap: Map<number, {
974
+ forRelating: InverseAttribute;
975
+ forRelated: InverseAttribute;
976
+ }>;
977
+ import * as THREE from "three";
978
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
979
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
980
+ /** {@link Disposable.onDisposed} */
981
+ readonly onDisposed: Event<unknown>;
982
+ readonly onAfterUpdate: Event<unknown>;
983
+ readonly onBeforeUpdate: Event<unknown>;
984
+ readonly onResize: Event<THREE.Vector2>;
985
+ frontOffset: number;
986
+ overrideMaterial: THREE.MeshDepthMaterial;
987
+ backgroundColor: THREE.Color;
988
+ renderer: THREE.WebGLRenderer;
989
+ enabled: boolean;
990
+ world: World;
991
+ private _lockRotation;
992
+ private _camera;
993
+ private _plane;
994
+ private _size;
995
+ private _tempVector1;
996
+ private _tempVector2;
997
+ private _tempTarget;
998
+ private readonly down;
999
+ get lockRotation(): boolean;
1000
+ set lockRotation(active: boolean);
1001
+ get zoom(): number;
1002
+ set zoom(value: number);
1003
+ constructor(world: World);
1004
+ dispose(): void;
1005
+ get(): THREE.OrthographicCamera;
1006
+ update(): void;
1007
+ getSize(): THREE.Vector2;
1008
+ resize(size?: THREE.Vector2): void;
1009
+ private updatePlanes;
1010
+ }
1011
+ import * as THREE from "three";
1012
+ import { Components } from "../../Components";
1013
+ import { Event, World, Disposable } from "../../Types";
1014
+ import { Mouse } from "./mouse";
1015
+ /**
1016
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1017
+ * that allows to easily get items from the scene using the mouse and touch
1018
+ * events.
1019
+ */
1020
+ export declare class SimpleRaycaster implements Disposable {
1021
+ /** {@link Component.enabled} */
1022
+ enabled: boolean;
1023
+ components: Components;
1024
+ /** {@link Disposable.onDisposed} */
1025
+ readonly onDisposed: Event<unknown>;
1026
+ /** The position of the mouse in the screen. */
1027
+ readonly mouse: Mouse;
1028
+ readonly three: THREE.Raycaster;
1029
+ world: World;
1030
+ constructor(components: Components, world: World);
1031
+ /** {@link Disposable.dispose} */
1032
+ dispose(): void;
1033
+ /**
1034
+ * Throws a ray from the camera to the mouse or touch event point and returns
1035
+ * the first item found. This also takes into account the clipping planes
1036
+ * used by the renderer.
1037
+ *
1038
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1039
+ * to query. If not provided, it will query all the meshes stored in
1040
+ * {@link Components.meshes}.
1041
+ */
1042
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1043
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1044
+ private intersect;
1045
+ private filterClippingPlanes;
1046
+ }
1047
+ import * as WEBIFC from "web-ifc";
1048
+ export declare class IfcMetadataReader {
1049
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1050
+ }
1051
+ import * as THREE from "three";
1052
+ import { Disposable, Event } from "../../Types";
801
1053
  /**
802
- * Object to export all the properties from an IFC to a JS object.
1054
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1055
+ * to work with tools like the
1056
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1057
+ * been transformed through CSS or doesn't occupy the whole screen.
803
1058
  */
804
- export declare class IfcJsonExporter extends Component {
805
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
806
- /** {@link Component.enabled} */
807
- enabled: boolean;
808
- constructor(components: Components);
1059
+ export declare class Mouse implements Disposable {
1060
+ dom: HTMLCanvasElement;
1061
+ private _event?;
1062
+ private _position;
1063
+ /** {@link Disposable.onDisposed} */
1064
+ readonly onDisposed: Event<unknown>;
1065
+ constructor(dom: HTMLCanvasElement);
809
1066
  /**
810
- * Exports all the properties of an IFC into an array of JS objects.
811
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
812
- * @param modelID ID of the IFC model whose properties to extract.
813
- * @param indirect whether to get the indirect relationships as well.
814
- * @param recursiveSpatial whether to get the properties of spatial items recursively
815
- * to make the location data available (e.g. absolute position of building).
1067
+ * The real position of the mouse of the Three.js canvas.
816
1068
  */
817
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1069
+ get position(): THREE.Vector2;
1070
+ /** {@link Disposable.dispose} */
1071
+ dispose(): void;
1072
+ private getPositionY;
1073
+ private getPositionX;
1074
+ private updateMouseInfo;
1075
+ private setupEvents;
818
1076
  }
1077
+ import * as THREE from "three";
819
1078
  import * as WEBIFC from "web-ifc";
820
- import { FragmentsGroup } from "@thatopen/fragments";
821
- import { Component, Disposable, Event, Components } from "../../core";
822
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
823
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
824
- type NumericPropTypes = "IfcInteger" | "IfcReal";
825
- interface ChangeMap {
826
- [modelID: string]: Set<number>;
1079
+ import * as FRAGS from "@thatopen/fragments";
1080
+ export declare class CivilReader {
1081
+ defLineMat: THREE.LineBasicMaterial;
1082
+ read(webIfc: WEBIFC.IfcAPI): {
1083
+ alignments: Map<number, FRAGS.Alignment>;
1084
+ coordinationMatrix: THREE.Matrix4;
1085
+ } | undefined;
1086
+ get(civilItems: any): {
1087
+ alignments: Map<number, FRAGS.Alignment>;
1088
+ coordinationMatrix: THREE.Matrix4;
1089
+ } | undefined;
1090
+ private getCurves;
827
1091
  }
828
- interface AttributeListener {
829
- [modelID: string]: {
830
- [expressID: number]: {
831
- [attributeName: string]: Event<String | Boolean | Number>;
832
- };
833
- };
1092
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
1093
+ /** Configuration of the IFC-fragment streaming. */
1094
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1095
+ minGeometrySize: number;
1096
+ minAssetsSize: number;
834
1097
  }
835
- export declare class IfcPropertiesManager extends Component implements Disposable {
836
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
837
- /** {@link Disposable.onDisposed} */
838
- readonly onDisposed: Event<string>;
839
- readonly onRequestFile: Event<unknown>;
840
- ifcToExport: ArrayBuffer | null;
841
- readonly onElementToPset: Event<{
842
- model: FragmentsGroup;
843
- psetID: number;
844
- elementID: number;
845
- }>;
846
- readonly onPropToPset: Event<{
847
- model: FragmentsGroup;
848
- psetID: number;
849
- propID: number;
850
- }>;
851
- readonly onPsetRemoved: Event<{
852
- model: FragmentsGroup;
853
- psetID: number;
854
- }>;
855
- readonly onDataChanged: Event<{
856
- model: FragmentsGroup;
857
- expressID: number;
858
- }>;
1098
+ /** Configuration of the IFC-fragment streaming. */
1099
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1100
+ propertiesSize: number;
1101
+ }
1102
+ import * as WEBIFC from "web-ifc";
1103
+ /** Configuration of the IFC-fragment conversion. */
1104
+ export declare class IfcFragmentSettings {
1105
+ /** Whether to extract the IFC properties into a JSON. */
1106
+ includeProperties: boolean;
1107
+ /**
1108
+ * Generate the geometry for categories that are not included by default,
1109
+ * like IFCSPACE.
1110
+ */
1111
+ optionalCategories: number[];
1112
+ /** Whether to use the coordination data coming from the IFC files. */
1113
+ coordinate: boolean;
1114
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
859
1115
  wasm: {
860
1116
  path: string;
861
1117
  absolute: boolean;
1118
+ logLevel?: WEBIFC.LogLevel;
862
1119
  };
863
- enabled: boolean;
864
- attributeListeners: AttributeListener;
865
- selectedModel?: FragmentsGroup;
866
- changeMap: ChangeMap;
867
- constructor(components: Components);
868
- dispose(): void;
869
- private increaseMaxID;
870
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
871
- private newGUID;
872
- private getOwnerHistory;
873
- private registerChange;
874
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
875
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
876
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
877
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1120
+ /** List of categories that won't be converted to fragments. */
1121
+ excludedCategories: Set<number>;
1122
+ /** Whether to save the absolute location of all IFC items. */
1123
+ saveLocations: boolean;
1124
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1125
+ webIfc: WEBIFC.LoaderSettings;
1126
+ autoSetWasm: boolean;
1127
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1128
+ }
1129
+ import * as WEBIFC from "web-ifc";
1130
+ import * as THREE from "three";
1131
+ export declare class Units {
1132
+ factor: number;
1133
+ complement: number;
1134
+ apply(matrix: THREE.Matrix4): void;
1135
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1136
+ private getLengthUnits;
1137
+ private getScaleMatrix;
1138
+ }
1139
+ import * as WEBIFC from "web-ifc";
1140
+ import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1141
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1142
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1143
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1144
+ onPropertiesStreamed: AsyncEvent<{
1145
+ type: number;
1146
+ data: {
1147
+ [id: number]: any;
1148
+ };
878
1149
  }>;
879
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
880
- private newSingleProperty;
881
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
882
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
883
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
884
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
885
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
886
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
887
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
888
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1150
+ onProgress: AsyncEvent<number>;
1151
+ onIndicesStreamed: AsyncEvent<number[][]>;
1152
+ /** {@link Disposable.onDisposed} */
1153
+ readonly onDisposed: Event<string>;
1154
+ enabled: boolean;
1155
+ settings: PropertiesStreamingSettings;
1156
+ webIfc: WEBIFC.IfcAPI;
1157
+ dispose(): Promise<void>;
1158
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1159
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1160
+ private readIfcFile;
1161
+ private streamIfcFile;
1162
+ private streamAllProperties;
1163
+ private getIndices;
1164
+ private cleanUp;
889
1165
  }
890
- export {};
891
- export declare class UUID {
892
- private static _pattern;
893
- private static _lut;
894
- static create(): string;
895
- static validate(uuid: string): void;
1166
+ export interface StreamedGeometries {
1167
+ [id: number]: {
1168
+ boundingBox: Float32Array;
1169
+ hasHoles: boolean;
1170
+ geometryFile?: string;
1171
+ };
1172
+ }
1173
+ export interface StreamedAsset {
1174
+ id: number;
1175
+ geometries: {
1176
+ geometryID: number;
1177
+ transformation: number[];
1178
+ color: number[];
1179
+ }[];
896
1180
  }
897
1181
  import * as THREE from "three";
898
- import { Component, Components, Event, World } from "../core";
899
- export interface VertexPickerConfig {
900
- showOnlyVertex: boolean;
901
- snapDistance: number;
902
- previewElement: HTMLElement;
1182
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1183
+ import { Components } from "../../Components";
1184
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1185
+ /**
1186
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1187
+ */
1188
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1189
+ readonly onAfterUpdate: Event<unknown>;
1190
+ readonly onBeforeUpdate: Event<unknown>;
1191
+ enabled: boolean;
1192
+ uuid: string;
1193
+ readonly onDisposed: Event<unknown>;
1194
+ private _scene?;
1195
+ private _camera?;
1196
+ private _renderer;
1197
+ get scene(): T;
1198
+ set scene(scene: T);
1199
+ get camera(): U;
1200
+ set camera(camera: U);
1201
+ get renderer(): S | null;
1202
+ set renderer(renderer: S | null);
1203
+ constructor(components: Components);
1204
+ update(delta?: number): void;
1205
+ dispose(disposeResources?: boolean): void;
903
1206
  }
904
- export declare class VertexPicker extends Component {
905
- onVertexFound: Event<THREE.Vector3>;
906
- onVertexLost: Event<THREE.Vector3>;
907
- components: Components;
908
- private _pickedPoint;
909
- private _config;
910
- private _enabled;
911
- private _workingPlane;
912
- set enabled(value: boolean);
1207
+ import * as THREE from "three";
1208
+ import CameraControls from "camera-controls";
1209
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1210
+ import { Components } from "../../Components";
1211
+ /**
1212
+ * A basic camera that uses
1213
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1214
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1215
+ * what features it offers.
1216
+ */
1217
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1218
+ /** {@link Updateable.onBeforeUpdate} */
1219
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1220
+ /** {@link Updateable.onAfterUpdate} */
1221
+ readonly onAfterUpdate: Event<SimpleCamera>;
1222
+ readonly onAspectUpdated: Event<unknown>;
1223
+ /** {@link Disposable.onDisposed} */
1224
+ readonly onDisposed: Event<string>;
1225
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1226
+ private _allControls;
1227
+ /**
1228
+ * The object that controls the camera. An instance of
1229
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1230
+ * Transforming the camera directly will have no effect: you need to use this
1231
+ * object to move, rotate, look at objects, etc.
1232
+ */
1233
+ get controls(): CameraControls;
1234
+ /** {@link Component.enabled} */
913
1235
  get enabled(): boolean;
914
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
915
- set workingPlane(plane: THREE.Plane | null);
916
- get workingPlane(): THREE.Plane | null;
917
- set config(value: Partial<VertexPickerConfig>);
918
- get config(): Partial<VertexPickerConfig>;
1236
+ /** {@link Component.enabled} */
1237
+ set enabled(enabled: boolean);
1238
+ constructor(components: Components);
1239
+ /** {@link Disposable.dispose} */
919
1240
  dispose(): void;
920
- get(world: World): THREE.Vector3 | null;
921
- private getClosestVertex;
922
- private getVertices;
923
- private getVertex;
1241
+ /** {@link Updateable.update} */
1242
+ update(_delta: number): void;
1243
+ /**
1244
+ * Updates the aspect of the camera to match the size of the
1245
+ * {@link Components.renderer}.
1246
+ */
1247
+ updateAspect: () => void;
1248
+ private setupCamera;
1249
+ private newCameraControls;
1250
+ private setupEvents;
1251
+ private static getSubsetOfThree;
924
1252
  }
925
- export declare const IfcElements: {
926
- [key: number]: string;
927
- };
928
- import * as WEBIFC from "web-ifc";
929
- export interface IfcItemsCategories {
930
- [itemID: number]: number;
1253
+ import * as THREE from "three";
1254
+ import { BaseScene, Configurable, Event } from "../../Types";
1255
+ import { Components } from "../../Components";
1256
+ export interface SimpleSceneConfig {
1257
+ directionalLight: {
1258
+ color: THREE.Color;
1259
+ intensity: number;
1260
+ position: THREE.Vector3;
1261
+ };
1262
+ ambientLight: {
1263
+ color: THREE.Color;
1264
+ intensity: number;
1265
+ };
931
1266
  }
932
- export declare class IfcCategories {
933
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1267
+ /**
1268
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1269
+ * objects hierarchically, and easily dispose them when you are finished with it.
1270
+ * @noInheritDoc
1271
+ */
1272
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1273
+ /** {@link Configurable.isSetup} */
1274
+ isSetup: boolean;
1275
+ three: THREE.Scene;
1276
+ /** {@link Configurable.onSetup} */
1277
+ readonly onSetup: Event<SimpleScene>;
1278
+ config: Required<SimpleSceneConfig>;
1279
+ constructor(components: Components);
1280
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1281
+ setup(config?: Partial<SimpleSceneConfig>): void;
934
1282
  }
935
1283
  import * as THREE from "three";
936
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
937
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
938
- /** {@link Disposable.onDisposed} */
939
- readonly onDisposed: Event<unknown>;
940
- readonly onAfterUpdate: Event<unknown>;
941
- readonly onBeforeUpdate: Event<unknown>;
942
- readonly onResize: Event<THREE.Vector2>;
943
- frontOffset: number;
944
- overrideMaterial: THREE.MeshDepthMaterial;
945
- backgroundColor: THREE.Color;
946
- renderer: THREE.WebGLRenderer;
1284
+ import { BaseRenderer, Event } from "../../Types";
1285
+ import { Components } from "../../Components";
1286
+ /**
1287
+ * A basic renderer capable of rendering
1288
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1289
+ */
1290
+ export declare class SimpleRenderer extends BaseRenderer {
947
1291
  enabled: boolean;
948
- world: World;
949
- private _lockRotation;
950
- private _camera;
951
- private _plane;
952
- private _size;
953
- private _tempVector1;
954
- private _tempVector2;
955
- private _tempTarget;
956
- private readonly down;
957
- get lockRotation(): boolean;
958
- set lockRotation(active: boolean);
959
- get zoom(): number;
960
- set zoom(value: number);
961
- constructor(world: World);
962
- dispose(): void;
963
- get(): THREE.OrthographicCamera;
1292
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1293
+ container: HTMLElement;
1294
+ three: THREE.WebGLRenderer;
1295
+ protected _canvas: HTMLCanvasElement;
1296
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1297
+ protected _resizeObserver: ResizeObserver | null;
1298
+ protected onContainerUpdated: Event<unknown>;
1299
+ private _resizing;
1300
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1301
+ /** {@link Updateable.update} */
964
1302
  update(): void;
1303
+ /** {@link Disposable.dispose} */
1304
+ dispose(): void;
1305
+ /** {@link Resizeable.getSize}. */
965
1306
  getSize(): THREE.Vector2;
966
- resize(size?: THREE.Vector2): void;
967
- private updatePlanes;
968
- }
969
- export declare const GeometryTypes: Set<number>;
970
- import * as WEBIFC from "web-ifc";
971
- import { IfcItemsCategories } from "../../../ifc";
972
- export declare class SpatialStructure {
973
- itemsByFloor: IfcItemsCategories;
974
- private _units;
975
- setUp(webIfc: WEBIFC.IfcAPI): void;
976
- cleanUp(): void;
977
- }
978
- export declare const IfcCategoryMap: {
979
- [key: number]: string;
980
- };
981
- import * as FRAGS from "@thatopen/fragments";
982
- export declare class IfcPropertiesUtils {
983
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
984
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
985
- [attribute: string]: any;
986
- } | null>;
987
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
988
- [relatingID: number]: number[];
989
- }>;
990
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
991
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
992
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
993
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
994
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
995
- key: string | null;
996
- name: string | null;
997
- }>;
998
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
999
- key: string | null;
1000
- value: number | null;
1001
- }>;
1002
- static isRel(expressID: number): boolean;
1003
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1004
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1307
+ /** {@link Resizeable.resize} */
1308
+ resize: (size?: THREE.Vector2) => void;
1309
+ setupEvents(active: boolean): void;
1310
+ private resizeEvent;
1311
+ private setupRenderer;
1312
+ private onContextLost;
1313
+ private onContextBack;
1005
1314
  }
1006
1315
  /**
1007
1316
  * Simple event handler by
@@ -1037,40 +1346,6 @@ export declare class Event<T> {
1037
1346
  reset(): void;
1038
1347
  private handlers;
1039
1348
  }
1040
- /**
1041
- * Simple event handler by
1042
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1043
- * Keep in mind that:
1044
- * - If you want to remove it later, you might want to declare the callback as
1045
- * an object.
1046
- * - If you want to maintain the reference to 'this', you will need to declare
1047
- * the callback as an arrow function.
1048
- */
1049
- export declare class AsyncEvent<T> {
1050
- /**
1051
- * Add a callback to this event instance.
1052
- * @param handler - the callback to be added to this event.
1053
- */
1054
- add(handler: T extends void ? {
1055
- (): Promise<void>;
1056
- } : {
1057
- (data: T): Promise<void>;
1058
- }): void;
1059
- /**
1060
- * Removes a callback from this event instance.
1061
- * @param handler - the callback to be removed from this event.
1062
- */
1063
- remove(handler: T extends void ? {
1064
- (): Promise<void>;
1065
- } : {
1066
- (data: T): Promise<void>;
1067
- }): void;
1068
- /** Triggers all the callbacks assigned to this event. */
1069
- trigger: (data?: T) => Promise<void>;
1070
- /** Gets rid of all the suscribed events. */
1071
- reset(): void;
1072
- private handlers;
1073
- }
1074
1349
  import * as THREE from "three";
1075
1350
  import CameraControls from "camera-controls";
1076
1351
  import { Event } from "./event";
@@ -1194,24 +1469,39 @@ export interface BVHGeometry extends THREE.BufferGeometry {
1194
1469
  export interface CameraControllable {
1195
1470
  controls: CameraControls;
1196
1471
  }
1197
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1198
- import { Components } from "../../Components";
1199
1472
  /**
1200
- * Base class of the library. Useful for finding out the interfaces it implements.
1473
+ * Simple event handler by
1474
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1475
+ * Keep in mind that:
1476
+ * - If you want to remove it later, you might want to declare the callback as
1477
+ * an object.
1478
+ * - If you want to maintain the reference to 'this', you will need to declare
1479
+ * the callback as an arrow function.
1201
1480
  */
1202
- export declare abstract class Base {
1203
- components: Components;
1204
- constructor(components: Components);
1205
- /** Whether is component is {@link Disposable}. */
1206
- isDisposeable: () => this is Disposable;
1207
- /** Whether is component is {@link Resizeable}. */
1208
- isResizeable: () => this is Resizeable;
1209
- /** Whether is component is {@link Updateable}. */
1210
- isUpdateable: () => this is Updateable;
1211
- /** Whether is component is {@link Hideable}. */
1212
- isHideable: () => this is Hideable;
1213
- /** Whether is component is {@link Configurable}. */
1214
- isConfigurable: () => this is Configurable<any>;
1481
+ export declare class AsyncEvent<T> {
1482
+ /**
1483
+ * Add a callback to this event instance.
1484
+ * @param handler - the callback to be added to this event.
1485
+ */
1486
+ add(handler: T extends void ? {
1487
+ (): Promise<void>;
1488
+ } : {
1489
+ (data: T): Promise<void>;
1490
+ }): void;
1491
+ /**
1492
+ * Removes a callback from this event instance.
1493
+ * @param handler - the callback to be removed from this event.
1494
+ */
1495
+ remove(handler: T extends void ? {
1496
+ (): Promise<void>;
1497
+ } : {
1498
+ (data: T): Promise<void>;
1499
+ }): void;
1500
+ /** Triggers all the callbacks assigned to this event. */
1501
+ trigger: (data?: T) => Promise<void>;
1502
+ /** Gets rid of all the suscribed events. */
1503
+ reset(): void;
1504
+ private handlers;
1215
1505
  }
1216
1506
  import { Base } from "./base";
1217
1507
  /**
@@ -1231,6 +1521,36 @@ export declare abstract class Component extends Base {
1231
1521
  */
1232
1522
  abstract enabled: boolean;
1233
1523
  }
1524
+ import * as THREE from "three";
1525
+ import CameraControls from "camera-controls";
1526
+ import { BaseWorldItem } from "./base-world-item";
1527
+ import { CameraControllable } from "./interfaces";
1528
+ export declare abstract class BaseCamera extends BaseWorldItem {
1529
+ abstract enabled: boolean;
1530
+ abstract three: THREE.Camera;
1531
+ abstract controls?: CameraControls;
1532
+ /** Whether is instance is {@link CameraControllable}. */
1533
+ hasCameraControls: () => this is CameraControllable;
1534
+ }
1535
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1536
+ import { Components } from "../../Components";
1537
+ /**
1538
+ * Base class of the library. Useful for finding out the interfaces it implements.
1539
+ */
1540
+ export declare abstract class Base {
1541
+ components: Components;
1542
+ constructor(components: Components);
1543
+ /** Whether is component is {@link Disposable}. */
1544
+ isDisposeable: () => this is Disposable;
1545
+ /** Whether is component is {@link Resizeable}. */
1546
+ isResizeable: () => this is Resizeable;
1547
+ /** Whether is component is {@link Updateable}. */
1548
+ isUpdateable: () => this is Updateable;
1549
+ /** Whether is component is {@link Hideable}. */
1550
+ isHideable: () => this is Hideable;
1551
+ /** Whether is component is {@link Configurable}. */
1552
+ isConfigurable: () => this is Configurable<any>;
1553
+ }
1234
1554
  import { Base } from "./base";
1235
1555
  import { World } from "./world";
1236
1556
  import { Event } from "./event";
@@ -1262,17 +1582,6 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
1262
1582
  dispose(): void;
1263
1583
  }
1264
1584
  import * as THREE from "three";
1265
- import CameraControls from "camera-controls";
1266
- import { BaseWorldItem } from "./base-world-item";
1267
- import { CameraControllable } from "./interfaces";
1268
- export declare abstract class BaseCamera extends BaseWorldItem {
1269
- abstract enabled: boolean;
1270
- abstract three: THREE.Camera;
1271
- abstract controls?: CameraControls;
1272
- /** Whether is instance is {@link CameraControllable}. */
1273
- hasCameraControls: () => this is CameraControllable;
1274
- }
1275
- import * as THREE from "three";
1276
1585
  import { Vector2 } from "three";
1277
1586
  import { Event } from "./event";
1278
1587
  import { BaseWorldItem } from "./base-world-item";
@@ -1312,304 +1621,155 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1312
1621
  */
1313
1622
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1314
1623
  }
1315
- import * as THREE from "three";
1316
- import { BaseScene } from "./base-scene";
1317
- import { BaseCamera } from "./base-camera";
1318
- import { BaseRenderer } from "./base-renderer";
1319
- import { Updateable, Disposable } from "./interfaces";
1320
- export interface World extends Disposable, Updateable {
1321
- meshes: Set<THREE.Mesh>;
1322
- scene: BaseScene;
1323
- camera: BaseCamera;
1324
- renderer: BaseRenderer | null;
1325
- uuid: string;
1326
- }
1327
- import * as THREE from "three";
1328
- import { BaseScene, Configurable, Event } from "../../Types";
1329
- import { Components } from "../../Components";
1330
- export interface SimpleSceneConfig {
1331
- directionalLight: {
1332
- color: THREE.Color;
1333
- intensity: number;
1334
- position: THREE.Vector3;
1335
- };
1336
- ambientLight: {
1337
- color: THREE.Color;
1338
- intensity: number;
1339
- };
1340
- }
1624
+ import { NavigationMode } from "./types";
1625
+ import { OrthoPerspectiveCamera } from "../index";
1341
1626
  /**
1342
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1343
- * objects hierarchically, and easily dispose them when you are finished with it.
1344
- * @noInheritDoc
1627
+ * A {@link NavigationMode} that allows first person navigation,
1628
+ * simulating FPS video games.
1345
1629
  */
1346
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1347
- /** {@link Configurable.isSetup} */
1348
- isSetup: boolean;
1349
- three: THREE.Scene;
1350
- /** {@link Configurable.onSetup} */
1351
- readonly onSetup: Event<SimpleScene>;
1352
- config: Required<SimpleSceneConfig>;
1353
- constructor(components: Components);
1354
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1355
- setup(config?: Partial<SimpleSceneConfig>): void;
1630
+ export declare class FirstPersonMode implements NavigationMode {
1631
+ private camera;
1632
+ /** {@link NavigationMode.enabled} */
1633
+ enabled: boolean;
1634
+ /** {@link NavigationMode.id} */
1635
+ readonly id = "FirstPerson";
1636
+ constructor(camera: OrthoPerspectiveCamera);
1637
+ /** {@link NavigationMode.set} */
1638
+ set(active: boolean): void;
1639
+ private setupFirstPersonCamera;
1356
1640
  }
1357
- import * as THREE from "three";
1358
- import { BaseRenderer, Event } from "../../Types";
1359
- import { Components } from "../../Components";
1641
+ import { NavigationMode } from "./types";
1642
+ import { OrthoPerspectiveCamera } from "../index";
1360
1643
  /**
1361
- * A basic renderer capable of rendering
1362
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1644
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1645
+ * like many BIM tools.
1363
1646
  */
1364
- export declare class SimpleRenderer extends BaseRenderer {
1647
+ export declare class PlanMode implements NavigationMode {
1648
+ private camera;
1649
+ /** {@link NavigationMode.enabled} */
1365
1650
  enabled: boolean;
1366
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1367
- container: HTMLElement;
1368
- three: THREE.WebGLRenderer;
1369
- protected _canvas: HTMLCanvasElement;
1370
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1371
- protected _resizeObserver: ResizeObserver | null;
1372
- protected onContainerUpdated: Event<unknown>;
1373
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1374
- /** {@link Updateable.update} */
1375
- update(): void;
1376
- /** {@link Disposable.dispose} */
1377
- dispose(): void;
1378
- /** {@link Resizeable.getSize}. */
1379
- getSize(): THREE.Vector2;
1380
- /** {@link Resizeable.resize} */
1381
- resize: (size?: THREE.Vector2) => void;
1382
- setupEvents(active: boolean): void;
1383
- private resizeEvent;
1384
- private setupRenderer;
1385
- private onContextLost;
1386
- private onContextBack;
1387
- }
1388
- import { InverseAttribute } from "./types";
1389
- export declare const relToAttributesMap: Map<number, {
1390
- forRelating: InverseAttribute;
1391
- forRelated: InverseAttribute;
1392
- }>;
1393
- /// <reference types="node" />
1394
- import * as THREE from "three";
1395
- import { Hideable, Event, World } from "../../Types";
1396
- import { Components } from "../../Components";
1397
- export interface GridConfig {
1398
- color: THREE.Color;
1399
- size1: number;
1400
- size2: number;
1401
- distance: number;
1651
+ /** {@link NavigationMode.id} */
1652
+ readonly id = "Plan";
1653
+ private mouseAction1?;
1654
+ private mouseAction2?;
1655
+ private mouseInitialized;
1656
+ private readonly defaultAzimuthSpeed;
1657
+ private readonly defaultPolarSpeed;
1658
+ constructor(camera: OrthoPerspectiveCamera);
1659
+ /** {@link NavigationMode.set} */
1660
+ set(active: boolean): void;
1402
1661
  }
1662
+ import { NavigationMode } from "./types";
1663
+ import { OrthoPerspectiveCamera } from "../index";
1403
1664
  /**
1404
- * An infinite grid. Created by
1405
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1406
- * and translated to typescript by
1407
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1665
+ * A {@link NavigationMode} that allows 3D navigation and panning
1666
+ * like in many 3D and CAD softwares.
1408
1667
  */
1409
- export declare class SimpleGrid implements Hideable, Disposable {
1410
- /** {@link Disposable.onDisposed} */
1411
- readonly onDisposed: Event<unknown>;
1412
- world: World;
1413
- components: Components;
1414
- /** {@link Hideable.visible} */
1415
- get visible(): boolean;
1416
- /** {@link Hideable.visible} */
1417
- set visible(visible: boolean);
1418
- /** The material of the grid. */
1419
- get material(): THREE.ShaderMaterial;
1420
- /**
1421
- * Whether the grid should fade away with distance. Recommended to be true for
1422
- * perspective cameras and false for orthographic cameras.
1423
- */
1424
- get fade(): boolean;
1425
- /**
1426
- * Whether the grid should fade away with distance. Recommended to be true for
1427
- * perspective cameras and false for orthographic cameras.
1428
- */
1429
- set fade(active: boolean);
1430
- readonly three: THREE.Mesh;
1431
- private _fade;
1432
- constructor(components: Components, world: World, config: GridConfig);
1433
- [Symbol.dispose](): void;
1434
- /** {@link Disposable.dispose} */
1435
- dispose(): void;
1436
- private setupEvents;
1437
- private updateZoom;
1438
- }
1439
- import * as THREE from "three";
1440
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1441
- import { Components } from "../../Components";
1442
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1443
- /**
1444
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1445
- */
1446
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1447
- readonly onAfterUpdate: Event<unknown>;
1448
- readonly onBeforeUpdate: Event<unknown>;
1668
+ export declare class OrbitMode implements NavigationMode {
1669
+ camera: OrthoPerspectiveCamera;
1670
+ /** {@link NavigationMode.enabled} */
1449
1671
  enabled: boolean;
1450
- uuid: string;
1451
- readonly onDisposed: Event<unknown>;
1452
- private _scene?;
1453
- private _camera?;
1454
- private _renderer;
1455
- get scene(): T;
1456
- set scene(scene: T);
1457
- get camera(): U;
1458
- set camera(camera: U);
1459
- get renderer(): S | null;
1460
- set renderer(renderer: S | null);
1461
- constructor(components: Components);
1462
- update(delta?: number): void;
1463
- dispose(disposeResources?: boolean): void;
1672
+ /** {@link NavigationMode.id} */
1673
+ readonly id = "Orbit";
1674
+ constructor(camera: OrthoPerspectiveCamera);
1675
+ /** {@link NavigationMode.set} */
1676
+ set(active: boolean): void;
1677
+ private activateOrbitControls;
1464
1678
  }
1465
1679
  import * as THREE from "three";
1466
- import CameraControls from "camera-controls";
1467
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1468
- import { Components } from "../../Components";
1469
- /**
1470
- * A basic camera that uses
1471
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1472
- * easily control the camera in 2D and 3D. Check out it's API to find out
1473
- * what features it offers.
1474
- */
1475
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1476
- /** {@link Updateable.onBeforeUpdate} */
1477
- readonly onBeforeUpdate: Event<SimpleCamera>;
1478
- /** {@link Updateable.onAfterUpdate} */
1479
- readonly onAfterUpdate: Event<SimpleCamera>;
1480
- readonly onAspectUpdated: Event<unknown>;
1481
- /** {@link Disposable.onDisposed} */
1482
- readonly onDisposed: Event<string>;
1483
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1484
- private _allControls;
1485
- /**
1486
- * The object that controls the camera. An instance of
1487
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1488
- * Transforming the camera directly will have no effect: you need to use this
1489
- * object to move, rotate, look at objects, etc.
1490
- */
1491
- get controls(): CameraControls;
1492
- /** {@link Component.enabled} */
1493
- get enabled(): boolean;
1494
- /** {@link Component.enabled} */
1495
- set enabled(enabled: boolean);
1496
- constructor(components: Components);
1497
- /** {@link Disposable.dispose} */
1498
- dispose(): void;
1499
- /** {@link Updateable.update} */
1500
- update(_delta: number): void;
1501
- /**
1502
- * Updates the aspect of the camera to match the size of the
1503
- * {@link Components.renderer}.
1504
- */
1505
- updateAspect: () => void;
1506
- private setupCamera;
1507
- private newCameraControls;
1508
- private setupEvents;
1509
- private static getSubsetOfThree;
1680
+ import { BaseScene } from "./base-scene";
1681
+ import { BaseCamera } from "./base-camera";
1682
+ import { BaseRenderer } from "./base-renderer";
1683
+ import { Updateable, Disposable } from "./interfaces";
1684
+ export interface World extends Disposable, Updateable {
1685
+ meshes: Set<THREE.Mesh>;
1686
+ scene: BaseScene;
1687
+ camera: BaseCamera;
1688
+ renderer: BaseRenderer | null;
1689
+ uuid: string;
1510
1690
  }
1511
1691
  import * as THREE from "three";
1512
- import { Components } from "../../Components";
1513
- import { Event, World, Disposable } from "../../Types";
1514
- import { Mouse } from "./mouse";
1692
+ import { CameraProjection } from "./types";
1693
+ import { Event } from "../../Types";
1694
+ import { OrthoPerspectiveCamera } from "../index";
1515
1695
  /**
1516
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1517
- * that allows to easily get items from the scene using the mouse and touch
1518
- * events.
1696
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1519
1697
  */
1520
- export declare class SimpleRaycaster implements Disposable {
1521
- /** {@link Component.enabled} */
1522
- enabled: boolean;
1523
- components: Components;
1524
- /** {@link Disposable.onDisposed} */
1525
- readonly onDisposed: Event<unknown>;
1526
- /** The position of the mouse in the screen. */
1527
- readonly mouse: Mouse;
1528
- readonly three: THREE.Raycaster;
1529
- world: World;
1530
- constructor(components: Components, world: World);
1531
- /** {@link Disposable.dispose} */
1532
- dispose(): void;
1698
+ export declare class ProjectionManager {
1533
1699
  /**
1534
- * Throws a ray from the camera to the mouse or touch event point and returns
1535
- * the first item found. This also takes into account the clipping planes
1536
- * used by the renderer.
1700
+ * Event that fires when the {@link CameraProjection} changes.
1701
+ */
1702
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1703
+ current: CameraProjection;
1704
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1705
+ private _component;
1706
+ private _previousDistance;
1707
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1708
+ matchOrthoDistanceEnabled: boolean;
1709
+ constructor(camera: OrthoPerspectiveCamera);
1710
+ /**
1711
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1537
1712
  *
1538
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1539
- * to query. If not provided, it will query all the meshes stored in
1540
- * {@link Components.meshes}.
1713
+ * @param projection - the new projection to set. If it is the current projection,
1714
+ * it will have no effect.
1541
1715
  */
1542
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1543
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1544
- private intersect;
1545
- private filterClippingPlanes;
1716
+ set(projection: CameraProjection): Promise<void>;
1717
+ /**
1718
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1719
+ * and vice versa.
1720
+ */
1721
+ toggle(): Promise<void>;
1722
+ private setOrthoCamera;
1723
+ private getPerspectiveDims;
1724
+ private setupOrthoCamera;
1725
+ private getDistance;
1726
+ private setPerspectiveCamera;
1546
1727
  }
1728
+ /// <reference types="node" />
1547
1729
  import * as THREE from "three";
1730
+ import { Hideable, Event, World } from "../../Types";
1548
1731
  import { Components } from "../../Components";
1549
- import { AsyncEvent, Event, World } from "../../Types";
1550
- export interface CullerRendererSettings {
1551
- updateInterval?: number;
1552
- width?: number;
1553
- height?: number;
1554
- autoUpdate?: boolean;
1732
+ export interface GridConfig {
1733
+ color: THREE.Color;
1734
+ size1: number;
1735
+ size2: number;
1736
+ distance: number;
1555
1737
  }
1556
1738
  /**
1557
- * A base renderer to determine visibility on screen
1739
+ * An infinite grid. Created by
1740
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1741
+ * and translated to typescript by
1742
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1558
1743
  */
1559
- export declare class CullerRenderer {
1744
+ export declare class SimpleGrid implements Hideable, Disposable {
1560
1745
  /** {@link Disposable.onDisposed} */
1561
- readonly onDisposed: Event<string>;
1562
- /**
1563
- * Fires after making the visibility check to the meshes. It lists the
1564
- * meshes that are currently visible, and the ones that were visible
1565
- * just before but not anymore.
1566
- */
1567
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1568
- /** {@link Component.enabled} */
1569
- enabled: boolean;
1746
+ readonly onDisposed: Event<unknown>;
1747
+ world: World;
1748
+ components: Components;
1749
+ /** {@link Hideable.visible} */
1750
+ get visible(): boolean;
1751
+ /** {@link Hideable.visible} */
1752
+ set visible(visible: boolean);
1753
+ /** The material of the grid. */
1754
+ get material(): THREE.ShaderMaterial;
1570
1755
  /**
1571
- * Needs to check whether there are objects that need to be hidden or shown.
1572
- * You can bind this to the camera movement, to a certain interval, etc.
1756
+ * Whether the grid should fade away with distance. Recommended to be true for
1757
+ * perspective cameras and false for orthographic cameras.
1573
1758
  */
1574
- needsUpdate: boolean;
1759
+ get fade(): boolean;
1575
1760
  /**
1576
- * Render the internal scene used to determine the object visibility. Used
1577
- * for debugging purposes.
1761
+ * Whether the grid should fade away with distance. Recommended to be true for
1762
+ * perspective cameras and false for orthographic cameras.
1578
1763
  */
1579
- renderDebugFrame: boolean;
1580
- components: Components;
1581
- readonly world: World;
1582
- readonly renderer: THREE.WebGLRenderer;
1583
- protected autoUpdate: boolean;
1584
- protected updateInterval: number;
1585
- protected readonly worker: Worker;
1586
- protected readonly scene: THREE.Scene;
1587
- private _width;
1588
- private _height;
1589
- private _availableColor;
1590
- private readonly renderTarget;
1591
- private readonly bufferSize;
1592
- private readonly _buffer;
1593
- protected _isWorkerBusy: boolean;
1594
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1764
+ set fade(active: boolean);
1765
+ readonly three: THREE.Mesh;
1766
+ private _fade;
1767
+ constructor(components: Components, world: World, config: GridConfig);
1768
+ [Symbol.dispose](): void;
1595
1769
  /** {@link Disposable.dispose} */
1596
1770
  dispose(): void;
1597
- /**
1598
- * The function that the culler uses to reprocess the scene. Generally it's
1599
- * better to call needsUpdate, but you can also call this to force it.
1600
- * @param force if true, it will refresh the scene even if needsUpdate is
1601
- * not true.
1602
- */
1603
- updateVisibility: (force?: boolean) => Promise<void>;
1604
- protected getAvailableColor(): {
1605
- r: number;
1606
- g: number;
1607
- b: number;
1608
- code: string;
1609
- };
1610
- protected increaseColor(): void;
1611
- protected decreaseColor(): void;
1612
- private applySettings;
1771
+ private setupEvents;
1772
+ private updateZoom;
1613
1773
  }
1614
1774
  import * as THREE from "three";
1615
1775
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
@@ -1639,133 +1799,62 @@ export declare class MeshCullerRenderer extends CullerRenderer {
1639
1799
  private handleWorkerMessage;
1640
1800
  private getAvailableMaterial;
1641
1801
  }
1642
- import * as THREE from "three";
1643
- import { Disposable, Event } from "../../Types";
1644
1802
  /**
1645
- * A helper to easily get the real position of the mouse in the Three.js canvas
1646
- * to work with tools like the
1647
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1648
- * been transformed through CSS or doesn't occupy the whole screen.
1803
+ * The projection system of the camera.
1649
1804
  */
1650
- export declare class Mouse implements Disposable {
1651
- dom: HTMLCanvasElement;
1652
- private _event?;
1653
- private _position;
1654
- /** {@link Disposable.onDisposed} */
1655
- readonly onDisposed: Event<unknown>;
1656
- constructor(dom: HTMLCanvasElement);
1657
- /**
1658
- * The real position of the mouse of the Three.js canvas.
1659
- */
1660
- get position(): THREE.Vector2;
1661
- /** {@link Disposable.dispose} */
1662
- dispose(): void;
1663
- private getPositionY;
1664
- private getPositionX;
1665
- private updateMouseInfo;
1666
- private setupEvents;
1667
- }
1668
- import * as WEBIFC from "web-ifc";
1669
- export declare class IfcMetadataReader {
1670
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1671
- }
1672
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1673
- import * as THREE from "three";
1674
- import * as WEBIFC from "web-ifc";
1675
- import * as FRAGS from "@thatopen/fragments";
1676
- export declare class CivilReader {
1677
- defLineMat: THREE.LineBasicMaterial;
1678
- read(webIfc: WEBIFC.IfcAPI): {
1679
- alignments: Map<number, FRAGS.Alignment>;
1680
- coordinationMatrix: THREE.Matrix4;
1681
- } | undefined;
1682
- get(civilItems: any): {
1683
- alignments: Map<number, FRAGS.Alignment>;
1684
- coordinationMatrix: THREE.Matrix4;
1685
- } | undefined;
1686
- private getCurves;
1687
- }
1688
- import * as WEBIFC from "web-ifc";
1689
- /** Configuration of the IFC-fragment conversion. */
1690
- export declare class IfcFragmentSettings {
1691
- /** Whether to extract the IFC properties into a JSON. */
1692
- includeProperties: boolean;
1693
- /**
1694
- * Generate the geometry for categories that are not included by default,
1695
- * like IFCSPACE.
1696
- */
1697
- optionalCategories: number[];
1698
- /** Whether to use the coordination data coming from the IFC files. */
1699
- coordinate: boolean;
1700
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1701
- wasm: {
1702
- path: string;
1703
- absolute: boolean;
1704
- logLevel?: WEBIFC.LogLevel;
1705
- };
1706
- /** List of categories that won't be converted to fragments. */
1707
- excludedCategories: Set<number>;
1708
- /** Whether to save the absolute location of all IFC items. */
1709
- saveLocations: boolean;
1710
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1711
- webIfc: WEBIFC.LoaderSettings;
1712
- autoSetWasm: boolean;
1713
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1714
- }
1715
- import { NavigationMode } from "./types";
1716
- import { OrthoPerspectiveCamera } from "../index";
1805
+ export type CameraProjection = "Perspective" | "Orthographic";
1717
1806
  /**
1718
- * A {@link NavigationMode} that allows first person navigation,
1719
- * simulating FPS video games.
1807
+ * The extensible list of supported navigation modes.
1720
1808
  */
1721
- export declare class FirstPersonMode implements NavigationMode {
1722
- private camera;
1723
- /** {@link NavigationMode.enabled} */
1724
- enabled: boolean;
1725
- /** {@link NavigationMode.id} */
1726
- readonly id = "FirstPerson";
1727
- constructor(camera: OrthoPerspectiveCamera);
1728
- /** {@link NavigationMode.set} */
1729
- set(active: boolean): void;
1730
- private setupFirstPersonCamera;
1731
- }
1732
- import { NavigationMode } from "./types";
1733
- import { OrthoPerspectiveCamera } from "../index";
1809
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1734
1810
  /**
1735
- * A {@link NavigationMode} that allows 3D navigation and panning
1736
- * like in many 3D and CAD softwares.
1811
+ * An object that determines the behavior of the camera controls
1812
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1737
1813
  */
1738
- export declare class OrbitMode implements NavigationMode {
1739
- camera: OrthoPerspectiveCamera;
1740
- /** {@link NavigationMode.enabled} */
1814
+ export interface NavigationMode {
1815
+ /** The unique ID of this navigation mode. */
1816
+ id: NavModeID;
1817
+ /**
1818
+ * Enable or disable this navigation mode.
1819
+ * When a new navigation mode is enabled, the previous navigation mode
1820
+ * must be disabled.
1821
+ *
1822
+ * @param active - whether to enable or disable this mode.
1823
+ * @param options - any additional data required to enable or disable it.
1824
+ * */
1825
+ set: (active: boolean, options?: any) => void;
1826
+ /** Whether this navigation mode is active or not. */
1741
1827
  enabled: boolean;
1742
- /** {@link NavigationMode.id} */
1743
- readonly id = "Orbit";
1744
- constructor(camera: OrthoPerspectiveCamera);
1745
- /** {@link NavigationMode.set} */
1746
- set(active: boolean): void;
1747
- private activateOrbitControls;
1748
1828
  }
1749
- import { NavigationMode } from "./types";
1750
- import { OrthoPerspectiveCamera } from "../index";
1829
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1830
+ export type RelationsMap = Map<number, Map<number, number[]>>;
1831
+ export interface ModelsRelationMap {
1832
+ [modelID: string]: RelationsMap;
1833
+ }
1751
1834
  /**
1752
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1753
- * like many BIM tools.
1835
+ * Type alias for an array of inverse attribute names.
1754
1836
  */
1755
- export declare class PlanMode implements NavigationMode {
1756
- private camera;
1757
- /** {@link NavigationMode.enabled} */
1758
- enabled: boolean;
1759
- /** {@link NavigationMode.id} */
1760
- readonly id = "Plan";
1761
- private mouseAction1?;
1762
- private mouseAction2?;
1763
- private mouseInitialized;
1764
- private readonly defaultAzimuthSpeed;
1765
- private readonly defaultPolarSpeed;
1766
- constructor(camera: OrthoPerspectiveCamera);
1767
- /** {@link NavigationMode.set} */
1768
- set(active: boolean): void;
1837
+ export type InverseAttributes = [
1838
+ "IsDecomposedBy",
1839
+ "Decomposes",
1840
+ "AssociatedTo",
1841
+ "HasAssociations",
1842
+ "ClassificationForObjects",
1843
+ "IsGroupedBy",
1844
+ "HasAssignments",
1845
+ "IsDefinedBy",
1846
+ "DefinesOcurrence",
1847
+ "IsTypedBy",
1848
+ "Types",
1849
+ "Defines",
1850
+ "ContainedInStructure",
1851
+ "ContainsElements"
1852
+ ];
1853
+ export type InverseAttribute = InverseAttributes[number];
1854
+ import { BufferGeometry } from "three";
1855
+ import * as THREE from "three";
1856
+ export declare class TransformHelper {
1857
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1769
1858
  }
1770
1859
  import * as THREE from "three";
1771
1860
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1829,159 +1918,71 @@ export declare class SimplePlane implements Disposable, Hideable {
1829
1918
  private static newPlaneMesh;
1830
1919
  }
1831
1920
  import * as THREE from "three";
1832
- import { CameraProjection } from "./types";
1833
- import { Event } from "../../Types";
1834
- import { OrthoPerspectiveCamera } from "../index";
1921
+ import { Components } from "../../Components";
1922
+ import { AsyncEvent, Event, World } from "../../Types";
1923
+ export interface CullerRendererSettings {
1924
+ updateInterval?: number;
1925
+ width?: number;
1926
+ height?: number;
1927
+ autoUpdate?: boolean;
1928
+ }
1835
1929
  /**
1836
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1930
+ * A base renderer to determine visibility on screen
1837
1931
  */
1838
- export declare class ProjectionManager {
1932
+ export declare class CullerRenderer {
1933
+ /** {@link Disposable.onDisposed} */
1934
+ readonly onDisposed: Event<string>;
1839
1935
  /**
1840
- * Event that fires when the {@link CameraProjection} changes.
1936
+ * Fires after making the visibility check to the meshes. It lists the
1937
+ * meshes that are currently visible, and the ones that were visible
1938
+ * just before but not anymore.
1841
1939
  */
1842
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1843
- current: CameraProjection;
1844
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1845
- private _component;
1846
- private _previousDistance;
1847
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1848
- matchOrthoDistanceEnabled: boolean;
1849
- constructor(camera: OrthoPerspectiveCamera);
1940
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1941
+ /** {@link Component.enabled} */
1942
+ enabled: boolean;
1850
1943
  /**
1851
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1852
- *
1853
- * @param projection - the new projection to set. If it is the current projection,
1854
- * it will have no effect.
1944
+ * Needs to check whether there are objects that need to be hidden or shown.
1945
+ * You can bind this to the camera movement, to a certain interval, etc.
1855
1946
  */
1856
- set(projection: CameraProjection): Promise<void>;
1947
+ needsUpdate: boolean;
1857
1948
  /**
1858
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1859
- * and vice versa.
1949
+ * Render the internal scene used to determine the object visibility. Used
1950
+ * for debugging purposes.
1860
1951
  */
1861
- toggle(): Promise<void>;
1862
- private setOrthoCamera;
1863
- private getPerspectiveDims;
1864
- private setupOrthoCamera;
1865
- private getDistance;
1866
- private setPerspectiveCamera;
1867
- }
1868
- /**
1869
- * The projection system of the camera.
1870
- */
1871
- export type CameraProjection = "Perspective" | "Orthographic";
1872
- /**
1873
- * The extensible list of supported navigation modes.
1874
- */
1875
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1876
- /**
1877
- * An object that determines the behavior of the camera controls
1878
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1879
- */
1880
- export interface NavigationMode {
1881
- /** The unique ID of this navigation mode. */
1882
- id: NavModeID;
1952
+ renderDebugFrame: boolean;
1953
+ components: Components;
1954
+ readonly world: World;
1955
+ readonly renderer: THREE.WebGLRenderer;
1956
+ protected autoUpdate: boolean;
1957
+ protected updateInterval: number;
1958
+ protected readonly worker: Worker;
1959
+ protected readonly scene: THREE.Scene;
1960
+ private _width;
1961
+ private _height;
1962
+ private _availableColor;
1963
+ private readonly renderTarget;
1964
+ private readonly bufferSize;
1965
+ private readonly _buffer;
1966
+ protected _isWorkerBusy: boolean;
1967
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1968
+ /** {@link Disposable.dispose} */
1969
+ dispose(): void;
1883
1970
  /**
1884
- * Enable or disable this navigation mode.
1885
- * When a new navigation mode is enabled, the previous navigation mode
1886
- * must be disabled.
1887
- *
1888
- * @param active - whether to enable or disable this mode.
1889
- * @param options - any additional data required to enable or disable it.
1890
- * */
1891
- set: (active: boolean, options?: any) => void;
1892
- /** Whether this navigation mode is active or not. */
1893
- enabled: boolean;
1894
- }
1895
- import * as WEBIFC from "web-ifc";
1896
- import * as THREE from "three";
1897
- export declare class Units {
1898
- factor: number;
1899
- complement: number;
1900
- apply(matrix: THREE.Matrix4): void;
1901
- setUp(webIfc: WEBIFC.IfcAPI): void;
1902
- private getLengthUnits;
1903
- private getScaleMatrix;
1904
- }
1905
- import { IfcFragmentSettings } from "../../IfcLoader/src";
1906
- /** Configuration of the IFC-fragment streaming. */
1907
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1908
- minGeometrySize: number;
1909
- minAssetsSize: number;
1910
- }
1911
- /** Configuration of the IFC-fragment streaming. */
1912
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1913
- propertiesSize: number;
1914
- }
1915
- export interface StreamedGeometries {
1916
- [id: number]: {
1917
- boundingBox: Float32Array;
1918
- hasHoles: boolean;
1919
- geometryFile?: string;
1971
+ * The function that the culler uses to reprocess the scene. Generally it's
1972
+ * better to call needsUpdate, but you can also call this to force it.
1973
+ * @param force if true, it will refresh the scene even if needsUpdate is
1974
+ * not true.
1975
+ */
1976
+ updateVisibility: (force?: boolean) => Promise<void>;
1977
+ protected getAvailableColor(): {
1978
+ r: number;
1979
+ g: number;
1980
+ b: number;
1981
+ code: string;
1920
1982
  };
1921
- }
1922
- export interface StreamedAsset {
1923
- id: number;
1924
- geometries: {
1925
- geometryID: number;
1926
- transformation: number[];
1927
- color: number[];
1928
- }[];
1929
- }
1930
- import * as WEBIFC from "web-ifc";
1931
- import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1932
- import { PropertiesStreamingSettings } from "./streaming-settings";
1933
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1934
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1935
- onPropertiesStreamed: AsyncEvent<{
1936
- type: number;
1937
- data: {
1938
- [id: number]: any;
1939
- };
1940
- }>;
1941
- onProgress: AsyncEvent<number>;
1942
- onIndicesStreamed: AsyncEvent<number[][]>;
1943
- /** {@link Disposable.onDisposed} */
1944
- readonly onDisposed: Event<string>;
1945
- enabled: boolean;
1946
- settings: PropertiesStreamingSettings;
1947
- webIfc: WEBIFC.IfcAPI;
1948
- dispose(): Promise<void>;
1949
- streamFromBuffer(data: Uint8Array): Promise<void>;
1950
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1951
- private readIfcFile;
1952
- private streamIfcFile;
1953
- private streamAllProperties;
1954
- private getIndices;
1955
- private cleanUp;
1956
- }
1957
- export type RelationsMap = Map<number, Map<number, number[]>>;
1958
- export interface ModelsRelationMap {
1959
- [modelID: string]: RelationsMap;
1960
- }
1961
- /**
1962
- * Type alias for an array of inverse attribute names.
1963
- */
1964
- export type InverseAttributes = [
1965
- "IsDecomposedBy",
1966
- "Decomposes",
1967
- "AssociatedTo",
1968
- "HasAssociations",
1969
- "ClassificationForObjects",
1970
- "IsGroupedBy",
1971
- "HasAssignments",
1972
- "IsDefinedBy",
1973
- "DefinesOcurrence",
1974
- "IsTypedBy",
1975
- "Types",
1976
- "Defines",
1977
- "ContainedInStructure",
1978
- "ContainsElements"
1979
- ];
1980
- export type InverseAttribute = InverseAttributes[number];
1981
- import { BufferGeometry } from "three";
1982
- import * as THREE from "three";
1983
- export declare class TransformHelper {
1984
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1983
+ protected increaseColor(): void;
1984
+ protected decreaseColor(): void;
1985
+ private applySettings;
1985
1986
  }
1986
1987
 
1987
1988
  }