@thatopen/components 2.1.5 → 2.1.6

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,91 @@
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, World, Event } from "../Types";
48
+ import { SimpleRaycaster } from "./src";
49
+ import { Components } from "../Components";
50
+ /**
51
+ * 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).
52
+ */
53
+ export declare class Raycasters extends Component implements Disposable {
54
+ /**
55
+ * A unique identifier for the component.
56
+ * This UUID is used to register the component within the Components system.
57
+ */
58
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
59
+ /** {@link Component.enabled} */
60
+ enabled: boolean;
61
+ /**
62
+ * A Map that stores raycasters for each world.
63
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
64
+ */
65
+ list: Map<string, SimpleRaycaster>;
66
+ /** {@link Disposable.onDisposed} */
67
+ onDisposed: Event<unknown>;
68
+ constructor(components: Components);
69
+ /**
70
+ * Retrieves a SimpleRaycaster instance for the given world.
71
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
72
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
73
+ *
74
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
75
+ * @returns The SimpleRaycaster instance for the given world.
76
+ */
77
+ get(world: World): SimpleRaycaster;
78
+ /**
79
+ * Deletes the SimpleRaycaster instance associated with the given world.
80
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
81
+ *
82
+ * @param world - The world for which to delete the SimpleRaycaster instance.
83
+ * @returns {void}
84
+ */
85
+ delete(world: World): void;
86
+ /** {@link Disposable.dispose} */
87
+ dispose(): void;
88
+ }
2
89
  import { Component, Disposable, Event } from "../Types";
3
90
  /**
4
91
  * 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.
@@ -7,7 +94,7 @@ export declare class Components implements Disposable {
7
94
  /**
8
95
  * The version of the @thatopen/components library.
9
96
  */
10
- static readonly release = "2.1.5";
97
+ static readonly release = "2.1.6";
11
98
  /** {@link Disposable.onDisposed} */
12
99
  readonly onDisposed: Event<void>;
13
100
  /**
@@ -76,93 +163,6 @@ export declare class Components implements Disposable {
76
163
  private static setupBVH;
77
164
  }
78
165
  import { Component, Disposable, World, Event } from "../Types";
79
- import { SimpleRaycaster } from "./src";
80
- import { Components } from "../Components";
81
- /**
82
- * 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).
83
- */
84
- export declare class Raycasters extends Component implements Disposable {
85
- /**
86
- * A unique identifier for the component.
87
- * This UUID is used to register the component within the Components system.
88
- */
89
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
90
- /** {@link Component.enabled} */
91
- enabled: boolean;
92
- /**
93
- * A Map that stores raycasters for each world.
94
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
95
- */
96
- list: Map<string, SimpleRaycaster>;
97
- /** {@link Disposable.onDisposed} */
98
- onDisposed: Event<unknown>;
99
- constructor(components: Components);
100
- /**
101
- * Retrieves a SimpleRaycaster instance for the given world.
102
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
103
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
104
- *
105
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
106
- * @returns The SimpleRaycaster instance for the given world.
107
- */
108
- get(world: World): SimpleRaycaster;
109
- /**
110
- * Deletes the SimpleRaycaster instance associated with the given world.
111
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
112
- *
113
- * @param world - The world for which to delete the SimpleRaycaster instance.
114
- * @returns {void}
115
- */
116
- delete(world: World): void;
117
- /** {@link Disposable.dispose} */
118
- dispose(): void;
119
- }
120
- import * as THREE from "three";
121
- import { Components } from "../Components";
122
- import { Component } from "../Types";
123
- /**
124
- * 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).
125
- */
126
- export declare class Disposer extends Component {
127
- private _disposedComponents;
128
- /** {@link Component.enabled} */
129
- enabled: boolean;
130
- /**
131
- * A unique identifier for the component.
132
- * This UUID is used to register the component within the Components system.
133
- */
134
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
135
- constructor(components: Components);
136
- /**
137
- * Return the UUIDs of all disposed components.
138
- */
139
- get(): Set<string>;
140
- /**
141
- * Removes a mesh, its geometry and its materials from memory. If you are
142
- * using any of these in other parts of the application, make sure that you
143
- * remove them from the mesh before disposing it.
144
- *
145
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
146
- * to remove.
147
- *
148
- * @param materials - whether to dispose the materials of the mesh.
149
- *
150
- * @param recursive - whether to recursively dispose the children of the mesh.
151
- */
152
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
153
- /**
154
- * Disposes a geometry from memory.
155
- *
156
- * @param geometry - the
157
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
158
- * to remove.
159
- */
160
- disposeGeometry(geometry: THREE.BufferGeometry): void;
161
- private disposeGeometryAndMaterials;
162
- private disposeChildren;
163
- private static disposeMaterial;
164
- }
165
- import { Component, Disposable, World, Event } from "../Types";
166
166
  import { GridConfig, SimpleGrid } from "./src";
167
167
  import { Components } from "../Components";
168
168
  /**
@@ -409,54 +409,6 @@ export declare class Clipper extends Component implements Createable, Disposable
409
409
  private _onStartDragging;
410
410
  private _onEndDragging;
411
411
  }
412
- import { Components } from "../Components";
413
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
414
- import { Component, Event, Disposable, World } from "../Types";
415
- /**
416
- * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
417
- */
418
- export declare class Cullers extends Component implements Disposable {
419
- /**
420
- * A unique identifier for the component.
421
- * This UUID is used to register the component within the Components system.
422
- */
423
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
424
- /**
425
- * An event that is triggered when the Cullers component is disposed.
426
- */
427
- readonly onDisposed: Event<unknown>;
428
- private _enabled;
429
- /**
430
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
431
- */
432
- list: Map<string, MeshCullerRenderer>;
433
- /** {@link Component.enabled} */
434
- get enabled(): boolean;
435
- /** {@link Component.enabled} */
436
- set enabled(value: boolean);
437
- constructor(components: Components);
438
- /**
439
- * Creates a new MeshCullerRenderer for the given world.
440
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
441
- *
442
- * @param world - The world for which to create the MeshCullerRenderer.
443
- * @param config - Optional configuration settings for the MeshCullerRenderer.
444
- *
445
- * @returns The newly created or existing MeshCullerRenderer for the given world.
446
- */
447
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
448
- /**
449
- * Deletes the MeshCullerRenderer associated with the given world.
450
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
451
- *
452
- * @param world - The world for which to delete the MeshCullerRenderer.
453
- *
454
- * @returns {void}
455
- */
456
- delete(world: World): void;
457
- /** {@link Disposable.dispose} */
458
- dispose(): void;
459
- }
460
412
  import { MiniMap } from "./src";
461
413
  import { Component, Updateable, World, Event, Disposable } from "../Types";
462
414
  import { Components } from "../Components";
@@ -504,38 +456,86 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
504
456
  /** {@link Updateable.update} */
505
457
  update(): void;
506
458
  }
507
- import * as THREE from "three";
508
459
  import { Components } from "../Components";
509
- import { SimpleCamera } from "..";
510
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
460
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
461
+ import { Component, Event, Disposable, World } from "../Types";
511
462
  /**
512
- * 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).
463
+ * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
513
464
  */
514
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
465
+ export declare class Cullers extends Component implements Disposable {
515
466
  /**
516
- * A ProjectionManager instance that manages the projection modes of the camera.
467
+ * A unique identifier for the component.
468
+ * This UUID is used to register the component within the Components system.
517
469
  */
518
- readonly projection: ProjectionManager;
470
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
519
471
  /**
520
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
521
- * This camera is used when the projection mode is set to orthographic.
472
+ * An event that is triggered when the Cullers component is disposed.
522
473
  */
523
- readonly threeOrtho: THREE.OrthographicCamera;
474
+ readonly onDisposed: Event<unknown>;
475
+ private _enabled;
524
476
  /**
525
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
526
- * This camera is used when the projection mode is set to perspective.
477
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
527
478
  */
528
- readonly threePersp: THREE.PerspectiveCamera;
529
- protected readonly _userInputButtons: any;
530
- protected readonly _frustumSize = 50;
531
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
532
- protected _mode: NavigationMode | null;
533
- private previousSize;
534
- /**
535
- * Getter for the current navigation mode.
536
- * Throws an error if the mode is not found or the camera is not initialized.
537
- *
538
- * @returns {NavigationMode} The current navigation mode.
479
+ list: Map<string, MeshCullerRenderer>;
480
+ /** {@link Component.enabled} */
481
+ get enabled(): boolean;
482
+ /** {@link Component.enabled} */
483
+ set enabled(value: boolean);
484
+ constructor(components: Components);
485
+ /**
486
+ * Creates a new MeshCullerRenderer for the given world.
487
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
488
+ *
489
+ * @param world - The world for which to create the MeshCullerRenderer.
490
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
491
+ *
492
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
493
+ */
494
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
495
+ /**
496
+ * Deletes the MeshCullerRenderer associated with the given world.
497
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
498
+ *
499
+ * @param world - The world for which to delete the MeshCullerRenderer.
500
+ *
501
+ * @returns {void}
502
+ */
503
+ delete(world: World): void;
504
+ /** {@link Disposable.dispose} */
505
+ dispose(): void;
506
+ }
507
+ import * as THREE from "three";
508
+ import { Components } from "../Components";
509
+ import { SimpleCamera } from "..";
510
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
511
+ /**
512
+ * 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).
513
+ */
514
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
515
+ /**
516
+ * A ProjectionManager instance that manages the projection modes of the camera.
517
+ */
518
+ readonly projection: ProjectionManager;
519
+ /**
520
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
521
+ * This camera is used when the projection mode is set to orthographic.
522
+ */
523
+ readonly threeOrtho: THREE.OrthographicCamera;
524
+ /**
525
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
526
+ * This camera is used when the projection mode is set to perspective.
527
+ */
528
+ readonly threePersp: THREE.PerspectiveCamera;
529
+ protected readonly _userInputButtons: any;
530
+ protected readonly _frustumSize = 50;
531
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
532
+ protected _mode: NavigationMode | null;
533
+ private previousSize;
534
+ /**
535
+ * Getter for the current navigation mode.
536
+ * Throws an error if the mode is not found or the camera is not initialized.
537
+ *
538
+ * @returns {NavigationMode} The current navigation mode.
539
539
  *
540
540
  * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
541
541
  */
@@ -568,43 +568,193 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
568
568
  private newOrthoCamera;
569
569
  private setOrthoPerspCameraAspect;
570
570
  }
571
- import * as FRAGS from "@thatopen/fragments";
572
- import { Components, Component } from "../../core";
571
+ import * as WEBIFC from "web-ifc";
572
+ import * as FRAG from "@thatopen/fragments";
573
+ import { Component, Components } from "../../core";
573
574
  /**
574
- * 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).
575
+ * 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).
575
576
  */
576
- export declare class Hider extends Component {
577
+ export declare class IfcJsonExporter extends Component {
577
578
  /**
578
579
  * A unique identifier for the component.
579
580
  * This UUID is used to register the component within the Components system.
580
581
  */
581
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
582
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
582
583
  /** {@link Component.enabled} */
583
584
  enabled: boolean;
584
585
  constructor(components: Components);
585
586
  /**
586
- * Sets the visibility of fragments within the 3D scene.
587
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
588
- * If 'items' is provided, only the specified fragments will be affected.
587
+ * Exports all the properties of an IFC into an array of JS objects.
588
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
589
+ * @param modelID ID of the IFC model whose properties to extract.
590
+ * @param indirect whether to get the indirect relationships as well.
591
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
592
+ * to make the location data available (e.g. absolute position of building).
593
+ */
594
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
595
+ }
596
+ import * as WEBIFC from "web-ifc";
597
+ import { FragmentsGroup } from "@thatopen/fragments";
598
+ import { Disposable, Event, Component, Components } from "../../core";
599
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
600
+ export type { InverseAttribute, RelationsMap } from "./src/types";
601
+ /**
602
+ * 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).
603
+ */
604
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
605
+ /**
606
+ * A unique identifier for the component.
607
+ * This UUID is used to register the component within the Components system.
608
+ */
609
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
610
+ /** {@link Disposable.onDisposed} */
611
+ readonly onDisposed: Event<string>;
612
+ /**
613
+ * Event triggered when relations for a model have been indexed.
614
+ * This event provides the model's UUID and the relations map generated for that model.
589
615
  *
590
- * @param visible - The visibility state to set for the fragments.
591
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
592
- * If not provided, all fragments will be affected.
616
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
617
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
618
+ * 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.
619
+ */
620
+ readonly onRelationsIndexed: Event<{
621
+ modelID: string;
622
+ relationsMap: RelationsMap;
623
+ }>;
624
+ /**
625
+ * Holds the relationship mappings for each model processed by the indexer.
626
+ * The structure is a map where each key is a model's UUID, and the value is another map.
627
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
628
+ * representing a specific relation type, and the value is an array of expressIDs of entities
629
+ * that are related through that relation type. This structure allows for efficient querying
630
+ * of entity relationships within a model.
631
+ */
632
+ readonly relationMaps: ModelsRelationMap;
633
+ /** {@link Component.enabled} */
634
+ enabled: boolean;
635
+ private _relToAttributesMap;
636
+ private _inverseAttributes;
637
+ private _ifcRels;
638
+ constructor(components: Components);
639
+ private onFragmentsDisposed;
640
+ private indexRelations;
641
+ private getAttributeIndex;
642
+ /**
643
+ * Adds a relation map to the model's relations map.
593
644
  *
594
- * @returns {void}
645
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
646
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
647
+ *
648
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
595
649
  */
596
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
650
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
597
651
  /**
598
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
599
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
652
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
653
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
654
+ * and maps them in a structured way to facilitate quick access to related entities.
600
655
  *
601
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
602
- * If not provided, all fragments will be isolated.
656
+ * The process involves querying the model for each relation type associated with the inverse attributes
657
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
658
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
659
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
660
+ * of entities that are related through that attribute.
603
661
  *
604
- * @returns {void}
662
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
663
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
664
+ * representation of the relations indexed by entity expressIDs and relation types.
665
+ * @throws An error if the model does not have properties loaded.
605
666
  */
606
- isolate(items: FRAGS.FragmentIdMap): void;
607
- private updateCulledVisibility;
667
+ process(model: FragmentsGroup): Promise<RelationsMap>;
668
+ /**
669
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
670
+ *
671
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
672
+ * @param modelID - The unique identifier of the model within the WebIfc API.
673
+ * @returns A promise that resolves to the relations map for the processed model.
674
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
675
+ */
676
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
677
+ /**
678
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
679
+ * This method searches the indexed relation maps for the specified model and entity,
680
+ * returning the IDs of related entities if a match is found.
681
+ *
682
+ * @param model The 'FragmentsGroup' model containing the entity.
683
+ * @param expressID The unique identifier of the entity within the model.
684
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
685
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
686
+ * or the specified relation name is not indexed.
687
+ */
688
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
689
+ /**
690
+ * Serializes the relations of a given relation map into a JSON string.
691
+ * 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,
692
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
693
+ * The resulting object is then serialized into a JSON string.
694
+ *
695
+ * @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.
696
+ * @returns A JSON string representing the serialized relations of the given relation map.
697
+ */
698
+ serializeRelations(relationMap: RelationsMap): string;
699
+ /**
700
+ * Serializes the relations of a specific model into a JSON string.
701
+ * This method iterates through the relations indexed for the given model,
702
+ * organizing them into a structured object where each key is an expressID of an entity,
703
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
704
+ * The resulting object is then serialized into a JSON string.
705
+ *
706
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
707
+ * @returns A JSON string representing the serialized relations of the specified model.
708
+ * If the model has no indexed relations, 'null' is returned.
709
+ */
710
+ serializeModelRelations(model: FragmentsGroup): string | null;
711
+ /**
712
+ * Serializes all relations of every model processed by the indexer into a JSON string.
713
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
714
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
715
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
716
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
717
+ *
718
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
719
+ * If no relations have been indexed, an empty object is returned as a JSON string.
720
+ */
721
+ serializeAllRelations(): string;
722
+ /**
723
+ * Converts a JSON string representing relations between entities into a structured map.
724
+ * This method parses the JSON string to reconstruct the relations map that indexes
725
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
726
+ * and the values are maps where each key is a relation type ID and its value is an array
727
+ * of express IDs of entities related through that relation type.
728
+ *
729
+ * @param json The JSON string to be parsed into the relations map.
730
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
731
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
732
+ * is an array of express IDs (as numbers) of entities related through that relation type.
733
+ */
734
+ getRelationsMapFromJSON(json: string): RelationsMap;
735
+ /** {@link Disposable.dispose} */
736
+ dispose(): void;
737
+ /**
738
+ * Adds relations between an entity and other entities in a BIM model.
739
+ *
740
+ * @param model - The BIM model to which the relations will be added.
741
+ * @param expressID - The expressID of the entity within the model.
742
+ * @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
743
+ * @param relIDs - The expressIDs of the related entities within the model.
744
+ *
745
+ * @throws An error if the relation name is not a valid relation name.
746
+ */
747
+ addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
748
+ /**
749
+ * 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.
750
+ *
751
+ * @param model The BIM model whose children to get.
752
+ * @param expressID The expressID of the item whose children to get.
753
+ * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
754
+ *
755
+ * @returns A 'Set' with the expressIDs of the found items.
756
+ */
757
+ getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
608
758
  }
