@thatopen/components 2.2.2 → 2.2.3

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.
@@ -7,7 +7,7 @@ export declare class Components implements Disposable {
7
7
  /**
8
8
  * The version of the @thatopen/components library.
9
9
  */
10
- static readonly release = "2.2.0-alpha.0";
10
+ static readonly release = "2.2.3";
11
11
  /** {@link Disposable.onDisposed} */
12
12
  readonly onDisposed: Event<void>;
13
13
  /**
@@ -75,110 +75,6 @@ export declare class Components implements Disposable {
75
75
  private update;
76
76
  private static setupBVH;
77
77
  }
78
- import * as THREE from "three";
79
- import { Components } from "../Components";
80
- import { Component } from "../Types";
81
- /**
82
- * 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).
83
- */
84
- export declare class Disposer extends Component {
85
- private _disposedComponents;
86
- /** {@link Component.enabled} */
87
- enabled: boolean;
88
- /**
89
- * A unique identifier for the component.
90
- * This UUID is used to register the component within the Components system.
91
- */
92
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
93
- constructor(components: Components);
94
- /**
95
- * Return the UUIDs of all disposed components.
96
- */
97
- get(): Set<string>;
98
- /**
99
- * Removes a mesh, its geometry and its materials from memory. If you are
100
- * using any of these in other parts of the application, make sure that you
101
- * remove them from the mesh before disposing it.
102
- *
103
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
- * to remove.
105
- *
106
- * @param materials - whether to dispose the materials of the mesh.
107
- *
108
- * @param recursive - whether to recursively dispose the children of the mesh.
109
- */
110
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
111
- /**
112
- * Disposes a geometry from memory.
113
- *
114
- * @param geometry - the
115
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
- * to remove.
117
- */
118
- disposeGeometry(geometry: THREE.BufferGeometry): void;
119
- private disposeGeometryAndMaterials;
120
- private disposeChildren;
121
- private static disposeMaterial;
122
- }
123
- import { SimpleScene, SimpleSceneConfig } from "../Worlds";
124
- import { DistanceRenderer } from "./src";
125
- import { Disposable } from "../Types";
126
- /**
127
- * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
128
- * as well as shadows.
129
- */
130
- export interface ShadowedSceneConfig extends SimpleSceneConfig {
131
- shadows: {
132
- cascade: number;
133
- resolution: number;
134
- };
135
- }
136
- /**
137
- * A scene that supports efficient cast shadows. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ShadowedScene). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ShadowedScene).
138
- */
139
- export declare class ShadowedScene extends SimpleScene implements Disposable {
140
- private _distanceRenderer?;
141
- /**
142
- * Whether the bias property should be set automatically depending on the shadow distance.
143
- */
144
- autoBias: boolean;
145
- /**
146
- * Configuration interface for the {@link ShadowedScene}.
147
- * Defines properties for directional and ambient lights, as well as shadows.
148
- */
149
- config: Required<ShadowedSceneConfig>;
150
- private _lightsWithShadow;
151
- private _isComputingShadows;
152
- private _shadowsEnabled;
153
- private _bias;
154
- /**
155
- * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
156
- */
157
- get bias(): number;
158
- /**
159
- * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
160
- */
161
- set bias(value: number);
162
- /**
163
- * Getter to see whether the shadows are enabled or not in this scene instance.
164
- */
165
- get shadowsEnabled(): boolean;
166
- /**
167
- * Setter to control whether the shadows are enabled or not in this scene instance.
168
- */
169
- set shadowsEnabled(value: boolean);
170
- /**
171
- * Getter to get the renderer used to determine the farthest distance from the camera.
172
- */
173
- get distanceRenderer(): DistanceRenderer;
174
- /** {@link Configurable.setup} */
175
- setup(config?: Partial<ShadowedSceneConfig>): void;
176
- /** {@link Disposable.dispose} */
177
- dispose(): void;
178
- /** Update all the shadows of the scene. */
179
- updateShadows(): Promise<void>;
180
- private recomputeShadows;
181
- }
182
78
  import { Component, Disposable, World, Event } from "../Types";
183
79
  import { SimpleRaycaster } from "./src";
184
80
  import { Components } from "../Components";
@@ -221,72 +117,50 @@ export declare class Raycasters extends Component implements Disposable {
221
117
  /** {@link Disposable.dispose} */
222
118
  dispose(): void;
223
119
  }
224
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
120
+ import * as THREE from "three";
225
121
  import { Components } from "../Components";
226
- import { SimpleWorld } from "./src";
122
+ import { Component } from "../Types";
227
123
  /**
228
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
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).
229
125
  */
230
- export declare class Worlds extends Component implements Updateable, Disposable {
126
+ export declare class Disposer extends Component {
127
+ private _disposedComponents;
128
+ /** {@link Component.enabled} */
129
+ enabled: boolean;
231
130
  /**
232
131
  * A unique identifier for the component.
233
132
  * This UUID is used to register the component within the Components system.
234
133
  */
235
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
236
- /** {@link Updateable.onAfterUpdate} */
237
- readonly onAfterUpdate: Event<unknown>;
238
- /** {@link Updateable.onBeforeUpdate} */
239
- readonly onBeforeUpdate: Event<unknown>;
240
- /** {@link Disposable.onDisposed} */
241
- readonly onDisposed: Event<unknown>;
242
- /**
243
- * An event that is triggered when a new world is created.
244
- * The event passes the newly created world as a parameter.
245
- */
246
- readonly onWorldCreated: Event<World>;
247
- /**
248
- * An event that is triggered when a world is deleted.
249
- * The event passes the UUID of the deleted world as a parameter.
250
- */
251
- readonly onWorldDeleted: Event<string>;
252
- /**
253
- * A collection of worlds managed by this component.
254
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
255
- */
256
- list: Map<string, World>;
257
- /** {@link Component.enabled} */
258
- enabled: boolean;
134
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
259
135
  constructor(components: Components);
260
136
  /**
261
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
262
- *
263
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
264
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
265
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
266
- *
267
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
137
+ * Return the UUIDs of all disposed components.
268
138
  */
269
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
139
+ get(): Set<string>;
270
140
  /**
271
- * Deletes a world from the list of worlds.
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.
272
144
  *
273
- * @param {World} world - The world to be deleted.
145
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
146
+ * to remove.
274
147
  *
275
- * @throws {Error} - Throws an error if the provided world is not found in the list.
148
+ * @param materials - whether to dispose the materials of the mesh.
276
149
  *
277
- * @returns {void}
150
+ * @param recursive - whether to recursively dispose the children of the mesh.
278
151
  */
279
- delete(world: World): void;
152
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
280
153
  /**
281
- * Disposes of the Worlds component and all its managed worlds.
282
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
283
- * and triggers the onDisposed event.
154
+ * Disposes a geometry from memory.
284
155
  *
285
- * @returns {void}
156
+ * @param geometry - the
157
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
158
+ * to remove.
286
159
  */
287
- dispose(): void;
288
- /** {@link Updateable.update} */
289
- update(delta?: number): void | Promise<void>;
160
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
161
+ private disposeGeometryAndMaterials;
162
+ private disposeChildren;
163
+ private static disposeMaterial;
290
164
  }
291
165
  import { Component, Disposable, World, Event } from "../Types";
292
166
  import { GridConfig, SimpleGrid } from "./src";
@@ -337,6 +211,65 @@ export declare class Grids extends Component implements Disposable {
337
211
  /** {@link Disposable.dispose} */
338
212
  dispose(): void;
339
213
  }
214
+ import { SimpleScene, SimpleSceneConfig } from "../Worlds";
215
+ import { DistanceRenderer } from "./src";
216
+ import { Disposable } from "../Types";
217
+ /**
218
+ * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
219
+ * as well as shadows.
220
+ */
221
+ export interface ShadowedSceneConfig extends SimpleSceneConfig {
222
+ shadows: {
223
+ cascade: number;
224
+ resolution: number;
225
+ };
226
+ }
227
+ /**
228
+ * A scene that supports efficient cast shadows. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ShadowedScene). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ShadowedScene).
229
+ */
230
+ export declare class ShadowedScene extends SimpleScene implements Disposable {
231
+ private _distanceRenderer?;
232
+ /**
233
+ * Whether the bias property should be set automatically depending on the shadow distance.
234
+ */
235
+ autoBias: boolean;
236
+ /**
237
+ * Configuration interface for the {@link ShadowedScene}.
238
+ * Defines properties for directional and ambient lights, as well as shadows.
239
+ */
240
+ config: Required<ShadowedSceneConfig>;
241
+ private _lightsWithShadow;
242
+ private _isComputingShadows;
243
+ private _shadowsEnabled;
244
+ private _bias;
245
+ /**
246
+ * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
247
+ */
248
+ get bias(): number;
249
+ /**
250
+ * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
251
+ */
252
+ set bias(value: number);
253
+ /**
254
+ * Getter to see whether the shadows are enabled or not in this scene instance.
255
+ */
256
+ get shadowsEnabled(): boolean;
257
+ /**
258
+ * Setter to control whether the shadows are enabled or not in this scene instance.
259
+ */
260
+ set shadowsEnabled(value: boolean);
261
+ /**
262
+ * Getter to get the renderer used to determine the farthest distance from the camera.
263
+ */
264
+ get distanceRenderer(): DistanceRenderer;
265
+ /** {@link Configurable.setup} */
266
+ setup(config?: Partial<ShadowedSceneConfig>): void;
267
+ /** {@link Disposable.dispose} */
268
+ dispose(): void;
269
+ /** Update all the shadows of the scene. */
270
+ updateShadows(): Promise<void>;
271
+ private recomputeShadows;
272
+ }
340
273
  import * as THREE from "three";
341
274
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
342
275
  import { SimplePlane } from "./src";
@@ -525,24 +458,91 @@ export declare class Cullers extends Component implements Disposable {
525
458
  */
526
459
  updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
527
460
  }
528
- import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
461
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
529
462
  import { Components } from "../Components";
530
- import { BCFViewpoint, Viewpoint } from "./src";
463
+ import { SimpleWorld } from "./src";
531
464
  /**
532
- * Configuration interface for the Viewpoints general behavior.
465
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
533
466
  */
534
- interface ViewpointsConfig {
467
+ export declare class Worlds extends Component implements Updateable, Disposable {
535
468
  /**
536
- * Indicates whether to overwrite the fragments colors when applying viewpoints.
537
- * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
538
- * @default false
469
+ * A unique identifier for the component.
470
+ * This UUID is used to register the component within the Components system.
539
471
  */
540
- overwriteColors: boolean;
541
- }
542
- export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfig> {
543
- static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
544
- enabled: boolean;
545
- /**
472
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
473
+ /** {@link Updateable.onAfterUpdate} */
474
+ readonly onAfterUpdate: Event<unknown>;
475
+ /** {@link Updateable.onBeforeUpdate} */
476
+ readonly onBeforeUpdate: Event<unknown>;
477
+ /** {@link Disposable.onDisposed} */
478
+ readonly onDisposed: Event<unknown>;
479
+ /**
480
+ * An event that is triggered when a new world is created.
481
+ * The event passes the newly created world as a parameter.
482
+ */
483
+ readonly onWorldCreated: Event<World>;
484
+ /**
485
+ * An event that is triggered when a world is deleted.
486
+ * The event passes the UUID of the deleted world as a parameter.
487
+ */
488
+ readonly onWorldDeleted: Event<string>;
489
+ /**
490
+ * A collection of worlds managed by this component.
491
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
492
+ */
493
+ list: Map<string, World>;
494
+ /** {@link Component.enabled} */
495
+ enabled: boolean;
496
+ constructor(components: Components);
497
+ /**
498
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
499
+ *
500
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
501
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
502
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
503
+ *
504
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
505
+ */
506
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
507
+ /**
508
+ * Deletes a world from the list of worlds.
509
+ *
510
+ * @param {World} world - The world to be deleted.
511
+ *
512
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
513
+ *
514
+ * @returns {void}
515
+ */
516
+ delete(world: World): void;
517
+ /**
518
+ * Disposes of the Worlds component and all its managed worlds.
519
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
520
+ * and triggers the onDisposed event.
521
+ *
522
+ * @returns {void}
523
+ */
524
+ dispose(): void;
525
+ /** {@link Updateable.update} */
526
+ update(delta?: number): void | Promise<void>;
527
+ }
528
+ import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
529
+ import { Components } from "../Components";
530
+ import { BCFViewpoint, Viewpoint } from "./src";
531
+ /**
532
+ * Configuration interface for the Viewpoints general behavior.
533
+ */
534
+ interface ViewpointsConfig {
535
+ /**
536
+ * Indicates whether to overwrite the fragments colors when applying viewpoints.
537
+ * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
538
+ * @default false
539
+ */
540
+ overwriteColors: boolean;
541
+ }
542
+ export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfig> {
543
+ static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
544
+ enabled: boolean;
545
+ /**
546
546
  * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
547
547
  * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
548
548
  */
@@ -619,6 +619,111 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
619
619
  update(): void;
620
620
  }
621
621
  import * as THREE from "three";
622
+ import * as FRAGS from "@thatopen/fragments";
623
+ import { Component, Components } from "../../core";
624
+ /**
625
+ * Represents an edge measurement result.
626
+ */
627
+ export interface MeasureEdge {
628
+ /**
629
+ * The distance between the two points of the edge.
630
+ */
631
+ distance: number;
632
+ /**
633
+ * The two points that define the edge.
634
+ */
635
+ points: THREE.Vector3[];
636
+ }
637
+ /**
638
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
639
+ */
640
+ export declare class MeasurementUtils extends Component {
641
+ /**
642
+ * A unique identifier for the component.
643
+ * This UUID is used to register the component within the Components system.
644
+ */
645
+ static uuid: string;
646
+ /** {@link Component.enabled} */
647
+ enabled: boolean;
648
+ constructor(components: Components);
649
+ /**
650
+ * Utility method to calculate the distance from a point to a line segment.
651
+ *
652
+ * @param point - The point from which to calculate the distance.
653
+ * @param lineStart - The start point of the line segment.
654
+ * @param lineEnd - The end point of the line segment.
655
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
656
+ * @returns The distance from the point to the line segment.
657
+ */
658
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
659
+ /**
660
+ * Method to get the face of a mesh that contains a given triangle index.
661
+ * It also returns the edges of the found face and their indices.
662
+ *
663
+ * @param mesh - The mesh to get the face from. It must be indexed.
664
+ * @param triangleIndex - The index of the triangle within the mesh.
665
+ * @param instance - The instance of the mesh (optional).
666
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
667
+ */
668
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
669
+ edges: MeasureEdge[];
670
+ indices: Set<number>;
671
+ } | null;
672
+ /**
673
+ * Method to get the vertices and normal of a mesh face at a given index.
674
+ * It also applies instance transformation if provided.
675
+ *
676
+ * @param mesh - The mesh to get the face from. It must be indexed.
677
+ * @param faceIndex - The index of the face within the mesh.
678
+ * @param instance - The instance of the mesh (optional).
679
+ * @returns An object containing the vertices and normal of the face.
680
+ * @throws Will throw an error if the geometry is not indexed.
681
+ */
682
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
683
+ p1: THREE.Vector3;
684
+ p2: THREE.Vector3;
685
+ p3: THREE.Vector3;
686
+ faceNormal: THREE.Vector3;
687
+ };
688
+ /**
689
+ * Method to round the vector's components to a specified number of decimal places.
690
+ * This is used to ensure numerical precision in edge detection.
691
+ *
692
+ * @param vector - The vector to round.
693
+ * @returns The vector with rounded components.
694
+ */
695
+ round(vector: THREE.Vector3): void;
696
+ /**
697
+ * Calculates the volume of a set of fragments.
698
+ *
699
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
700
+ * @returns The total volume of the fragments and the bounding sphere.
701
+ *
702
+ * @remarks
703
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
704
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
705
+ *
706
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
707
+ * @throws Will throw an error if the fragment manager is not available.
708
+ */
709
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
710
+ /**
711
+ * Calculates the total volume of a set of meshes.
712
+ *
713
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
714
+ * @returns The total volume of the meshes and the bounding sphere.
715
+ *
716
+ * @remarks
717
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
718
+ * and its bounding sphere.
719
+ *
720
+ */
721
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
722
+ private getFaceData;
723
+ private getVolumeOfMesh;
724
+ private getSignedVolumeOfTriangle;
725
+ }
726
+ import * as THREE from "three";
622
727
  import { Components } from "../Components";
623
728
  import { SimpleCamera } from "..";
624
729
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
@@ -682,61 +787,195 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
682
787
  private newOrthoCamera;
683
788
  private setOrthoPerspCameraAspect;
684
789
  }
