@thatopen/components 2.0.0-alpha.1 → 2.0.0-alpha.11

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