609
759
  import * as THREE from "three";
610
760
  import * as FRAGS from "@thatopen/fragments";
@@ -814,182 +964,267 @@ export declare class BoundingBoxer extends Component implements Disposable {
814
964
  addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
815
965
  private static getFragmentBounds;
816
966
  }
817
- import * as THREE from "three";
818
- import * as FRAGS from "@thatopen/fragments";
819
- import { Disposable, Component, Event, Components } from "../../core";
967
+ import * as WEBIFC from "web-ifc";
968
+ import { FragmentsGroup } from "@thatopen/fragments";
969
+ import { Component, Disposable, Event, Components } from "../../core";
820
970
  /**
821
- * 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.
971
+ * Types for boolean properties in IFC schema.
822
972
  */
823
- export interface Classification {
824
- /**
825
- * A system within the classification.
826
- * The key is the system name, and the value is an object representing the classes within the system.
827
- */
828
- [system: string]: {
829
- /**
830
- * A class within the system.
831
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
832
- */
833
- [className: string]: {
834
- map: FRAGS.FragmentIdMap;
835
- name: string;
836
- id: number | null;
973
+ export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
974
+ /**
975
+ * Types for string properties in IFC schema.
976
+ */
977
+ export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
978
+ /**
979
+ * Types for numeric properties in IFC schema.
980
+ */
981
+ export type NumericPropTypes = "IfcInteger" | "IfcReal";
982
+ /**
983
+ * 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.
984
+ */
985
+ export interface ChangeMap {
986
+ [modelID: string]: Set<number>;
987
+ }
988
+ /**
989
+ * 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.
990
+ */
991
+ export interface AttributeListener {
992
+ [modelID: string]: {
993
+ [expressID: number]: {
994
+ [attributeName: string]: Event<String | Boolean | Number>;
837
995
  };
838
996
  };
839
997
  }
840
998
  /**
841
- * 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).
999
+ * Component to manage and edit properties and Psets in IFC files.
842
1000
  */
843
- export declare class Classifier extends Component implements Disposable {
1001
+ export declare class IfcPropertiesManager extends Component implements Disposable {
844
1002
  /**
845
1003
  * A unique identifier for the component.
846
1004
  * This UUID is used to register the component within the Components system.
847
1005
  */
848
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1006
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1007
+ /** {@link Disposable.onDisposed} */
1008
+ readonly onDisposed: Event<string>;
1009
+ /**
1010
+ * Event triggered when a file is requested for export.
1011
+ */
1012
+ readonly onRequestFile: Event<unknown>;
1013
+ /**
1014
+ * ArrayBuffer containing the IFC data to be exported.
1015
+ */
1016
+ ifcToExport: ArrayBuffer | null;
1017
+ /**
1018
+ * Event triggered when an element is added to a Pset.
1019
+ */
1020
+ readonly onElementToPset: Event<{
1021
+ model: FragmentsGroup;
1022
+ psetID: number;
1023
+ elementID: number;
1024
+ }>;
1025
+ /**
1026
+ * Event triggered when a property is added to a Pset.
1027
+ */
1028
+ readonly onPropToPset: Event<{
1029
+ model: FragmentsGroup;
1030
+ psetID: number;
1031
+ propID: number;
1032
+ }>;
1033
+ /**
1034
+ * Event triggered when a Pset is removed.
1035
+ */
1036
+ readonly onPsetRemoved: Event<{
1037
+ model: FragmentsGroup;
1038
+ psetID: number;
1039
+ }>;
1040
+ /**
1041
+ * Event triggered when data in the model changes.
1042
+ */
1043
+ readonly onDataChanged: Event<{
1044
+ model: FragmentsGroup;
1045
+ expressID: number;
1046
+ }>;
1047
+ /**
1048
+ * Configuration for the WebAssembly module.
1049
+ */
1050
+ wasm: {
1051
+ path: string;
1052
+ absolute: boolean;
1053
+ };
849
1054
  /** {@link Component.enabled} */
850
1055
  enabled: boolean;
851
1056
  /**
852
- * A map representing the classification systems.
853
- * The key is the system name, and the value is an object representing the classes within the system.
1057
+ * Map of attribute listeners.
854
1058
  */
855
- list: Classification;
856
- /** {@link Disposable.onDisposed} */
857
- readonly onDisposed: Event<unknown>;
1059
+ attributeListeners: AttributeListener;
1060
+ /**
1061
+ * The currently selected model.
1062
+ */
1063
+ selectedModel?: FragmentsGroup;
1064
+ /**
1065
+ * Map of changed entities in the model.
1066
+ */
1067
+ changeMap: ChangeMap;
858
1068
  constructor(components: Components);
859
- private onFragmentsDisposed;
860
1069
  /** {@link Disposable.dispose} */
861
1070
  dispose(): void;
862
1071
  /**
863
- * Removes a fragment from the classification based on its unique identifier (guid).
864
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1072
+ * Static method to retrieve the IFC schema from a given model.
865
1073
  *
866
- * @param guid - The unique identifier of the fragment to be removed.
1074
+ * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1075
+ * @throws Will throw an error if the IFC schema is not found in the model.
1076
+ * @returns The IFC schema associated with the given model.
867
1077
  */
868
- remove(guid: string): void;
1078
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
869
1079
  /**
870
- * Finds and returns fragments based on the provided filter criteria.
871
- * If no filter is provided, it returns all fragments.
1080
+ * Method to set properties data in the model.
872
1081
  *
873
- * @param filter - An optional object containing filter criteria.
874
- * The keys of the object represent the classification system names,
875
- * and the values are arrays of class names to match.
1082
+ * @param model - The FragmentsGroup model in which to set the properties.
1083
+ * @param dataToSave - An array of objects representing the properties to be saved.
1084
+ * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1085
+ * The rest of the properties will be set as the properties of the entity.
876
1086
  *
877
- * @returns A map of fragment GUIDs to their respective express IDs,
878
- * where the express IDs are filtered based on the provided filter criteria.
1087
+ * @returns A promise that resolves when all the properties have been set.
879
1088
  *
880
- * @throws Will throw an error if the fragments map is malformed.
1089
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
881
1090
  */
882
- find(filter?: {
883
- [name: string]: string[];
884
- }): FRAGS.FragmentIdMap;
1091
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
885
1092
  /**
886
- * Classifies fragments based on their modelID.
1093
+ * Creates a new Property Set (Pset) in the given model.
887
1094
  *
888
- * @param modelID - The unique identifier of the model to classify fragments by.
889
- * @param group - The FragmentsGroup containing the fragments to be classified.
1095
+ * @param model - The FragmentsGroup model in which to create the Pset.
1096
+ * @param name - The name of the Pset.
1097
+ * @param description - (Optional) The description of the Pset.
890
1098
  *
891
- * @remarks
892
- * This method iterates through the fragments in the provided group,
893
- * and classifies them based on their modelID.
894
- * The classification is stored in the 'list.models' property,
895
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1099
+ * @returns A promise that resolves with an object containing the newly created Pset and its relation.
896
1100
  *
1101
+ * @throws Will throw an error if the IFC schema is not found in the model.
1102
+ * @throws Will throw an error if no OwnerHistory is found in the model.
897
1103
  */
898
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1104
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1105
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1106
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1107
+ }>;
899
1108
  /**
900
- * Classifies fragments based on their PredefinedType property.
1109
+ * Removes a Property Set (Pset) from the given model.
901
1110
  *
902
- * @param group - The FragmentsGroup containing the fragments to be classified.
1111
+ * @param model - The FragmentsGroup model from which to remove the Pset.
1112
+ * @param psetID - The express IDs of the Psets to be removed.
903
1113
  *
904
- * @remarks
905
- * This method iterates through the properties of the fragments in the provided group,
906
- * and classifies them based on their PredefinedType property.
907
- * The classification is stored in the 'list.predefinedTypes' property,
908
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1114
+ * @returns A promise that resolves when all the Psets have been removed.
909
1115
  *
910
- * @throws Will throw an error if the fragment ID is not found.
1116
+ * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1117
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1118
+ * @throws Will throw an error if no relation is found between the Pset and the model.
911
1119
  */
912
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1120
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
913
1121
  /**
914
- * Classifies fragments based on their entity type.
1122
+ * Creates a new single-value property of type string in the given model.
915
1123
  *
916
- * @param group - The FragmentsGroup containing the fragments to be classified.
1124
+ * @param model - The FragmentsGroup model in which to create the property.
1125
+ * @param type - The type of the property value. Must be a string property type.
1126
+ * @param name - The name of the property.
1127
+ * @param value - The value of the property. Must be a string.
917
1128
  *
918
- * @remarks
919
- * This method iterates through the relations of the fragments in the provided group,
920
- * and classifies them based on their entity type.
921
- * The classification is stored in the 'list.entities' property,
922
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1129
+ * @returns The newly created single-value property.
923
1130
  *
924
- * @throws Will throw an error if the fragment ID is not found.
1131
+ * @throws Will throw an error if the IFC schema is not found in the model.
1132
+ * @throws Will throw an error if no OwnerHistory is found in the model.
925
1133
  */
926
- byEntity(group: FRAGS.FragmentsGroup): void;
1134
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
927
1135
  /**
928
- * Classifies fragments based on a specific IFC relationship.
1136
+ * Creates a new single-value property of type numeric in the given model.
929
1137
  *
930
- * @param group - The FragmentsGroup containing the fragments to be classified.
931
- * @param ifcRel - The IFC relationship number to classify fragments by.
932
- * @param systemName - The name of the classification system to store the classification.
1138
+ * @param model - The FragmentsGroup model in which to create the property.
1139
+ * @param type - The type of the property value. Must be a numeric property type.
1140
+ * @param name - The name of the property.
1141
+ * @param value - The value of the property. Must be a number.
933
1142
  *
934
- * @remarks
935
- * This method iterates through the relations of the fragments in the provided group,
936
- * and classifies them based on the specified IFC relationship.
937
- * The classification is stored in the 'list' property under the specified system name,
938
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1143
+ * @returns The newly created single-value property.
939
1144
  *
940
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1145
+ * @throws Will throw an error if the IFC schema is not found in the model.
1146
+ * @throws Will throw an error if no OwnerHistory is found in the model.
941
1147
  */
942
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1148
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
943
1149
  /**
944
- * Classifies fragments based on their spatial structure in the IFC model.
1150
+ * Creates a new single-value property of type boolean in the given model.
945
1151
  *
946
- * @param model - The FragmentsGroup containing the fragments to be classified.
947
- * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
1152
+ * @param model - The FragmentsGroup model in which to create the property.
1153
+ * @param type - The type of the property value. Must be a boolean property type.
1154
+ * @param name - The name of the property.
1155
+ * @param value - The value of the property. Must be a boolean.
948
1156
  *
949
- * @remarks
950
- * This method iterates through the relations of the fragments in the provided group,
951
- * and classifies them based on their spatial structure in the IFC model.
952
- * The classification is stored in the 'list' property under the system name "spatialStructures",
953
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1157
+ * @returns The newly created single-value property.
954
1158
  *
955
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1159
+ * @throws Will throw an error if the IFC schema is not found in the model.
1160
+ * @throws Will throw an error if no OwnerHistory is found in the model.
956
1161
  */
957
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
958
- useProperties: boolean;
959
- }): Promise<void>;
1162
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
960
1163
  /**
961
- * Sets the color of the specified fragments.
1164
+ * Removes a property from a Property Set (Pset) in the given model.
962
1165
  *
963
- * @param items - A map of fragment IDs to their respective express IDs.
964
- * @param color - The color to set for the fragments.
965
- * @param override - A boolean indicating whether to override the existing color of the fragments.
1166
+ * @param model - The FragmentsGroup model from which to remove the property.
1167
+ * @param psetID - The express ID of the Pset from which to remove the property.
1168
+ * @param propID - The express ID of the property to be removed.
966
1169
  *
967
- * @remarks
968
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
969
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
1170
+ * @returns A promise that resolves when the property has been removed.
970
1171
  *
971
- * @throws Will throw an error if the fragment with the specified ID is not found.
1172
+ * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
1173
+ * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
972
1174
  */
973
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1175
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
1176
+ addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
974
1177
  /**
975
- * Resets the color of the specified fragments to their original color.
1178
+ * Adds elements to a Property Set (Pset) in the given model.
976
1179
  *
977
- * @param items - A map of fragment IDs to their respective express IDs.
1180
+ * @param model - The FragmentsGroup model in which to add the elements.
1181
+ * @param psetID - The express ID of the Pset to which to add the elements.
1182
+ * @param elementID - The express IDs of the elements to be added.
978
1183
  *
979
- * @remarks
980
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
981
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1184
+ * @returns A promise that resolves when all the elements have been added.
982
1185
  *
983
- * @throws Will throw an error if the fragment with the specified ID is not found.
1186
+ * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
1187
+ * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
1188
+ * @throws Will throw an error if no relation is found between the Pset and the model.
984
1189
  */
985
- resetColor(items: FRAGS.FragmentIdMap): void;
986
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
987
- }
988
- import { Component, Disposable, Event, Components } from "../../core";
989
- /**
990
- * 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).
991
- */
992
- export declare class Exploder extends Component implements Disposable {
1190
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
1191
+ /**
1192
+ * Saves the changes made to the model to a new IFC file.
1193
+ *
1194
+ * @param model - The FragmentsGroup model from which to save the changes.
1195
+ * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
1196
+ *
1197
+ * @returns A promise that resolves with the modified IFC data as a Uint8Array.
1198
+ *
1199
+ * @throws Will throw an error if any issues occur during the saving process.
1200
+ */
1201
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
1202
+ /**
1203
+ * Sets an attribute listener for a specific attribute of an entity in the model.
1204
+ * The listener will trigger an event whenever the attribute's value changes.
1205
+ *
1206
+ * @param model - The FragmentsGroup model in which to set the attribute listener.
1207
+ * @param expressID - The express ID of the entity for which to set the listener.
1208
+ * @param attributeName - The name of the attribute for which to set the listener.
1209
+ *
1210
+ * @returns The event that will be triggered when the attribute's value changes.
1211
+ *
1212
+ * @throws Will throw an error if the entity with the given expressID doesn't exist.
1213
+ * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
1214
+ * @throws Will throw an error if the attribute has a badly defined handle.
1215
+ */
1216
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1217
+ private increaseMaxID;
1218
+ private newGUID;
1219
+ private getOwnerHistory;
1220
+ private registerChange;
1221
+ private newSingleProperty;
1222
+ }
1223
+ import { Component, Disposable, Event, Components } from "../../core";
1224
+ /**
1225
+ * 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).
1226
+ */
1227
+ export declare class Exploder extends Component implements Disposable {
993
1228
  /**
994
1229
  * A unique identifier for the component.
995
1230
  * This UUID is used to register the component within the Components system.
@@ -1035,6 +1270,222 @@ export declare class Exploder extends Component implements Disposable {
1035
1270
  */
1036
1271
  set(active: boolean): void;
1037
1272
  }
1273
+ import * as THREE from "three";
1274
+ import * as FRAGS from "@thatopen/fragments";
1275
+ import { Disposable, Component, Event, Components } from "../../core";
1276
+ /**
1277
+ * 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.
1278
+ */
1279
+ export interface Classification {
1280
+ /**
1281
+ * A system within the classification.
1282
+ * The key is the system name, and the value is an object representing the classes within the system.
1283
+ */
1284
+ [system: string]: {
1285
+ /**
1286
+ * A class within the system.
1287
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1288
+ */
1289
+ [className: string]: {
1290
+ map: FRAGS.FragmentIdMap;
1291
+ name: string;
1292
+ id: number | null;
1293
+ };
1294
+ };
1295
+ }
1296
+ /**
1297
+ * 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).
1298
+ */
1299
+ export declare class Classifier extends Component implements Disposable {
1300
+ /**
1301
+ * A unique identifier for the component.
1302
+ * This UUID is used to register the component within the Components system.
1303
+ */
1304
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1305
+ /** {@link Component.enabled} */
1306
+ enabled: boolean;
1307
+ /**
1308
+ * A map representing the classification systems.
1309
+ * The key is the system name, and the value is an object representing the classes within the system.
1310
+ */
1311
+ list: Classification;
1312
+ /** {@link Disposable.onDisposed} */
1313
+ readonly onDisposed: Event<unknown>;
1314
+ constructor(components: Components);
1315
+ private onFragmentsDisposed;
1316
+ /** {@link Disposable.dispose} */
1317
+ dispose(): void;
1318
+ /**
1319
+ * Removes a fragment from the classification based on its unique identifier (guid).
1320
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1321
+ *
1322
+ * @param guid - The unique identifier of the fragment to be removed.
1323
+ */
1324
+ remove(guid: string): void;
1325
+ /**
1326
+ * Finds and returns fragments based on the provided filter criteria.
1327
+ * If no filter is provided, it returns all fragments.
1328
+ *
1329
+ * @param filter - An optional object containing filter criteria.
1330
+ * The keys of the object represent the classification system names,
1331
+ * and the values are arrays of class names to match.
1332
+ *
1333
+ * @returns A map of fragment GUIDs to their respective express IDs,
1334
+ * where the express IDs are filtered based on the provided filter criteria.
1335
+ *
1336
+ * @throws Will throw an error if the fragments map is malformed.
1337
+ */
1338
+ find(filter?: {
1339
+ [name: string]: string[];
1340
+ }): FRAGS.FragmentIdMap;
1341
+ /**
1342
+ * Classifies fragments based on their modelID.
1343
+ *
1344
+ * @param modelID - The unique identifier of the model to classify fragments by.
1345
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1346
+ *
1347
+ * @remarks
1348
+ * This method iterates through the fragments in the provided group,
1349
+ * and classifies them based on their modelID.
1350
+ * The classification is stored in the 'list.models' property,
1351
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1352
+ *
1353
+ */
1354
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1355
+ /**
1356
+ * Classifies fragments based on their PredefinedType property.
1357
+ *
1358
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1359
+ *
1360
+ * @remarks
1361
+ * This method iterates through the properties of the fragments in the provided group,
1362
+ * and classifies them based on their PredefinedType property.
1363
+ * The classification is stored in the 'list.predefinedTypes' property,
1364
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1365
+ *
1366
+ * @throws Will throw an error if the fragment ID is not found.
1367
+ */
1368
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1369
+ /**
1370
+ * Classifies fragments based on their entity type.
1371
+ *
1372
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1373
+ *
1374
+ * @remarks
1375
+ * This method iterates through the relations of the fragments in the provided group,
1376
+ * and classifies them based on their entity type.
1377
+ * The classification is stored in the 'list.entities' property,
1378
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1379
+ *
1380
+ * @throws Will throw an error if the fragment ID is not found.
1381
+ */
1382
+ byEntity(group: FRAGS.FragmentsGroup): void;
1383
+ /**
1384
+ * Classifies fragments based on a specific IFC relationship.
1385
+ *
1386
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1387
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1388
+ * @param systemName - The name of the classification system to store the classification.
1389
+ *
1390
+ * @remarks
1391
+ * This method iterates through the relations of the fragments in the provided group,
1392
+ * and classifies them based on the specified IFC relationship.
1393
+ * The classification is stored in the 'list' property under the specified system name,
1394
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1395
+ *
1396
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1397
+ */
1398
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1399
+ /**
1400
+ * Classifies fragments based on their spatial structure in the IFC model.
1401
+ *
1402
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1403
+ * @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
1404
+ *
1405
+ * @remarks
1406
+ * This method iterates through the relations of the fragments in the provided group,
1407
+ * and classifies them based on their spatial structure in the IFC model.
1408
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1409
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1410
+ *
1411
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1412
+ */
1413
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1414
+ useProperties: boolean;
1415
+ }): Promise<void>;
1416
+ /**
1417
+ * Sets the color of the specified fragments.
1418
+ *
1419
+ * @param items - A map of fragment IDs to their respective express IDs.
1420
+ * @param color - The color to set for the fragments.
1421
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1422
+ *
1423
+ * @remarks
1424
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1425
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1426
+ *
1427
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1428
+ */
1429
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1430
+ /**
1431
+ * Resets the color of the specified fragments to their original color.
1432
+ *
1433
+ * @param items - A map of fragment IDs to their respective express IDs.
1434
+ *
1435
+ * @remarks
1436
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1437
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1438
+ *
1439
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1440
+ */
1441
+ resetColor(items: FRAGS.FragmentIdMap): void;
1442
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1443
+ }
1444
+ import * as FRAGS from "@thatopen/fragments";
1445
+ import { Components, Component } from "../../core";
1446
+ /**
1447
+ * 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).
1448
+ */
1449
+ export declare class Hider extends Component {
1450
+ /**
1451
+ * A unique identifier for the component.
1452
+ * This UUID is used to register the component within the Components system.
1453
+ */
1454
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1455
+ /** {@link Component.enabled} */
1456
+ enabled: boolean;
1457
+ constructor(components: Components);
1458
+ /**
1459
+ * Sets the visibility of fragments within the 3D scene.
1460
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1461
+ * If 'items' is provided, only the specified fragments will be affected.
1462
+ *
1463
+ * @param visible - The visibility state to set for the fragments.
1464
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1465
+ * If not provided, all fragments will be affected.
1466
+ *
1467
+ * @returns {void}
1468
+ */
1469
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1470
+ /**
1471
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1472
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1473
+ *
1474
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1475
+ * If not provided, all fragments will be isolated.
1476
+ *
1477
+ * @returns {void}
1478
+ */
1479
+ isolate(items: FRAGS.FragmentIdMap): void;
1480
+ private updateCulledVisibility;
1481
+ }
1482
+ import * as THREE from "three";
1483
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1484
+ center: THREE.Vector3;
1485
+ halfSizes: THREE.Vector3;
1486
+ rotation: THREE.Matrix3;
1487
+ transformation: THREE.Matrix4;
1488
+ };
1038
1489
  import * as WEBIFC from "web-ifc";
