@thatopen/components 2.1.24 → 2.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,125 @@
1
1
  declare namespace OBC {
2
+ import * as THREE from "three";
3
+ import { Components } from "../Components";
4
+ import { Component } from "../Types";
5
+ /**
6
+ * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
7
+ */
8
+ export declare class Disposer extends Component {
9
+ private _disposedComponents;
10
+ /** {@link Component.enabled} */
11
+ enabled: boolean;
12
+ /**
13
+ * A unique identifier for the component.
14
+ * This UUID is used to register the component within the Components system.
15
+ */
16
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
17
+ constructor(components: Components);
18
+ /**
19
+ * Return the UUIDs of all disposed components.
20
+ */
21
+ get(): Set<string>;
22
+ /**
23
+ * Removes a mesh, its geometry and its materials from memory. If you are
24
+ * using any of these in other parts of the application, make sure that you
25
+ * remove them from the mesh before disposing it.
26
+ *
27
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
+ * to remove.
29
+ *
30
+ * @param materials - whether to dispose the materials of the mesh.
31
+ *
32
+ * @param recursive - whether to recursively dispose the children of the mesh.
33
+ */
34
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
35
+ /**
36
+ * Disposes a geometry from memory.
37
+ *
38
+ * @param geometry - the
39
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
+ * to remove.
41
+ */
42
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
43
+ private disposeGeometryAndMaterials;
44
+ private disposeChildren;
45
+ private static disposeMaterial;
46
+ }
47
+ import { Component, Disposable, Event } from "../Types";
48
+ /**
49
+ * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
50
+ */
51
+ export declare class Components implements Disposable {
52
+ /**
53
+ * The version of the @thatopen/components library.
54
+ */
55
+ static readonly release = "2.1.26";
56
+ /** {@link Disposable.onDisposed} */
57
+ readonly onDisposed: Event<void>;
58
+ /**
59
+ * The list of components created in this app.
60
+ * The keys are UUIDs and the values are instances of the components.
61
+ */
62
+ readonly list: Map<string, Component>;
63
+ /**
64
+ * If disabled, the animation loop will be stopped.
65
+ * Default value is false.
66
+ */
67
+ enabled: boolean;
68
+ private _clock;
69
+ /**
70
+ * Adds a component to the list of components.
71
+ * Throws an error if a component with the same UUID already exists.
72
+ *
73
+ * @param uuid - The unique identifier of the component.
74
+ * @param instance - The instance of the component to be added.
75
+ *
76
+ * @throws Will throw an error if a component with the same UUID already exists.
77
+ *
78
+ * @internal
79
+ */
80
+ add(uuid: string, instance: Component): void;
81
+ /**
82
+ * Retrieves a component instance by its constructor function.
83
+ * If the component does not exist in the list, it will be created and added.
84
+ *
85
+ * @template U - The type of the component to retrieve.
86
+ * @param Component - The constructor function of the component to retrieve.
87
+ *
88
+ * @returns The instance of the requested component.
89
+ *
90
+ * @throws Will throw an error if a component with the same UUID already exists.
91
+ *
92
+ * @internal
93
+ */
94
+ get<U extends Component>(Component: new (components: Components) => U): U;
95
+ constructor();
96
+ /**
97
+ * Initializes the Components instance.
98
+ * This method starts the animation loop, sets the enabled flag to true,
99
+ * and calls the update method.
100
+ *
101
+ * @returns {void}
102
+ */
103
+ init(): void;
104
+ /**
105
+ * Disposes the memory of all the components and tools of this instance of
106
+ * the library. A memory leak will be created if:
107
+ *
108
+ * - An instance of the library ends up out of scope and this function isn't
109
+ * called. This is especially relevant in Single Page Applications (React,
110
+ * Angular, Vue, etc).
111
+ *
112
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
113
+ * referenced by a reference type (object or array).
114
+ *
115
+ * You can learn more about how Three.js handles memory leaks
116
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
117
+ *
118
+ */
119
+ dispose(): void;
120
+ private update;
121
+ private static setupBVH;
122
+ }
2
123
  import { SimpleScene, SimpleSceneConfig } from "../Worlds";
3
124
  import { DistanceRenderer } from "./src";
4
125
  import { Disposable } from "../Types";
@@ -125,81 +246,96 @@ export declare class Worlds extends Component implements Updateable, Disposable
125
246
  /** {@link Updateable.update} */
126
247
  update(delta?: number): void | Promise<void>;
127
248
  }
128
- import { Component, Disposable, Event } from "../Types";
249
+ import { Component, Disposable, World, Event } from "../Types";
250
+ import { GridConfig, SimpleGrid } from "./src";
251
+ import { Components } from "../Components";
129
252
  /**
130
- * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
253
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
131
254
  */
132
- export declare class Components implements Disposable {
255
+ export declare class Grids extends Component implements Disposable {
133
256
  /**
134
- * The version of the @thatopen/components library.
257
+ * A unique identifier for the component.
258
+ * This UUID is used to register the component within the Components system.
135
259
  */
136
- static readonly release = "2.1.24";
137
- /** {@link Disposable.onDisposed} */
138
- readonly onDisposed: Event<void>;
260
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
139
261
  /**
140
- * The list of components created in this app.
141
- * The keys are UUIDs and the values are instances of the components.
262
+ * A map of world UUIDs to their corresponding grid instances.
142
263
  */
143
- readonly list: Map<string, Component>;
264
+ list: Map<string, SimpleGrid>;
144
265
  /**
145
- * If disabled, the animation loop will be stopped.
146
- * Default value is false.
266
+ * The default configuration for grid creation.
147
267
  */
268
+ config: Required<GridConfig>;
269
+ /** {@link Disposable.onDisposed} */
270
+ readonly onDisposed: Event<unknown>;
271
+ /** {@link Component.enabled} */
148
272
  enabled: boolean;
149
- private _clock;
273
+ constructor(components: Components);
150
274
  /**
151
- * Adds a component to the list of components.
152
- * Throws an error if a component with the same UUID already exists.
153
- *
154
- * @param uuid - The unique identifier of the component.
155
- * @param instance - The instance of the component to be added.
275
+ * Creates a new grid for the given world.
276
+ * Throws an error if a grid already exists for the world.
156
277
  *
157
- * @throws Will throw an error if a component with the same UUID already exists.
278
+ * @param world - The world to create the grid for.
279
+ * @returns The newly created grid.
158
280
  *
159
- * @internal
281
+ * @throws Will throw an error if a grid already exists for the given world.
160
282
  */
161
- add(uuid: string, instance: Component): void;
283
+ create(world: World): SimpleGrid;
162
284
  /**
163
- * Retrieves a component instance by its constructor function.
164
- * If the component does not exist in the list, it will be created and added.
165
- *
166
- * @template U - The type of the component to retrieve.
167
- * @param Component - The constructor function of the component to retrieve.
168
- *
169
- * @returns The instance of the requested component.
285
+ * Deletes the grid associated with the given world.
286
+ * If a grid does not exist for the given world, this method does nothing.
170
287
  *
171
- * @throws Will throw an error if a component with the same UUID already exists.
288
+ * @param world - The world for which to delete the grid.
172
289
  *
173
- * @internal
290
+ * @remarks
291
+ * This method will dispose of the grid and remove it from the internal list.
292
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
174
293
  */
175
- get<U extends Component>(Component: new (components: Components) => U): U;
176
- constructor();
294
+ delete(world: World): void;
295
+ /** {@link Disposable.dispose} */
296
+ dispose(): void;
297
+ }
298
+ import { Component, Disposable, World, Event } from "../Types";
299
+ import { SimpleRaycaster } from "./src";
300
+ import { Components } from "../Components";
301
+ /**
302
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
303
+ */
304
+ export declare class Raycasters extends Component implements Disposable {
177
305
  /**
178
- * Initializes the Components instance.
179
- * This method starts the animation loop, sets the enabled flag to true,
180
- * and calls the update method.
181
- *
182
- * @returns {void}
306
+ * A unique identifier for the component.
307
+ * This UUID is used to register the component within the Components system.
183
308
  */
184
- init(): void;
309
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
310
+ /** {@link Component.enabled} */
311
+ enabled: boolean;
185
312
  /**
186
- * Disposes the memory of all the components and tools of this instance of
187
- * the library. A memory leak will be created if:
188
- *
189
- * - An instance of the library ends up out of scope and this function isn't
190
- * called. This is especially relevant in Single Page Applications (React,
191
- * Angular, Vue, etc).
192
- *
193
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
194
- * referenced by a reference type (object or array).
313
+ * A Map that stores raycasters for each world.
314
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
315
+ */
316
+ list: Map<string, SimpleRaycaster>;
317
+ /** {@link Disposable.onDisposed} */
318
+ onDisposed: Event<unknown>;
319
+ constructor(components: Components);
320
+ /**
321
+ * Retrieves a SimpleRaycaster instance for the given world.
322
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
323
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
195
324
  *
196
- * You can learn more about how Three.js handles memory leaks
197
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
325
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
326
+ * @returns The SimpleRaycaster instance for the given world.
327
+ */
328
+ get(world: World): SimpleRaycaster;
329
+ /**
330
+ * Deletes the SimpleRaycaster instance associated with the given world.
331
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
198
332
  *
333
+ * @param world - The world for which to delete the SimpleRaycaster instance.
334
+ * @returns {void}
199
335
  */
336
+ delete(world: World): void;
337
+ /** {@link Disposable.dispose} */
200
338
  dispose(): void;
201
- private update;
202
- private static setupBVH;
203
339
  }
204
340
  import * as THREE from "three";
205
341
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
@@ -436,157 +572,21 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
436
572
  /** {@link Updateable.update} */
437
573
  update(): void;
438
574
  }
439
- import { Component, Disposable, World, Event } from "../Types";
440
- import { SimpleRaycaster } from "./src";
575
+ import * as THREE from "three";
441
576
  import { Components } from "../Components";
577
+ import { SimpleCamera } from "..";
578
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
442
579
  /**
443
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
580
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
444
581
  */
445
- export declare class Raycasters extends Component implements Disposable {
582
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
446
583
  /**
447
- * A unique identifier for the component.
448
- * This UUID is used to register the component within the Components system.
584
+ * A ProjectionManager instance that manages the projection modes of the camera.
449
585
  */
450
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
451
- /** {@link Component.enabled} */
452
- enabled: boolean;
586
+ readonly projection: ProjectionManager;
453
587
  /**
454
- * A Map that stores raycasters for each world.
455
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
456
- */
457
- list: Map<string, SimpleRaycaster>;
458
- /** {@link Disposable.onDisposed} */
459
- onDisposed: Event<unknown>;
460
- constructor(components: Components);
461
- /**
462
- * Retrieves a SimpleRaycaster instance for the given world.
463
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
464
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
465
- *
466
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
467
- * @returns The SimpleRaycaster instance for the given world.
468
- */
469
- get(world: World): SimpleRaycaster;
470
- /**
471
- * Deletes the SimpleRaycaster instance associated with the given world.
472
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
473
- *
474
- * @param world - The world for which to delete the SimpleRaycaster instance.
475
- * @returns {void}
476
- */
477
- delete(world: World): void;
478
- /** {@link Disposable.dispose} */
479
- dispose(): void;
480
- }
481
- import { Component, Disposable, World, Event } from "../Types";
482
- import { GridConfig, SimpleGrid } from "./src";
483
- import { Components } from "../Components";
484
- /**
485
- * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
486
- */
487
- export declare class Grids extends Component implements Disposable {
488
- /**
489
- * A unique identifier for the component.
490
- * This UUID is used to register the component within the Components system.
491
- */
492
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
493
- /**
494
- * A map of world UUIDs to their corresponding grid instances.
495
- */
496
- list: Map<string, SimpleGrid>;
497
- /**
498
- * The default configuration for grid creation.
499
- */
500
- config: Required<GridConfig>;
501
- /** {@link Disposable.onDisposed} */
502
- readonly onDisposed: Event<unknown>;
503
- /** {@link Component.enabled} */
504
- enabled: boolean;
505
- constructor(components: Components);
506
- /**
507
- * Creates a new grid for the given world.
508
- * Throws an error if a grid already exists for the world.
509
- *
510
- * @param world - The world to create the grid for.
511
- * @returns The newly created grid.
512
- *
513
- * @throws Will throw an error if a grid already exists for the given world.
514
- */
515
- create(world: World): SimpleGrid;
516
- /**
517
- * Deletes the grid associated with the given world.
518
- * If a grid does not exist for the given world, this method does nothing.
519
- *
520
- * @param world - The world for which to delete the grid.
521
- *
522
- * @remarks
523
- * This method will dispose of the grid and remove it from the internal list.
524
- * If the world is disposed before calling this method, the grid will be automatically deleted.
525
- */
526
- delete(world: World): void;
527
- /** {@link Disposable.dispose} */
528
- dispose(): void;
529
- }
530
- import * as THREE from "three";
531
- import { Components } from "../Components";
532
- import { Component } from "../Types";
533
- /**
534
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
535
- */
536
- export declare class Disposer extends Component {
537
- private _disposedComponents;
538
- /** {@link Component.enabled} */
539
- enabled: boolean;
540
- /**
541
- * A unique identifier for the component.
542
- * This UUID is used to register the component within the Components system.
543
- */
544
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
545
- constructor(components: Components);
546
- /**
547
- * Return the UUIDs of all disposed components.
548
- */
549
- get(): Set<string>;
550
- /**
551
- * Removes a mesh, its geometry and its materials from memory. If you are
552
- * using any of these in other parts of the application, make sure that you
553
- * remove them from the mesh before disposing it.
554
- *
555
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
556
- * to remove.
557
- *
558
- * @param materials - whether to dispose the materials of the mesh.
559
- *
560
- * @param recursive - whether to recursively dispose the children of the mesh.
561
- */
562
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
563
- /**
564
- * Disposes a geometry from memory.
565
- *
566
- * @param geometry - the
567
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
568
- * to remove.
569
- */
570
- disposeGeometry(geometry: THREE.BufferGeometry): void;
571
- private disposeGeometryAndMaterials;
572
- private disposeChildren;
573
- private static disposeMaterial;
574
- }
575
- import * as THREE from "three";
576
- import { Components } from "../Components";
577
- import { SimpleCamera } from "..";
578
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
579
- /**
580
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
581
- */
582
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
583
- /**
584
- * A ProjectionManager instance that manages the projection modes of the camera.
585
- */
586
- readonly projection: ProjectionManager;
587
- /**
588
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
589
- * This camera is used when the projection mode is set to orthographic.
588
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
589
+ * This camera is used when the projection mode is set to orthographic.
590
590
  */
591
591
  readonly threeOrtho: THREE.OrthographicCamera;
592
592
  /**
@@ -643,339 +643,92 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
643
643
  rotation: THREE.Matrix3;
644
644
  transformation: THREE.Matrix4;
645
645
  };
646
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
647
- import * as THREE from "three";
648
- export declare class MaterialsUtils {
649
- static isTransparent(material: THREE.Material): boolean;
650
- }
651
- import * as THREE from "three";
652
- import * as FRAGS from "@thatopen/fragments";
646
+ import * as WEBIFC from "web-ifc";
647
+ import * as FRAG from "@thatopen/fragments";
653
648
  import { Component, Components } from "../../core";
654
649
  /**
655
- * Represents an edge measurement result.
650
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
656
651
  */