685
- import * as WEBIFC from "web-ifc";
686
- import { FragmentsGroup } from "@thatopen/fragments";
687
- import { Disposable, Event, Component, Components } from "../../core";
688
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
689
- export type { InverseAttribute, RelationsMap } from "./src/types";
690
- /**
691
- * 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).
692
- */
693
- export declare class IfcRelationsIndexer extends Component implements Disposable {
790
+ import { XMLParser } from "fast-xml-parser";
791
+ import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core/Types";
792
+ import { BCFTopic, BCFTopicsConfig, Topic } from "./src";
793
+ import { Viewpoint } from "../../core/Viewpoints";
794
+ export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfig> {
795
+ static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
796
+ enabled: boolean;
797
+ static xmlParser: XMLParser;
798
+ config: Required<BCFTopicsConfig>;
799
+ readonly list: DataMap<string, Topic>;
800
+ readonly onSetup: Event<unknown>;
801
+ isSetup: boolean;
802
+ setup(config?: Partial<BCFTopicsConfig>): void;
803
+ readonly onBCFImported: Event<Topic[]>;
694
804
  /**
695
- * A unique identifier for the component.
696
- * This UUID is used to register the component within the Components system.
805
+ * Creates a new BCFTopic instance and adds it to the list.
806
+ *
807
+ * @param data - Optional partial BCFTopic object to initialize the new topic with.
808
+ * If not provided, default values will be used.
809
+ * @returns The newly created BCFTopic instance.
697
810
  */
698
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
699
- /** {@link Disposable.onDisposed} */
700
- readonly onDisposed: Event<string>;
811
+ create(data?: Partial<BCFTopic>): Topic;
812
+ readonly onDisposed: Event<unknown>;
701
813
  /**
702
- * Event triggered when relations for a model have been indexed.
703
- * This event provides the model's UUID and the relations map generated for that model.
814
+ * Disposes of the BCFTopics component and triggers the onDisposed event.
704
815
  *
705
- * @property {string} modelID - The UUID of the model for which relations have been indexed.
706
- * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
707
- * 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.
816
+ * @remarks
817
+ * This method clears the list of topics and triggers the onDisposed event.
818
+ * It also resets the onDisposed event listener.
708
819
  */
709
- readonly onRelationsIndexed: Event<{
710
- modelID: string;
711
- relationsMap: RelationsMap;
712
- }>;
820
+ dispose(): void;
713
821
  /**
714
- * Holds the relationship mappings for each model processed by the indexer.
715
- * The structure is a map where each key is a model's UUID, and the value is another map.
716
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
717
- * representing a specific relation type, and the value is an array of expressIDs of entities
718
- * that are related through that relation type. This structure allows for efficient querying
719
- * of entity relationships within a model.
822
+ * Retrieves the unique set of topic types used across all topics.
823
+ *
824
+ * @returns A Set containing the unique topic types.
720
825
  */
721
- readonly relationMaps: ModelsRelationMap;
722
- /** {@link Component.enabled} */
723
- enabled: boolean;
724
- private _relToAttributesMap;
725
- private _inverseAttributes;
726
- private _ifcRels;
727
- constructor(components: Components);
728
- private onFragmentsDisposed;
729
- private indexRelations;
730
- private getAttributeIndex;
826
+ get usedTypes(): Set<string>;
731
827
  /**
732
- * Adds a relation map to the model's relations map.
733
- *
734
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
735
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
828
+ * Retrieves the unique set of topic statuses used across all topics.
736
829
  *
737
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
830
+ * @returns A Set containing the unique topic statuses.
738
831
  */
739
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
832
+ get usedStatuses(): Set<string>;
833
+ /**
834
+ * Retrieves the unique set of topic priorities used across all topics.
835
+ *
836
+ * @returns A Set containing the unique topic priorities.
837
+ * Note: This method filters out any null or undefined priorities.
838
+ */
839
+ get usedPriorities(): Set<string | undefined>;
840
+ /**
841
+ * Retrieves the unique set of topic stages used across all topics.
842
+ *
843
+ * @returns A Set containing the unique topic stages.
844
+ * Note: This method filters out any null or undefined stages.
845
+ */
846
+ get usedStages(): Set<string | undefined>;
847
+ /**
848
+ * Retrieves the unique set of users associated with topics.
849
+ *
850
+ * @returns A Set containing the unique users.
851
+ * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
852
+ */
853
+ get usedUsers(): Set<string>;
854
+ /**
855
+ * Retrieves the unique set of labels used across all topics.
856
+ *
857
+ * @returns A Set containing the unique labels.
858
+ */
859
+ get usedLabels(): Set<string>;
860
+ /**
861
+ * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
862
+ * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
863
+ */
864
+ updateExtensions(): void;
865
+ /**
866
+ * Updates the references to viewpoints in the topics.
867
+ * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
868
+ * If a viewpoint does not exist, it is removed from the topic's viewpoints.
869
+ */
870
+ updateViewpointReferences(): void;
871
+ /**
872
+ * Exports the given topics to a BCF (Building Collaboration Format) zip file.
873
+ *
874
+ * @param topics - The topics to export. Defaults to all topics in the list.
875
+ * @returns A promise that resolves to a Blob containing the exported BCF zip file.
876
+ */
877
+ export(topics?: Iterable<Topic>): Promise<Blob>;
878
+ private serializeExtensions;
879
+ private processMarkupComment;
880
+ private getMarkupComments;
881
+ private getMarkupLabels;
882
+ private getMarkupViewpoints;
883
+ private getMarkupRelatedTopics;
884
+ /**
885
+ * Loads BCF (Building Collaboration Format) data into the engine.
886
+ *
887
+ * @param world - The default world where the viewpoints are going to be created.
888
+ * @param data - The BCF data to load.
889
+ *
890
+ * @returns A promise that resolves to an object containing the created viewpoints and topics.
891
+ *
892
+ * @throws An error if the BCF version is not supported.
893
+ */
894
+ load(data: Uint8Array, world: World): Promise<{
895
+ viewpoints: Viewpoint[];
896
+ topics: Topic[];
897
+ }>;
898
+ }
899
+ import * as WEBIFC from "web-ifc";
900
+ import * as FRAG from "@thatopen/fragments";
901
+ import { Component, Components } from "../../core";
902
+ /**
903
+ * 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).
904
+ */
905
+ export declare class IfcJsonExporter extends Component {
906
+ /**
907
+ * A unique identifier for the component.
908
+ * This UUID is used to register the component within the Components system.
909
+ */
910
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
911
+ /** {@link Component.enabled} */
912
+ enabled: boolean;
913
+ constructor(components: Components);
914
+ /**
915
+ * Exports all the properties of an IFC into an array of JS objects.
916
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
917
+ * @param modelID ID of the IFC model whose properties to extract.
918
+ * @param indirect whether to get the indirect relationships as well.
919
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
920
+ * to make the location data available (e.g. absolute position of building).
921
+ */
922
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
923
+ }
924
+ import * as WEBIFC from "web-ifc";
925
+ import { FragmentsGroup } from "@thatopen/fragments";
926
+ import { Disposable, Event, Component, Components } from "../../core";
927
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
928
+ export type { InverseAttribute, RelationsMap } from "./src/types";
929
+ /**
930
+ * 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).
931
+ */
932
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
933
+ /**
934
+ * A unique identifier for the component.
935
+ * This UUID is used to register the component within the Components system.
936
+ */
937
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
938
+ /** {@link Disposable.onDisposed} */
939
+ readonly onDisposed: Event<string>;
940
+ /**
941
+ * Event triggered when relations for a model have been indexed.
942
+ * This event provides the model's UUID and the relations map generated for that model.
943
+ *
944
+ * @property {string} modelID - The UUID of the model for which relations have been indexed.
945
+ * @property {RelationsMap} relationsMap - The relations map generated for the specified model.
946
+ * 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.
947
+ */
948
+ readonly onRelationsIndexed: Event<{
949
+ modelID: string;
950
+ relationsMap: RelationsMap;
951
+ }>;
952
+ /**
953
+ * Holds the relationship mappings for each model processed by the indexer.
954
+ * The structure is a map where each key is a model's UUID, and the value is another map.
955
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
956
+ * representing a specific relation type, and the value is an array of expressIDs of entities
957
+ * that are related through that relation type. This structure allows for efficient querying
958
+ * of entity relationships within a model.
959
+ */
960
+ readonly relationMaps: ModelsRelationMap;
961
+ /** {@link Component.enabled} */
962
+ enabled: boolean;
963
+ private _relToAttributesMap;
964
+ private _inverseAttributes;
965
+ private _ifcRels;
966
+ constructor(components: Components);
967
+ private onFragmentsDisposed;
968
+ private indexRelations;
969
+ private getAttributeIndex;
970
+ /**
971
+ * Adds a relation map to the model's relations map.
972
+ *
973
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
974
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
975
+ *
976
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
977
+ */
978
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
740
979
  /**
741
980
  * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
742
981
  * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
@@ -858,31 +1097,6 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
858
1097
  getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
859
1098
  }
860
1099
  import * as WEBIFC from "web-ifc";
861
- import * as FRAG from "@thatopen/fragments";
862
- import { Component, Components } from "../../core";
863
- /**
864
- * 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).
865
- */
866
- export declare class IfcJsonExporter extends Component {
867
- /**
868
- * A unique identifier for the component.
869
- * This UUID is used to register the component within the Components system.
870
- */
871
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
872
- /** {@link Component.enabled} */
873
- enabled: boolean;
874
- constructor(components: Components);
875
- /**
876
- * Exports all the properties of an IFC into an array of JS objects.
877
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
878
- * @param modelID ID of the IFC model whose properties to extract.
879
- * @param indirect whether to get the indirect relationships as well.
880
- * @param recursiveSpatial whether to get the properties of spatial items recursively
881
- * to make the location data available (e.g. absolute position of building).
882
- */
883
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
884
- }
885
- import * as WEBIFC from "web-ifc";
886
1100
  import { FragmentsGroup } from "@thatopen/fragments";
887
1101
  import { Component, Disposable, Event, Components } from "../../core";
888
1102
  /**
@@ -1150,167 +1364,62 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1150
1364
  private newSingleProperty;
1151
1365
  }
1152
1366
  import * as THREE from "three";
1153
- import * as FRAGS from "@thatopen/fragments";
1154
- import { Component, Components } from "../../core";
1367
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1368
+ center: THREE.Vector3;
1369
+ halfSizes: THREE.Vector3;
1370
+ rotation: THREE.Matrix3;
1371
+ transformation: THREE.Matrix4;
1372
+ };
1373
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1374
+ import * as THREE from "three";
1375
+ export declare class MaterialsUtils {
1376
+ static isTransparent(material: THREE.Material): boolean;
1377
+ }
1378
+ export declare class UUID {
1379
+ private static _pattern;
1380
+ private static _lut;
1381
+ static create(): string;
1382
+ static validate(uuid: string): void;
1383
+ }
1384
+ import * as THREE from "three";
1385
+ import { Component, Components, Disposable, Event, World } from "../core";
1155
1386
  /**
1156
- * Represents an edge measurement result.
1387
+ * Configuration interface for the VertexPicker component.
1157
1388
  */
1158
- export interface MeasureEdge {
1389
+ export interface VertexPickerConfig {
1159
1390
  /**
1160
- * The distance between the two points of the edge.
1391
+ * If true, only vertices will be picked, not the closest point on the face.
1161
1392
  */
1162
- distance: number;
1393
+ showOnlyVertex: boolean;
1163
1394
  /**
1164
- * The two points that define the edge.
1395
+ * The maximum distance for snapping to a vertex.
1165
1396
  */
1166
- points: THREE.Vector3[];
1397
+ snapDistance: number;
1398
+ /**
1399
+ * The HTML element to use for previewing the picked vertex.
1400
+ */
1401
+ previewElement: HTMLElement;
1167
1402
  }
1168
1403
  /**
1169
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1404
+ * A class that provides functionality for picking vertices in a 3D scene.
1170
1405
  */
1171
- export declare class MeasurementUtils extends Component {
1406
+ export declare class VertexPicker extends Component implements Disposable {
1407
+ /** {@link Disposable.onDisposed} */
1408
+ readonly onDisposed: Event<unknown>;
1172
1409
  /**
1173
- * A unique identifier for the component.
1174
- * This UUID is used to register the component within the Components system.
1410
+ * An event that is triggered when a vertex is found.
1411
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1175
1412
  */
1176
- static uuid: string;
1177
- /** {@link Component.enabled} */
1178
- enabled: boolean;
1179
- constructor(components: Components);
1413
+ readonly onVertexFound: Event<THREE.Vector3>;
1180
1414
  /**
1181
- * Utility method to calculate the distance from a point to a line segment.
1182
- *
1183
- * @param point - The point from which to calculate the distance.
1184
- * @param lineStart - The start point of the line segment.
1185
- * @param lineEnd - The end point of the line segment.
1186
- * @param clamp - If true, the distance will be clamped to the line segment's length.
1187
- * @returns The distance from the point to the line segment.
1415
+ * An event that is triggered when a vertex is lost.
1416
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1188
1417
  */
1189
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1418
+ readonly onVertexLost: Event<THREE.Vector3>;
1190
1419
  /**
1191
- * Method to get the face of a mesh that contains a given triangle index.
1192
- * It also returns the edges of the found face and their indices.
1193
- *
1194
- * @param mesh - The mesh to get the face from. It must be indexed.
1195
- * @param triangleIndex - The index of the triangle within the mesh.
1196
- * @param instance - The instance of the mesh (optional).
1197
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1420
+ * An event that is triggered when the picker is enabled or disabled
1198
1421
  */
1199
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1200
- edges: MeasureEdge[];
1201
- indices: Set<number>;
1202
- } | null;
1203
- /**
1204
- * Method to get the vertices and normal of a mesh face at a given index.
1205
- * It also applies instance transformation if provided.
1206
- *
1207
- * @param mesh - The mesh to get the face from. It must be indexed.
1208
- * @param faceIndex - The index of the face within the mesh.
1209
- * @param instance - The instance of the mesh (optional).
1210
- * @returns An object containing the vertices and normal of the face.
1211
- * @throws Will throw an error if the geometry is not indexed.
1212
- */
1213
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1214
- p1: THREE.Vector3;
1215
- p2: THREE.Vector3;
1216
- p3: THREE.Vector3;
1217
- faceNormal: THREE.Vector3;
1218
- };
1219
- /**
1220
- * Method to round the vector's components to a specified number of decimal places.
1221
- * This is used to ensure numerical precision in edge detection.
1222
- *
1223
- * @param vector - The vector to round.
1224
- * @returns The vector with rounded components.
1225
- */
1226
- round(vector: THREE.Vector3): void;
1227
- /**
1228
- * Calculates the volume of a set of fragments.
1229
- *
1230
- * @param frags - A map of fragment IDs to their corresponding item IDs.
1231
- * @returns The total volume of the fragments and the bounding sphere.
1232
- *
1233
- * @remarks
1234
- * This method creates a set of instanced meshes from the given fragments and item IDs.
1235
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1236
- *
1237
- * @throws Will throw an error if the geometry of the meshes is not indexed.
1238
- * @throws Will throw an error if the fragment manager is not available.
1239
- */
1240
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
1241
- /**
1242
- * Calculates the total volume of a set of meshes.
1243
- *
1244
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
1245
- * @returns The total volume of the meshes and the bounding sphere.
1246
- *
1247
- * @remarks
1248
- * This method calculates the volume of each mesh in the provided array and returns the total volume
1249
- * and its bounding sphere.
1250
- *
1251
- */
1252
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
1253
- private getFaceData;
1254
- private getVolumeOfMesh;
1255
- private getSignedVolumeOfTriangle;
1256
- }
1257
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1258
- import * as THREE from "three";
1259
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1260
- center: THREE.Vector3;
1261
- halfSizes: THREE.Vector3;
1262
- rotation: THREE.Matrix3;
1263
- transformation: THREE.Matrix4;
1264
- };
1265
- import * as THREE from "three";
1266
- export declare class MaterialsUtils {
1267
- static isTransparent(material: THREE.Material): boolean;
1268
- }
1269
- export declare class UUID {
1270
- private static _pattern;
1271
- private static _lut;
1272
- static create(): string;
1273
- static validate(uuid: string): void;
1274
- }
1275
- import * as THREE from "three";
1276
- import { Component, Components, Disposable, Event, World } from "../core";
1277
- /**
1278
- * Configuration interface for the VertexPicker component.
1279
- */
1280
- export interface VertexPickerConfig {
1281
- /**
1282
- * If true, only vertices will be picked, not the closest point on the face.
1283
- */
1284
- showOnlyVertex: boolean;
1285
- /**
1286
- * The maximum distance for snapping to a vertex.
1287
- */
1288
- snapDistance: number;
1289
- /**
1290
- * The HTML element to use for previewing the picked vertex.
1291
- */
1292
- previewElement: HTMLElement;
1293
- }
1294
- /**
1295
- * A class that provides functionality for picking vertices in a 3D scene.
1296
- */
1297
- export declare class VertexPicker extends Component implements Disposable {
1298
- /** {@link Disposable.onDisposed} */
1299
- readonly onDisposed: Event<unknown>;
1300
- /**
1301
- * An event that is triggered when a vertex is found.
1302
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1303
- */
1304
- readonly onVertexFound: Event<THREE.Vector3>;
1305
- /**
1306
- * An event that is triggered when a vertex is lost.
1307
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1308
- */
1309
- readonly onVertexLost: Event<THREE.Vector3>;
1310
- /**
1311
- * An event that is triggered when the picker is enabled or disabled
1312
- */
1313
- readonly onEnabled: Event<boolean>;
1422
+ readonly onEnabled: Event<boolean>;
1314
1423
  /**
1315
1424
  * A reference to the Components instance associated with this VertexPicker.
1316
1425
  */
@@ -1388,115 +1497,6 @@ export declare class VertexPicker extends Component implements Disposable {
1388
1497
  private getVertices;
1389
1498
  private getVertex;
1390
1499
  }
1391
- import { XMLParser } from "fast-xml-parser";
1392
- import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core/Types";
1393
- import { BCFTopic, BCFTopicsConfig, Topic } from "./src";
1394
- import { Viewpoint } from "../../core/Viewpoints";
1395
- export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfig> {
1396
- static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
1397
- enabled: boolean;
1398
- static xmlParser: XMLParser;
1399
- config: Required<BCFTopicsConfig>;
1400
- readonly list: DataMap<string, Topic>;
1401
- readonly onSetup: Event<unknown>;
1402
- isSetup: boolean;
1403
- setup(config?: Partial<BCFTopicsConfig>): void;
1404
- readonly onBCFImported: Event<Topic[]>;
1405
- /**
1406
- * Creates a new BCFTopic instance and adds it to the list.
1407
- *
1408
- * @param data - Optional partial BCFTopic object to initialize the new topic with.
1409
- * If not provided, default values will be used.
1410
- * @returns The newly created BCFTopic instance.
1411
- */
1412
- create(data?: Partial<BCFTopic>): Topic;
1413
- readonly onDisposed: Event<unknown>;
1414
- /**
1415
- * Disposes of the BCFTopics component and triggers the onDisposed event.
1416
- *
1417
- * @remarks
1418
- * This method clears the list of topics and triggers the onDisposed event.
1419
- * It also resets the onDisposed event listener.
1420
- */
1421
- dispose(): void;
1422
- /**
1423
- * Retrieves the unique set of topic types used across all topics.
1424
- *
1425
- * @returns A Set containing the unique topic types.
1426
- */
1427
- get usedTypes(): Set<string>;
1428
- /**
1429
- * Retrieves the unique set of topic statuses used across all topics.
1430
- *
1431
- * @returns A Set containing the unique topic statuses.
1432
- */
1433
- get usedStatuses(): Set<string>;
1434
- /**
1435
- * Retrieves the unique set of topic priorities used across all topics.
1436
- *
1437
- * @returns A Set containing the unique topic priorities.
1438
- * Note: This method filters out any null or undefined priorities.
1439
- */
1440
- get usedPriorities(): Set<string | undefined>;
1441
- /**
1442
- * Retrieves the unique set of topic stages used across all topics.
1443
- *
1444
- * @returns A Set containing the unique topic stages.
1445
- * Note: This method filters out any null or undefined stages.
1446
- */
1447
- get usedStages(): Set<string | undefined>;
1448
- /**
1449
- * Retrieves the unique set of users associated with topics.
1450
- *
1451
- * @returns A Set containing the unique users.
1452
- * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
1453
- */
1454
- get usedUsers(): Set<string>;
1455
- /**
1456
- * Retrieves the unique set of labels used across all topics.
1457
- *
1458
- * @returns A Set containing the unique labels.
1459
- */
1460
- get usedLabels(): Set<string>;
1461
- /**
1462
- * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
1463
- * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
1464
- */
1465
- updateExtensions(): void;
1466
- /**
1467
- * Updates the references to viewpoints in the topics.
1468
- * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
1469
- * If a viewpoint does not exist, it is removed from the topic's viewpoints.
1470
- */
1471
- updateViewpointReferences(): void;
1472
- /**
1473
- * Exports the given topics to a BCF (Building Collaboration Format) zip file.
1474
- *
1475
- * @param topics - The topics to export. Defaults to all topics in the list.
1476
- * @returns A promise that resolves to a Blob containing the exported BCF zip file.
1477
- */
1478
- export(topics?: Iterable<Topic>): Promise<Blob>;
1479
- private serializeExtensions;
1480
- private processMarkupComment;
1481
- private getMarkupComments;
1482
- private getMarkupLabels;
1483
- private getMarkupViewpoints;
1484
- private getMarkupRelatedTopics;
1485
- /**
1486
- * Loads BCF (Building Collaboration Format) data into the engine.
1487
- *
1488
- * @param world - The default world where the viewpoints are going to be created.
1489
- * @param data - The BCF data to load.
1490
- *
1491
- * @returns A promise that resolves to an object containing the created viewpoints and topics.
1492
- *
1493
- * @throws An error if the BCF version is not supported.
1494
- */
1495
- load(data: Uint8Array, world: World): Promise<{
1496
- viewpoints: Viewpoint[];
1497
- topics: Topic[];
1498
- }>;
1499
- }
1500
1500
  import * as THREE from "three";
1501
1501
  import * as FRAGS from "@thatopen/fragments";
1502
1502
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1917,84 +1917,34 @@ export declare class Hider extends Component {
1917
1917
  isolate(items: FRAGS.FragmentIdMap): void;
1918
1918
  private updateCulledVisibility;
1919
1919
  }
1920
- import { Component, Disposable, Event, Components } from "../../core";
1920
+ import * as WEBIFC from "web-ifc";
1921
+ import * as FRAGS from "@thatopen/fragments";
1922
+ import { IfcFragmentSettings } from "./src";
1923
+ import { Component, Components, Event, Disposable } from "../../core";
1921
1924
  /**
1922
- * 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).
1925
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1923
1926
  */
1924
- export declare class Exploder extends Component implements Disposable {
1927
+ export declare class IfcLoader extends Component implements Disposable {
1925
1928
  /**
1926
1929
  * A unique identifier for the component.
1927
1930
  * This UUID is used to register the component within the Components system.
1928
1931
  */
1929
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1932
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1930
1933
  /** {@link Disposable.onDisposed} */
1931
- readonly onDisposed: Event<unknown>;
1932
- /** {@link Component.enabled} */
1933
- enabled: boolean;
1934
+ readonly onDisposed: Event<string>;
1934
1935
  /**
1935
- * The height of the explosion animation.
1936
- * This property determines the vertical distance by which fragments are moved during the explosion.
1937
- * Default value is 10.
1936
+ * An event triggered when the IFC file starts loading.
1938
1937
  */
1939
- height: number;
1938
+ readonly onIfcStartedLoading: Event<void>;
1940
1939
  /**
1941
- * The group name used for the explosion animation.
1942
- * This property specifies the group of fragments that will be affected by the explosion.
1943
- * Default value is "storeys".
1940
+ * An event triggered when the setup process is completed.
1944
1941
  */
1945
- groupName: string;
1942
+ readonly onSetup: Event<void>;
1946
1943
  /**
1947
- * A set of strings representing the exploded items.
1948
- * This set is used to keep track of which items have been exploded.
1944
+ * The settings for the IfcLoader.
1945
+ * It includes options for excluding categories, setting WASM paths, and more.
1949
1946
  */
1950
- list: Set<string>;
1951
- constructor(components: Components);
1952
- /** {@link Disposable.dispose} */
1953
- dispose(): void;
1954
- /**
1955
- * Sets the explosion state of the fragments.
1956
- *
1957
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1958
- *
1959
- * @remarks
1960
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1961
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1962
- * If 'active' is false, the fragments are moved back to their original position.
1963
- *
1964
- * The method also keeps track of the exploded items using the 'list' set.
1965
- *
1966
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1967
- */
1968
- set(active: boolean): void;
1969
- }
1970
- import * as WEBIFC from "web-ifc";
1971
- import * as FRAGS from "@thatopen/fragments";
1972
- import { IfcFragmentSettings } from "./src";
1973
- import { Component, Components, Event, Disposable } from "../../core";
1974
- /**
1975
- * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1976
- */
1977
- export declare class IfcLoader extends Component implements Disposable {
1978
- /**
1979
- * A unique identifier for the component.
1980
- * This UUID is used to register the component within the Components system.
1981
- */
1982
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1983
- /** {@link Disposable.onDisposed} */
1984
- readonly onDisposed: Event<string>;
1985
- /**
1986
- * An event triggered when the IFC file starts loading.
1987
- */
1988
- readonly onIfcStartedLoading: Event<void>;
1989
- /**
1990
- * An event triggered when the setup process is completed.
1991
- */
1992
- readonly onSetup: Event<void>;
1993
- /**
1994
- * The settings for the IfcLoader.
1995
- * It includes options for excluding categories, setting WASM paths, and more.
1996
- */
1997
- settings: IfcFragmentSettings;
1947
+ settings: IfcFragmentSettings;
1998
1948
  /**
1999
1949
  * The instance of the Web-IFC library used for handling IFC data.
2000
1950
  */
@@ -2082,6 +2032,56 @@ export declare class IfcLoader extends Component implements Disposable {
2082
2032
  private getGeometry;
2083
2033
  private autoSetWasm;
2084
2034
  }
2035
+ import { Component, Disposable, Event, Components } from "../../core";
2036
+ /**
2037
+ * 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).
2038
+ */
2039
+ export declare class Exploder extends Component implements Disposable {
2040
+ /**
2041
+ * A unique identifier for the component.
2042
+ * This UUID is used to register the component within the Components system.
2043
+ */
2044
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
2045
+ /** {@link Disposable.onDisposed} */
2046
+ readonly onDisposed: Event<unknown>;
2047
+ /** {@link Component.enabled} */
2048
+ enabled: boolean;
2049
+ /**
2050
+ * The height of the explosion animation.
2051
+ * This property determines the vertical distance by which fragments are moved during the explosion.
2052
+ * Default value is 10.
2053
+ */
2054
+ height: number;
2055
+ /**
2056
+ * The group name used for the explosion animation.
2057
+ * This property specifies the group of fragments that will be affected by the explosion.
2058
+ * Default value is "storeys".
2059
+ */
2060
+ groupName: string;
2061
+ /**
2062
+ * A set of strings representing the exploded items.
2063
+ * This set is used to keep track of which items have been exploded.
2064
+ */
2065
+ list: Set<string>;
2066
+ constructor(components: Components);
2067
+ /** {@link Disposable.dispose} */
2068
+ dispose(): void;
2069
+ /**
2070
+ * Sets the explosion state of the fragments.
2071
+ *
2072
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
2073
+ *
2074
+ * @remarks
2075
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
2076
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
2077
+ * If 'active' is false, the fragments are moved back to their original position.
2078
+ *
2079
+ * The method also keeps track of the exploded items using the 'list' set.
2080
+ *
2081
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
2082
+ */
2083
+ set(active: boolean): void;
2084
+ }
2085
2085
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
2086
2086
  import * as THREE from "three";
2087
2087
  import * as FRAGS from "@thatopen/fragments";
@@ -2226,6 +2226,19 @@ export declare class FragmentsManager extends Component implements Disposable {
2226
2226
  */
2227
2227
  clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
2228
2228
  }
2229
+ import * as WEBIFC from "web-ifc";
2230
+ export interface IfcItemsCategories {
2231
+ [itemID: number]: number;
2232
+ }
2233
+ export declare class IfcCategories {
2234
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2235
+ }
2236
+ /**
2237
+ * 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.
2238
+ */
2239
+ export declare const IfcCategoryMap: {
2240
+ [key: number]: string;
2241
+ };
2229
2242
  /**
2230
2243
  * 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.
2231
2244
  *
@@ -2238,13 +2251,6 @@ export declare const IfcElements: {
2238
2251
  [key: number]: string;
2239
2252
  };
2240
2253
  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
- import * as WEBIFC from "web-ifc";
2248
2254
  import { Components, Disposable, Event, Component } from "../../core";
2249
2255
  import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
2250
2256
  /**
@@ -2407,12 +2413,6 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
2407
2413
  private streamAllProperties;
2408
2414
  private cleanUp;
2409
2415
  }
2410
- /**
2411
- * 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.
2412
- */
2413
- export declare const IfcCategoryMap: {
2414
- [key: number]: string;
2415
- };
2416
2416
  import * as FRAGS from "@thatopen/fragments";
2417
2417
  export declare class IfcPropertiesUtils {
2418
2418
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -2438,6 +2438,10 @@ export declare class IfcPropertiesUtils {
2438
2438
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2439
2439
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2440
2440
  }
2441
+ /**
2442
+ * A Set of unique numbers representing different types of IFC geometries.
2443
+ */
2444
+ export declare const GeometryTypes: Set<number>;
2441
2445
  import * as THREE from "three";
2442
2446
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2443
2447
  /**
@@ -2527,10 +2531,6 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2527
2531
  resize(size?: THREE.Vector2): void;
2528
2532
  private updatePlanes;
2529
2533
  }
2530
- /**
2531
- * A Set of unique numbers representing different types of IFC geometries.
2532
- */
2533
- export declare const GeometryTypes: Set<number>;
2534
2534
  import { InverseAttribute } from "./types";
2535
2535
  export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
2536
2536
  forRelating: InverseAttribute;
@@ -2576,6 +2576,19 @@ export declare class Comment {
2576
2576
  */
2577
2577
  serialize(): string;
2578
2578
  }
2579
+ import * as FRAGS from "@thatopen/fragments";
2580
+ import * as WEBIFC from "web-ifc";
2581
+ export declare class SpatialIdsFinder {
2582
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2583
+ }
2584
+ import * as WEBIFC from "web-ifc";
2585
+ import { IfcItemsCategories } from "../../../ifc";
2586
+ export declare class SpatialStructure {
2587
+ itemsByFloor: IfcItemsCategories;
2588
+ private _units;
2589
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2590
+ cleanUp(): void;
2591
+ }
2579
2592
  import * as WEBIFC from "web-ifc";
2580
2593
  /** Configuration of the IFC-fragment conversion. */
2581
2594
  export declare class IfcFragmentSettings {
@@ -2619,19 +2632,6 @@ export declare class IfcFragmentSettings {
2619
2632
  */
2620
2633
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2621
2634
  }
2622
- import * as WEBIFC from "web-ifc";
2623
- import { IfcItemsCategories } from "../../../ifc";
2624
- export declare class SpatialStructure {
2625
- itemsByFloor: IfcItemsCategories;
2626
- private _units;
2627
- setUp(webIfc: WEBIFC.IfcAPI): void;
2628
- cleanUp(): void;
2629
- }
2630
- import * as FRAGS from "@thatopen/fragments";
2631
- import * as WEBIFC from "web-ifc";
2632
- export declare class SpatialIdsFinder {
2633
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2634
- }
2635
2635
  import * as THREE from "three";
2636
2636
  import { Hideable, Event, World, Disposable } from "../../Types";
2637
2637
  import { Components } from "../../Components";
@@ -2691,292 +2691,69 @@ export declare class SimpleGrid implements Hideable, Disposable {
2691
2691
  private setupEvents;
2692
2692
  private updateZoom;
2693
2693
  }
2694
- import { SimplePlane } from "../../Clipper";
2695
- import { DataSet } from "../../Types";
2696
- export interface ViewpointCamera {
2697
- direction: {
2698
- x: number;
2699
- y: number;
2700
- z: number;
2701
- };
2702
- position: {
2703
- x: number;
2704
- y: number;
2705
- z: number;
2706
- };
2707
- aspectRatio: number;
2708
- }
2709
- export interface ViewpointPerspectiveCamera extends ViewpointCamera {
2710
- fov: number;
2711
- }
2712
- export interface ViewpointOrthographicCamera extends ViewpointCamera {
2713
- viewToWorldScale: number;
2714
- }
2715
- export interface BCFViewpoint {
2716
- title?: string;
2717
- guid: string;
2718
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2719
- selectionComponents: Iterable<string>;
2720
- exceptionComponents: Iterable<string>;
2721
- clippingPlanes: DataSet<SimplePlane>;
2722
- spacesVisible: boolean;
2723
- spaceBoundariesVisible: boolean;
2724
- openingsVisible: boolean;
2725
- defaultVisibility: boolean;
2726
- }
2727
- import * as THREE from "three";
2728
- import * as FRAGS from "@thatopen/fragments";
2729
- import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
2730
- import { CameraProjection } from "../../OrthoPerspectiveCamera";
2731
- import { Components } from "../../Components";
2732
- import { DataMap, DataSet, World } from "../../Types";
2733
- import { SimplePlane } from "../../Clipper";
2734
- export declare class Viewpoint implements BCFViewpoint {
2735
- title?: string;
2736
- guid: string;
2694
+ /**
2695
+ * 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.
2696
+ */
2697
+ export declare class Event<T> {
2737
2698
  /**
2738
- * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
2739
- * Each clipping plane is defined by Location and Direction.
2740
- * The Direction vector points in the invisible direction meaning the half-space that is clipped.
2699
+ * Add a callback to this event instance.
2700
+ * @param handler - the callback to be added to this event.
2741
2701
  */
2742
- clippingPlanes: DataSet<SimplePlane>;
2743
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2702
+ add(handler: T extends void ? {
2703
+ (): void;
2704
+ } : {
2705
+ (data: T): void;
2706
+ }): void;
2744
2707
  /**
2745
- * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
2708
+ * Removes a callback from this event instance.
2709
+ * @param handler - the callback to be removed from this event.
2746
2710
  */
2747
- readonly exceptionComponents: DataSet<string>;
2711
+ remove(handler: T extends void ? {
2712
+ (): void;
2713
+ } : {
2714
+ (data: T): void;
2715
+ }): void;
2716
+ /** Triggers all the callbacks assigned to this event. */
2717
+ trigger: (data?: T) => void;
2718
+ /** Gets rid of all the suscribed events. */
2719
+ reset(): void;
2720
+ private handlers;
2721
+ }
2722
+ /**
2723
+ * 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.
2724
+ */
2725
+ export declare class AsyncEvent<T> {
2748
2726
  /**
2749
- * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
2727
+ * Add a callback to this event instance.
2728
+ * @param handler - the callback to be added to this event.
2750
2729
  */
2751
- readonly selectionComponents: DataSet<string>;
2730
+ add(handler: T extends void ? {
2731
+ (): Promise<void>;
2732
+ } : {
2733
+ (data: T): Promise<void>;
2734
+ }): void;
2752
2735
  /**
2753
- * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
2754
- * For this to work, call viewpoint.colorize()
2736
+ * Removes a callback from this event instance.
2737
+ * @param handler - the callback to be removed from this event.
2755
2738
  */
2756
- readonly componentColors: DataMap<string, string[]>;
2757
- /**
2758
- * Boolean flags to allow fine control over the visibility of spaces.
2759
- * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
2760
- * @default false
2761
- */
2762
- spacesVisible: boolean;
2763
- /**
2764
- * Boolean flags to allow fine control over the visibility of space boundaries.
2765
- * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
2766
- * @default false
2767
- */
2768
- spaceBoundariesVisible: boolean;
2769
- /**
2770
- * Boolean flags to allow fine control over the visibility of openings.
2771
- * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
2772
- * @default false
2773
- */
2774
- openingsVisible: boolean;
2775
- /**
2776
- * When true, all components should be visible unless listed in the exceptions
2777
- * When false all components should be invisible unless listed in the exceptions
2778
- */
2779
- defaultVisibility: boolean;
2780
- private get _selectionModelIdMap();
2781
- private get _exceptionModelIdMap();
2782
- /**
2783
- * A list of components that should be selected (highlighted) when displaying a viewpoint.
2784
- * @returns The fragmentIdMap for components marked as selections.
2785
- */
2786
- get selection(): FRAGS.FragmentIdMap;
2787
- /**
2788
- * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
2789
- * @returns The fragmentIdMap for components marked as exceptions.
2790
- */
2791
- get exception(): FRAGS.FragmentIdMap;
2792
- /**
2793
- * Retrieves the projection type of the viewpoint's camera.
2794
- *
2795
- * @returns A string representing the projection type of the viewpoint's camera.
2796
- * It can be either 'Perspective' or 'Orthographic'.
2797
- */
2798
- get projection(): CameraProjection;
2799
- /**
2800
- * Retrieves the position vector of the viewpoint's camera.
2801
- *
2802
- * @remarks
2803
- * The position vector represents the camera's position in the world coordinate system.
2804
- * The function applies the base coordinate system transformation to the position vector.
2805
- *
2806
- * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
2807
- */
2808
- get position(): THREE.Vector3;
2809
- /**
2810
- * Retrieves the direction vector of the viewpoint's camera.
2811
- *
2812
- * @remarks
2813
- * The direction vector represents the direction in which the camera is pointing.
2814
- * It is calculated by extracting the x, y, and z components from the camera's direction property.
2815
- *
2816
- * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
2817
- */
2818
- get direction(): THREE.Vector3;
2819
- private _components;
2820
- /**
2821
- * Represents the world in which the viewpoints are created and managed.
2822
- */
2823
- readonly world: World;
2824
- private get _managerVersion();
2825
- /**
2826
- * Retrieves the list of BCF topics associated with the current viewpoint.
2827
- *
2828
- * @remarks
2829
- * This function retrieves the BCFTopics manager from the components,
2830
- * then filters the list of topics to find those associated with the current viewpoint.
2831
- *
2832
- * @returns An array of BCF topics associated with the current viewpoint.
2833
- */
2834
- get topics(): import("../../../openbim/BCFTopics").Topic[];
2835
- constructor(components: Components, world: World, _config?: {
2836
- data?: Partial<BCFViewpoint>;
2837
- setCamera?: boolean;
2838
- });
2839
- /**
2840
- * Adds components to the viewpoint based on the provided fragment ID map.
2841
- *
2842
- * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
2843
- *
2844
- * @returns A Promise that resolves when the components have been added to the viewpoint.
2845
- */
2846
- addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
2847
- /**
2848
- * Sets the properties of the viewpoint with the provided data.
2849
- *
2850
- * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
2851
- *
2852
- * @param data - An object containing the properties to be set.
2853
- * The properties not included in the object will remain unchanged.
2854
- *
2855
- * @returns The viewpoint instance with the updated properties.
2856
- */
2857
- set(data: Partial<BCFViewpoint>): this;
2858
- /**
2859
- * Sets the viewpoint of the camera in the world.
2860
- *
2861
- * @remarks
2862
- * This function calculates the target position based on the viewpoint information.
2863
- * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
2864
- *
2865
- * @param transition - Indicates whether the camera movement should have a transition effect.
2866
- * Default value is 'true'.
2867
- *
2868
- * @throws An error if the world's camera does not have camera controls.
2869
- *
2870
- * @returns A Promise that resolves when the camera has been set.
2871
- */
2872
- go(transition?: boolean): Promise<void>;
2873
- /**
2874
- * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
2875
- *
2876
- * @remarks
2877
- * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
2878
- * It then calculates the camera's perspective or orthographic settings based on the camera type.
2879
- * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
2880
- *
2881
- * @throws An error if the world's camera does not have camera controls.
2882
- * @throws An error if the world's renderer is not available.
2883
- */
2884
- updateCamera(): void;
2885
- /**
2886
- * Applies color to the components in the viewpoint based on their GUIDs.
2887
- *
2888
- * This function iterates through the 'componentColors' map, retrieves the fragment IDs
2889
- * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
2890
- *
2891
- * @remarks
2892
- * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
2893
- * The color is provided as a hexadecimal string, prefixed with a '#'.
2894
- */
2895
- colorize(): void;
2896
- /**
2897
- * Resets the colors of all components in the viewpoint to their original color.
2898
- * This method iterates through the 'componentColors' map, retrieves the fragment IDs
2899
- * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
2900
- */
2901
- resetColors(): void;
2902
- private createComponentTags;
2903
- /**
2904
- * Serializes the viewpoint into a buildingSMART compliant XML string for export.
2905
- *
2906
- * @param version - The version of the BCF Manager to use for serialization.
2907
- * If not provided, the current version of the manager will be used.
2908
- *
2909
- * @returns A Promise that resolves to an XML string representing the viewpoint.
2910
- * The XML string follows the BCF VisualizationInfo schema.
2911
- *
2912
- * @throws An error if the world's camera does not have camera controls.
2913
- * @throws An error if the world's renderer is not available.
2914
- */
2915
- serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
2916
- }
2917
- /**
2918
- * 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.
2919
- */
2920
- export declare class Event<T> {
2921
- /**
2922
- * Add a callback to this event instance.
2923
- * @param handler - the callback to be added to this event.
2924
- */
2925
- add(handler: T extends void ? {
2926
- (): void;
2927
- } : {
2928
- (data: T): void;
2929
- }): void;
2930
- /**
2931
- * Removes a callback from this event instance.
2932
- * @param handler - the callback to be removed from this event.
2933
- */
2934
- remove(handler: T extends void ? {
2935
- (): void;
2936
- } : {
2937
- (data: T): void;
2938
- }): void;
2939
- /** Triggers all the callbacks assigned to this event. */
2940
- trigger: (data?: T) => void;
2941
- /** Gets rid of all the suscribed events. */
2942
- reset(): void;
2943
- private handlers;
2944
- }
2945
- /**
2946
- * 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.
2947
- */
2948
- export declare class AsyncEvent<T> {
2949
- /**
2950
- * Add a callback to this event instance.
2951
- * @param handler - the callback to be added to this event.
2952
- */
2953
- add(handler: T extends void ? {
2954
- (): Promise<void>;
2955
- } : {
2956
- (data: T): Promise<void>;
2957
- }): void;
2958
- /**
2959
- * Removes a callback from this event instance.
2960
- * @param handler - the callback to be removed from this event.
2961
- */
2962
- remove(handler: T extends void ? {
2963
- (): Promise<void>;
2964
- } : {
2965
- (data: T): Promise<void>;
2966
- }): void;
2967
- /** Triggers all the callbacks assigned to this event. */
2968
- trigger: (data?: T) => Promise<void>;
2969
- /** Gets rid of all the suscribed events. */
2970
- reset(): void;
2971
- private handlers;
2972
- }
2973
- import * as THREE from "three";
2974
- import CameraControls from "camera-controls";
2975
- import { Event } from "./event";
2976
- /**
2977
- * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2978
- */
2979
- export interface Disposable {
2739
+ remove(handler: T extends void ? {
2740
+ (): Promise<void>;
2741
+ } : {
2742
+ (data: T): Promise<void>;
2743
+ }): void;
2744
+ /** Triggers all the callbacks assigned to this event. */
2745
+ trigger: (data?: T) => Promise<void>;
2746
+ /** Gets rid of all the suscribed events. */
2747
+ reset(): void;
2748
+ private handlers;
2749
+ }
2750
+ import * as THREE from "three";
2751
+ import CameraControls from "camera-controls";
2752
+ import { Event } from "./event";
2753
+ /**
2754
+ * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2755
+ */
2756
+ export interface Disposable {
2980
2757
  /**
2981
2758
  * Destroys the object from memory to prevent a
2982
2759
  * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
@@ -3091,25 +2868,6 @@ export declare abstract class Component extends Base {
3091
2868
  */
3092
2869
  abstract enabled: boolean;
3093
2870
  }
3094
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3095
- import { Components } from "../../Components";
3096
- /**
3097
- * Base class of the library. Useful for finding out the interfaces something implements.
3098
- */
3099
- export declare abstract class Base {
3100
- components: Components;
3101
- constructor(components: Components);
3102
- /** Whether is component is {@link Disposable}. */
3103
- isDisposeable: () => this is Disposable;
3104
- /** Whether is component is {@link Resizeable}. */
3105
- isResizeable: () => this is Resizeable;
3106
- /** Whether is component is {@link Updateable}. */
3107
- isUpdateable: () => this is Updateable;
3108
- /** Whether is component is {@link Hideable}. */
3109
- isHideable: () => this is Hideable;
3110
- /** Whether is component is {@link Configurable}. */
3111
- isConfigurable: () => this is Configurable<any>;
3112
- }
3113
2871
  import { Base } from "./base";
3114
2872
  import { World } from "./world";
3115
2873
  import { Event } from "./event";
@@ -3133,19 +2891,38 @@ export declare abstract class BaseWorldItem extends Base {
3133
2891
  currentWorld: World | null;
3134
2892
  protected constructor(components: Components);
3135
2893
  }
3136
- import * as THREE from "three";
3137
- import CameraControls from "camera-controls";
3138
- import { BaseWorldItem } from "./base-world-item";
3139
- import { CameraControllable } from "./interfaces";
2894
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2895
+ import { Components } from "../../Components";
3140
2896
  /**
3141
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2897
+ * Base class of the library. Useful for finding out the interfaces something implements.
3142
2898
  */
3143
- export declare abstract class BaseCamera extends BaseWorldItem {
3144
- /**
3145
- * Whether the camera is enabled or not.
3146
- */
3147
- abstract enabled: boolean;
3148
- /**
2899
+ export declare abstract class Base {
2900
+ components: Components;
2901
+ constructor(components: Components);
2902
+ /** Whether is component is {@link Disposable}. */
2903
+ isDisposeable: () => this is Disposable;
2904
+ /** Whether is component is {@link Resizeable}. */
2905
+ isResizeable: () => this is Resizeable;
2906
+ /** Whether is component is {@link Updateable}. */
2907
+ isUpdateable: () => this is Updateable;
2908
+ /** Whether is component is {@link Hideable}. */
2909
+ isHideable: () => this is Hideable;
2910
+ /** Whether is component is {@link Configurable}. */
2911
+ isConfigurable: () => this is Configurable<any>;
2912
+ }
2913
+ import * as THREE from "three";
2914
+ import CameraControls from "camera-controls";
2915
+ import { BaseWorldItem } from "./base-world-item";
2916
+ import { CameraControllable } from "./interfaces";
2917
+ /**
2918
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2919
+ */
2920
+ export declare abstract class BaseCamera extends BaseWorldItem {
2921
+ /**
2922
+ * Whether the camera is enabled or not.
2923
+ */
2924
+ abstract enabled: boolean;
2925
+ /**
3149
2926
  * The Three.js camera instance.
3150
2927
  */
3151
2928
  abstract three: THREE.Camera;
@@ -3343,97 +3120,6 @@ export declare class DataSet<T> extends Set<T> {
3343
3120
  */
3344
3121
  dispose(): void;
3345
3122
  }
3346
- import * as THREE from "three";
3347
- import { Components } from "../../Components";
3348
- import { AsyncEvent, Event, World } from "../../Types";
3349
- /**
3350
- * Settings to configure the CullerRenderer.
3351
- */
3352
- export interface CullerRendererSettings {
3353
- /**
3354
- * Interval in milliseconds at which the visibility check should be performed.
3355
- * Default value is 1000.
3356
- */
3357
- updateInterval?: number;
3358
- /**
3359
- * Width of the render target used for visibility checks.
3360
- * Default value is 512.
3361
- */
3362
- width?: number;
3363
- /**
3364
- * Height of the render target used for visibility checks.
3365
- * Default value is 512.
3366
- */
3367
- height?: number;
3368
- /**
3369
- * Whether the visibility check should be performed automatically.
3370
- * Default value is true.
3371
- */
3372
- autoUpdate?: boolean;
3373
- }
3374
- /**
3375
- * A base renderer to determine visibility on screen.
3376
- */
3377
- export declare class CullerRenderer {
3378
- /** {@link Disposable.onDisposed} */
3379
- readonly onDisposed: Event<string>;
3380
- /**
3381
- * Fires after making the visibility check to the meshes. It lists the
3382
- * meshes that are currently visible, and the ones that were visible
3383
- * just before but not anymore.
3384
- */
3385
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3386
- /**
3387
- * Whether this renderer is active or not. If not, it won't render anything.
3388
- */
3389
- enabled: boolean;
3390
- /**
3391
- * Needs to check whether there are objects that need to be hidden or shown.
3392
- * You can bind this to the camera movement, to a certain interval, etc.
3393
- */
3394
- needsUpdate: boolean;
3395
- /**
3396
- * Render the internal scene used to determine the object visibility. Used
3397
- * for debugging purposes.
3398
- */
3399
- renderDebugFrame: boolean;
3400
- /** The components instance to which this renderer belongs. */
3401
- components: Components;
3402
- /** The world instance to which this renderer belongs. */
3403
- readonly world: World;
3404
- /** The THREE.js renderer used to make the visibility test. */
3405
- readonly renderer: THREE.WebGLRenderer;
3406
- protected autoUpdate: boolean;
3407
- protected updateInterval: number;
3408
- protected readonly worker: Worker;
3409
- protected readonly scene: THREE.Scene;
3410
- private _width;
3411
- private _height;
3412
- private _availableColor;
3413
- private readonly renderTarget;
3414
- private readonly bufferSize;
3415
- private readonly _buffer;
3416
- protected _isWorkerBusy: boolean;
3417
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3418
- /** {@link Disposable.dispose} */
3419
- dispose(): void;
3420
- /**
3421
- * The function that the culler uses to reprocess the scene. Generally it's
3422
- * better to call needsUpdate, but you can also call this to force it.
3423
- * @param force if true, it will refresh the scene even if needsUpdate is
3424
- * not true.
3425
- */
3426
- updateVisibility: (force?: boolean) => Promise<void>;
3427
- protected getAvailableColor(): {
3428
- r: number;
3429
- g: number;
3430
- b: number;
3431
- code: string;
3432
- };
3433
- protected increaseColor(): void;
3434
- protected decreaseColor(): void;
3435
- private applySettings;
3436
- }
3437
3123
  import { Event } from "./event";
3438
3124
  /**
3439
3125
  * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
@@ -3506,71 +3192,6 @@ export declare class DataMap<K, V> extends Map<K, V> {
3506
3192
  dispose(): void;
3507
3193
  }
3508
3194
  import * as THREE from "three";
3509
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3510
- import { Components } from "../../Components";
3511
- import { Event, World, Disposable } from "../../Types";
3512
- /**
3513
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3514
- */
3515
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3516
- /**
3517
- * Event triggered when the visibility of meshes is updated.
3518
- * Contains two sets: seen and unseen.
3519
- */
3520
- readonly onViewUpdated: Event<{
3521
- seen: Set<THREE.Mesh>;
3522
- unseen: Set<THREE.Mesh>;
3523
- }>;
3524
- /**
3525
- * Pixels in screen a geometry must occupy to be considered "seen".
3526
- * Default value is 100.
3527
- */
3528
- threshold: number;
3529
- /**
3530
- * Map of color code to THREE.InstancedMesh.
3531
- * Used to keep track of color-coded meshes.
3532
- */
3533
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3534
- /**
3535
- * Flag to indicate if the renderer is currently processing.
3536
- * Used to prevent concurrent processing.
3537
- */
3538
- isProcessing: boolean;
3539
- private _colorCodeMeshMap;
3540
- private _meshIDColorCodeMap;
3541
- private _currentVisibleMeshes;
3542
- private _recentlyHiddenMeshes;
3543
- private _intervalID;
3544
- private readonly _transparentMat;
3545
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3546
- /** {@link Disposable.dispose} */
3547
- dispose(): void;
3548
- /**
3549
- * 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.
3550
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3551
- * @returns {void}
3552
- */
3553
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3554
- /**
3555
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3556
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3557
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3558
- * @returns {void}
3559
- */
3560
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3561
- /**
3562
- * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
3563
- *
3564
- * @param meshes - The meshes to update.
3565
- *
3566
- * @returns {void}
3567
- */
3568
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
3569
- private handleWorkerMessage;
3570
- private getAvailableMaterial;
3571
- }
3572
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3573
- import * as THREE from "three";
3574
3195
  import { Disposable, Event } from "../../Types";
3575
3196
  /**
3576
3197
  * 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.
@@ -3593,6 +3214,22 @@ export declare class Mouse implements Disposable {
3593
3214
  private updateMouseInfo;
3594
3215
  private setupEvents;
3595
3216
  }
3217
+ import { NavigationMode } from "./types";
3218
+ import { OrthoPerspectiveCamera } from "../index";
3219
+ /**
3220
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3221
+ */
3222
+ export declare class FirstPersonMode implements NavigationMode {
3223
+ private camera;
3224
+ /** {@link NavigationMode.enabled} */
3225
+ enabled: boolean;
3226
+ /** {@link NavigationMode.id} */
3227
+ readonly id = "FirstPerson";
3228
+ constructor(camera: OrthoPerspectiveCamera);
3229
+ /** {@link NavigationMode.set} */
3230
+ set(active: boolean): void;
3231
+ private setupFirstPersonCamera;
3232
+ }
3596
3233
  import * as THREE from "three";
3597
3234
  import { Components } from "../../Components";
3598
3235
  import { Event, World, Disposable } from "../../Types";
@@ -3623,106 +3260,436 @@ export declare class SimpleRaycaster implements Disposable {
3623
3260
  /** {@link Disposable.dispose} */
3624
3261
  dispose(): void;
3625
3262
  /**
3626
- * Throws a ray from the camera to the mouse or touch event point and returns
3627
- * the first item found. This also takes into account the clipping planes
3628
- * used by the renderer.
3629
- *
3630
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3631
- * to query. If not provided, it will query all the meshes stored in
3632
- * {@link Components.meshes}.
3263
+ * Throws a ray from the camera to the mouse or touch event point and returns
3264
+ * the first item found. This also takes into account the clipping planes
3265
+ * used by the renderer.
3266
+ *
3267
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3268
+ * to query. If not provided, it will query all the meshes stored in
3269
+ * {@link Components.meshes}.
3270
+ */
3271
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3272
+ /**
3273
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3274
+ * This method also takes into account the clipping planes used by the renderer.
3275
+ *
3276
+ * @param origin - The origin of the ray.
3277
+ * @param direction - The direction of the ray.
3278
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3279
+ * @returns The first intersection found or 'null' if no intersection was found.
3280
+ */
3281
+ 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;
3282
+ private intersect;
3283
+ private filterClippingPlanes;
3284
+ }
3285
+ import { NavigationMode } from "./types";
3286
+ import { OrthoPerspectiveCamera } from "../index";
3287
+ /**
3288
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3289
+ */
3290
+ export declare class PlanMode implements NavigationMode {
3291
+ private camera;
3292
+ /** {@link NavigationMode.enabled} */
3293
+ enabled: boolean;
3294
+ /** {@link NavigationMode.id} */
3295
+ readonly id = "Plan";
3296
+ private mouseAction1?;
3297
+ private mouseAction2?;
3298
+ private mouseInitialized;
3299
+ private readonly defaultAzimuthSpeed;
3300
+ private readonly defaultPolarSpeed;
3301
+ constructor(camera: OrthoPerspectiveCamera);
3302
+ /** {@link NavigationMode.set} */
3303
+ set(active: boolean): void;
3304
+ }
3305
+ import { NavigationMode } from "./types";
3306
+ import { OrthoPerspectiveCamera } from "../index";
3307
+ /**
3308
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3309
+ */
3310
+ export declare class OrbitMode implements NavigationMode {
3311
+ camera: OrthoPerspectiveCamera;
3312
+ /** {@link NavigationMode.enabled} */
3313
+ enabled: boolean;
3314
+ /** {@link NavigationMode.id} */
3315
+ readonly id = "Orbit";
3316
+ constructor(camera: OrthoPerspectiveCamera);
3317
+ /** {@link NavigationMode.set} */
3318
+ set(active: boolean): void;
3319
+ private activateOrbitControls;
3320
+ }
3321
+ import * as THREE from "three";
3322
+ import { CameraProjection } from "./types";
3323
+ import { Event } from "../../Types";
3324
+ import { OrthoPerspectiveCamera } from "../index";
3325
+ /**
3326
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3327
+ */
3328
+ export declare class ProjectionManager {
3329
+ /**
3330
+ * Event that fires when the {@link CameraProjection} changes.
3331
+ */
3332
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3333
+ /**
3334
+ * Current projection mode of the camera.
3335
+ * Default is "Perspective".
3336
+ */
3337
+ current: CameraProjection;
3338
+ /**
3339
+ * The camera controlled by this ProjectionManager.
3340
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3341
+ */
3342
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3343
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3344
+ matchOrthoDistanceEnabled: boolean;
3345
+ private _component;
3346
+ private _previousDistance;
3347
+ constructor(camera: OrthoPerspectiveCamera);
3348
+ /**
3349
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3350
+ *
3351
+ * @param projection - the new projection to set. If it is the current projection,
3352
+ * it will have no effect.
3353
+ */
3354
+ set(projection: CameraProjection): Promise<void>;
3355
+ /**
3356
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3357
+ * and vice versa.
3358
+ */
3359
+ toggle(): Promise<void>;
3360
+ private setOrthoCamera;
3361
+ private getPerspectiveDims;
3362
+ private setupOrthoCamera;
3363
+ private getDistance;
3364
+ private setPerspectiveCamera;
3365
+ }
3366
+ import { SimplePlane } from "../../Clipper";
3367
+ import { DataSet } from "../../Types";
3368
+ export interface ViewpointCamera {
3369
+ direction: {
3370
+ x: number;
3371
+ y: number;
3372
+ z: number;
3373
+ };
3374
+ position: {
3375
+ x: number;
3376
+ y: number;
3377
+ z: number;
3378
+ };
3379
+ aspectRatio: number;
3380
+ }
3381
+ export interface ViewpointPerspectiveCamera extends ViewpointCamera {
3382
+ fov: number;
3383
+ }
3384
+ export interface ViewpointOrthographicCamera extends ViewpointCamera {
3385
+ viewToWorldScale: number;
3386
+ }
3387
+ export interface BCFViewpoint {
3388
+ title?: string;
3389
+ guid: string;
3390
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3391
+ selectionComponents: Iterable<string>;
3392
+ exceptionComponents: Iterable<string>;
3393
+ clippingPlanes: DataSet<SimplePlane>;
3394
+ spacesVisible: boolean;
3395
+ spaceBoundariesVisible: boolean;
3396
+ openingsVisible: boolean;
3397
+ defaultVisibility: boolean;
3398
+ }
3399
+ /**
3400
+ * The projection system of the camera.
3401
+ */
3402
+ export type CameraProjection = "Perspective" | "Orthographic";
3403
+ /**
3404
+ * The extensible list of supported navigation modes.
3405
+ */
3406
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3407
+ /**
3408
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3409
+ */
3410
+ export interface NavigationMode {
3411
+ /** The unique ID of this navigation mode. */
3412
+ id: NavModeID;
3413
+ /**
3414
+ * Enable or disable this navigation mode.
3415
+ * When a new navigation mode is enabled, the previous navigation mode
3416
+ * must be disabled.
3417
+ *
3418
+ * @param active - whether to enable or disable this mode.
3419
+ * @param options - any additional data required to enable or disable it.
3420
+ * */
3421
+ set: (active: boolean, options?: any) => void;
3422
+ /** Whether this navigation mode is active or not. */
3423
+ enabled: boolean;
3424
+ }
3425
+ import * as THREE from "three";
3426
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3427
+ /**
3428
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3429
+ *
3430
+ * @template T - The type of the scene. Default is BaseScene.
3431
+ * @template U - The type of the camera. Default is BaseCamera.
3432
+ * @template S - The type of the renderer. Default is BaseRenderer.
3433
+ */
3434
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3435
+ /**
3436
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3437
+ */
3438
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3439
+ /** {@link Updateable.onAfterUpdate} */
3440
+ readonly onAfterUpdate: Event<unknown>;
3441
+ /** {@link Updateable.onBeforeUpdate} */
3442
+ readonly onBeforeUpdate: Event<unknown>;
3443
+ /** {@link Disposable.onDisposed} */
3444
+ readonly onDisposed: Event<unknown>;
3445
+ /**
3446
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3447
+ */
3448
+ isDisposing: boolean;
3449
+ /**
3450
+ * Indicates whether the world is currently enabled.
3451
+ * When disabled, the world will not be updated.
3452
+ */
3453
+ enabled: boolean;
3454
+ /**
3455
+ * A unique identifier for the world.
3456
+ */
3457
+ uuid: string;
3458
+ /**
3459
+ * An optional name for the world.
3460
+ */
3461
+ name?: string;
3462
+ private _scene?;
3463
+ private _camera?;
3464
+ private _renderer;
3465
+ /**
3466
+ * Getter for the scene. If no scene is initialized, it throws an error.
3467
+ * @returns The current scene.
3468
+ */
3469
+ get scene(): T;
3470
+ /**
3471
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3472
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3473
+ * @param scene - The new scene to be set.
3474
+ */
3475
+ set scene(scene: T);
3476
+ /**
3477
+ * Getter for the camera. If no camera is initialized, it throws an error.
3478
+ * @returns The current camera.
3479
+ */
3480
+ get camera(): U;
3481
+ /**
3482
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3483
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3484
+ * @param camera - The new camera to be set.
3485
+ */
3486
+ set camera(camera: U);
3487
+ /**
3488
+ * Getter for the renderer.
3489
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3490
+ */
3491
+ get renderer(): S | null;
3492
+ /**
3493
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3494
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3495
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3496
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3497
+ */
3498
+ set renderer(renderer: S | null);
3499
+ /** {@link Updateable.update} */
3500
+ update(delta?: number): void;
3501
+ /** {@link Disposable.dispose} */
3502
+ dispose(disposeResources?: boolean): void;
3503
+ }
3504
+ import * as THREE from "three";
3505
+ import * as FRAGS from "@thatopen/fragments";
3506
+ import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
3507
+ import { CameraProjection } from "../../OrthoPerspectiveCamera";
3508
+ import { Components } from "../../Components";
3509
+ import { DataMap, DataSet, World } from "../../Types";
3510
+ import { SimplePlane } from "../../Clipper";
3511
+ export declare class Viewpoint implements BCFViewpoint {
3512
+ title?: string;
3513
+ guid: string;
3514
+ /**
3515
+ * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
3516
+ * Each clipping plane is defined by Location and Direction.
3517
+ * The Direction vector points in the invisible direction meaning the half-space that is clipped.
3518
+ */
3519
+ clippingPlanes: DataSet<SimplePlane>;
3520
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3521
+ /**
3522
+ * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
3523
+ */
3524
+ readonly exceptionComponents: DataSet<string>;
3525
+ /**
3526
+ * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
3527
+ */
3528
+ readonly selectionComponents: DataSet<string>;
3529
+ /**
3530
+ * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
3531
+ * For this to work, call viewpoint.colorize()
3532
+ */
3533
+ readonly componentColors: DataMap<string, string[]>;
3534
+ /**
3535
+ * Boolean flags to allow fine control over the visibility of spaces.
3536
+ * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
3537
+ * @default false
3538
+ */
3539
+ spacesVisible: boolean;
3540
+ /**
3541
+ * Boolean flags to allow fine control over the visibility of space boundaries.
3542
+ * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
3543
+ * @default false
3544
+ */
3545
+ spaceBoundariesVisible: boolean;
3546
+ /**
3547
+ * Boolean flags to allow fine control over the visibility of openings.
3548
+ * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
3549
+ * @default false
3550
+ */
3551
+ openingsVisible: boolean;
3552
+ /**
3553
+ * When true, all components should be visible unless listed in the exceptions
3554
+ * When false all components should be invisible unless listed in the exceptions
3555
+ */
3556
+ defaultVisibility: boolean;
3557
+ private get _selectionModelIdMap();
3558
+ private get _exceptionModelIdMap();
3559
+ /**
3560
+ * A list of components that should be selected (highlighted) when displaying a viewpoint.
3561
+ * @returns The fragmentIdMap for components marked as selections.
3562
+ */
3563
+ get selection(): FRAGS.FragmentIdMap;
3564
+ /**
3565
+ * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
3566
+ * @returns The fragmentIdMap for components marked as exceptions.
3633
3567
  */
3634
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3568
+ get exception(): FRAGS.FragmentIdMap;
3635
3569
  /**
3636
- * Casts a ray from a given origin in a given direction and returns the first item found.
3637
- * This method also takes into account the clipping planes used by the renderer.
3570
+ * Retrieves the projection type of the viewpoint's camera.
3638
3571
  *
3639
- * @param origin - The origin of the ray.
3640
- * @param direction - The direction of the ray.
3641
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3642
- * @returns The first intersection found or 'null' if no intersection was found.
3572
+ * @returns A string representing the projection type of the viewpoint's camera.
3573
+ * It can be either 'Perspective' or 'Orthographic'.
3643
3574
  */
3644
- 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;
3645
- private intersect;
3646
- private filterClippingPlanes;
3647
- }
3648
- import * as THREE from "three";
3649
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3650
- /**
3651
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3652
- *
3653
- * @template T - The type of the scene. Default is BaseScene.
3654
- * @template U - The type of the camera. Default is BaseCamera.
3655
- * @template S - The type of the renderer. Default is BaseRenderer.
3656
- */
3657
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3575
+ get projection(): CameraProjection;
3658
3576
  /**
3659
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3577
+ * Retrieves the position vector of the viewpoint's camera.
3578
+ *
3579
+ * @remarks
3580
+ * The position vector represents the camera's position in the world coordinate system.
3581
+ * The function applies the base coordinate system transformation to the position vector.
3582
+ *
3583
+ * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
3660
3584
  */
3661
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3662
- /** {@link Updateable.onAfterUpdate} */
3663
- readonly onAfterUpdate: Event<unknown>;
3664
- /** {@link Updateable.onBeforeUpdate} */
3665
- readonly onBeforeUpdate: Event<unknown>;
3666
- /** {@link Disposable.onDisposed} */
3667
- readonly onDisposed: Event<unknown>;
3585
+ get position(): THREE.Vector3;
3668
3586
  /**
3669
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3587
+ * Retrieves the direction vector of the viewpoint's camera.
3588
+ *
3589
+ * @remarks
3590
+ * The direction vector represents the direction in which the camera is pointing.
3591
+ * It is calculated by extracting the x, y, and z components from the camera's direction property.
3592
+ *
3593
+ * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
3670
3594
  */
3671
- isDisposing: boolean;
3595
+ get direction(): THREE.Vector3;
3596
+ private _components;
3672
3597
  /**
3673
- * Indicates whether the world is currently enabled.
3674
- * When disabled, the world will not be updated.
3598
+ * Represents the world in which the viewpoints are created and managed.
3675
3599
  */
3676
- enabled: boolean;
3600
+ readonly world: World;
3601
+ private get _managerVersion();
3677
3602
  /**
3678
- * A unique identifier for the world.
3603
+ * Retrieves the list of BCF topics associated with the current viewpoint.
3604
+ *
3605
+ * @remarks
3606
+ * This function retrieves the BCFTopics manager from the components,
3607
+ * then filters the list of topics to find those associated with the current viewpoint.
3608
+ *
3609
+ * @returns An array of BCF topics associated with the current viewpoint.
3679
3610
  */
3680
- uuid: string;
3611
+ get topics(): import("../../../openbim/BCFTopics").Topic[];
3612
+ constructor(components: Components, world: World, _config?: {
3613
+ data?: Partial<BCFViewpoint>;
3614
+ setCamera?: boolean;
3615
+ });
3681
3616
  /**
3682
- * An optional name for the world.
3617
+ * Adds components to the viewpoint based on the provided fragment ID map.
3618
+ *
3619
+ * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
3620
+ *
3621
+ * @returns A Promise that resolves when the components have been added to the viewpoint.
3683
3622
  */
3684
- name?: string;
3685
- private _scene?;
3686
- private _camera?;
3687
- private _renderer;
3623
+ addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
3688
3624
  /**
3689
- * Getter for the scene. If no scene is initialized, it throws an error.
3690
- * @returns The current scene.
3625
+ * Sets the properties of the viewpoint with the provided data.
3626
+ *
3627
+ * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
3628
+ *
3629
+ * @param data - An object containing the properties to be set.
3630
+ * The properties not included in the object will remain unchanged.
3631
+ *
3632
+ * @returns The viewpoint instance with the updated properties.
3691
3633
  */
3692
- get scene(): T;
3634
+ set(data: Partial<BCFViewpoint>): this;
3693
3635
  /**
3694
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3695
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3696
- * @param scene - The new scene to be set.
3636
+ * Sets the viewpoint of the camera in the world.
3637
+ *
3638
+ * @remarks
3639
+ * This function calculates the target position based on the viewpoint information.
3640
+ * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
3641
+ *
3642
+ * @param transition - Indicates whether the camera movement should have a transition effect.
3643
+ * Default value is 'true'.
3644
+ *
3645
+ * @throws An error if the world's camera does not have camera controls.
3646
+ *
3647
+ * @returns A Promise that resolves when the camera has been set.
3697
3648
  */
3698
- set scene(scene: T);
3649
+ go(transition?: boolean): Promise<void>;
3699
3650
  /**
3700
- * Getter for the camera. If no camera is initialized, it throws an error.
3701
- * @returns The current camera.
3651
+ * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
3652
+ *
3653
+ * @remarks
3654
+ * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
3655
+ * It then calculates the camera's perspective or orthographic settings based on the camera type.
3656
+ * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
3657
+ *
3658
+ * @throws An error if the world's camera does not have camera controls.
3659
+ * @throws An error if the world's renderer is not available.
3702
3660
  */
3703
- get camera(): U;
3661
+ updateCamera(): void;
3704
3662
  /**
3705
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3706
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3707
- * @param camera - The new camera to be set.
3663
+ * Applies color to the components in the viewpoint based on their GUIDs.
3664
+ *
3665
+ * This function iterates through the 'componentColors' map, retrieves the fragment IDs
3666
+ * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
3667
+ *
3668
+ * @remarks
3669
+ * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
3670
+ * The color is provided as a hexadecimal string, prefixed with a '#'.
3708
3671
  */
3709
- set camera(camera: U);
3672
+ colorize(): void;
3710
3673
  /**
3711
- * Getter for the renderer.
3712
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3674
+ * Resets the colors of all components in the viewpoint to their original color.
3675
+ * This method iterates through the 'componentColors' map, retrieves the fragment IDs
3676
+ * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
3713
3677
  */
3714
- get renderer(): S | null;
3678
+ resetColors(): void;
3679
+ private createComponentTags;
3715
3680
  /**
3716
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3717
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3718
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3719
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3681
+ * Serializes the viewpoint into a buildingSMART compliant XML string for export.
3682
+ *
3683
+ * @param version - The version of the BCF Manager to use for serialization.
3684
+ * If not provided, the current version of the manager will be used.
3685
+ *
3686
+ * @returns A Promise that resolves to an XML string representing the viewpoint.
3687
+ * The XML string follows the BCF VisualizationInfo schema.
3688
+ *
3689
+ * @throws An error if the world's camera does not have camera controls.
3690
+ * @throws An error if the world's renderer is not available.
3720
3691
  */
3721
- set renderer(renderer: S | null);
3722
- /** {@link Updateable.update} */
3723
- update(delta?: number): void;
3724
- /** {@link Disposable.dispose} */
3725
- dispose(disposeResources?: boolean): void;
3692
+ serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
3726
3693
  }
3727
3694
  import * as THREE from "three";
3728
3695
  import { BaseScene, Configurable, Event } from "../../Types";
@@ -3843,41 +3810,132 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3843
3810
  three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3844
3811
  private _allControls;
3845
3812
  /**
3846
- * The object that controls the camera. An instance of
3847
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3848
- * Transforming the camera directly will have no effect: you need to use this
3849
- * object to move, rotate, look at objects, etc.
3813
+ * The object that controls the camera. An instance of
3814
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3815
+ * Transforming the camera directly will have no effect: you need to use this
3816
+ * object to move, rotate, look at objects, etc.
3817
+ */
3818
+ get controls(): CameraControls;
3819
+ /**
3820
+ * Getter for the enabled state of the camera controls.
3821
+ * If the current world is null, it returns false.
3822
+ * Otherwise, it returns the enabled state of the camera controls.
3823
+ *
3824
+ * @returns {boolean} The enabled state of the camera controls.
3825
+ */
3826
+ get enabled(): boolean;
3827
+ /**
3828
+ * Setter for the enabled state of the camera controls.
3829
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3830
+ *
3831
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3832
+ */
3833
+ set enabled(enabled: boolean);
3834
+ constructor(components: Components);
3835
+ /** {@link Disposable.dispose} */
3836
+ dispose(): void;
3837
+ /** {@link Updateable.update} */
3838
+ update(_delta: number): void;
3839
+ /**
3840
+ * Updates the aspect of the camera to match the size of the
3841
+ * {@link Components.renderer}.
3842
+ */
3843
+ updateAspect: () => void;
3844
+ private setupCamera;
3845
+ private newCameraControls;
3846
+ private setupEvents;
3847
+ private static getSubsetOfThree;
3848
+ }
3849
+ import * as THREE from "three";
3850
+ import { Components } from "../../Components";
3851
+ import { AsyncEvent, Event, World } from "../../Types";
3852
+ /**
3853
+ * Settings to configure the CullerRenderer.
3854
+ */
3855
+ export interface CullerRendererSettings {
3856
+ /**
3857
+ * Interval in milliseconds at which the visibility check should be performed.
3858
+ * Default value is 1000.
3859
+ */
3860
+ updateInterval?: number;
3861
+ /**
3862
+ * Width of the render target used for visibility checks.
3863
+ * Default value is 512.
3864
+ */
3865
+ width?: number;
3866
+ /**
3867
+ * Height of the render target used for visibility checks.
3868
+ * Default value is 512.
3869
+ */
3870
+ height?: number;
3871
+ /**
3872
+ * Whether the visibility check should be performed automatically.
3873
+ * Default value is true.
3874
+ */
3875
+ autoUpdate?: boolean;
3876
+ }
3877
+ /**
3878
+ * A base renderer to determine visibility on screen.
3879
+ */
3880
+ export declare class CullerRenderer {
3881
+ /** {@link Disposable.onDisposed} */
3882
+ readonly onDisposed: Event<string>;
3883
+ /**
3884
+ * Fires after making the visibility check to the meshes. It lists the
3885
+ * meshes that are currently visible, and the ones that were visible
3886
+ * just before but not anymore.
3887
+ */
3888
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3889
+ /**
3890
+ * Whether this renderer is active or not. If not, it won't render anything.
3850
3891
  */
3851
- get controls(): CameraControls;
3892
+ enabled: boolean;
3852
3893
  /**
3853
- * Getter for the enabled state of the camera controls.
3854
- * If the current world is null, it returns false.
3855
- * Otherwise, it returns the enabled state of the camera controls.
3856
- *
3857
- * @returns {boolean} The enabled state of the camera controls.
3894
+ * Needs to check whether there are objects that need to be hidden or shown.
3895
+ * You can bind this to the camera movement, to a certain interval, etc.
3858
3896
  */
3859
- get enabled(): boolean;
3897
+ needsUpdate: boolean;
3860
3898
  /**
3861
- * Setter for the enabled state of the camera controls.
3862
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3863
- *
3864
- * @param {boolean} enabled - The new enabled state of the camera controls.
3899
+ * Render the internal scene used to determine the object visibility. Used
3900
+ * for debugging purposes.
3865
3901
  */
3866
- set enabled(enabled: boolean);
3867
- constructor(components: Components);
3902
+ renderDebugFrame: boolean;
3903
+ /** The components instance to which this renderer belongs. */
3904
+ components: Components;
3905
+ /** The world instance to which this renderer belongs. */
3906
+ readonly world: World;
3907
+ /** The THREE.js renderer used to make the visibility test. */
3908
+ readonly renderer: THREE.WebGLRenderer;
3909
+ protected autoUpdate: boolean;
3910
+ protected updateInterval: number;
3911
+ protected readonly worker: Worker;
3912
+ protected readonly scene: THREE.Scene;
3913
+ private _width;
3914
+ private _height;
3915
+ private _availableColor;
3916
+ private readonly renderTarget;
3917
+ private readonly bufferSize;
3918
+ private readonly _buffer;
3919
+ protected _isWorkerBusy: boolean;
3920
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3868
3921
  /** {@link Disposable.dispose} */
3869
3922
  dispose(): void;
3870
- /** {@link Updateable.update} */
3871
- update(_delta: number): void;
3872
3923
  /**
3873
- * Updates the aspect of the camera to match the size of the
3874
- * {@link Components.renderer}.
3924
+ * The function that the culler uses to reprocess the scene. Generally it's
3925
+ * better to call needsUpdate, but you can also call this to force it.
3926
+ * @param force if true, it will refresh the scene even if needsUpdate is
3927
+ * not true.
3875
3928
  */
3876
- updateAspect: () => void;
3877
- private setupCamera;
3878
- private newCameraControls;
3879
- private setupEvents;
3880
- private static getSubsetOfThree;
3929
+ updateVisibility: (force?: boolean) => Promise<void>;
3930
+ protected getAvailableColor(): {
3931
+ r: number;
3932
+ g: number;
3933
+ b: number;
3934
+ code: string;
3935
+ };
3936
+ protected increaseColor(): void;
3937
+ protected decreaseColor(): void;
3938
+ private applySettings;
3881
3939
  }
3882
3940
  import * as THREE from "three";
3883
3941
  import { Event, World } from "../../Types";
@@ -3946,128 +4004,70 @@ export declare class DistanceRenderer {
3946
4004
  compute: () => Promise<void>;
3947
4005
  private handleWorkerMessage;
3948
4006
  }
3949
- import { NavigationMode } from "./types";
3950
- import { OrthoPerspectiveCamera } from "../index";
3951
- /**
3952
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3953
- */
3954
- export declare class OrbitMode implements NavigationMode {
3955
- camera: OrthoPerspectiveCamera;
3956
- /** {@link NavigationMode.enabled} */
3957
- enabled: boolean;
3958
- /** {@link NavigationMode.id} */
3959
- readonly id = "Orbit";
3960
- constructor(camera: OrthoPerspectiveCamera);
3961
- /** {@link NavigationMode.set} */
3962
- set(active: boolean): void;
3963
- private activateOrbitControls;
3964
- }
3965
- import { NavigationMode } from "./types";
3966
- import { OrthoPerspectiveCamera } from "../index";
3967
- /**
3968
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3969
- */
3970
- export declare class FirstPersonMode implements NavigationMode {
3971
- private camera;
3972
- /** {@link NavigationMode.enabled} */
3973
- enabled: boolean;
3974
- /** {@link NavigationMode.id} */
3975
- readonly id = "FirstPerson";
3976
- constructor(camera: OrthoPerspectiveCamera);
3977
- /** {@link NavigationMode.set} */
3978
- set(active: boolean): void;
3979
- private setupFirstPersonCamera;
3980
- }
3981
- import { NavigationMode } from "./types";
3982
- import { OrthoPerspectiveCamera } from "../index";
3983
- /**
3984
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3985
- */
3986
- export declare class PlanMode implements NavigationMode {
3987
- private camera;
3988
- /** {@link NavigationMode.enabled} */
3989
- enabled: boolean;
3990
- /** {@link NavigationMode.id} */
3991
- readonly id = "Plan";
3992
- private mouseAction1?;
3993
- private mouseAction2?;
3994
- private mouseInitialized;
3995
- private readonly defaultAzimuthSpeed;
3996
- private readonly defaultPolarSpeed;
3997
- constructor(camera: OrthoPerspectiveCamera);
3998
- /** {@link NavigationMode.set} */
3999
- set(active: boolean): void;
4000
- }
4001
- /**
4002
- * The projection system of the camera.
4003
- */
4004
- export type CameraProjection = "Perspective" | "Orthographic";
4005
- /**
4006
- * The extensible list of supported navigation modes.
4007
- */
4008
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
4009
- /**
4010
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
4011
- */
4012
- export interface NavigationMode {
4013
- /** The unique ID of this navigation mode. */
4014
- id: NavModeID;
4015
- /**
4016
- * Enable or disable this navigation mode.
4017
- * When a new navigation mode is enabled, the previous navigation mode
4018
- * must be disabled.
4019
- *
4020
- * @param active - whether to enable or disable this mode.
4021
- * @param options - any additional data required to enable or disable it.
4022
- * */
4023
- set: (active: boolean, options?: any) => void;
4024
- /** Whether this navigation mode is active or not. */
4025
- enabled: boolean;
4026
- }
4007
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
4027
4008
  import * as THREE from "three";
4028
- import { CameraProjection } from "./types";
4029
- import { Event } from "../../Types";
4030
- import { OrthoPerspectiveCamera } from "../index";
4009
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
4010
+ import { Components } from "../../Components";
4011
+ import { Event, World, Disposable } from "../../Types";
4031
4012
  /**
4032
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4013
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
4033
4014
  */
4034
- export declare class ProjectionManager {
4015
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
4035
4016
  /**
4036
- * Event that fires when the {@link CameraProjection} changes.
4017
+ * Event triggered when the visibility of meshes is updated.
4018
+ * Contains two sets: seen and unseen.
4037
4019
  */
4038
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
4020
+ readonly onViewUpdated: Event<{
4021
+ seen: Set<THREE.Mesh>;
4022
+ unseen: Set<THREE.Mesh>;
4023
+ }>;
4039
4024
  /**
4040
- * Current projection mode of the camera.
4041
- * Default is "Perspective".
4025
+ * Pixels in screen a geometry must occupy to be considered "seen".
4026
+ * Default value is 100.
4042
4027
  */
4043
- current: CameraProjection;
4028
+ threshold: number;
4044
4029
  /**
4045
- * The camera controlled by this ProjectionManager.
4046
- * It can be either a PerspectiveCamera or an OrthographicCamera.
4030
+ * Map of color code to THREE.InstancedMesh.
4031
+ * Used to keep track of color-coded meshes.
4047
4032
  */
4048
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
4049
- /** Match Ortho zoom with Perspective distance when changing projection mode */
4050
- matchOrthoDistanceEnabled: boolean;
4051
- private _component;
4052
- private _previousDistance;
4053
- constructor(camera: OrthoPerspectiveCamera);
4033
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
4054
4034
  /**
4055
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4056
- *
4057
- * @param projection - the new projection to set. If it is the current projection,
4058
- * it will have no effect.
4035
+ * Flag to indicate if the renderer is currently processing.
4036
+ * Used to prevent concurrent processing.
4059
4037
  */
4060
- set(projection: CameraProjection): Promise<void>;
4038
+ isProcessing: boolean;
4039
+ private _colorCodeMeshMap;
4040
+ private _meshIDColorCodeMap;
4041
+ private _currentVisibleMeshes;
4042
+ private _recentlyHiddenMeshes;
4043
+ private _intervalID;
4044
+ private readonly _transparentMat;
4045
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
4046
+ /** {@link Disposable.dispose} */
4047
+ dispose(): void;
4061
4048
  /**
4062
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
4063
- * and vice versa.
4049
+ * 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.
4050
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
4051
+ * @returns {void}
4064
4052
  */
4065
- toggle(): Promise<void>;
4066
- private setOrthoCamera;
4067
- private getPerspectiveDims;
4068
- private setupOrthoCamera;
4069
- private getDistance;
4070
- private setPerspectiveCamera;
4053
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
4054
+ /**
4055
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
4056
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
4057
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
4058
+ * @returns {void}
4059
+ */
4060
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
4061
+ /**
4062
+ * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
4063
+ *
4064
+ * @param meshes - The meshes to update.
4065
+ *
4066
+ * @returns {void}
4067
+ */
4068
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
4069
+ private handleWorkerMessage;
4070
+ private getAvailableMaterial;
4071
4071
  }
4072
4072
  import * as THREE from "three";
4073
4073
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -4413,6 +4413,16 @@ export declare class IfcMetadataReader {
4413
4413
  getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4414
4414
  getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4415
4415
  }
4416
+ import * as WEBIFC from "web-ifc";
4417
+ import * as THREE from "three";
4418
+ export declare class Units {
4419
+ factor: number;
4420
+ complement: number;
4421
+ apply(matrix: THREE.Matrix4): void;
4422
+ setUp(webIfc: WEBIFC.IfcAPI): void;
4423
+ private getLengthUnits;
4424
+ private getScaleMatrix;
4425
+ }
4416
4426
  import { IfcFragmentSettings } from "../../IfcLoader/src";
4417
4427
  /**
4418
4428
  * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
@@ -4458,23 +4468,8 @@ export interface StreamedAsset {
4458
4468
  color: number[];
4459
4469
  }[];
4460
4470
  }
4461
- import * as WEBIFC from "web-ifc";
4462
- import * as THREE from "three";
4463
- export declare class Units {
4464
- factor: number;
4465
- complement: number;
4466
- apply(matrix: THREE.Matrix4): void;
4467
- setUp(webIfc: WEBIFC.IfcAPI): void;
4468
- private getLengthUnits;
4469
- private getScaleMatrix;
4470
- }
4471
4471
  import { BCFTopics } from "../..";
4472
4472
  export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void;
4473
- import { BufferGeometry } from "three";
4474
- import * as THREE from "three";
4475
- export declare class TransformHelper {
4476
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
4477
- }
4478
4473
  import * as WEBIFC from "web-ifc";
4479
4474
  export type RelationsMap = Map<number, Map<number, number[]>>;
4480
4475
  export interface ModelsRelationMap {
@@ -4546,6 +4541,11 @@ export type IfcRelations = [
4546
4541
  typeof WEBIFC.IFCRELNESTS
4547
4542
  ];
4548
4543
  export type IfcRelation = IfcRelations[number];
4544
+ import { BufferGeometry } from "three";
4545
+ import * as THREE from "three";
4546
+ export declare class TransformHelper {
4547
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
4548
+ }
4549
4549
  import * as WEBIFC from "web-ifc";
4550
4550
  import { IfcSchema } from "@thatopen/fragments";
4551
4551
  import { IfcRelName } from "./types";