1039
1490
  import * as FRAGS from "@thatopen/fragments";
1040
1491
  import { IfcFragmentSettings } from "./src";
@@ -1150,7 +1601,134 @@ export declare class IfcLoader extends Component implements Disposable {
1150
1601
  private getGeometry;
1151
1602
  private autoSetWasm;
1152
1603
  }
1153
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1604
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1605
+ import * as THREE from "three";
1606
+ export declare class MaterialsUtils {
1607
+ static isTransparent(material: THREE.Material): boolean;
1608
+ }
1609
+ export declare class UUID {
1610
+ private static _pattern;
1611
+ private static _lut;
1612
+ static create(): string;
1613
+ static validate(uuid: string): void;
1614
+ }
1615
+ import * as THREE from "three";
1616
+ import { Component, Components, Disposable, Event, World } from "../core";
1617
+ /**
1618
+ * Configuration interface for the VertexPicker component.
1619
+ */
1620
+ export interface VertexPickerConfig {
1621
+ /**
1622
+ * If true, only vertices will be picked, not the closest point on the face.
1623
+ */
1624
+ showOnlyVertex: boolean;
1625
+ /**
1626
+ * The maximum distance for snapping to a vertex.
1627
+ */
1628
+ snapDistance: number;
1629
+ /**
1630
+ * The HTML element to use for previewing the picked vertex.
1631
+ */
1632
+ previewElement: HTMLElement;
1633
+ }
1634
+ /**
1635
+ * A class that provides functionality for picking vertices in a 3D scene.
1636
+ */
1637
+ export declare class VertexPicker extends Component implements Disposable {
1638
+ /** {@link Disposable.onDisposed} */
1639
+ readonly onDisposed: Event<unknown>;
1640
+ /**
1641
+ * An event that is triggered when a vertex is found.
1642
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1643
+ */
1644
+ readonly onVertexFound: Event<THREE.Vector3>;
1645
+ /**
1646
+ * An event that is triggered when a vertex is lost.
1647
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1648
+ */
1649
+ readonly onVertexLost: Event<THREE.Vector3>;
1650
+ /**
1651
+ * An event that is triggered when the picker is enabled or disabled
1652
+ */
1653
+ readonly onEnabled: Event<boolean>;
1654
+ /**
1655
+ * A reference to the Components instance associated with this VertexPicker.
1656
+ */
1657
+ components: Components;
1658
+ /**
1659
+ * A reference to the working plane used for vertex picking.
1660
+ * This plane is used to determine which vertices are considered valid for picking.
1661
+ * If this value is null, all vertices are considered valid.
1662
+ */
1663
+ workingPlane: THREE.Plane | null;
1664
+ private _pickedPoint;
1665
+ private _config;
1666
+ private _enabled;
1667
+ /**
1668
+ * Sets the enabled state of the VertexPicker.
1669
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1670
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1671
+ *
1672
+ * @param value - The new enabled state.
1673
+ */
1674
+ set enabled(value: boolean);
1675
+ /**
1676
+ * Gets the current enabled state of the VertexPicker.
1677
+ *
1678
+ * @returns The current enabled state.
1679
+ */
1680
+ get enabled(): boolean;
1681
+ /**
1682
+ * Sets the configuration for the VertexPicker component.
1683
+ *
1684
+ * @param value - A Partial object containing the configuration properties to update.
1685
+ * The properties not provided in the value object will retain their current values.
1686
+ *
1687
+ * @example
1688
+ * '''typescript
1689
+ * vertexPicker.config = {
1690
+ * snapDistance: 0.5,
1691
+ * showOnlyVertex: true,
1692
+ * };
1693
+ * '''
1694
+ */
1695
+ set config(value: Partial<VertexPickerConfig>);
1696
+ /**
1697
+ * Gets the current configuration for the VertexPicker component.
1698
+ *
1699
+ * @returns A copy of the current VertexPickerConfig object.
1700
+ *
1701
+ * @example
1702
+ * '''typescript
1703
+ * const currentConfig = vertexPicker.config;
1704
+ * console.log(currentConfig.snapDistance); // Output: 0.25
1705
+ * '''
1706
+ */
1707
+ get config(): Partial<VertexPickerConfig>;
1708
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
1709
+ /** {@link Disposable.dispose} */
1710
+ dispose(): void;
1711
+ /**
1712
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
1713
+ *
1714
+ * @param world - The World instance to use for raycasting.
1715
+ *
1716
+ * @returns The current picked point, or null if no point is picked.
1717
+ *
1718
+ * @remarks
1719
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1720
+ * If enabled, it performs raycasting to find the closest intersecting object.
1721
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
1722
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1723
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1724
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1725
+ */
1726
+ get(world: World): THREE.Vector3 | null;
1727
+ private getClosestVertex;
1728
+ private getVertices;
1729
+ private getVertex;
1730
+ }
1731
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1154
1732
  import * as THREE from "three";