657
- export interface MeasureEdge {
652
+ export declare class IfcJsonExporter extends Component {
658
653
  /**
659
- * The distance between the two points of the edge.
654
+ * A unique identifier for the component.
655
+ * This UUID is used to register the component within the Components system.
660
656
  */
661
- distance: number;
657
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
658
+ /** {@link Component.enabled} */
659
+ enabled: boolean;
660
+ constructor(components: Components);
662
661
  /**
663
- * The two points that define the edge.
662
+ * Exports all the properties of an IFC into an array of JS objects.
663
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
664
+ * @param modelID ID of the IFC model whose properties to extract.
665
+ * @param indirect whether to get the indirect relationships as well.
666
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
667
+ * to make the location data available (e.g. absolute position of building).
664
668
  */
665
- points: THREE.Vector3[];
669
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
666
670
  }
671
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
672
+ import * as WEBIFC from "web-ifc";
673
+ import { FragmentsGroup } from "@thatopen/fragments";
674
+ import { Component, Disposable, Event, Components } from "../../core";
667
675
  /**
668
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
676
+ * Types for boolean properties in IFC schema.
669
677
  */
670
- export declare class MeasurementUtils extends Component {
678
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
679
+ /**
680
+ * Types for string properties in IFC schema.
681
+ */
682
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
683
+ /**
684
+ * Types for numeric properties in IFC schema.
685
+ */
686
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
687
+ /**
688
+ * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
689
+ */
690
+ export interface ChangeMap {
691
+ [modelID: string]: Set<number>;
692
+ }
693
+ /**
694
+ * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
695
+ */
696
+ export interface AttributeListener {
697
+ [modelID: string]: {
698
+ [expressID: number]: {
699
+ [attributeName: string]: Event<String | Boolean | Number>;
700
+ };
701
+ };
702
+ }
703
+ /**
704
+ * Component to manage and edit properties and Psets in IFC files.
705
+ */
706
+ export declare class IfcPropertiesManager extends Component implements Disposable {
671
707
  /**
672
708
  * A unique identifier for the component.
673
709
  * This UUID is used to register the component within the Components system.
674
710
  */
675
- static uuid: string;
676
- /** {@link Component.enabled} */
677
- enabled: boolean;
678
- constructor(components: Components);
711
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
712
+ /** {@link Disposable.onDisposed} */
713
+ readonly onDisposed: Event<string>;
679
714
  /**
680
- * Utility method to calculate the distance from a point to a line segment.
681
- *
682
- * @param point - The point from which to calculate the distance.
683
- * @param lineStart - The start point of the line segment.
684
- * @param lineEnd - The end point of the line segment.
685
- * @param clamp - If true, the distance will be clamped to the line segment's length.
686
- * @returns The distance from the point to the line segment.
715
+ * Event triggered when a file is requested for export.
687
716
  */
688
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
717
+ readonly onRequestFile: Event<unknown>;
689
718
  /**
690
- * Method to get the face of a mesh that contains a given triangle index.
691
- * It also returns the edges of the found face and their indices.
692
- *
693
- * @param mesh - The mesh to get the face from. It must be indexed.
694
- * @param triangleIndex - The index of the triangle within the mesh.
695
- * @param instance - The instance of the mesh (optional).
696
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
719
+ * ArrayBuffer containing the IFC data to be exported.
697
720
  */
698
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
699
- edges: MeasureEdge[];
700
- indices: Set<number>;
701
- } | null;
721
+ ifcToExport: ArrayBuffer | null;
702
722
  /**
703
- * Method to get the vertices and normal of a mesh face at a given index.
704
- * It also applies instance transformation if provided.
705
- *
706
- * @param mesh - The mesh to get the face from. It must be indexed.
707
- * @param faceIndex - The index of the face within the mesh.
708
- * @param instance - The instance of the mesh (optional).
709
- * @returns An object containing the vertices and normal of the face.
710
- * @throws Will throw an error if the geometry is not indexed.
723
+ * Event triggered when an element is added to a Pset.
711
724
  */
712
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
713
- p1: THREE.Vector3;
714
- p2: THREE.Vector3;
715
- p3: THREE.Vector3;
716
- faceNormal: THREE.Vector3;
717
- };
725
+ readonly onElementToPset: Event<{
726
+ model: FragmentsGroup;
727
+ psetID: number;
728
+ elementID: number;
729
+ }>;
718
730
  /**
719
- * Method to round the vector's components to a specified number of decimal places.
720
- * This is used to ensure numerical precision in edge detection.
721
- *
722
- * @param vector - The vector to round.
723
- * @returns The vector with rounded components.
724
- */
725
- round(vector: THREE.Vector3): void;
726
- /**
727
- * Calculates the volume of a set of fragments.
728
- *
729
- * @param frags - A map of fragment IDs to their corresponding item IDs.
730
- * @returns The total volume of the fragments and the bounding sphere.
731
- *
732
- * @remarks
733
- * This method creates a set of instanced meshes from the given fragments and item IDs.
734
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
735
- *
736
- * @throws Will throw an error if the geometry of the meshes is not indexed.
737
- * @throws Will throw an error if the fragment manager is not available.
738
- */
739
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
740
- /**
741
- * Calculates the total volume of a set of meshes.
742
- *
743
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
744
- * @returns The total volume of the meshes and the bounding sphere.
745
- *
746
- * @remarks
747
- * This method calculates the volume of each mesh in the provided array and returns the total volume
748
- * and its bounding sphere.
749
- *
750
- */
751
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
752
- private getFaceData;
753
- private getVolumeOfMesh;
754
- private getSignedVolumeOfTriangle;
755
- }
756
- import * as WEBIFC from "web-ifc";
757
- import { FragmentsGroup } from "@thatopen/fragments";
758
- import { Disposable, Event, Component, Components } from "../../core";
759
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
760
- export type { InverseAttribute, RelationsMap } from "./src/types";
761
- /**
762
- * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
763
- */
764
- export declare class IfcRelationsIndexer extends Component implements Disposable {
765
- /**
766
- * A unique identifier for the component.
767
- * This UUID is used to register the component within the Components system.
768
- */
769
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
770
- /** {@link Disposable.onDisposed} */
771
- readonly onDisposed: Event<string>;
772
- /**
773
- * Event triggered when relations for a model have been indexed.
774
- * This event provides the model's UUID and the relations map generated for that model.
775
- *
776
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
777
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
778
- * 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.
779
- */
780
- readonly onRelationsIndexed: Event<{
781
- modelID: string;
782
- relationsMap: RelationsMap;
783
- }>;
784
- /**
785
- * Holds the relationship mappings for each model processed by the indexer.
786
- * The structure is a map where each key is a model's UUID, and the value is another map.
787
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
788
- * representing a specific relation type, and the value is an array of expressIDs of entities
789
- * that are related through that relation type. This structure allows for efficient querying
790
- * of entity relationships within a model.
791
- */
792
- readonly relationMaps: ModelsRelationMap;
793
- /** {@link Component.enabled} */
794
- enabled: boolean;
795
- private _relToAttributesMap;
796
- private _inverseAttributes;
797
- private _ifcRels;
798
- constructor(components: Components);
799
- private onFragmentsDisposed;
800
- private indexRelations;
801
- private getAttributeIndex;
802
- /**
803
- * Adds a relation map to the model's relations map.
804
- *
805
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
806
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
807
- *
808
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
809
- */
810
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
811
- /**
812
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
813
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
814
- * and maps them in a structured way to facilitate quick access to related entities.
815
- *
816
- * The process involves querying the model for each relation type associated with the inverse attributes
817
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
818
- * and contains a nested map where each key is an entity's expressID and its value is another map.
819
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
820
- * of entities that are related through that attribute.
821
- *
822
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
823
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
824
- * representation of the relations indexed by entity expressIDs and relation types.
825
- * @throws An error if the model does not have properties loaded.
826
- */
827
- process(model: FragmentsGroup): Promise<RelationsMap>;
828
- /**
829
- * Processes a given model from a WebIfc API to index its IFC entities relations.
830
- *
831
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
832
- * @param modelID - The unique identifier of the model within the WebIfc API.
833
- * @returns A promise that resolves to the relations map for the processed model.
834
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
835
- */
836
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
837
- /**
838
- * Retrieves the relations of a specific entity within a model based on the given relation name.
839
- * This method searches the indexed relation maps for the specified model and entity,
840
- * returning the IDs of related entities if a match is found.
841
- *
842
- * @param model The 'FragmentsGroup' model containing the entity.
843
- * @param expressID The unique identifier of the entity within the model.
844
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
845
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
846
- * or the specified relation name is not indexed.
847
- */
848
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
849
- /**
850
- * Serializes the relations of a given relation map into a JSON string.
851
- * 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,
852
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
853
- * The resulting object is then serialized into a JSON string.
854
- *
855
- * @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.
856
- * @returns A JSON string representing the serialized relations of the given relation map.
857
- */
858
- serializeRelations(relationMap: RelationsMap): string;
859
- /**
860
- * Serializes the relations of a specific model into a JSON string.
861
- * This method iterates through the relations indexed for the given model,
862
- * organizing them into a structured object where each key is an expressID of an entity,
863
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
864
- * The resulting object is then serialized into a JSON string.
865
- *
866
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
867
- * @returns A JSON string representing the serialized relations of the specified model.
868
- * If the model has no indexed relations, 'null' is returned.
869
- */
870
- serializeModelRelations(model: FragmentsGroup): string | null;
871
- /**
872
- * Serializes all relations of every model processed by the indexer into a JSON string.
873
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
874
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
875
- * and its value is another object mapping entity expressIDs to their related entities, categorized
876
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
877
- *
878
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
879
- * If no relations have been indexed, an empty object is returned as a JSON string.
880
- */
881
- serializeAllRelations(): string;
882
- /**
883
- * Converts a JSON string representing relations between entities into a structured map.
884
- * This method parses the JSON string to reconstruct the relations map that indexes
885
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
886
- * and the values are maps where each key is a relation type ID and its value is an array
887
- * of express IDs of entities related through that relation type.
888
- *
889
- * @param json The JSON string to be parsed into the relations map.
890
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
891
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
892
- * is an array of express IDs (as numbers) of entities related through that relation type.
893
- */
894
- getRelationsMapFromJSON(json: string): RelationsMap;
895
- /** {@link Disposable.dispose} */
896
- dispose(): void;
897
- /**
898
- * Adds relations between an entity and other entities in a BIM model.
899
- *
900
- * @param model - The BIM model to which the relations will be added.
901
- * @param expressID - The expressID of the entity within the model.
902
- * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
903
- * @param relIDs - The expressIDs of the related entities within the model.
904
- *
905
- * @throws An error if the relation name is not a valid relation name.
906
- */
907
- addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
908
- /**
909
- * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
910
- *
911
- * @param model The BIM model whose children to get.
912
- * @param expressID The expressID of the item whose children to get.
913
- * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
914
- *
915
- * @returns A 'Set' with the expressIDs of the found items.
916
- */
917
- getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
918
- }
919
- import * as WEBIFC from "web-ifc";
920
- import { FragmentsGroup } from "@thatopen/fragments";
921
- import { Component, Disposable, Event, Components } from "../../core";
922
- /**
923
- * Types for boolean properties in IFC schema.
924
- */
925
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
926
- /**
927
- * Types for string properties in IFC schema.
928
- */
929
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
930
- /**
931
- * Types for numeric properties in IFC schema.
932
- */
933
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
934
- /**
935
- * Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
936
- */
937
- export interface ChangeMap {
938
- [modelID: string]: Set<number>;
939
- }
940
- /**
941
- * Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
942
- */
943
- export interface AttributeListener {
944
- [modelID: string]: {
945
- [expressID: number]: {
946
- [attributeName: string]: Event<String | Boolean | Number>;
947
- };
948
- };
949
- }
950
- /**
951
- * Component to manage and edit properties and Psets in IFC files.
952
- */
953
- export declare class IfcPropertiesManager extends Component implements Disposable {
954
- /**
955
- * A unique identifier for the component.
956
- * This UUID is used to register the component within the Components system.
957
- */
958
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
959
- /** {@link Disposable.onDisposed} */
960
- readonly onDisposed: Event<string>;
961
- /**
962
- * Event triggered when a file is requested for export.
963
- */
964
- readonly onRequestFile: Event<unknown>;
965
- /**
966
- * ArrayBuffer containing the IFC data to be exported.
967
- */
968
- ifcToExport: ArrayBuffer | null;
969
- /**
970
- * Event triggered when an element is added to a Pset.
971
- */
972
- readonly onElementToPset: Event<{
973
- model: FragmentsGroup;
974
- psetID: number;
975
- elementID: number;
976
- }>;
977
- /**
978
- * Event triggered when a property is added to a Pset.
731
+ * Event triggered when a property is added to a Pset.
979
732
  */
980
733
  readonly onPropToPset: Event<{
981
734
  model: FragmentsGroup;
@@ -1173,233 +926,272 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1173
926
  private newSingleProperty;
1174
927
  }
1175
928
  import * as WEBIFC from "web-ifc";
1176
- import * as FRAG from "@thatopen/fragments";
1177
- import { Component, Components } from "../../core";
929
+ import { FragmentsGroup } from "@thatopen/fragments";
930
+ import { Disposable, Event, Component, Components } from "../../core";
931
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
932
+ export type { InverseAttribute, RelationsMap } from "./src/types";
1178
933
  /**
1179
- * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
934
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1180
935
  */
1181
- export declare class IfcJsonExporter extends Component {
936
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1182
937
  /**
1183
938
  * A unique identifier for the component.
1184
939
  * This UUID is used to register the component within the Components system.
1185
940
  */
1186
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1187
- /** {@link Component.enabled} */
1188
- enabled: boolean;
1189
- constructor(components: Components);
1190
- /**
1191
- * Exports all the properties of an IFC into an array of JS objects.
1192
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1193
- * @param modelID ID of the IFC model whose properties to extract.
1194
- * @param indirect whether to get the indirect relationships as well.
1195
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1196
- * to make the location data available (e.g. absolute position of building).
1197
- */
1198
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1199
- }
1200
- import * as THREE from "three";
1201
- import { Component, Components, Disposable, Event, World } from "../core";
1202
- /**
1203
- * Configuration interface for the VertexPicker component.
1204
- */
1205
- export interface VertexPickerConfig {
941
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
942
+ /** {@link Disposable.onDisposed} */
943
+ readonly onDisposed: Event<string>;
1206
944
  /**
1207
- * If true, only vertices will be picked, not the closest point on the face.
945
+ * Event triggered when relations for a model have been indexed.
946
+ * This event provides the model's UUID and the relations map generated for that model.
947
+ *
948
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
949
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
950
+ * 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.
1208
951
  */
1209
- showOnlyVertex: boolean;
952
+ readonly onRelationsIndexed: Event<{
953
+ modelID: string;
954
+ relationsMap: RelationsMap;
955
+ }>;
1210
956
  /**
1211
- * The maximum distance for snapping to a vertex.
957
+ * Holds the relationship mappings for each model processed by the indexer.
958
+ * The structure is a map where each key is a model's UUID, and the value is another map.
959
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
960
+ * representing a specific relation type, and the value is an array of expressIDs of entities
961
+ * that are related through that relation type. This structure allows for efficient querying
962
+ * of entity relationships within a model.
1212
963
  */
1213
- snapDistance: number;
964
+ readonly relationMaps: ModelsRelationMap;
965
+ /** {@link Component.enabled} */
966
+ enabled: boolean;
967
+ private _relToAttributesMap;
968
+ private _inverseAttributes;
969
+ private _ifcRels;
970
+ constructor(components: Components);
971
+ private onFragmentsDisposed;
972
+ private indexRelations;
973
+ private getAttributeIndex;
1214
974
  /**
1215
- * The HTML element to use for previewing the picked vertex.
975
+ * Adds a relation map to the model's relations map.
976
+ *
977
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
978
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
979
+ *
980
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1216
981
  */
1217
- previewElement: HTMLElement;
1218
- }
1219
- /**
1220
- * A class that provides functionality for picking vertices in a 3D scene.
1221
- */
1222
- export declare class VertexPicker extends Component implements Disposable {
1223
- /** {@link Disposable.onDisposed} */
1224
- readonly onDisposed: Event<unknown>;
982
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1225
983
  /**
1226
- * An event that is triggered when a vertex is found.
1227
- * The event passes a THREE.Vector3 representing the position of the found vertex.
984
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
985
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
986
+ * and maps them in a structured way to facilitate quick access to related entities.
987
+ *
988
+ * The process involves querying the model for each relation type associated with the inverse attributes
989
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
990
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
991
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
992
+ * of entities that are related through that attribute.
993
+ *
994
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
995
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
996
+ * representation of the relations indexed by entity expressIDs and relation types.
997
+ * @throws An error if the model does not have properties loaded.
1228
998
  */
1229
- readonly onVertexFound: Event<THREE.Vector3>;
999
+ process(model: FragmentsGroup): Promise<RelationsMap>;
1230
1000
  /**
1231
- * An event that is triggered when a vertex is lost.
1232
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1001
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
1002
+ *
1003
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1004
+ * @param modelID - The unique identifier of the model within the WebIfc API.
1005
+ * @returns A promise that resolves to the relations map for the processed model.
1006
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1233
1007
  */
1234
- readonly onVertexLost: Event<THREE.Vector3>;
1008
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1235
1009
  /**
1236
- * An event that is triggered when the picker is enabled or disabled
1010
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
1011
+ * This method searches the indexed relation maps for the specified model and entity,
1012
+ * returning the IDs of related entities if a match is found.
1013
+ *
1014
+ * @param model The 'FragmentsGroup' model containing the entity.
1015
+ * @param expressID The unique identifier of the entity within the model.
1016
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1017
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1018
+ * or the specified relation name is not indexed.
1237
1019
  */
1238
- readonly onEnabled: Event<boolean>;
1020
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1239
1021
  /**
1240
- * A reference to the Components instance associated with this VertexPicker.
1022
+ * Serializes the relations of a given relation map into a JSON string.
1023
+ * 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,
1024
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1025
+ * The resulting object is then serialized into a JSON string.
1026
+ *
1027
+ * @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.
1028
+ * @returns A JSON string representing the serialized relations of the given relation map.
1241
1029
  */
1242
- components: Components;
1030
+ serializeRelations(relationMap: RelationsMap): string;
1243
1031
  /**
1244
- * A reference to the working plane used for vertex picking.
1245
- * This plane is used to determine which vertices are considered valid for picking.
1246
- * If this value is null, all vertices are considered valid.
1032
+ * Serializes the relations of a specific model into a JSON string.
1033
+ * This method iterates through the relations indexed for the given model,
1034
+ * organizing them into a structured object where each key is an expressID of an entity,
1035
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1036
+ * The resulting object is then serialized into a JSON string.
1037
+ *
1038
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1039
+ * @returns A JSON string representing the serialized relations of the specified model.
1040
+ * If the model has no indexed relations, 'null' is returned.
1247
1041
  */
1248
- workingPlane: THREE.Plane | null;
1249
- private _pickedPoint;
1250
- private _config;
1251
- private _enabled;
1042
+ serializeModelRelations(model: FragmentsGroup): string | null;
1252
1043
  /**
1253
- * Sets the enabled state of the VertexPicker.
1254
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1255
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1044
+ * Serializes all relations of every model processed by the indexer into a JSON string.
1045
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1046
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1047
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
1048
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
1256
1049
  *
1257
- * @param value - The new enabled state.
1050
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1051
+ * If no relations have been indexed, an empty object is returned as a JSON string.
1258
1052
  */
1259
- set enabled(value: boolean);
1053
+ serializeAllRelations(): string;
1260
1054
  /**
1261
- * Gets the current enabled state of the VertexPicker.
1055
+ * Converts a JSON string representing relations between entities into a structured map.
1056
+ * This method parses the JSON string to reconstruct the relations map that indexes
1057
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1058
+ * and the values are maps where each key is a relation type ID and its value is an array
1059
+ * of express IDs of entities related through that relation type.
1262
1060
  *
1263
- * @returns The current enabled state.
1061
+ * @param json The JSON string to be parsed into the relations map.
1062
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1063
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1064
+ * is an array of express IDs (as numbers) of entities related through that relation type.
1264
1065
  */
1265
- get enabled(): boolean;
1066
+ getRelationsMapFromJSON(json: string): RelationsMap;
1067
+ /** {@link Disposable.dispose} */
1068
+ dispose(): void;
1266
1069
  /**
1267
- * Sets the configuration for the VertexPicker component.
1070
+ * Adds relations between an entity and other entities in a BIM model.
1268
1071
  *
1269
- * @param value - A Partial object containing the configuration properties to update.
1270
- * The properties not provided in the value object will retain their current values.
1072
+ * @param model - The BIM model to which the relations will be added.
1073
+ * @param expressID - The expressID of the entity within the model.
1074
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
1075
+ * @param relIDs - The expressIDs of the related entities within the model.
1271
1076
  *
1272
- * @example
1273
- * '''typescript
1274
- * vertexPicker.config = {
1275
- * snapDistance: 0.5,
1276
- * showOnlyVertex: true,
1277
- * };
1278
- * '''
1077
+ * @throws An error if the relation name is not a valid relation name.
1279
1078
  */
1280
- set config(value: Partial<VertexPickerConfig>);
1079
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
1281
1080
  /**
1282
- * Gets the current configuration for the VertexPicker component.
1081
+ * Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
1283
1082
  *
1284
- * @returns A copy of the current VertexPickerConfig object.
1083
+ * @param model The BIM model whose children to get.
1084
+ * @param expressID The expressID of the item whose children to get.
1085
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1285
1086
  *
1286
- * @example
1287
- * '''typescript
1288
- * const currentConfig = vertexPicker.config;
1289
- * console.log(currentConfig.snapDistance); // Output: 0.25
1290
- * '''
1087
+ * @returns A 'Set' with the expressIDs of the found items.
1291
1088
  */
1292
- get config(): Partial<VertexPickerConfig>;
1293
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1294
- /** {@link Disposable.dispose} */
1295
- dispose(): void;
1089
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
1090
+ }
1091
+ import * as THREE from "three";
1092
+ import * as FRAGS from "@thatopen/fragments";
1093
+ import { Component, Components } from "../../core";
1094
+ /**
1095
+ * Represents an edge measurement result.
1096
+ */
1097
+ export interface MeasureEdge {
1296
1098
  /**
1297
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1298
- *
1299
- * @param world - The World instance to use for raycasting.
1300
- *
1301
- * @returns The current picked point, or null if no point is picked.
1302
- *
1303
- * @remarks
1304
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1305
- * If enabled, it performs raycasting to find the closest intersecting object.
1306
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1307
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1308
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1309
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1099
+ * The distance between the two points of the edge.
1310
1100
  */
1311
- get(world: World): THREE.Vector3 | null;
1312
- private getClosestVertex;
1313
- private getVertices;
1314
- private getVertex;
1101
+ distance: number;
1102
+ /**
1103
+ * The two points that define the edge.
1104
+ */
1105
+ points: THREE.Vector3[];
1315
1106
  }
1316
- import { Component, Disposable, Event, Components } from "../../core";
1317
1107
  /**
1318
- * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
1108
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1319
1109
  */
1320
- export declare class Exploder extends Component implements Disposable {
1110
+ export declare class MeasurementUtils extends Component {
1321
1111
  /**
1322
1112
  * A unique identifier for the component.
1323
1113
  * This UUID is used to register the component within the Components system.
1324
1114
  */
1325
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1326
- /** {@link Disposable.onDisposed} */
1327
- readonly onDisposed: Event<unknown>;
1115
+ static uuid: string;
1328
1116
  /** {@link Component.enabled} */
1329
1117
  enabled: boolean;
1118
+ constructor(components: Components);
1330
1119
  /**
1331
- * The height of the explosion animation.
1332
- * This property determines the vertical distance by which fragments are moved during the explosion.
1333
- * Default value is 10.
1120
+ * Utility method to calculate the distance from a point to a line segment.
1121
+ *
1122
+ * @param point - The point from which to calculate the distance.
1123
+ * @param lineStart - The start point of the line segment.
1124
+ * @param lineEnd - The end point of the line segment.
1125
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
1126
+ * @returns The distance from the point to the line segment.
1334
1127
  */
1335
- height: number;
1128
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1336
1129
  /**
1337
- * The group name used for the explosion animation.
1338
- * This property specifies the group of fragments that will be affected by the explosion.
1339
- * Default value is "storeys".
1130
+ * Method to get the face of a mesh that contains a given triangle index.
1131
+ * It also returns the edges of the found face and their indices.
1132
+ *
1133
+ * @param mesh - The mesh to get the face from. It must be indexed.
1134
+ * @param triangleIndex - The index of the triangle within the mesh.
1135
+ * @param instance - The instance of the mesh (optional).
1136
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1340
1137
  */
1341
- groupName: string;
1138
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1139
+ edges: MeasureEdge[];
1140
+ indices: Set<number>;
1141
+ } | null;
1142
+ /**
1143
+ * Method to get the vertices and normal of a mesh face at a given index.
1144
+ * It also applies instance transformation if provided.
1145
+ *
1146
+ * @param mesh - The mesh to get the face from. It must be indexed.
1147
+ * @param faceIndex - The index of the face within the mesh.
1148
+ * @param instance - The instance of the mesh (optional).
1149
+ * @returns An object containing the vertices and normal of the face.
1150
+ * @throws Will throw an error if the geometry is not indexed.
1151
+ */
1152
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1153
+ p1: THREE.Vector3;
1154
+ p2: THREE.Vector3;
1155
+ p3: THREE.Vector3;
1156
+ faceNormal: THREE.Vector3;
1157
+ };
1342
1158
  /**
1343
- * A set of strings representing the exploded items.
1344
- * This set is used to keep track of which items have been exploded.
1159
+ * Method to round the vector's components to a specified number of decimal places.
1160
+ * This is used to ensure numerical precision in edge detection.
1161
+ *
1162
+ * @param vector - The vector to round.
1163
+ * @returns The vector with rounded components.
1345
1164
  */
1346
- list: Set<string>;
1347
- constructor(components: Components);
1348
- /** {@link Disposable.dispose} */
1349
- dispose(): void;
1165
+ round(vector: THREE.Vector3): void;
1350
1166
  /**
1351
- * Sets the explosion state of the fragments.
1167
+ * Calculates the volume of a set of fragments.
1352
1168
  *
1353
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1169
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
1170
+ * @returns The total volume of the fragments and the bounding sphere.
1354
1171
  *
1355
1172
  * @remarks
1356
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1357
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1358
- * If 'active' is false, the fragments are moved back to their original position.
1359
- *
1360
- * The method also keeps track of the exploded items using the 'list' set.
1173
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
1174
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1361
1175
  *
1362
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1363
- */
1364
- set(active: boolean): void;
1365
- }
1366
- import * as FRAGS from "@thatopen/fragments";
1367
- import { Components, Component } from "../../core";
1368
- /**
1369
- * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
1370
- */
1371
- export declare class Hider extends Component {
1372
- /**
1373
- * A unique identifier for the component.
1374
- * This UUID is used to register the component within the Components system.
1176
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
1177
+ * @throws Will throw an error if the fragment manager is not available.
1375
1178
  */
1376
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1377
- /** {@link Component.enabled} */
1378
- enabled: boolean;
1379
- constructor(components: Components);
1179
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
1380
1180
  /**
1381
- * Sets the visibility of fragments within the 3D scene.
1382
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1383
- * If 'items' is provided, only the specified fragments will be affected.
1384
- *
1385
- * @param visible - The visibility state to set for the fragments.
1386
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1387
- * If not provided, all fragments will be affected.
1181
+ * Calculates the total volume of a set of meshes.
1388
1182
  *
1389
- * @returns {void}
1390
- */
1391
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1392
- /**
1393
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1394
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1183
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
1184
+ * @returns The total volume of the meshes and the bounding sphere.
1395
1185
  *
1396
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1397
- * If not provided, all fragments will be isolated.
1186
+ * @remarks
1187
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
1188
+ * and its bounding sphere.
1398
1189
  *
1399
- * @returns {void}
1400
1190
  */
1401
- isolate(items: FRAGS.FragmentIdMap): void;
1402
- private updateCulledVisibility;
1191
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
1192
+ private getFaceData;
1193
+ private getVolumeOfMesh;
1194
+ private getSignedVolumeOfTriangle;
1403
1195
  }
