@thatopen/components 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/ifc/IfcPropertiesManager/index.d.ts +5 -5
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +14 -2
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +610 -566
- package/dist/namespace.d.ts +1245 -1233
- package/package.json +1 -1
package/dist/namespace.d.ts
CHANGED
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { Components } from "../Components";
|
|
4
|
+
import { Component } from "../Types";
|
|
5
|
+
/**
|
|
6
|
+
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
7
|
+
*/
|
|
8
|
+
export declare class Disposer extends Component {
|
|
9
|
+
private _disposedComponents;
|
|
10
|
+
/** {@link Component.enabled} */
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* A unique identifier for the component.
|
|
14
|
+
* This UUID is used to register the component within the Components system.
|
|
15
|
+
*/
|
|
16
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
17
|
+
constructor(components: Components);
|
|
18
|
+
/**
|
|
19
|
+
* Return the UUIDs of all disposed components.
|
|
20
|
+
*/
|
|
21
|
+
get(): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
24
|
+
* using any of these in other parts of the application, make sure that you
|
|
25
|
+
* remove them from the mesh before disposing it.
|
|
26
|
+
*
|
|
27
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
28
|
+
* to remove.
|
|
29
|
+
*
|
|
30
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
31
|
+
*
|
|
32
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
33
|
+
*/
|
|
34
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
35
|
+
/**
|
|
36
|
+
* Disposes a geometry from memory.
|
|
37
|
+
*
|
|
38
|
+
* @param geometry - the
|
|
39
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
40
|
+
* to remove.
|
|
41
|
+
*/
|
|
42
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
43
|
+
private disposeGeometryAndMaterials;
|
|
44
|
+
private disposeChildren;
|
|
45
|
+
private static disposeMaterial;
|
|
46
|
+
}
|
|
2
47
|
import { Component, Disposable, World, Event } from "../Types";
|
|
3
48
|
import { SimpleRaycaster } from "./src";
|
|
4
49
|
import { Components } from "../Components";
|
|
@@ -49,7 +94,7 @@ export declare class Components implements Disposable {
|
|
|
49
94
|
/**
|
|
50
95
|
* The version of the @thatopen/components library.
|
|
51
96
|
*/
|
|
52
|
-
static readonly release = "2.1.
|
|
97
|
+
static readonly release = "2.1.6";
|
|
53
98
|
/** {@link Disposable.onDisposed} */
|
|
54
99
|
readonly onDisposed: Event<void>;
|
|
55
100
|
/**
|
|
@@ -117,51 +162,6 @@ export declare class Components implements Disposable {
|
|
|
117
162
|
private update;
|
|
118
163
|
private static setupBVH;
|
|
119
164
|
}
|
|
120
|
-
import * as THREE from "three";
|
|
121
|
-
import { Components } from "../Components";
|
|
122
|
-
import { Component } from "../Types";
|
|
123
|
-
/**
|
|
124
|
-
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
125
|
-
*/
|
|
126
|
-
export declare class Disposer extends Component {
|
|
127
|
-
private _disposedComponents;
|
|
128
|
-
/** {@link Component.enabled} */
|
|
129
|
-
enabled: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* A unique identifier for the component.
|
|
132
|
-
* This UUID is used to register the component within the Components system.
|
|
133
|
-
*/
|
|
134
|
-
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
135
|
-
constructor(components: Components);
|
|
136
|
-
/**
|
|
137
|
-
* Return the UUIDs of all disposed components.
|
|
138
|
-
*/
|
|
139
|
-
get(): Set<string>;
|
|
140
|
-
/**
|
|
141
|
-
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
142
|
-
* using any of these in other parts of the application, make sure that you
|
|
143
|
-
* remove them from the mesh before disposing it.
|
|
144
|
-
*
|
|
145
|
-
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
146
|
-
* to remove.
|
|
147
|
-
*
|
|
148
|
-
* @param materials - whether to dispose the materials of the mesh.
|
|
149
|
-
*
|
|
150
|
-
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
151
|
-
*/
|
|
152
|
-
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
153
|
-
/**
|
|
154
|
-
* Disposes a geometry from memory.
|
|
155
|
-
*
|
|
156
|
-
* @param geometry - the
|
|
157
|
-
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
158
|
-
* to remove.
|
|
159
|
-
*/
|
|
160
|
-
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
161
|
-
private disposeGeometryAndMaterials;
|
|
162
|
-
private disposeChildren;
|
|
163
|
-
private static disposeMaterial;
|
|
164
|
-
}
|
|
165
165
|
import { Component, Disposable, World, Event } from "../Types";
|
|
166
166
|
import { GridConfig, SimpleGrid } from "./src";
|
|
167
167
|
import { Components } from "../Components";
|
|
@@ -568,111 +568,6 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
568
568
|
private newOrthoCamera;
|
|
569
569
|
private setOrthoPerspCameraAspect;
|
|
570
570
|
}
|
|
571
|
-
import * as THREE from "three";
|
|
572
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
573
|
-
import { Component, Components } from "../../core";
|
|
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
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* 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).
|
|
589
|
-
*/
|
|
590
|
-
export declare class MeasurementUtils extends Component {
|
|
591
|
-
/**
|
|
592
|
-
* A unique identifier for the component.
|
|
593
|
-
* This UUID is used to register the component within the Components system.
|
|
594
|
-
*/
|
|
595
|
-
static uuid: string;
|
|
596
|
-
/** {@link Component.enabled} */
|
|
597
|
-
enabled: boolean;
|
|
598
|
-
constructor(components: Components);
|
|
599
|
-
/**
|
|
600
|
-
* Utility method to calculate the distance from a point to a line segment.
|
|
601
|
-
*
|
|
602
|
-
* @param point - The point from which to calculate the distance.
|
|
603
|
-
* @param lineStart - The start point of the line segment.
|
|
604
|
-
* @param lineEnd - The end point of the line segment.
|
|
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.
|
|
612
|
-
*
|
|
613
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
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.
|
|
617
|
-
*/
|
|
618
|
-
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
619
|
-
edges: MeasureEdge[];
|
|
620
|
-
indices: Set<number>;
|
|
621
|
-
} | null;
|
|
622
|
-
/**
|
|
623
|
-
* Method to get the vertices and normal of a mesh face at a given index.
|
|
624
|
-
* It also applies instance transformation if provided.
|
|
625
|
-
*
|
|
626
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
627
|
-
* @param faceIndex - The index of the face within the mesh.
|
|
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.
|
|
641
|
-
*
|
|
642
|
-
* @param vector - The vector to round.
|
|
643
|
-
* @returns The vector with rounded components.
|
|
644
|
-
*/
|
|
645
|
-
round(vector: THREE.Vector3): void;
|
|
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
571
|
import * as WEBIFC from "web-ifc";
|
|
677
572
|
import * as FRAG from "@thatopen/fragments";
|
|
678
573
|
import { Component, Components } from "../../core";
|
|
@@ -700,287 +595,31 @@ export declare class IfcJsonExporter extends Component {
|
|
|
700
595
|
}
|
|
701
596
|
import * as WEBIFC from "web-ifc";
|
|
702
597
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
703
|
-
import {
|
|
704
|
-
|
|
705
|
-
|
|
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
|
-
}
|
|
598
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
599
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
600
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
732
601
|
/**
|
|
733
|
-
*
|
|
602
|
+
* Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
|
|
734
603
|
*/
|
|
735
|
-
export declare class
|
|
604
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
736
605
|
/**
|
|
737
606
|
* A unique identifier for the component.
|
|
738
607
|
* This UUID is used to register the component within the Components system.
|
|
739
608
|
*/
|
|
740
|
-
static readonly uuid: "
|
|
609
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
741
610
|
/** {@link Disposable.onDisposed} */
|
|
742
611
|
readonly onDisposed: Event<string>;
|
|
743
612
|
/**
|
|
744
|
-
* Event triggered when a
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
*
|
|
749
|
-
|
|
750
|
-
ifcToExport: ArrayBuffer | null;
|
|
751
|
-
/**
|
|
752
|
-
* Event triggered when an element is added to a Pset.
|
|
613
|
+
* Event triggered when relations for a model have been indexed.
|
|
614
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
615
|
+
*
|
|
616
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
617
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
618
|
+
* The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
753
619
|
*/
|
|
754
|
-
readonly
|
|
755
|
-
|
|
756
|
-
|
|
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
|
-
};
|
|
788
|
-
/** {@link Component.enabled} */
|
|
789
|
-
enabled: boolean;
|
|
790
|
-
/**
|
|
791
|
-
* Map of attribute listeners.
|
|
792
|
-
*/
|
|
793
|
-
attributeListeners: AttributeListener;
|
|
794
|
-
/**
|
|
795
|
-
* The currently selected model.
|
|
796
|
-
*/
|
|
797
|
-
selectedModel?: FragmentsGroup;
|
|
798
|
-
/**
|
|
799
|
-
* Map of changed entities in the model.
|
|
800
|
-
*/
|
|
801
|
-
changeMap: ChangeMap;
|
|
802
|
-
constructor(components: Components);
|
|
803
|
-
/** {@link Disposable.dispose} */
|
|
804
|
-
dispose(): void;
|
|
805
|
-
/**
|
|
806
|
-
* Static method to retrieve the IFC schema from a given model.
|
|
807
|
-
*
|
|
808
|
-
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
809
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
810
|
-
* @returns The IFC schema associated with the given model.
|
|
811
|
-
*/
|
|
812
|
-
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
813
|
-
/**
|
|
814
|
-
* Method to set properties data in the model.
|
|
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.
|
|
822
|
-
*
|
|
823
|
-
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
824
|
-
*/
|
|
825
|
-
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
826
|
-
/**
|
|
827
|
-
* Creates a new Property Set (Pset) in the given model.
|
|
828
|
-
*
|
|
829
|
-
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
830
|
-
* @param name - The name of the Pset.
|
|
831
|
-
* @param description - (Optional) The description of the Pset.
|
|
832
|
-
*
|
|
833
|
-
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
834
|
-
*
|
|
835
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
836
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
837
|
-
*/
|
|
838
|
-
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
839
|
-
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
840
|
-
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
841
|
-
}>;
|
|
842
|
-
/**
|
|
843
|
-
* Removes a Property Set (Pset) from the given model.
|
|
844
|
-
*
|
|
845
|
-
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
846
|
-
* @param psetID - The express IDs of the Psets to be removed.
|
|
847
|
-
*
|
|
848
|
-
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
849
|
-
*
|
|
850
|
-
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
851
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
852
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
853
|
-
*/
|
|
854
|
-
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
855
|
-
/**
|
|
856
|
-
* Creates a new single-value property of type string in the given model.
|
|
857
|
-
*
|
|
858
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
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.
|
|
862
|
-
*
|
|
863
|
-
* @returns The newly created single-value property.
|
|
864
|
-
*
|
|
865
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
866
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
867
|
-
*/
|
|
868
|
-
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
869
|
-
/**
|
|
870
|
-
* Creates a new single-value property of type numeric in the given model.
|
|
871
|
-
*
|
|
872
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
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.
|
|
876
|
-
*
|
|
877
|
-
* @returns The newly created single-value property.
|
|
878
|
-
*
|
|
879
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
880
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
881
|
-
*/
|
|
882
|
-
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
883
|
-
/**
|
|
884
|
-
* Creates a new single-value property of type boolean in the given model.
|
|
885
|
-
*
|
|
886
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
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.
|
|
890
|
-
*
|
|
891
|
-
* @returns The newly created single-value property.
|
|
892
|
-
*
|
|
893
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
894
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
895
|
-
*/
|
|
896
|
-
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
897
|
-
/**
|
|
898
|
-
* Removes a property from a Property Set (Pset) in the given model.
|
|
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.
|
|
903
|
-
*
|
|
904
|
-
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
905
|
-
*
|
|
906
|
-
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
907
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
908
|
-
*/
|
|
909
|
-
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
910
|
-
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
911
|
-
/**
|
|
912
|
-
* Adds elements to a Property Set (Pset) in the given model.
|
|
913
|
-
*
|
|
914
|
-
* @param model - The FragmentsGroup model in which to add the elements.
|
|
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.
|
|
917
|
-
*
|
|
918
|
-
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
919
|
-
*
|
|
920
|
-
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
921
|
-
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
922
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
923
|
-
*/
|
|
924
|
-
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
925
|
-
/**
|
|
926
|
-
* Saves the changes made to the model to a new IFC file.
|
|
927
|
-
*
|
|
928
|
-
* @param model - The FragmentsGroup model from which to save the changes.
|
|
929
|
-
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
930
|
-
*
|
|
931
|
-
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
932
|
-
*
|
|
933
|
-
* @throws Will throw an error if any issues occur during the saving process.
|
|
934
|
-
*/
|
|
935
|
-
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
936
|
-
/**
|
|
937
|
-
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
938
|
-
* The listener will trigger an event whenever the attribute's value changes.
|
|
939
|
-
*
|
|
940
|
-
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
941
|
-
* @param expressID - The express ID of the entity for which to set the listener.
|
|
942
|
-
* @param attributeName - The name of the attribute for which to set the listener.
|
|
943
|
-
*
|
|
944
|
-
* @returns The event that will be triggered when the attribute's value changes.
|
|
945
|
-
*
|
|
946
|
-
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
947
|
-
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
948
|
-
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
949
|
-
*/
|
|
950
|
-
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
951
|
-
private increaseMaxID;
|
|
952
|
-
private newGUID;
|
|
953
|
-
private getOwnerHistory;
|
|
954
|
-
private registerChange;
|
|
955
|
-
private newSingleProperty;
|
|
956
|
-
}
|
|
957
|
-
import * as WEBIFC from "web-ifc";
|
|
958
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
959
|
-
import { Disposable, Event, Component, Components } from "../../core";
|
|
960
|
-
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
961
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
962
|
-
/**
|
|
963
|
-
* 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).
|
|
964
|
-
*/
|
|
965
|
-
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
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>;
|
|
973
|
-
/**
|
|
974
|
-
* Event triggered when relations for a model have been indexed.
|
|
975
|
-
* This event provides the model's UUID and the relations map generated for that model.
|
|
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.
|
|
980
|
-
*/
|
|
981
|
-
readonly onRelationsIndexed: Event<{
|
|
982
|
-
modelID: string;
|
|
983
|
-
relationsMap: RelationsMap;
|
|
620
|
+
readonly onRelationsIndexed: Event<{
|
|
621
|
+
modelID: string;
|
|
622
|
+
relationsMap: RelationsMap;
|
|
984
623
|
}>;
|
|
985
624
|
/**
|
|
986
625
|
* Holds the relationship mappings for each model processed by the indexer.
|
|
@@ -999,6 +638,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
999
638
|
constructor(components: Components);
|
|
1000
639
|
private onFragmentsDisposed;
|
|
1001
640
|
private indexRelations;
|
|
641
|
+
private getAttributeIndex;
|
|
1002
642
|
/**
|
|
1003
643
|
* Adds a relation map to the model's relations map.
|
|
1004
644
|
*
|
|
@@ -1094,16 +734,27 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
1094
734
|
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
1095
735
|
/** {@link Disposable.dispose} */
|
|
1096
736
|
dispose(): void;
|
|
737
|
+
/**
|
|
738
|
+
* Adds relations between an entity and other entities in a BIM model.
|
|
739
|
+
*
|
|
740
|
+
* @param model - The BIM model to which the relations will be added.
|
|
741
|
+
* @param expressID - The expressID of the entity within the model.
|
|
742
|
+
* @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
|
|
743
|
+
* @param relIDs - The expressIDs of the related entities within the model.
|
|
744
|
+
*
|
|
745
|
+
* @throws An error if the relation name is not a valid relation name.
|
|
746
|
+
*/
|
|
747
|
+
addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
|
|
1097
748
|
/**
|
|
1098
749
|
* Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
|
|
1099
750
|
*
|
|
1100
751
|
* @param model The BIM model whose children to get.
|
|
1101
|
-
* @param
|
|
752
|
+
* @param expressID The expressID of the item whose children to get.
|
|
1102
753
|
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
1103
754
|
*
|
|
1104
755
|
* @returns A 'Set' with the expressIDs of the found items.
|
|
1105
756
|
*/
|
|
1106
|
-
|
|
757
|
+
getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
|
|
1107
758
|
}
|
|
1108
759
|
import * as THREE from "three";
|
|
1109
760
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -1313,186 +964,271 @@ export declare class BoundingBoxer extends Component implements Disposable {
|
|
|
1313
964
|
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
1314
965
|
private static getFragmentBounds;
|
|
1315
966
|
}
|
|
1316
|
-
import * as
|
|
1317
|
-
import
|
|
1318
|
-
import {
|
|
967
|
+
import * as WEBIFC from "web-ifc";
|
|
968
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
969
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
1319
970
|
/**
|
|
1320
|
-
*
|
|
971
|
+
* Types for boolean properties in IFC schema.
|
|
1321
972
|
*/
|
|
1322
|
-
export
|
|
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
|
-
}
|
|
973
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1339
974
|
/**
|
|
1340
|
-
*
|
|
975
|
+
* Types for string properties in IFC schema.
|
|
1341
976
|
*/
|
|
1342
|
-
export
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
977
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
978
|
+
/**
|
|
979
|
+
* Types for numeric properties in IFC schema.
|
|
980
|
+
*/
|
|
981
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
982
|
+
/**
|
|
983
|
+
* Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
|
|
984
|
+
*/
|
|
985
|
+
export interface ChangeMap {
|
|
986
|
+
[modelID: string]: Set<number>;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
|
|
990
|
+
*/
|
|
991
|
+
export interface AttributeListener {
|
|
992
|
+
[modelID: string]: {
|
|
993
|
+
[expressID: number]: {
|
|
994
|
+
[attributeName: string]: Event<String | Boolean | Number>;
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
1000
|
+
*/
|
|
1001
|
+
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
1002
|
+
/**
|
|
1003
|
+
* A unique identifier for the component.
|
|
1004
|
+
* This UUID is used to register the component within the Components system.
|
|
1346
1005
|
*/
|
|
1347
|
-
static readonly uuid: "
|
|
1006
|
+
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
1007
|
+
/** {@link Disposable.onDisposed} */
|
|
1008
|
+
readonly onDisposed: Event<string>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Event triggered when a file is requested for export.
|
|
1011
|
+
*/
|
|
1012
|
+
readonly onRequestFile: Event<unknown>;
|
|
1013
|
+
/**
|
|
1014
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
1015
|
+
*/
|
|
1016
|
+
ifcToExport: ArrayBuffer | null;
|
|
1017
|
+
/**
|
|
1018
|
+
* Event triggered when an element is added to a Pset.
|
|
1019
|
+
*/
|
|
1020
|
+
readonly onElementToPset: Event<{
|
|
1021
|
+
model: FragmentsGroup;
|
|
1022
|
+
psetID: number;
|
|
1023
|
+
elementID: number;
|
|
1024
|
+
}>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Event triggered when a property is added to a Pset.
|
|
1027
|
+
*/
|
|
1028
|
+
readonly onPropToPset: Event<{
|
|
1029
|
+
model: FragmentsGroup;
|
|
1030
|
+
psetID: number;
|
|
1031
|
+
propID: number;
|
|
1032
|
+
}>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Event triggered when a Pset is removed.
|
|
1035
|
+
*/
|
|
1036
|
+
readonly onPsetRemoved: Event<{
|
|
1037
|
+
model: FragmentsGroup;
|
|
1038
|
+
psetID: number;
|
|
1039
|
+
}>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Event triggered when data in the model changes.
|
|
1042
|
+
*/
|
|
1043
|
+
readonly onDataChanged: Event<{
|
|
1044
|
+
model: FragmentsGroup;
|
|
1045
|
+
expressID: number;
|
|
1046
|
+
}>;
|
|
1047
|
+
/**
|
|
1048
|
+
* Configuration for the WebAssembly module.
|
|
1049
|
+
*/
|
|
1050
|
+
wasm: {
|
|
1051
|
+
path: string;
|
|
1052
|
+
absolute: boolean;
|
|
1053
|
+
};
|
|
1348
1054
|
/** {@link Component.enabled} */
|
|
1349
1055
|
enabled: boolean;
|
|
1350
1056
|
/**
|
|
1351
|
-
*
|
|
1352
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1057
|
+
* Map of attribute listeners.
|
|
1353
1058
|
*/
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
|
|
1059
|
+
attributeListeners: AttributeListener;
|
|
1060
|
+
/**
|
|
1061
|
+
* The currently selected model.
|
|
1062
|
+
*/
|
|
1063
|
+
selectedModel?: FragmentsGroup;
|
|
1064
|
+
/**
|
|
1065
|
+
* Map of changed entities in the model.
|
|
1066
|
+
*/
|
|
1067
|
+
changeMap: ChangeMap;
|
|
1357
1068
|
constructor(components: Components);
|
|
1358
|
-
private onFragmentsDisposed;
|
|
1359
1069
|
/** {@link Disposable.dispose} */
|
|
1360
1070
|
dispose(): void;
|
|
1361
1071
|
/**
|
|
1362
|
-
*
|
|
1363
|
-
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
1072
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
1364
1073
|
*
|
|
1365
|
-
* @param
|
|
1074
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
1075
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1076
|
+
* @returns The IFC schema associated with the given model.
|
|
1366
1077
|
*/
|
|
1367
|
-
|
|
1078
|
+
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
1368
1079
|
/**
|
|
1369
|
-
*
|
|
1370
|
-
* If no filter is provided, it returns all fragments.
|
|
1080
|
+
* Method to set properties data in the model.
|
|
1371
1081
|
*
|
|
1372
|
-
* @param
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1082
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
1083
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
1084
|
+
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1085
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
1375
1086
|
*
|
|
1376
|
-
* @returns A
|
|
1377
|
-
* where the express IDs are filtered based on the provided filter criteria.
|
|
1087
|
+
* @returns A promise that resolves when all the properties have been set.
|
|
1378
1088
|
*
|
|
1379
|
-
* @throws Will throw an error if the
|
|
1089
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
1380
1090
|
*/
|
|
1381
|
-
|
|
1382
|
-
[name: string]: string[];
|
|
1383
|
-
}): FRAGS.FragmentIdMap;
|
|
1091
|
+
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
1384
1092
|
/**
|
|
1385
|
-
*
|
|
1093
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
1386
1094
|
*
|
|
1387
|
-
* @param
|
|
1388
|
-
* @param
|
|
1095
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1096
|
+
* @param name - The name of the Pset.
|
|
1097
|
+
* @param description - (Optional) The description of the Pset.
|
|
1389
1098
|
*
|
|
1390
|
-
* @
|
|
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.
|
|
1099
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1395
1100
|
*
|
|
1101
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1102
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1396
1103
|
*/
|
|
1397
|
-
|
|
1104
|
+
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
1105
|
+
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
1106
|
+
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
1107
|
+
}>;
|
|
1398
1108
|
/**
|
|
1399
|
-
*
|
|
1109
|
+
* Removes a Property Set (Pset) from the given model.
|
|
1400
1110
|
*
|
|
1401
|
-
* @param
|
|
1111
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1112
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
1402
1113
|
*
|
|
1403
|
-
* @
|
|
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.
|
|
1114
|
+
* @returns A promise that resolves when all the Psets have been removed.
|
|
1408
1115
|
*
|
|
1409
|
-
* @throws Will throw an error if the
|
|
1116
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1117
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1118
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1410
1119
|
*/
|
|
1411
|
-
|
|
1120
|
+
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
1412
1121
|
/**
|
|
1413
|
-
*
|
|
1122
|
+
* Creates a new single-value property of type string in the given model.
|
|
1414
1123
|
*
|
|
1415
|
-
* @param
|
|
1124
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1125
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
1126
|
+
* @param name - The name of the property.
|
|
1127
|
+
* @param value - The value of the property. Must be a string.
|
|
1416
1128
|
*
|
|
1417
|
-
* @
|
|
1418
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1419
|
-
* and classifies them based on their entity type.
|
|
1420
|
-
* The classification is stored in the 'list.entities' property,
|
|
1421
|
-
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1129
|
+
* @returns The newly created single-value property.
|
|
1422
1130
|
*
|
|
1423
|
-
* @throws Will throw an error if the
|
|
1131
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1132
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1424
1133
|
*/
|
|
1425
|
-
|
|
1134
|
+
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1426
1135
|
/**
|
|
1427
|
-
*
|
|
1136
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
1428
1137
|
*
|
|
1429
|
-
* @param
|
|
1430
|
-
* @param
|
|
1431
|
-
* @param
|
|
1138
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1139
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
1140
|
+
* @param name - The name of the property.
|
|
1141
|
+
* @param value - The value of the property. Must be a number.
|
|
1432
1142
|
*
|
|
1433
|
-
* @
|
|
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.
|
|
1143
|
+
* @returns The newly created single-value property.
|
|
1438
1144
|
*
|
|
1439
|
-
* @throws Will throw an error if the
|
|
1145
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1146
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1440
1147
|
*/
|
|
1441
|
-
|
|
1148
|
+
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1442
1149
|
/**
|
|
1443
|
-
*
|
|
1150
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
1444
1151
|
*
|
|
1445
|
-
* @param model - The FragmentsGroup
|
|
1446
|
-
* @param
|
|
1152
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1153
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
1154
|
+
* @param name - The name of the property.
|
|
1155
|
+
* @param value - The value of the property. Must be a boolean.
|
|
1447
1156
|
*
|
|
1448
|
-
* @
|
|
1449
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1450
|
-
* and classifies them based on their spatial structure in the IFC model.
|
|
1451
|
-
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
1452
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1157
|
+
* @returns The newly created single-value property.
|
|
1453
1158
|
*
|
|
1454
|
-
* @throws Will throw an error if the
|
|
1159
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1160
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1455
1161
|
*/
|
|
1456
|
-
|
|
1457
|
-
useProperties: boolean;
|
|
1458
|
-
}): Promise<void>;
|
|
1162
|
+
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1459
1163
|
/**
|
|
1460
|
-
*
|
|
1164
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
1461
1165
|
*
|
|
1462
|
-
* @param
|
|
1463
|
-
* @param
|
|
1464
|
-
* @param
|
|
1166
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
1167
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
1168
|
+
* @param propID - The express ID of the property to be removed.
|
|
1465
1169
|
*
|
|
1466
|
-
* @
|
|
1467
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1468
|
-
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
1170
|
+
* @returns A promise that resolves when the property has been removed.
|
|
1469
1171
|
*
|
|
1470
|
-
* @throws Will throw an error if the
|
|
1172
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
1173
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1471
1174
|
*/
|
|
1472
|
-
|
|
1175
|
+
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
1176
|
+
addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
|
|
1473
1177
|
/**
|
|
1474
|
-
*
|
|
1178
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
1475
1179
|
*
|
|
1476
|
-
* @param
|
|
1180
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
1181
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
1182
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
1477
1183
|
*
|
|
1478
|
-
* @
|
|
1479
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1480
|
-
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
1184
|
+
* @returns A promise that resolves when all the elements have been added.
|
|
1481
1185
|
*
|
|
1482
|
-
* @throws Will throw an error if the
|
|
1186
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
1187
|
+
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
1188
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1483
1189
|
*/
|
|
1484
|
-
|
|
1485
|
-
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
1486
|
-
}
|
|
1487
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
1488
|
-
/**
|
|
1489
|
-
* 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).
|
|
1490
|
-
*/
|
|
1491
|
-
export declare class Exploder extends Component implements Disposable {
|
|
1190
|
+
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
1492
1191
|
/**
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
|
|
1192
|
+
* Saves the changes made to the model to a new IFC file.
|
|
1193
|
+
*
|
|
1194
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
1195
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
1196
|
+
*
|
|
1197
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
1198
|
+
*
|
|
1199
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
1200
|
+
*/
|
|
1201
|
+
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
1204
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
1205
|
+
*
|
|
1206
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
1207
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
1208
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
1209
|
+
*
|
|
1210
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
1211
|
+
*
|
|
1212
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
1213
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
1214
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
1215
|
+
*/
|
|
1216
|
+
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
1217
|
+
private increaseMaxID;
|
|
1218
|
+
private newGUID;
|
|
1219
|
+
private getOwnerHistory;
|
|
1220
|
+
private registerChange;
|
|
1221
|
+
private newSingleProperty;
|
|
1222
|
+
}
|
|
1223
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
1224
|
+
/**
|
|
1225
|
+
* The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
|
|
1226
|
+
*/
|
|
1227
|
+
export declare class Exploder extends Component implements Disposable {
|
|
1228
|
+
/**
|
|
1229
|
+
* A unique identifier for the component.
|
|
1230
|
+
* This UUID is used to register the component within the Components system.
|
|
1231
|
+
*/
|
|
1496
1232
|
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
1497
1233
|
/** {@link Disposable.onDisposed} */
|
|
1498
1234
|
readonly onDisposed: Event<unknown>;
|
|
@@ -1534,6 +1270,177 @@ export declare class Exploder extends Component implements Disposable {
|
|
|
1534
1270
|
*/
|
|
1535
1271
|
set(active: boolean): void;
|
|
1536
1272
|
}
|
|
1273
|
+
import * as THREE from "three";
|
|
1274
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1275
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
1276
|
+
/**
|
|
1277
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
1278
|
+
*/
|
|
1279
|
+
export interface Classification {
|
|
1280
|
+
/**
|
|
1281
|
+
* A system within the classification.
|
|
1282
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1283
|
+
*/
|
|
1284
|
+
[system: string]: {
|
|
1285
|
+
/**
|
|
1286
|
+
* A class within the system.
|
|
1287
|
+
* The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
|
|
1288
|
+
*/
|
|
1289
|
+
[className: string]: {
|
|
1290
|
+
map: FRAGS.FragmentIdMap;
|
|
1291
|
+
name: string;
|
|
1292
|
+
id: number | null;
|
|
1293
|
+
};
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
|
|
1298
|
+
*/
|
|
1299
|
+
export declare class Classifier extends Component implements Disposable {
|
|
1300
|
+
/**
|
|
1301
|
+
* A unique identifier for the component.
|
|
1302
|
+
* This UUID is used to register the component within the Components system.
|
|
1303
|
+
*/
|
|
1304
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
1305
|
+
/** {@link Component.enabled} */
|
|
1306
|
+
enabled: boolean;
|
|
1307
|
+
/**
|
|
1308
|
+
* A map representing the classification systems.
|
|
1309
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1310
|
+
*/
|
|
1311
|
+
list: Classification;
|
|
1312
|
+
/** {@link Disposable.onDisposed} */
|
|
1313
|
+
readonly onDisposed: Event<unknown>;
|
|
1314
|
+
constructor(components: Components);
|
|
1315
|
+
private onFragmentsDisposed;
|
|
1316
|
+
/** {@link Disposable.dispose} */
|
|
1317
|
+
dispose(): void;
|
|
1318
|
+
/**
|
|
1319
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
1320
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
1321
|
+
*
|
|
1322
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
1323
|
+
*/
|
|
1324
|
+
remove(guid: string): void;
|
|
1325
|
+
/**
|
|
1326
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
1327
|
+
* If no filter is provided, it returns all fragments.
|
|
1328
|
+
*
|
|
1329
|
+
* @param filter - An optional object containing filter criteria.
|
|
1330
|
+
* The keys of the object represent the classification system names,
|
|
1331
|
+
* and the values are arrays of class names to match.
|
|
1332
|
+
*
|
|
1333
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
1334
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
1335
|
+
*
|
|
1336
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
1337
|
+
*/
|
|
1338
|
+
find(filter?: {
|
|
1339
|
+
[name: string]: string[];
|
|
1340
|
+
}): FRAGS.FragmentIdMap;
|
|
1341
|
+
/**
|
|
1342
|
+
* Classifies fragments based on their modelID.
|
|
1343
|
+
*
|
|
1344
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
1345
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1346
|
+
*
|
|
1347
|
+
* @remarks
|
|
1348
|
+
* This method iterates through the fragments in the provided group,
|
|
1349
|
+
* and classifies them based on their modelID.
|
|
1350
|
+
* The classification is stored in the 'list.models' property,
|
|
1351
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1352
|
+
*
|
|
1353
|
+
*/
|
|
1354
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
1355
|
+
/**
|
|
1356
|
+
* Classifies fragments based on their PredefinedType property.
|
|
1357
|
+
*
|
|
1358
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1359
|
+
*
|
|
1360
|
+
* @remarks
|
|
1361
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
1362
|
+
* and classifies them based on their PredefinedType property.
|
|
1363
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
1364
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1365
|
+
*
|
|
1366
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
1367
|
+
*/
|
|
1368
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Classifies fragments based on their entity type.
|
|
1371
|
+
*
|
|
1372
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1373
|
+
*
|
|
1374
|
+
* @remarks
|
|
1375
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
1376
|
+
* and classifies them based on their entity type.
|
|
1377
|
+
* The classification is stored in the 'list.entities' property,
|
|
1378
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1379
|
+
*
|
|
1380
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
1381
|
+
*/
|
|
1382
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
1383
|
+
/**
|
|
1384
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
1385
|
+
*
|
|
1386
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1387
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
1388
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
1389
|
+
*
|
|
1390
|
+
* @remarks
|
|
1391
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
1392
|
+
* and classifies them based on the specified IFC relationship.
|
|
1393
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
1394
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1395
|
+
*
|
|
1396
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
1397
|
+
*/
|
|
1398
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
1399
|
+
/**
|
|
1400
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
1401
|
+
*
|
|
1402
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
1403
|
+
* @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
|
|
1404
|
+
*
|
|
1405
|
+
* @remarks
|
|
1406
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
1407
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
1408
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
1409
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1410
|
+
*
|
|
1411
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
1412
|
+
*/
|
|
1413
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
|
|
1414
|
+
useProperties: boolean;
|
|
1415
|
+
}): Promise<void>;
|
|
1416
|
+
/**
|
|
1417
|
+
* Sets the color of the specified fragments.
|
|
1418
|
+
*
|
|
1419
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
1420
|
+
* @param color - The color to set for the fragments.
|
|
1421
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
1422
|
+
*
|
|
1423
|
+
* @remarks
|
|
1424
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1425
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
1426
|
+
*
|
|
1427
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1428
|
+
*/
|
|
1429
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
1430
|
+
/**
|
|
1431
|
+
* Resets the color of the specified fragments to their original color.
|
|
1432
|
+
*
|
|
1433
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
1434
|
+
*
|
|
1435
|
+
* @remarks
|
|
1436
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1437
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
1438
|
+
*
|
|
1439
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1440
|
+
*/
|
|
1441
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
1442
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
1443
|
+
}
|
|
1537
1444
|
import * as FRAGS from "@thatopen/fragments";
|
|
1538
1445
|
import { Components, Component } from "../../core";
|
|
1539
1446
|
/**
|
|
@@ -1579,172 +1486,27 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
|
1579
1486
|
rotation: THREE.Matrix3;
|
|
1580
1487
|
transformation: THREE.Matrix4;
|
|
1581
1488
|
};
|
|
1582
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1583
|
-
import * as THREE from "three";
|
|
1584
|
-
export declare class MaterialsUtils {
|
|
1585
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
1586
|
-
}
|
|
1587
|
-
export declare class UUID {
|
|
1588
|
-
private static _pattern;
|
|
1589
|
-
private static _lut;
|
|
1590
|
-
static create(): string;
|
|
1591
|
-
static validate(uuid: string): void;
|
|
1592
|
-
}
|
|
1593
1489
|
import * as WEBIFC from "web-ifc";
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
}
|
|
1597
|
-
export declare class IfcCategories {
|
|
1598
|
-
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
1599
|
-
}
|
|
1600
|
-
import * as THREE from "three";
|
|
1601
|
-
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1490
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1491
|
+
import { IfcFragmentSettings } from "./src";
|
|
1492
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1602
1493
|
/**
|
|
1603
|
-
*
|
|
1494
|
+
* 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).
|
|
1604
1495
|
*/
|
|
1605
|
-
export
|
|
1496
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
1606
1497
|
/**
|
|
1607
|
-
*
|
|
1498
|
+
* A unique identifier for the component.
|
|
1499
|
+
* This UUID is used to register the component within the Components system.
|
|
1608
1500
|
*/
|
|
1609
|
-
|
|
1501
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1502
|
+
/** {@link Disposable.onDisposed} */
|
|
1503
|
+
readonly onDisposed: Event<string>;
|
|
1610
1504
|
/**
|
|
1611
|
-
*
|
|
1505
|
+
* An event triggered when the IFC file starts loading.
|
|
1612
1506
|
*/
|
|
1613
|
-
|
|
1507
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1614
1508
|
/**
|
|
1615
|
-
*
|
|
1616
|
-
*/
|
|
1617
|
-
previewElement: HTMLElement;
|
|
1618
|
-
}
|
|
1619
|
-
/**
|
|
1620
|
-
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1621
|
-
*/
|
|
1622
|
-
export declare class VertexPicker extends Component implements Disposable {
|
|
1623
|
-
/** {@link Disposable.onDisposed} */
|
|
1624
|
-
readonly onDisposed: Event<unknown>;
|
|
1625
|
-
/**
|
|
1626
|
-
* An event that is triggered when a vertex is found.
|
|
1627
|
-
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1628
|
-
*/
|
|
1629
|
-
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1630
|
-
/**
|
|
1631
|
-
* An event that is triggered when a vertex is lost.
|
|
1632
|
-
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
1633
|
-
*/
|
|
1634
|
-
readonly onVertexLost: Event<THREE.Vector3>;
|
|
1635
|
-
/**
|
|
1636
|
-
* An event that is triggered when the picker is enabled or disabled
|
|
1637
|
-
*/
|
|
1638
|
-
readonly onEnabled: Event<boolean>;
|
|
1639
|
-
/**
|
|
1640
|
-
* A reference to the Components instance associated with this VertexPicker.
|
|
1641
|
-
*/
|
|
1642
|
-
components: Components;
|
|
1643
|
-
/**
|
|
1644
|
-
* A reference to the working plane used for vertex picking.
|
|
1645
|
-
* This plane is used to determine which vertices are considered valid for picking.
|
|
1646
|
-
* If this value is null, all vertices are considered valid.
|
|
1647
|
-
*/
|
|
1648
|
-
workingPlane: THREE.Plane | null;
|
|
1649
|
-
private _pickedPoint;
|
|
1650
|
-
private _config;
|
|
1651
|
-
private _enabled;
|
|
1652
|
-
/**
|
|
1653
|
-
* Sets the enabled state of the VertexPicker.
|
|
1654
|
-
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
1655
|
-
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1656
|
-
*
|
|
1657
|
-
* @param value - The new enabled state.
|
|
1658
|
-
*/
|
|
1659
|
-
set enabled(value: boolean);
|
|
1660
|
-
/**
|
|
1661
|
-
* Gets the current enabled state of the VertexPicker.
|
|
1662
|
-
*
|
|
1663
|
-
* @returns The current enabled state.
|
|
1664
|
-
*/
|
|
1665
|
-
get enabled(): boolean;
|
|
1666
|
-
/**
|
|
1667
|
-
* Sets the configuration for the VertexPicker component.
|
|
1668
|
-
*
|
|
1669
|
-
* @param value - A Partial object containing the configuration properties to update.
|
|
1670
|
-
* The properties not provided in the value object will retain their current values.
|
|
1671
|
-
*
|
|
1672
|
-
* @example
|
|
1673
|
-
* '''typescript
|
|
1674
|
-
* vertexPicker.config = {
|
|
1675
|
-
* snapDistance: 0.5,
|
|
1676
|
-
* showOnlyVertex: true,
|
|
1677
|
-
* };
|
|
1678
|
-
* '''
|
|
1679
|
-
*/
|
|
1680
|
-
set config(value: Partial<VertexPickerConfig>);
|
|
1681
|
-
/**
|
|
1682
|
-
* Gets the current configuration for the VertexPicker component.
|
|
1683
|
-
*
|
|
1684
|
-
* @returns A copy of the current VertexPickerConfig object.
|
|
1685
|
-
*
|
|
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.
|
|
1509
|
+
* An event triggered when the setup process is completed.
|
|
1748
1510
|
*/
|
|
1749
1511
|
readonly onSetup: Event<void>;
|
|
1750
1512
|
/**
|
|
@@ -1839,6 +1601,133 @@ export declare class IfcLoader extends Component implements Disposable {
|
|
|
1839
1601
|
private getGeometry;
|
|
1840
1602
|
private autoSetWasm;
|
|
1841
1603
|
}
|
|
1604
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1605
|
+
import * as THREE from "three";
|
|
1606
|
+
export declare class MaterialsUtils {
|
|
1607
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
1608
|
+
}
|
|
1609
|
+
export declare class UUID {
|
|
1610
|
+
private static _pattern;
|
|
1611
|
+
private static _lut;
|
|
1612
|
+
static create(): string;
|
|
1613
|
+
static validate(uuid: string): void;
|
|
1614
|
+
}
|
|
1615
|
+
import * as THREE from "three";
|
|
1616
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1617
|
+
/**
|
|
1618
|
+
* Configuration interface for the VertexPicker component.
|
|
1619
|
+
*/
|
|
1620
|
+
export interface VertexPickerConfig {
|
|
1621
|
+
/**
|
|
1622
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
1623
|
+
*/
|
|
1624
|
+
showOnlyVertex: boolean;
|
|
1625
|
+
/**
|
|
1626
|
+
* The maximum distance for snapping to a vertex.
|
|
1627
|
+
*/
|
|
1628
|
+
snapDistance: number;
|
|
1629
|
+
/**
|
|
1630
|
+
* The HTML element to use for previewing the picked vertex.
|
|
1631
|
+
*/
|
|
1632
|
+
previewElement: HTMLElement;
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1636
|
+
*/
|
|
1637
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
1638
|
+
/** {@link Disposable.onDisposed} */
|
|
1639
|
+
readonly onDisposed: Event<unknown>;
|
|
1640
|
+
/**
|
|
1641
|
+
* An event that is triggered when a vertex is found.
|
|
1642
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1643
|
+
*/
|
|
1644
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1645
|
+
/**
|
|
1646
|
+
* An event that is triggered when a vertex is lost.
|
|
1647
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
1648
|
+
*/
|
|
1649
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
1650
|
+
/**
|
|
1651
|
+
* An event that is triggered when the picker is enabled or disabled
|
|
1652
|
+
*/
|
|
1653
|
+
readonly onEnabled: Event<boolean>;
|
|
1654
|
+
/**
|
|
1655
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
1656
|
+
*/
|
|
1657
|
+
components: Components;
|
|
1658
|
+
/**
|
|
1659
|
+
* A reference to the working plane used for vertex picking.
|
|
1660
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
1661
|
+
* If this value is null, all vertices are considered valid.
|
|
1662
|
+
*/
|
|
1663
|
+
workingPlane: THREE.Plane | null;
|
|
1664
|
+
private _pickedPoint;
|
|
1665
|
+
private _config;
|
|
1666
|
+
private _enabled;
|
|
1667
|
+
/**
|
|
1668
|
+
* Sets the enabled state of the VertexPicker.
|
|
1669
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
1670
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1671
|
+
*
|
|
1672
|
+
* @param value - The new enabled state.
|
|
1673
|
+
*/
|
|
1674
|
+
set enabled(value: boolean);
|
|
1675
|
+
/**
|
|
1676
|
+
* Gets the current enabled state of the VertexPicker.
|
|
1677
|
+
*
|
|
1678
|
+
* @returns The current enabled state.
|
|
1679
|
+
*/
|
|
1680
|
+
get enabled(): boolean;
|
|
1681
|
+
/**
|
|
1682
|
+
* Sets the configuration for the VertexPicker component.
|
|
1683
|
+
*
|
|
1684
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
1685
|
+
* The properties not provided in the value object will retain their current values.
|
|
1686
|
+
*
|
|
1687
|
+
* @example
|
|
1688
|
+
* '''typescript
|
|
1689
|
+
* vertexPicker.config = {
|
|
1690
|
+
* snapDistance: 0.5,
|
|
1691
|
+
* showOnlyVertex: true,
|
|
1692
|
+
* };
|
|
1693
|
+
* '''
|
|
1694
|
+
*/
|
|
1695
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
1696
|
+
/**
|
|
1697
|
+
* Gets the current configuration for the VertexPicker component.
|
|
1698
|
+
*
|
|
1699
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
1700
|
+
*
|
|
1701
|
+
* @example
|
|
1702
|
+
* '''typescript
|
|
1703
|
+
* const currentConfig = vertexPicker.config;
|
|
1704
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1705
|
+
* '''
|
|
1706
|
+
*/
|
|
1707
|
+
get config(): Partial<VertexPickerConfig>;
|
|
1708
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1709
|
+
/** {@link Disposable.dispose} */
|
|
1710
|
+
dispose(): void;
|
|
1711
|
+
/**
|
|
1712
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1713
|
+
*
|
|
1714
|
+
* @param world - The World instance to use for raycasting.
|
|
1715
|
+
*
|
|
1716
|
+
* @returns The current picked point, or null if no point is picked.
|
|
1717
|
+
*
|
|
1718
|
+
* @remarks
|
|
1719
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1720
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1721
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1722
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1723
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1724
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1725
|
+
*/
|
|
1726
|
+
get(world: World): THREE.Vector3 | null;
|
|
1727
|
+
private getClosestVertex;
|
|
1728
|
+
private getVertices;
|
|
1729
|
+
private getVertex;
|
|
1730
|
+
}
|
|
1842
1731
|
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1843
1732
|
import * as THREE from "three";
|
|
1844
1733
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -2113,6 +2002,129 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
|
|
|
2113
2002
|
private streamAllProperties;
|
|
2114
2003
|
private cleanUp;
|
|
2115
2004
|
}
|
|
2005
|
+
import * as THREE from "three";
|
|
2006
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2007
|
+
import { Component, Components } from "../../core";
|
|
2008
|
+
/**
|
|
2009
|
+
* Represents an edge measurement result.
|
|
2010
|
+
*/
|
|
2011
|
+
export interface MeasureEdge {
|
|
2012
|
+
/**
|
|
2013
|
+
* The distance between the two points of the edge.
|
|
2014
|
+
*/
|
|
2015
|
+
distance: number;
|
|
2016
|
+
/**
|
|
2017
|
+
* The two points that define the edge.
|
|
2018
|
+
*/
|
|
2019
|
+
points: THREE.Vector3[];
|
|
2020
|
+
}
|
|
2021
|
+
/**
|
|
2022
|
+
* 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).
|
|
2023
|
+
*/
|
|
2024
|
+
export declare class MeasurementUtils extends Component {
|
|
2025
|
+
/**
|
|
2026
|
+
* A unique identifier for the component.
|
|
2027
|
+
* This UUID is used to register the component within the Components system.
|
|
2028
|
+
*/
|
|
2029
|
+
static uuid: string;
|
|
2030
|
+
/** {@link Component.enabled} */
|
|
2031
|
+
enabled: boolean;
|
|
2032
|
+
constructor(components: Components);
|
|
2033
|
+
/**
|
|
2034
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
2035
|
+
*
|
|
2036
|
+
* @param point - The point from which to calculate the distance.
|
|
2037
|
+
* @param lineStart - The start point of the line segment.
|
|
2038
|
+
* @param lineEnd - The end point of the line segment.
|
|
2039
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
2040
|
+
* @returns The distance from the point to the line segment.
|
|
2041
|
+
*/
|
|
2042
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
2043
|
+
/**
|
|
2044
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
2045
|
+
* It also returns the edges of the found face and their indices.
|
|
2046
|
+
*
|
|
2047
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
2048
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
2049
|
+
* @param instance - The instance of the mesh (optional).
|
|
2050
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
2051
|
+
*/
|
|
2052
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
2053
|
+
edges: MeasureEdge[];
|
|
2054
|
+
indices: Set<number>;
|
|
2055
|
+
} | null;
|
|
2056
|
+
/**
|
|
2057
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
2058
|
+
* It also applies instance transformation if provided.
|
|
2059
|
+
*
|
|
2060
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
2061
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
2062
|
+
* @param instance - The instance of the mesh (optional).
|
|
2063
|
+
* @returns An object containing the vertices and normal of the face.
|
|
2064
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
2065
|
+
*/
|
|
2066
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
2067
|
+
p1: THREE.Vector3;
|
|
2068
|
+
p2: THREE.Vector3;
|
|
2069
|
+
p3: THREE.Vector3;
|
|
2070
|
+
faceNormal: THREE.Vector3;
|
|
2071
|
+
};
|
|
2072
|
+
/**
|
|
2073
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
2074
|
+
* This is used to ensure numerical precision in edge detection.
|
|
2075
|
+
*
|
|
2076
|
+
* @param vector - The vector to round.
|
|
2077
|
+
* @returns The vector with rounded components.
|
|
2078
|
+
*/
|
|
2079
|
+
round(vector: THREE.Vector3): void;
|
|
2080
|
+
/**
|
|
2081
|
+
* Calculates the volume of a set of fragments.
|
|
2082
|
+
*
|
|
2083
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
2084
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
2085
|
+
*
|
|
2086
|
+
* @remarks
|
|
2087
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
2088
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
2089
|
+
*
|
|
2090
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
2091
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
2092
|
+
*/
|
|
2093
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
2094
|
+
/**
|
|
2095
|
+
* Calculates the total volume of a set of meshes.
|
|
2096
|
+
*
|
|
2097
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
2098
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
2099
|
+
*
|
|
2100
|
+
* @remarks
|
|
2101
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
2102
|
+
* and its bounding sphere.
|
|
2103
|
+
*
|
|
2104
|
+
*/
|
|
2105
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
2106
|
+
private getFaceData;
|
|
2107
|
+
private getVolumeOfMesh;
|
|
2108
|
+
private getSignedVolumeOfTriangle;
|
|
2109
|
+
}
|
|
2110
|
+
import * as WEBIFC from "web-ifc";
|
|
2111
|
+
export interface IfcItemsCategories {
|
|
2112
|
+
[itemID: number]: number;
|
|
2113
|
+
}
|
|
2114
|
+
export declare class IfcCategories {
|
|
2115
|
+
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2116
|
+
}
|
|
2117
|
+
/**
|
|
2118
|
+
* A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
|
|
2119
|
+
*
|
|
2120
|
+
* @remarks
|
|
2121
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2122
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2123
|
+
*
|
|
2124
|
+
*/
|
|
2125
|
+
export declare const IfcElements: {
|
|
2126
|
+
[key: number]: string;
|
|
2127
|
+
};
|
|
2116
2128
|
/**
|
|
2117
2129
|
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
2118
2130
|
*/
|
|
@@ -2264,342 +2276,32 @@ export declare class IfcFragmentSettings {
|
|
|
2264
2276
|
excludedCategories: Set<number>;
|
|
2265
2277
|
/** Whether to save the absolute location of all IFC items. */
|
|
2266
2278
|
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;
|
|
2305
|
-
/**
|
|
2306
|
-
* The size of the primary grid lines.
|
|
2307
|
-
*/
|
|
2308
|
-
size1: number;
|
|
2309
|
-
/**
|
|
2310
|
-
* The size of the secondary grid lines.
|
|
2311
|
-
*/
|
|
2312
|
-
size2: number;
|
|
2313
|
-
/**
|
|
2314
|
-
* The distance at which the grid lines start to fade away.
|
|
2315
|
-
*/
|
|
2316
|
-
distance: number;
|
|
2317
|
-
}
|
|
2318
|
-
/**
|
|
2319
|
-
* 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).
|
|
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;
|
|
2334
|
-
/**
|
|
2335
|
-
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2336
|
-
* perspective cameras and false for orthographic cameras.
|
|
2337
|
-
*/
|
|
2338
|
-
get fade(): boolean;
|
|
2339
|
-
/**
|
|
2340
|
-
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2341
|
-
* perspective cameras and false for orthographic cameras.
|
|
2342
|
-
*/
|
|
2343
|
-
set fade(active: boolean);
|
|
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 {
|
|
2360
|
-
/**
|
|
2361
|
-
* Interval in milliseconds at which the visibility check should be performed.
|
|
2362
|
-
* Default value is 1000.
|
|
2363
|
-
*/
|
|
2364
|
-
updateInterval?: number;
|
|
2365
|
-
/**
|
|
2366
|
-
* Width of the render target used for visibility checks.
|
|
2367
|
-
* Default value is 512.
|
|
2368
|
-
*/
|
|
2369
|
-
width?: number;
|
|
2370
|
-
/**
|
|
2371
|
-
* Height of the render target used for visibility checks.
|
|
2372
|
-
* Default value is 512.
|
|
2373
|
-
*/
|
|
2374
|
-
height?: number;
|
|
2375
|
-
/**
|
|
2376
|
-
* Whether the visibility check should be performed automatically.
|
|
2377
|
-
* Default value is true.
|
|
2378
|
-
*/
|
|
2379
|
-
autoUpdate?: boolean;
|
|
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>;
|
|
2387
|
-
/**
|
|
2388
|
-
* Fires after making the visibility check to the meshes. It lists the
|
|
2389
|
-
* meshes that are currently visible, and the ones that were visible
|
|
2390
|
-
* just before but not anymore.
|
|
2391
|
-
*/
|
|
2392
|
-
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2393
|
-
/**
|
|
2394
|
-
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2395
|
-
*/
|
|
2396
|
-
enabled: boolean;
|
|
2397
|
-
/**
|
|
2398
|
-
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2399
|
-
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2400
|
-
*/
|
|
2401
|
-
needsUpdate: boolean;
|
|
2402
|
-
/**
|
|
2403
|
-
* Render the internal scene used to determine the object visibility. Used
|
|
2404
|
-
* for debugging purposes.
|
|
2405
|
-
*/
|
|
2406
|
-
renderDebugFrame: boolean;
|
|
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;
|
|
2427
|
-
/**
|
|
2428
|
-
* The function that the culler uses to reprocess the scene. Generally it's
|
|
2429
|
-
* better to call needsUpdate, but you can also call this to force it.
|
|
2430
|
-
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2431
|
-
* not true.
|
|
2432
|
-
*/
|
|
2433
|
-
updateVisibility: (force?: boolean) => Promise<void>;
|
|
2434
|
-
protected getAvailableColor(): {
|
|
2435
|
-
r: number;
|
|
2436
|
-
g: number;
|
|
2437
|
-
b: number;
|
|
2438
|
-
code: string;
|
|
2439
|
-
};
|
|
2440
|
-
protected increaseColor(): void;
|
|
2441
|
-
protected decreaseColor(): void;
|
|
2442
|
-
private applySettings;
|
|
2443
|
-
}
|
|
2444
|
-
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2445
|
-
import * as THREE from "three";
|
|
2446
|
-
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2447
|
-
import { Components } from "../../Components";
|
|
2448
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2449
|
-
/**
|
|
2450
|
-
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2451
|
-
*/
|
|
2452
|
-
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2453
|
-
/**
|
|
2454
|
-
* Event triggered when the visibility of meshes is updated.
|
|
2455
|
-
* Contains two sets: seen and unseen.
|
|
2456
|
-
*/
|
|
2457
|
-
readonly onViewUpdated: Event<{
|
|
2458
|
-
seen: Set<THREE.Mesh>;
|
|
2459
|
-
unseen: Set<THREE.Mesh>;
|
|
2460
|
-
}>;
|
|
2461
|
-
/**
|
|
2462
|
-
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2463
|
-
* Default value is 100.
|
|
2464
|
-
*/
|
|
2465
|
-
threshold: number;
|
|
2466
|
-
/**
|
|
2467
|
-
* Map of color code to THREE.InstancedMesh.
|
|
2468
|
-
* Used to keep track of color-coded meshes.
|
|
2469
|
-
*/
|
|
2470
|
-
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2471
|
-
/**
|
|
2472
|
-
* Flag to indicate if the renderer is currently processing.
|
|
2473
|
-
* Used to prevent concurrent processing.
|
|
2474
|
-
*/
|
|
2475
|
-
isProcessing: boolean;
|
|
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;
|
|
2485
|
-
/**
|
|
2486
|
-
* 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.
|
|
2487
|
-
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2488
|
-
* @returns {void}
|
|
2489
|
-
*/
|
|
2490
|
-
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2491
|
-
/**
|
|
2492
|
-
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2493
|
-
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2494
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2495
|
-
* @returns {void}
|
|
2496
|
-
*/
|
|
2497
|
-
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2498
|
-
private handleWorkerMessage;
|
|
2499
|
-
private getAvailableMaterial;
|
|
2500
|
-
}
|
|
2501
|
-
import * as THREE from "three";
|
|
2502
|
-
import { Disposable, Event } from "../../Types";
|
|
2503
|
-
/**
|
|
2504
|
-
* 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.
|
|
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);
|
|
2513
|
-
/**
|
|
2514
|
-
* The real position of the mouse of the Three.js canvas.
|
|
2515
|
-
*/
|
|
2516
|
-
get position(): THREE.Vector2;
|
|
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;
|
|
2540
|
-
/**
|
|
2541
|
-
* A reference to the Three.js Raycaster instance.
|
|
2542
|
-
* This is used for raycasting operations.
|
|
2543
|
-
*/
|
|
2544
|
-
readonly three: THREE.Raycaster;
|
|
2545
|
-
/**
|
|
2546
|
-
* A reference to the world instance to which this Raycaster belongs.
|
|
2547
|
-
* This is used to access the camera and meshes.
|
|
2548
|
-
*/
|
|
2549
|
-
world: World;
|
|
2550
|
-
constructor(components: Components, world: World);
|
|
2551
|
-
/** {@link Disposable.dispose} */
|
|
2552
|
-
dispose(): void;
|
|
2279
|
+
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2280
|
+
webIfc: WEBIFC.LoaderSettings;
|
|
2553
2281
|
/**
|
|
2554
|
-
*
|
|
2555
|
-
* the
|
|
2556
|
-
*
|
|
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}.
|
|
2282
|
+
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2283
|
+
* If set to true, the path will be set to the default path of the WASM file.
|
|
2284
|
+
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2285
|
+
* Default value is true.
|
|
2561
2286
|
*/
|
|
2562
|
-
|
|
2287
|
+
autoSetWasm: boolean;
|
|
2563
2288
|
/**
|
|
2564
|
-
*
|
|
2565
|
-
* This
|
|
2289
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2290
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2291
|
+
* If set to null, the default file location handler will be used.
|
|
2566
2292
|
*
|
|
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.
|
|
2293
|
+
* @param url - The URL of the file to locate.
|
|
2294
|
+
* @returns The absolute path of the file.
|
|
2571
2295
|
*/
|
|
2572
|
-
|
|
2573
|
-
private intersect;
|
|
2574
|
-
private filterClippingPlanes;
|
|
2296
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2575
2297
|
}
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
*/
|
|
2584
|
-
add(handler: T extends void ? {
|
|
2585
|
-
(): void;
|
|
2586
|
-
} : {
|
|
2587
|
-
(data: T): void;
|
|
2588
|
-
}): void;
|
|
2589
|
-
/**
|
|
2590
|
-
* Removes a callback from this event instance.
|
|
2591
|
-
* @param handler - the callback to be removed from this event.
|
|
2592
|
-
*/
|
|
2593
|
-
remove(handler: T extends void ? {
|
|
2594
|
-
(): void;
|
|
2595
|
-
} : {
|
|
2596
|
-
(data: T): void;
|
|
2597
|
-
}): void;
|
|
2598
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2599
|
-
trigger: (data?: T) => void;
|
|
2600
|
-
/** Gets rid of all the suscribed events. */
|
|
2601
|
-
reset(): void;
|
|
2602
|
-
private handlers;
|
|
2298
|
+
import * as WEBIFC from "web-ifc";
|
|
2299
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2300
|
+
export declare class SpatialStructure {
|
|
2301
|
+
itemsByFloor: IfcItemsCategories;
|
|
2302
|
+
private _units;
|
|
2303
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2304
|
+
cleanUp(): void;
|
|
2603
2305
|
}
|
|
2604
2306
|
/**
|
|
2605
2307
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
@@ -2793,6 +2495,34 @@ export declare abstract class BaseWorldItem extends Base {
|
|
|
2793
2495
|
protected constructor(components: Components);
|
|
2794
2496
|
}
|
|
2795
2497
|
import * as THREE from "three";
|
|
2498
|
+
import CameraControls from "camera-controls";
|
|
2499
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2500
|
+
import { CameraControllable } from "./interfaces";
|
|
2501
|
+
/**
|
|
2502
|
+
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2503
|
+
*/
|
|
2504
|
+
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether the camera is enabled or not.
|
|
2507
|
+
*/
|
|
2508
|
+
abstract enabled: boolean;
|
|
2509
|
+
/**
|
|
2510
|
+
* The Three.js camera instance.
|
|
2511
|
+
*/
|
|
2512
|
+
abstract three: THREE.Camera;
|
|
2513
|
+
/**
|
|
2514
|
+
* Optional CameraControls instance for controlling the camera.
|
|
2515
|
+
* This property is only available if the camera is controllable.
|
|
2516
|
+
*/
|
|
2517
|
+
abstract controls?: CameraControls;
|
|
2518
|
+
/**
|
|
2519
|
+
* Checks whether the instance is {@link CameraControllable}.
|
|
2520
|
+
*
|
|
2521
|
+
* @returns True if the instance is controllable, false otherwise.
|
|
2522
|
+
*/
|
|
2523
|
+
hasCameraControls: () => this is CameraControllable;
|
|
2524
|
+
}
|
|
2525
|
+
import * as THREE from "three";
|
|
2796
2526
|
import { Vector2 } from "three";
|
|
2797
2527
|
import { Event } from "./event";
|
|
2798
2528
|
import { BaseWorldItem } from "./base-world-item";
|
|
@@ -2858,52 +2588,206 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
|
|
|
2858
2588
|
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2859
2589
|
}
|
|
2860
2590
|
import * as THREE from "three";
|
|
2861
|
-
import
|
|
2591
|
+
import { Disposable } from "./interfaces";
|
|
2592
|
+
import { Event } from "./event";
|
|
2593
|
+
import { Components } from "../../Components";
|
|
2862
2594
|
import { BaseWorldItem } from "./base-world-item";
|
|
2863
|
-
import { CameraControllable } from "./interfaces";
|
|
2864
2595
|
/**
|
|
2865
|
-
* Abstract class representing a
|
|
2596
|
+
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2866
2597
|
*/
|
|
2867
|
-
export declare abstract class
|
|
2598
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2599
|
+
/** {@link Disposable.onDisposed} */
|
|
2600
|
+
readonly onDisposed: Event<unknown>;
|
|
2868
2601
|
/**
|
|
2869
|
-
*
|
|
2602
|
+
* Abstract property representing the three.js object associated with this scene.
|
|
2603
|
+
* It should be implemented by subclasses.
|
|
2870
2604
|
*/
|
|
2871
|
-
abstract
|
|
2605
|
+
abstract three: THREE.Object3D;
|
|
2606
|
+
protected constructor(components: Components);
|
|
2607
|
+
/** {@link Disposable.dispose} */
|
|
2608
|
+
dispose(): void;
|
|
2609
|
+
}
|
|
2610
|
+
import * as THREE from "three";
|
|
2611
|
+
import { BaseScene } from "./base-scene";
|
|
2612
|
+
import { BaseCamera } from "./base-camera";
|
|
2613
|
+
import { BaseRenderer } from "./base-renderer";
|
|
2614
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
2615
|
+
/**
|
|
2616
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2617
|
+
*/
|
|
2618
|
+
export interface World extends Disposable, Updateable {
|
|
2872
2619
|
/**
|
|
2873
|
-
*
|
|
2620
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2874
2621
|
*/
|
|
2875
|
-
|
|
2622
|
+
meshes: Set<THREE.Mesh>;
|
|
2876
2623
|
/**
|
|
2877
|
-
*
|
|
2878
|
-
|
|
2624
|
+
* The base scene of the world.
|
|
2625
|
+
*/
|
|
2626
|
+
scene: BaseScene;
|
|
2627
|
+
/**
|
|
2628
|
+
* The base camera of the world.
|
|
2629
|
+
*/
|
|
2630
|
+
camera: BaseCamera;
|
|
2631
|
+
/**
|
|
2632
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
2633
|
+
*/
|
|
2634
|
+
renderer: BaseRenderer | null;
|
|
2635
|
+
/**
|
|
2636
|
+
* A unique identifier for the world.
|
|
2637
|
+
*/
|
|
2638
|
+
uuid: string;
|
|
2639
|
+
/**
|
|
2640
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
2641
|
+
*/
|
|
2642
|
+
isDisposing: boolean;
|
|
2643
|
+
}
|
|
2644
|
+
import * as THREE from "three";
|
|
2645
|
+
import { Components } from "../../Components";
|
|
2646
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
2647
|
+
/**
|
|
2648
|
+
* Settings to configure the CullerRenderer.
|
|
2649
|
+
*/
|
|
2650
|
+
export interface CullerRendererSettings {
|
|
2651
|
+
/**
|
|
2652
|
+
* Interval in milliseconds at which the visibility check should be performed.
|
|
2653
|
+
* Default value is 1000.
|
|
2654
|
+
*/
|
|
2655
|
+
updateInterval?: number;
|
|
2656
|
+
/**
|
|
2657
|
+
* Width of the render target used for visibility checks.
|
|
2658
|
+
* Default value is 512.
|
|
2659
|
+
*/
|
|
2660
|
+
width?: number;
|
|
2661
|
+
/**
|
|
2662
|
+
* Height of the render target used for visibility checks.
|
|
2663
|
+
* Default value is 512.
|
|
2664
|
+
*/
|
|
2665
|
+
height?: number;
|
|
2666
|
+
/**
|
|
2667
|
+
* Whether the visibility check should be performed automatically.
|
|
2668
|
+
* Default value is true.
|
|
2669
|
+
*/
|
|
2670
|
+
autoUpdate?: boolean;
|
|
2671
|
+
}
|
|
2672
|
+
/**
|
|
2673
|
+
* A base renderer to determine visibility on screen.
|
|
2674
|
+
*/
|
|
2675
|
+
export declare class CullerRenderer {
|
|
2676
|
+
/** {@link Disposable.onDisposed} */
|
|
2677
|
+
readonly onDisposed: Event<string>;
|
|
2678
|
+
/**
|
|
2679
|
+
* Fires after making the visibility check to the meshes. It lists the
|
|
2680
|
+
* meshes that are currently visible, and the ones that were visible
|
|
2681
|
+
* just before but not anymore.
|
|
2682
|
+
*/
|
|
2683
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2684
|
+
/**
|
|
2685
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2686
|
+
*/
|
|
2687
|
+
enabled: boolean;
|
|
2688
|
+
/**
|
|
2689
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2690
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2691
|
+
*/
|
|
2692
|
+
needsUpdate: boolean;
|
|
2693
|
+
/**
|
|
2694
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
2695
|
+
* for debugging purposes.
|
|
2696
|
+
*/
|
|
2697
|
+
renderDebugFrame: boolean;
|
|
2698
|
+
/** The components instance to which this renderer belongs. */
|
|
2699
|
+
components: Components;
|
|
2700
|
+
/** The world instance to which this renderer belongs. */
|
|
2701
|
+
readonly world: World;
|
|
2702
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
2703
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
2704
|
+
protected autoUpdate: boolean;
|
|
2705
|
+
protected updateInterval: number;
|
|
2706
|
+
protected readonly worker: Worker;
|
|
2707
|
+
protected readonly scene: THREE.Scene;
|
|
2708
|
+
private _width;
|
|
2709
|
+
private _height;
|
|
2710
|
+
private _availableColor;
|
|
2711
|
+
private readonly renderTarget;
|
|
2712
|
+
private readonly bufferSize;
|
|
2713
|
+
private readonly _buffer;
|
|
2714
|
+
protected _isWorkerBusy: boolean;
|
|
2715
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2716
|
+
/** {@link Disposable.dispose} */
|
|
2717
|
+
dispose(): void;
|
|
2718
|
+
/**
|
|
2719
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
2720
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
2721
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2722
|
+
* not true.
|
|
2723
|
+
*/
|
|
2724
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
2725
|
+
protected getAvailableColor(): {
|
|
2726
|
+
r: number;
|
|
2727
|
+
g: number;
|
|
2728
|
+
b: number;
|
|
2729
|
+
code: string;
|
|
2730
|
+
};
|
|
2731
|
+
protected increaseColor(): void;
|
|
2732
|
+
protected decreaseColor(): void;
|
|
2733
|
+
private applySettings;
|
|
2734
|
+
}
|
|
2735
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2736
|
+
import * as THREE from "three";
|
|
2737
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2738
|
+
import { Components } from "../../Components";
|
|
2739
|
+
import { Event, World, Disposable } from "../../Types";
|
|
2740
|
+
/**
|
|
2741
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2742
|
+
*/
|
|
2743
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2744
|
+
/**
|
|
2745
|
+
* Event triggered when the visibility of meshes is updated.
|
|
2746
|
+
* Contains two sets: seen and unseen.
|
|
2747
|
+
*/
|
|
2748
|
+
readonly onViewUpdated: Event<{
|
|
2749
|
+
seen: Set<THREE.Mesh>;
|
|
2750
|
+
unseen: Set<THREE.Mesh>;
|
|
2751
|
+
}>;
|
|
2752
|
+
/**
|
|
2753
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2754
|
+
* Default value is 100.
|
|
2879
2755
|
*/
|
|
2880
|
-
|
|
2756
|
+
threshold: number;
|
|
2881
2757
|
/**
|
|
2882
|
-
*
|
|
2883
|
-
*
|
|
2884
|
-
* @returns True if the instance is controllable, false otherwise.
|
|
2758
|
+
* Map of color code to THREE.InstancedMesh.
|
|
2759
|
+
* Used to keep track of color-coded meshes.
|
|
2885
2760
|
*/
|
|
2886
|
-
|
|
2887
|
-
}
|
|
2888
|
-
import * as THREE from "three";
|
|
2889
|
-
import { Disposable } from "./interfaces";
|
|
2890
|
-
import { Event } from "./event";
|
|
2891
|
-
import { Components } from "../../Components";
|
|
2892
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2893
|
-
/**
|
|
2894
|
-
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2895
|
-
*/
|
|
2896
|
-
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2897
|
-
/** {@link Disposable.onDisposed} */
|
|
2898
|
-
readonly onDisposed: Event<unknown>;
|
|
2761
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2899
2762
|
/**
|
|
2900
|
-
*
|
|
2901
|
-
*
|
|
2763
|
+
* Flag to indicate if the renderer is currently processing.
|
|
2764
|
+
* Used to prevent concurrent processing.
|
|
2902
2765
|
*/
|
|
2903
|
-
|
|
2904
|
-
|
|
2766
|
+
isProcessing: boolean;
|
|
2767
|
+
private _colorCodeMeshMap;
|
|
2768
|
+
private _meshIDColorCodeMap;
|
|
2769
|
+
private _currentVisibleMeshes;
|
|
2770
|
+
private _recentlyHiddenMeshes;
|
|
2771
|
+
private _intervalID;
|
|
2772
|
+
private readonly _transparentMat;
|
|
2773
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2905
2774
|
/** {@link Disposable.dispose} */
|
|
2906
2775
|
dispose(): void;
|
|
2776
|
+
/**
|
|
2777
|
+
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
2778
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2779
|
+
* @returns {void}
|
|
2780
|
+
*/
|
|
2781
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2782
|
+
/**
|
|
2783
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2784
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2785
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2786
|
+
* @returns {void}
|
|
2787
|
+
*/
|
|
2788
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2789
|
+
private handleWorkerMessage;
|
|
2790
|
+
private getAvailableMaterial;
|
|
2907
2791
|
}
|
|
2908
2792
|
import * as THREE from "three";
|
|
2909
2793
|
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
@@ -2985,40 +2869,6 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
|
|
|
2985
2869
|
dispose(disposeResources?: boolean): void;
|
|
2986
2870
|
}
|
|
2987
2871
|
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
2872
|
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3023
2873
|
import { Components } from "../../Components";
|
|
3024
2874
|
/**
|
|
@@ -3111,6 +2961,34 @@ export declare class SimpleRenderer extends BaseRenderer {
|
|
|
3111
2961
|
private onContextLost;
|
|
3112
2962
|
private onContextBack;
|
|
3113
2963
|
}
|
|
2964
|
+
/**
|
|
2965
|
+
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
2966
|
+
*/
|
|
2967
|
+
export declare class Event<T> {
|
|
2968
|
+
/**
|
|
2969
|
+
* Add a callback to this event instance.
|
|
2970
|
+
* @param handler - the callback to be added to this event.
|
|
2971
|
+
*/
|
|
2972
|
+
add(handler: T extends void ? {
|
|
2973
|
+
(): void;
|
|
2974
|
+
} : {
|
|
2975
|
+
(data: T): void;
|
|
2976
|
+
}): void;
|
|
2977
|
+
/**
|
|
2978
|
+
* Removes a callback from this event instance.
|
|
2979
|
+
* @param handler - the callback to be removed from this event.
|
|
2980
|
+
*/
|
|
2981
|
+
remove(handler: T extends void ? {
|
|
2982
|
+
(): void;
|
|
2983
|
+
} : {
|
|
2984
|
+
(data: T): void;
|
|
2985
|
+
}): void;
|
|
2986
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2987
|
+
trigger: (data?: T) => void;
|
|
2988
|
+
/** Gets rid of all the suscribed events. */
|
|
2989
|
+
reset(): void;
|
|
2990
|
+
private handlers;
|
|
2991
|
+
}
|
|
3114
2992
|
import * as THREE from "three";
|
|
3115
2993
|
import CameraControls from "camera-controls";
|
|
3116
2994
|
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
@@ -3144,167 +3022,200 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
|
|
|
3144
3022
|
*/
|
|
3145
3023
|
get controls(): CameraControls;
|
|
3146
3024
|
/**
|
|
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.
|
|
3025
|
+
* Getter for the enabled state of the camera controls.
|
|
3026
|
+
* If the current world is null, it returns false.
|
|
3027
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
3028
|
+
*
|
|
3029
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
3030
|
+
*/
|
|
3031
|
+
get enabled(): boolean;
|
|
3032
|
+
/**
|
|
3033
|
+
* Setter for the enabled state of the camera controls.
|
|
3034
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
3035
|
+
*
|
|
3036
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3037
|
+
*/
|
|
3038
|
+
set enabled(enabled: boolean);
|
|
3039
|
+
constructor(components: Components);
|
|
3040
|
+
/** {@link Disposable.dispose} */
|
|
3041
|
+
dispose(): void;
|
|
3042
|
+
/** {@link Updateable.update} */
|
|
3043
|
+
update(_delta: number): void;
|
|
3044
|
+
/**
|
|
3045
|
+
* Updates the aspect of the camera to match the size of the
|
|
3046
|
+
* {@link Components.renderer}.
|
|
3047
|
+
*/
|
|
3048
|
+
updateAspect: () => void;
|
|
3049
|
+
private setupCamera;
|
|
3050
|
+
private newCameraControls;
|
|
3051
|
+
private setupEvents;
|
|
3052
|
+
private static getSubsetOfThree;
|
|
3053
|
+
}
|
|
3054
|
+
import * as THREE from "three";
|
|
3055
|
+
import { Disposable, Event } from "../../Types";
|
|
3056
|
+
/**
|
|
3057
|
+
* A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
|
|
3058
|
+
*/
|
|
3059
|
+
export declare class Mouse implements Disposable {
|
|
3060
|
+
dom: HTMLCanvasElement;
|
|
3061
|
+
private _event?;
|
|
3062
|
+
private _position;
|
|
3063
|
+
/** {@link Disposable.onDisposed} */
|
|
3064
|
+
readonly onDisposed: Event<unknown>;
|
|
3065
|
+
constructor(dom: HTMLCanvasElement);
|
|
3066
|
+
/**
|
|
3067
|
+
* The real position of the mouse of the Three.js canvas.
|
|
3068
|
+
*/
|
|
3069
|
+
get position(): THREE.Vector2;
|
|
3070
|
+
/** {@link Disposable.dispose} */
|
|
3071
|
+
dispose(): void;
|
|
3072
|
+
private getPositionY;
|
|
3073
|
+
private getPositionX;
|
|
3074
|
+
private updateMouseInfo;
|
|
3075
|
+
private setupEvents;
|
|
3076
|
+
}
|
|
3077
|
+
import * as THREE from "three";
|
|
3078
|
+
import { Components } from "../../Components";
|
|
3079
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3080
|
+
import { Mouse } from "./mouse";
|
|
3081
|
+
/**
|
|
3082
|
+
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
3083
|
+
*/
|
|
3084
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
3085
|
+
/** {@link Component.enabled} */
|
|
3086
|
+
enabled: boolean;
|
|
3087
|
+
/** The components instance to which this Raycaster belongs. */
|
|
3088
|
+
components: Components;
|
|
3089
|
+
/** {@link Disposable.onDisposed} */
|
|
3090
|
+
readonly onDisposed: Event<unknown>;
|
|
3091
|
+
/** The position of the mouse in the screen. */
|
|
3092
|
+
readonly mouse: Mouse;
|
|
3093
|
+
/**
|
|
3094
|
+
* A reference to the Three.js Raycaster instance.
|
|
3095
|
+
* This is used for raycasting operations.
|
|
3096
|
+
*/
|
|
3097
|
+
readonly three: THREE.Raycaster;
|
|
3098
|
+
/**
|
|
3099
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
3100
|
+
* This is used to access the camera and meshes.
|
|
3101
|
+
*/
|
|
3102
|
+
world: World;
|
|
3103
|
+
constructor(components: Components, world: World);
|
|
3104
|
+
/** {@link Disposable.dispose} */
|
|
3105
|
+
dispose(): void;
|
|
3106
|
+
/**
|
|
3107
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3108
|
+
* the first item found. This also takes into account the clipping planes
|
|
3109
|
+
* used by the renderer.
|
|
3110
|
+
*
|
|
3111
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3112
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
3113
|
+
* {@link Components.meshes}.
|
|
3114
|
+
*/
|
|
3115
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3116
|
+
/**
|
|
3117
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3118
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
3119
|
+
*
|
|
3120
|
+
* @param origin - The origin of the ray.
|
|
3121
|
+
* @param direction - The direction of the ray.
|
|
3122
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3123
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3124
|
+
*/
|
|
3125
|
+
castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
|
|
3126
|
+
private intersect;
|
|
3127
|
+
private filterClippingPlanes;
|
|
3128
|
+
}
|
|
3129
|
+
import * as THREE from "three";
|
|
3130
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
3131
|
+
import { Components } from "../../Components";
|
|
3132
|
+
/**
|
|
3133
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
3134
|
+
*/
|
|
3135
|
+
export interface GridConfig {
|
|
3136
|
+
/**
|
|
3137
|
+
* The color of the grid lines.
|
|
3138
|
+
*/
|
|
3139
|
+
color: THREE.Color;
|
|
3140
|
+
/**
|
|
3141
|
+
* The size of the primary grid lines.
|
|
3142
|
+
*/
|
|
3143
|
+
size1: number;
|
|
3144
|
+
/**
|
|
3145
|
+
* The size of the secondary grid lines.
|
|
3146
|
+
*/
|
|
3147
|
+
size2: number;
|
|
3148
|
+
/**
|
|
3149
|
+
* The distance at which the grid lines start to fade away.
|
|
3150
|
+
*/
|
|
3151
|
+
distance: number;
|
|
3152
|
+
}
|
|
3153
|
+
/**
|
|
3154
|
+
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
3155
|
+
*/
|
|
3156
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
3157
|
+
/** {@link Disposable.onDisposed} */
|
|
3158
|
+
readonly onDisposed: Event<unknown>;
|
|
3159
|
+
/** The world instance to which this Raycaster belongs. */
|
|
3160
|
+
world: World;
|
|
3161
|
+
/** The components instance to which this grid belongs. */
|
|
3162
|
+
components: Components;
|
|
3163
|
+
/** {@link Hideable.visible} */
|
|
3164
|
+
get visible(): boolean;
|
|
3165
|
+
/** {@link Hideable.visible} */
|
|
3166
|
+
set visible(visible: boolean);
|
|
3167
|
+
/** The material of the grid. */
|
|
3168
|
+
get material(): THREE.ShaderMaterial;
|
|
3169
|
+
/**
|
|
3170
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3171
|
+
* perspective cameras and false for orthographic cameras.
|
|
3152
3172
|
*/
|
|
3153
|
-
get
|
|
3173
|
+
get fade(): boolean;
|
|
3154
3174
|
/**
|
|
3155
|
-
*
|
|
3156
|
-
*
|
|
3157
|
-
*
|
|
3158
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3175
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3176
|
+
* perspective cameras and false for orthographic cameras.
|
|
3159
3177
|
*/
|
|
3160
|
-
set
|
|
3161
|
-
|
|
3178
|
+
set fade(active: boolean);
|
|
3179
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
3180
|
+
readonly three: THREE.Mesh;
|
|
3181
|
+
private _fade;
|
|
3182
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
3162
3183
|
/** {@link Disposable.dispose} */
|
|
3163
3184
|
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
3185
|
private setupEvents;
|
|
3174
|
-
private
|
|
3186
|
+
private updateZoom;
|
|
3175
3187
|
}
|
|
3176
3188
|
import { NavigationMode } from "./types";
|
|
3177
3189
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3178
3190
|
/**
|
|
3179
|
-
* A {@link NavigationMode} that allows
|
|
3191
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3180
3192
|
*/
|
|
3181
|
-
export declare class
|
|
3182
|
-
|
|
3193
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3194
|
+
camera: OrthoPerspectiveCamera;
|
|
3183
3195
|
/** {@link NavigationMode.enabled} */
|
|
3184
3196
|
enabled: boolean;
|
|
3185
3197
|
/** {@link NavigationMode.id} */
|
|
3186
|
-
readonly id = "
|
|
3198
|
+
readonly id = "Orbit";
|
|
3187
3199
|
constructor(camera: OrthoPerspectiveCamera);
|
|
3188
3200
|
/** {@link NavigationMode.set} */
|
|
3189
3201
|
set(active: boolean): void;
|
|
3190
|
-
private
|
|
3202
|
+
private activateOrbitControls;
|
|
3191
3203
|
}
|
|
3192
3204
|
import { NavigationMode } from "./types";
|
|
3193
3205
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3194
3206
|
/**
|
|
3195
|
-
* A {@link NavigationMode} that allows
|
|
3207
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3196
3208
|
*/
|
|
3197
|
-
export declare class
|
|
3209
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3198
3210
|
private camera;
|
|
3199
3211
|
/** {@link NavigationMode.enabled} */
|
|
3200
3212
|
enabled: boolean;
|
|
3201
3213
|
/** {@link NavigationMode.id} */
|
|
3202
|
-
readonly id = "
|
|
3203
|
-
private mouseAction1?;
|
|
3204
|
-
private mouseAction2?;
|
|
3205
|
-
private mouseInitialized;
|
|
3206
|
-
private readonly defaultAzimuthSpeed;
|
|
3207
|
-
private readonly defaultPolarSpeed;
|
|
3208
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3209
|
-
/** {@link NavigationMode.set} */
|
|
3210
|
-
set(active: boolean): void;
|
|
3211
|
-
}
|
|
3212
|
-
import { NavigationMode } from "./types";
|
|
3213
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3214
|
-
/**
|
|
3215
|
-
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3216
|
-
*/
|
|
3217
|
-
export declare class OrbitMode implements NavigationMode {
|
|
3218
|
-
camera: OrthoPerspectiveCamera;
|
|
3219
|
-
/** {@link NavigationMode.enabled} */
|
|
3220
|
-
enabled: boolean;
|
|
3221
|
-
/** {@link NavigationMode.id} */
|
|
3222
|
-
readonly id = "Orbit";
|
|
3214
|
+
readonly id = "FirstPerson";
|
|
3223
3215
|
constructor(camera: OrthoPerspectiveCamera);
|
|
3224
3216
|
/** {@link NavigationMode.set} */
|
|
3225
3217
|
set(active: boolean): void;
|
|
3226
|
-
private
|
|
3227
|
-
}
|
|
3228
|
-
import * as THREE from "three";
|
|
3229
|
-
import { CameraProjection } from "./types";
|
|
3230
|
-
import { Event } from "../../Types";
|
|
3231
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3232
|
-
/**
|
|
3233
|
-
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3234
|
-
*/
|
|
3235
|
-
export declare class ProjectionManager {
|
|
3236
|
-
/**
|
|
3237
|
-
* Event that fires when the {@link CameraProjection} changes.
|
|
3238
|
-
*/
|
|
3239
|
-
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3240
|
-
/**
|
|
3241
|
-
* Current projection mode of the camera.
|
|
3242
|
-
* Default is "Perspective".
|
|
3243
|
-
*/
|
|
3244
|
-
current: CameraProjection;
|
|
3245
|
-
/**
|
|
3246
|
-
* The camera controlled by this ProjectionManager.
|
|
3247
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3248
|
-
*/
|
|
3249
|
-
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3250
|
-
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3251
|
-
matchOrthoDistanceEnabled: boolean;
|
|
3252
|
-
private _component;
|
|
3253
|
-
private _previousDistance;
|
|
3254
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3255
|
-
/**
|
|
3256
|
-
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3257
|
-
*
|
|
3258
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
3259
|
-
* it will have no effect.
|
|
3260
|
-
*/
|
|
3261
|
-
set(projection: CameraProjection): Promise<void>;
|
|
3262
|
-
/**
|
|
3263
|
-
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3264
|
-
* and vice versa.
|
|
3265
|
-
*/
|
|
3266
|
-
toggle(): Promise<void>;
|
|
3267
|
-
private setOrthoCamera;
|
|
3268
|
-
private getPerspectiveDims;
|
|
3269
|
-
private setupOrthoCamera;
|
|
3270
|
-
private getDistance;
|
|
3271
|
-
private setPerspectiveCamera;
|
|
3272
|
-
}
|
|
3273
|
-
/**
|
|
3274
|
-
* The projection system of the camera.
|
|
3275
|
-
*/
|
|
3276
|
-
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3277
|
-
/**
|
|
3278
|
-
* The extensible list of supported navigation modes.
|
|
3279
|
-
*/
|
|
3280
|
-
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3281
|
-
/**
|
|
3282
|
-
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3283
|
-
*/
|
|
3284
|
-
export interface NavigationMode {
|
|
3285
|
-
/** The unique ID of this navigation mode. */
|
|
3286
|
-
id: NavModeID;
|
|
3287
|
-
/**
|
|
3288
|
-
* Enable or disable this navigation mode.
|
|
3289
|
-
* When a new navigation mode is enabled, the previous navigation mode
|
|
3290
|
-
* must be disabled.
|
|
3291
|
-
*
|
|
3292
|
-
* @param active - whether to enable or disable this mode.
|
|
3293
|
-
* @param options - any additional data required to enable or disable it.
|
|
3294
|
-
* */
|
|
3295
|
-
set: (active: boolean, options?: any) => void;
|
|
3296
|
-
/** Whether this navigation mode is active or not. */
|
|
3297
|
-
enabled: boolean;
|
|
3298
|
-
}
|
|
3299
|
-
import * as WEBIFC from "web-ifc";
|
|
3300
|
-
import * as THREE from "three";
|
|
3301
|
-
export declare class Units {
|
|
3302
|
-
factor: number;
|
|
3303
|
-
complement: number;
|
|
3304
|
-
apply(matrix: THREE.Matrix4): void;
|
|
3305
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3306
|
-
private getLengthUnits;
|
|
3307
|
-
private getScaleMatrix;
|
|
3218
|
+
private setupFirstPersonCamera;
|
|
3308
3219
|
}
|
|
3309
3220
|
import * as THREE from "three";
|
|
3310
3221
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
@@ -3406,6 +3317,107 @@ export declare class SimplePlane implements Disposable, Hideable {
|
|
|
3406
3317
|
private static newPlaneMesh;
|
|
3407
3318
|
}
|
|
3408
3319
|
import * as THREE from "three";
|
|
3320
|
+
import { CameraProjection } from "./types";
|
|
3321
|
+
import { Event } from "../../Types";
|
|
3322
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3323
|
+
/**
|
|
3324
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3325
|
+
*/
|
|
3326
|
+
export declare class ProjectionManager {
|
|
3327
|
+
/**
|
|
3328
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
3329
|
+
*/
|
|
3330
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3331
|
+
/**
|
|
3332
|
+
* Current projection mode of the camera.
|
|
3333
|
+
* Default is "Perspective".
|
|
3334
|
+
*/
|
|
3335
|
+
current: CameraProjection;
|
|
3336
|
+
/**
|
|
3337
|
+
* The camera controlled by this ProjectionManager.
|
|
3338
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3339
|
+
*/
|
|
3340
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3341
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3342
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3343
|
+
private _component;
|
|
3344
|
+
private _previousDistance;
|
|
3345
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3346
|
+
/**
|
|
3347
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3348
|
+
*
|
|
3349
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3350
|
+
* it will have no effect.
|
|
3351
|
+
*/
|
|
3352
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3353
|
+
/**
|
|
3354
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3355
|
+
* and vice versa.
|
|
3356
|
+
*/
|
|
3357
|
+
toggle(): Promise<void>;
|
|
3358
|
+
private setOrthoCamera;
|
|
3359
|
+
private getPerspectiveDims;
|
|
3360
|
+
private setupOrthoCamera;
|
|
3361
|
+
private getDistance;
|
|
3362
|
+
private setPerspectiveCamera;
|
|
3363
|
+
}
|
|
3364
|
+
import { NavigationMode } from "./types";
|
|
3365
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3366
|
+
/**
|
|
3367
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3368
|
+
*/
|
|
3369
|
+
export declare class PlanMode implements NavigationMode {
|
|
3370
|
+
private camera;
|
|
3371
|
+
/** {@link NavigationMode.enabled} */
|
|
3372
|
+
enabled: boolean;
|
|
3373
|
+
/** {@link NavigationMode.id} */
|
|
3374
|
+
readonly id = "Plan";
|
|
3375
|
+
private mouseAction1?;
|
|
3376
|
+
private mouseAction2?;
|
|
3377
|
+
private mouseInitialized;
|
|
3378
|
+
private readonly defaultAzimuthSpeed;
|
|
3379
|
+
private readonly defaultPolarSpeed;
|
|
3380
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3381
|
+
/** {@link NavigationMode.set} */
|
|
3382
|
+
set(active: boolean): void;
|
|
3383
|
+
}
|
|
3384
|
+
/**
|
|
3385
|
+
* The projection system of the camera.
|
|
3386
|
+
*/
|
|
3387
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3388
|
+
/**
|
|
3389
|
+
* The extensible list of supported navigation modes.
|
|
3390
|
+
*/
|
|
3391
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3392
|
+
/**
|
|
3393
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3394
|
+
*/
|
|
3395
|
+
export interface NavigationMode {
|
|
3396
|
+
/** The unique ID of this navigation mode. */
|
|
3397
|
+
id: NavModeID;
|
|
3398
|
+
/**
|
|
3399
|
+
* Enable or disable this navigation mode.
|
|
3400
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3401
|
+
* must be disabled.
|
|
3402
|
+
*
|
|
3403
|
+
* @param active - whether to enable or disable this mode.
|
|
3404
|
+
* @param options - any additional data required to enable or disable it.
|
|
3405
|
+
* */
|
|
3406
|
+
set: (active: boolean, options?: any) => void;
|
|
3407
|
+
/** Whether this navigation mode is active or not. */
|
|
3408
|
+
enabled: boolean;
|
|
3409
|
+
}
|
|
3410
|
+
import * as WEBIFC from "web-ifc";
|
|
3411
|
+
import * as THREE from "three";
|
|
3412
|
+
export declare class Units {
|
|
3413
|
+
factor: number;
|
|
3414
|
+
complement: number;
|
|
3415
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3416
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3417
|
+
private getLengthUnits;
|
|
3418
|
+
private getScaleMatrix;
|
|
3419
|
+
}
|
|
3420
|
+
import * as THREE from "three";
|
|
3409
3421
|
import * as WEBIFC from "web-ifc";
|
|
3410
3422
|
import * as FRAGS from "@thatopen/fragments";
|
|
3411
3423
|
export declare class CivilReader {
|