1155
1733
  import * as FRAGS from "@thatopen/fragments";
1156
1734
  import { Component, Components, Event, Disposable } from "../../core";
@@ -1529,616 +2107,99 @@ export declare class MeasurementUtils extends Component {
1529
2107
  private getVolumeOfMesh;
1530
2108
  private getSignedVolumeOfTriangle;
1531
2109
  }
1532
- import * as THREE from "three";
1533
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1534
- center: THREE.Vector3;
1535
- halfSizes: THREE.Vector3;
1536
- rotation: THREE.Matrix3;
1537
- transformation: THREE.Matrix4;
1538
- };
1539
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1540
- import * as THREE from "three";
1541
- export declare class MaterialsUtils {
1542
- static isTransparent(material: THREE.Material): boolean;
2110
+ import * as WEBIFC from "web-ifc";
2111
+ export interface IfcItemsCategories {
2112
+ [itemID: number]: number;
1543
2113
  }
1544
- export declare class UUID {
1545
- private static _pattern;
1546
- private static _lut;
1547
- static create(): string;
1548
- static validate(uuid: string): void;
2114
+ export declare class IfcCategories {
2115
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1549
2116
  }
1550
- import * as THREE from "three";
1551
- import { Component, Components, Disposable, Event, World } from "../core";
1552
2117
  /**
1553
- * Configuration interface for the VertexPicker component.
2118
+ * 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.
2119
+ *
2120
+ * @remarks
2121
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2122
+ * It is useful for identifying and processing different types of IFC elements in a project.
2123
+ *
1554
2124
  */
1555
- export interface VertexPickerConfig {
1556
- /**
1557
- * If true, only vertices will be picked, not the closest point on the face.
1558
- */
1559
- showOnlyVertex: boolean;
1560
- /**
1561
- * The maximum distance for snapping to a vertex.
1562
- */
1563
- snapDistance: number;
1564
- /**
1565
- * The HTML element to use for previewing the picked vertex.
1566
- */
1567
- previewElement: HTMLElement;
2125
+ export declare const IfcElements: {
2126
+ [key: number]: string;
2127
+ };
2128
+ /**
2129
+ * 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.
2130
+ */
2131
+ export declare const IfcCategoryMap: {
2132
+ [key: number]: string;
2133
+ };
2134
+ import * as FRAGS from "@thatopen/fragments";
2135
+ export declare class IfcPropertiesUtils {
2136
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2137
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2138
+ [attribute: string]: any;
2139
+ } | null>;
2140
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2141
+ [relatingID: number]: number[];
2142
+ }>;
2143
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2144
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2145
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2146
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2147
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2148
+ key: string | null;
2149
+ name: string | null;
2150
+ }>;
2151
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2152
+ key: string | null;
2153
+ value: number | null;
2154
+ }>;
2155
+ static isRel(expressID: number): boolean;
2156
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2157
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1568
2158
  }
1569
2159
  /**
1570
- * A class that provides functionality for picking vertices in a 3D scene.
2160
+ * A Set of unique numbers representing different types of IFC geometries.
1571
2161
  */