1404
1196
  import * as THREE from "three";
1405
1197
  import * as FRAGS from "@thatopen/fragments";
@@ -1583,146 +1375,293 @@ export declare class BoundingBoxer extends Component implements Disposable {
1583
1375
  * boundingBoxer.addMesh(mesh);
1584
1376
  * '''
1585
1377
  */
1586
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1378
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
1379
+ /**
1380
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
1381
+ *
1382
+ * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1383
+ * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
1384
+ *
1385
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
1386
+ *
1387
+ * @remarks
1388
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1389
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
1390
+ *
1391
+ * @example
1392
+ * '''typescript
1393
+ * const boundingBoxer = components.get(BoundingBoxer);
1394
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
1395
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1396
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1397
+ * };
1398
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1399
+ * '''
1400
+ */
1401
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1402
+ private static getFragmentBounds;
1403
+ }
1404
+ import * as THREE from "three";
1405
+ import * as FRAGS from "@thatopen/fragments";
1406
+ import { Disposable, Component, Event, Components } from "../../core";
1407
+ /**
1408
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
1409
+ */
1410
+ export interface Classification {
1411
+ /**
1412
+ * A system within the classification.
1413
+ * The key is the system name, and the value is an object representing the classes within the system.
1414
+ */
1415
+ [system: string]: {
1416
+ /**
1417
+ * A class within the system.
1418
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1419
+ */
1420
+ [className: string]: {
1421
+ map: FRAGS.FragmentIdMap;
1422
+ name: string;
1423
+ id: number | null;
1424
+ };
1425
+ };
1426
+ }
1427
+ /**
1428
+ * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
1429
+ */
1430
+ export declare class Classifier extends Component implements Disposable {
1431
+ /**
1432
+ * A unique identifier for the component.
1433
+ * This UUID is used to register the component within the Components system.
1434
+ */
1435
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1436
+ /** {@link Component.enabled} */
1437
+ enabled: boolean;
1438
+ /**
1439
+ * A map representing the classification systems.
1440
+ * The key is the system name, and the value is an object representing the classes within the system.
1441
+ */
1442
+ list: Classification;
1443
+ /** {@link Disposable.onDisposed} */
1444
+ readonly onDisposed: Event<unknown>;
1445
+ constructor(components: Components);
1446
+ private onFragmentsDisposed;
1447
+ /** {@link Disposable.dispose} */
1448
+ dispose(): void;
1449
+ /**
1450
+ * Removes a fragment from the classification based on its unique identifier (guid).
1451
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1452
+ *
1453
+ * @param guid - The unique identifier of the fragment to be removed.
1454
+ */
1455
+ remove(guid: string): void;
1456
+ /**
1457
+ * Finds and returns fragments based on the provided filter criteria.
1458
+ * If no filter is provided, it returns all fragments.
1459
+ *
1460
+ * @param filter - An optional object containing filter criteria.
1461
+ * The keys of the object represent the classification system names,
1462
+ * and the values are arrays of class names to match.
1463
+ *
1464
+ * @returns A map of fragment GUIDs to their respective express IDs,
1465
+ * where the express IDs are filtered based on the provided filter criteria.
1466
+ *
1467
+ * @throws Will throw an error if the fragments map is malformed.
1468
+ */
1469
+ find(filter?: {
1470
+ [name: string]: string[];
1471
+ }): FRAGS.FragmentIdMap;
1472
+ /**
1473
+ * Classifies fragments based on their modelID.
1474
+ *
1475
+ * @param modelID - The unique identifier of the model to classify fragments by.
1476
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1477
+ *
1478
+ * @remarks
1479
+ * This method iterates through the fragments in the provided group,
1480
+ * and classifies them based on their modelID.
1481
+ * The classification is stored in the 'list.models' property,
1482
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1483
+ *
1484
+ */
1485
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1486
+ /**
1487
+ * Classifies fragments based on their PredefinedType property.
1488
+ *
1489
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1490
+ *
1491
+ * @remarks
1492
+ * This method iterates through the properties of the fragments in the provided group,
1493
+ * and classifies them based on their PredefinedType property.
1494
+ * The classification is stored in the 'list.predefinedTypes' property,
1495
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1496
+ *
1497
+ * @throws Will throw an error if the fragment ID is not found.
1498
+ */
1499
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1500
+ /**
1501
+ * Classifies fragments based on their entity type.
1502
+ *
1503
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1504
+ *
1505
+ * @remarks
1506
+ * This method iterates through the relations of the fragments in the provided group,
1507
+ * and classifies them based on their entity type.
1508
+ * The classification is stored in the 'list.entities' property,
1509
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1510
+ *
1511
+ * @throws Will throw an error if the fragment ID is not found.
1512
+ */
1513
+ byEntity(group: FRAGS.FragmentsGroup): void;
1514
+ /**
1515
+ * Classifies fragments based on a specific IFC relationship.
1516
+ *
1517
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1518
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1519
+ * @param systemName - The name of the classification system to store the classification.
1520
+ *
1521
+ * @remarks
1522
+ * This method iterates through the relations of the fragments in the provided group,
1523
+ * and classifies them based on the specified IFC relationship.
1524
+ * The classification is stored in the 'list' property under the specified system name,
1525
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1526
+ *
1527
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1528
+ */
1529
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1530
+ /**
1531
+ * Classifies fragments based on their spatial structure in the IFC model.
1532
+ *
1533
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1534
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1535
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1536
+ * the classifier just pick the WEBIFC categories provided.
1537
+ *
1538
+ * @remarks
1539
+ * This method iterates through the relations of the fragments in the provided group,
1540
+ * and classifies them based on their spatial structure in the IFC model.
1541
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1542
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1543
+ *
1544
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1545
+ */
1546
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1547
+ useProperties?: boolean;
1548
+ isolate?: Set<number>;
1549
+ }): Promise<void>;
1550
+ /**
1551
+ * Sets the color of the specified fragments.
1552
+ *
1553
+ * @param items - A map of fragment IDs to their respective express IDs.
1554
+ * @param color - The color to set for the fragments.
1555
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1556
+ *
1557
+ * @remarks
1558
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1559
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1560
+ *
1561
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1562
+ */
1563
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1587
1564
  /**
1588
- * Uses a FragmentIdMap to add its meshes to the bb calculation.
1589
- *
1590
- * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
1591
- * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
1565
+ * Resets the color of the specified fragments to their original color.
1592
1566
  *
1593
- * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
1567
+ * @param items - A map of fragment IDs to their respective express IDs.
1594
1568
  *
1595
1569
  * @remarks
1596
- * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
1597
- * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
1570
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1571
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1598
1572
  *
1599
- * @example
1600
- * '''typescript
1601
- * const boundingBoxer = components.get(BoundingBoxer);
1602
- * const fragmentIdMap: FRAGS.FragmentIdMap = {
1603
- * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
1604
- * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
1605
- * };
1606
- * boundingBoxer.addFragmentIdMap(fragmentIdMap);
1607
- * '''
1573
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1608
1574
  */
1609
- addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1610
- private static getFragmentBounds;
1575
+ resetColor(items: FRAGS.FragmentIdMap): void;
1576
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1611
1577
  }
1612
- import * as WEBIFC from "web-ifc";
1613
- import * as FRAGS from "@thatopen/fragments";
1614
- import { IfcFragmentSettings } from "./src";
1615
- import { Component, Components, Event, Disposable } from "../../core";
1578
+ import { Component, Disposable, Event, Components } from "../../core";
1616
1579
  /**
1617
- * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1580
+ * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
1618
1581
  */
1619
- export declare class IfcLoader extends Component implements Disposable {
1582
+ export declare class Exploder extends Component implements Disposable {
1620
1583
  /**
1621
1584
  * A unique identifier for the component.
1622
1585
  * This UUID is used to register the component within the Components system.
1623
1586
  */
1624
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1587
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1625
1588
  /** {@link Disposable.onDisposed} */
1626
- readonly onDisposed: Event<string>;
1627
- /**
1628
- * An event triggered when the IFC file starts loading.
1629
- */
1630
- readonly onIfcStartedLoading: Event<void>;
1589
+ readonly onDisposed: Event<unknown>;
1590
+ /** {@link Component.enabled} */
1591
+ enabled: boolean;
1631
1592
  /**
1632
- * An event triggered when the setup process is completed.
1593
+ * The height of the explosion animation.
1594
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1595
+ * Default value is 10.
1633
1596
  */
1634
- readonly onSetup: Event<void>;
1597
+ height: number;
1635
1598
  /**
1636
- * The settings for the IfcLoader.
1637
- * It includes options for excluding categories, setting WASM paths, and more.
1599
+ * The group name used for the explosion animation.
1600
+ * This property specifies the group of fragments that will be affected by the explosion.
1601
+ * Default value is "storeys".
1638
1602
  */
1639
- settings: IfcFragmentSettings;
1603
+ groupName: string;
1640
1604
  /**
1641
- * The instance of the Web-IFC library used for handling IFC data.
1605
+ * A set of strings representing the exploded items.
1606
+ * This set is used to keep track of which items have been exploded.
1642
1607
  */
1643
- webIfc: WEBIFC.IfcAPI;
1644
- /** {@link Component.enabled} */
1645
- enabled: boolean;
1646
- private _material;
1647
- private _spatialTree;
1648
- private _metaData;
1649
- private _fragmentInstances;
1650
- private _civil;
1651
- private _visitedFragments;
1652
- private _materialT;
1608
+ list: Set<string>;
1653
1609
  constructor(components: Components);
1654
1610
  /** {@link Disposable.dispose} */
1655
1611
  dispose(): void;
1656
1612
  /**
1657
- * Sets up the IfcLoader component with the provided configuration.
1658
- *
1659
- * @param config - Optional configuration settings for the IfcLoader.
1660
- * If not provided, the existing settings will be used.
1613
+ * Sets the explosion state of the fragments.
1661
1614
  *
1662
- * @returns A Promise that resolves when the setup process is completed.
1615
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1663
1616
  *
1664
1617
  * @remarks
1665
- * If the 'autoSetWasm' option is enabled in the configuration,
1666
- * the method will automatically set the WASM paths for the Web-IFC library.
1618
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1619
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1620
+ * If 'active' is false, the fragments are moved back to their original position.
1667
1621
  *
1668
- * @example
1669
- * '''typescript
1670
- * const ifcLoader = new IfcLoader(components);
1671
- * await ifcLoader.setup({ autoSetWasm: true });
1672
- * '''
1622
+ * The method also keeps track of the exploded items using the 'list' set.
1623
+ *
1624
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1673
1625
  */
1674
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1626
+ set(active: boolean): void;
1627
+ }
1628
+ import * as FRAGS from "@thatopen/fragments";
1629
+ import { Components, Component } from "../../core";
1630
+ /**
1631
+ * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
1632
+ */
1633
+ export declare class Hider extends Component {
1675
1634
  /**
1676
- * Loads an IFC file and processes it for 3D visualization.
1677
- *
1678
- * @param data - The Uint8Array containing the IFC file data.
1679
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1680
- *
1681
- * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1682
- *
1683
- * @example
1684
- * '''typescript
1685
- * const ifcLoader = components.get(IfcLoader);
1686
- * const group = await ifcLoader.load(ifcData);
1687
- * '''
1635
+ * A unique identifier for the component.
1636
+ * This UUID is used to register the component within the Components system.
1688
1637
  */
1689
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1638
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1639
+ /** {@link Component.enabled} */
1640
+ enabled: boolean;
1641
+ constructor(components: Components);
1690
1642
  /**
1691
- * Reads an IFC file and initializes the Web-IFC library.
1692
- *
1693
- * @param data - The Uint8Array containing the IFC file data.
1694
- *
1695
- * @returns A Promise that resolves when the IFC file is opened and initialized.
1643
+ * Sets the visibility of fragments within the 3D scene.
1644
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1645
+ * If 'items' is provided, only the specified fragments will be affected.
1696
1646
  *
1697
- * @remarks
1698
- * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1699
- * It also opens the IFC model using the provided data and settings.
1647
+ * @param visible - The visibility state to set for the fragments.
1648
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1649
+ * If not provided, all fragments will be affected.
1700
1650
  *
1701
- * @example
1702
- * '''typescript
1703
- * const ifcLoader = components.get(IfcLoader);
1704
- * await ifcLoader.readIfcFile(ifcData);
1705
- * '''
1651
+ * @returns {void}
1706
1652
  */
1707
- readIfcFile(data: Uint8Array): Promise<number>;
1653
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1708
1654
  /**
1709
- * Cleans up the IfcLoader component by resetting the Web-IFC library,
1710
- * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1655
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1656
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1711
1657
  *
1712
- * @remarks
1713
- * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1658
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1659
+ * If not provided, all fragments will be isolated.
1714
1660
  *
1715
- * @example
1716
- * '''typescript
1717
- * const ifcLoader = components.get(IfcLoader);
1718
- * ifcLoader.cleanUp();
1719
- * '''
1661
+ * @returns {void}
1720
1662
  */
1721
- cleanUp(): void;
1722
- private getAllGeometries;
1723
- private getMesh;
1724
- private getGeometry;
1725
- private autoSetWasm;
1663
+ isolate(items: FRAGS.FragmentIdMap): void;
1664
+ private updateCulledVisibility;
1726
1665
  }
1727
1666
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1728
1667
  import * as THREE from "three";
@@ -1814,51 +1753,166 @@ export declare class FragmentsManager extends Component implements Disposable {
1814
1753
  [modelID: string]: Set<number>;
1815
1754
  };
1816
1755
  /**
1817
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1818
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1819
- * @returns A fragment ID map.
1756
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1757
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1758
+ * @returns A fragment ID map.
1759
+ * @remarks
1760
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1761
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1762
+ * The fragment ID maps are then merged into a single map and returned.
1763
+ * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1764
+ */
1765
+ modelIdToFragmentIdMap(modelIdMap: {
1766
+ [modelID: string]: Set<number>;
1767
+ }): FRAGS.FragmentIdMap;
1768
+ /**
1769
+ * Applies coordinate transformation to the provided models.
1770
+ * If no models are provided, all groups are used.
1771
+ * The first model in the list becomes the base model for coordinate transformation.
1772
+ * All other models are then transformed to match the base model's coordinate system.
1773
+ *
1774
+ * @param models - The models to apply coordinate transformation to.
1775
+ * If not provided, all models are used.
1776
+ */
1777
+ coordinate(models?: FragmentsGroup[]): void;
1778
+ /**
1779
+ * Applies the base coordinate system to the provided object.
1780
+ *
1781
+ * This function takes an object and its original coordinate system as input.
1782
+ * It then inverts the original coordinate system and applies the base coordinate system
1783
+ * to the object. This ensures that the object's position, rotation, and scale are
1784
+ * transformed to match the base coordinate system (which is taken from the first model loaded).
1785
+ *
1786
+ * @param object - The object to which the base coordinate system will be applied.
1787
+ * This should be an instance of THREE.Object3D.
1788
+ *
1789
+ * @param originalCoordinateSystem - The original coordinate system of the object.
1790
+ * This should be a THREE.Matrix4 representing the object's transformation matrix.
1791
+ */
1792
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1793
+ /**
1794
+ * Creates a copy of the whole model or a part of it.
1795
+ *
1796
+ * @param model - The model to clone.
1797
+ * @param items - Optional - The part of the model to be cloned. If not given, the whole group is cloned.
1798
+ *
1799
+ */
1800
+ clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
1801
+ }
1802
+ import * as WEBIFC from "web-ifc";
1803
+ import * as FRAGS from "@thatopen/fragments";
1804
+ import { IfcFragmentSettings } from "./src";
1805
+ import { Component, Components, Event, Disposable } from "../../core";
1806
+ /**
1807
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1808
+ */
1809
+ export declare class IfcLoader extends Component implements Disposable {
1810
+ /**
1811
+ * A unique identifier for the component.
1812
+ * This UUID is used to register the component within the Components system.
1813
+ */
1814
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1815
+ /** {@link Disposable.onDisposed} */
1816
+ readonly onDisposed: Event<string>;
1817
+ /**
1818
+ * An event triggered when the IFC file starts loading.
1819
+ */
1820
+ readonly onIfcStartedLoading: Event<void>;
1821
+ /**
1822
+ * An event triggered when the setup process is completed.
1823
+ */
1824
+ readonly onSetup: Event<void>;
1825
+ /**
1826
+ * The settings for the IfcLoader.
1827
+ * It includes options for excluding categories, setting WASM paths, and more.
1828
+ */
1829
+ settings: IfcFragmentSettings;
1830
+ /**
1831
+ * The instance of the Web-IFC library used for handling IFC data.
1832
+ */
1833
+ webIfc: WEBIFC.IfcAPI;
1834
+ /** {@link Component.enabled} */
1835
+ enabled: boolean;
1836
+ private _material;
1837
+ private _spatialTree;
1838
+ private _metaData;
1839
+ private _fragmentInstances;
1840
+ private _civil;
1841
+ private _visitedFragments;
1842
+ private _materialT;
1843
+ constructor(components: Components);
1844
+ /** {@link Disposable.dispose} */
1845
+ dispose(): void;
1846
+ /**
1847
+ * Sets up the IfcLoader component with the provided configuration.
1848
+ *
1849
+ * @param config - Optional configuration settings for the IfcLoader.
1850
+ * If not provided, the existing settings will be used.
1851
+ *
1852
+ * @returns A Promise that resolves when the setup process is completed.
1853
+ *
1820
1854
  * @remarks
1821
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1822
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1823
- * The fragment ID maps are then merged into a single map and returned.
1824
- * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1855
+ * If the 'autoSetWasm' option is enabled in the configuration,
1856
+ * the method will automatically set the WASM paths for the Web-IFC library.
1857
+ *
1858
+ * @example
1859
+ * '''typescript
1860
+ * const ifcLoader = new IfcLoader(components);
1861
+ * await ifcLoader.setup({ autoSetWasm: true });
1862
+ * '''
1825
1863
  */
1826
- modelIdToFragmentIdMap(modelIdMap: {
1827
- [modelID: string]: Set<number>;
1828
- }): FRAGS.FragmentIdMap;
1864
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1829
1865
  /**
1830
- * Applies coordinate transformation to the provided models.
1831
- * If no models are provided, all groups are used.
1832
- * The first model in the list becomes the base model for coordinate transformation.
1833
- * All other models are then transformed to match the base model's coordinate system.
1866
+ * Loads an IFC file and processes it for 3D visualization.
1834
1867
  *
1835
- * @param models - The models to apply coordinate transformation to.
1836
- * If not provided, all models are used.
1868
+ * @param data - The Uint8Array containing the IFC file data.
1869
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1870
+ *
1871
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1872
+ *
1873
+ * @example
1874
+ * '''typescript
1875
+ * const ifcLoader = components.get(IfcLoader);
1876
+ * const group = await ifcLoader.load(ifcData);
1877
+ * '''
1837
1878
  */
1838
- coordinate(models?: FragmentsGroup[]): void;
1879
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1839
1880
  /**
1840
- * Applies the base coordinate system to the provided object.
1881
+ * Reads an IFC file and initializes the Web-IFC library.
1841
1882
  *
1842
- * This function takes an object and its original coordinate system as input.
1843
- * It then inverts the original coordinate system and applies the base coordinate system
1844
- * to the object. This ensures that the object's position, rotation, and scale are
1845
- * transformed to match the base coordinate system (which is taken from the first model loaded).
1883
+ * @param data - The Uint8Array containing the IFC file data.
1846
1884
  *
1847
- * @param object - The object to which the base coordinate system will be applied.
1848
- * This should be an instance of THREE.Object3D.
1885
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
1849
1886
  *
1850
- * @param originalCoordinateSystem - The original coordinate system of the object.
1851
- * This should be a THREE.Matrix4 representing the object's transformation matrix.
1887
+ * @remarks
1888
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1889
+ * It also opens the IFC model using the provided data and settings.
1890
+ *
1891
+ * @example
1892
+ * '''typescript
1893
+ * const ifcLoader = components.get(IfcLoader);
1894
+ * await ifcLoader.readIfcFile(ifcData);
1895
+ * '''
1852
1896
  */
1853
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
1897
+ readIfcFile(data: Uint8Array): Promise<number>;
1854
1898
  /**
1855
- * Creates a copy of the whole model or a part of it.
1899
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
1900
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1856
1901
  *
1857
- * @param model - The model to clone.
1858
- * @param items - Optional - The part of the model to be cloned. If not given, the whole group is cloned.
1902
+ * @remarks
1903
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1859
1904
  *
1905
+ * @example
1906
+ * '''typescript
1907
+ * const ifcLoader = components.get(IfcLoader);
1908
+ * ifcLoader.cleanUp();
1909
+ * '''
1860
1910
  */
1861
- clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
1911
+ cleanUp(): void;
1912
+ private getAllGeometries;
1913
+ private getMesh;
1914
+ private getGeometry;
1915
+ private autoSetWasm;
1862
1916
  }
1863
1917
  import * as WEBIFC from "web-ifc";
1864
1918
  import { Components, Disposable, Event, Component } from "../../core";
@@ -2023,197 +2077,150 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
2023
2077
  private streamAllProperties;
2024
2078
  private cleanUp;
2025
2079
  }
2026
- /**
2027
- * A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
2028
- *
2029
- * @remarks
2030
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2031
- * It is useful for identifying and processing different types of IFC elements in a project.
2032
- *
2033
- */
2034
- export declare const IfcElements: {
2035
- [key: number]: string;
2036
- };
2037
- export declare class UUID {
2038
- private static _pattern;
2039
- private static _lut;
2040
- static create(): string;
2041
- static validate(uuid: string): void;
2080
+ import * as THREE from "three";
2081
+ export declare class MaterialsUtils {
2082
+ static isTransparent(material: THREE.Material): boolean;
2042
2083
  }
2043
2084
  import * as THREE from "three";
2044
- import * as FRAGS from "@thatopen/fragments";
2045
- import { Disposable, Component, Event, Components } from "../../core";
2085
+ import { Component, Components, Disposable, Event, World } from "../core";
2046
2086
  /**
2047
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
2087
+ * Configuration interface for the VertexPicker component.
2048
2088
  */
2049
- export interface Classification {
2089
+ export interface VertexPickerConfig {
2050
2090
  /**
2051
- * A system within the classification.
2052
- * The key is the system name, and the value is an object representing the classes within the system.
2091
+ * If true, only vertices will be picked, not the closest point on the face.
2053
2092
  */
2054
- [system: string]: {
2055
- /**
2056
- * A class within the system.
2057
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
2058
- */
2059
- [className: string]: {
2060
- map: FRAGS.FragmentIdMap;
2061
- name: string;
2062
- id: number | null;
2063
- };
2064
- };
2065
- }
2066
- /**
2067
- * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
2068
- */
2069
- export declare class Classifier extends Component implements Disposable {
2093
+ showOnlyVertex: boolean;
2070
2094
  /**
2071
- * A unique identifier for the component.
2072
- * This UUID is used to register the component within the Components system.
2095
+ * The maximum distance for snapping to a vertex.
2073
2096
  */
2074
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
2075
- /** {@link Component.enabled} */
2076
- enabled: boolean;
2097
+ snapDistance: number;
2077
2098
  /**
2078
- * A map representing the classification systems.
2079
- * The key is the system name, and the value is an object representing the classes within the system.
2099
+ * The HTML element to use for previewing the picked vertex.
2080
2100
  */
2081
- list: Classification;
2101
+ previewElement: HTMLElement;
2102
+ }
2103
+ /**
2104
+ * A class that provides functionality for picking vertices in a 3D scene.
2105
+ */
2106
+ export declare class VertexPicker extends Component implements Disposable {
2082
2107
  /** {@link Disposable.onDisposed} */
2083
2108
  readonly onDisposed: Event<unknown>;
2084
- constructor(components: Components);
2085
- private onFragmentsDisposed;
2086
- /** {@link Disposable.dispose} */
2087
- dispose(): void;
2088
- /**
2089
- * Removes a fragment from the classification based on its unique identifier (guid).
2090
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
2091
- *
2092
- * @param guid - The unique identifier of the fragment to be removed.
2093
- */
2094
- remove(guid: string): void;
2095
2109
  /**
2096
- * Finds and returns fragments based on the provided filter criteria.
2097
- * If no filter is provided, it returns all fragments.
2098
- *
2099
- * @param filter - An optional object containing filter criteria.
2100
- * The keys of the object represent the classification system names,
2101
- * and the values are arrays of class names to match.
2102
- *
2103
- * @returns A map of fragment GUIDs to their respective express IDs,
2104
- * where the express IDs are filtered based on the provided filter criteria.
2105
- *
2106
- * @throws Will throw an error if the fragments map is malformed.
2110
+ * An event that is triggered when a vertex is found.
2111
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
2107
2112
  */
2108
- find(filter?: {
2109
- [name: string]: string[];
2110
- }): FRAGS.FragmentIdMap;
2113
+ readonly onVertexFound: Event<THREE.Vector3>;
2111
2114
  /**
2112
- * Classifies fragments based on their modelID.
2113
- *
2114
- * @param modelID - The unique identifier of the model to classify fragments by.
2115
- * @param group - The FragmentsGroup containing the fragments to be classified.
2116
- *
2117
- * @remarks
2118
- * This method iterates through the fragments in the provided group,
2119
- * and classifies them based on their modelID.
2120
- * The classification is stored in the 'list.models' property,
2121
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
2122
- *
2115
+ * An event that is triggered when a vertex is lost.
2116
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
2123
2117
  */
2124
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
2118
+ readonly onVertexLost: Event<THREE.Vector3>;
2125
2119
  /**
2126
- * Classifies fragments based on their PredefinedType property.
2127
- *
2128
- * @param group - The FragmentsGroup containing the fragments to be classified.
2129
- *
2130
- * @remarks
2131
- * This method iterates through the properties of the fragments in the provided group,
2132
- * and classifies them based on their PredefinedType property.
2133
- * The classification is stored in the 'list.predefinedTypes' property,
2134
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
2135
- *
2136
- * @throws Will throw an error if the fragment ID is not found.
2120
+ * An event that is triggered when the picker is enabled or disabled
2137
2121
  */
2138
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
2122
+ readonly onEnabled: Event<boolean>;
2139
2123
  /**
2140
- * Classifies fragments based on their entity type.
2141
- *
2142
- * @param group - The FragmentsGroup containing the fragments to be classified.
2143
- *
2144
- * @remarks
2145
- * This method iterates through the relations of the fragments in the provided group,
2146
- * and classifies them based on their entity type.
2147
- * The classification is stored in the 'list.entities' property,
2148
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
2149
- *
2150
- * @throws Will throw an error if the fragment ID is not found.
2124
+ * A reference to the Components instance associated with this VertexPicker.
2151
2125
  */
2152
- byEntity(group: FRAGS.FragmentsGroup): void;
2126
+ components: Components;
2153
2127
  /**
2154
- * Classifies fragments based on a specific IFC relationship.
2155
- *
2156
- * @param group - The FragmentsGroup containing the fragments to be classified.
2157
- * @param ifcRel - The IFC relationship number to classify fragments by.
2158
- * @param systemName - The name of the classification system to store the classification.
2159
- *
2160
- * @remarks
2161
- * This method iterates through the relations of the fragments in the provided group,
2162
- * and classifies them based on the specified IFC relationship.
2163
- * The classification is stored in the 'list' property under the specified system name,
2164
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
2165
- *
2166
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
2128
+ * A reference to the working plane used for vertex picking.
2129
+ * This plane is used to determine which vertices are considered valid for picking.
2130
+ * If this value is null, all vertices are considered valid.
2167
2131
  */
2168
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
2132
+ workingPlane: THREE.Plane | null;
2133
+ private _pickedPoint;
2134
+ private _config;
2135
+ private _enabled;
2169
2136
  /**
2170
- * Classifies fragments based on their spatial structure in the IFC model.
2171
- *
2172
- * @param model - The FragmentsGroup containing the fragments to be classified.
2173
- * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
2174
- * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
2175
- * the classifier just pick the WEBIFC categories provided.
2176
- *
2177
- * @remarks
2178
- * This method iterates through the relations of the fragments in the provided group,
2179
- * and classifies them based on their spatial structure in the IFC model.
2180
- * The classification is stored in the 'list' property under the system name "spatialStructures",
2181
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
2137
+ * Sets the enabled state of the VertexPicker.
2138
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
2139
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
2182
2140
  *
2183
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
2141
+ * @param value - The new enabled state.
2184
2142
  */
2185
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
2186
- useProperties?: boolean;
2187
- isolate?: Set<number>;
2188
- }): Promise<void>;
2143
+ set enabled(value: boolean);
2189
2144
  /**
2190
- * Sets the color of the specified fragments.
2145
+ * Gets the current enabled state of the VertexPicker.
2191
2146
  *
2192
- * @param items - A map of fragment IDs to their respective express IDs.
2193
- * @param color - The color to set for the fragments.
2194
- * @param override - A boolean indicating whether to override the existing color of the fragments.
2147
+ * @returns The current enabled state.
2148
+ */
2149
+ get enabled(): boolean;
2150
+ /**
2151
+ * Sets the configuration for the VertexPicker component.
2195
2152
  *
2196
- * @remarks
2197
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
2198
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
2153
+ * @param value - A Partial object containing the configuration properties to update.
2154
+ * The properties not provided in the value object will retain their current values.
2199
2155
  *
2200
- * @throws Will throw an error if the fragment with the specified ID is not found.
2156
+ * @example
2157
+ * '''typescript
2158
+ * vertexPicker.config = {
2159
+ * snapDistance: 0.5,
2160
+ * showOnlyVertex: true,
2161
+ * };
2162
+ * '''
2201
2163
  */
2202
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
2164
+ set config(value: Partial<VertexPickerConfig>);
2203
2165
  /**
2204
- * Resets the color of the specified fragments to their original color.
2166
+ * Gets the current configuration for the VertexPicker component.
2205
2167
  *
2206
- * @param items - A map of fragment IDs to their respective express IDs.
2168
+ * @returns A copy of the current VertexPickerConfig object.
2207
2169
  *
2208
- * @remarks
2209
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
2210
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
2170
+ * @example
2171
+ * '''typescript
2172
+ * const currentConfig = vertexPicker.config;
2173
+ * console.log(currentConfig.snapDistance); // Output: 0.25
2174
+ * '''
2175
+ */
2176
+ get config(): Partial<VertexPickerConfig>;
2177
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
2178
+ /** {@link Disposable.dispose} */
2179
+ dispose(): void;
2180
+ /**
2181
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
2211
2182
  *
2212
- * @throws Will throw an error if the fragment with the specified ID is not found.
2183
+ * @param world - The World instance to use for raycasting.
2184
+ *
2185
+ * @returns The current picked point, or null if no point is picked.
2186
+ *
2187
+ * @remarks
2188
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2189
+ * If enabled, it performs raycasting to find the closest intersecting object.
2190
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
2191
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2192
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2193
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
2213
2194
  */
2214
- resetColor(items: FRAGS.FragmentIdMap): void;
2215
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
2195
+ get(world: World): THREE.Vector3 | null;
2196
+ private getClosestVertex;
2197
+ private getVertices;
2198
+ private getVertex;
2199
+ }
2200
+ export declare class UUID {
2201
+ private static _pattern;
2202
+ private static _lut;
2203
+ static create(): string;
2204
+ static validate(uuid: string): void;
2205
+ }
2206
+ import * as WEBIFC from "web-ifc";
2207
+ export interface IfcItemsCategories {
2208
+ [itemID: number]: number;
2209
+ }
2210
+ export declare class IfcCategories {
2211
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2216
2212
  }
2213
+ /**
2214
+ * A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
2215
+ *
2216
+ * @remarks
2217
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2218
+ * It is useful for identifying and processing different types of IFC elements in a project.
2219
+ *
2220
+ */
2221
+ export declare const IfcElements: {
2222
+ [key: number]: string;
2223
+ };
2217
2224
  /**
2218
2225
  * A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
2219
2226
  */
@@ -2245,13 +2252,10 @@ export declare class IfcPropertiesUtils {
2245
2252
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2246
2253
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2247
2254
  }
2248
- import * as WEBIFC from "web-ifc";
2249
- export interface IfcItemsCategories {
2250
- [itemID: number]: number;
2251
- }
2252
- export declare class IfcCategories {
2253
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2254
- }
2255
+ /**
2256
+ * A Set of unique numbers representing different types of IFC geometries.
2257
+ */
2258
+ export declare const GeometryTypes: Set<number>;
2255
2259
  import * as THREE from "three";
2256
2260
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2257
2261
  /**
@@ -2346,11 +2350,6 @@ export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153
2346
2350
  forRelating: InverseAttribute;
2347
2351
  forRelated: InverseAttribute;
2348
2352
  }>;
2349
- import * as FRAGS from "@thatopen/fragments";
2350
- import * as WEBIFC from "web-ifc";
2351
- export declare class SpatialIdsFinder {
2352
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2353
- }
2354
2353
  import * as WEBIFC from "web-ifc";
2355
2354
  /** Configuration of the IFC-fragment conversion. */
2356
2355
  export declare class IfcFragmentSettings {
@@ -2395,116 +2394,91 @@ export declare class IfcFragmentSettings {
2395
2394
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2396
2395
  }
2397
2396
  import * as THREE from "three";
2398
- import { Event, World } from "../../Types";
2399
- import { Components } from "../../Components";
2397
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2400
2398
  /**
2401
- * A base renderer to determine visibility on screen.
2399
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2400
+ *
2401
+ * @template T - The type of the scene. Default is BaseScene.
2402
+ * @template U - The type of the camera. Default is BaseCamera.
2403
+ * @template S - The type of the renderer. Default is BaseRenderer.
2402
2404
  */
2403
- export declare class DistanceRenderer {
2404
- /** {@link Disposable.onDisposed} */
2405
- readonly onDisposed: Event<string>;
2405
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2406
2406
  /**
2407
- * Fires after making the visibility check to the meshes. It lists the
2408
- * meshes that are currently visible, and the ones that were visible
2409
- * just before but not anymore.
2407
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2410
2408
  */
2411
- readonly onDistanceComputed: Event<number>;
2409
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2410
+ /** {@link Updateable.onAfterUpdate} */
2411
+ readonly onAfterUpdate: Event<unknown>;
2412
+ /** {@link Updateable.onBeforeUpdate} */
2413
+ readonly onBeforeUpdate: Event<unknown>;
2414
+ /** {@link Disposable.onDisposed} */
2415
+ readonly onDisposed: Event<unknown>;
2412
2416
  /**
2413
- * Objects that won't be taken into account in the distance check.
2417
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2414
2418
  */
2415
- excludedObjects: Set<THREE.Object3D<THREE.Object3DEventMap>>;
2419
+ isDisposing: boolean;
2416
2420
  /**
2417
- * Whether this renderer is active or not. If not, it won't render anything.
2421
+ * Indicates whether the world is currently enabled.
2422
+ * When disabled, the world will not be updated.
2418
2423
  */
2419
2424
  enabled: boolean;
2420
2425
  /**
2421
- * Render the internal scene used to determine the object visibility. Used
2422
- * for debugging purposes.
2423
- */
2424
- renderDebugFrame: boolean;
2425
- /** The components instance to which this renderer belongs. */
2426
- components: Components;
2427
- /**
2428
- * The scene where the distance is computed.
2426
+ * A unique identifier for the world.
2429
2427
  */
2430
- scene: THREE.Scene;
2428
+ uuid: string;
2431
2429
  /**
2432
- * The camera used to compute the distance.
2430
+ * An optional name for the world.
2433
2431
  */
2434
- camera: THREE.OrthographicCamera;
2432
+ name?: string;
2433
+ private _scene?;
2434
+ private _camera?;
2435
+ private _renderer;
2435
2436
  /**
2436
- * The material used to compute the distance.
2437
+ * Getter for the scene. If no scene is initialized, it throws an error.
2438
+ * @returns The current scene.
2437
2439
  */
2438
- depthMaterial: THREE.ShaderMaterial;
2439
- /** The world instance to which this renderer belongs. */
2440
- readonly world: World;
2441
- /** The THREE.js renderer used to make the visibility test. */
2442
- readonly renderer: THREE.WebGLRenderer;
2443
- protected readonly worker: Worker;
2444
- private _width;
2445
- private _height;
2446
- private readonly _postQuad;
2447
- private readonly tempRT;
2448
- private readonly resultRT;
2449
- private readonly bufferSize;
2450
- private readonly _buffer;
2451
- protected _isWorkerBusy: boolean;
2452
- constructor(components: Components, world: World);
2453
- /** {@link Disposable.dispose} */
2454
- dispose(): void;
2440
+ get scene(): T;
2455
2441
  /**
2456
- * The function that the culler uses to reprocess the scene. Generally it's
2457
- * better to call needsUpdate, but you can also call this to force it.
2458
- * @param force if true, it will refresh the scene even if needsUpdate is
2459
- * not true.
2442
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2443
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2444
+ * @param scene - The new scene to be set.
2460
2445
  */
2461
- compute: () => Promise<void>;
2462
- private handleWorkerMessage;
2463
- }
2464
- import * as WEBIFC from "web-ifc";
2465
- import { IfcItemsCategories } from "../../../ifc";
2466
- export declare class SpatialStructure {
2467
- itemsByFloor: IfcItemsCategories;
2468
- private _units;
2469
- setUp(webIfc: WEBIFC.IfcAPI): void;
2470
- cleanUp(): void;
2471
- }
2472
- /**
2473
- * A Set of unique numbers representing different types of IFC geometries.
2474
- */
2475
- export declare const GeometryTypes: Set<number>;
2476
- import * as THREE from "three";
2477
- import { Components } from "../../Components";
2478
- import { AsyncEvent, Event, World } from "../../Types";
2479
- /**
2480
- * Settings to configure the CullerRenderer.
2481
- */
2482
- export interface CullerRendererSettings {
2446
+ set scene(scene: T);
2483
2447
  /**
2484
- * Interval in milliseconds at which the visibility check should be performed.
2485
- * Default value is 1000.
2448
+ * Getter for the camera. If no camera is initialized, it throws an error.
2449
+ * @returns The current camera.
2486
2450
  */
2487
- updateInterval?: number;
2451
+ get camera(): U;
2488
2452
  /**
2489
- * Width of the render target used for visibility checks.
2490
- * Default value is 512.
2453
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2454
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2455
+ * @param camera - The new camera to be set.
2491
2456
  */
2492
- width?: number;
2457
+ set camera(camera: U);
2493
2458
  /**
2494
- * Height of the render target used for visibility checks.
2495
- * Default value is 512.
2459
+ * Getter for the renderer.
2460
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
2496
2461
  */
2497
- height?: number;
2462
+ get renderer(): S | null;
2498
2463
  /**
2499
- * Whether the visibility check should be performed automatically.
2500
- * Default value is true.
2464
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2465
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2466
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2467
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
2501
2468
  */
2502
- autoUpdate?: boolean;
2469
+ set renderer(renderer: S | null);
2470
+ /** {@link Updateable.update} */
2471
+ update(delta?: number): void;
2472
+ /** {@link Disposable.dispose} */
2473
+ dispose(disposeResources?: boolean): void;
2503
2474
  }
2475
+ import * as THREE from "three";
2476
+ import { Event, World } from "../../Types";
2477
+ import { Components } from "../../Components";
2504
2478
  /**
2505
2479
  * A base renderer to determine visibility on screen.
2506
2480
  */
2507
- export declare class CullerRenderer {
2481
+ export declare class DistanceRenderer {
2508
2482
  /** {@link Disposable.onDisposed} */
2509
2483
  readonly onDisposed: Event<string>;
2510
2484
  /**
@@ -2512,16 +2486,15 @@ export declare class CullerRenderer {
2512
2486
  * meshes that are currently visible, and the ones that were visible
2513
2487
  * just before but not anymore.
2514
2488
  */
2515
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2489
+ readonly onDistanceComputed: Event<number>;
2516
2490
  /**
2517
- * Whether this renderer is active or not. If not, it won't render anything.
2491
+ * Objects that won't be taken into account in the distance check.
2518
2492
  */
2519
- enabled: boolean;
2493
+ excludedObjects: Set<THREE.Object3D<THREE.Object3DEventMap>>;
2520
2494
  /**
2521
- * Needs to check whether there are objects that need to be hidden or shown.
2522
- * You can bind this to the camera movement, to a certain interval, etc.
2495
+ * Whether this renderer is active or not. If not, it won't render anything.
2523
2496
  */
2524
- needsUpdate: boolean;
2497
+ enabled: boolean;
2525
2498
  /**
2526
2499
  * Render the internal scene used to determine the object visibility. Used
2527
2500
  * for debugging purposes.
@@ -2529,22 +2502,32 @@ export declare class CullerRenderer {
2529
2502
  renderDebugFrame: boolean;
2530
2503
  /** The components instance to which this renderer belongs. */
2531
2504
  components: Components;
2505
+ /**
2506
+ * The scene where the distance is computed.
2507
+ */
2508
+ scene: THREE.Scene;
2509
+ /**
2510
+ * The camera used to compute the distance.
2511
+ */
2512
+ camera: THREE.OrthographicCamera;
2513
+ /**
2514
+ * The material used to compute the distance.
2515
+ */
2516
+ depthMaterial: THREE.ShaderMaterial;
2532
2517
  /** The world instance to which this renderer belongs. */
2533
2518
  readonly world: World;
2534
2519
  /** The THREE.js renderer used to make the visibility test. */
2535
2520
  readonly renderer: THREE.WebGLRenderer;
2536
- protected autoUpdate: boolean;
2537
- protected updateInterval: number;
2538
2521
  protected readonly worker: Worker;
2539
- protected readonly scene: THREE.Scene;
2540
2522
  private _width;
2541
2523
  private _height;
2542
- private _availableColor;
2543
- private readonly renderTarget;
2524
+ private readonly _postQuad;
2525
+ private readonly tempRT;
2526
+ private readonly resultRT;
2544
2527
  private readonly bufferSize;
2545
2528
  private readonly _buffer;
2546
2529
  protected _isWorkerBusy: boolean;
2547
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2530
+ constructor(components: Components, world: World);
2548
2531
  /** {@link Disposable.dispose} */
2549
2532
  dispose(): void;
2550
2533
  /**
@@ -2553,80 +2536,8 @@ export declare class CullerRenderer {
2553
2536
  * @param force if true, it will refresh the scene even if needsUpdate is
2554
2537
  * not true.
2555
2538
  */
2556
- updateVisibility: (force?: boolean) => Promise<void>;
2557
- protected getAvailableColor(): {
2558
- r: number;
2559
- g: number;
2560
- b: number;
2561
- code: string;
2562
- };
2563
- protected increaseColor(): void;
2564
- protected decreaseColor(): void;
2565
- private applySettings;
2566
- }
2567
- import * as THREE from "three";
2568
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2569
- import { Components } from "../../Components";
2570
- import { Event, World, Disposable } from "../../Types";
2571
- /**
2572
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2573
- */
2574
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2575
- /**
2576
- * Event triggered when the visibility of meshes is updated.
2577
- * Contains two sets: seen and unseen.
2578
- */
2579
- readonly onViewUpdated: Event<{
2580
- seen: Set<THREE.Mesh>;
2581
- unseen: Set<THREE.Mesh>;
2582
- }>;
2583
- /**
2584
- * Pixels in screen a geometry must occupy to be considered "seen".
2585
- * Default value is 100.
2586
- */
2587
- threshold: number;
2588
- /**
2589
- * Map of color code to THREE.InstancedMesh.
2590
- * Used to keep track of color-coded meshes.
2591
- */
2592
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2593
- /**
2594
- * Flag to indicate if the renderer is currently processing.
2595
- * Used to prevent concurrent processing.
2596
- */
2597
- isProcessing: boolean;
2598
- private _colorCodeMeshMap;
2599
- private _meshIDColorCodeMap;
2600
- private _currentVisibleMeshes;
2601
- private _recentlyHiddenMeshes;
2602
- private _intervalID;
2603
- private readonly _transparentMat;
2604
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2605
- /** {@link Disposable.dispose} */
2606
- dispose(): void;
2607
- /**
2608
- * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2609
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2610
- * @returns {void}
2611
- */
2612
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2613
- /**
2614
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2615
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2616
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2617
- * @returns {void}
2618
- */
2619
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2620
- /**
2621
- * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
2622
- *
2623
- * @param meshes - The meshes to update.
2624
- *
2625
- * @returns {void}
2626
- */
2627
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
2539
+ compute: () => Promise<void>;
2628
2540
  private handleWorkerMessage;
2629
- private getAvailableMaterial;
2630
2541
  }
2631
2542
  /**
2632
2543
  * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
@@ -2656,19 +2567,98 @@ export declare class Event<T> {
2656
2567
  reset(): void;
2657
2568
  private handlers;
2658
2569
  }
2659
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2660
- import { Base } from "./base";
2570
+ import * as THREE from "three";
2571
+ import { BaseScene, Configurable, Event } from "../../Types";
2572
+ import { Components } from "../../Components";
2661
2573
  /**
2662
- * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2574
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2663
2575
  */
2664
- export declare abstract class Component extends Base {
2576
+ export interface SimpleSceneConfig {
2577
+ directionalLight: {
2578
+ color: THREE.Color;
2579
+ intensity: number;
2580
+ position: THREE.Vector3;
2581
+ };
2582
+ ambientLight: {
2583
+ color: THREE.Color;
2584
+ intensity: number;
2585
+ };
2586
+ }
2587
+ /**
2588
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2589
+ */
2590
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2591
+ /** {@link Configurable.isSetup} */
2592
+ isSetup: boolean;
2665
2593
  /**
2666
- * Whether this component is active or not. The behaviour can vary depending
2667
- * on the type of component. E.g. a disabled dimension tool will stop creating
2668
- * dimensions, while a disabled camera will stop moving. A disabled component
2669
- * will not be updated automatically each frame.
2594
+ * The underlying Three.js scene object.
2595
+ * It is used to define the 3D space containing objects, lights, and cameras.
2670
2596
  */
2671
- abstract enabled: boolean;
2597
+ three: THREE.Scene;
2598
+ /** {@link Configurable.onSetup} */
2599
+ readonly onSetup: Event<SimpleScene>;
2600
+ /**
2601
+ * Configuration interface for the {@link SimpleScene}.
2602
+ * Defines properties for directional and ambient lights.
2603
+ */
2604
+ config: Required<SimpleSceneConfig>;
2605
+ constructor(components: Components);
2606
+ /** {@link Configurable.setup} */
2607
+ setup(config?: Partial<SimpleSceneConfig>): void;
2608
+ }
2609
+ import * as THREE from "three";
2610
+ import { BaseRenderer, Event } from "../../Types";
2611
+ import { Components } from "../../Components";
2612
+ /**
2613
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2614
+ */
2615
+ export declare class SimpleRenderer extends BaseRenderer {
2616
+ /**
2617
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2618
+ * Default is 'true'.
2619
+ */
2620
+ enabled: boolean;
2621
+ /**
2622
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2623
+ */
2624
+ container: HTMLElement;
2625
+ /**
2626
+ * The THREE.js WebGLRenderer instance.
2627
+ */
2628
+ three: THREE.WebGLRenderer;
2629
+ protected _canvas: HTMLCanvasElement;
2630
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2631
+ protected _resizeObserver: ResizeObserver | null;
2632
+ protected onContainerUpdated: Event<unknown>;
2633
+ private _resizing;
2634
+ /**
2635
+ * Constructor for the SimpleRenderer class.
2636
+ *
2637
+ * @param components - The components instance.
2638
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
2639
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2640
+ */
2641
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2642
+ /** {@link Updateable.update} */
2643
+ update(): void;
2644
+ /** {@link Disposable.dispose} */
2645
+ dispose(): void;
2646
+ /** {@link Resizeable.getSize}. */
2647
+ getSize(): THREE.Vector2;
2648
+ /** {@link Resizeable.resize} */
2649
+ resize: (size?: THREE.Vector2) => void;
2650
+ /**
2651
+ * Sets up and manages the event listeners for the renderer.
2652
+ *
2653
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2654
+ *
2655
+ * @throws Will throw an error if the renderer does not have an HTML container.
2656
+ */
2657
+ setupEvents(active: boolean): void;
2658
+ private resizeEvent;
2659
+ private setupRenderer;
2660
+ private onContextLost;
2661
+ private onContextBack;
2672
2662
  }
2673
2663
  /**
2674
2664
  * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
@@ -2700,6 +2690,81 @@ export declare class AsyncEvent<T> {
2700
2690
  }
2701
2691
  import * as THREE from "three";
2702
2692
  import CameraControls from "camera-controls";
2693
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2694
+ import { Components } from "../../Components";
2695
+ /**
2696
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
2697
+ */
2698
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2699
+ /** {@link Updateable.onBeforeUpdate} */
2700
+ readonly onBeforeUpdate: Event<SimpleCamera>;
2701
+ /** {@link Updateable.onAfterUpdate} */
2702
+ readonly onAfterUpdate: Event<SimpleCamera>;
2703
+ /**
2704
+ * Event that is triggered when the aspect of the camera has been updated.
2705
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2706
+ */
2707
+ readonly onAspectUpdated: Event<unknown>;
2708
+ /** {@link Disposable.onDisposed} */
2709
+ readonly onDisposed: Event<string>;
2710
+ /**
2711
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
2712
+ * This camera is used for rendering the scene.
2713
+ */
2714
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2715
+ private _allControls;
2716
+ /**
2717
+ * The object that controls the camera. An instance of
2718
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2719
+ * Transforming the camera directly will have no effect: you need to use this
2720
+ * object to move, rotate, look at objects, etc.
2721
+ */
2722
+ get controls(): CameraControls;
2723
+ /**
2724
+ * Getter for the enabled state of the camera controls.
2725
+ * If the current world is null, it returns false.
2726
+ * Otherwise, it returns the enabled state of the camera controls.
2727
+ *
2728
+ * @returns {boolean} The enabled state of the camera controls.
2729
+ */
2730
+ get enabled(): boolean;
2731
+ /**
2732
+ * Setter for the enabled state of the camera controls.
2733
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2734
+ *
2735
+ * @param {boolean} enabled - The new enabled state of the camera controls.
2736
+ */
2737
+ set enabled(enabled: boolean);
2738
+ constructor(components: Components);
2739
+ /** {@link Disposable.dispose} */
2740
+ dispose(): void;
2741
+ /** {@link Updateable.update} */
2742
+ update(_delta: number): void;
2743
+ /**
2744
+ * Updates the aspect of the camera to match the size of the
2745
+ * {@link Components.renderer}.
2746
+ */
2747
+ updateAspect: () => void;
2748
+ private setupCamera;
2749
+ private newCameraControls;
2750
+ private setupEvents;
2751
+ private static getSubsetOfThree;
2752
+ }
2753
+ import * as WEBIFC from "web-ifc";
2754
+ import { IfcItemsCategories } from "../../../ifc";
2755
+ export declare class SpatialStructure {
2756
+ itemsByFloor: IfcItemsCategories;
2757
+ private _units;
2758
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2759
+ cleanUp(): void;
2760
+ }
2761
+ import * as FRAGS from "@thatopen/fragments";
2762
+ import * as WEBIFC from "web-ifc";
2763
+ export declare class SpatialIdsFinder {
2764
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2765
+ }
2766
+ import * as THREE from "three";
2767
+ import CameraControls from "camera-controls";
2703
2768
  import { Event } from "./event";
2704
2769
  /**
2705
2770
  * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
@@ -2825,6 +2890,42 @@ export declare abstract class Base {
2825
2890
  /** Whether is component is {@link Configurable}. */
2826
2891
  isConfigurable: () => this is Configurable<any>;
2827
2892
  }
2893
+ import { Base } from "./base";
2894
+ /**
2895
+ * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2896
+ */
2897
+ export declare abstract class Component extends Base {
2898
+ /**
2899
+ * Whether this component is active or not. The behaviour can vary depending
2900
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2901
+ * dimensions, while a disabled camera will stop moving. A disabled component
2902
+ * will not be updated automatically each frame.
2903
+ */
2904
+ abstract enabled: boolean;
2905
+ }
2906
+ import { Base } from "./base";
2907
+ import { World } from "./world";
2908
+ import { Event } from "./event";
2909
+ import { Components } from "../../Components";
2910
+ /**
2911
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2912
+ */
2913
+ export declare abstract class BaseWorldItem extends Base {
2914
+ readonly worlds: Map<string, World>;
2915
+ /**
2916
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2917
+ * The event payload contains the world instance and the action ("added" or "removed").
2918
+ */
2919
+ readonly onWorldChanged: Event<{
2920
+ world: World;
2921
+ action: "added" | "removed";
2922
+ }>;
2923
+ /**
2924
+ * The current world this item is associated with. It can be null if no world is currently active.
2925
+ */
2926
+ currentWorld: World | null;
2927
+ protected constructor(components: Components);
2928
+ }
2828
2929
  import * as THREE from "three";
2829
2930
  import CameraControls from "camera-controls";
2830
2931
  import { BaseWorldItem } from "./base-world-item";
@@ -2913,258 +3014,34 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2913
3014
  * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2914
3015
  * If 'active' is 'true' and the plane is not already in the array, it is added.
2915
3016
  * If 'active' is 'false' and the plane is in the array, it is removed.
2916
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2917
- * excluding any planes marked as local.
2918
- */
2919
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2920
- }
2921
- import * as THREE from "three";
2922
- import { BaseScene } from "./base-scene";
2923
- import { BaseCamera } from "./base-camera";
2924
- import { BaseRenderer } from "./base-renderer";
2925
- import { Updateable, Disposable } from "./interfaces";
2926
- /**
2927
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2928
- */
2929
- export interface World extends Disposable, Updateable {
2930
- /**
2931
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2932
- */
2933
- meshes: Set<THREE.Mesh>;
2934
- /**
2935
- * The base scene of the world.
2936
- */
2937
- scene: BaseScene;
2938
- /**
2939
- * The base camera of the world.
2940
- */
2941
- camera: BaseCamera;
2942
- /**
2943
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2944
- */
2945
- renderer: BaseRenderer | null;
2946
- /**
2947
- * A unique identifier for the world.
2948
- */
2949
- uuid: string;
2950
- /**
2951
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2952
- */
2953
- isDisposing: boolean;
2954
- }
2955
- import * as THREE from "three";
2956
- import { Disposable } from "./interfaces";
2957
- import { Event } from "./event";
2958
- import { Components } from "../../Components";
2959
- import { BaseWorldItem } from "./base-world-item";
2960
- /**
2961
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2962
- */
2963
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2964
- /** {@link Disposable.onDisposed} */
2965
- readonly onDisposed: Event<unknown>;
2966
- /**
2967
- * Abstract property representing the three.js object associated with this scene.
2968
- * It should be implemented by subclasses.
2969
- */
2970
- abstract three: THREE.Object3D;
2971
- /** The set of directional lights managed by this scene component. */
2972
- directionalLights: Map<string, THREE.DirectionalLight>;
2973
- /** The set of ambient lights managed by this scene component. */
2974
- ambientLights: Map<string, THREE.AmbientLight>;
2975
- protected constructor(components: Components);
2976
- /** {@link Disposable.dispose} */
2977
- dispose(): void;
2978
- }
2979
- import { Base } from "./base";
2980
- import { World } from "./world";
2981
- import { Event } from "./event";
2982
- import { Components } from "../../Components";
2983
- /**
2984
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2985
- */
2986
- export declare abstract class BaseWorldItem extends Base {
2987
- readonly worlds: Map<string, World>;
2988
- /**
2989
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2990
- * The event payload contains the world instance and the action ("added" or "removed").
2991
- */
2992
- readonly onWorldChanged: Event<{
2993
- world: World;
2994
- action: "added" | "removed";
2995
- }>;
2996
- /**
2997
- * The current world this item is associated with. It can be null if no world is currently active.
2998
- */
2999
- currentWorld: World | null;
3000
- protected constructor(components: Components);
3001
- }
3002
- import { Event } from "./event";
3003
- /**
3004
- * A class that extends the built-in Set class and provides additional functionality.
3005
- * It triggers events when items are added, deleted, or the set is cleared.
3006
- *
3007
- * @template T - The type of elements in the set.
3008
- */
3009
- export declare class DataSet<T> extends Set<T> {
3010
- /**
3011
- * An event that is triggered when a new item is added to the set.
3012
- */
3013
- readonly onItemAdded: Event<T>;
3014
- /**
3015
- * An event that is triggered when an item is deleted from the set.
3016
- */
3017
- readonly onItemDeleted: Event<unknown>;
3018
- /**
3019
- * An event that is triggered when the set is cleared.
3020
- */
3021
- readonly onCleared: Event<unknown>;
3022
- /**
3023
- * Constructs a new instance of the DataSet class.
3024
- *
3025
- * @param iterable - An optional iterable object to initialize the set with.
3026
- */
3027
- constructor(iterable?: Iterable<T> | null);
3028
- /**
3029
- * Clears the set and triggers the onCleared event.
3030
- */
3031
- clear(): void;
3032
- /**
3033
- * Adds a value to the set and triggers the onItemAdded event.
3034
- *
3035
- * @param value - The value to add to the set.
3036
- * @returns - The set instance.
3037
- */
3038
- add(value: T): this;
3039
- /**
3040
- * Deletes a value from the set and triggers the onItemDeleted event.
3041
- *
3042
- * @param value - The value to delete from the set.
3043
- * @returns - True if the value was successfully deleted, false otherwise.
3044
- */
3045
- delete(value: T): boolean;
3046
- /**
3047
- * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3048
- */
3049
- dispose(): void;
3050
- }
3051
- import * as THREE from "three";
3052
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3053
- /**
3054
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3055
- *
3056
- * @template T - The type of the scene. Default is BaseScene.
3057
- * @template U - The type of the camera. Default is BaseCamera.
3058
- * @template S - The type of the renderer. Default is BaseRenderer.
3059
- */
3060
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3061
- /**
3062
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3063
- */
3064
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3065
- /** {@link Updateable.onAfterUpdate} */
3066
- readonly onAfterUpdate: Event<unknown>;
3067
- /** {@link Updateable.onBeforeUpdate} */
3068
- readonly onBeforeUpdate: Event<unknown>;
3069
- /** {@link Disposable.onDisposed} */
3070
- readonly onDisposed: Event<unknown>;
3071
- /**
3072
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3073
- */
3074
- isDisposing: boolean;
3075
- /**
3076
- * Indicates whether the world is currently enabled.
3077
- * When disabled, the world will not be updated.
3078
- */
3079
- enabled: boolean;
3080
- /**
3081
- * A unique identifier for the world.
3082
- */
3083
- uuid: string;
3084
- /**
3085
- * An optional name for the world.
3086
- */
3087
- name?: string;
3088
- private _scene?;
3089
- private _camera?;
3090
- private _renderer;
3091
- /**
3092
- * Getter for the scene. If no scene is initialized, it throws an error.
3093
- * @returns The current scene.
3094
- */
3095
- get scene(): T;
3096
- /**
3097
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3098
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3099
- * @param scene - The new scene to be set.
3100
- */
3101
- set scene(scene: T);
3102
- /**
3103
- * Getter for the camera. If no camera is initialized, it throws an error.
3104
- * @returns The current camera.
3105
- */
3106
- get camera(): U;
3107
- /**
3108
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3109
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3110
- * @param camera - The new camera to be set.
3111
- */
3112
- set camera(camera: U);
3113
- /**
3114
- * Getter for the renderer.
3115
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3116
- */
3117
- get renderer(): S | null;
3118
- /**
3119
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3120
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3121
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3122
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3017
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
3018
+ * excluding any planes marked as local.
3123
3019
  */
3124
- set renderer(renderer: S | null);
3125
- /** {@link Updateable.update} */
3126
- update(delta?: number): void;
3127
- /** {@link Disposable.dispose} */
3128
- dispose(disposeResources?: boolean): void;
3020
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
3129
3021
  }
3130
3022
  import * as THREE from "three";
3131
- import { BaseScene, Configurable, Event } from "../../Types";
3023
+ import { Disposable } from "./interfaces";
3024
+ import { Event } from "./event";
3132
3025
  import { Components } from "../../Components";
3026
+ import { BaseWorldItem } from "./base-world-item";
3133
3027
  /**
3134
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3135
- */
3136
- export interface SimpleSceneConfig {
3137
- directionalLight: {
3138
- color: THREE.Color;
3139
- intensity: number;
3140
- position: THREE.Vector3;
3141
- };
3142
- ambientLight: {
3143
- color: THREE.Color;
3144
- intensity: number;
3145
- };
3146
- }
3147
- /**
3148
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
3028
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3149
3029
  */
3150
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3151
- /** {@link Configurable.isSetup} */
3152
- isSetup: boolean;
3153
- /**
3154
- * The underlying Three.js scene object.
3155
- * It is used to define the 3D space containing objects, lights, and cameras.
3156
- */
3157
- three: THREE.Scene;
3158
- /** {@link Configurable.onSetup} */
3159
- readonly onSetup: Event<SimpleScene>;
3030
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3031
+ /** {@link Disposable.onDisposed} */
3032
+ readonly onDisposed: Event<unknown>;
3160
3033
  /**
3161
- * Configuration interface for the {@link SimpleScene}.
3162
- * Defines properties for directional and ambient lights.
3034
+ * Abstract property representing the three.js object associated with this scene.
3035
+ * It should be implemented by subclasses.
3163
3036
  */
3164
- config: Required<SimpleSceneConfig>;
3165
- constructor(components: Components);
3166
- /** {@link Configurable.setup} */
3167
- setup(config?: Partial<SimpleSceneConfig>): void;
3037
+ abstract three: THREE.Object3D;
3038
+ /** The set of directional lights managed by this scene component. */
3039
+ directionalLights: Map<string, THREE.DirectionalLight>;
3040
+ /** The set of ambient lights managed by this scene component. */
3041
+ ambientLights: Map<string, THREE.AmbientLight>;
3042
+ protected constructor(components: Components);
3043
+ /** {@link Disposable.dispose} */
3044
+ dispose(): void;
3168
3045
  }
3169
3046
  import { Event } from "./event";
3170
3047
  /**
@@ -3226,281 +3103,244 @@ export declare class DataMap<K, V> extends Map<K, V> {
3226
3103
  */
3227
3104
  dispose(): void;
3228
3105
  }
3229
- import * as THREE from "three";
3230
- import { BaseRenderer, Event } from "../../Types";
3231
- import { Components } from "../../Components";
3106
+ import { Event } from "./event";
3232
3107
  /**
3233
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
3108
+ * A class that extends the built-in Set class and provides additional functionality.
3109
+ * It triggers events when items are added, deleted, or the set is cleared.
3110
+ *
3111
+ * @template T - The type of elements in the set.
3234
3112
  */
3235
- export declare class SimpleRenderer extends BaseRenderer {
3236
- /**
3237
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3238
- * Default is 'true'.
3239
- */
3240
- enabled: boolean;
3113
+ export declare class DataSet<T> extends Set<T> {
3241
3114
  /**
3242
- * The HTML container of the THREE.js canvas where the scene is rendered.
3115
+ * An event that is triggered when a new item is added to the set.
3243
3116
  */
3244
- container: HTMLElement;
3117
+ readonly onItemAdded: Event<T>;
3245
3118
  /**
3246
- * The THREE.js WebGLRenderer instance.
3119
+ * An event that is triggered when an item is deleted from the set.
3247
3120
  */
3248
- three: THREE.WebGLRenderer;
3249
- protected _canvas: HTMLCanvasElement;
3250
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3251
- protected _resizeObserver: ResizeObserver | null;
3252
- protected onContainerUpdated: Event<unknown>;
3253
- private _resizing;
3121
+ readonly onItemDeleted: Event<unknown>;
3254
3122
  /**
3255
- * Constructor for the SimpleRenderer class.
3256
- *
3257
- * @param components - The components instance.
3258
- * @param container - The HTML container where the THREE.js canvas will be rendered.
3259
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3123
+ * An event that is triggered when the set is cleared.
3260
3124
  */
3261
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3262
- /** {@link Updateable.update} */
3263
- update(): void;
3264
- /** {@link Disposable.dispose} */
3265
- dispose(): void;
3266
- /** {@link Resizeable.getSize}. */
3267
- getSize(): THREE.Vector2;
3268
- /** {@link Resizeable.resize} */
3269
- resize: (size?: THREE.Vector2) => void;
3125
+ readonly onCleared: Event<unknown>;
3270
3126
  /**
3271
- * Sets up and manages the event listeners for the renderer.
3272
- *
3273
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3127
+ * Constructs a new instance of the DataSet class.
3274
3128
  *
3275
- * @throws Will throw an error if the renderer does not have an HTML container.
3276
- */
3277
- setupEvents(active: boolean): void;
3278
- private resizeEvent;
3279
- private setupRenderer;
3280
- private onContextLost;
3281
- private onContextBack;
3282
- }
3283
- import * as THREE from "three";
3284
- import CameraControls from "camera-controls";
3285
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3286
- import { Components } from "../../Components";
3287
- /**
3288
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3289
- */
3290
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3291
- /** {@link Updateable.onBeforeUpdate} */
3292
- readonly onBeforeUpdate: Event<SimpleCamera>;
3293
- /** {@link Updateable.onAfterUpdate} */
3294
- readonly onAfterUpdate: Event<SimpleCamera>;
3295
- /**
3296
- * Event that is triggered when the aspect of the camera has been updated.
3297
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3298
- */
3299
- readonly onAspectUpdated: Event<unknown>;
3300
- /** {@link Disposable.onDisposed} */
3301
- readonly onDisposed: Event<string>;
3302
- /**
3303
- * A three.js PerspectiveCamera or OrthographicCamera instance.
3304
- * This camera is used for rendering the scene.
3129
+ * @param iterable - An optional iterable object to initialize the set with.
3305
3130
  */
3306
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3307
- private _allControls;
3131
+ constructor(iterable?: Iterable<T> | null);
3308
3132
  /**
3309
- * The object that controls the camera. An instance of
3310
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3311
- * Transforming the camera directly will have no effect: you need to use this
3312
- * object to move, rotate, look at objects, etc.
3133
+ * Clears the set and triggers the onCleared event.
3313
3134
  */
3314
- get controls(): CameraControls;
3135
+ clear(): void;
3315
3136
  /**
3316
- * Getter for the enabled state of the camera controls.
3317
- * If the current world is null, it returns false.
3318
- * Otherwise, it returns the enabled state of the camera controls.
3137
+ * Adds a value to the set and triggers the onItemAdded event.
3319
3138
  *
3320
- * @returns {boolean} The enabled state of the camera controls.
3139
+ * @param value - The value to add to the set.
3140
+ * @returns - The set instance.
3321
3141
  */
3322
- get enabled(): boolean;
3142
+ add(value: T): this;
3323
3143
  /**
3324
- * Setter for the enabled state of the camera controls.
3325
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3144
+ * Deletes a value from the set and triggers the onItemDeleted event.
3326
3145
  *
3327
- * @param {boolean} enabled - The new enabled state of the camera controls.
3328
- */
3329
- set enabled(enabled: boolean);
3330
- constructor(components: Components);
3331
- /** {@link Disposable.dispose} */
3332
- dispose(): void;
3333
- /** {@link Updateable.update} */
3334
- update(_delta: number): void;
3335
- /**
3336
- * Updates the aspect of the camera to match the size of the
3337
- * {@link Components.renderer}.
3146
+ * @param value - The value to delete from the set.
3147
+ * @returns - True if the value was successfully deleted, false otherwise.
3338
3148
  */
3339
- updateAspect: () => void;
3340
- private setupCamera;
3341
- private newCameraControls;
3342
- private setupEvents;
3343
- private static getSubsetOfThree;
3344
- }
3345
- import { NavigationMode } from "./types";
3346
- import { OrthoPerspectiveCamera } from "../index";
3347
- /**
3348
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3349
- */
3350
- export declare class FirstPersonMode implements NavigationMode {
3351
- private camera;
3352
- /** {@link NavigationMode.enabled} */
3353
- enabled: boolean;
3354
- /** {@link NavigationMode.id} */
3355
- readonly id = "FirstPerson";
3356
- constructor(camera: OrthoPerspectiveCamera);
3357
- /** {@link NavigationMode.set} */
3358
- set(active: boolean): void;
3359
- private setupFirstPersonCamera;
3360
- }
3361
- import { NavigationMode } from "./types";
3362
- import { OrthoPerspectiveCamera } from "../index";
3363
- /**
3364
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3365
- */
3366
- export declare class OrbitMode implements NavigationMode {
3367
- camera: OrthoPerspectiveCamera;
3368
- /** {@link NavigationMode.enabled} */
3369
- enabled: boolean;
3370
- /** {@link NavigationMode.id} */
3371
- readonly id = "Orbit";
3372
- constructor(camera: OrthoPerspectiveCamera);
3373
- /** {@link NavigationMode.set} */
3374
- set(active: boolean): void;
3375
- private activateOrbitControls;
3376
- }
3377
- import * as THREE from "three";
3378
- import { Disposable, Event } from "../../Types";
3379
- /**
3380
- * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
3381
- */
3382
- export declare class Mouse implements Disposable {
3383
- dom: HTMLCanvasElement;
3384
- private _event?;
3385
- private _position;
3386
- /** {@link Disposable.onDisposed} */
3387
- readonly onDisposed: Event<unknown>;
3388
- constructor(dom: HTMLCanvasElement);
3149
+ delete(value: T): boolean;
3389
3150
  /**
3390
- * The real position of the mouse of the Three.js canvas.
3151
+ * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3391
3152
  */
3392
- get position(): THREE.Vector2;
3393
- /** {@link Disposable.dispose} */
3394
3153
  dispose(): void;
3395
- private getPositionY;
3396
- private getPositionX;
3397
- private updateMouseInfo;
3398
- private setupEvents;
3399
- }
3400
- import { NavigationMode } from "./types";
3401
- import { OrthoPerspectiveCamera } from "../index";
3402
- /**
3403
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3404
- */
3405
- export declare class PlanMode implements NavigationMode {
3406
- private camera;
3407
- /** {@link NavigationMode.enabled} */
3408
- enabled: boolean;
3409
- /** {@link NavigationMode.id} */
3410
- readonly id = "Plan";
3411
- private mouseAction1?;
3412
- private mouseAction2?;
3413
- private mouseInitialized;
3414
- private readonly defaultAzimuthSpeed;
3415
- private readonly defaultPolarSpeed;
3416
- constructor(camera: OrthoPerspectiveCamera);
3417
- /** {@link NavigationMode.set} */
3418
- set(active: boolean): void;
3419
3154
  }
3155
+ import * as THREE from "three";
3156
+ import { Components } from "../../Components";
3157
+ import { AsyncEvent, Event, World } from "../../Types";
3420
3158
  /**
3421
- * The projection system of the camera.
3422
- */
3423
- export type CameraProjection = "Perspective" | "Orthographic";
3424
- /**
3425
- * The extensible list of supported navigation modes.
3159
+ * Settings to configure the CullerRenderer.
3426
3160
  */
3427
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3161
+ export interface CullerRendererSettings {
3162
+ /**
3163
+ * Interval in milliseconds at which the visibility check should be performed.
3164
+ * Default value is 1000.
3165
+ */
3166
+ updateInterval?: number;
3167
+ /**
3168
+ * Width of the render target used for visibility checks.
3169
+ * Default value is 512.
3170
+ */
3171
+ width?: number;
3172
+ /**
3173
+ * Height of the render target used for visibility checks.
3174
+ * Default value is 512.
3175
+ */
3176
+ height?: number;
3177
+ /**
3178
+ * Whether the visibility check should be performed automatically.
3179
+ * Default value is true.
3180
+ */
3181
+ autoUpdate?: boolean;
3182
+ }
3428
3183
  /**
3429
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3184
+ * A base renderer to determine visibility on screen.
3430
3185
  */
3431
- export interface NavigationMode {
3432
- /** The unique ID of this navigation mode. */
3433
- id: NavModeID;
3186
+ export declare class CullerRenderer {
3187
+ /** {@link Disposable.onDisposed} */
3188
+ readonly onDisposed: Event<string>;
3434
3189
  /**
3435
- * Enable or disable this navigation mode.
3436
- * When a new navigation mode is enabled, the previous navigation mode
3437
- * must be disabled.
3438
- *
3439
- * @param active - whether to enable or disable this mode.
3440
- * @param options - any additional data required to enable or disable it.
3441
- * */
3442
- set: (active: boolean, options?: any) => void;
3443
- /** Whether this navigation mode is active or not. */
3190
+ * Fires after making the visibility check to the meshes. It lists the
3191
+ * meshes that are currently visible, and the ones that were visible
3192
+ * just before but not anymore.
3193
+ */
3194
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3195
+ /**
3196
+ * Whether this renderer is active or not. If not, it won't render anything.
3197
+ */
3444
3198
  enabled: boolean;
3199
+ /**
3200
+ * Needs to check whether there are objects that need to be hidden or shown.
3201
+ * You can bind this to the camera movement, to a certain interval, etc.
3202
+ */
3203
+ needsUpdate: boolean;
3204
+ /**
3205
+ * Render the internal scene used to determine the object visibility. Used
3206
+ * for debugging purposes.
3207
+ */
3208
+ renderDebugFrame: boolean;
3209
+ /** The components instance to which this renderer belongs. */
3210
+ components: Components;
3211
+ /** The world instance to which this renderer belongs. */
3212
+ readonly world: World;
3213
+ /** The THREE.js renderer used to make the visibility test. */
3214
+ readonly renderer: THREE.WebGLRenderer;
3215
+ protected autoUpdate: boolean;
3216
+ protected updateInterval: number;
3217
+ protected readonly worker: Worker;
3218
+ protected readonly scene: THREE.Scene;
3219
+ private _width;
3220
+ private _height;
3221
+ private _availableColor;
3222
+ private readonly renderTarget;
3223
+ private readonly bufferSize;
3224
+ private readonly _buffer;
3225
+ protected _isWorkerBusy: boolean;
3226
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3227
+ /** {@link Disposable.dispose} */
3228
+ dispose(): void;
3229
+ /**
3230
+ * The function that the culler uses to reprocess the scene. Generally it's
3231
+ * better to call needsUpdate, but you can also call this to force it.
3232
+ * @param force if true, it will refresh the scene even if needsUpdate is
3233
+ * not true.
3234
+ */
3235
+ updateVisibility: (force?: boolean) => Promise<void>;
3236
+ protected getAvailableColor(): {
3237
+ r: number;
3238
+ g: number;
3239
+ b: number;
3240
+ code: string;
3241
+ };
3242
+ protected increaseColor(): void;
3243
+ protected decreaseColor(): void;
3244
+ private applySettings;
3445
3245
  }
3246
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3446
3247
  import * as THREE from "three";
3447
- import { Hideable, Event, World, Disposable } from "../../Types";
3448
- import { Components } from "../../Components";
3248
+ import { BaseScene } from "./base-scene";
3249
+ import { BaseCamera } from "./base-camera";
3250
+ import { BaseRenderer } from "./base-renderer";
3251
+ import { Updateable, Disposable } from "./interfaces";
3449
3252
  /**
3450
- * Configuration interface for the {@link SimpleGrid} class.
3253
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3451
3254
  */
3452
- export interface GridConfig {
3255
+ export interface World extends Disposable, Updateable {
3453
3256
  /**
3454
- * The color of the grid lines.
3257
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
3455
3258
  */
3456
- color: THREE.Color;
3259
+ meshes: Set<THREE.Mesh>;
3457
3260
  /**
3458
- * The size of the primary grid lines.
3261
+ * The base scene of the world.
3459
3262
  */
3460
- size1: number;
3263
+ scene: BaseScene;
3461
3264
  /**
3462
- * The size of the secondary grid lines.
3265
+ * The base camera of the world.
3463
3266
  */
3464
- size2: number;
3267
+ camera: BaseCamera;
3465
3268
  /**
3466
- * The distance at which the grid lines start to fade away.
3269
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3467
3270
  */
3468
- distance: number;
3271
+ renderer: BaseRenderer | null;
3272
+ /**
3273
+ * A unique identifier for the world.
3274
+ */
3275
+ uuid: string;
3276
+ /**
3277
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3278
+ */
3279
+ isDisposing: boolean;
3469
3280
  }
3281
+ import * as THREE from "three";
3282
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3283
+ import { Components } from "../../Components";
3284
+ import { Event, World, Disposable } from "../../Types";
3470
3285
  /**
3471
- * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3286
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3472
3287
  */
3473
- export declare class SimpleGrid implements Hideable, Disposable {
3474
- /** {@link Disposable.onDisposed} */
3475
- readonly onDisposed: Event<unknown>;
3476
- /** The world instance to which this Raycaster belongs. */
3477
- world: World;
3478
- /** The components instance to which this grid belongs. */
3479
- components: Components;
3480
- /** {@link Hideable.visible} */
3481
- get visible(): boolean;
3482
- /** {@link Hideable.visible} */
3483
- set visible(visible: boolean);
3484
- /** The material of the grid. */
3485
- get material(): THREE.ShaderMaterial;
3288
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3486
3289
  /**
3487
- * Whether the grid should fade away with distance. Recommended to be true for
3488
- * perspective cameras and false for orthographic cameras.
3290
+ * Event triggered when the visibility of meshes is updated.
3291
+ * Contains two sets: seen and unseen.
3489
3292
  */
3490
- get fade(): boolean;
3293
+ readonly onViewUpdated: Event<{
3294
+ seen: Set<THREE.Mesh>;
3295
+ unseen: Set<THREE.Mesh>;
3296
+ }>;
3491
3297
  /**
3492
- * Whether the grid should fade away with distance. Recommended to be true for
3493
- * perspective cameras and false for orthographic cameras.
3298
+ * Pixels in screen a geometry must occupy to be considered "seen".
3299
+ * Default value is 100.
3494
3300
  */
3495
- set fade(active: boolean);
3496
- /** The Three.js mesh that contains the infinite grid. */
3497
- readonly three: THREE.Mesh;
3498
- private _fade;
3499
- constructor(components: Components, world: World, config: GridConfig);
3301
+ threshold: number;
3302
+ /**
3303
+ * Map of color code to THREE.InstancedMesh.
3304
+ * Used to keep track of color-coded meshes.
3305
+ */
3306
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3307
+ /**
3308
+ * Flag to indicate if the renderer is currently processing.
3309
+ * Used to prevent concurrent processing.
3310
+ */
3311
+ isProcessing: boolean;
3312
+ private _colorCodeMeshMap;
3313
+ private _meshIDColorCodeMap;
3314
+ private _currentVisibleMeshes;
3315
+ private _recentlyHiddenMeshes;
3316
+ private _intervalID;
3317
+ private readonly _transparentMat;
3318
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3500
3319
  /** {@link Disposable.dispose} */
3501
3320
  dispose(): void;
3502
- private setupEvents;
3503
- private updateZoom;
3321
+ /**
3322
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
3323
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3324
+ * @returns {void}
3325
+ */
3326
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3327
+ /**
3328
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3329
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3330
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3331
+ * @returns {void}
3332
+ */
3333
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3334
+ /**
3335
+ * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
3336
+ *
3337
+ * @param meshes - The meshes to update.
3338
+ *
3339
+ * @returns {void}
3340
+ */
3341
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
3342
+ private handleWorkerMessage;
3343
+ private getAvailableMaterial;
3504
3344
  }
3505
3345
  import * as THREE from "three";
3506
3346
  import { Components } from "../../Components";
@@ -3544,60 +3384,38 @@ export declare class SimpleRaycaster implements Disposable {
3544
3384
  /**
3545
3385
  * Casts a ray from a given origin in a given direction and returns the first item found.
3546
3386
  * This method also takes into account the clipping planes used by the renderer.
3547
- *
3548
- * @param origin - The origin of the ray.
3549
- * @param direction - The direction of the ray.
3550
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3551
- * @returns The first intersection found or 'null' if no intersection was found.
3552
- */
3553
- 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;
3554
- private intersect;
3555
- private filterClippingPlanes;
3556
- }
3557
- import * as THREE from "three";
3558
- import { CameraProjection } from "./types";
3559
- import { Event } from "../../Types";
3560
- import { OrthoPerspectiveCamera } from "../index";
3561
- /**
3562
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3563
- */
3564
- export declare class ProjectionManager {
3565
- /**
3566
- * Event that fires when the {@link CameraProjection} changes.
3567
- */
3568
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3569
- /**
3570
- * Current projection mode of the camera.
3571
- * Default is "Perspective".
3572
- */
3573
- current: CameraProjection;
3574
- /**
3575
- * The camera controlled by this ProjectionManager.
3576
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3577
- */
3578
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3579
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3580
- matchOrthoDistanceEnabled: boolean;
3581
- private _component;
3582
- private _previousDistance;
3583
- constructor(camera: OrthoPerspectiveCamera);
3584
- /**
3585
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3586
- *
3587
- * @param projection - the new projection to set. If it is the current projection,
3588
- * it will have no effect.
3387
+ *
3388
+ * @param origin - The origin of the ray.
3389
+ * @param direction - The direction of the ray.
3390
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3391
+ * @returns The first intersection found or 'null' if no intersection was found.
3589
3392
  */
3590
- set(projection: CameraProjection): Promise<void>;
3393
+ 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;
3394
+ private intersect;
3395
+ private filterClippingPlanes;
3396
+ }
3397
+ import * as THREE from "three";
3398
+ import { Disposable, Event } from "../../Types";
3399
+ /**
3400
+ * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
3401
+ */
3402
+ export declare class Mouse implements Disposable {
3403
+ dom: HTMLCanvasElement;
3404
+ private _event?;
3405
+ private _position;
3406
+ /** {@link Disposable.onDisposed} */
3407
+ readonly onDisposed: Event<unknown>;
3408
+ constructor(dom: HTMLCanvasElement);
3591
3409
  /**
3592
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3593
- * and vice versa.
3410
+ * The real position of the mouse of the Three.js canvas.
3594
3411
  */
3595
- toggle(): Promise<void>;
3596
- private setOrthoCamera;
3597
- private getPerspectiveDims;
3598
- private setupOrthoCamera;
3599
- private getDistance;
3600
- private setPerspectiveCamera;
3412
+ get position(): THREE.Vector2;
3413
+ /** {@link Disposable.dispose} */
3414
+ dispose(): void;
3415
+ private getPositionY;
3416
+ private getPositionX;
3417
+ private updateMouseInfo;
3418
+ private setupEvents;
3601
3419
  }
3602
3420
  import * as THREE from "three";
3603
3421
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3698,20 +3516,82 @@ export declare class SimplePlane implements Disposable, Hideable {
3698
3516
  private newHelper;
3699
3517
  private static newPlaneMesh;
3700
3518
  }
3701
- import * as WEBIFC from "web-ifc";
3702
- import * as THREE from "three";
3703
- export declare class Units {
3704
- factor: number;
3705
- complement: number;
3706
- apply(matrix: THREE.Matrix4): void;
3707
- setUp(webIfc: WEBIFC.IfcAPI): void;
3708
- private getLengthUnits;
3709
- private getScaleMatrix;
3519
+ import { NavigationMode } from "./types";
3520
+ import { OrthoPerspectiveCamera } from "../index";
3521
+ /**
3522
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3523
+ */
3524
+ export declare class FirstPersonMode implements NavigationMode {
3525
+ private camera;
3526
+ /** {@link NavigationMode.enabled} */
3527
+ enabled: boolean;
3528
+ /** {@link NavigationMode.id} */
3529
+ readonly id = "FirstPerson";
3530
+ constructor(camera: OrthoPerspectiveCamera);
3531
+ /** {@link NavigationMode.set} */
3532
+ set(active: boolean): void;
3533
+ private setupFirstPersonCamera;
3710
3534
  }
3711
- import * as WEBIFC from "web-ifc";
3712
- export declare class IfcMetadataReader {
3713
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3714
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3535
+ import { NavigationMode } from "./types";
3536
+ import { OrthoPerspectiveCamera } from "../index";
3537
+ /**
3538
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3539
+ */
3540
+ export declare class OrbitMode implements NavigationMode {
3541
+ camera: OrthoPerspectiveCamera;
3542
+ /** {@link NavigationMode.enabled} */
3543
+ enabled: boolean;
3544
+ /** {@link NavigationMode.id} */
3545
+ readonly id = "Orbit";
3546
+ constructor(camera: OrthoPerspectiveCamera);
3547
+ /** {@link NavigationMode.set} */
3548
+ set(active: boolean): void;
3549
+ private activateOrbitControls;
3550
+ }
3551
+ import * as THREE from "three";
3552
+ import { CameraProjection } from "./types";
3553
+ import { Event } from "../../Types";
3554
+ import { OrthoPerspectiveCamera } from "../index";
3555
+ /**
3556
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3557
+ */
3558
+ export declare class ProjectionManager {
3559
+ /**
3560
+ * Event that fires when the {@link CameraProjection} changes.
3561
+ */
3562
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3563
+ /**
3564
+ * Current projection mode of the camera.
3565
+ * Default is "Perspective".
3566
+ */
3567
+ current: CameraProjection;
3568
+ /**
3569
+ * The camera controlled by this ProjectionManager.
3570
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3571
+ */
3572
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3573
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3574
+ matchOrthoDistanceEnabled: boolean;
3575
+ private _component;
3576
+ private _previousDistance;
3577
+ constructor(camera: OrthoPerspectiveCamera);
3578
+ /**
3579
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3580
+ *
3581
+ * @param projection - the new projection to set. If it is the current projection,
3582
+ * it will have no effect.
3583
+ */
3584
+ set(projection: CameraProjection): Promise<void>;
3585
+ /**
3586
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3587
+ * and vice versa.
3588
+ */
3589
+ toggle(): Promise<void>;
3590
+ private setOrthoCamera;
3591
+ private getPerspectiveDims;
3592
+ private setupOrthoCamera;
3593
+ private getDistance;
3594
+ private setPerspectiveCamera;
3715
3595
  }
3716
3596
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3717
3597
  /**
@@ -3730,6 +3610,65 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3730
3610
  minAssetsSize: number;
3731
3611
  }
3732
3612
  import * as THREE from "three";
3613
+ import { Hideable, Event, World, Disposable } from "../../Types";
3614
+ import { Components } from "../../Components";
3615
+ /**
3616
+ * Configuration interface for the {@link SimpleGrid} class.
3617
+ */
3618
+ export interface GridConfig {
3619
+ /**
3620
+ * The color of the grid lines.
3621
+ */
3622
+ color: THREE.Color;
3623
+ /**
3624
+ * The size of the primary grid lines.
3625
+ */
3626
+ size1: number;
3627
+ /**
3628
+ * The size of the secondary grid lines.
3629
+ */
3630
+ size2: number;
3631
+ /**
3632
+ * The distance at which the grid lines start to fade away.
3633
+ */
3634
+ distance: number;
3635
+ }
3636
+ /**
3637
+ * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3638
+ */
3639
+ export declare class SimpleGrid implements Hideable, Disposable {
3640
+ /** {@link Disposable.onDisposed} */
3641
+ readonly onDisposed: Event<unknown>;
3642
+ /** The world instance to which this Raycaster belongs. */
3643
+ world: World;
3644
+ /** The components instance to which this grid belongs. */
3645
+ components: Components;
3646
+ /** {@link Hideable.visible} */
3647
+ get visible(): boolean;
3648
+ /** {@link Hideable.visible} */
3649
+ set visible(visible: boolean);
3650
+ /** The material of the grid. */
3651
+ get material(): THREE.ShaderMaterial;
3652
+ /**
3653
+ * Whether the grid should fade away with distance. Recommended to be true for
3654
+ * perspective cameras and false for orthographic cameras.
3655
+ */
3656
+ get fade(): boolean;
3657
+ /**
3658
+ * Whether the grid should fade away with distance. Recommended to be true for
3659
+ * perspective cameras and false for orthographic cameras.
3660
+ */
3661
+ set fade(active: boolean);
3662
+ /** The Three.js mesh that contains the infinite grid. */
3663
+ readonly three: THREE.Mesh;
3664
+ private _fade;
3665
+ constructor(components: Components, world: World, config: GridConfig);
3666
+ /** {@link Disposable.dispose} */
3667
+ dispose(): void;
3668
+ private setupEvents;
3669
+ private updateZoom;
3670
+ }
3671
+ import * as THREE from "three";
3733
3672
  import * as WEBIFC from "web-ifc";
3734
3673
  import * as FRAGS from "@thatopen/fragments";
3735
3674
  export declare class CivilReader {
@@ -3744,6 +3683,57 @@ export declare class CivilReader {
3744
3683
  } | undefined;
3745
3684
  private getCurves;
3746
3685
  }
3686
+ /**
3687
+ * The projection system of the camera.
3688
+ */
3689
+ export type CameraProjection = "Perspective" | "Orthographic";
3690
+ /**
3691
+ * The extensible list of supported navigation modes.
3692
+ */
3693
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3694
+ /**
3695
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3696
+ */
3697
+ export interface NavigationMode {
3698
+ /** The unique ID of this navigation mode. */
3699
+ id: NavModeID;
3700
+ /**
3701
+ * Enable or disable this navigation mode.
3702
+ * When a new navigation mode is enabled, the previous navigation mode
3703
+ * must be disabled.
3704
+ *
3705
+ * @param active - whether to enable or disable this mode.
3706
+ * @param options - any additional data required to enable or disable it.
3707
+ * */
3708
+ set: (active: boolean, options?: any) => void;
3709
+ /** Whether this navigation mode is active or not. */
3710
+ enabled: boolean;
3711
+ }
3712
+ import { NavigationMode } from "./types";
3713
+ import { OrthoPerspectiveCamera } from "../index";
3714
+ /**
3715
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3716
+ */
3717
+ export declare class PlanMode implements NavigationMode {
3718
+ private camera;
3719
+ /** {@link NavigationMode.enabled} */
3720
+ enabled: boolean;
3721
+ /** {@link NavigationMode.id} */
3722
+ readonly id = "Plan";
3723
+ private mouseAction1?;
3724
+ private mouseAction2?;
3725
+ private mouseInitialized;
3726
+ private readonly defaultAzimuthSpeed;
3727
+ private readonly defaultPolarSpeed;
3728
+ constructor(camera: OrthoPerspectiveCamera);
3729
+ /** {@link NavigationMode.set} */
3730
+ set(active: boolean): void;
3731
+ }
3732
+ import * as WEBIFC from "web-ifc";
3733
+ export declare class IfcMetadataReader {
3734
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3735
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3736
+ }
3747
3737
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3748
3738
  /**
3749
3739
  * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -3755,6 +3745,16 @@ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3755
3745
  */
3756
3746
  propertiesSize: number;
3757
3747
  }
3748
+ import * as WEBIFC from "web-ifc";
3749
+ import * as THREE from "three";
3750
+ export declare class Units {
3751
+ factor: number;
3752
+ complement: number;
3753
+ apply(matrix: THREE.Matrix4): void;
3754
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3755
+ private getLengthUnits;
3756
+ private getScaleMatrix;
3757
+ }
3758
3758
  /**
3759
3759
  * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
3760
3760
  */
@@ -3784,11 +3784,6 @@ export interface StreamedAsset {
3784
3784
  color: number[];
3785
3785
  }[];
3786
3786
  }
3787
- import { BufferGeometry } from "three";
3788
- import * as THREE from "three";
3789
- export declare class TransformHelper {
3790
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3791
- }
3792
3787
  import * as WEBIFC from "web-ifc";
3793
3788
  export type RelationsMap = Map<number, Map<number, number[]>>;
3794
3789
  export interface ModelsRelationMap {
@@ -3844,5 +3839,10 @@ export type IfcRelations = [
3844
3839
  typeof WEBIFC.IFCRELNESTS
3845
3840
  ];
3846
3841
  export type IfcRelation = IfcRelations[number];
3842
+ import { BufferGeometry } from "three";
3843
+ import * as THREE from "three";
3844
+ export declare class TransformHelper {
3845
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3846
+ }
3847
3847
 
3848
3848
  }