@thatopen/components 2.1.4 → 2.1.5
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.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/namespace.d.ts +1721 -1721
- package/package.json +1 -1
package/dist/namespace.d.ts
CHANGED
|
@@ -1,46 +1,4 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
-
import { Component, Disposable, World, Event } from "../Types";
|
|
3
|
-
import { SimpleRaycaster } from "./src";
|
|
4
|
-
import { Components } from "../Components";
|
|
5
|
-
/**
|
|
6
|
-
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
7
|
-
*/
|
|
8
|
-
export declare class Raycasters extends Component implements Disposable {
|
|
9
|
-
/**
|
|
10
|
-
* A unique identifier for the component.
|
|
11
|
-
* This UUID is used to register the component within the Components system.
|
|
12
|
-
*/
|
|
13
|
-
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
14
|
-
/** {@link Component.enabled} */
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* A Map that stores raycasters for each world.
|
|
18
|
-
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
19
|
-
*/
|
|
20
|
-
list: Map<string, SimpleRaycaster>;
|
|
21
|
-
/** {@link Disposable.onDisposed} */
|
|
22
|
-
onDisposed: Event<unknown>;
|
|
23
|
-
constructor(components: Components);
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves a SimpleRaycaster instance for the given world.
|
|
26
|
-
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
27
|
-
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
28
|
-
*
|
|
29
|
-
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
30
|
-
* @returns The SimpleRaycaster instance for the given world.
|
|
31
|
-
*/
|
|
32
|
-
get(world: World): SimpleRaycaster;
|
|
33
|
-
/**
|
|
34
|
-
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
35
|
-
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
36
|
-
*
|
|
37
|
-
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
38
|
-
* @returns {void}
|
|
39
|
-
*/
|
|
40
|
-
delete(world: World): void;
|
|
41
|
-
/** {@link Disposable.dispose} */
|
|
42
|
-
dispose(): void;
|
|
43
|
-
}
|
|
44
2
|
import { Component, Disposable, Event } from "../Types";
|
|
45
3
|
/**
|
|
46
4
|
* The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
|
|
@@ -49,7 +7,7 @@ export declare class Components implements Disposable {
|
|
|
49
7
|
/**
|
|
50
8
|
* The version of the @thatopen/components library.
|
|
51
9
|
*/
|
|
52
|
-
static readonly release = "2.1.
|
|
10
|
+
static readonly release = "2.1.5";
|
|
53
11
|
/** {@link Disposable.onDisposed} */
|
|
54
12
|
readonly onDisposed: Event<void>;
|
|
55
13
|
/**
|
|
@@ -117,6 +75,48 @@ export declare class Components implements Disposable {
|
|
|
117
75
|
private update;
|
|
118
76
|
private static setupBVH;
|
|
119
77
|
}
|
|
78
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
79
|
+
import { SimpleRaycaster } from "./src";
|
|
80
|
+
import { Components } from "../Components";
|
|
81
|
+
/**
|
|
82
|
+
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
83
|
+
*/
|
|
84
|
+
export declare class Raycasters extends Component implements Disposable {
|
|
85
|
+
/**
|
|
86
|
+
* A unique identifier for the component.
|
|
87
|
+
* This UUID is used to register the component within the Components system.
|
|
88
|
+
*/
|
|
89
|
+
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
90
|
+
/** {@link Component.enabled} */
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* A Map that stores raycasters for each world.
|
|
94
|
+
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
95
|
+
*/
|
|
96
|
+
list: Map<string, SimpleRaycaster>;
|
|
97
|
+
/** {@link Disposable.onDisposed} */
|
|
98
|
+
onDisposed: Event<unknown>;
|
|
99
|
+
constructor(components: Components);
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves a SimpleRaycaster instance for the given world.
|
|
102
|
+
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
103
|
+
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
104
|
+
*
|
|
105
|
+
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
106
|
+
* @returns The SimpleRaycaster instance for the given world.
|
|
107
|
+
*/
|
|
108
|
+
get(world: World): SimpleRaycaster;
|
|
109
|
+
/**
|
|
110
|
+
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
111
|
+
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
112
|
+
*
|
|
113
|
+
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
114
|
+
* @returns {void}
|
|
115
|
+
*/
|
|
116
|
+
delete(world: World): void;
|
|
117
|
+
/** {@link Disposable.dispose} */
|
|
118
|
+
dispose(): void;
|
|
119
|
+
}
|
|
120
120
|
import * as THREE from "three";
|
|
121
121
|
import { Components } from "../Components";
|
|
122
122
|
import { Component } from "../Types";
|
|
@@ -409,53 +409,6 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
409
409
|
private _onStartDragging;
|
|
410
410
|
private _onEndDragging;
|
|
411
411
|
}
|
|
412
|
-
import { MiniMap } from "./src";
|
|
413
|
-
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
414
|
-
import { Components } from "../Components";
|
|
415
|
-
/**
|
|
416
|
-
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
417
|
-
*/
|
|
418
|
-
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
419
|
-
/**
|
|
420
|
-
* A unique identifier for the component.
|
|
421
|
-
* This UUID is used to register the component within the Components system.
|
|
422
|
-
*/
|
|
423
|
-
static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
|
|
424
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
425
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
426
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
427
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
428
|
-
/** {@link Disposable.onDisposed} */
|
|
429
|
-
readonly onDisposed: Event<unknown>;
|
|
430
|
-
/** {@link Component.enabled} */
|
|
431
|
-
enabled: boolean;
|
|
432
|
-
/**
|
|
433
|
-
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
434
|
-
*/
|
|
435
|
-
list: Map<string, MiniMap>;
|
|
436
|
-
constructor(components: Components);
|
|
437
|
-
/**
|
|
438
|
-
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
439
|
-
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
440
|
-
*
|
|
441
|
-
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
442
|
-
* @returns The newly created {@link MiniMap} instance.
|
|
443
|
-
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
444
|
-
*/
|
|
445
|
-
create(world: World): MiniMap;
|
|
446
|
-
/**
|
|
447
|
-
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
448
|
-
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
449
|
-
*
|
|
450
|
-
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
451
|
-
* @returns {void}
|
|
452
|
-
*/
|
|
453
|
-
delete(id: string): void;
|
|
454
|
-
/** {@link Disposable.dispose} */
|
|
455
|
-
dispose(): void;
|
|
456
|
-
/** {@link Updateable.update} */
|
|
457
|
-
update(): void;
|
|
458
|
-
}
|
|
459
412
|
import { Components } from "../Components";
|
|
460
413
|
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
461
414
|
import { Component, Event, Disposable, World } from "../Types";
|
|
@@ -504,6 +457,53 @@ export declare class Cullers extends Component implements Disposable {
|
|
|
504
457
|
/** {@link Disposable.dispose} */
|
|
505
458
|
dispose(): void;
|
|
506
459
|
}
|
|
460
|
+
import { MiniMap } from "./src";
|
|
461
|
+
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
462
|
+
import { Components } from "../Components";
|
|
463
|
+
/**
|
|
464
|
+
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
465
|
+
*/
|
|
466
|
+
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
467
|
+
/**
|
|
468
|
+
* A unique identifier for the component.
|
|
469
|
+
* This UUID is used to register the component within the Components system.
|
|
470
|
+
*/
|
|
471
|
+
static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
|
|
472
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
473
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
474
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
475
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
476
|
+
/** {@link Disposable.onDisposed} */
|
|
477
|
+
readonly onDisposed: Event<unknown>;
|
|
478
|
+
/** {@link Component.enabled} */
|
|
479
|
+
enabled: boolean;
|
|
480
|
+
/**
|
|
481
|
+
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
482
|
+
*/
|
|
483
|
+
list: Map<string, MiniMap>;
|
|
484
|
+
constructor(components: Components);
|
|
485
|
+
/**
|
|
486
|
+
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
487
|
+
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
488
|
+
*
|
|
489
|
+
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
490
|
+
* @returns The newly created {@link MiniMap} instance.
|
|
491
|
+
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
492
|
+
*/
|
|
493
|
+
create(world: World): MiniMap;
|
|
494
|
+
/**
|
|
495
|
+
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
496
|
+
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
497
|
+
*
|
|
498
|
+
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
499
|
+
* @returns {void}
|
|
500
|
+
*/
|
|
501
|
+
delete(id: string): void;
|
|
502
|
+
/** {@link Disposable.dispose} */
|
|
503
|
+
dispose(): void;
|
|
504
|
+
/** {@link Updateable.update} */
|
|
505
|
+
update(): void;
|
|
506
|
+
}
|
|
507
507
|
import * as THREE from "three";
|
|
508
508
|
import { Components } from "../Components";
|
|
509
509
|
import { SimpleCamera } from "..";
|
|
@@ -568,1009 +568,966 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
568
568
|
private newOrthoCamera;
|
|
569
569
|
private setOrthoPerspCameraAspect;
|
|
570
570
|
}
|
|
571
|
-
import * as THREE from "three";
|
|
572
571
|
import * as FRAGS from "@thatopen/fragments";
|
|
573
|
-
import {
|
|
574
|
-
/**
|
|
575
|
-
* Represents an edge measurement result.
|
|
576
|
-
*/
|
|
577
|
-
export interface MeasureEdge {
|
|
578
|
-
/**
|
|
579
|
-
* The distance between the two points of the edge.
|
|
580
|
-
*/
|
|
581
|
-
distance: number;
|
|
582
|
-
/**
|
|
583
|
-
* The two points that define the edge.
|
|
584
|
-
*/
|
|
585
|
-
points: THREE.Vector3[];
|
|
586
|
-
}
|
|
572
|
+
import { Components, Component } from "../../core";
|
|
587
573
|
/**
|
|
588
|
-
*
|
|
574
|
+
* A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
|
|
589
575
|
*/
|
|
590
|
-
export declare class
|
|
576
|
+
export declare class Hider extends Component {
|
|
591
577
|
/**
|
|
592
578
|
* A unique identifier for the component.
|
|
593
579
|
* This UUID is used to register the component within the Components system.
|
|
594
580
|
*/
|
|
595
|
-
static uuid:
|
|
581
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
596
582
|
/** {@link Component.enabled} */
|
|
597
583
|
enabled: boolean;
|
|
598
584
|
constructor(components: Components);
|
|
599
585
|
/**
|
|
600
|
-
*
|
|
586
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
587
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
588
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
601
589
|
*
|
|
602
|
-
* @param
|
|
603
|
-
* @param
|
|
604
|
-
*
|
|
605
|
-
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
606
|
-
* @returns The distance from the point to the line segment.
|
|
607
|
-
*/
|
|
608
|
-
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
609
|
-
/**
|
|
610
|
-
* Method to get the face of a mesh that contains a given triangle index.
|
|
611
|
-
* It also returns the edges of the found face and their indices.
|
|
590
|
+
* @param visible - The visibility state to set for the fragments.
|
|
591
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
592
|
+
* If not provided, all fragments will be affected.
|
|
612
593
|
*
|
|
613
|
-
* @
|
|
614
|
-
* @param triangleIndex - The index of the triangle within the mesh.
|
|
615
|
-
* @param instance - The instance of the mesh (optional).
|
|
616
|
-
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
594
|
+
* @returns {void}
|
|
617
595
|
*/
|
|
618
|
-
|
|
619
|
-
edges: MeasureEdge[];
|
|
620
|
-
indices: Set<number>;
|
|
621
|
-
} | null;
|
|
596
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
622
597
|
/**
|
|
623
|
-
*
|
|
624
|
-
* It
|
|
598
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
599
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
625
600
|
*
|
|
626
|
-
* @param
|
|
627
|
-
*
|
|
628
|
-
* @param instance - The instance of the mesh (optional).
|
|
629
|
-
* @returns An object containing the vertices and normal of the face.
|
|
630
|
-
* @throws Will throw an error if the geometry is not indexed.
|
|
631
|
-
*/
|
|
632
|
-
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
633
|
-
p1: THREE.Vector3;
|
|
634
|
-
p2: THREE.Vector3;
|
|
635
|
-
p3: THREE.Vector3;
|
|
636
|
-
faceNormal: THREE.Vector3;
|
|
637
|
-
};
|
|
638
|
-
/**
|
|
639
|
-
* Method to round the vector's components to a specified number of decimal places.
|
|
640
|
-
* This is used to ensure numerical precision in edge detection.
|
|
601
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
602
|
+
* If not provided, all fragments will be isolated.
|
|
641
603
|
*
|
|
642
|
-
* @
|
|
643
|
-
* @returns The vector with rounded components.
|
|
604
|
+
* @returns {void}
|
|
644
605
|
*/
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
* Calculates the volume of a set of fragments.
|
|
648
|
-
*
|
|
649
|
-
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
650
|
-
* @returns The total volume of the fragments and the bounding sphere.
|
|
651
|
-
*
|
|
652
|
-
* @remarks
|
|
653
|
-
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
654
|
-
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
655
|
-
*
|
|
656
|
-
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
657
|
-
* @throws Will throw an error if the fragment manager is not available.
|
|
658
|
-
*/
|
|
659
|
-
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
660
|
-
/**
|
|
661
|
-
* Calculates the total volume of a set of meshes.
|
|
662
|
-
*
|
|
663
|
-
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
664
|
-
* @returns The total volume of the meshes and the bounding sphere.
|
|
665
|
-
*
|
|
666
|
-
* @remarks
|
|
667
|
-
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
668
|
-
* and its bounding sphere.
|
|
669
|
-
*
|
|
670
|
-
*/
|
|
671
|
-
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
672
|
-
private getFaceData;
|
|
673
|
-
private getVolumeOfMesh;
|
|
674
|
-
private getSignedVolumeOfTriangle;
|
|
675
|
-
}
|
|
676
|
-
import * as WEBIFC from "web-ifc";
|
|
677
|
-
import * as FRAG from "@thatopen/fragments";
|
|
678
|
-
import { Component, Components } from "../../core";
|
|
679
|
-
/**
|
|
680
|
-
* 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).
|
|
681
|
-
*/
|
|
682
|
-
export declare class IfcJsonExporter extends Component {
|
|
683
|
-
/**
|
|
684
|
-
* A unique identifier for the component.
|
|
685
|
-
* This UUID is used to register the component within the Components system.
|
|
686
|
-
*/
|
|
687
|
-
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
688
|
-
/** {@link Component.enabled} */
|
|
689
|
-
enabled: boolean;
|
|
690
|
-
constructor(components: Components);
|
|
691
|
-
/**
|
|
692
|
-
* Exports all the properties of an IFC into an array of JS objects.
|
|
693
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
694
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
695
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
696
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
697
|
-
* to make the location data available (e.g. absolute position of building).
|
|
698
|
-
*/
|
|
699
|
-
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
606
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
607
|
+
private updateCulledVisibility;
|
|
700
608
|
}
|
|
701
|
-
import * as
|
|
609
|
+
import * as THREE from "three";
|
|
610
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
702
611
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
703
|
-
import { Component, Disposable, Event
|
|
704
|
-
/**
|
|
705
|
-
* Types for boolean properties in IFC schema.
|
|
706
|
-
*/
|
|
707
|
-
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
708
|
-
/**
|
|
709
|
-
* Types for string properties in IFC schema.
|
|
710
|
-
*/
|
|
711
|
-
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
712
|
-
/**
|
|
713
|
-
* Types for numeric properties in IFC schema.
|
|
714
|
-
*/
|
|
715
|
-
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
716
|
-
/**
|
|
717
|
-
* Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
|
|
718
|
-
*/
|
|
719
|
-
export interface ChangeMap {
|
|
720
|
-
[modelID: string]: Set<number>;
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
|
|
724
|
-
*/
|
|
725
|
-
export interface AttributeListener {
|
|
726
|
-
[modelID: string]: {
|
|
727
|
-
[expressID: number]: {
|
|
728
|
-
[attributeName: string]: Event<String | Boolean | Number>;
|
|
729
|
-
};
|
|
730
|
-
};
|
|
731
|
-
}
|
|
612
|
+
import { Component, Components, Disposable, Event } from "../../core";
|
|
732
613
|
/**
|
|
733
|
-
*
|
|
614
|
+
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
734
615
|
*/
|
|
735
|
-
export declare class
|
|
736
|
-
|
|
737
|
-
* A unique identifier for the component.
|
|
738
|
-
* This UUID is used to register the component within the Components system.
|
|
739
|
-
*/
|
|
740
|
-
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
741
|
-
/** {@link Disposable.onDisposed} */
|
|
742
|
-
readonly onDisposed: Event<string>;
|
|
743
|
-
/**
|
|
744
|
-
* Event triggered when a file is requested for export.
|
|
745
|
-
*/
|
|
746
|
-
readonly onRequestFile: Event<unknown>;
|
|
747
|
-
/**
|
|
748
|
-
* ArrayBuffer containing the IFC data to be exported.
|
|
749
|
-
*/
|
|
750
|
-
ifcToExport: ArrayBuffer | null;
|
|
751
|
-
/**
|
|
752
|
-
* Event triggered when an element is added to a Pset.
|
|
753
|
-
*/
|
|
754
|
-
readonly onElementToPset: Event<{
|
|
755
|
-
model: FragmentsGroup;
|
|
756
|
-
psetID: number;
|
|
757
|
-
elementID: number;
|
|
758
|
-
}>;
|
|
759
|
-
/**
|
|
760
|
-
* Event triggered when a property is added to a Pset.
|
|
761
|
-
*/
|
|
762
|
-
readonly onPropToPset: Event<{
|
|
763
|
-
model: FragmentsGroup;
|
|
764
|
-
psetID: number;
|
|
765
|
-
propID: number;
|
|
766
|
-
}>;
|
|
767
|
-
/**
|
|
768
|
-
* Event triggered when a Pset is removed.
|
|
769
|
-
*/
|
|
770
|
-
readonly onPsetRemoved: Event<{
|
|
771
|
-
model: FragmentsGroup;
|
|
772
|
-
psetID: number;
|
|
773
|
-
}>;
|
|
774
|
-
/**
|
|
775
|
-
* Event triggered when data in the model changes.
|
|
776
|
-
*/
|
|
777
|
-
readonly onDataChanged: Event<{
|
|
778
|
-
model: FragmentsGroup;
|
|
779
|
-
expressID: number;
|
|
780
|
-
}>;
|
|
781
|
-
/**
|
|
782
|
-
* Configuration for the WebAssembly module.
|
|
783
|
-
*/
|
|
784
|
-
wasm: {
|
|
785
|
-
path: string;
|
|
786
|
-
absolute: boolean;
|
|
787
|
-
};
|
|
616
|
+
export declare class BoundingBoxer extends Component implements Disposable {
|
|
617
|
+
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
788
618
|
/** {@link Component.enabled} */
|
|
789
619
|
enabled: boolean;
|
|
790
|
-
/**
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
* The currently selected model.
|
|
796
|
-
*/
|
|
797
|
-
selectedModel?: FragmentsGroup;
|
|
798
|
-
/**
|
|
799
|
-
* Map of changed entities in the model.
|
|
800
|
-
*/
|
|
801
|
-
changeMap: ChangeMap;
|
|
620
|
+
/** {@link Disposable.onDisposed} */
|
|
621
|
+
readonly onDisposed: Event<unknown>;
|
|
622
|
+
private _absoluteMin;
|
|
623
|
+
private _absoluteMax;
|
|
624
|
+
private _meshes;
|
|
802
625
|
constructor(components: Components);
|
|
803
|
-
/** {@link Disposable.dispose} */
|
|
804
|
-
dispose(): void;
|
|
805
626
|
/**
|
|
806
|
-
*
|
|
627
|
+
* A static method to calculate the dimensions of a given bounding box.
|
|
807
628
|
*
|
|
808
|
-
* @param
|
|
809
|
-
* @
|
|
810
|
-
* @returns The IFC schema associated with the given model.
|
|
629
|
+
* @param bbox - The bounding box to calculate the dimensions for.
|
|
630
|
+
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
811
631
|
*/
|
|
812
|
-
static
|
|
632
|
+
static getDimensions(bbox: THREE.Box3): {
|
|
633
|
+
width: number;
|
|
634
|
+
height: number;
|
|
635
|
+
depth: number;
|
|
636
|
+
center: THREE.Vector3;
|
|
637
|
+
};
|
|
813
638
|
/**
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
* @param model - The FragmentsGroup model in which to set the properties.
|
|
817
|
-
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
818
|
-
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
819
|
-
* The rest of the properties will be set as the properties of the entity.
|
|
820
|
-
*
|
|
821
|
-
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
639
|
+
* A static method to create a new bounding box boundary.
|
|
822
640
|
*
|
|
823
|
-
* @
|
|
824
|
-
|
|
825
|
-
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
826
|
-
/**
|
|
827
|
-
* Creates a new Property Set (Pset) in the given model.
|
|
641
|
+
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
642
|
+
* @returns A new THREE.Vector3 representing the boundary.
|
|
828
643
|
*
|
|
829
|
-
* @
|
|
830
|
-
*
|
|
831
|
-
*
|
|
644
|
+
* @remarks
|
|
645
|
+
* This method is used to create a new boundary for calculating bounding boxes.
|
|
646
|
+
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
647
|
+
* depending on the value of the 'positive' parameter.
|
|
832
648
|
*
|
|
833
|
-
* @
|
|
649
|
+
* @example
|
|
650
|
+
* '''typescript
|
|
651
|
+
* const positiveBound = BoundingBoxer.newBound(true);
|
|
652
|
+
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
834
653
|
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
654
|
+
* const negativeBound = BoundingBoxer.newBound(false);
|
|
655
|
+
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
656
|
+
* '''
|
|
837
657
|
*/
|
|
838
|
-
|
|
839
|
-
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
840
|
-
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
841
|
-
}>;
|
|
658
|
+
static newBound(positive: boolean): THREE.Vector3;
|
|
842
659
|
/**
|
|
843
|
-
*
|
|
660
|
+
* A static method to calculate the bounding box of a set of points.
|
|
844
661
|
*
|
|
845
|
-
* @param
|
|
846
|
-
* @param
|
|
662
|
+
* @param points - An array of THREE.Vector3 representing the points.
|
|
663
|
+
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
664
|
+
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
665
|
+
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
847
666
|
*
|
|
848
|
-
* @
|
|
667
|
+
* @remarks
|
|
668
|
+
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
669
|
+
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
849
670
|
*
|
|
850
|
-
* @
|
|
851
|
-
*
|
|
852
|
-
*
|
|
671
|
+
* @example
|
|
672
|
+
* '''typescript
|
|
673
|
+
* const points = [
|
|
674
|
+
* new THREE.Vector3(1, 2, 3),
|
|
675
|
+
* new THREE.Vector3(4, 5, 6),
|
|
676
|
+
* new THREE.Vector3(7, 8, 9),
|
|
677
|
+
* ];
|
|
678
|
+
*
|
|
679
|
+
* const bbox = BoundingBoxer.getBounds(points);
|
|
680
|
+
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
681
|
+
* '''
|
|
853
682
|
*/
|
|
854
|
-
|
|
683
|
+
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
684
|
+
/** {@link Disposable.dispose} */
|
|
685
|
+
dispose(): void;
|
|
855
686
|
/**
|
|
856
|
-
*
|
|
687
|
+
* Returns the bounding box of the calculated fragments.
|
|
857
688
|
*
|
|
858
|
-
* @
|
|
859
|
-
* @param type - The type of the property value. Must be a string property type.
|
|
860
|
-
* @param name - The name of the property.
|
|
861
|
-
* @param value - The value of the property. Must be a string.
|
|
689
|
+
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
862
690
|
*
|
|
863
|
-
* @
|
|
691
|
+
* @remarks
|
|
692
|
+
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
693
|
+
* The returned box represents the bounding box of the calculated fragments.
|
|
864
694
|
*
|
|
865
|
-
* @
|
|
866
|
-
*
|
|
695
|
+
* @example
|
|
696
|
+
* '''typescript
|
|
697
|
+
* const boundingBox = boundingBoxer.get();
|
|
698
|
+
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
699
|
+
* '''
|
|
867
700
|
*/
|
|
868
|
-
|
|
701
|
+
get(): THREE.Box3;
|
|
869
702
|
/**
|
|
870
|
-
*
|
|
703
|
+
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
871
704
|
*
|
|
872
|
-
* @
|
|
873
|
-
* @param type - The type of the property value. Must be a numeric property type.
|
|
874
|
-
* @param name - The name of the property.
|
|
875
|
-
* @param value - The value of the property. Must be a number.
|
|
705
|
+
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
876
706
|
*
|
|
877
|
-
* @
|
|
707
|
+
* @remarks
|
|
708
|
+
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
709
|
+
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
710
|
+
* The radius is calculated as the distance from the center to the minimum bound.
|
|
878
711
|
*
|
|
879
|
-
* @
|
|
880
|
-
*
|
|
712
|
+
* @example
|
|
713
|
+
* '''typescript
|
|
714
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
715
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
716
|
+
* const boundingSphere = boundingBoxer.getSphere();
|
|
717
|
+
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
718
|
+
* '''
|
|
881
719
|
*/
|
|
882
|
-
|
|
720
|
+
getSphere(): THREE.Sphere;
|
|
883
721
|
/**
|
|
884
|
-
*
|
|
722
|
+
* Returns a THREE.Mesh instance representing the bounding box.
|
|
885
723
|
*
|
|
886
|
-
* @
|
|
887
|
-
* @param type - The type of the property value. Must be a boolean property type.
|
|
888
|
-
* @param name - The name of the property.
|
|
889
|
-
* @param value - The value of the property. Must be a boolean.
|
|
724
|
+
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
890
725
|
*
|
|
891
|
-
* @
|
|
726
|
+
* @remarks
|
|
727
|
+
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
728
|
+
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
729
|
+
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
730
|
+
* The position of the mesh is set to the center of the bounding box.
|
|
892
731
|
*
|
|
893
|
-
* @
|
|
894
|
-
*
|
|
732
|
+
* @example
|
|
733
|
+
* '''typescript
|
|
734
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
735
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
736
|
+
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
737
|
+
* scene.add(boundingBoxMesh);
|
|
738
|
+
* '''
|
|
895
739
|
*/
|
|
896
|
-
|
|
740
|
+
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
897
741
|
/**
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
* @param model - The FragmentsGroup model from which to remove the property.
|
|
901
|
-
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
902
|
-
* @param propID - The express ID of the property to be removed.
|
|
742
|
+
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
743
|
+
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
903
744
|
*
|
|
904
|
-
* @
|
|
745
|
+
* @remarks
|
|
746
|
+
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
747
|
+
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
905
748
|
*
|
|
906
|
-
* @
|
|
907
|
-
*
|
|
749
|
+
* @example
|
|
750
|
+
* '''typescript
|
|
751
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
752
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
753
|
+
* // ...
|
|
754
|
+
* boundingBoxer.reset();
|
|
755
|
+
* '''
|
|
908
756
|
*/
|
|
909
|
-
|
|
910
|
-
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
757
|
+
reset(): void;
|
|
911
758
|
/**
|
|
912
|
-
* Adds
|
|
759
|
+
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
913
760
|
*
|
|
914
|
-
* @param
|
|
915
|
-
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
916
|
-
* @param elementID - The express IDs of the elements to be added.
|
|
761
|
+
* @param group - The FragmentsGroup to add.
|
|
917
762
|
*
|
|
918
|
-
* @
|
|
763
|
+
* @remarks
|
|
764
|
+
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
765
|
+
* and calls the 'addMesh' method for each fragment's mesh.
|
|
919
766
|
*
|
|
920
|
-
* @
|
|
921
|
-
*
|
|
922
|
-
*
|
|
767
|
+
* @example
|
|
768
|
+
* '''typescript
|
|
769
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
770
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
771
|
+
* '''
|
|
923
772
|
*/
|
|
924
|
-
|
|
773
|
+
add(group: FragmentsGroup): void;
|
|
925
774
|
/**
|
|
926
|
-
*
|
|
775
|
+
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
927
776
|
*
|
|
928
|
-
* @param
|
|
929
|
-
* @param
|
|
777
|
+
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
778
|
+
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
930
779
|
*
|
|
931
|
-
* @
|
|
780
|
+
* @remarks
|
|
781
|
+
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
782
|
+
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
783
|
+
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
932
784
|
*
|
|
933
|
-
* @
|
|
785
|
+
* @example
|
|
786
|
+
* '''typescript
|
|
787
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
788
|
+
* boundingBoxer.addMesh(mesh);
|
|
789
|
+
* '''
|
|
934
790
|
*/
|
|
935
|
-
|
|
791
|
+
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
936
792
|
/**
|
|
937
|
-
*
|
|
938
|
-
* The listener will trigger an event whenever the attribute's value changes.
|
|
793
|
+
* Uses a FragmentIdMap to add its meshes to the bb calculation.
|
|
939
794
|
*
|
|
940
|
-
*
|
|
941
|
-
*
|
|
942
|
-
* @param attributeName - The name of the attribute for which to set the listener.
|
|
795
|
+
* This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
|
|
796
|
+
* and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
|
|
943
797
|
*
|
|
944
|
-
* @
|
|
798
|
+
* @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
|
|
945
799
|
*
|
|
946
|
-
* @
|
|
947
|
-
*
|
|
948
|
-
*
|
|
800
|
+
* @remarks
|
|
801
|
+
* This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
|
|
802
|
+
* It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* '''typescript
|
|
806
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
807
|
+
* const fragmentIdMap: FRAGS.FragmentIdMap = {
|
|
808
|
+
* '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
|
|
809
|
+
* '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
|
|
810
|
+
* };
|
|
811
|
+
* boundingBoxer.addFragmentIdMap(fragmentIdMap);
|
|
812
|
+
* '''
|
|
949
813
|
*/
|
|
950
|
-
|
|
951
|
-
private
|
|
952
|
-
private newGUID;
|
|
953
|
-
private getOwnerHistory;
|
|
954
|
-
private registerChange;
|
|
955
|
-
private newSingleProperty;
|
|
814
|
+
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
815
|
+
private static getFragmentBounds;
|
|
956
816
|
}
|
|
957
|
-
import * as
|
|
958
|
-
import
|
|
959
|
-
import { Disposable,
|
|
960
|
-
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
961
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
817
|
+
import * as THREE from "three";
|
|
818
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
819
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
962
820
|
/**
|
|
963
|
-
*
|
|
821
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
964
822
|
*/
|
|
965
|
-
export
|
|
966
|
-
/**
|
|
967
|
-
* A unique identifier for the component.
|
|
968
|
-
* This UUID is used to register the component within the Components system.
|
|
969
|
-
*/
|
|
970
|
-
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
971
|
-
/** {@link Disposable.onDisposed} */
|
|
972
|
-
readonly onDisposed: Event<string>;
|
|
823
|
+
export interface Classification {
|
|
973
824
|
/**
|
|
974
|
-
*
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
978
|
-
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
979
|
-
* 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.
|
|
825
|
+
* A system within the classification.
|
|
826
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
980
827
|
*/
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
828
|
+
[system: string]: {
|
|
829
|
+
/**
|
|
830
|
+
* A class within the system.
|
|
831
|
+
* The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
|
|
832
|
+
*/
|
|
833
|
+
[className: string]: {
|
|
834
|
+
map: FRAGS.FragmentIdMap;
|
|
835
|
+
name: string;
|
|
836
|
+
id: number | null;
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
|
|
842
|
+
*/
|
|
843
|
+
export declare class Classifier extends Component implements Disposable {
|
|
985
844
|
/**
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
989
|
-
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
990
|
-
* that are related through that relation type. This structure allows for efficient querying
|
|
991
|
-
* of entity relationships within a model.
|
|
845
|
+
* A unique identifier for the component.
|
|
846
|
+
* This UUID is used to register the component within the Components system.
|
|
992
847
|
*/
|
|
993
|
-
readonly
|
|
848
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
994
849
|
/** {@link Component.enabled} */
|
|
995
850
|
enabled: boolean;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
851
|
+
/**
|
|
852
|
+
* A map representing the classification systems.
|
|
853
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
854
|
+
*/
|
|
855
|
+
list: Classification;
|
|
856
|
+
/** {@link Disposable.onDisposed} */
|
|
857
|
+
readonly onDisposed: Event<unknown>;
|
|
999
858
|
constructor(components: Components);
|
|
1000
859
|
private onFragmentsDisposed;
|
|
1001
|
-
|
|
860
|
+
/** {@link Disposable.dispose} */
|
|
861
|
+
dispose(): void;
|
|
1002
862
|
/**
|
|
1003
|
-
*
|
|
1004
|
-
*
|
|
1005
|
-
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
1006
|
-
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
863
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
864
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
1007
865
|
*
|
|
1008
|
-
* @
|
|
866
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
1009
867
|
*/
|
|
1010
|
-
|
|
868
|
+
remove(guid: string): void;
|
|
1011
869
|
/**
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
870
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
871
|
+
* If no filter is provided, it returns all fragments.
|
|
1015
872
|
*
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
* and
|
|
1019
|
-
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1020
|
-
* of entities that are related through that attribute.
|
|
873
|
+
* @param filter - An optional object containing filter criteria.
|
|
874
|
+
* The keys of the object represent the classification system names,
|
|
875
|
+
* and the values are arrays of class names to match.
|
|
1021
876
|
*
|
|
1022
|
-
* @
|
|
1023
|
-
*
|
|
1024
|
-
* representation of the relations indexed by entity expressIDs and relation types.
|
|
1025
|
-
* @throws An error if the model does not have properties loaded.
|
|
1026
|
-
*/
|
|
1027
|
-
process(model: FragmentsGroup): Promise<RelationsMap>;
|
|
1028
|
-
/**
|
|
1029
|
-
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
877
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
878
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
1030
879
|
*
|
|
1031
|
-
* @
|
|
1032
|
-
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1033
|
-
* @returns A promise that resolves to the relations map for the processed model.
|
|
1034
|
-
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
880
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
1035
881
|
*/
|
|
1036
|
-
|
|
882
|
+
find(filter?: {
|
|
883
|
+
[name: string]: string[];
|
|
884
|
+
}): FRAGS.FragmentIdMap;
|
|
1037
885
|
/**
|
|
1038
|
-
*
|
|
1039
|
-
* This method searches the indexed relation maps for the specified model and entity,
|
|
1040
|
-
* returning the IDs of related entities if a match is found.
|
|
886
|
+
* Classifies fragments based on their modelID.
|
|
1041
887
|
*
|
|
1042
|
-
* @param
|
|
1043
|
-
* @param
|
|
1044
|
-
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1045
|
-
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1046
|
-
* or the specified relation name is not indexed.
|
|
1047
|
-
*/
|
|
1048
|
-
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
|
|
1049
|
-
/**
|
|
1050
|
-
* Serializes the relations of a given relation map into a JSON string.
|
|
1051
|
-
* This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
|
|
1052
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1053
|
-
* The resulting object is then serialized into a JSON string.
|
|
888
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
889
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1054
890
|
*
|
|
1055
|
-
* @
|
|
1056
|
-
*
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
* Serializes the relations of a specific model into a JSON string.
|
|
1061
|
-
* This method iterates through the relations indexed for the given model,
|
|
1062
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1063
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1064
|
-
* The resulting object is then serialized into a JSON string.
|
|
891
|
+
* @remarks
|
|
892
|
+
* This method iterates through the fragments in the provided group,
|
|
893
|
+
* and classifies them based on their modelID.
|
|
894
|
+
* The classification is stored in the 'list.models' property,
|
|
895
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1065
896
|
*
|
|
1066
|
-
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1067
|
-
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1068
|
-
* If the model has no indexed relations, 'null' is returned.
|
|
1069
897
|
*/
|
|
1070
|
-
|
|
898
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
1071
899
|
/**
|
|
1072
|
-
*
|
|
1073
|
-
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
1074
|
-
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1075
|
-
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1076
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
900
|
+
* Classifies fragments based on their PredefinedType property.
|
|
1077
901
|
*
|
|
1078
|
-
* @
|
|
1079
|
-
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
1080
|
-
*/
|
|
1081
|
-
serializeAllRelations(): string;
|
|
1082
|
-
/**
|
|
1083
|
-
* Converts a JSON string representing relations between entities into a structured map.
|
|
1084
|
-
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
1085
|
-
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1086
|
-
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1087
|
-
* of express IDs of entities related through that relation type.
|
|
902
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1088
903
|
*
|
|
1089
|
-
* @
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
904
|
+
* @remarks
|
|
905
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
906
|
+
* and classifies them based on their PredefinedType property.
|
|
907
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
908
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
909
|
+
*
|
|
910
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
1093
911
|
*/
|
|
1094
|
-
|
|
1095
|
-
/** {@link Disposable.dispose} */
|
|
1096
|
-
dispose(): void;
|
|
912
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
1097
913
|
/**
|
|
1098
|
-
*
|
|
914
|
+
* Classifies fragments based on their entity type.
|
|
1099
915
|
*
|
|
1100
|
-
* @param
|
|
1101
|
-
* @param id The expressID of the item whose children to get.
|
|
1102
|
-
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
916
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1103
917
|
*
|
|
1104
|
-
* @
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1110
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1111
|
-
import { Component, Components, Disposable, Event } from "../../core";
|
|
1112
|
-
/**
|
|
1113
|
-
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
1114
|
-
*/
|
|
1115
|
-
export declare class BoundingBoxer extends Component implements Disposable {
|
|
1116
|
-
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
1117
|
-
/** {@link Component.enabled} */
|
|
1118
|
-
enabled: boolean;
|
|
1119
|
-
/** {@link Disposable.onDisposed} */
|
|
1120
|
-
readonly onDisposed: Event<unknown>;
|
|
1121
|
-
private _absoluteMin;
|
|
1122
|
-
private _absoluteMax;
|
|
1123
|
-
private _meshes;
|
|
1124
|
-
constructor(components: Components);
|
|
1125
|
-
/**
|
|
1126
|
-
* A static method to calculate the dimensions of a given bounding box.
|
|
918
|
+
* @remarks
|
|
919
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
920
|
+
* and classifies them based on their entity type.
|
|
921
|
+
* The classification is stored in the 'list.entities' property,
|
|
922
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1127
923
|
*
|
|
1128
|
-
* @
|
|
1129
|
-
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
924
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
1130
925
|
*/
|
|
1131
|
-
|
|
1132
|
-
width: number;
|
|
1133
|
-
height: number;
|
|
1134
|
-
depth: number;
|
|
1135
|
-
center: THREE.Vector3;
|
|
1136
|
-
};
|
|
926
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
1137
927
|
/**
|
|
1138
|
-
*
|
|
928
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
1139
929
|
*
|
|
1140
|
-
* @param
|
|
1141
|
-
* @
|
|
930
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
931
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
932
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
1142
933
|
*
|
|
1143
934
|
* @remarks
|
|
1144
|
-
* This method
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
*
|
|
1148
|
-
* @example
|
|
1149
|
-
* '''typescript
|
|
1150
|
-
* const positiveBound = BoundingBoxer.newBound(true);
|
|
1151
|
-
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
935
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
936
|
+
* and classifies them based on the specified IFC relationship.
|
|
937
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
938
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1152
939
|
*
|
|
1153
|
-
*
|
|
1154
|
-
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
1155
|
-
* '''
|
|
940
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
1156
941
|
*/
|
|
1157
|
-
|
|
942
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
1158
943
|
/**
|
|
1159
|
-
*
|
|
944
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
1160
945
|
*
|
|
1161
|
-
* @param
|
|
1162
|
-
* @param
|
|
1163
|
-
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
1164
|
-
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
946
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
947
|
+
* @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
|
|
1165
948
|
*
|
|
1166
949
|
* @remarks
|
|
1167
|
-
* This method
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1171
|
-
* '''typescript
|
|
1172
|
-
* const points = [
|
|
1173
|
-
* new THREE.Vector3(1, 2, 3),
|
|
1174
|
-
* new THREE.Vector3(4, 5, 6),
|
|
1175
|
-
* new THREE.Vector3(7, 8, 9),
|
|
1176
|
-
* ];
|
|
950
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
951
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
952
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
953
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1177
954
|
*
|
|
1178
|
-
*
|
|
1179
|
-
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
1180
|
-
* '''
|
|
955
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
1181
956
|
*/
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
957
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
|
|
958
|
+
useProperties: boolean;
|
|
959
|
+
}): Promise<void>;
|
|
1185
960
|
/**
|
|
1186
|
-
*
|
|
961
|
+
* Sets the color of the specified fragments.
|
|
1187
962
|
*
|
|
1188
|
-
* @
|
|
963
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
964
|
+
* @param color - The color to set for the fragments.
|
|
965
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
1189
966
|
*
|
|
1190
967
|
* @remarks
|
|
1191
|
-
* This method
|
|
1192
|
-
*
|
|
968
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
969
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
1193
970
|
*
|
|
1194
|
-
* @
|
|
1195
|
-
* '''typescript
|
|
1196
|
-
* const boundingBox = boundingBoxer.get();
|
|
1197
|
-
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
1198
|
-
* '''
|
|
971
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1199
972
|
*/
|
|
1200
|
-
|
|
973
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
1201
974
|
/**
|
|
1202
|
-
*
|
|
975
|
+
* Resets the color of the specified fragments to their original color.
|
|
1203
976
|
*
|
|
1204
|
-
* @
|
|
977
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
1205
978
|
*
|
|
1206
979
|
* @remarks
|
|
1207
|
-
* This method
|
|
1208
|
-
*
|
|
1209
|
-
* The radius is calculated as the distance from the center to the minimum bound.
|
|
980
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
981
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
1210
982
|
*
|
|
1211
|
-
* @
|
|
1212
|
-
* '''typescript
|
|
1213
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1214
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
1215
|
-
* const boundingSphere = boundingBoxer.getSphere();
|
|
1216
|
-
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
1217
|
-
* '''
|
|
983
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1218
984
|
*/
|
|
1219
|
-
|
|
985
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
986
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
987
|
+
}
|
|
988
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
989
|
+
/**
|
|
990
|
+
* The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
|
|
991
|
+
*/
|
|
992
|
+
export declare class Exploder extends Component implements Disposable {
|
|
1220
993
|
/**
|
|
1221
|
-
*
|
|
994
|
+
* A unique identifier for the component.
|
|
995
|
+
* This UUID is used to register the component within the Components system.
|
|
996
|
+
*/
|
|
997
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
998
|
+
/** {@link Disposable.onDisposed} */
|
|
999
|
+
readonly onDisposed: Event<unknown>;
|
|
1000
|
+
/** {@link Component.enabled} */
|
|
1001
|
+
enabled: boolean;
|
|
1002
|
+
/**
|
|
1003
|
+
* The height of the explosion animation.
|
|
1004
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1005
|
+
* Default value is 10.
|
|
1006
|
+
*/
|
|
1007
|
+
height: number;
|
|
1008
|
+
/**
|
|
1009
|
+
* The group name used for the explosion animation.
|
|
1010
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1011
|
+
* Default value is "storeys".
|
|
1012
|
+
*/
|
|
1013
|
+
groupName: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* A set of strings representing the exploded items.
|
|
1016
|
+
* This set is used to keep track of which items have been exploded.
|
|
1017
|
+
*/
|
|
1018
|
+
list: Set<string>;
|
|
1019
|
+
constructor(components: Components);
|
|
1020
|
+
/** {@link Disposable.dispose} */
|
|
1021
|
+
dispose(): void;
|
|
1022
|
+
/**
|
|
1023
|
+
* Sets the explosion state of the fragments.
|
|
1222
1024
|
*
|
|
1223
|
-
* @
|
|
1025
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
1224
1026
|
*
|
|
1225
1027
|
* @remarks
|
|
1226
|
-
* This method
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
* The position of the mesh is set to the center of the bounding box.
|
|
1028
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
1029
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1030
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
1230
1031
|
*
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
1235
|
-
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
1236
|
-
* scene.add(boundingBoxMesh);
|
|
1237
|
-
* '''
|
|
1032
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
1033
|
+
*
|
|
1034
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
1238
1035
|
*/
|
|
1239
|
-
|
|
1036
|
+
set(active: boolean): void;
|
|
1037
|
+
}
|
|
1038
|
+
import * as WEBIFC from "web-ifc";
|
|
1039
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1040
|
+
import { IfcFragmentSettings } from "./src";
|
|
1041
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1042
|
+
/**
|
|
1043
|
+
* 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).
|
|
1044
|
+
*/
|
|
1045
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
1240
1046
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
* This
|
|
1047
|
+
* A unique identifier for the component.
|
|
1048
|
+
* This UUID is used to register the component within the Components system.
|
|
1049
|
+
*/
|
|
1050
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1051
|
+
/** {@link Disposable.onDisposed} */
|
|
1052
|
+
readonly onDisposed: Event<string>;
|
|
1053
|
+
/**
|
|
1054
|
+
* An event triggered when the IFC file starts loading.
|
|
1055
|
+
*/
|
|
1056
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1057
|
+
/**
|
|
1058
|
+
* An event triggered when the setup process is completed.
|
|
1059
|
+
*/
|
|
1060
|
+
readonly onSetup: Event<void>;
|
|
1061
|
+
/**
|
|
1062
|
+
* The settings for the IfcLoader.
|
|
1063
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1064
|
+
*/
|
|
1065
|
+
settings: IfcFragmentSettings;
|
|
1066
|
+
/**
|
|
1067
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
1068
|
+
*/
|
|
1069
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1070
|
+
/** {@link Component.enabled} */
|
|
1071
|
+
enabled: boolean;
|
|
1072
|
+
private _material;
|
|
1073
|
+
private _spatialTree;
|
|
1074
|
+
private _metaData;
|
|
1075
|
+
private _fragmentInstances;
|
|
1076
|
+
private _civil;
|
|
1077
|
+
private _visitedFragments;
|
|
1078
|
+
private _materialT;
|
|
1079
|
+
constructor(components: Components);
|
|
1080
|
+
/** {@link Disposable.dispose} */
|
|
1081
|
+
dispose(): void;
|
|
1082
|
+
/**
|
|
1083
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
1084
|
+
*
|
|
1085
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
1086
|
+
* If not provided, the existing settings will be used.
|
|
1087
|
+
*
|
|
1088
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
1243
1089
|
*
|
|
1244
1090
|
* @remarks
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1091
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1092
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
1247
1093
|
*
|
|
1248
1094
|
* @example
|
|
1249
1095
|
* '''typescript
|
|
1250
|
-
* const
|
|
1251
|
-
*
|
|
1252
|
-
* // ...
|
|
1253
|
-
* boundingBoxer.reset();
|
|
1096
|
+
* const ifcLoader = new IfcLoader(components);
|
|
1097
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1254
1098
|
* '''
|
|
1255
1099
|
*/
|
|
1256
|
-
|
|
1100
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
1257
1101
|
/**
|
|
1258
|
-
*
|
|
1102
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
1259
1103
|
*
|
|
1260
|
-
* @param
|
|
1104
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1105
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
1261
1106
|
*
|
|
1262
|
-
* @
|
|
1263
|
-
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
1264
|
-
* and calls the 'addMesh' method for each fragment's mesh.
|
|
1107
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
1265
1108
|
*
|
|
1266
1109
|
* @example
|
|
1267
1110
|
* '''typescript
|
|
1268
|
-
* const
|
|
1269
|
-
*
|
|
1111
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1112
|
+
* const group = await ifcLoader.load(ifcData);
|
|
1270
1113
|
* '''
|
|
1271
1114
|
*/
|
|
1272
|
-
|
|
1115
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
1273
1116
|
/**
|
|
1274
|
-
*
|
|
1117
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
1275
1118
|
*
|
|
1276
|
-
* @param
|
|
1277
|
-
*
|
|
1119
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1120
|
+
*
|
|
1121
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
1278
1122
|
*
|
|
1279
1123
|
* @remarks
|
|
1280
|
-
* This method
|
|
1281
|
-
*
|
|
1282
|
-
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
1124
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1125
|
+
* It also opens the IFC model using the provided data and settings.
|
|
1283
1126
|
*
|
|
1284
1127
|
* @example
|
|
1285
1128
|
* '''typescript
|
|
1286
|
-
* const
|
|
1287
|
-
*
|
|
1129
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1130
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
1288
1131
|
* '''
|
|
1289
1132
|
*/
|
|
1290
|
-
|
|
1133
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
1291
1134
|
/**
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1294
|
-
* This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
|
|
1295
|
-
* and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
|
|
1296
|
-
*
|
|
1297
|
-
* @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
|
|
1135
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
1136
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1298
1137
|
*
|
|
1299
1138
|
* @remarks
|
|
1300
|
-
* This method is
|
|
1301
|
-
* It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
|
|
1139
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
1302
1140
|
*
|
|
1303
1141
|
* @example
|
|
1304
1142
|
* '''typescript
|
|
1305
|
-
* const
|
|
1306
|
-
*
|
|
1307
|
-
* '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
|
|
1308
|
-
* '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
|
|
1309
|
-
* };
|
|
1310
|
-
* boundingBoxer.addFragmentIdMap(fragmentIdMap);
|
|
1143
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1144
|
+
* ifcLoader.cleanUp();
|
|
1311
1145
|
* '''
|
|
1312
1146
|
*/
|
|
1313
|
-
|
|
1314
|
-
private
|
|
1147
|
+
cleanUp(): void;
|
|
1148
|
+
private getAllGeometries;
|
|
1149
|
+
private getMesh;
|
|
1150
|
+
private getGeometry;
|
|
1151
|
+
private autoSetWasm;
|
|
1315
1152
|
}
|
|
1153
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1316
1154
|
import * as THREE from "three";
|
|
1317
1155
|
import * as FRAGS from "@thatopen/fragments";
|
|
1318
|
-
import {
|
|
1319
|
-
|
|
1320
|
-
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
1321
|
-
*/
|
|
1322
|
-
export interface Classification {
|
|
1323
|
-
/**
|
|
1324
|
-
* A system within the classification.
|
|
1325
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1326
|
-
*/
|
|
1327
|
-
[system: string]: {
|
|
1328
|
-
/**
|
|
1329
|
-
* A class within the system.
|
|
1330
|
-
* The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
|
|
1331
|
-
*/
|
|
1332
|
-
[className: string]: {
|
|
1333
|
-
map: FRAGS.FragmentIdMap;
|
|
1334
|
-
name: string;
|
|
1335
|
-
id: number | null;
|
|
1336
|
-
};
|
|
1337
|
-
};
|
|
1338
|
-
}
|
|
1156
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1157
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1339
1158
|
/**
|
|
1340
|
-
*
|
|
1159
|
+
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
1341
1160
|
*/
|
|
1342
|
-
export declare class
|
|
1161
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
1343
1162
|
/**
|
|
1344
1163
|
* A unique identifier for the component.
|
|
1345
1164
|
* This UUID is used to register the component within the Components system.
|
|
1346
1165
|
*/
|
|
1347
|
-
static readonly uuid: "
|
|
1166
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1167
|
+
/** {@link Disposable.onDisposed} */
|
|
1168
|
+
readonly onDisposed: Event<unknown>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Event triggered when fragments are loaded.
|
|
1171
|
+
*/
|
|
1172
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Event triggered when fragments are disposed.
|
|
1175
|
+
*/
|
|
1176
|
+
readonly onFragmentsDisposed: Event<{
|
|
1177
|
+
groupID: string;
|
|
1178
|
+
fragmentIDs: string[];
|
|
1179
|
+
}>;
|
|
1180
|
+
/**
|
|
1181
|
+
* Map containing all loaded fragments.
|
|
1182
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1183
|
+
*/
|
|
1184
|
+
readonly list: Map<string, Fragment>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Map containing all loaded fragment groups.
|
|
1187
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1188
|
+
*/
|
|
1189
|
+
readonly groups: Map<string, FragmentsGroup>;
|
|
1190
|
+
baseCoordinationModel: string;
|
|
1191
|
+
baseCoordinationMatrix: THREE.Matrix4;
|
|
1348
1192
|
/** {@link Component.enabled} */
|
|
1349
1193
|
enabled: boolean;
|
|
1194
|
+
private _loader;
|
|
1350
1195
|
/**
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1196
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1197
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1198
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1353
1199
|
*/
|
|
1354
|
-
|
|
1355
|
-
/** {@link Disposable.onDisposed} */
|
|
1356
|
-
readonly onDisposed: Event<unknown>;
|
|
1200
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1357
1201
|
constructor(components: Components);
|
|
1358
|
-
private onFragmentsDisposed;
|
|
1359
1202
|
/** {@link Disposable.dispose} */
|
|
1360
1203
|
dispose(): void;
|
|
1361
1204
|
/**
|
|
1362
|
-
*
|
|
1363
|
-
* This method
|
|
1205
|
+
* Dispose of a specific fragment group.
|
|
1206
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1207
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1364
1208
|
*
|
|
1365
|
-
* @param
|
|
1209
|
+
* @param group - The fragment group to be disposed.
|
|
1366
1210
|
*/
|
|
1367
|
-
|
|
1211
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
1368
1212
|
/**
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1372
|
-
* @param
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1375
|
-
*
|
|
1376
|
-
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
1377
|
-
* where the express IDs are filtered based on the provided filter criteria.
|
|
1378
|
-
*
|
|
1379
|
-
* @throws Will throw an error if the fragments map is malformed.
|
|
1213
|
+
* Loads a binary file that contain fragment geometry.
|
|
1214
|
+
* @param data - The binary data to load.
|
|
1215
|
+
* @param config - Optional configuration for loading.
|
|
1216
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1217
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1218
|
+
* @returns The loaded FragmentsGroup.
|
|
1380
1219
|
*/
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1220
|
+
load(data: Uint8Array, config?: Partial<{
|
|
1221
|
+
coordinate: boolean;
|
|
1222
|
+
name: string;
|
|
1223
|
+
properties: FRAGS.IfcProperties;
|
|
1224
|
+
relationsMap: RelationsMap;
|
|
1225
|
+
}>): FragmentsGroup;
|
|
1384
1226
|
/**
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
* @
|
|
1388
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1389
|
-
*
|
|
1390
|
-
* @remarks
|
|
1391
|
-
* This method iterates through the fragments in the provided group,
|
|
1392
|
-
* and classifies them based on their modelID.
|
|
1393
|
-
* The classification is stored in the 'list.models' property,
|
|
1394
|
-
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1395
|
-
*
|
|
1227
|
+
* Export the specified fragmentsgroup to binary data.
|
|
1228
|
+
* @param group - the fragments group to be exported.
|
|
1229
|
+
* @returns the exported data as binary buffer.
|
|
1396
1230
|
*/
|
|
1397
|
-
|
|
1231
|
+
export(group: FragmentsGroup): Uint8Array;
|
|
1398
1232
|
/**
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
* @
|
|
1402
|
-
*
|
|
1403
|
-
* @remarks
|
|
1404
|
-
* This method iterates through the properties of the fragments in the provided group,
|
|
1405
|
-
* and classifies them based on their PredefinedType property.
|
|
1406
|
-
* The classification is stored in the 'list.predefinedTypes' property,
|
|
1407
|
-
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1408
|
-
*
|
|
1409
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
1233
|
+
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1234
|
+
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1235
|
+
* @returns A map of model IDs to sets of express IDs.
|
|
1410
1236
|
*/
|
|
1411
|
-
|
|
1237
|
+
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1238
|
+
[modelID: string]: Set<number>;
|
|
1239
|
+
};
|
|
1412
1240
|
/**
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
* @
|
|
1416
|
-
*
|
|
1241
|
+
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1242
|
+
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1243
|
+
* @returns A fragment ID map.
|
|
1417
1244
|
* @remarks
|
|
1418
|
-
* This method iterates through the
|
|
1419
|
-
* and
|
|
1420
|
-
* The
|
|
1421
|
-
* with
|
|
1422
|
-
*
|
|
1423
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
1245
|
+
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1246
|
+
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1247
|
+
* The fragment ID maps are then merged into a single map and returned.
|
|
1248
|
+
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1424
1249
|
*/
|
|
1425
|
-
|
|
1250
|
+
modelIdToFragmentIdMap(modelIdMap: {
|
|
1251
|
+
[modelID: string]: Set<number>;
|
|
1252
|
+
}): FRAGS.FragmentIdMap;
|
|
1426
1253
|
/**
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1431
|
-
* @param systemName - The name of the classification system to store the classification.
|
|
1432
|
-
*
|
|
1433
|
-
* @remarks
|
|
1434
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1435
|
-
* and classifies them based on the specified IFC relationship.
|
|
1436
|
-
* The classification is stored in the 'list' property under the specified system name,
|
|
1437
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1254
|
+
* Applies coordinate transformation to the provided models.
|
|
1255
|
+
* If no models are provided, all groups are used.
|
|
1256
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
1257
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
1438
1258
|
*
|
|
1439
|
-
* @
|
|
1259
|
+
* @param models - The models to apply coordinate transformation to.
|
|
1260
|
+
* If not provided, all models are used.
|
|
1440
1261
|
*/
|
|
1441
|
-
|
|
1262
|
+
coordinate(models?: FragmentsGroup[]): void;
|
|
1263
|
+
}
|
|
1264
|
+
import * as WEBIFC from "web-ifc";
|
|
1265
|
+
import { Components, Disposable, Event, Component } from "../../core";
|
|
1266
|
+
import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
|
|
1267
|
+
/**
|
|
1268
|
+
* A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
|
|
1269
|
+
*/
|
|
1270
|
+
export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
1442
1271
|
/**
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
*
|
|
1449
|
-
*
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1272
|
+
* A unique identifier for the component.
|
|
1273
|
+
* This UUID is used to register the component within the Components system.
|
|
1274
|
+
*/
|
|
1275
|
+
static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
|
|
1276
|
+
/**
|
|
1277
|
+
* Event triggered when geometry is streamed.
|
|
1278
|
+
* Contains the streamed geometry data and its buffer.
|
|
1279
|
+
*/
|
|
1280
|
+
readonly onGeometryStreamed: Event<{
|
|
1281
|
+
buffer: Uint8Array;
|
|
1282
|
+
data: StreamedGeometries;
|
|
1283
|
+
}>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Event triggered when assets are streamed.
|
|
1286
|
+
* Contains the streamed assets.
|
|
1287
|
+
*/
|
|
1288
|
+
readonly onAssetStreamed: Event<StreamedAsset[]>;
|
|
1289
|
+
/**
|
|
1290
|
+
* Event triggered to indicate the progress of the streaming process.
|
|
1291
|
+
* Contains the progress percentage.
|
|
1292
|
+
*/
|
|
1293
|
+
readonly onProgress: Event<number>;
|
|
1294
|
+
/**
|
|
1295
|
+
* Event triggered when the IFC file is loaded.
|
|
1296
|
+
* Contains the loaded IFC file data.
|
|
1297
|
+
*/
|
|
1298
|
+
readonly onIfcLoaded: Event<Uint8Array>;
|
|
1299
|
+
/** {@link Disposable.onDisposed} */
|
|
1300
|
+
readonly onDisposed: Event<unknown>;
|
|
1301
|
+
/**
|
|
1302
|
+
* Settings for the IfcGeometryTiler.
|
|
1455
1303
|
*/
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1304
|
+
settings: IfcStreamingSettings;
|
|
1305
|
+
/** {@link Component.enabled} */
|
|
1306
|
+
enabled: boolean;
|
|
1459
1307
|
/**
|
|
1460
|
-
*
|
|
1308
|
+
* The WebIFC API instance used for IFC file processing.
|
|
1309
|
+
*/
|
|
1310
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1311
|
+
private _spatialTree;
|
|
1312
|
+
private _metaData;
|
|
1313
|
+
private _visitedGeometries;
|
|
1314
|
+
private _streamSerializer;
|
|
1315
|
+
private _geometries;
|
|
1316
|
+
private _geometryCount;
|
|
1317
|
+
private _civil;
|
|
1318
|
+
private _groupSerializer;
|
|
1319
|
+
private _assets;
|
|
1320
|
+
private _meshesWithHoles;
|
|
1321
|
+
constructor(components: Components);
|
|
1322
|
+
/** {@link Disposable.dispose} */
|
|
1323
|
+
dispose(): void;
|
|
1324
|
+
/**
|
|
1325
|
+
* This method streams the IFC file from a given buffer.
|
|
1461
1326
|
*
|
|
1462
|
-
* @param
|
|
1463
|
-
* @
|
|
1464
|
-
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
1327
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1328
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1465
1329
|
*
|
|
1466
1330
|
* @remarks
|
|
1467
|
-
* This method
|
|
1468
|
-
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
1331
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1469
1332
|
*
|
|
1470
|
-
* @
|
|
1333
|
+
* @example
|
|
1334
|
+
* '''typescript
|
|
1335
|
+
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1336
|
+
* const rawBuffer = await response.arrayBuffer();
|
|
1337
|
+
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1338
|
+
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1339
|
+
* '''
|
|
1471
1340
|
*/
|
|
1472
|
-
|
|
1341
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1473
1342
|
/**
|
|
1474
|
-
*
|
|
1343
|
+
* This method streams the IFC file from a given callback.
|
|
1475
1344
|
*
|
|
1476
|
-
* @param
|
|
1345
|
+
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
1346
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1477
1347
|
*
|
|
1478
1348
|
* @remarks
|
|
1479
|
-
* This method
|
|
1480
|
-
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
1349
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1481
1350
|
*
|
|
1482
|
-
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1483
1351
|
*/
|
|
1484
|
-
|
|
1485
|
-
|
|
1352
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1353
|
+
private readIfcFile;
|
|
1354
|
+
private streamIfcFile;
|
|
1355
|
+
private streamAllGeometries;
|
|
1356
|
+
private cleanUp;
|
|
1357
|
+
private getMesh;
|
|
1358
|
+
private getGeometry;
|
|
1359
|
+
private streamAssets;
|
|
1360
|
+
private streamGeometries;
|
|
1486
1361
|
}
|
|
1487
|
-
import
|
|
1362
|
+
import * as WEBIFC from "web-ifc";
|
|
1363
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1364
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1488
1365
|
/**
|
|
1489
|
-
*
|
|
1366
|
+
* A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
|
|
1490
1367
|
*/
|
|
1491
|
-
export declare class
|
|
1368
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1492
1369
|
/**
|
|
1493
1370
|
* A unique identifier for the component.
|
|
1494
1371
|
* This UUID is used to register the component within the Components system.
|
|
1495
1372
|
*/
|
|
1496
|
-
static readonly uuid: "
|
|
1373
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1374
|
+
/**
|
|
1375
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1376
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1377
|
+
*/
|
|
1378
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1379
|
+
type: number;
|
|
1380
|
+
data: {
|
|
1381
|
+
[id: number]: any;
|
|
1382
|
+
};
|
|
1383
|
+
}>;
|
|
1384
|
+
/**
|
|
1385
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
1386
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1387
|
+
*/
|
|
1388
|
+
readonly onProgress: AsyncEvent<number>;
|
|
1389
|
+
/**
|
|
1390
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
1391
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1392
|
+
*/
|
|
1393
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1497
1394
|
/** {@link Disposable.onDisposed} */
|
|
1498
|
-
readonly onDisposed: Event<
|
|
1395
|
+
readonly onDisposed: Event<string>;
|
|
1499
1396
|
/** {@link Component.enabled} */
|
|
1500
1397
|
enabled: boolean;
|
|
1501
1398
|
/**
|
|
1502
|
-
*
|
|
1503
|
-
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1504
|
-
* Default value is 10.
|
|
1505
|
-
*/
|
|
1506
|
-
height: number;
|
|
1507
|
-
/**
|
|
1508
|
-
* The group name used for the explosion animation.
|
|
1509
|
-
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1510
|
-
* Default value is "storeys".
|
|
1399
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1511
1400
|
*/
|
|
1512
|
-
|
|
1401
|
+
settings: PropertiesStreamingSettings;
|
|
1513
1402
|
/**
|
|
1514
|
-
*
|
|
1515
|
-
* This set is used to keep track of which items have been exploded.
|
|
1403
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1516
1404
|
*/
|
|
1517
|
-
|
|
1518
|
-
constructor(components: Components);
|
|
1405
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1519
1406
|
/** {@link Disposable.dispose} */
|
|
1520
|
-
dispose(): void
|
|
1407
|
+
dispose(): Promise<void>;
|
|
1521
1408
|
/**
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1524
|
-
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
1525
|
-
*
|
|
1526
|
-
* @remarks
|
|
1527
|
-
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
1528
|
-
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1529
|
-
* If 'active' is false, the fragments are moved back to their original position.
|
|
1409
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1530
1410
|
*
|
|
1531
|
-
*
|
|
1411
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1412
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1413
|
+
*/
|
|
1414
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1415
|
+
/**
|
|
1416
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1532
1417
|
*
|
|
1533
|
-
* @
|
|
1418
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1419
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1534
1420
|
*/
|
|
1535
|
-
|
|
1421
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1422
|
+
private readIfcFile;
|
|
1423
|
+
private streamIfcFile;
|
|
1424
|
+
private streamAllProperties;
|
|
1425
|
+
private cleanUp;
|
|
1536
1426
|
}
|
|
1427
|
+
import * as THREE from "three";
|
|
1537
1428
|
import * as FRAGS from "@thatopen/fragments";
|
|
1538
|
-
import {
|
|
1429
|
+
import { Component, Components } from "../../core";
|
|
1539
1430
|
/**
|
|
1540
|
-
*
|
|
1431
|
+
* Represents an edge measurement result.
|
|
1541
1432
|
*/
|
|
1542
|
-
export
|
|
1433
|
+
export interface MeasureEdge {
|
|
1434
|
+
/**
|
|
1435
|
+
* The distance between the two points of the edge.
|
|
1436
|
+
*/
|
|
1437
|
+
distance: number;
|
|
1438
|
+
/**
|
|
1439
|
+
* The two points that define the edge.
|
|
1440
|
+
*/
|
|
1441
|
+
points: THREE.Vector3[];
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* 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).
|
|
1445
|
+
*/
|
|
1446
|
+
export declare class MeasurementUtils extends Component {
|
|
1543
1447
|
/**
|
|
1544
1448
|
* A unique identifier for the component.
|
|
1545
1449
|
* This UUID is used to register the component within the Components system.
|
|
1546
1450
|
*/
|
|
1547
|
-
static
|
|
1451
|
+
static uuid: string;
|
|
1548
1452
|
/** {@link Component.enabled} */
|
|
1549
1453
|
enabled: boolean;
|
|
1550
1454
|
constructor(components: Components);
|
|
1551
1455
|
/**
|
|
1552
|
-
*
|
|
1553
|
-
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
1554
|
-
* If 'items' is provided, only the specified fragments will be affected.
|
|
1456
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
1555
1457
|
*
|
|
1556
|
-
* @param
|
|
1557
|
-
* @param
|
|
1558
|
-
*
|
|
1458
|
+
* @param point - The point from which to calculate the distance.
|
|
1459
|
+
* @param lineStart - The start point of the line segment.
|
|
1460
|
+
* @param lineEnd - The end point of the line segment.
|
|
1461
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
1462
|
+
* @returns The distance from the point to the line segment.
|
|
1463
|
+
*/
|
|
1464
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1465
|
+
/**
|
|
1466
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
1467
|
+
* It also returns the edges of the found face and their indices.
|
|
1559
1468
|
*
|
|
1560
|
-
* @
|
|
1469
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1470
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
1471
|
+
* @param instance - The instance of the mesh (optional).
|
|
1472
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1561
1473
|
*/
|
|
1562
|
-
|
|
1474
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1475
|
+
edges: MeasureEdge[];
|
|
1476
|
+
indices: Set<number>;
|
|
1477
|
+
} | null;
|
|
1563
1478
|
/**
|
|
1564
|
-
*
|
|
1565
|
-
* It
|
|
1479
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
1480
|
+
* It also applies instance transformation if provided.
|
|
1566
1481
|
*
|
|
1567
|
-
* @param
|
|
1568
|
-
*
|
|
1482
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1483
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
1484
|
+
* @param instance - The instance of the mesh (optional).
|
|
1485
|
+
* @returns An object containing the vertices and normal of the face.
|
|
1486
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
1487
|
+
*/
|
|
1488
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1489
|
+
p1: THREE.Vector3;
|
|
1490
|
+
p2: THREE.Vector3;
|
|
1491
|
+
p3: THREE.Vector3;
|
|
1492
|
+
faceNormal: THREE.Vector3;
|
|
1493
|
+
};
|
|
1494
|
+
/**
|
|
1495
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
1496
|
+
* This is used to ensure numerical precision in edge detection.
|
|
1569
1497
|
*
|
|
1570
|
-
* @
|
|
1498
|
+
* @param vector - The vector to round.
|
|
1499
|
+
* @returns The vector with rounded components.
|
|
1571
1500
|
*/
|
|
1572
|
-
|
|
1573
|
-
|
|
1501
|
+
round(vector: THREE.Vector3): void;
|
|
1502
|
+
/**
|
|
1503
|
+
* Calculates the volume of a set of fragments.
|
|
1504
|
+
*
|
|
1505
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
1506
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
1507
|
+
*
|
|
1508
|
+
* @remarks
|
|
1509
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
1510
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
1511
|
+
*
|
|
1512
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
1513
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
1514
|
+
*/
|
|
1515
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
1516
|
+
/**
|
|
1517
|
+
* Calculates the total volume of a set of meshes.
|
|
1518
|
+
*
|
|
1519
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
1520
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
1521
|
+
*
|
|
1522
|
+
* @remarks
|
|
1523
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
1524
|
+
* and its bounding sphere.
|
|
1525
|
+
*
|
|
1526
|
+
*/
|
|
1527
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
1528
|
+
private getFaceData;
|
|
1529
|
+
private getVolumeOfMesh;
|
|
1530
|
+
private getSignedVolumeOfTriangle;
|
|
1574
1531
|
}
|
|
1575
1532
|
import * as THREE from "three";
|
|
1576
1533
|
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
@@ -1585,17 +1542,10 @@ export declare class MaterialsUtils {
|
|
|
1585
1542
|
static isTransparent(material: THREE.Material): boolean;
|
|
1586
1543
|
}
|
|
1587
1544
|
export declare class UUID {
|
|
1588
|
-
private static _pattern;
|
|
1589
|
-
private static _lut;
|
|
1590
|
-
static create(): string;
|
|
1591
|
-
static validate(uuid: string): void;
|
|
1592
|
-
}
|
|
1593
|
-
import * as WEBIFC from "web-ifc";
|
|
1594
|
-
export interface IfcItemsCategories {
|
|
1595
|
-
[itemID: number]: number;
|
|
1596
|
-
}
|
|
1597
|
-
export declare class IfcCategories {
|
|
1598
|
-
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
1545
|
+
private static _pattern;
|
|
1546
|
+
private static _lut;
|
|
1547
|
+
static create(): string;
|
|
1548
|
+
static validate(uuid: string): void;
|
|
1599
1549
|
}
|
|
1600
1550
|
import * as THREE from "three";
|
|
1601
1551
|
import { Component, Components, Disposable, Event, World } from "../core";
|
|
@@ -1683,895 +1633,658 @@ export declare class VertexPicker extends Component implements Disposable {
|
|
|
1683
1633
|
*
|
|
1684
1634
|
* @returns A copy of the current VertexPickerConfig object.
|
|
1685
1635
|
*
|
|
1686
|
-
* @example
|
|
1687
|
-
* '''typescript
|
|
1688
|
-
* const currentConfig = vertexPicker.config;
|
|
1689
|
-
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1690
|
-
* '''
|
|
1691
|
-
*/
|
|
1692
|
-
get config(): Partial<VertexPickerConfig>;
|
|
1693
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1694
|
-
/** {@link Disposable.dispose} */
|
|
1695
|
-
dispose(): void;
|
|
1696
|
-
/**
|
|
1697
|
-
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1698
|
-
*
|
|
1699
|
-
* @param world - The World instance to use for raycasting.
|
|
1700
|
-
*
|
|
1701
|
-
* @returns The current picked point, or null if no point is picked.
|
|
1702
|
-
*
|
|
1703
|
-
* @remarks
|
|
1704
|
-
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1705
|
-
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1706
|
-
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1707
|
-
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1708
|
-
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1709
|
-
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1710
|
-
*/
|
|
1711
|
-
get(world: World): THREE.Vector3 | null;
|
|
1712
|
-
private getClosestVertex;
|
|
1713
|
-
private getVertices;
|
|
1714
|
-
private getVertex;
|
|
1715
|
-
}
|
|
1716
|
-
/**
|
|
1717
|
-
* 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.
|
|
1718
|
-
*
|
|
1719
|
-
* @remarks
|
|
1720
|
-
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
1721
|
-
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
1722
|
-
*
|
|
1723
|
-
*/
|
|
1724
|
-
export declare const IfcElements: {
|
|
1725
|
-
[key: number]: string;
|
|
1726
|
-
};
|
|
1727
|
-
import * as WEBIFC from "web-ifc";
|
|
1728
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1729
|
-
import { IfcFragmentSettings } from "./src";
|
|
1730
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1731
|
-
/**
|
|
1732
|
-
* 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).
|
|
1733
|
-
*/
|
|
1734
|
-
export declare class IfcLoader extends Component implements Disposable {
|
|
1735
|
-
/**
|
|
1736
|
-
* A unique identifier for the component.
|
|
1737
|
-
* This UUID is used to register the component within the Components system.
|
|
1738
|
-
*/
|
|
1739
|
-
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1740
|
-
/** {@link Disposable.onDisposed} */
|
|
1741
|
-
readonly onDisposed: Event<string>;
|
|
1742
|
-
/**
|
|
1743
|
-
* An event triggered when the IFC file starts loading.
|
|
1744
|
-
*/
|
|
1745
|
-
readonly onIfcStartedLoading: Event<void>;
|
|
1746
|
-
/**
|
|
1747
|
-
* An event triggered when the setup process is completed.
|
|
1748
|
-
*/
|
|
1749
|
-
readonly onSetup: Event<void>;
|
|
1750
|
-
/**
|
|
1751
|
-
* The settings for the IfcLoader.
|
|
1752
|
-
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1753
|
-
*/
|
|
1754
|
-
settings: IfcFragmentSettings;
|
|
1755
|
-
/**
|
|
1756
|
-
* The instance of the Web-IFC library used for handling IFC data.
|
|
1757
|
-
*/
|
|
1758
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1759
|
-
/** {@link Component.enabled} */
|
|
1760
|
-
enabled: boolean;
|
|
1761
|
-
private _material;
|
|
1762
|
-
private _spatialTree;
|
|
1763
|
-
private _metaData;
|
|
1764
|
-
private _fragmentInstances;
|
|
1765
|
-
private _civil;
|
|
1766
|
-
private _visitedFragments;
|
|
1767
|
-
private _materialT;
|
|
1768
|
-
constructor(components: Components);
|
|
1769
|
-
/** {@link Disposable.dispose} */
|
|
1770
|
-
dispose(): void;
|
|
1771
|
-
/**
|
|
1772
|
-
* Sets up the IfcLoader component with the provided configuration.
|
|
1773
|
-
*
|
|
1774
|
-
* @param config - Optional configuration settings for the IfcLoader.
|
|
1775
|
-
* If not provided, the existing settings will be used.
|
|
1776
|
-
*
|
|
1777
|
-
* @returns A Promise that resolves when the setup process is completed.
|
|
1778
|
-
*
|
|
1779
|
-
* @remarks
|
|
1780
|
-
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1781
|
-
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
1782
|
-
*
|
|
1783
|
-
* @example
|
|
1784
|
-
* '''typescript
|
|
1785
|
-
* const ifcLoader = new IfcLoader(components);
|
|
1786
|
-
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1787
|
-
* '''
|
|
1788
|
-
*/
|
|
1789
|
-
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
1790
|
-
/**
|
|
1791
|
-
* Loads an IFC file and processes it for 3D visualization.
|
|
1792
|
-
*
|
|
1793
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1794
|
-
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
1795
|
-
*
|
|
1796
|
-
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
1797
|
-
*
|
|
1798
|
-
* @example
|
|
1799
|
-
* '''typescript
|
|
1800
|
-
* const ifcLoader = components.get(IfcLoader);
|
|
1801
|
-
* const group = await ifcLoader.load(ifcData);
|
|
1802
|
-
* '''
|
|
1803
|
-
*/
|
|
1804
|
-
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
1805
|
-
/**
|
|
1806
|
-
* Reads an IFC file and initializes the Web-IFC library.
|
|
1807
|
-
*
|
|
1808
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1809
|
-
*
|
|
1810
|
-
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
1811
|
-
*
|
|
1812
|
-
* @remarks
|
|
1813
|
-
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1814
|
-
* It also opens the IFC model using the provided data and settings.
|
|
1815
|
-
*
|
|
1816
|
-
* @example
|
|
1817
|
-
* '''typescript
|
|
1818
|
-
* const ifcLoader = components.get(IfcLoader);
|
|
1819
|
-
* await ifcLoader.readIfcFile(ifcData);
|
|
1820
|
-
* '''
|
|
1821
|
-
*/
|
|
1822
|
-
readIfcFile(data: Uint8Array): Promise<number>;
|
|
1823
|
-
/**
|
|
1824
|
-
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
1825
|
-
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1826
|
-
*
|
|
1827
|
-
* @remarks
|
|
1828
|
-
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
1829
|
-
*
|
|
1830
|
-
* @example
|
|
1831
|
-
* '''typescript
|
|
1832
|
-
* const ifcLoader = components.get(IfcLoader);
|
|
1833
|
-
* ifcLoader.cleanUp();
|
|
1834
|
-
* '''
|
|
1835
|
-
*/
|
|
1836
|
-
cleanUp(): void;
|
|
1837
|
-
private getAllGeometries;
|
|
1838
|
-
private getMesh;
|
|
1839
|
-
private getGeometry;
|
|
1840
|
-
private autoSetWasm;
|
|
1841
|
-
}
|
|
1842
|
-
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1843
|
-
import * as THREE from "three";
|
|
1844
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1845
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1846
|
-
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1847
|
-
/**
|
|
1848
|
-
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
1849
|
-
*/
|
|
1850
|
-
export declare class FragmentsManager extends Component implements Disposable {
|
|
1851
|
-
/**
|
|
1852
|
-
* A unique identifier for the component.
|
|
1853
|
-
* This UUID is used to register the component within the Components system.
|
|
1854
|
-
*/
|
|
1855
|
-
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1856
|
-
/** {@link Disposable.onDisposed} */
|
|
1857
|
-
readonly onDisposed: Event<unknown>;
|
|
1858
|
-
/**
|
|
1859
|
-
* Event triggered when fragments are loaded.
|
|
1860
|
-
*/
|
|
1861
|
-
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1862
|
-
/**
|
|
1863
|
-
* Event triggered when fragments are disposed.
|
|
1864
|
-
*/
|
|
1865
|
-
readonly onFragmentsDisposed: Event<{
|
|
1866
|
-
groupID: string;
|
|
1867
|
-
fragmentIDs: string[];
|
|
1868
|
-
}>;
|
|
1869
|
-
/**
|
|
1870
|
-
* Map containing all loaded fragments.
|
|
1871
|
-
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1872
|
-
*/
|
|
1873
|
-
readonly list: Map<string, Fragment>;
|
|
1874
|
-
/**
|
|
1875
|
-
* Map containing all loaded fragment groups.
|
|
1876
|
-
* The key is the group's unique identifier, and the value is the group itself.
|
|
1877
|
-
*/
|
|
1878
|
-
readonly groups: Map<string, FragmentsGroup>;
|
|
1879
|
-
baseCoordinationModel: string;
|
|
1880
|
-
baseCoordinationMatrix: THREE.Matrix4;
|
|
1881
|
-
/** {@link Component.enabled} */
|
|
1882
|
-
enabled: boolean;
|
|
1883
|
-
private _loader;
|
|
1884
|
-
/**
|
|
1885
|
-
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1886
|
-
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1887
|
-
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1888
|
-
*/
|
|
1889
|
-
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1890
|
-
constructor(components: Components);
|
|
1891
|
-
/** {@link Disposable.dispose} */
|
|
1892
|
-
dispose(): void;
|
|
1893
|
-
/**
|
|
1894
|
-
* Dispose of a specific fragment group.
|
|
1895
|
-
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1896
|
-
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1897
|
-
*
|
|
1898
|
-
* @param group - The fragment group to be disposed.
|
|
1899
|
-
*/
|
|
1900
|
-
disposeGroup(group: FragmentsGroup): void;
|
|
1901
|
-
/**
|
|
1902
|
-
* Loads a binary file that contain fragment geometry.
|
|
1903
|
-
* @param data - The binary data to load.
|
|
1904
|
-
* @param config - Optional configuration for loading.
|
|
1905
|
-
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1906
|
-
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1907
|
-
* @returns The loaded FragmentsGroup.
|
|
1908
|
-
*/
|
|
1909
|
-
load(data: Uint8Array, config?: Partial<{
|
|
1910
|
-
coordinate: boolean;
|
|
1911
|
-
name: string;
|
|
1912
|
-
properties: FRAGS.IfcProperties;
|
|
1913
|
-
relationsMap: RelationsMap;
|
|
1914
|
-
}>): FragmentsGroup;
|
|
1915
|
-
/**
|
|
1916
|
-
* Export the specified fragmentsgroup to binary data.
|
|
1917
|
-
* @param group - the fragments group to be exported.
|
|
1918
|
-
* @returns the exported data as binary buffer.
|
|
1919
|
-
*/
|
|
1920
|
-
export(group: FragmentsGroup): Uint8Array;
|
|
1921
|
-
/**
|
|
1922
|
-
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1923
|
-
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1924
|
-
* @returns A map of model IDs to sets of express IDs.
|
|
1925
|
-
*/
|
|
1926
|
-
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1927
|
-
[modelID: string]: Set<number>;
|
|
1928
|
-
};
|
|
1929
|
-
/**
|
|
1930
|
-
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1931
|
-
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1932
|
-
* @returns A fragment ID map.
|
|
1933
|
-
* @remarks
|
|
1934
|
-
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1935
|
-
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1936
|
-
* The fragment ID maps are then merged into a single map and returned.
|
|
1937
|
-
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1636
|
+
* @example
|
|
1637
|
+
* '''typescript
|
|
1638
|
+
* const currentConfig = vertexPicker.config;
|
|
1639
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1640
|
+
* '''
|
|
1938
1641
|
*/
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1642
|
+
get config(): Partial<VertexPickerConfig>;
|
|
1643
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1644
|
+
/** {@link Disposable.dispose} */
|
|
1645
|
+
dispose(): void;
|
|
1942
1646
|
/**
|
|
1943
|
-
*
|
|
1944
|
-
* If no models are provided, all groups are used.
|
|
1945
|
-
* The first model in the list becomes the base model for coordinate transformation.
|
|
1946
|
-
* All other models are then transformed to match the base model's coordinate system.
|
|
1647
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1947
1648
|
*
|
|
1948
|
-
* @param
|
|
1949
|
-
*
|
|
1649
|
+
* @param world - The World instance to use for raycasting.
|
|
1650
|
+
*
|
|
1651
|
+
* @returns The current picked point, or null if no point is picked.
|
|
1652
|
+
*
|
|
1653
|
+
* @remarks
|
|
1654
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1655
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1656
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1657
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1658
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1659
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1950
1660
|
*/
|
|
1951
|
-
|
|
1661
|
+
get(world: World): THREE.Vector3 | null;
|
|
1662
|
+
private getClosestVertex;
|
|
1663
|
+
private getVertices;
|
|
1664
|
+
private getVertex;
|
|
1952
1665
|
}
|
|
1953
1666
|
import * as WEBIFC from "web-ifc";
|
|
1954
|
-
import
|
|
1955
|
-
import {
|
|
1667
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1668
|
+
import { Component, Components } from "../../core";
|
|
1956
1669
|
/**
|
|
1957
|
-
*
|
|
1670
|
+
* Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
|
|
1958
1671
|
*/
|
|
1959
|
-
export declare class
|
|
1672
|
+
export declare class IfcJsonExporter extends Component {
|
|
1960
1673
|
/**
|
|
1961
1674
|
* A unique identifier for the component.
|
|
1962
1675
|
* This UUID is used to register the component within the Components system.
|
|
1963
1676
|
*/
|
|
1964
|
-
static readonly uuid: "
|
|
1965
|
-
/**
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
*/
|
|
1969
|
-
readonly onGeometryStreamed: Event<{
|
|
1970
|
-
buffer: Uint8Array;
|
|
1971
|
-
data: StreamedGeometries;
|
|
1972
|
-
}>;
|
|
1677
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1678
|
+
/** {@link Component.enabled} */
|
|
1679
|
+
enabled: boolean;
|
|
1680
|
+
constructor(components: Components);
|
|
1973
1681
|
/**
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1682
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
1683
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1684
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
1685
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
1686
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1687
|
+
* to make the location data available (e.g. absolute position of building).
|
|
1976
1688
|
*/
|
|
1977
|
-
|
|
1689
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1690
|
+
}
|
|
1691
|
+
import * as WEBIFC from "web-ifc";
|
|
1692
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1693
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
1694
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
1695
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
1696
|
+
/**
|
|
1697
|
+
* Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
|
|
1698
|
+
*/
|
|
1699
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
1978
1700
|
/**
|
|
1979
|
-
*
|
|
1980
|
-
*
|
|
1701
|
+
* A unique identifier for the component.
|
|
1702
|
+
* This UUID is used to register the component within the Components system.
|
|
1981
1703
|
*/
|
|
1982
|
-
readonly
|
|
1704
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
1705
|
+
/** {@link Disposable.onDisposed} */
|
|
1706
|
+
readonly onDisposed: Event<string>;
|
|
1983
1707
|
/**
|
|
1984
|
-
* Event triggered when
|
|
1985
|
-
*
|
|
1708
|
+
* Event triggered when relations for a model have been indexed.
|
|
1709
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
1710
|
+
*
|
|
1711
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
1712
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
1713
|
+
* The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
1986
1714
|
*/
|
|
1987
|
-
readonly
|
|
1988
|
-
|
|
1989
|
-
|
|
1715
|
+
readonly onRelationsIndexed: Event<{
|
|
1716
|
+
modelID: string;
|
|
1717
|
+
relationsMap: RelationsMap;
|
|
1718
|
+
}>;
|
|
1990
1719
|
/**
|
|
1991
|
-
*
|
|
1720
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
1721
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
1722
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
1723
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
1724
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
1725
|
+
* of entity relationships within a model.
|
|
1992
1726
|
*/
|
|
1993
|
-
|
|
1727
|
+
readonly relationMaps: ModelsRelationMap;
|
|
1994
1728
|
/** {@link Component.enabled} */
|
|
1995
1729
|
enabled: boolean;
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
webIfc: WEBIFC.IfcAPI;
|
|
2000
|
-
private _spatialTree;
|
|
2001
|
-
private _metaData;
|
|
2002
|
-
private _visitedGeometries;
|
|
2003
|
-
private _streamSerializer;
|
|
2004
|
-
private _geometries;
|
|
2005
|
-
private _geometryCount;
|
|
2006
|
-
private _civil;
|
|
2007
|
-
private _groupSerializer;
|
|
2008
|
-
private _assets;
|
|
2009
|
-
private _meshesWithHoles;
|
|
1730
|
+
private _relToAttributesMap;
|
|
1731
|
+
private _inverseAttributes;
|
|
1732
|
+
private _ifcRels;
|
|
2010
1733
|
constructor(components: Components);
|
|
2011
|
-
|
|
2012
|
-
|
|
1734
|
+
private onFragmentsDisposed;
|
|
1735
|
+
private indexRelations;
|
|
2013
1736
|
/**
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2016
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
2017
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1737
|
+
* Adds a relation map to the model's relations map.
|
|
2018
1738
|
*
|
|
2019
|
-
* @
|
|
2020
|
-
*
|
|
1739
|
+
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
1740
|
+
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
2021
1741
|
*
|
|
2022
|
-
* @
|
|
2023
|
-
* '''typescript
|
|
2024
|
-
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
2025
|
-
* const rawBuffer = await response.arrayBuffer();
|
|
2026
|
-
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
2027
|
-
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
2028
|
-
* '''
|
|
1742
|
+
* @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
|
|
2029
1743
|
*/
|
|
2030
|
-
|
|
1744
|
+
setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
|
|
2031
1745
|
/**
|
|
2032
|
-
*
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2035
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1746
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
1747
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
1748
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
2036
1749
|
*
|
|
2037
|
-
*
|
|
2038
|
-
*
|
|
1750
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
1751
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
1752
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
1753
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1754
|
+
* of entities that are related through that attribute.
|
|
2039
1755
|
*
|
|
1756
|
+
* @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
|
|
1757
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
1758
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
1759
|
+
* @throws An error if the model does not have properties loaded.
|
|
2040
1760
|
*/
|
|
2041
|
-
|
|
2042
|
-
private readIfcFile;
|
|
2043
|
-
private streamIfcFile;
|
|
2044
|
-
private streamAllGeometries;
|
|
2045
|
-
private cleanUp;
|
|
2046
|
-
private getMesh;
|
|
2047
|
-
private getGeometry;
|
|
2048
|
-
private streamAssets;
|
|
2049
|
-
private streamGeometries;
|
|
2050
|
-
}
|
|
2051
|
-
import * as WEBIFC from "web-ifc";
|
|
2052
|
-
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
2053
|
-
import { PropertiesStreamingSettings } from "./src";
|
|
2054
|
-
/**
|
|
2055
|
-
* A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
|
|
2056
|
-
*/
|
|
2057
|
-
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
2058
|
-
/**
|
|
2059
|
-
* A unique identifier for the component.
|
|
2060
|
-
* This UUID is used to register the component within the Components system.
|
|
2061
|
-
*/
|
|
2062
|
-
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1761
|
+
process(model: FragmentsGroup): Promise<RelationsMap>;
|
|
2063
1762
|
/**
|
|
2064
|
-
*
|
|
2065
|
-
*
|
|
1763
|
+
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
1764
|
+
*
|
|
1765
|
+
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
1766
|
+
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1767
|
+
* @returns A promise that resolves to the relations map for the processed model.
|
|
1768
|
+
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
2066
1769
|
*/
|
|
2067
|
-
|
|
2068
|
-
type: number;
|
|
2069
|
-
data: {
|
|
2070
|
-
[id: number]: any;
|
|
2071
|
-
};
|
|
2072
|
-
}>;
|
|
1770
|
+
processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
|
|
2073
1771
|
/**
|
|
2074
|
-
*
|
|
2075
|
-
*
|
|
1772
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
1773
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
1774
|
+
* returning the IDs of related entities if a match is found.
|
|
1775
|
+
*
|
|
1776
|
+
* @param model The 'FragmentsGroup' model containing the entity.
|
|
1777
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
1778
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1779
|
+
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1780
|
+
* or the specified relation name is not indexed.
|
|
2076
1781
|
*/
|
|
2077
|
-
|
|
1782
|
+
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
|
|
2078
1783
|
/**
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
1784
|
+
* Serializes the relations of a given relation map into a JSON string.
|
|
1785
|
+
* This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
|
|
1786
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1787
|
+
* The resulting object is then serialized into a JSON string.
|
|
1788
|
+
*
|
|
1789
|
+
* @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
1790
|
+
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
2081
1791
|
*/
|
|
2082
|
-
|
|
2083
|
-
/** {@link Disposable.onDisposed} */
|
|
2084
|
-
readonly onDisposed: Event<string>;
|
|
2085
|
-
/** {@link Component.enabled} */
|
|
2086
|
-
enabled: boolean;
|
|
1792
|
+
serializeRelations(relationMap: RelationsMap): string;
|
|
2087
1793
|
/**
|
|
2088
|
-
*
|
|
1794
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
1795
|
+
* This method iterates through the relations indexed for the given model,
|
|
1796
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1797
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1798
|
+
* The resulting object is then serialized into a JSON string.
|
|
1799
|
+
*
|
|
1800
|
+
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1801
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1802
|
+
* If the model has no indexed relations, 'null' is returned.
|
|
2089
1803
|
*/
|
|
2090
|
-
|
|
1804
|
+
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
2091
1805
|
/**
|
|
2092
|
-
*
|
|
1806
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
1807
|
+
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
1808
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1809
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1810
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1811
|
+
*
|
|
1812
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
1813
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
2093
1814
|
*/
|
|
2094
|
-
|
|
2095
|
-
/** {@link Disposable.dispose} */
|
|
2096
|
-
dispose(): Promise<void>;
|
|
1815
|
+
serializeAllRelations(): string;
|
|
2097
1816
|
/**
|
|
2098
|
-
*
|
|
1817
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
1818
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
1819
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1820
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1821
|
+
* of express IDs of entities related through that relation type.
|
|
2099
1822
|
*
|
|
2100
|
-
* @param
|
|
2101
|
-
* @returns A
|
|
1823
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
1824
|
+
* @returns A 'Map' where the key is the express ID of an entity as a number, and the value
|
|
1825
|
+
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
1826
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
2102
1827
|
*/
|
|
2103
|
-
|
|
1828
|
+
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
1829
|
+
/** {@link Disposable.dispose} */
|
|
1830
|
+
dispose(): void;
|
|
2104
1831
|
/**
|
|
2105
|
-
*
|
|
1832
|
+
* Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
|
|
2106
1833
|
*
|
|
2107
|
-
* @param
|
|
2108
|
-
* @
|
|
1834
|
+
* @param model The BIM model whose children to get.
|
|
1835
|
+
* @param id The expressID of the item whose children to get.
|
|
1836
|
+
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
1837
|
+
*
|
|
1838
|
+
* @returns A 'Set' with the expressIDs of the found items.
|
|
2109
1839
|
*/
|
|
2110
|
-
|
|
2111
|
-
private readIfcFile;
|
|
2112
|
-
private streamIfcFile;
|
|
2113
|
-
private streamAllProperties;
|
|
2114
|
-
private cleanUp;
|
|
1840
|
+
getElementsChildren(model: FragmentsGroup, id: number, found?: Set<number>): Set<number>;
|
|
2115
1841
|
}
|
|
1842
|
+
import * as WEBIFC from "web-ifc";
|
|
1843
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1844
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
2116
1845
|
/**
|
|
2117
|
-
*
|
|
1846
|
+
* Types for boolean properties in IFC schema.
|
|
2118
1847
|
*/
|
|
2119
|
-
export
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
export
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2134
|
-
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2135
|
-
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2136
|
-
key: string | null;
|
|
2137
|
-
name: string | null;
|
|
2138
|
-
}>;
|
|
2139
|
-
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2140
|
-
key: string | null;
|
|
2141
|
-
value: number | null;
|
|
2142
|
-
}>;
|
|
2143
|
-
static isRel(expressID: number): boolean;
|
|
2144
|
-
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2145
|
-
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
1848
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1849
|
+
/**
|
|
1850
|
+
* Types for string properties in IFC schema.
|
|
1851
|
+
*/
|
|
1852
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
1853
|
+
/**
|
|
1854
|
+
* Types for numeric properties in IFC schema.
|
|
1855
|
+
*/
|
|
1856
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
1857
|
+
/**
|
|
1858
|
+
* Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
|
|
1859
|
+
*/
|
|
1860
|
+
export interface ChangeMap {
|
|
1861
|
+
[modelID: string]: Set<number>;
|
|
2146
1862
|
}
|
|
2147
1863
|
/**
|
|
2148
|
-
*
|
|
1864
|
+
* Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
|
|
2149
1865
|
*/
|
|
2150
|
-
export
|
|
2151
|
-
|
|
2152
|
-
|
|
1866
|
+
export interface AttributeListener {
|
|
1867
|
+
[modelID: string]: {
|
|
1868
|
+
[expressID: number]: {
|
|
1869
|
+
[attributeName: string]: Event<String | Boolean | Number>;
|
|
1870
|
+
};
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
2153
1873
|
/**
|
|
2154
|
-
*
|
|
1874
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
2155
1875
|
*/
|
|
2156
|
-
export declare class
|
|
2157
|
-
/** {@link Disposable.onDisposed} */
|
|
2158
|
-
readonly onDisposed: Event<unknown>;
|
|
2159
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2160
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
2161
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2162
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
2163
|
-
/** {@link Resizeable.onResize} */
|
|
2164
|
-
readonly onResize: Event<THREE.Vector2>;
|
|
2165
|
-
/**
|
|
2166
|
-
* The front offset of the minimap.
|
|
2167
|
-
* It determines how much the minimap's view is offset from the camera's view.
|
|
2168
|
-
* By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
2169
|
-
*/
|
|
2170
|
-
frontOffset: number;
|
|
2171
|
-
/**
|
|
2172
|
-
* The override material for the minimap.
|
|
2173
|
-
* It is used to render the depth information of the world onto the minimap.
|
|
2174
|
-
*/
|
|
2175
|
-
overrideMaterial: THREE.MeshDepthMaterial;
|
|
2176
|
-
/**
|
|
2177
|
-
* The background color of the minimap.
|
|
2178
|
-
* It is used to set the background color of the minimap's renderer.
|
|
2179
|
-
*/
|
|
2180
|
-
backgroundColor: THREE.Color;
|
|
1876
|
+
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
2181
1877
|
/**
|
|
2182
|
-
*
|
|
2183
|
-
*
|
|
1878
|
+
* A unique identifier for the component.
|
|
1879
|
+
* This UUID is used to register the component within the Components system.
|
|
2184
1880
|
*/
|
|
2185
|
-
|
|
1881
|
+
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
1882
|
+
/** {@link Disposable.onDisposed} */
|
|
1883
|
+
readonly onDisposed: Event<string>;
|
|
2186
1884
|
/**
|
|
2187
|
-
*
|
|
2188
|
-
* If disabled, the minimap will not update or render.
|
|
1885
|
+
* Event triggered when a file is requested for export.
|
|
2189
1886
|
*/
|
|
2190
|
-
|
|
1887
|
+
readonly onRequestFile: Event<unknown>;
|
|
2191
1888
|
/**
|
|
2192
|
-
*
|
|
2193
|
-
* It provides access to the 3D scene, camera, and other relevant world elements.
|
|
1889
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
2194
1890
|
*/
|
|
2195
|
-
|
|
2196
|
-
private _lockRotation;
|
|
2197
|
-
private _camera;
|
|
2198
|
-
private _plane;
|
|
2199
|
-
private _size;
|
|
2200
|
-
private _tempVector1;
|
|
2201
|
-
private _tempVector2;
|
|
2202
|
-
private _tempTarget;
|
|
2203
|
-
private readonly down;
|
|
1891
|
+
ifcToExport: ArrayBuffer | null;
|
|
2204
1892
|
/**
|
|
2205
|
-
*
|
|
2206
|
-
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
1893
|
+
* Event triggered when an element is added to a Pset.
|
|
2207
1894
|
*/
|
|
2208
|
-
|
|
1895
|
+
readonly onElementToPset: Event<{
|
|
1896
|
+
model: FragmentsGroup;
|
|
1897
|
+
psetID: number;
|
|
1898
|
+
elementID: number;
|
|
1899
|
+
}>;
|
|
2209
1900
|
/**
|
|
2210
|
-
*
|
|
2211
|
-
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2212
|
-
* @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
|
|
1901
|
+
* Event triggered when a property is added to a Pset.
|
|
2213
1902
|
*/
|
|
2214
|
-
|
|
1903
|
+
readonly onPropToPset: Event<{
|
|
1904
|
+
model: FragmentsGroup;
|
|
1905
|
+
psetID: number;
|
|
1906
|
+
propID: number;
|
|
1907
|
+
}>;
|
|
2215
1908
|
/**
|
|
2216
|
-
*
|
|
2217
|
-
* The zoom level determines how much of the world is visible on the minimap.
|
|
2218
|
-
* @returns The current zoom level of the minimap.
|
|
1909
|
+
* Event triggered when a Pset is removed.
|
|
2219
1910
|
*/
|
|
2220
|
-
|
|
1911
|
+
readonly onPsetRemoved: Event<{
|
|
1912
|
+
model: FragmentsGroup;
|
|
1913
|
+
psetID: number;
|
|
1914
|
+
}>;
|
|
2221
1915
|
/**
|
|
2222
|
-
*
|
|
2223
|
-
* The zoom level determines how much of the world is visible on the minimap.
|
|
2224
|
-
* @param value - The new zoom level of the minimap.
|
|
1916
|
+
* Event triggered when data in the model changes.
|
|
2225
1917
|
*/
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
/** Returns the camera used by the MiniMap */
|
|
2231
|
-
get(): THREE.OrthographicCamera;
|
|
2232
|
-
/** {@link Updateable.update} */
|
|
2233
|
-
update(): void;
|
|
2234
|
-
/** {@link Resizeable.getSize} */
|
|
2235
|
-
getSize(): THREE.Vector2;
|
|
2236
|
-
/** {@link Resizeable.resize} */
|
|
2237
|
-
resize(size?: THREE.Vector2): void;
|
|
2238
|
-
private updatePlanes;
|
|
2239
|
-
}
|
|
2240
|
-
import { InverseAttribute } from "./types";
|
|
2241
|
-
export declare const relToAttributesMap: Map<number, {
|
|
2242
|
-
forRelating: InverseAttribute;
|
|
2243
|
-
forRelated: InverseAttribute;
|
|
2244
|
-
}>;
|
|
2245
|
-
import * as WEBIFC from "web-ifc";
|
|
2246
|
-
/** Configuration of the IFC-fragment conversion. */
|
|
2247
|
-
export declare class IfcFragmentSettings {
|
|
2248
|
-
/** Whether to extract the IFC properties into a JSON. */
|
|
2249
|
-
includeProperties: boolean;
|
|
1918
|
+
readonly onDataChanged: Event<{
|
|
1919
|
+
model: FragmentsGroup;
|
|
1920
|
+
expressID: number;
|
|
1921
|
+
}>;
|
|
2250
1922
|
/**
|
|
2251
|
-
*
|
|
2252
|
-
* like IFCSPACE.
|
|
1923
|
+
* Configuration for the WebAssembly module.
|
|
2253
1924
|
*/
|
|
2254
|
-
optionalCategories: number[];
|
|
2255
|
-
/** Whether to use the coordination data coming from the IFC files. */
|
|
2256
|
-
coordinate: boolean;
|
|
2257
|
-
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2258
1925
|
wasm: {
|
|
2259
1926
|
path: string;
|
|
2260
1927
|
absolute: boolean;
|
|
2261
|
-
logLevel?: WEBIFC.LogLevel;
|
|
2262
1928
|
};
|
|
2263
|
-
/**
|
|
2264
|
-
|
|
2265
|
-
/** Whether to save the absolute location of all IFC items. */
|
|
2266
|
-
saveLocations: boolean;
|
|
2267
|
-
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2268
|
-
webIfc: WEBIFC.LoaderSettings;
|
|
2269
|
-
/**
|
|
2270
|
-
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2271
|
-
* If set to true, the path will be set to the default path of the WASM file.
|
|
2272
|
-
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2273
|
-
* Default value is true.
|
|
2274
|
-
*/
|
|
2275
|
-
autoSetWasm: boolean;
|
|
2276
|
-
/**
|
|
2277
|
-
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2278
|
-
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2279
|
-
* If set to null, the default file location handler will be used.
|
|
2280
|
-
*
|
|
2281
|
-
* @param url - The URL of the file to locate.
|
|
2282
|
-
* @returns The absolute path of the file.
|
|
2283
|
-
*/
|
|
2284
|
-
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2285
|
-
}
|
|
2286
|
-
import * as WEBIFC from "web-ifc";
|
|
2287
|
-
import { IfcItemsCategories } from "../../../ifc";
|
|
2288
|
-
export declare class SpatialStructure {
|
|
2289
|
-
itemsByFloor: IfcItemsCategories;
|
|
2290
|
-
private _units;
|
|
2291
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2292
|
-
cleanUp(): void;
|
|
2293
|
-
}
|
|
2294
|
-
import * as THREE from "three";
|
|
2295
|
-
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2296
|
-
import { Components } from "../../Components";
|
|
2297
|
-
/**
|
|
2298
|
-
* Configuration interface for the {@link SimpleGrid} class.
|
|
2299
|
-
*/
|
|
2300
|
-
export interface GridConfig {
|
|
2301
|
-
/**
|
|
2302
|
-
* The color of the grid lines.
|
|
2303
|
-
*/
|
|
2304
|
-
color: THREE.Color;
|
|
1929
|
+
/** {@link Component.enabled} */
|
|
1930
|
+
enabled: boolean;
|
|
2305
1931
|
/**
|
|
2306
|
-
*
|
|
1932
|
+
* Map of attribute listeners.
|
|
2307
1933
|
*/
|
|
2308
|
-
|
|
1934
|
+
attributeListeners: AttributeListener;
|
|
2309
1935
|
/**
|
|
2310
|
-
* The
|
|
1936
|
+
* The currently selected model.
|
|
2311
1937
|
*/
|
|
2312
|
-
|
|
1938
|
+
selectedModel?: FragmentsGroup;
|
|
2313
1939
|
/**
|
|
2314
|
-
*
|
|
1940
|
+
* Map of changed entities in the model.
|
|
2315
1941
|
*/
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
/**
|
|
2319
|
-
|
|
2320
|
-
*/
|
|
2321
|
-
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2322
|
-
/** {@link Disposable.onDisposed} */
|
|
2323
|
-
readonly onDisposed: Event<unknown>;
|
|
2324
|
-
/** The world instance to which this Raycaster belongs. */
|
|
2325
|
-
world: World;
|
|
2326
|
-
/** The components instance to which this grid belongs. */
|
|
2327
|
-
components: Components;
|
|
2328
|
-
/** {@link Hideable.visible} */
|
|
2329
|
-
get visible(): boolean;
|
|
2330
|
-
/** {@link Hideable.visible} */
|
|
2331
|
-
set visible(visible: boolean);
|
|
2332
|
-
/** The material of the grid. */
|
|
2333
|
-
get material(): THREE.ShaderMaterial;
|
|
1942
|
+
changeMap: ChangeMap;
|
|
1943
|
+
constructor(components: Components);
|
|
1944
|
+
/** {@link Disposable.dispose} */
|
|
1945
|
+
dispose(): void;
|
|
2334
1946
|
/**
|
|
2335
|
-
*
|
|
2336
|
-
*
|
|
1947
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
1948
|
+
*
|
|
1949
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
1950
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1951
|
+
* @returns The IFC schema associated with the given model.
|
|
2337
1952
|
*/
|
|
2338
|
-
|
|
1953
|
+
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
2339
1954
|
/**
|
|
2340
|
-
*
|
|
2341
|
-
*
|
|
1955
|
+
* Method to set properties data in the model.
|
|
1956
|
+
*
|
|
1957
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
1958
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
1959
|
+
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1960
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
1961
|
+
*
|
|
1962
|
+
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
1963
|
+
*
|
|
1964
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
2342
1965
|
*/
|
|
2343
|
-
|
|
2344
|
-
/** The Three.js mesh that contains the infinite grid. */
|
|
2345
|
-
readonly three: THREE.Mesh;
|
|
2346
|
-
private _fade;
|
|
2347
|
-
constructor(components: Components, world: World, config: GridConfig);
|
|
2348
|
-
/** {@link Disposable.dispose} */
|
|
2349
|
-
dispose(): void;
|
|
2350
|
-
private setupEvents;
|
|
2351
|
-
private updateZoom;
|
|
2352
|
-
}
|
|
2353
|
-
import * as THREE from "three";
|
|
2354
|
-
import { Components } from "../../Components";
|
|
2355
|
-
import { AsyncEvent, Event, World } from "../../Types";
|
|
2356
|
-
/**
|
|
2357
|
-
* Settings to configure the CullerRenderer.
|
|
2358
|
-
*/
|
|
2359
|
-
export interface CullerRendererSettings {
|
|
1966
|
+
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
2360
1967
|
/**
|
|
2361
|
-
*
|
|
2362
|
-
*
|
|
1968
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
1969
|
+
*
|
|
1970
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1971
|
+
* @param name - The name of the Pset.
|
|
1972
|
+
* @param description - (Optional) The description of the Pset.
|
|
1973
|
+
*
|
|
1974
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1975
|
+
*
|
|
1976
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1977
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2363
1978
|
*/
|
|
2364
|
-
|
|
1979
|
+
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
1980
|
+
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
1981
|
+
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
1982
|
+
}>;
|
|
2365
1983
|
/**
|
|
2366
|
-
*
|
|
2367
|
-
*
|
|
1984
|
+
* Removes a Property Set (Pset) from the given model.
|
|
1985
|
+
*
|
|
1986
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1987
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
1988
|
+
*
|
|
1989
|
+
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
1990
|
+
*
|
|
1991
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1992
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1993
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
2368
1994
|
*/
|
|
2369
|
-
|
|
1995
|
+
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
2370
1996
|
/**
|
|
2371
|
-
*
|
|
2372
|
-
*
|
|
1997
|
+
* Creates a new single-value property of type string in the given model.
|
|
1998
|
+
*
|
|
1999
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
2000
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
2001
|
+
* @param name - The name of the property.
|
|
2002
|
+
* @param value - The value of the property. Must be a string.
|
|
2003
|
+
*
|
|
2004
|
+
* @returns The newly created single-value property.
|
|
2005
|
+
*
|
|
2006
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
2007
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2373
2008
|
*/
|
|
2374
|
-
|
|
2009
|
+
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
2375
2010
|
/**
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2011
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
2012
|
+
*
|
|
2013
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
2014
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
2015
|
+
* @param name - The name of the property.
|
|
2016
|
+
* @param value - The value of the property. Must be a number.
|
|
2017
|
+
*
|
|
2018
|
+
* @returns The newly created single-value property.
|
|
2019
|
+
*
|
|
2020
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
2021
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2378
2022
|
*/
|
|
2379
|
-
|
|
2380
|
-
}
|
|
2381
|
-
/**
|
|
2382
|
-
* A base renderer to determine visibility on screen.
|
|
2383
|
-
*/
|
|
2384
|
-
export declare class CullerRenderer {
|
|
2385
|
-
/** {@link Disposable.onDisposed} */
|
|
2386
|
-
readonly onDisposed: Event<string>;
|
|
2023
|
+
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
2387
2024
|
/**
|
|
2388
|
-
*
|
|
2389
|
-
*
|
|
2390
|
-
*
|
|
2025
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
2026
|
+
*
|
|
2027
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
2028
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
2029
|
+
* @param name - The name of the property.
|
|
2030
|
+
* @param value - The value of the property. Must be a boolean.
|
|
2031
|
+
*
|
|
2032
|
+
* @returns The newly created single-value property.
|
|
2033
|
+
*
|
|
2034
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
2035
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2391
2036
|
*/
|
|
2392
|
-
|
|
2037
|
+
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
2393
2038
|
/**
|
|
2394
|
-
*
|
|
2039
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
2040
|
+
*
|
|
2041
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
2042
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
2043
|
+
* @param propID - The express ID of the property to be removed.
|
|
2044
|
+
*
|
|
2045
|
+
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
2046
|
+
*
|
|
2047
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
2048
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
2395
2049
|
*/
|
|
2396
|
-
|
|
2050
|
+
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
2051
|
+
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
2397
2052
|
/**
|
|
2398
|
-
*
|
|
2399
|
-
*
|
|
2053
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
2054
|
+
*
|
|
2055
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
2056
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
2057
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
2058
|
+
*
|
|
2059
|
+
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
2060
|
+
*
|
|
2061
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
2062
|
+
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
2063
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
2400
2064
|
*/
|
|
2401
|
-
|
|
2065
|
+
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
2402
2066
|
/**
|
|
2403
|
-
*
|
|
2404
|
-
*
|
|
2067
|
+
* Saves the changes made to the model to a new IFC file.
|
|
2068
|
+
*
|
|
2069
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
2070
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
2071
|
+
*
|
|
2072
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
2073
|
+
*
|
|
2074
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
2405
2075
|
*/
|
|
2406
|
-
|
|
2407
|
-
/** The components instance to which this renderer belongs. */
|
|
2408
|
-
components: Components;
|
|
2409
|
-
/** The world instance to which this renderer belongs. */
|
|
2410
|
-
readonly world: World;
|
|
2411
|
-
/** The THREE.js renderer used to make the visibility test. */
|
|
2412
|
-
readonly renderer: THREE.WebGLRenderer;
|
|
2413
|
-
protected autoUpdate: boolean;
|
|
2414
|
-
protected updateInterval: number;
|
|
2415
|
-
protected readonly worker: Worker;
|
|
2416
|
-
protected readonly scene: THREE.Scene;
|
|
2417
|
-
private _width;
|
|
2418
|
-
private _height;
|
|
2419
|
-
private _availableColor;
|
|
2420
|
-
private readonly renderTarget;
|
|
2421
|
-
private readonly bufferSize;
|
|
2422
|
-
private readonly _buffer;
|
|
2423
|
-
protected _isWorkerBusy: boolean;
|
|
2424
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2425
|
-
/** {@link Disposable.dispose} */
|
|
2426
|
-
dispose(): void;
|
|
2076
|
+
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
2427
2077
|
/**
|
|
2428
|
-
*
|
|
2429
|
-
*
|
|
2430
|
-
*
|
|
2431
|
-
*
|
|
2078
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
2079
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
2080
|
+
*
|
|
2081
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
2082
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
2083
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
2084
|
+
*
|
|
2085
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
2086
|
+
*
|
|
2087
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
2088
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
2089
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
2432
2090
|
*/
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
};
|
|
2440
|
-
protected increaseColor(): void;
|
|
2441
|
-
protected decreaseColor(): void;
|
|
2442
|
-
private applySettings;
|
|
2091
|
+
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
2092
|
+
private increaseMaxID;
|
|
2093
|
+
private newGUID;
|
|
2094
|
+
private getOwnerHistory;
|
|
2095
|
+
private registerChange;
|
|
2096
|
+
private newSingleProperty;
|
|
2443
2097
|
}
|
|
2444
|
-
|
|
2098
|
+
/**
|
|
2099
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
2100
|
+
*/
|
|
2101
|
+
export declare const GeometryTypes: Set<number>;
|
|
2445
2102
|
import * as THREE from "three";
|
|
2446
|
-
import {
|
|
2447
|
-
import { Components } from "../../Components";
|
|
2448
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2103
|
+
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
2449
2104
|
/**
|
|
2450
|
-
* A
|
|
2105
|
+
* A class representing a 2D minimap of a 3D world.
|
|
2451
2106
|
*/
|
|
2452
|
-
export declare class
|
|
2107
|
+
export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
2108
|
+
/** {@link Disposable.onDisposed} */
|
|
2109
|
+
readonly onDisposed: Event<unknown>;
|
|
2110
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2111
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2112
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2113
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2114
|
+
/** {@link Resizeable.onResize} */
|
|
2115
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
2453
2116
|
/**
|
|
2454
|
-
*
|
|
2455
|
-
*
|
|
2117
|
+
* The front offset of the minimap.
|
|
2118
|
+
* It determines how much the minimap's view is offset from the camera's view.
|
|
2119
|
+
* By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
2456
2120
|
*/
|
|
2457
|
-
|
|
2458
|
-
seen: Set<THREE.Mesh>;
|
|
2459
|
-
unseen: Set<THREE.Mesh>;
|
|
2460
|
-
}>;
|
|
2121
|
+
frontOffset: number;
|
|
2461
2122
|
/**
|
|
2462
|
-
*
|
|
2463
|
-
*
|
|
2123
|
+
* The override material for the minimap.
|
|
2124
|
+
* It is used to render the depth information of the world onto the minimap.
|
|
2464
2125
|
*/
|
|
2465
|
-
|
|
2126
|
+
overrideMaterial: THREE.MeshDepthMaterial;
|
|
2466
2127
|
/**
|
|
2467
|
-
*
|
|
2468
|
-
*
|
|
2128
|
+
* The background color of the minimap.
|
|
2129
|
+
* It is used to set the background color of the minimap's renderer.
|
|
2469
2130
|
*/
|
|
2470
|
-
|
|
2131
|
+
backgroundColor: THREE.Color;
|
|
2471
2132
|
/**
|
|
2472
|
-
*
|
|
2473
|
-
*
|
|
2133
|
+
* The WebGL renderer for the minimap.
|
|
2134
|
+
* It is used to render the minimap onto the screen.
|
|
2474
2135
|
*/
|
|
2475
|
-
|
|
2476
|
-
private _colorCodeMeshMap;
|
|
2477
|
-
private _meshIDColorCodeMap;
|
|
2478
|
-
private _currentVisibleMeshes;
|
|
2479
|
-
private _recentlyHiddenMeshes;
|
|
2480
|
-
private _intervalID;
|
|
2481
|
-
private readonly _transparentMat;
|
|
2482
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2483
|
-
/** {@link Disposable.dispose} */
|
|
2484
|
-
dispose(): void;
|
|
2136
|
+
renderer: THREE.WebGLRenderer;
|
|
2485
2137
|
/**
|
|
2486
|
-
*
|
|
2487
|
-
*
|
|
2488
|
-
* @returns {void}
|
|
2138
|
+
* A flag indicating whether the minimap is enabled.
|
|
2139
|
+
* If disabled, the minimap will not update or render.
|
|
2489
2140
|
*/
|
|
2490
|
-
|
|
2141
|
+
enabled: boolean;
|
|
2491
2142
|
/**
|
|
2492
|
-
*
|
|
2493
|
-
*
|
|
2494
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2495
|
-
* @returns {void}
|
|
2143
|
+
* The world in which the minimap is displayed.
|
|
2144
|
+
* It provides access to the 3D scene, camera, and other relevant world elements.
|
|
2496
2145
|
*/
|
|
2497
|
-
|
|
2498
|
-
private
|
|
2499
|
-
private
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
export declare class Mouse implements Disposable {
|
|
2507
|
-
dom: HTMLCanvasElement;
|
|
2508
|
-
private _event?;
|
|
2509
|
-
private _position;
|
|
2510
|
-
/** {@link Disposable.onDisposed} */
|
|
2511
|
-
readonly onDisposed: Event<unknown>;
|
|
2512
|
-
constructor(dom: HTMLCanvasElement);
|
|
2146
|
+
world: World;
|
|
2147
|
+
private _lockRotation;
|
|
2148
|
+
private _camera;
|
|
2149
|
+
private _plane;
|
|
2150
|
+
private _size;
|
|
2151
|
+
private _tempVector1;
|
|
2152
|
+
private _tempVector2;
|
|
2153
|
+
private _tempTarget;
|
|
2154
|
+
private readonly down;
|
|
2513
2155
|
/**
|
|
2514
|
-
*
|
|
2156
|
+
* Gets or sets whether the minimap rotation is locked.
|
|
2157
|
+
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2515
2158
|
*/
|
|
2516
|
-
get
|
|
2517
|
-
/** {@link Disposable.dispose} */
|
|
2518
|
-
dispose(): void;
|
|
2519
|
-
private getPositionY;
|
|
2520
|
-
private getPositionX;
|
|
2521
|
-
private updateMouseInfo;
|
|
2522
|
-
private setupEvents;
|
|
2523
|
-
}
|
|
2524
|
-
import * as THREE from "three";
|
|
2525
|
-
import { Components } from "../../Components";
|
|
2526
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2527
|
-
import { Mouse } from "./mouse";
|
|
2528
|
-
/**
|
|
2529
|
-
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
2530
|
-
*/
|
|
2531
|
-
export declare class SimpleRaycaster implements Disposable {
|
|
2532
|
-
/** {@link Component.enabled} */
|
|
2533
|
-
enabled: boolean;
|
|
2534
|
-
/** The components instance to which this Raycaster belongs. */
|
|
2535
|
-
components: Components;
|
|
2536
|
-
/** {@link Disposable.onDisposed} */
|
|
2537
|
-
readonly onDisposed: Event<unknown>;
|
|
2538
|
-
/** The position of the mouse in the screen. */
|
|
2539
|
-
readonly mouse: Mouse;
|
|
2159
|
+
get lockRotation(): boolean;
|
|
2540
2160
|
/**
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2161
|
+
* Sets whether the minimap rotation is locked.
|
|
2162
|
+
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2163
|
+
* @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
|
|
2543
2164
|
*/
|
|
2544
|
-
|
|
2165
|
+
set lockRotation(active: boolean);
|
|
2545
2166
|
/**
|
|
2546
|
-
*
|
|
2547
|
-
*
|
|
2167
|
+
* Gets the current zoom level of the minimap.
|
|
2168
|
+
* The zoom level determines how much of the world is visible on the minimap.
|
|
2169
|
+
* @returns The current zoom level of the minimap.
|
|
2548
2170
|
*/
|
|
2549
|
-
|
|
2550
|
-
|
|
2171
|
+
get zoom(): number;
|
|
2172
|
+
/**
|
|
2173
|
+
* Sets the zoom level of the minimap.
|
|
2174
|
+
* The zoom level determines how much of the world is visible on the minimap.
|
|
2175
|
+
* @param value - The new zoom level of the minimap.
|
|
2176
|
+
*/
|
|
2177
|
+
set zoom(value: number);
|
|
2178
|
+
constructor(world: World);
|
|
2551
2179
|
/** {@link Disposable.dispose} */
|
|
2552
2180
|
dispose(): void;
|
|
2181
|
+
/** Returns the camera used by the MiniMap */
|
|
2182
|
+
get(): THREE.OrthographicCamera;
|
|
2183
|
+
/** {@link Updateable.update} */
|
|
2184
|
+
update(): void;
|
|
2185
|
+
/** {@link Resizeable.getSize} */
|
|
2186
|
+
getSize(): THREE.Vector2;
|
|
2187
|
+
/** {@link Resizeable.resize} */
|
|
2188
|
+
resize(size?: THREE.Vector2): void;
|
|
2189
|
+
private updatePlanes;
|
|
2190
|
+
}
|
|
2191
|
+
import * as WEBIFC from "web-ifc";
|
|
2192
|
+
/** Configuration of the IFC-fragment conversion. */
|
|
2193
|
+
export declare class IfcFragmentSettings {
|
|
2194
|
+
/** Whether to extract the IFC properties into a JSON. */
|
|
2195
|
+
includeProperties: boolean;
|
|
2553
2196
|
/**
|
|
2554
|
-
*
|
|
2555
|
-
*
|
|
2556
|
-
* used by the renderer.
|
|
2557
|
-
*
|
|
2558
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
2559
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
2560
|
-
* {@link Components.meshes}.
|
|
2197
|
+
* Generate the geometry for categories that are not included by default,
|
|
2198
|
+
* like IFCSPACE.
|
|
2561
2199
|
*/
|
|
2562
|
-
|
|
2200
|
+
optionalCategories: number[];
|
|
2201
|
+
/** Whether to use the coordination data coming from the IFC files. */
|
|
2202
|
+
coordinate: boolean;
|
|
2203
|
+
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2204
|
+
wasm: {
|
|
2205
|
+
path: string;
|
|
2206
|
+
absolute: boolean;
|
|
2207
|
+
logLevel?: WEBIFC.LogLevel;
|
|
2208
|
+
};
|
|
2209
|
+
/** List of categories that won't be converted to fragments. */
|
|
2210
|
+
excludedCategories: Set<number>;
|
|
2211
|
+
/** Whether to save the absolute location of all IFC items. */
|
|
2212
|
+
saveLocations: boolean;
|
|
2213
|
+
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2214
|
+
webIfc: WEBIFC.LoaderSettings;
|
|
2563
2215
|
/**
|
|
2564
|
-
*
|
|
2565
|
-
*
|
|
2216
|
+
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2217
|
+
* If set to true, the path will be set to the default path of the WASM file.
|
|
2218
|
+
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2219
|
+
* Default value is true.
|
|
2220
|
+
*/
|
|
2221
|
+
autoSetWasm: boolean;
|
|
2222
|
+
/**
|
|
2223
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2224
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2225
|
+
* If set to null, the default file location handler will be used.
|
|
2566
2226
|
*
|
|
2567
|
-
* @param
|
|
2568
|
-
* @
|
|
2569
|
-
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
2570
|
-
* @returns The first intersection found or 'null' if no intersection was found.
|
|
2227
|
+
* @param url - The URL of the file to locate.
|
|
2228
|
+
* @returns The absolute path of the file.
|
|
2571
2229
|
*/
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2230
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2231
|
+
}
|
|
2232
|
+
import * as WEBIFC from "web-ifc";
|
|
2233
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2234
|
+
export declare class SpatialStructure {
|
|
2235
|
+
itemsByFloor: IfcItemsCategories;
|
|
2236
|
+
private _units;
|
|
2237
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2238
|
+
cleanUp(): void;
|
|
2239
|
+
}
|
|
2240
|
+
import * as WEBIFC from "web-ifc";
|
|
2241
|
+
export interface IfcItemsCategories {
|
|
2242
|
+
[itemID: number]: number;
|
|
2243
|
+
}
|
|
2244
|
+
export declare class IfcCategories {
|
|
2245
|
+
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
|
|
2249
|
+
*
|
|
2250
|
+
* @remarks
|
|
2251
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2252
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2253
|
+
*
|
|
2254
|
+
*/
|
|
2255
|
+
export declare const IfcElements: {
|
|
2256
|
+
[key: number]: string;
|
|
2257
|
+
};
|
|
2258
|
+
/**
|
|
2259
|
+
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
2260
|
+
*/
|
|
2261
|
+
export declare const IfcCategoryMap: {
|
|
2262
|
+
[key: number]: string;
|
|
2263
|
+
};
|
|
2264
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2265
|
+
export declare class IfcPropertiesUtils {
|
|
2266
|
+
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2267
|
+
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2268
|
+
[attribute: string]: any;
|
|
2269
|
+
} | null>;
|
|
2270
|
+
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2271
|
+
[relatingID: number]: number[];
|
|
2272
|
+
}>;
|
|
2273
|
+
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2274
|
+
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2275
|
+
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2276
|
+
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2277
|
+
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2278
|
+
key: string | null;
|
|
2279
|
+
name: string | null;
|
|
2280
|
+
}>;
|
|
2281
|
+
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2282
|
+
key: string | null;
|
|
2283
|
+
value: number | null;
|
|
2284
|
+
}>;
|
|
2285
|
+
static isRel(expressID: number): boolean;
|
|
2286
|
+
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2287
|
+
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2575
2288
|
}
|
|
2576
2289
|
/**
|
|
2577
2290
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
@@ -2737,19 +2450,6 @@ export interface CameraControllable {
|
|
|
2737
2450
|
*/
|
|
2738
2451
|
controls: CameraControls;
|
|
2739
2452
|
}
|
|
2740
|
-
import { Base } from "./base";
|
|
2741
|
-
/**
|
|
2742
|
-
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
2743
|
-
*/
|
|
2744
|
-
export declare abstract class Component extends Base {
|
|
2745
|
-
/**
|
|
2746
|
-
* Whether this component is active or not. The behaviour can vary depending
|
|
2747
|
-
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2748
|
-
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2749
|
-
* will not be updated automatically each frame.
|
|
2750
|
-
*/
|
|
2751
|
-
abstract enabled: boolean;
|
|
2752
|
-
}
|
|
2753
2453
|
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2754
2454
|
import { Components } from "../../Components";
|
|
2755
2455
|
/**
|
|
@@ -2770,6 +2470,24 @@ export declare abstract class Base {
|
|
|
2770
2470
|
isConfigurable: () => this is Configurable<any>;
|
|
2771
2471
|
}
|
|
2772
2472
|
import { Base } from "./base";
|
|
2473
|
+
/**
|
|
2474
|
+
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
2475
|
+
*/
|
|
2476
|
+
export declare abstract class Component extends Base {
|
|
2477
|
+
/**
|
|
2478
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
2479
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2480
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2481
|
+
* will not be updated automatically each frame.
|
|
2482
|
+
*/
|
|
2483
|
+
abstract enabled: boolean;
|
|
2484
|
+
}
|
|
2485
|
+
import { InverseAttribute } from "./types";
|
|
2486
|
+
export declare const relToAttributesMap: Map<number, {
|
|
2487
|
+
forRelating: InverseAttribute;
|
|
2488
|
+
forRelated: InverseAttribute;
|
|
2489
|
+
}>;
|
|
2490
|
+
import { Base } from "./base";
|
|
2773
2491
|
import { World } from "./world";
|
|
2774
2492
|
import { Event } from "./event";
|
|
2775
2493
|
import { Components } from "../../Components";
|
|
@@ -2906,6 +2624,126 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
|
|
|
2906
2624
|
dispose(): void;
|
|
2907
2625
|
}
|
|
2908
2626
|
import * as THREE from "three";
|
|
2627
|
+
import { BaseScene } from "./base-scene";
|
|
2628
|
+
import { BaseCamera } from "./base-camera";
|
|
2629
|
+
import { BaseRenderer } from "./base-renderer";
|
|
2630
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
2631
|
+
/**
|
|
2632
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2633
|
+
*/
|
|
2634
|
+
export interface World extends Disposable, Updateable {
|
|
2635
|
+
/**
|
|
2636
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2637
|
+
*/
|
|
2638
|
+
meshes: Set<THREE.Mesh>;
|
|
2639
|
+
/**
|
|
2640
|
+
* The base scene of the world.
|
|
2641
|
+
*/
|
|
2642
|
+
scene: BaseScene;
|
|
2643
|
+
/**
|
|
2644
|
+
* The base camera of the world.
|
|
2645
|
+
*/
|
|
2646
|
+
camera: BaseCamera;
|
|
2647
|
+
/**
|
|
2648
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
2649
|
+
*/
|
|
2650
|
+
renderer: BaseRenderer | null;
|
|
2651
|
+
/**
|
|
2652
|
+
* A unique identifier for the world.
|
|
2653
|
+
*/
|
|
2654
|
+
uuid: string;
|
|
2655
|
+
/**
|
|
2656
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
2657
|
+
*/
|
|
2658
|
+
isDisposing: boolean;
|
|
2659
|
+
}
|
|
2660
|
+
import * as THREE from "three";
|
|
2661
|
+
import { Disposable, Event } from "../../Types";
|
|
2662
|
+
/**
|
|
2663
|
+
* A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
|
|
2664
|
+
*/
|
|
2665
|
+
export declare class Mouse implements Disposable {
|
|
2666
|
+
dom: HTMLCanvasElement;
|
|
2667
|
+
private _event?;
|
|
2668
|
+
private _position;
|
|
2669
|
+
/** {@link Disposable.onDisposed} */
|
|
2670
|
+
readonly onDisposed: Event<unknown>;
|
|
2671
|
+
constructor(dom: HTMLCanvasElement);
|
|
2672
|
+
/**
|
|
2673
|
+
* The real position of the mouse of the Three.js canvas.
|
|
2674
|
+
*/
|
|
2675
|
+
get position(): THREE.Vector2;
|
|
2676
|
+
/** {@link Disposable.dispose} */
|
|
2677
|
+
dispose(): void;
|
|
2678
|
+
private getPositionY;
|
|
2679
|
+
private getPositionX;
|
|
2680
|
+
private updateMouseInfo;
|
|
2681
|
+
private setupEvents;
|
|
2682
|
+
}
|
|
2683
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2684
|
+
/**
|
|
2685
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
2686
|
+
*/
|
|
2687
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
2688
|
+
/**
|
|
2689
|
+
* Amount of properties to be streamed.
|
|
2690
|
+
* Defaults to 100 properties.
|
|
2691
|
+
*/
|
|
2692
|
+
propertiesSize: number;
|
|
2693
|
+
}
|
|
2694
|
+
import * as THREE from "three";
|
|
2695
|
+
import { Components } from "../../Components";
|
|
2696
|
+
import { Event, World, Disposable } from "../../Types";
|
|
2697
|
+
import { Mouse } from "./mouse";
|
|
2698
|
+
/**
|
|
2699
|
+
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
2700
|
+
*/
|
|
2701
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
2702
|
+
/** {@link Component.enabled} */
|
|
2703
|
+
enabled: boolean;
|
|
2704
|
+
/** The components instance to which this Raycaster belongs. */
|
|
2705
|
+
components: Components;
|
|
2706
|
+
/** {@link Disposable.onDisposed} */
|
|
2707
|
+
readonly onDisposed: Event<unknown>;
|
|
2708
|
+
/** The position of the mouse in the screen. */
|
|
2709
|
+
readonly mouse: Mouse;
|
|
2710
|
+
/**
|
|
2711
|
+
* A reference to the Three.js Raycaster instance.
|
|
2712
|
+
* This is used for raycasting operations.
|
|
2713
|
+
*/
|
|
2714
|
+
readonly three: THREE.Raycaster;
|
|
2715
|
+
/**
|
|
2716
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
2717
|
+
* This is used to access the camera and meshes.
|
|
2718
|
+
*/
|
|
2719
|
+
world: World;
|
|
2720
|
+
constructor(components: Components, world: World);
|
|
2721
|
+
/** {@link Disposable.dispose} */
|
|
2722
|
+
dispose(): void;
|
|
2723
|
+
/**
|
|
2724
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
2725
|
+
* the first item found. This also takes into account the clipping planes
|
|
2726
|
+
* used by the renderer.
|
|
2727
|
+
*
|
|
2728
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
2729
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
2730
|
+
* {@link Components.meshes}.
|
|
2731
|
+
*/
|
|
2732
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
2733
|
+
/**
|
|
2734
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
2735
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
2736
|
+
*
|
|
2737
|
+
* @param origin - The origin of the ray.
|
|
2738
|
+
* @param direction - The direction of the ray.
|
|
2739
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
2740
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
2741
|
+
*/
|
|
2742
|
+
castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
|
|
2743
|
+
private intersect;
|
|
2744
|
+
private filterClippingPlanes;
|
|
2745
|
+
}
|
|
2746
|
+
import * as THREE from "three";
|
|
2909
2747
|
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2910
2748
|
/**
|
|
2911
2749
|
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
@@ -2985,40 +2823,6 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
|
|
|
2985
2823
|
dispose(disposeResources?: boolean): void;
|
|
2986
2824
|
}
|
|
2987
2825
|
import * as THREE from "three";
|
|
2988
|
-
import { BaseScene } from "./base-scene";
|
|
2989
|
-
import { BaseCamera } from "./base-camera";
|
|
2990
|
-
import { BaseRenderer } from "./base-renderer";
|
|
2991
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
2992
|
-
/**
|
|
2993
|
-
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2994
|
-
*/
|
|
2995
|
-
export interface World extends Disposable, Updateable {
|
|
2996
|
-
/**
|
|
2997
|
-
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2998
|
-
*/
|
|
2999
|
-
meshes: Set<THREE.Mesh>;
|
|
3000
|
-
/**
|
|
3001
|
-
* The base scene of the world.
|
|
3002
|
-
*/
|
|
3003
|
-
scene: BaseScene;
|
|
3004
|
-
/**
|
|
3005
|
-
* The base camera of the world.
|
|
3006
|
-
*/
|
|
3007
|
-
camera: BaseCamera;
|
|
3008
|
-
/**
|
|
3009
|
-
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
3010
|
-
*/
|
|
3011
|
-
renderer: BaseRenderer | null;
|
|
3012
|
-
/**
|
|
3013
|
-
* A unique identifier for the world.
|
|
3014
|
-
*/
|
|
3015
|
-
uuid: string;
|
|
3016
|
-
/**
|
|
3017
|
-
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
3018
|
-
*/
|
|
3019
|
-
isDisposing: boolean;
|
|
3020
|
-
}
|
|
3021
|
-
import * as THREE from "three";
|
|
3022
2826
|
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3023
2827
|
import { Components } from "../../Components";
|
|
3024
2828
|
/**
|
|
@@ -3144,34 +2948,93 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
|
|
|
3144
2948
|
*/
|
|
3145
2949
|
get controls(): CameraControls;
|
|
3146
2950
|
/**
|
|
3147
|
-
* Getter for the enabled state of the camera controls.
|
|
3148
|
-
* If the current world is null, it returns false.
|
|
3149
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
3150
|
-
*
|
|
3151
|
-
* @returns {boolean} The enabled state of the camera controls.
|
|
2951
|
+
* Getter for the enabled state of the camera controls.
|
|
2952
|
+
* If the current world is null, it returns false.
|
|
2953
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
2954
|
+
*
|
|
2955
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
2956
|
+
*/
|
|
2957
|
+
get enabled(): boolean;
|
|
2958
|
+
/**
|
|
2959
|
+
* Setter for the enabled state of the camera controls.
|
|
2960
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
2961
|
+
*
|
|
2962
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2963
|
+
*/
|
|
2964
|
+
set enabled(enabled: boolean);
|
|
2965
|
+
constructor(components: Components);
|
|
2966
|
+
/** {@link Disposable.dispose} */
|
|
2967
|
+
dispose(): void;
|
|
2968
|
+
/** {@link Updateable.update} */
|
|
2969
|
+
update(_delta: number): void;
|
|
2970
|
+
/**
|
|
2971
|
+
* Updates the aspect of the camera to match the size of the
|
|
2972
|
+
* {@link Components.renderer}.
|
|
2973
|
+
*/
|
|
2974
|
+
updateAspect: () => void;
|
|
2975
|
+
private setupCamera;
|
|
2976
|
+
private newCameraControls;
|
|
2977
|
+
private setupEvents;
|
|
2978
|
+
private static getSubsetOfThree;
|
|
2979
|
+
}
|
|
2980
|
+
import * as THREE from "three";
|
|
2981
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2982
|
+
import { Components } from "../../Components";
|
|
2983
|
+
/**
|
|
2984
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
2985
|
+
*/
|
|
2986
|
+
export interface GridConfig {
|
|
2987
|
+
/**
|
|
2988
|
+
* The color of the grid lines.
|
|
2989
|
+
*/
|
|
2990
|
+
color: THREE.Color;
|
|
2991
|
+
/**
|
|
2992
|
+
* The size of the primary grid lines.
|
|
2993
|
+
*/
|
|
2994
|
+
size1: number;
|
|
2995
|
+
/**
|
|
2996
|
+
* The size of the secondary grid lines.
|
|
2997
|
+
*/
|
|
2998
|
+
size2: number;
|
|
2999
|
+
/**
|
|
3000
|
+
* The distance at which the grid lines start to fade away.
|
|
3001
|
+
*/
|
|
3002
|
+
distance: number;
|
|
3003
|
+
}
|
|
3004
|
+
/**
|
|
3005
|
+
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
3006
|
+
*/
|
|
3007
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
3008
|
+
/** {@link Disposable.onDisposed} */
|
|
3009
|
+
readonly onDisposed: Event<unknown>;
|
|
3010
|
+
/** The world instance to which this Raycaster belongs. */
|
|
3011
|
+
world: World;
|
|
3012
|
+
/** The components instance to which this grid belongs. */
|
|
3013
|
+
components: Components;
|
|
3014
|
+
/** {@link Hideable.visible} */
|
|
3015
|
+
get visible(): boolean;
|
|
3016
|
+
/** {@link Hideable.visible} */
|
|
3017
|
+
set visible(visible: boolean);
|
|
3018
|
+
/** The material of the grid. */
|
|
3019
|
+
get material(): THREE.ShaderMaterial;
|
|
3020
|
+
/**
|
|
3021
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3022
|
+
* perspective cameras and false for orthographic cameras.
|
|
3152
3023
|
*/
|
|
3153
|
-
get
|
|
3024
|
+
get fade(): boolean;
|
|
3154
3025
|
/**
|
|
3155
|
-
*
|
|
3156
|
-
*
|
|
3157
|
-
*
|
|
3158
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3026
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3027
|
+
* perspective cameras and false for orthographic cameras.
|
|
3159
3028
|
*/
|
|
3160
|
-
set
|
|
3161
|
-
|
|
3029
|
+
set fade(active: boolean);
|
|
3030
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
3031
|
+
readonly three: THREE.Mesh;
|
|
3032
|
+
private _fade;
|
|
3033
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
3162
3034
|
/** {@link Disposable.dispose} */
|
|
3163
3035
|
dispose(): void;
|
|
3164
|
-
/** {@link Updateable.update} */
|
|
3165
|
-
update(_delta: number): void;
|
|
3166
|
-
/**
|
|
3167
|
-
* Updates the aspect of the camera to match the size of the
|
|
3168
|
-
* {@link Components.renderer}.
|
|
3169
|
-
*/
|
|
3170
|
-
updateAspect: () => void;
|
|
3171
|
-
private setupCamera;
|
|
3172
|
-
private newCameraControls;
|
|
3173
3036
|
private setupEvents;
|
|
3174
|
-
private
|
|
3037
|
+
private updateZoom;
|
|
3175
3038
|
}
|
|
3176
3039
|
import { NavigationMode } from "./types";
|
|
3177
3040
|
import { OrthoPerspectiveCamera } from "../index";
|
|
@@ -3296,15 +3159,153 @@ export interface NavigationMode {
|
|
|
3296
3159
|
/** Whether this navigation mode is active or not. */
|
|
3297
3160
|
enabled: boolean;
|
|
3298
3161
|
}
|
|
3299
|
-
import * as WEBIFC from "web-ifc";
|
|
3300
3162
|
import * as THREE from "three";
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3163
|
+
import { Components } from "../../Components";
|
|
3164
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
3165
|
+
/**
|
|
3166
|
+
* Settings to configure the CullerRenderer.
|
|
3167
|
+
*/
|
|
3168
|
+
export interface CullerRendererSettings {
|
|
3169
|
+
/**
|
|
3170
|
+
* Interval in milliseconds at which the visibility check should be performed.
|
|
3171
|
+
* Default value is 1000.
|
|
3172
|
+
*/
|
|
3173
|
+
updateInterval?: number;
|
|
3174
|
+
/**
|
|
3175
|
+
* Width of the render target used for visibility checks.
|
|
3176
|
+
* Default value is 512.
|
|
3177
|
+
*/
|
|
3178
|
+
width?: number;
|
|
3179
|
+
/**
|
|
3180
|
+
* Height of the render target used for visibility checks.
|
|
3181
|
+
* Default value is 512.
|
|
3182
|
+
*/
|
|
3183
|
+
height?: number;
|
|
3184
|
+
/**
|
|
3185
|
+
* Whether the visibility check should be performed automatically.
|
|
3186
|
+
* Default value is true.
|
|
3187
|
+
*/
|
|
3188
|
+
autoUpdate?: boolean;
|
|
3189
|
+
}
|
|
3190
|
+
/**
|
|
3191
|
+
* A base renderer to determine visibility on screen.
|
|
3192
|
+
*/
|
|
3193
|
+
export declare class CullerRenderer {
|
|
3194
|
+
/** {@link Disposable.onDisposed} */
|
|
3195
|
+
readonly onDisposed: Event<string>;
|
|
3196
|
+
/**
|
|
3197
|
+
* Fires after making the visibility check to the meshes. It lists the
|
|
3198
|
+
* meshes that are currently visible, and the ones that were visible
|
|
3199
|
+
* just before but not anymore.
|
|
3200
|
+
*/
|
|
3201
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
3202
|
+
/**
|
|
3203
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
3204
|
+
*/
|
|
3205
|
+
enabled: boolean;
|
|
3206
|
+
/**
|
|
3207
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
3208
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
3209
|
+
*/
|
|
3210
|
+
needsUpdate: boolean;
|
|
3211
|
+
/**
|
|
3212
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
3213
|
+
* for debugging purposes.
|
|
3214
|
+
*/
|
|
3215
|
+
renderDebugFrame: boolean;
|
|
3216
|
+
/** The components instance to which this renderer belongs. */
|
|
3217
|
+
components: Components;
|
|
3218
|
+
/** The world instance to which this renderer belongs. */
|
|
3219
|
+
readonly world: World;
|
|
3220
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
3221
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
3222
|
+
protected autoUpdate: boolean;
|
|
3223
|
+
protected updateInterval: number;
|
|
3224
|
+
protected readonly worker: Worker;
|
|
3225
|
+
protected readonly scene: THREE.Scene;
|
|
3226
|
+
private _width;
|
|
3227
|
+
private _height;
|
|
3228
|
+
private _availableColor;
|
|
3229
|
+
private readonly renderTarget;
|
|
3230
|
+
private readonly bufferSize;
|
|
3231
|
+
private readonly _buffer;
|
|
3232
|
+
protected _isWorkerBusy: boolean;
|
|
3233
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3234
|
+
/** {@link Disposable.dispose} */
|
|
3235
|
+
dispose(): void;
|
|
3236
|
+
/**
|
|
3237
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
3238
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
3239
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
3240
|
+
* not true.
|
|
3241
|
+
*/
|
|
3242
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
3243
|
+
protected getAvailableColor(): {
|
|
3244
|
+
r: number;
|
|
3245
|
+
g: number;
|
|
3246
|
+
b: number;
|
|
3247
|
+
code: string;
|
|
3248
|
+
};
|
|
3249
|
+
protected increaseColor(): void;
|
|
3250
|
+
protected decreaseColor(): void;
|
|
3251
|
+
private applySettings;
|
|
3252
|
+
}
|
|
3253
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
3254
|
+
import * as THREE from "three";
|
|
3255
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
3256
|
+
import { Components } from "../../Components";
|
|
3257
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3258
|
+
/**
|
|
3259
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
3260
|
+
*/
|
|
3261
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
3262
|
+
/**
|
|
3263
|
+
* Event triggered when the visibility of meshes is updated.
|
|
3264
|
+
* Contains two sets: seen and unseen.
|
|
3265
|
+
*/
|
|
3266
|
+
readonly onViewUpdated: Event<{
|
|
3267
|
+
seen: Set<THREE.Mesh>;
|
|
3268
|
+
unseen: Set<THREE.Mesh>;
|
|
3269
|
+
}>;
|
|
3270
|
+
/**
|
|
3271
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
3272
|
+
* Default value is 100.
|
|
3273
|
+
*/
|
|
3274
|
+
threshold: number;
|
|
3275
|
+
/**
|
|
3276
|
+
* Map of color code to THREE.InstancedMesh.
|
|
3277
|
+
* Used to keep track of color-coded meshes.
|
|
3278
|
+
*/
|
|
3279
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
3280
|
+
/**
|
|
3281
|
+
* Flag to indicate if the renderer is currently processing.
|
|
3282
|
+
* Used to prevent concurrent processing.
|
|
3283
|
+
*/
|
|
3284
|
+
isProcessing: boolean;
|
|
3285
|
+
private _colorCodeMeshMap;
|
|
3286
|
+
private _meshIDColorCodeMap;
|
|
3287
|
+
private _currentVisibleMeshes;
|
|
3288
|
+
private _recentlyHiddenMeshes;
|
|
3289
|
+
private _intervalID;
|
|
3290
|
+
private readonly _transparentMat;
|
|
3291
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3292
|
+
/** {@link Disposable.dispose} */
|
|
3293
|
+
dispose(): void;
|
|
3294
|
+
/**
|
|
3295
|
+
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
3296
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3297
|
+
* @returns {void}
|
|
3298
|
+
*/
|
|
3299
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3300
|
+
/**
|
|
3301
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
3302
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
3303
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3304
|
+
* @returns {void}
|
|
3305
|
+
*/
|
|
3306
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3307
|
+
private handleWorkerMessage;
|
|
3308
|
+
private getAvailableMaterial;
|
|
3308
3309
|
}
|
|
3309
3310
|
import * as THREE from "three";
|
|
3310
3311
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
@@ -3426,17 +3427,6 @@ export declare class IfcMetadataReader {
|
|
|
3426
3427
|
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3427
3428
|
}
|
|
3428
3429
|
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3429
|
-
/**
|
|
3430
|
-
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3431
|
-
*/
|
|
3432
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3433
|
-
/**
|
|
3434
|
-
* Amount of properties to be streamed.
|
|
3435
|
-
* Defaults to 100 properties.
|
|
3436
|
-
*/
|
|
3437
|
-
propertiesSize: number;
|
|
3438
|
-
}
|
|
3439
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3440
3430
|
/**
|
|
3441
3431
|
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3442
3432
|
*/
|
|
@@ -3452,6 +3442,40 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
|
3452
3442
|
*/
|
|
3453
3443
|
minAssetsSize: number;
|
|
3454
3444
|
}
|
|
3445
|
+
import * as WEBIFC from "web-ifc";
|
|
3446
|
+
import * as THREE from "three";
|
|
3447
|
+
export declare class Units {
|
|
3448
|
+
factor: number;
|
|
3449
|
+
complement: number;
|
|
3450
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3451
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3452
|
+
private getLengthUnits;
|
|
3453
|
+
private getScaleMatrix;
|
|
3454
|
+
}
|
|
3455
|
+
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
3456
|
+
export interface ModelsRelationMap {
|
|
3457
|
+
[modelID: string]: RelationsMap;
|
|
3458
|
+
}
|
|
3459
|
+
/**
|
|
3460
|
+
* Type alias for an array of inverse attribute names.
|
|
3461
|
+
*/
|
|
3462
|
+
export type InverseAttributes = [
|
|
3463
|
+
"IsDecomposedBy",
|
|
3464
|
+
"Decomposes",
|
|
3465
|
+
"AssociatedTo",
|
|
3466
|
+
"HasAssociations",
|
|
3467
|
+
"ClassificationForObjects",
|
|
3468
|
+
"IsGroupedBy",
|
|
3469
|
+
"HasAssignments",
|
|
3470
|
+
"IsDefinedBy",
|
|
3471
|
+
"DefinesOcurrence",
|
|
3472
|
+
"IsTypedBy",
|
|
3473
|
+
"Types",
|
|
3474
|
+
"Defines",
|
|
3475
|
+
"ContainedInStructure",
|
|
3476
|
+
"ContainsElements"
|
|
3477
|
+
];
|
|
3478
|
+
export type InverseAttribute = InverseAttributes[number];
|
|
3455
3479
|
/**
|
|
3456
3480
|
* A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
|
|
3457
3481
|
*/
|
|
@@ -3481,30 +3505,6 @@ export interface StreamedAsset {
|
|
|
3481
3505
|
color: number[];
|
|
3482
3506
|
}[];
|
|
3483
3507
|
}
|
|
3484
|
-
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
3485
|
-
export interface ModelsRelationMap {
|
|
3486
|
-
[modelID: string]: RelationsMap;
|
|
3487
|
-
}
|
|
3488
|
-
/**
|
|
3489
|
-
* Type alias for an array of inverse attribute names.
|
|
3490
|
-
*/
|
|
3491
|
-
export type InverseAttributes = [
|
|
3492
|
-
"IsDecomposedBy",
|
|
3493
|
-
"Decomposes",
|
|
3494
|
-
"AssociatedTo",
|
|
3495
|
-
"HasAssociations",
|
|
3496
|
-
"ClassificationForObjects",
|
|
3497
|
-
"IsGroupedBy",
|
|
3498
|
-
"HasAssignments",
|
|
3499
|
-
"IsDefinedBy",
|
|
3500
|
-
"DefinesOcurrence",
|
|
3501
|
-
"IsTypedBy",
|
|
3502
|
-
"Types",
|
|
3503
|
-
"Defines",
|
|
3504
|
-
"ContainedInStructure",
|
|
3505
|
-
"ContainsElements"
|
|
3506
|
-
];
|
|
3507
|
-
export type InverseAttribute = InverseAttributes[number];
|
|
3508
3508
|
import { BufferGeometry } from "three";
|
|
3509
3509
|
import * as THREE from "three";
|
|
3510
3510
|
export declare class TransformHelper {
|