1572
- export declare class VertexPicker extends Component implements Disposable {
2162
+ export declare const GeometryTypes: Set<number>;
2163
+ import * as THREE from "three";
2164
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2165
+ /**
2166
+ * A class representing a 2D minimap of a 3D world.
2167
+ */
2168
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1573
2169
  /** {@link Disposable.onDisposed} */
1574
2170
  readonly onDisposed: Event<unknown>;
2171
+ /** {@link Updateable.onAfterUpdate} */
2172
+ readonly onAfterUpdate: Event<unknown>;
2173
+ /** {@link Updateable.onBeforeUpdate} */
2174
+ readonly onBeforeUpdate: Event<unknown>;
2175
+ /** {@link Resizeable.onResize} */
2176
+ readonly onResize: Event<THREE.Vector2>;
1575
2177
  /**
1576
- * An event that is triggered when a vertex is found.
1577
- * The event passes a THREE.Vector3 representing the position of the found vertex.
2178
+ * The front offset of the minimap.
2179
+ * It determines how much the minimap's view is offset from the camera's view.
2180
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1578
2181
  */
1579
- readonly onVertexFound: Event<THREE.Vector3>;
2182
+ frontOffset: number;
1580
2183
  /**
1581
- * An event that is triggered when a vertex is lost.
1582
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
2184
+ * The override material for the minimap.
2185
+ * It is used to render the depth information of the world onto the minimap.
1583
2186
  */
1584
- readonly onVertexLost: Event<THREE.Vector3>;
2187
+ overrideMaterial: THREE.MeshDepthMaterial;
1585
2188
  /**
1586
- * An event that is triggered when the picker is enabled or disabled
2189
+ * The background color of the minimap.
2190
+ * It is used to set the background color of the minimap's renderer.
1587
2191
  */
1588
- readonly onEnabled: Event<boolean>;
2192
+ backgroundColor: THREE.Color;
1589
2193
  /**
1590
- * A reference to the Components instance associated with this VertexPicker.
2194
+ * The WebGL renderer for the minimap.
2195
+ * It is used to render the minimap onto the screen.
1591
2196
  */
1592
- components: Components;
2197
+ renderer: THREE.WebGLRenderer;
1593
2198
  /**
1594
- * A reference to the working plane used for vertex picking.
1595
- * This plane is used to determine which vertices are considered valid for picking.
1596
- * If this value is null, all vertices are considered valid.
2199
+ * A flag indicating whether the minimap is enabled.
2200
+ * If disabled, the minimap will not update or render.
1597
2201
  */
1598
- workingPlane: THREE.Plane | null;
1599
- private _pickedPoint;
1600
- private _config;
1601
- private _enabled;
1602
- /**
1603
- * Sets the enabled state of the VertexPicker.
1604
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1605
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1606
- *
1607
- * @param value - The new enabled state.
1608
- */
1609
- set enabled(value: boolean);
1610
- /**
1611
- * Gets the current enabled state of the VertexPicker.
1612
- *
1613
- * @returns The current enabled state.
1614
- */
1615
- get enabled(): boolean;
1616
- /**
1617
- * Sets the configuration for the VertexPicker component.
1618
- *
1619
- * @param value - A Partial object containing the configuration properties to update.
1620
- * The properties not provided in the value object will retain their current values.
1621
- *
1622
- * @example
1623
- * '''typescript
1624
- * vertexPicker.config = {
1625
- * snapDistance: 0.5,
1626
- * showOnlyVertex: true,
1627
- * };
1628
- * '''
1629
- */
1630
- set config(value: Partial<VertexPickerConfig>);
1631
- /**
1632
- * Gets the current configuration for the VertexPicker component.
1633
- *
1634
- * @returns A copy of the current VertexPickerConfig object.
1635
- *
1636
- * @example
1637
- * '''typescript
1638
- * const currentConfig = vertexPicker.config;
1639
- * console.log(currentConfig.snapDistance); // Output: 0.25
1640
- * '''
1641
- */
1642
- get config(): Partial<VertexPickerConfig>;
1643
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1644
- /** {@link Disposable.dispose} */
1645
- dispose(): void;
1646
- /**
1647
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1648
- *
1649
- * @param world - The World instance to use for raycasting.
1650
- *
1651
- * @returns The current picked point, or null if no point is picked.
1652
- *
1653
- * @remarks
1654
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1655
- * If enabled, it performs raycasting to find the closest intersecting object.
1656
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1657
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1658
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1659
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1660
- */
1661
- get(world: World): THREE.Vector3 | null;
1662
- private getClosestVertex;
1663
- private getVertices;
1664
- private getVertex;
1665
- }
1666
- import * as WEBIFC from "web-ifc";
1667
- import * as FRAG from "@thatopen/fragments";
1668
- import { Component, Components } from "../../core";
1669
- /**
1670
- * 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).
1671
- */
1672
- export declare class IfcJsonExporter extends Component {
1673
- /**
1674
- * A unique identifier for the component.
1675
- * This UUID is used to register the component within the Components system.
1676
- */
1677
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1678
- /** {@link Component.enabled} */
1679
- enabled: boolean;
1680
- constructor(components: Components);
1681
- /**
1682
- * Exports all the properties of an IFC into an array of JS objects.
1683
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1684
- * @param modelID ID of the IFC model whose properties to extract.
1685
- * @param indirect whether to get the indirect relationships as well.
1686
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1687
- * to make the location data available (e.g. absolute position of building).
1688
- */
1689
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1690
- }
1691
- import * as WEBIFC from "web-ifc";
1692
- import { FragmentsGroup } from "@thatopen/fragments";
1693
- import { Disposable, Event, Component, Components } from "../../core";
1694
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
1695
- export type { InverseAttribute, RelationsMap } from "./src/types";
1696
- /**
1697
- * 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).
1698
- */
1699
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1700
- /**
1701
- * A unique identifier for the component.
1702
- * This UUID is used to register the component within the Components system.
1703
- */
1704
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1705
- /** {@link Disposable.onDisposed} */
1706
- readonly onDisposed: Event<string>;
1707
- /**
1708
- * Event triggered when relations for a model have been indexed.
1709
- * This event provides the model's UUID and the relations map generated for that model.
1710
- *
1711
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
1712
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
1713
- * 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.
1714
- */
1715
- readonly onRelationsIndexed: Event<{
1716
- modelID: string;
1717
- relationsMap: RelationsMap;
1718
- }>;
1719
- /**
1720
- * Holds the relationship mappings for each model processed by the indexer.
1721
- * The structure is a map where each key is a model's UUID, and the value is another map.
1722
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
1723
- * representing a specific relation type, and the value is an array of expressIDs of entities
1724
- * that are related through that relation type. This structure allows for efficient querying
1725
- * of entity relationships within a model.
1726
- */
1727
- readonly relationMaps: ModelsRelationMap;
1728
- /** {@link Component.enabled} */
1729
- enabled: boolean;
1730
- private _relToAttributesMap;
1731
- private _inverseAttributes;
1732
- private _ifcRels;
1733
- constructor(components: Components);
1734
- private onFragmentsDisposed;
1735
- private indexRelations;
1736
- /**
1737
- * Adds a relation map to the model's relations map.
1738
- *
1739
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
1740
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
1741
- *
1742
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
1743
- */
1744
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
1745
- /**
1746
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
1747
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
1748
- * and maps them in a structured way to facilitate quick access to related entities.
1749
- *
1750
- * The process involves querying the model for each relation type associated with the inverse attributes
1751
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
1752
- * and contains a nested map where each key is an entity's expressID and its value is another map.
1753
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
1754
- * of entities that are related through that attribute.
1755
- *
1756
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
1757
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
1758
- * representation of the relations indexed by entity expressIDs and relation types.
1759
- * @throws An error if the model does not have properties loaded.
1760
- */
1761
- process(model: FragmentsGroup): Promise<RelationsMap>;
1762
- /**
1763
- * Processes a given model from a WebIfc API to index its IFC entities relations.
1764
- *
1765
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
1766
- * @param modelID - The unique identifier of the model within the WebIfc API.
1767
- * @returns A promise that resolves to the relations map for the processed model.
1768
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
1769
- */
1770
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
1771
- /**
1772
- * Retrieves the relations of a specific entity within a model based on the given relation name.
1773
- * This method searches the indexed relation maps for the specified model and entity,
1774
- * returning the IDs of related entities if a match is found.
1775
- *
1776
- * @param model The 'FragmentsGroup' model containing the entity.
1777
- * @param expressID The unique identifier of the entity within the model.
1778
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
1779
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
1780
- * or the specified relation name is not indexed.
1781
- */
1782
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
1783
- /**
1784
- * Serializes the relations of a given relation map into a JSON string.
1785
- * 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,
1786
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1787
- * The resulting object is then serialized into a JSON string.
1788
- *
1789
- * @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.
1790
- * @returns A JSON string representing the serialized relations of the given relation map.
1791
- */
1792
- serializeRelations(relationMap: RelationsMap): string;
1793
- /**
1794
- * Serializes the relations of a specific model into a JSON string.
1795
- * This method iterates through the relations indexed for the given model,
1796
- * organizing them into a structured object where each key is an expressID of an entity,
1797
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
1798
- * The resulting object is then serialized into a JSON string.
1799
- *
1800
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
1801
- * @returns A JSON string representing the serialized relations of the specified model.
1802
- * If the model has no indexed relations, 'null' is returned.
1803
- */
1804
- serializeModelRelations(model: FragmentsGroup): string | null;
1805
- /**
1806
- * Serializes all relations of every model processed by the indexer into a JSON string.
1807
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
1808
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
1809
- * and its value is another object mapping entity expressIDs to their related entities, categorized
1810
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
1811
- *
1812
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
1813
- * If no relations have been indexed, an empty object is returned as a JSON string.
1814
- */
1815
- serializeAllRelations(): string;
1816
- /**
1817
- * Converts a JSON string representing relations between entities into a structured map.
1818
- * This method parses the JSON string to reconstruct the relations map that indexes
1819
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
1820
- * and the values are maps where each key is a relation type ID and its value is an array
1821
- * of express IDs of entities related through that relation type.
1822
- *
1823
- * @param json The JSON string to be parsed into the relations map.
1824
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
1825
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
1826
- * is an array of express IDs (as numbers) of entities related through that relation type.
1827
- */
1828
- getRelationsMapFromJSON(json: string): RelationsMap;
1829
- /** {@link Disposable.dispose} */
1830
- dispose(): void;
1831
- /**
1832
- * 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.
1833
- *
1834
- * @param model The BIM model whose children to get.
1835
- * @param id The expressID of the item whose children to get.
1836
- * @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
1837
- *
1838
- * @returns A 'Set' with the expressIDs of the found items.
1839
- */
1840
- getElementsChildren(model: FragmentsGroup, id: number, found?: Set<number>): Set<number>;
1841
- }
1842
- import * as WEBIFC from "web-ifc";
1843
- import { FragmentsGroup } from "@thatopen/fragments";
1844
- import { Component, Disposable, Event, Components } from "../../core";
1845
- /**
1846
- * Types for boolean properties in IFC schema.
1847
- */
1848
- export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
1849
- /**
1850
- * Types for string properties in IFC schema.
1851
- */
1852
- export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
1853
- /**
1854
- * Types for numeric properties in IFC schema.
1855
- */
1856
- export type NumericPropTypes = "IfcInteger" | "IfcReal";
1857
- /**
1858
- * 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.
1859
- */
1860
- export interface ChangeMap {
1861
- [modelID: string]: Set<number>;
1862
- }
1863
- /**
1864
- * 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.
1865
- */
1866
- export interface AttributeListener {
1867
- [modelID: string]: {
1868
- [expressID: number]: {
1869
- [attributeName: string]: Event<String | Boolean | Number>;
1870
- };
1871
- };
1872
- }
1873
- /**
1874
- * Component to manage and edit properties and Psets in IFC files.
1875
- */
1876
- export declare class IfcPropertiesManager extends Component implements Disposable {
1877
- /**
1878
- * A unique identifier for the component.
1879
- * This UUID is used to register the component within the Components system.
1880
- */
1881
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
1882
- /** {@link Disposable.onDisposed} */
1883
- readonly onDisposed: Event<string>;
1884
- /**
1885
- * Event triggered when a file is requested for export.
1886
- */
1887
- readonly onRequestFile: Event<unknown>;
1888
- /**
1889
- * ArrayBuffer containing the IFC data to be exported.
1890
- */
1891
- ifcToExport: ArrayBuffer | null;
1892
- /**
1893
- * Event triggered when an element is added to a Pset.
1894
- */
1895
- readonly onElementToPset: Event<{
1896
- model: FragmentsGroup;
1897
- psetID: number;
1898
- elementID: number;
1899
- }>;
1900
- /**
1901
- * Event triggered when a property is added to a Pset.
1902
- */
1903
- readonly onPropToPset: Event<{
1904
- model: FragmentsGroup;
1905
- psetID: number;
1906
- propID: number;
1907
- }>;
1908
- /**
1909
- * Event triggered when a Pset is removed.
1910
- */
1911
- readonly onPsetRemoved: Event<{
1912
- model: FragmentsGroup;
1913
- psetID: number;
1914
- }>;
1915
- /**
1916
- * Event triggered when data in the model changes.
1917
- */
1918
- readonly onDataChanged: Event<{
1919
- model: FragmentsGroup;
1920
- expressID: number;
1921
- }>;
1922
- /**
1923
- * Configuration for the WebAssembly module.
1924
- */
1925
- wasm: {
1926
- path: string;
1927
- absolute: boolean;
1928
- };
1929
- /** {@link Component.enabled} */
1930
- enabled: boolean;
1931
- /**
1932
- * Map of attribute listeners.
1933
- */
1934
- attributeListeners: AttributeListener;
1935
- /**
1936
- * The currently selected model.
1937
- */
1938
- selectedModel?: FragmentsGroup;
1939
- /**
1940
- * Map of changed entities in the model.
1941
- */
1942
- changeMap: ChangeMap;
1943
- constructor(components: Components);
1944
- /** {@link Disposable.dispose} */
1945
- dispose(): void;
1946
- /**
1947
- * Static method to retrieve the IFC schema from a given model.
1948
- *
1949
- * @param model - The FragmentsGroup model from which to retrieve the IFC schema.
1950
- * @throws Will throw an error if the IFC schema is not found in the model.
1951
- * @returns The IFC schema associated with the given model.
1952
- */
1953
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
1954
- /**
1955
- * Method to set properties data in the model.
1956
- *
1957
- * @param model - The FragmentsGroup model in which to set the properties.
1958
- * @param dataToSave - An array of objects representing the properties to be saved.
1959
- * Each object must have an 'expressID' property, which is the express ID of the entity in the model.
1960
- * The rest of the properties will be set as the properties of the entity.
1961
- *
1962
- * @returns {Promise<void>} A promise that resolves when all the properties have been set.
1963
- *
1964
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
1965
- */
1966
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
1967
- /**
1968
- * Creates a new Property Set (Pset) in the given model.
1969
- *
1970
- * @param model - The FragmentsGroup model in which to create the Pset.
1971
- * @param name - The name of the Pset.
1972
- * @param description - (Optional) The description of the Pset.
1973
- *
1974
- * @returns A promise that resolves with an object containing the newly created Pset and its relation.
1975
- *
1976
- * @throws Will throw an error if the IFC schema is not found in the model.
1977
- * @throws Will throw an error if no OwnerHistory is found in the model.
1978
- */
1979
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
1980
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
1981
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
1982
- }>;
1983
- /**
1984
- * Removes a Property Set (Pset) from the given model.
1985
- *
1986
- * @param model - The FragmentsGroup model from which to remove the Pset.
1987
- * @param psetID - The express IDs of the Psets to be removed.
1988
- *
1989
- * @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
1990
- *
1991
- * @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
1992
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
1993
- * @throws Will throw an error if no relation is found between the Pset and the model.
1994
- */
1995
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
1996
- /**
1997
- * Creates a new single-value property of type string in the given model.
1998
- *
1999
- * @param model - The FragmentsGroup model in which to create the property.
2000
- * @param type - The type of the property value. Must be a string property type.
2001
- * @param name - The name of the property.
2002
- * @param value - The value of the property. Must be a string.
2003
- *
2004
- * @returns The newly created single-value property.
2005
- *
2006
- * @throws Will throw an error if the IFC schema is not found in the model.
2007
- * @throws Will throw an error if no OwnerHistory is found in the model.
2008
- */
2009
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
2010
- /**
2011
- * Creates a new single-value property of type numeric in the given model.
2012
- *
2013
- * @param model - The FragmentsGroup model in which to create the property.
2014
- * @param type - The type of the property value. Must be a numeric property type.
2015
- * @param name - The name of the property.
2016
- * @param value - The value of the property. Must be a number.
2017
- *
2018
- * @returns The newly created single-value property.
2019
- *
2020
- * @throws Will throw an error if the IFC schema is not found in the model.
2021
- * @throws Will throw an error if no OwnerHistory is found in the model.
2022
- */
2023
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
2024
- /**
2025
- * Creates a new single-value property of type boolean in the given model.
2026
- *
2027
- * @param model - The FragmentsGroup model in which to create the property.
2028
- * @param type - The type of the property value. Must be a boolean property type.
2029
- * @param name - The name of the property.
2030
- * @param value - The value of the property. Must be a boolean.
2031
- *
2032
- * @returns The newly created single-value property.
2033
- *
2034
- * @throws Will throw an error if the IFC schema is not found in the model.
2035
- * @throws Will throw an error if no OwnerHistory is found in the model.
2036
- */
2037
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
2038
- /**
2039
- * Removes a property from a Property Set (Pset) in the given model.
2040
- *
2041
- * @param model - The FragmentsGroup model from which to remove the property.
2042
- * @param psetID - The express ID of the Pset from which to remove the property.
2043
- * @param propID - The express ID of the property to be removed.
2044
- *
2045
- * @returns {Promise<void>} A promise that resolves when the property has been removed.
2046
- *
2047
- * @throws Will throw an error if the Pset or the property to be removed are not found in the model.
2048
- * @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
2049
- */
2050
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
2051
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
2052
- /**
2053
- * Adds elements to a Property Set (Pset) in the given model.
2054
- *
2055
- * @param model - The FragmentsGroup model in which to add the elements.
2056
- * @param psetID - The express ID of the Pset to which to add the elements.
2057
- * @param elementID - The express IDs of the elements to be added.
2058
- *
2059
- * @returns {Promise<void>} A promise that resolves when all the elements have been added.
2060
- *
2061
- * @throws Will throw an error if the Pset or the elements to be added are not found in the model.
2062
- * @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
2063
- * @throws Will throw an error if no relation is found between the Pset and the model.
2064
- */
2065
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
2066
- /**
2067
- * Saves the changes made to the model to a new IFC file.
2068
- *
2069
- * @param model - The FragmentsGroup model from which to save the changes.
2070
- * @param ifcToSaveOn - The Uint8Array representing the original IFC file.
2071
- *
2072
- * @returns A promise that resolves with the modified IFC data as a Uint8Array.
2073
- *
2074
- * @throws Will throw an error if any issues occur during the saving process.
2075
- */
2076
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
2077
- /**
2078
- * Sets an attribute listener for a specific attribute of an entity in the model.
2079
- * The listener will trigger an event whenever the attribute's value changes.
2080
- *
2081
- * @param model - The FragmentsGroup model in which to set the attribute listener.
2082
- * @param expressID - The express ID of the entity for which to set the listener.
2083
- * @param attributeName - The name of the attribute for which to set the listener.
2084
- *
2085
- * @returns The event that will be triggered when the attribute's value changes.
2086
- *
2087
- * @throws Will throw an error if the entity with the given expressID doesn't exist.
2088
- * @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
2089
- * @throws Will throw an error if the attribute has a badly defined handle.
2090
- */
2091
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
2092
- private increaseMaxID;
2093
- private newGUID;
2094
- private getOwnerHistory;
2095
- private registerChange;
2096
- private newSingleProperty;
2097
- }
2098
- /**
2099
- * A Set of unique numbers representing different types of IFC geometries.
2100
- */
2101
- export declare const GeometryTypes: Set<number>;
2102
- import * as THREE from "three";
2103
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2104
- /**
2105
- * A class representing a 2D minimap of a 3D world.
2106
- */
2107
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2108
- /** {@link Disposable.onDisposed} */
2109
- readonly onDisposed: Event<unknown>;
2110
- /** {@link Updateable.onAfterUpdate} */
2111
- readonly onAfterUpdate: Event<unknown>;
2112
- /** {@link Updateable.onBeforeUpdate} */
2113
- readonly onBeforeUpdate: Event<unknown>;
2114
- /** {@link Resizeable.onResize} */
2115
- readonly onResize: Event<THREE.Vector2>;
2116
- /**
2117
- * The front offset of the minimap.
2118
- * It determines how much the minimap's view is offset from the camera's view.
2119
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2120
- */
2121
- frontOffset: number;
2122
- /**
2123
- * The override material for the minimap.
2124
- * It is used to render the depth information of the world onto the minimap.
2125
- */
2126
- overrideMaterial: THREE.MeshDepthMaterial;
2127
- /**
2128
- * The background color of the minimap.
2129
- * It is used to set the background color of the minimap's renderer.
2130
- */
2131
- backgroundColor: THREE.Color;
2132
- /**
2133
- * The WebGL renderer for the minimap.
2134
- * It is used to render the minimap onto the screen.
2135
- */
2136
- renderer: THREE.WebGLRenderer;
2137
- /**
2138
- * A flag indicating whether the minimap is enabled.
2139
- * If disabled, the minimap will not update or render.
2140
- */
2141
- enabled: boolean;
2202
+ enabled: boolean;
2142
2203
  /**
2143
2204
  * The world in which the minimap is displayed.
2144
2205
  * It provides access to the 3D scene, camera, and other relevant world elements.
@@ -2188,6 +2249,11 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2188
2249
  resize(size?: THREE.Vector2): void;
2189
2250
  private updatePlanes;
2190
2251
  }
2252
+ import { InverseAttribute } from "./types";
2253
+ export declare const relToAttributesMap: Map<number, {
2254
+ forRelating: InverseAttribute;
2255
+ forRelated: InverseAttribute;
2256
+ }>;
2191
2257
  import * as WEBIFC from "web-ifc";
2192
2258
  /** Configuration of the IFC-fragment conversion. */
2193
2259
  export declare class IfcFragmentSettings {
@@ -2200,119 +2266,42 @@ export declare class IfcFragmentSettings {
2200
2266
  optionalCategories: number[];
2201
2267
  /** Whether to use the coordination data coming from the IFC files. */
2202
2268
  coordinate: boolean;
2203
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2204
- wasm: {
2205
- path: string;
2206
- absolute: boolean;
2207
- logLevel?: WEBIFC.LogLevel;
2208
- };
2209
- /** List of categories that won't be converted to fragments. */
2210
- excludedCategories: Set<number>;
2211
- /** Whether to save the absolute location of all IFC items. */
2212
- saveLocations: boolean;
2213
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2214
- webIfc: WEBIFC.LoaderSettings;
2215
- /**
2216
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2217
- * If set to true, the path will be set to the default path of the WASM file.
2218
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2219
- * Default value is true.
2220
- */
2221
- autoSetWasm: boolean;
2222
- /**
2223
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2224
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2225
- * If set to null, the default file location handler will be used.
2226
- *
2227
- * @param url - The URL of the file to locate.
2228
- * @returns The absolute path of the file.
2229
- */
2230
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2231
- }
2232
- import * as WEBIFC from "web-ifc";
2233
- import { IfcItemsCategories } from "../../../ifc";
2234
- export declare class SpatialStructure {
2235
- itemsByFloor: IfcItemsCategories;
2236
- private _units;
2237
- setUp(webIfc: WEBIFC.IfcAPI): void;
2238
- cleanUp(): void;
2239
- }
2240
- import * as WEBIFC from "web-ifc";
2241
- export interface IfcItemsCategories {
2242
- [itemID: number]: number;
2243
- }
2244
- export declare class IfcCategories {
2245
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2246
- }
2247
- /**
2248
- * 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.
2249
- *
2250
- * @remarks
2251
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2252
- * It is useful for identifying and processing different types of IFC elements in a project.
2253
- *
2254
- */
2255
- export declare const IfcElements: {
2256
- [key: number]: string;
2257
- };
2258
- /**
2259
- * 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.
2260
- */
2261
- export declare const IfcCategoryMap: {
2262
- [key: number]: string;
2263
- };
2264
- import * as FRAGS from "@thatopen/fragments";
2265
- export declare class IfcPropertiesUtils {
2266
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2267
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2268
- [attribute: string]: any;
2269
- } | null>;
2270
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2271
- [relatingID: number]: number[];
2272
- }>;
2273
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2274
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2275
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2276
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2277
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2278
- key: string | null;
2279
- name: string | null;
2280
- }>;
2281
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2282
- key: string | null;
2283
- value: number | null;
2284
- }>;
2285
- static isRel(expressID: number): boolean;
2286
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2287
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2288
- }
2289
- /**
2290
- * 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.
2291
- */
2292
- export declare class Event<T> {
2269
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2270
+ wasm: {
2271
+ path: string;
2272
+ absolute: boolean;
2273
+ logLevel?: WEBIFC.LogLevel;
2274
+ };
2275
+ /** List of categories that won't be converted to fragments. */
2276
+ excludedCategories: Set<number>;
2277
+ /** Whether to save the absolute location of all IFC items. */
2278
+ saveLocations: boolean;
2279
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2280
+ webIfc: WEBIFC.LoaderSettings;
2293
2281
  /**
2294
- * Add a callback to this event instance.
2295
- * @param handler - the callback to be added to this event.
2282
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2283
+ * If set to true, the path will be set to the default path of the WASM file.
2284
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2285
+ * Default value is true.
2296
2286
  */
2297
- add(handler: T extends void ? {
2298
- (): void;
2299
- } : {
2300
- (data: T): void;
2301
- }): void;
2287
+ autoSetWasm: boolean;
2302
2288
  /**
2303
- * Removes a callback from this event instance.
2304
- * @param handler - the callback to be removed from this event.
2289
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2290
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2291
+ * If set to null, the default file location handler will be used.
2292
+ *
2293
+ * @param url - The URL of the file to locate.
2294
+ * @returns The absolute path of the file.
2305
2295
  */
2306
- remove(handler: T extends void ? {
2307
- (): void;
2308
- } : {
2309
- (data: T): void;
2310
- }): void;
2311
- /** Triggers all the callbacks assigned to this event. */
2312
- trigger: (data?: T) => void;
2313
- /** Gets rid of all the suscribed events. */
2314
- reset(): void;
2315
- private handlers;
2296
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2297
+ }
2298
+ import * as WEBIFC from "web-ifc";
2299
+ import { IfcItemsCategories } from "../../../ifc";
2300
+ export declare class SpatialStructure {
2301
+ itemsByFloor: IfcItemsCategories;
2302
+ private _units;
2303
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2304
+ cleanUp(): void;
2316
2305
  }
2317
2306
  /**
2318
2307
  * 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.
@@ -2450,6 +2439,19 @@ export interface CameraControllable {
2450
2439
  */
2451
2440
  controls: CameraControls;
2452
2441
  }
2442
+ import { Base } from "./base";
2443
+ /**
2444
+ * 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.
2445
+ */
2446
+ export declare abstract class Component extends Base {
2447
+ /**
2448
+ * Whether this component is active or not. The behaviour can vary depending
2449
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2450
+ * dimensions, while a disabled camera will stop moving. A disabled component
2451
+ * will not be updated automatically each frame.
2452
+ */
2453
+ abstract enabled: boolean;
2454
+ }
2453
2455
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2454
2456
  import { Components } from "../../Components";
2455
2457
  /**
@@ -2470,24 +2472,6 @@ export declare abstract class Base {
2470
2472
  isConfigurable: () => this is Configurable<any>;
2471
2473
  }
2472
2474
  import { Base } from "./base";
2473
- /**
2474
- * 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.
2475
- */
2476
- export declare abstract class Component extends Base {
2477
- /**
2478
- * Whether this component is active or not. The behaviour can vary depending
2479
- * on the type of component. E.g. a disabled dimension tool will stop creating
2480
- * dimensions, while a disabled camera will stop moving. A disabled component
2481
- * will not be updated automatically each frame.
2482
- */
2483
- abstract enabled: boolean;
2484
- }
2485
- import { InverseAttribute } from "./types";
2486
- export declare const relToAttributesMap: Map<number, {
2487
- forRelating: InverseAttribute;
2488
- forRelated: InverseAttribute;
2489
- }>;
2490
- import { Base } from "./base";
2491
2475
  import { World } from "./world";
2492
2476
  import { Event } from "./event";
2493
2477
  import { Components } from "../../Components";
@@ -2511,6 +2495,34 @@ export declare abstract class BaseWorldItem extends Base {
2511
2495
  protected constructor(components: Components);
2512
2496
  }
2513
2497
  import * as THREE from "three";
2498
+ import CameraControls from "camera-controls";
2499
+ import { BaseWorldItem } from "./base-world-item";
2500
+ import { CameraControllable } from "./interfaces";
2501
+ /**
2502
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2503
+ */
2504
+ export declare abstract class BaseCamera extends BaseWorldItem {
2505
+ /**
2506
+ * Whether the camera is enabled or not.
2507
+ */
2508
+ abstract enabled: boolean;
2509
+ /**
2510
+ * The Three.js camera instance.
2511
+ */
2512
+ abstract three: THREE.Camera;
2513
+ /**
2514
+ * Optional CameraControls instance for controlling the camera.
2515
+ * This property is only available if the camera is controllable.
2516
+ */
2517
+ abstract controls?: CameraControls;
2518
+ /**
2519
+ * Checks whether the instance is {@link CameraControllable}.
2520
+ *
2521
+ * @returns True if the instance is controllable, false otherwise.
2522
+ */
2523
+ hasCameraControls: () => this is CameraControllable;
2524
+ }
2525
+ import * as THREE from "three";
2514
2526
  import { Vector2 } from "three";
2515
2527
  import { Event } from "./event";
2516
2528
  import { BaseWorldItem } from "./base-world-item";
@@ -2576,34 +2588,6 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2576
2588
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2577
2589
  }
2578
2590
  import * as THREE from "three";
2579
- import CameraControls from "camera-controls";
2580
- import { BaseWorldItem } from "./base-world-item";
2581
- import { CameraControllable } from "./interfaces";
2582
- /**
2583
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2584
- */
2585
- export declare abstract class BaseCamera extends BaseWorldItem {
2586
- /**
2587
- * Whether the camera is enabled or not.
2588
- */
2589
- abstract enabled: boolean;
2590
- /**
2591
- * The Three.js camera instance.
2592
- */
2593
- abstract three: THREE.Camera;
2594
- /**
2595
- * Optional CameraControls instance for controlling the camera.
2596
- * This property is only available if the camera is controllable.
2597
- */
2598
- abstract controls?: CameraControls;
2599
- /**
2600
- * Checks whether the instance is {@link CameraControllable}.
2601
- *
2602
- * @returns True if the instance is controllable, false otherwise.
2603
- */
2604
- hasCameraControls: () => this is CameraControllable;
2605
- }
2606
- import * as THREE from "three";
2607
2591
  import { Disposable } from "./interfaces";
2608
2592
  import { Event } from "./event";
2609
2593
  import { Components } from "../../Components";
@@ -2658,90 +2642,152 @@ export interface World extends Disposable, Updateable {
2658
2642
  isDisposing: boolean;
2659
2643
  }
2660
2644
  import * as THREE from "three";
2661
- import { Disposable, Event } from "../../Types";
2645
+ import { Components } from "../../Components";
2646
+ import { AsyncEvent, Event, World } from "../../Types";
2662
2647
  /**
2663
- * 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.
2648
+ * Settings to configure the CullerRenderer.
2664
2649
  */
2665
- export declare class Mouse implements Disposable {
2666
- dom: HTMLCanvasElement;
2667
- private _event?;
2668
- private _position;
2669
- /** {@link Disposable.onDisposed} */
2670
- readonly onDisposed: Event<unknown>;
2671
- constructor(dom: HTMLCanvasElement);
2650
+ export interface CullerRendererSettings {
2672
2651
  /**
2673
- * The real position of the mouse of the Three.js canvas.
2652
+ * Interval in milliseconds at which the visibility check should be performed.
2653
+ * Default value is 1000.
2674
2654
  */
2675
- get position(): THREE.Vector2;
2676
- /** {@link Disposable.dispose} */
2677
- dispose(): void;
2678
- private getPositionY;
2679
- private getPositionX;
2680
- private updateMouseInfo;
2681
- private setupEvents;
2655
+ updateInterval?: number;
2656
+ /**
2657
+ * Width of the render target used for visibility checks.
2658
+ * Default value is 512.
2659
+ */
2660
+ width?: number;
2661
+ /**
2662
+ * Height of the render target used for visibility checks.
2663
+ * Default value is 512.
2664
+ */
2665
+ height?: number;
2666
+ /**
2667
+ * Whether the visibility check should be performed automatically.
2668
+ * Default value is true.
2669
+ */
2670
+ autoUpdate?: boolean;
2682
2671
  }
2683
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2684
2672
  /**
2685
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2673
+ * A base renderer to determine visibility on screen.
2686
2674
  */
2687
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2675
+ export declare class CullerRenderer {
2676
+ /** {@link Disposable.onDisposed} */
2677
+ readonly onDisposed: Event<string>;
2688
2678
  /**
2689
- * Amount of properties to be streamed.
2690
- * Defaults to 100 properties.
2679
+ * Fires after making the visibility check to the meshes. It lists the
2680
+ * meshes that are currently visible, and the ones that were visible
2681
+ * just before but not anymore.
2691
2682
  */
2692
- propertiesSize: number;
2683
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2684
+ /**
2685
+ * Whether this renderer is active or not. If not, it won't render anything.
2686
+ */
2687
+ enabled: boolean;
2688
+ /**
2689
+ * Needs to check whether there are objects that need to be hidden or shown.
2690
+ * You can bind this to the camera movement, to a certain interval, etc.
2691
+ */
2692
+ needsUpdate: boolean;
2693
+ /**
2694
+ * Render the internal scene used to determine the object visibility. Used
2695
+ * for debugging purposes.
2696
+ */
2697
+ renderDebugFrame: boolean;
2698
+ /** The components instance to which this renderer belongs. */
2699
+ components: Components;
2700
+ /** The world instance to which this renderer belongs. */
2701
+ readonly world: World;
2702
+ /** The THREE.js renderer used to make the visibility test. */
2703
+ readonly renderer: THREE.WebGLRenderer;
2704
+ protected autoUpdate: boolean;
2705
+ protected updateInterval: number;
2706
+ protected readonly worker: Worker;
2707
+ protected readonly scene: THREE.Scene;
2708
+ private _width;
2709
+ private _height;
2710
+ private _availableColor;
2711
+ private readonly renderTarget;
2712
+ private readonly bufferSize;
2713
+ private readonly _buffer;
2714
+ protected _isWorkerBusy: boolean;
2715
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2716
+ /** {@link Disposable.dispose} */
2717
+ dispose(): void;
2718
+ /**
2719
+ * The function that the culler uses to reprocess the scene. Generally it's
2720
+ * better to call needsUpdate, but you can also call this to force it.
2721
+ * @param force if true, it will refresh the scene even if needsUpdate is
2722
+ * not true.
2723
+ */
2724
+ updateVisibility: (force?: boolean) => Promise<void>;
2725
+ protected getAvailableColor(): {
2726
+ r: number;
2727
+ g: number;
2728
+ b: number;
2729
+ code: string;
2730
+ };
2731
+ protected increaseColor(): void;
2732
+ protected decreaseColor(): void;
2733
+ private applySettings;
2693
2734
  }
2735
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2694
2736
  import * as THREE from "three";
2737
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2695
2738
  import { Components } from "../../Components";
2696
2739
  import { Event, World, Disposable } from "../../Types";
2697
- import { Mouse } from "./mouse";
2698
- /**
2699
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2700
- */
2701
- export declare class SimpleRaycaster implements Disposable {
2702
- /** {@link Component.enabled} */
2703
- enabled: boolean;
2704
- /** The components instance to which this Raycaster belongs. */
2705
- components: Components;
2706
- /** {@link Disposable.onDisposed} */
2707
- readonly onDisposed: Event<unknown>;
2708
- /** The position of the mouse in the screen. */
2709
- readonly mouse: Mouse;
2740
+ /**
2741
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2742
+ */
2743
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2710
2744
  /**
2711
- * A reference to the Three.js Raycaster instance.
2712
- * This is used for raycasting operations.
2745
+ * Event triggered when the visibility of meshes is updated.
2746
+ * Contains two sets: seen and unseen.
2713
2747
  */
2714
- readonly three: THREE.Raycaster;
2748
+ readonly onViewUpdated: Event<{
2749
+ seen: Set<THREE.Mesh>;
2750
+ unseen: Set<THREE.Mesh>;
2751
+ }>;
2715
2752
  /**
2716
- * A reference to the world instance to which this Raycaster belongs.
2717
- * This is used to access the camera and meshes.
2753
+ * Pixels in screen a geometry must occupy to be considered "seen".
2754
+ * Default value is 100.
2718
2755
  */
2719
- world: World;
2720
- constructor(components: Components, world: World);
2756
+ threshold: number;
2757
+ /**
2758
+ * Map of color code to THREE.InstancedMesh.
2759
+ * Used to keep track of color-coded meshes.
2760
+ */
2761
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2762
+ /**
2763
+ * Flag to indicate if the renderer is currently processing.
2764
+ * Used to prevent concurrent processing.
2765
+ */
2766
+ isProcessing: boolean;
2767
+ private _colorCodeMeshMap;
2768
+ private _meshIDColorCodeMap;
2769
+ private _currentVisibleMeshes;
2770
+ private _recentlyHiddenMeshes;
2771
+ private _intervalID;
2772
+ private readonly _transparentMat;
2773
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2721
2774
  /** {@link Disposable.dispose} */
2722
2775
  dispose(): void;
2723
2776
  /**
2724
- * Throws a ray from the camera to the mouse or touch event point and returns
2725
- * the first item found. This also takes into account the clipping planes
2726
- * used by the renderer.
2727
- *
2728
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2729
- * to query. If not provided, it will query all the meshes stored in
2730
- * {@link Components.meshes}.
2777
+ * 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.
2778
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2779
+ * @returns {void}
2731
2780
  */
2732
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2781
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2733
2782
  /**
2734
- * Casts a ray from a given origin in a given direction and returns the first item found.
2735
- * This method also takes into account the clipping planes used by the renderer.
2736
- *
2737
- * @param origin - The origin of the ray.
2738
- * @param direction - The direction of the ray.
2739
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2740
- * @returns The first intersection found or 'null' if no intersection was found.
2783
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2784
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2785
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2786
+ * @returns {void}
2741
2787
  */
2742
- 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;
2743
- private intersect;
2744
- private filterClippingPlanes;
2788
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2789
+ private handleWorkerMessage;
2790
+ private getAvailableMaterial;
2745
2791
  }
2746
2792
  import * as THREE from "three";
2747
2793
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
@@ -2915,397 +2961,261 @@ export declare class SimpleRenderer extends BaseRenderer {
2915
2961
  private onContextLost;
2916
2962
  private onContextBack;
2917
2963
  }
2918
- import * as THREE from "three";
2919
- import CameraControls from "camera-controls";
2920
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2921
- import { Components } from "../../Components";
2922
- /**
2923
- * 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.
2924
- */
2925
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2926
- /** {@link Updateable.onBeforeUpdate} */
2927
- readonly onBeforeUpdate: Event<SimpleCamera>;
2928
- /** {@link Updateable.onAfterUpdate} */
2929
- readonly onAfterUpdate: Event<SimpleCamera>;
2930
- /**
2931
- * Event that is triggered when the aspect of the camera has been updated.
2932
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2933
- */
2934
- readonly onAspectUpdated: Event<unknown>;
2935
- /** {@link Disposable.onDisposed} */
2936
- readonly onDisposed: Event<string>;
2937
- /**
2938
- * A three.js PerspectiveCamera or OrthographicCamera instance.
2939
- * This camera is used for rendering the scene.
2940
- */
2941
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2942
- private _allControls;
2943
- /**
2944
- * The object that controls the camera. An instance of
2945
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2946
- * Transforming the camera directly will have no effect: you need to use this
2947
- * object to move, rotate, look at objects, etc.
2948
- */
2949
- get controls(): CameraControls;
2950
- /**
2951
- * Getter for the enabled state of the camera controls.
2952
- * If the current world is null, it returns false.
2953
- * Otherwise, it returns the enabled state of the camera controls.
2954
- *
2955
- * @returns {boolean} The enabled state of the camera controls.
2956
- */
2957
- get enabled(): boolean;
2958
- /**
2959
- * Setter for the enabled state of the camera controls.
2960
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2961
- *
2962
- * @param {boolean} enabled - The new enabled state of the camera controls.
2963
- */
2964
- set enabled(enabled: boolean);
2965
- constructor(components: Components);
2966
- /** {@link Disposable.dispose} */
2967
- dispose(): void;
2968
- /** {@link Updateable.update} */
2969
- update(_delta: number): void;
2970
- /**
2971
- * Updates the aspect of the camera to match the size of the
2972
- * {@link Components.renderer}.
2973
- */
2974
- updateAspect: () => void;
2975
- private setupCamera;
2976
- private newCameraControls;
2977
- private setupEvents;
2978
- private static getSubsetOfThree;
2979
- }
2980
- import * as THREE from "three";
2981
- import { Hideable, Event, World, Disposable } from "../../Types";
2982
- import { Components } from "../../Components";
2983
- /**
2984
- * Configuration interface for the {@link SimpleGrid} class.
2985
- */
2986
- export interface GridConfig {
2987
- /**
2988
- * The color of the grid lines.
2989
- */
2990
- color: THREE.Color;
2991
- /**
2992
- * The size of the primary grid lines.
2993
- */
2994
- size1: number;
2995
- /**
2996
- * The size of the secondary grid lines.
2997
- */
2998
- size2: number;
2999
- /**
3000
- * The distance at which the grid lines start to fade away.
3001
- */
3002
- distance: number;
3003
- }
3004
2964
  /**
3005
- * 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).
2965
+ * 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.
3006
2966
  */
3007
- export declare class SimpleGrid implements Hideable, Disposable {
3008
- /** {@link Disposable.onDisposed} */
3009
- readonly onDisposed: Event<unknown>;
3010
- /** The world instance to which this Raycaster belongs. */
3011
- world: World;
3012
- /** The components instance to which this grid belongs. */
3013
- components: Components;
3014
- /** {@link Hideable.visible} */
3015
- get visible(): boolean;
3016
- /** {@link Hideable.visible} */
3017
- set visible(visible: boolean);
3018
- /** The material of the grid. */
3019
- get material(): THREE.ShaderMaterial;
2967
+ export declare class Event<T> {
3020
2968
  /**
3021
- * Whether the grid should fade away with distance. Recommended to be true for
3022
- * perspective cameras and false for orthographic cameras.
2969
+ * Add a callback to this event instance.
2970
+ * @param handler - the callback to be added to this event.
3023
2971
  */
3024
- get fade(): boolean;
2972
+ add(handler: T extends void ? {
2973
+ (): void;
2974
+ } : {
2975
+ (data: T): void;
2976
+ }): void;
3025
2977
  /**
3026
- * Whether the grid should fade away with distance. Recommended to be true for
3027
- * perspective cameras and false for orthographic cameras.
2978
+ * Removes a callback from this event instance.
2979
+ * @param handler - the callback to be removed from this event.
3028
2980
  */
3029
- set fade(active: boolean);
3030
- /** The Three.js mesh that contains the infinite grid. */
3031
- readonly three: THREE.Mesh;
3032
- private _fade;
3033
- constructor(components: Components, world: World, config: GridConfig);
3034
- /** {@link Disposable.dispose} */
3035
- dispose(): void;
3036
- private setupEvents;
3037
- private updateZoom;
3038
- }
3039
- import { NavigationMode } from "./types";
3040
- import { OrthoPerspectiveCamera } from "../index";
3041
- /**
3042
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3043
- */
3044
- export declare class FirstPersonMode implements NavigationMode {
3045
- private camera;
3046
- /** {@link NavigationMode.enabled} */
3047
- enabled: boolean;
3048
- /** {@link NavigationMode.id} */
3049
- readonly id = "FirstPerson";
3050
- constructor(camera: OrthoPerspectiveCamera);
3051
- /** {@link NavigationMode.set} */
3052
- set(active: boolean): void;
3053
- private setupFirstPersonCamera;
3054
- }
3055
- import { NavigationMode } from "./types";
3056
- import { OrthoPerspectiveCamera } from "../index";
3057
- /**
3058
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3059
- */
3060
- export declare class PlanMode implements NavigationMode {
3061
- private camera;
3062
- /** {@link NavigationMode.enabled} */
3063
- enabled: boolean;
3064
- /** {@link NavigationMode.id} */
3065
- readonly id = "Plan";
3066
- private mouseAction1?;
3067
- private mouseAction2?;
3068
- private mouseInitialized;
3069
- private readonly defaultAzimuthSpeed;
3070
- private readonly defaultPolarSpeed;
3071
- constructor(camera: OrthoPerspectiveCamera);
3072
- /** {@link NavigationMode.set} */
3073
- set(active: boolean): void;
3074
- }
3075
- import { NavigationMode } from "./types";
3076
- import { OrthoPerspectiveCamera } from "../index";
3077
- /**
3078
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3079
- */
3080
- export declare class OrbitMode implements NavigationMode {
3081
- camera: OrthoPerspectiveCamera;
3082
- /** {@link NavigationMode.enabled} */
3083
- enabled: boolean;
3084
- /** {@link NavigationMode.id} */
3085
- readonly id = "Orbit";
3086
- constructor(camera: OrthoPerspectiveCamera);
3087
- /** {@link NavigationMode.set} */
3088
- set(active: boolean): void;
3089
- private activateOrbitControls;
2981
+ remove(handler: T extends void ? {
2982
+ (): void;
2983
+ } : {
2984
+ (data: T): void;
2985
+ }): void;
2986
+ /** Triggers all the callbacks assigned to this event. */
2987
+ trigger: (data?: T) => void;
2988
+ /** Gets rid of all the suscribed events. */
2989
+ reset(): void;
2990
+ private handlers;
3090
2991
  }
3091
2992
  import * as THREE from "three";
3092
- import { CameraProjection } from "./types";
3093
- import { Event } from "../../Types";
3094
- import { OrthoPerspectiveCamera } from "../index";
2993
+ import CameraControls from "camera-controls";
2994
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2995
+ import { Components } from "../../Components";
3095
2996
  /**
3096
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2997
+ * 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.
3097
2998
  */
3098
- export declare class ProjectionManager {
2999
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3000
+ /** {@link Updateable.onBeforeUpdate} */
3001
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3002
+ /** {@link Updateable.onAfterUpdate} */
3003
+ readonly onAfterUpdate: Event<SimpleCamera>;
3099
3004
  /**
3100
- * Event that fires when the {@link CameraProjection} changes.
3005
+ * Event that is triggered when the aspect of the camera has been updated.
3006
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3101
3007
  */
3102
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3008
+ readonly onAspectUpdated: Event<unknown>;
3009
+ /** {@link Disposable.onDisposed} */
3010
+ readonly onDisposed: Event<string>;
3103
3011
  /**
3104
- * Current projection mode of the camera.
3105
- * Default is "Perspective".
3012
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3013
+ * This camera is used for rendering the scene.
3106
3014
  */
3107
- current: CameraProjection;
3015
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3016
+ private _allControls;
3108
3017
  /**
3109
- * The camera controlled by this ProjectionManager.
3110
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3018
+ * The object that controls the camera. An instance of
3019
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3020
+ * Transforming the camera directly will have no effect: you need to use this
3021
+ * object to move, rotate, look at objects, etc.
3111
3022
  */
3112
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3113
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3114
- matchOrthoDistanceEnabled: boolean;
3115
- private _component;
3116
- private _previousDistance;
3117
- constructor(camera: OrthoPerspectiveCamera);
3023
+ get controls(): CameraControls;
3118
3024
  /**
3119
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3025
+ * Getter for the enabled state of the camera controls.
3026
+ * If the current world is null, it returns false.
3027
+ * Otherwise, it returns the enabled state of the camera controls.
3120
3028
  *
3121
- * @param projection - the new projection to set. If it is the current projection,
3122
- * it will have no effect.
3029
+ * @returns {boolean} The enabled state of the camera controls.
3123
3030
  */
3124
- set(projection: CameraProjection): Promise<void>;
3031
+ get enabled(): boolean;
3125
3032
  /**
3126
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3127
- * and vice versa.
3033
+ * Setter for the enabled state of the camera controls.
3034
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3035
+ *
3036
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3128
3037
  */
3129
- toggle(): Promise<void>;
3130
- private setOrthoCamera;
3131
- private getPerspectiveDims;
3132
- private setupOrthoCamera;
3133
- private getDistance;
3134
- private setPerspectiveCamera;
3038
+ set enabled(enabled: boolean);
3039
+ constructor(components: Components);
3040
+ /** {@link Disposable.dispose} */
3041
+ dispose(): void;
3042
+ /** {@link Updateable.update} */
3043
+ update(_delta: number): void;
3044
+ /**
3045
+ * Updates the aspect of the camera to match the size of the
3046
+ * {@link Components.renderer}.
3047
+ */
3048
+ updateAspect: () => void;
3049
+ private setupCamera;
3050
+ private newCameraControls;
3051
+ private setupEvents;
3052
+ private static getSubsetOfThree;
3135
3053
  }
3054
+ import * as THREE from "three";
3055
+ import { Disposable, Event } from "../../Types";
3136
3056
  /**
3137
- * The projection system of the camera.
3138
- */
3139
- export type CameraProjection = "Perspective" | "Orthographic";
3140
- /**
3141
- * The extensible list of supported navigation modes.
3142
- */
3143
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3144
- /**
3145
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3057
+ * 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.
3146
3058
  */
3147
- export interface NavigationMode {
3148
- /** The unique ID of this navigation mode. */
3149
- id: NavModeID;
3059
+ export declare class Mouse implements Disposable {
3060
+ dom: HTMLCanvasElement;
3061
+ private _event?;
3062
+ private _position;
3063
+ /** {@link Disposable.onDisposed} */
3064
+ readonly onDisposed: Event<unknown>;
3065
+ constructor(dom: HTMLCanvasElement);
3150
3066
  /**
3151
- * Enable or disable this navigation mode.
3152
- * When a new navigation mode is enabled, the previous navigation mode
3153
- * must be disabled.
3154
- *
3155
- * @param active - whether to enable or disable this mode.
3156
- * @param options - any additional data required to enable or disable it.
3157
- * */
3158
- set: (active: boolean, options?: any) => void;
3159
- /** Whether this navigation mode is active or not. */
3160
- enabled: boolean;
3067
+ * The real position of the mouse of the Three.js canvas.
3068
+ */
3069
+ get position(): THREE.Vector2;
3070
+ /** {@link Disposable.dispose} */
3071
+ dispose(): void;
3072
+ private getPositionY;
3073
+ private getPositionX;
3074
+ private updateMouseInfo;
3075
+ private setupEvents;
3161
3076
  }
3162
3077
  import * as THREE from "three";
3163
3078
  import { Components } from "../../Components";
3164
- import { AsyncEvent, Event, World } from "../../Types";
3079
+ import { Event, World, Disposable } from "../../Types";
3080
+ import { Mouse } from "./mouse";
3165
3081
  /**
3166
- * Settings to configure the CullerRenderer.
3082
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
3167
3083
  */
3168
- export interface CullerRendererSettings {
3084
+ export declare class SimpleRaycaster implements Disposable {
3085
+ /** {@link Component.enabled} */
3086
+ enabled: boolean;
3087
+ /** The components instance to which this Raycaster belongs. */
3088
+ components: Components;
3089
+ /** {@link Disposable.onDisposed} */
3090
+ readonly onDisposed: Event<unknown>;
3091
+ /** The position of the mouse in the screen. */
3092
+ readonly mouse: Mouse;
3169
3093
  /**
3170
- * Interval in milliseconds at which the visibility check should be performed.
3171
- * Default value is 1000.
3094
+ * A reference to the Three.js Raycaster instance.
3095
+ * This is used for raycasting operations.
3172
3096
  */
3173
- updateInterval?: number;
3097
+ readonly three: THREE.Raycaster;
3174
3098
  /**
3175
- * Width of the render target used for visibility checks.
3176
- * Default value is 512.
3099
+ * A reference to the world instance to which this Raycaster belongs.
3100
+ * This is used to access the camera and meshes.
3177
3101
  */
3178
- width?: number;
3102
+ world: World;
3103
+ constructor(components: Components, world: World);
3104
+ /** {@link Disposable.dispose} */
3105
+ dispose(): void;
3179
3106
  /**
3180
- * Height of the render target used for visibility checks.
3181
- * Default value is 512.
3107
+ * Throws a ray from the camera to the mouse or touch event point and returns
3108
+ * the first item found. This also takes into account the clipping planes
3109
+ * used by the renderer.
3110
+ *
3111
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3112
+ * to query. If not provided, it will query all the meshes stored in
3113
+ * {@link Components.meshes}.
3182
3114
  */
3183
- height?: number;
3115
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3184
3116
  /**
3185
- * Whether the visibility check should be performed automatically.
3186
- * Default value is true.
3117
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3118
+ * This method also takes into account the clipping planes used by the renderer.
3119
+ *
3120
+ * @param origin - The origin of the ray.
3121
+ * @param direction - The direction of the ray.
3122
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3123
+ * @returns The first intersection found or 'null' if no intersection was found.
3187
3124
  */
3188
- autoUpdate?: boolean;
3125
+ 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;
3126
+ private intersect;
3127
+ private filterClippingPlanes;
3189
3128
  }
3129
+ import * as THREE from "three";
3130
+ import { Hideable, Event, World, Disposable } from "../../Types";
3131
+ import { Components } from "../../Components";
3190
3132
  /**
3191
- * A base renderer to determine visibility on screen.
3133
+ * Configuration interface for the {@link SimpleGrid} class.
3192
3134
  */
3193
- export declare class CullerRenderer {
3194
- /** {@link Disposable.onDisposed} */
3195
- readonly onDisposed: Event<string>;
3196
- /**
3197
- * Fires after making the visibility check to the meshes. It lists the
3198
- * meshes that are currently visible, and the ones that were visible
3199
- * just before but not anymore.
3200
- */
3201
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3135
+ export interface GridConfig {
3202
3136
  /**
3203
- * Whether this renderer is active or not. If not, it won't render anything.
3137
+ * The color of the grid lines.
3204
3138
  */
3205
- enabled: boolean;
3139
+ color: THREE.Color;
3206
3140
  /**
3207
- * Needs to check whether there are objects that need to be hidden or shown.
3208
- * You can bind this to the camera movement, to a certain interval, etc.
3141
+ * The size of the primary grid lines.
3209
3142
  */
3210
- needsUpdate: boolean;
3143
+ size1: number;
3211
3144
  /**
3212
- * Render the internal scene used to determine the object visibility. Used
3213
- * for debugging purposes.
3145
+ * The size of the secondary grid lines.
3214
3146
  */
3215
- renderDebugFrame: boolean;
3216
- /** The components instance to which this renderer belongs. */
3217
- components: Components;
3218
- /** The world instance to which this renderer belongs. */
3219
- readonly world: World;
3220
- /** The THREE.js renderer used to make the visibility test. */
3221
- readonly renderer: THREE.WebGLRenderer;
3222
- protected autoUpdate: boolean;
3223
- protected updateInterval: number;
3224
- protected readonly worker: Worker;
3225
- protected readonly scene: THREE.Scene;
3226
- private _width;
3227
- private _height;
3228
- private _availableColor;
3229
- private readonly renderTarget;
3230
- private readonly bufferSize;
3231
- private readonly _buffer;
3232
- protected _isWorkerBusy: boolean;
3233
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3234
- /** {@link Disposable.dispose} */
3235
- dispose(): void;
3147
+ size2: number;
3236
3148
  /**
3237
- * The function that the culler uses to reprocess the scene. Generally it's
3238
- * better to call needsUpdate, but you can also call this to force it.
3239
- * @param force if true, it will refresh the scene even if needsUpdate is
3240
- * not true.
3149
+ * The distance at which the grid lines start to fade away.
3241
3150
  */
3242
- updateVisibility: (force?: boolean) => Promise<void>;
3243
- protected getAvailableColor(): {
3244
- r: number;
3245
- g: number;
3246
- b: number;
3247
- code: string;
3248
- };
3249
- protected increaseColor(): void;
3250
- protected decreaseColor(): void;
3251
- private applySettings;
3151
+ distance: number;
3252
3152
  }
3253
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3254
- import * as THREE from "three";
3255
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3256
- import { Components } from "../../Components";
3257
- import { Event, World, Disposable } from "../../Types";
3258
3153
  /**
3259
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3260
- */
3261
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3262
- /**
3263
- * Event triggered when the visibility of meshes is updated.
3264
- * Contains two sets: seen and unseen.
3265
- */
3266
- readonly onViewUpdated: Event<{
3267
- seen: Set<THREE.Mesh>;
3268
- unseen: Set<THREE.Mesh>;
3269
- }>;
3270
- /**
3271
- * Pixels in screen a geometry must occupy to be considered "seen".
3272
- * Default value is 100.
3273
- */
3274
- threshold: number;
3154
+ * 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).
3155
+ */
3156
+ export declare class SimpleGrid implements Hideable, Disposable {
3157
+ /** {@link Disposable.onDisposed} */
3158
+ readonly onDisposed: Event<unknown>;
3159
+ /** The world instance to which this Raycaster belongs. */
3160
+ world: World;
3161
+ /** The components instance to which this grid belongs. */
3162
+ components: Components;
3163
+ /** {@link Hideable.visible} */
3164
+ get visible(): boolean;
3165
+ /** {@link Hideable.visible} */
3166
+ set visible(visible: boolean);
3167
+ /** The material of the grid. */
3168
+ get material(): THREE.ShaderMaterial;
3275
3169
  /**
3276
- * Map of color code to THREE.InstancedMesh.
3277
- * Used to keep track of color-coded meshes.
3170
+ * Whether the grid should fade away with distance. Recommended to be true for
3171
+ * perspective cameras and false for orthographic cameras.
3278
3172
  */
3279
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3173
+ get fade(): boolean;
3280
3174
  /**
3281
- * Flag to indicate if the renderer is currently processing.
3282
- * Used to prevent concurrent processing.
3175
+ * Whether the grid should fade away with distance. Recommended to be true for
3176
+ * perspective cameras and false for orthographic cameras.
3283
3177
  */
3284
- isProcessing: boolean;
3285
- private _colorCodeMeshMap;
3286
- private _meshIDColorCodeMap;
3287
- private _currentVisibleMeshes;
3288
- private _recentlyHiddenMeshes;
3289
- private _intervalID;
3290
- private readonly _transparentMat;
3291
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3178
+ set fade(active: boolean);
3179
+ /** The Three.js mesh that contains the infinite grid. */
3180
+ readonly three: THREE.Mesh;
3181
+ private _fade;
3182
+ constructor(components: Components, world: World, config: GridConfig);
3292
3183
  /** {@link Disposable.dispose} */
3293
3184
  dispose(): void;
3294
- /**
3295
- * 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.
3296
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3297
- * @returns {void}
3298
- */
3299
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3300
- /**
3301
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3302
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3303
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3304
- * @returns {void}
3305
- */
3306
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3307
- private handleWorkerMessage;
3308
- private getAvailableMaterial;
3185
+ private setupEvents;
3186
+ private updateZoom;
3187
+ }
3188
+ import { NavigationMode } from "./types";
3189
+ import { OrthoPerspectiveCamera } from "../index";
3190
+ /**
3191
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3192
+ */
3193
+ export declare class OrbitMode implements NavigationMode {
3194
+ camera: OrthoPerspectiveCamera;
3195
+ /** {@link NavigationMode.enabled} */
3196
+ enabled: boolean;
3197
+ /** {@link NavigationMode.id} */
3198
+ readonly id = "Orbit";
3199
+ constructor(camera: OrthoPerspectiveCamera);
3200
+ /** {@link NavigationMode.set} */
3201
+ set(active: boolean): void;
3202
+ private activateOrbitControls;
3203
+ }
3204
+ import { NavigationMode } from "./types";
3205
+ import { OrthoPerspectiveCamera } from "../index";
3206
+ /**
3207
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3208
+ */
3209
+ export declare class FirstPersonMode implements NavigationMode {
3210
+ private camera;
3211
+ /** {@link NavigationMode.enabled} */
3212
+ enabled: boolean;
3213
+ /** {@link NavigationMode.id} */
3214
+ readonly id = "FirstPerson";
3215
+ constructor(camera: OrthoPerspectiveCamera);
3216
+ /** {@link NavigationMode.set} */
3217
+ set(active: boolean): void;
3218
+ private setupFirstPersonCamera;
3309
3219
  }
3310
3220
  import * as THREE from "three";
3311
3221
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3407,6 +3317,107 @@ export declare class SimplePlane implements Disposable, Hideable {
3407
3317
  private static newPlaneMesh;
3408
3318
  }
3409
3319
  import * as THREE from "three";
3320
+ import { CameraProjection } from "./types";
3321
+ import { Event } from "../../Types";
3322
+ import { OrthoPerspectiveCamera } from "../index";
3323
+ /**
3324
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3325
+ */
3326
+ export declare class ProjectionManager {
3327
+ /**
3328
+ * Event that fires when the {@link CameraProjection} changes.
3329
+ */
3330
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3331
+ /**
3332
+ * Current projection mode of the camera.
3333
+ * Default is "Perspective".
3334
+ */
3335
+ current: CameraProjection;
3336
+ /**
3337
+ * The camera controlled by this ProjectionManager.
3338
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3339
+ */
3340
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3341
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3342
+ matchOrthoDistanceEnabled: boolean;
3343
+ private _component;
3344
+ private _previousDistance;
3345
+ constructor(camera: OrthoPerspectiveCamera);
3346
+ /**
3347
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3348
+ *
3349
+ * @param projection - the new projection to set. If it is the current projection,
3350
+ * it will have no effect.
3351
+ */
3352
+ set(projection: CameraProjection): Promise<void>;
3353
+ /**
3354
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3355
+ * and vice versa.
3356
+ */
3357
+ toggle(): Promise<void>;
3358
+ private setOrthoCamera;
3359
+ private getPerspectiveDims;
3360
+ private setupOrthoCamera;
3361
+ private getDistance;
3362
+ private setPerspectiveCamera;
3363
+ }
3364
+ import { NavigationMode } from "./types";
3365
+ import { OrthoPerspectiveCamera } from "../index";
3366
+ /**
3367
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3368
+ */
3369
+ export declare class PlanMode implements NavigationMode {
3370
+ private camera;
3371
+ /** {@link NavigationMode.enabled} */
3372
+ enabled: boolean;
3373
+ /** {@link NavigationMode.id} */
3374
+ readonly id = "Plan";
3375
+ private mouseAction1?;
3376
+ private mouseAction2?;
3377
+ private mouseInitialized;
3378
+ private readonly defaultAzimuthSpeed;
3379
+ private readonly defaultPolarSpeed;
3380
+ constructor(camera: OrthoPerspectiveCamera);
3381
+ /** {@link NavigationMode.set} */
3382
+ set(active: boolean): void;
3383
+ }
3384
+ /**
3385
+ * The projection system of the camera.
3386
+ */
3387
+ export type CameraProjection = "Perspective" | "Orthographic";
3388
+ /**
3389
+ * The extensible list of supported navigation modes.
3390
+ */
3391
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3392
+ /**
3393
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3394
+ */
3395
+ export interface NavigationMode {
3396
+ /** The unique ID of this navigation mode. */
3397
+ id: NavModeID;
3398
+ /**
3399
+ * Enable or disable this navigation mode.
3400
+ * When a new navigation mode is enabled, the previous navigation mode
3401
+ * must be disabled.
3402
+ *
3403
+ * @param active - whether to enable or disable this mode.
3404
+ * @param options - any additional data required to enable or disable it.
3405
+ * */
3406
+ set: (active: boolean, options?: any) => void;
3407
+ /** Whether this navigation mode is active or not. */
3408
+ enabled: boolean;
3409
+ }
3410
+ import * as WEBIFC from "web-ifc";
3411
+ import * as THREE from "three";
3412
+ export declare class Units {
3413
+ factor: number;
3414
+ complement: number;
3415
+ apply(matrix: THREE.Matrix4): void;
3416
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3417
+ private getLengthUnits;
3418
+ private getScaleMatrix;
3419
+ }
3420
+ import * as THREE from "three";
3410
3421
  import * as WEBIFC from "web-ifc";
3411
3422
  import * as FRAGS from "@thatopen/fragments";
3412
3423
  export declare class CivilReader {
@@ -3427,6 +3438,17 @@ export declare class IfcMetadataReader {
3427
3438
  getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3428
3439
  }
3429
3440
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3441
+ /**
3442
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3443
+ */
3444
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3445
+ /**
3446
+ * Amount of properties to be streamed.
3447
+ * Defaults to 100 properties.
3448
+ */
3449
+ propertiesSize: number;
3450
+ }
3451
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3430
3452
  /**
3431
3453
  * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3432
3454
  */
@@ -3442,40 +3464,6 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3442
3464
  */
3443
3465
  minAssetsSize: number;
3444
3466
  }
3445
- import * as WEBIFC from "web-ifc";
3446
- import * as THREE from "three";
3447
- export declare class Units {
3448
- factor: number;
3449
- complement: number;
3450
- apply(matrix: THREE.Matrix4): void;
3451
- setUp(webIfc: WEBIFC.IfcAPI): void;
3452
- private getLengthUnits;
3453
- private getScaleMatrix;
3454
- }
3455
- export type RelationsMap = Map<number, Map<number, number[]>>;
3456
- export interface ModelsRelationMap {
3457
- [modelID: string]: RelationsMap;
3458
- }
3459
- /**
3460
- * Type alias for an array of inverse attribute names.
3461
- */
3462
- export type InverseAttributes = [
3463
- "IsDecomposedBy",
3464
- "Decomposes",
3465
- "AssociatedTo",
3466
- "HasAssociations",
3467
- "ClassificationForObjects",
3468
- "IsGroupedBy",
3469
- "HasAssignments",
3470
- "IsDefinedBy",
3471
- "DefinesOcurrence",
3472
- "IsTypedBy",
3473
- "Types",
3474
- "Defines",
3475
- "ContainedInStructure",
3476
- "ContainsElements"
3477
- ];
3478
- export type InverseAttribute = InverseAttributes[number];
3479
3467
  /**
3480
3468
  * 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.
3481
3469
  */
@@ -3505,6 +3493,30 @@ export interface StreamedAsset {
3505
3493
  color: number[];
3506
3494
  }[];
3507
3495
  }
3496
+ export type RelationsMap = Map<number, Map<number, number[]>>;
3497
+ export interface ModelsRelationMap {
3498
+ [modelID: string]: RelationsMap;
3499
+ }
3500
+ /**
3501
+ * Type alias for an array of inverse attribute names.
3502
+ */
3503
+ export type InverseAttributes = [
3504
+ "IsDecomposedBy",
3505
+ "Decomposes",
3506
+ "AssociatedTo",
3507
+ "HasAssociations",
3508
+ "ClassificationForObjects",
3509
+ "IsGroupedBy",
3510
+ "HasAssignments",
3511
+ "IsDefinedBy",
3512
+ "DefinesOcurrence",
3513
+ "IsTypedBy",
3514
+ "Types",
3515
+ "Defines",
3516
+ "ContainedInStructure",
3517
+ "ContainsElements"
3518
+ ];
3519
+ export type InverseAttribute = InverseAttributes[number];
3508
3520
  import { BufferGeometry } from "three";
3509
3521
  import * as THREE from "three";
3510
3522
  export declare class TransformHelper {