@thatopen/components 2.0.10 → 2.0.12
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/Clipper/index.d.ts +1 -1
- package/dist/core/Clipper/src/simple-plane.d.ts +16 -16
- package/dist/core/Components/index.d.ts +24 -24
- package/dist/core/Cullers/index.d.ts +3 -3
- package/dist/core/Cullers/src/culler-renderer.d.ts +1 -1
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +6 -6
- package/dist/core/Disposer/index.d.ts +1 -1
- package/dist/core/Grids/index.d.ts +10 -9
- package/dist/core/Grids/src/simple-grid.d.ts +16 -4
- package/dist/core/MiniMap/index.d.ts +20 -19
- package/dist/core/MiniMap/src/index.d.ts +16 -16
- package/dist/core/OrthoPerspectiveCamera/index.d.ts +8 -8
- package/dist/core/Raycasters/index.d.ts +2 -1
- package/dist/core/Raycasters/src/mouse.d.ts +1 -4
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +9 -11
- package/dist/core/Types/src/base-camera.d.ts +1 -1
- package/dist/core/Types/src/base-renderer.d.ts +19 -19
- package/dist/core/Types/src/base-scene.d.ts +3 -3
- package/dist/core/Worlds/index.d.ts +15 -15
- package/dist/core/Worlds/src/simple-camera.d.ts +1 -1
- package/dist/core/Worlds/src/simple-scene.d.ts +3 -3
- package/dist/fragments/BoundingBoxer/index.d.ts +151 -1
- package/dist/fragments/Classifier/index.d.ts +133 -0
- package/dist/fragments/Exploder/index.d.ts +39 -2
- package/dist/fragments/FragmentsManager/index.d.ts +45 -6
- package/dist/fragments/Hider/index.d.ts +28 -0
- package/dist/fragments/IfcGeometryTiler/index.d.ts +62 -4
- package/dist/fragments/IfcGeometryTiler/src/base-types.d.ts +14 -0
- package/dist/fragments/IfcGeometryTiler/src/index.d.ts +0 -1
- package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +11 -5
- package/dist/fragments/IfcLoader/index.d.ts +89 -4
- package/dist/fragments/IfcLoader/src/ifc-fragment-settings.d.ts +14 -0
- package/dist/fragments/IfcPropertiesTiler/index.d.ts +44 -4
- package/dist/fragments/IfcPropertiesTiler/src/index.d.ts +1 -0
- package/dist/fragments/IfcPropertiesTiler/src/streaming-settings.d.ts +11 -0
- package/dist/ifc/IfcJsonExporter/index.d.ts +7 -2
- package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +3 -0
- package/dist/ifc/IfcJsonExporter/src/index.d.ts +1 -0
- package/dist/ifc/IfcPropertiesManager/index.d.ts +195 -11
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +20 -11
- package/dist/ifc/Utils/ifc-category-map.d.ts +3 -0
- package/dist/ifc/Utils/ifc-elements-map.d.ts +8 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +3578 -2906
- package/dist/measurement/MeasurementUtils/index.d.ts +76 -0
- package/dist/measurement/index.d.ts +1 -1
- package/dist/namespace.d.ts +2490 -1634
- package/package.json +2 -2
- package/dist/fragments/IfcGeometryTiler/src/fragment-props-stream-converter.d.ts +0 -27
- package/dist/measurement/Utils/index.d.ts +0 -24
package/dist/namespace.d.ts
CHANGED
|
@@ -1,727 +1,878 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
2
|
import * as THREE from "three";
|
|
3
|
-
import { Components } from "
|
|
4
|
-
import { Component } from "../Types";
|
|
3
|
+
import { Component, Components } from "../../core";
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Represents an edge measurement result.
|
|
7
6
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export interface MeasureEdge {
|
|
8
|
+
/**
|
|
9
|
+
* The distance between the two points of the edge.
|
|
10
|
+
*/
|
|
11
|
+
distance: number;
|
|
12
|
+
/**
|
|
13
|
+
* The two points that define the edge.
|
|
14
|
+
*/
|
|
15
|
+
points: THREE.Vector3[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 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).
|
|
19
|
+
*/
|
|
20
|
+
export declare class MeasurementUtils extends Component {
|
|
12
21
|
/**
|
|
13
22
|
* A unique identifier for the component.
|
|
14
23
|
* This UUID is used to register the component within the Components system.
|
|
15
24
|
*/
|
|
16
|
-
static
|
|
25
|
+
static uuid: string;
|
|
26
|
+
/** {@link Component.enabled} */
|
|
27
|
+
enabled: boolean;
|
|
17
28
|
constructor(components: Components);
|
|
18
29
|
/**
|
|
19
|
-
*
|
|
30
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
31
|
+
*
|
|
32
|
+
* @param point - The point from which to calculate the distance.
|
|
33
|
+
* @param lineStart - The start point of the line segment.
|
|
34
|
+
* @param lineEnd - The end point of the line segment.
|
|
35
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
36
|
+
* @returns The distance from the point to the line segment.
|
|
20
37
|
*/
|
|
21
|
-
|
|
38
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
22
39
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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.
|
|
40
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
41
|
+
* It also returns the edges of the found face and their indices.
|
|
29
42
|
*
|
|
30
|
-
* @param
|
|
43
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
44
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
45
|
+
* @param instance - The instance of the mesh (optional).
|
|
46
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
47
|
+
*/
|
|
48
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
49
|
+
edges: MeasureEdge[];
|
|
50
|
+
indices: Set<number>;
|
|
51
|
+
} | null;
|
|
52
|
+
/**
|
|
53
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
54
|
+
* It also applies instance transformation if provided.
|
|
31
55
|
*
|
|
32
|
-
* @param
|
|
56
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
57
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
58
|
+
* @param instance - The instance of the mesh (optional).
|
|
59
|
+
* @returns An object containing the vertices and normal of the face.
|
|
60
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
33
61
|
*/
|
|
34
|
-
|
|
62
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
63
|
+
p1: THREE.Vector3;
|
|
64
|
+
p2: THREE.Vector3;
|
|
65
|
+
p3: THREE.Vector3;
|
|
66
|
+
faceNormal: THREE.Vector3;
|
|
67
|
+
};
|
|
35
68
|
/**
|
|
36
|
-
*
|
|
69
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
70
|
+
* This is used to ensure numerical precision in edge detection.
|
|
37
71
|
*
|
|
38
|
-
* @param
|
|
39
|
-
*
|
|
40
|
-
* to remove.
|
|
72
|
+
* @param vector - The vector to round.
|
|
73
|
+
* @returns The vector with rounded components.
|
|
41
74
|
*/
|
|
42
|
-
|
|
43
|
-
private
|
|
44
|
-
private disposeChildren;
|
|
45
|
-
private static disposeMaterial;
|
|
75
|
+
round(vector: THREE.Vector3): void;
|
|
76
|
+
private getFaceData;
|
|
46
77
|
}
|
|
47
|
-
import
|
|
78
|
+
import * as THREE from "three";
|
|
79
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
80
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
81
|
+
import { Component, Components, Disposable, Event } from "../../core";
|
|
48
82
|
/**
|
|
49
|
-
*
|
|
83
|
+
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
50
84
|
*/
|
|
51
|
-
export declare class
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
static readonly release = "2.0.8";
|
|
85
|
+
export declare class BoundingBoxer extends Component implements Disposable {
|
|
86
|
+
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
87
|
+
/** {@link Component.enabled} */
|
|
88
|
+
enabled: boolean;
|
|
56
89
|
/** {@link Disposable.onDisposed} */
|
|
57
|
-
readonly onDisposed: Event<
|
|
90
|
+
readonly onDisposed: Event<unknown>;
|
|
91
|
+
private _absoluteMin;
|
|
92
|
+
private _absoluteMax;
|
|
93
|
+
private _meshes;
|
|
94
|
+
constructor(components: Components);
|
|
58
95
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
96
|
+
* A static method to calculate the dimensions of a given bounding box.
|
|
97
|
+
*
|
|
98
|
+
* @param bbox - The bounding box to calculate the dimensions for.
|
|
99
|
+
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
61
100
|
*/
|
|
62
|
-
|
|
101
|
+
static getDimensions(bbox: THREE.Box3): {
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
depth: number;
|
|
105
|
+
center: THREE.Vector3;
|
|
106
|
+
};
|
|
63
107
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
108
|
+
* A static method to create a new bounding box boundary.
|
|
109
|
+
*
|
|
110
|
+
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
111
|
+
* @returns A new THREE.Vector3 representing the boundary.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* This method is used to create a new boundary for calculating bounding boxes.
|
|
115
|
+
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
116
|
+
* depending on the value of the 'positive' parameter.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* '''typescript
|
|
120
|
+
* const positiveBound = BoundingBoxer.newBound(true);
|
|
121
|
+
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
122
|
+
*
|
|
123
|
+
* const negativeBound = BoundingBoxer.newBound(false);
|
|
124
|
+
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
125
|
+
* '''
|
|
66
126
|
*/
|
|
67
|
-
|
|
68
|
-
private _clock;
|
|
69
|
-
/**
|
|
70
|
-
* Adds a component to the list of components.
|
|
71
|
-
* Throws an error if a component with the same UUID already exists.
|
|
72
|
-
*
|
|
73
|
-
* @param uuid - The unique identifier of the component.
|
|
74
|
-
* @param instance - The instance of the component to be added.
|
|
75
|
-
*
|
|
76
|
-
* @throws Will throw an error if a component with the same UUID already exists.
|
|
77
|
-
*
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
add(uuid: string, instance: Component): void;
|
|
81
|
-
/**
|
|
82
|
-
* Retrieves a component instance by its constructor function.
|
|
83
|
-
* If the component does not exist in the list, it will be created and added.
|
|
84
|
-
*
|
|
85
|
-
* @template U - The type of the component to retrieve.
|
|
86
|
-
* @param Component - The constructor function of the component to retrieve.
|
|
87
|
-
*
|
|
88
|
-
* @returns The instance of the requested component.
|
|
89
|
-
*
|
|
90
|
-
* @throws Will throw an error if a component with the same UUID already exists.
|
|
91
|
-
*
|
|
92
|
-
* @internal
|
|
93
|
-
*/
|
|
94
|
-
get<U extends Component>(Component: new (components: Components) => U): U;
|
|
95
|
-
constructor();
|
|
127
|
+
static newBound(positive: boolean): THREE.Vector3;
|
|
96
128
|
/**
|
|
97
|
-
*
|
|
98
|
-
* This method starts the animation loop, sets the enabled flag to true,
|
|
99
|
-
* and calls the update method.
|
|
129
|
+
* A static method to calculate the bounding box of a set of points.
|
|
100
130
|
*
|
|
101
|
-
* @
|
|
131
|
+
* @param points - An array of THREE.Vector3 representing the points.
|
|
132
|
+
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
133
|
+
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
134
|
+
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
138
|
+
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* '''typescript
|
|
142
|
+
* const points = [
|
|
143
|
+
* new THREE.Vector3(1, 2, 3),
|
|
144
|
+
* new THREE.Vector3(4, 5, 6),
|
|
145
|
+
* new THREE.Vector3(7, 8, 9),
|
|
146
|
+
* ];
|
|
147
|
+
*
|
|
148
|
+
* const bbox = BoundingBoxer.getBounds(points);
|
|
149
|
+
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
150
|
+
* '''
|
|
102
151
|
*/
|
|
103
|
-
|
|
152
|
+
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
153
|
+
/** {@link Disposable.dispose} */
|
|
154
|
+
dispose(): void;
|
|
104
155
|
/**
|
|
105
|
-
*
|
|
106
|
-
* the library. A memory leak will be created if:
|
|
156
|
+
* Returns the bounding box of the calculated fragments.
|
|
107
157
|
*
|
|
108
|
-
*
|
|
109
|
-
* called. This is especially relevant in Single Page Applications (React,
|
|
110
|
-
* Angular, Vue, etc).
|
|
158
|
+
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
111
159
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
162
|
+
* The returned box represents the bounding box of the calculated fragments.
|
|
114
163
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
164
|
+
* @example
|
|
165
|
+
* '''typescript
|
|
166
|
+
* const boundingBox = boundingBoxer.get();
|
|
167
|
+
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
168
|
+
* '''
|
|
169
|
+
*/
|
|
170
|
+
get(): THREE.Box3;
|
|
171
|
+
/**
|
|
172
|
+
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
173
|
+
*
|
|
174
|
+
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
178
|
+
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
179
|
+
* The radius is calculated as the distance from the center to the minimum bound.
|
|
117
180
|
*
|
|
181
|
+
* @example
|
|
182
|
+
* '''typescript
|
|
183
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
184
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
185
|
+
* const boundingSphere = boundingBoxer.getSphere();
|
|
186
|
+
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
187
|
+
* '''
|
|
118
188
|
*/
|
|
119
|
-
|
|
120
|
-
private update;
|
|
121
|
-
private static setupBVH;
|
|
122
|
-
}
|
|
123
|
-
import { Component, Disposable, World, Event } from "../Types";
|
|
124
|
-
import { SimpleRaycaster } from "./src";
|
|
125
|
-
import { Components } from "../Components";
|
|
126
|
-
/**
|
|
127
|
-
* A component that manages raycasters for different worlds. It uses a Map to store raycasters for each world, and automatically disposes them when the world is disposed.
|
|
128
|
-
*/
|
|
129
|
-
export declare class Raycasters extends Component implements Disposable {
|
|
189
|
+
getSphere(): THREE.Sphere;
|
|
130
190
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
191
|
+
* Returns a THREE.Mesh instance representing the bounding box.
|
|
192
|
+
*
|
|
193
|
+
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
197
|
+
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
198
|
+
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
199
|
+
* The position of the mesh is set to the center of the bounding box.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* '''typescript
|
|
203
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
204
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
205
|
+
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
206
|
+
* scene.add(boundingBoxMesh);
|
|
207
|
+
* '''
|
|
133
208
|
*/
|
|
134
|
-
|
|
135
|
-
/** {@link Component.enabled} */
|
|
136
|
-
enabled: boolean;
|
|
209
|
+
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
137
210
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
211
|
+
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
212
|
+
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
216
|
+
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* '''typescript
|
|
220
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
221
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
222
|
+
* // ...
|
|
223
|
+
* boundingBoxer.reset();
|
|
224
|
+
* '''
|
|
140
225
|
*/
|
|
141
|
-
|
|
142
|
-
/** {@link Disposable.onDisposed} */
|
|
143
|
-
onDisposed: Event<unknown>;
|
|
144
|
-
constructor(components: Components);
|
|
226
|
+
reset(): void;
|
|
145
227
|
/**
|
|
146
|
-
*
|
|
147
|
-
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
148
|
-
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
228
|
+
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
149
229
|
*
|
|
150
|
-
* @param
|
|
151
|
-
*
|
|
230
|
+
* @param group - The FragmentsGroup to add.
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
234
|
+
* and calls the 'addMesh' method for each fragment's mesh.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* '''typescript
|
|
238
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
239
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
240
|
+
* '''
|
|
152
241
|
*/
|
|
153
|
-
|
|
242
|
+
add(group: FragmentsGroup): void;
|
|
154
243
|
/**
|
|
155
|
-
*
|
|
156
|
-
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
244
|
+
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
157
245
|
*
|
|
158
|
-
* @param
|
|
159
|
-
* @
|
|
246
|
+
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
247
|
+
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
248
|
+
*
|
|
249
|
+
* @remarks
|
|
250
|
+
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
251
|
+
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
252
|
+
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* '''typescript
|
|
256
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
257
|
+
* boundingBoxer.addMesh(mesh);
|
|
258
|
+
* '''
|
|
160
259
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
dispose(): void;
|
|
260
|
+
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
261
|
+
private static getFragmentBounds;
|
|
164
262
|
}
|
|
165
|
-
import { Component, Disposable,
|
|
166
|
-
import { Components } from "../Components";
|
|
167
|
-
import { SimpleWorld } from "./src";
|
|
263
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
168
264
|
/**
|
|
169
|
-
*
|
|
265
|
+
* 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).
|
|
170
266
|
*/
|
|
171
|
-
export declare class
|
|
267
|
+
export declare class Exploder extends Component implements Disposable {
|
|
172
268
|
/**
|
|
173
269
|
* A unique identifier for the component.
|
|
174
270
|
* This UUID is used to register the component within the Components system.
|
|
175
271
|
*/
|
|
176
|
-
static readonly uuid: "
|
|
177
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
178
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
179
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
180
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
272
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
181
273
|
/** {@link Disposable.onDisposed} */
|
|
182
274
|
readonly onDisposed: Event<unknown>;
|
|
275
|
+
/** {@link Component.enabled} */
|
|
276
|
+
enabled: boolean;
|
|
183
277
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
278
|
+
* The height of the explosion animation.
|
|
279
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
280
|
+
* Default value is 10.
|
|
186
281
|
*/
|
|
187
|
-
|
|
282
|
+
height: number;
|
|
188
283
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
284
|
+
* The group name used for the explosion animation.
|
|
285
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
286
|
+
* Default value is "storeys".
|
|
191
287
|
*/
|
|
192
|
-
|
|
288
|
+
groupName: string;
|
|
193
289
|
/**
|
|
194
|
-
* A
|
|
195
|
-
*
|
|
290
|
+
* A set of strings representing the exploded items.
|
|
291
|
+
* This set is used to keep track of which items have been exploded.
|
|
196
292
|
*/
|
|
197
|
-
list:
|
|
198
|
-
/** {@link Component.enabled} */
|
|
199
|
-
enabled: boolean;
|
|
293
|
+
list: Set<string>;
|
|
200
294
|
constructor(components: Components);
|
|
295
|
+
/** {@link Disposable.dispose} */
|
|
296
|
+
dispose(): void;
|
|
201
297
|
/**
|
|
202
|
-
*
|
|
298
|
+
* Sets the explosion state of the fragments.
|
|
203
299
|
*
|
|
204
|
-
* @
|
|
205
|
-
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
206
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
300
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
207
301
|
*
|
|
208
|
-
* @
|
|
302
|
+
* @remarks
|
|
303
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
304
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
305
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
306
|
+
*
|
|
307
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
308
|
+
*
|
|
309
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
209
310
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*/
|
|
220
|
-
delete(world: World): void;
|
|
311
|
+
set(active: boolean): void;
|
|
312
|
+
}
|
|
313
|
+
import * as THREE from "three";
|
|
314
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
315
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
316
|
+
/**
|
|
317
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
|
|
318
|
+
*/
|
|
319
|
+
export interface Classification {
|
|
221
320
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
321
|
+
* A system within the classification.
|
|
322
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
323
|
+
*/
|
|
324
|
+
[system: string]: {
|
|
325
|
+
/**
|
|
326
|
+
* A class within the system.
|
|
327
|
+
* The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
|
|
328
|
+
*/
|
|
329
|
+
[className: string]: FRAGS.FragmentIdMap;
|
|
330
|
+
};
|
|
231
331
|
}
|
|
232
|
-
import { Component, Disposable, World, Event } from "../Types";
|
|
233
|
-
import { GridConfig, SimpleGrid } from "./src";
|
|
234
|
-
import { Components } from "../Components";
|
|
235
332
|
/**
|
|
236
|
-
*
|
|
333
|
+
* 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).
|
|
237
334
|
*/
|
|
238
|
-
export declare class
|
|
335
|
+
export declare class Classifier extends Component implements Disposable {
|
|
239
336
|
/**
|
|
240
337
|
* A unique identifier for the component.
|
|
241
338
|
* This UUID is used to register the component within the Components system.
|
|
242
339
|
*/
|
|
243
|
-
static readonly uuid: "
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
*/
|
|
247
|
-
list: Map<string, SimpleGrid>;
|
|
340
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
341
|
+
/** {@link Component.enabled} */
|
|
342
|
+
enabled: boolean;
|
|
248
343
|
/**
|
|
249
|
-
*
|
|
344
|
+
* A map representing the classification systems.
|
|
345
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
250
346
|
*/
|
|
251
|
-
|
|
347
|
+
list: Classification;
|
|
252
348
|
/** {@link Disposable.onDisposed} */
|
|
253
349
|
readonly onDisposed: Event<unknown>;
|
|
254
|
-
/** {@link Component.enabled} */
|
|
255
|
-
enabled: boolean;
|
|
256
350
|
constructor(components: Components);
|
|
351
|
+
private onFragmentsDisposed;
|
|
352
|
+
/** {@link Disposable.dispose} */
|
|
353
|
+
dispose(): void;
|
|
257
354
|
/**
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
*
|
|
261
|
-
* @param world - The world to create the grid for.
|
|
262
|
-
* @returns The newly created grid.
|
|
263
|
-
*
|
|
264
|
-
* @throws Will throw an error if a grid already exists for the given world.
|
|
265
|
-
*/
|
|
266
|
-
create(world: World): SimpleGrid;
|
|
267
|
-
/**
|
|
268
|
-
* Deletes the grid associated with the given world.
|
|
269
|
-
* If a grid does not exist for the given world, this method does nothing.
|
|
355
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
356
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
270
357
|
*
|
|
271
|
-
* @param
|
|
358
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
359
|
+
*/
|
|
360
|
+
remove(guid: string): void;
|
|
361
|
+
/**
|
|
362
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
363
|
+
* If no filter is provided, it returns all fragments.
|
|
364
|
+
*
|
|
365
|
+
* @param filter - An optional object containing filter criteria.
|
|
366
|
+
* The keys of the object represent the classification system names,
|
|
367
|
+
* and the values are arrays of class names to match.
|
|
368
|
+
*
|
|
369
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
370
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
371
|
+
*
|
|
372
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
373
|
+
*/
|
|
374
|
+
find(filter?: {
|
|
375
|
+
[name: string]: string[];
|
|
376
|
+
}): FRAGS.FragmentIdMap;
|
|
377
|
+
/**
|
|
378
|
+
* Classifies fragments based on their modelID.
|
|
379
|
+
*
|
|
380
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
381
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
272
382
|
*
|
|
273
383
|
* @remarks
|
|
274
|
-
* This method
|
|
275
|
-
*
|
|
384
|
+
* This method iterates through the fragments in the provided group,
|
|
385
|
+
* and classifies them based on their modelID.
|
|
386
|
+
* The classification is stored in the 'list.models' property,
|
|
387
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
388
|
+
*
|
|
276
389
|
*/
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
|
|
390
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
391
|
+
/**
|
|
392
|
+
* Classifies fragments based on their PredefinedType property.
|
|
393
|
+
*
|
|
394
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
395
|
+
*
|
|
396
|
+
* @remarks
|
|
397
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
398
|
+
* and classifies them based on their PredefinedType property.
|
|
399
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
400
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
401
|
+
*
|
|
402
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
403
|
+
*/
|
|
404
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
405
|
+
/**
|
|
406
|
+
* Classifies fragments based on their entity type.
|
|
407
|
+
*
|
|
408
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
409
|
+
*
|
|
410
|
+
* @remarks
|
|
411
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
412
|
+
* and classifies them based on their entity type.
|
|
413
|
+
* The classification is stored in the 'list.entities' property,
|
|
414
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
415
|
+
*
|
|
416
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
417
|
+
*/
|
|
418
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
419
|
+
/**
|
|
420
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
421
|
+
*
|
|
422
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
423
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
424
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
425
|
+
*
|
|
426
|
+
* @remarks
|
|
427
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
428
|
+
* and classifies them based on the specified IFC relationship.
|
|
429
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
430
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
431
|
+
*
|
|
432
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
433
|
+
*/
|
|
434
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
435
|
+
/**
|
|
436
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
437
|
+
*
|
|
438
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
439
|
+
*
|
|
440
|
+
* @remarks
|
|
441
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
442
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
443
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
444
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
445
|
+
*
|
|
446
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
447
|
+
*/
|
|
448
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
|
|
449
|
+
/**
|
|
450
|
+
* Sets the color of the specified fragments.
|
|
451
|
+
*
|
|
452
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
453
|
+
* @param color - The color to set for the fragments.
|
|
454
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
455
|
+
*
|
|
456
|
+
* @remarks
|
|
457
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
458
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
459
|
+
*
|
|
460
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
461
|
+
*/
|
|
462
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
463
|
+
/**
|
|
464
|
+
* Resets the color of the specified fragments to their original color.
|
|
465
|
+
*
|
|
466
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
467
|
+
*
|
|
468
|
+
* @remarks
|
|
469
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
470
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
471
|
+
*
|
|
472
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
473
|
+
*/
|
|
474
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
475
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
|
|
280
476
|
}
|
|
281
|
-
import * as
|
|
282
|
-
import {
|
|
283
|
-
import {
|
|
284
|
-
import { Components } from "../Components";
|
|
477
|
+
import * as WEBIFC from "web-ifc";
|
|
478
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
479
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
285
480
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* @param components - the instance of {@link Components} used.
|
|
289
|
-
* E.g. {@link SimplePlane}.
|
|
481
|
+
* Types for boolean properties in IFC schema.
|
|
290
482
|
*/
|
|
291
|
-
export
|
|
483
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
484
|
+
/**
|
|
485
|
+
* Types for string properties in IFC schema.
|
|
486
|
+
*/
|
|
487
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
488
|
+
/**
|
|
489
|
+
* Types for numeric properties in IFC schema.
|
|
490
|
+
*/
|
|
491
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
492
|
+
/**
|
|
493
|
+
* 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.
|
|
494
|
+
*/
|
|
495
|
+
export interface ChangeMap {
|
|
496
|
+
[modelID: string]: Set<number>;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* 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.
|
|
500
|
+
*/
|
|
501
|
+
export interface AttributeListener {
|
|
502
|
+
[modelID: string]: {
|
|
503
|
+
[expressID: number]: {
|
|
504
|
+
[attributeName: string]: Event<String | Boolean | Number>;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
510
|
+
*/
|
|
511
|
+
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
292
512
|
/**
|
|
293
513
|
* A unique identifier for the component.
|
|
294
514
|
* This UUID is used to register the component within the Components system.
|
|
295
515
|
*/
|
|
296
|
-
static readonly uuid: "
|
|
297
|
-
/**
|
|
298
|
-
readonly
|
|
299
|
-
/** Event that fires when the user stops dragging a clipping plane. */
|
|
300
|
-
readonly onAfterDrag: Event<void>;
|
|
516
|
+
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
517
|
+
/** {@link Disposable.onDisposed} */
|
|
518
|
+
readonly onDisposed: Event<string>;
|
|
301
519
|
/**
|
|
302
|
-
* Event
|
|
520
|
+
* Event triggered when a file is requested for export.
|
|
303
521
|
*/
|
|
304
|
-
readonly
|
|
522
|
+
readonly onRequestFile: Event<unknown>;
|
|
305
523
|
/**
|
|
306
|
-
*
|
|
524
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
307
525
|
*/
|
|
308
|
-
|
|
526
|
+
ifcToExport: ArrayBuffer | null;
|
|
309
527
|
/**
|
|
310
|
-
* Event
|
|
528
|
+
* Event triggered when an element is added to a Pset.
|
|
311
529
|
*/
|
|
312
|
-
readonly
|
|
530
|
+
readonly onElementToPset: Event<{
|
|
531
|
+
model: FragmentsGroup;
|
|
532
|
+
psetID: number;
|
|
533
|
+
elementID: number;
|
|
534
|
+
}>;
|
|
313
535
|
/**
|
|
314
|
-
* Event
|
|
536
|
+
* Event triggered when a property is added to a Pset.
|
|
315
537
|
*/
|
|
316
|
-
readonly
|
|
538
|
+
readonly onPropToPset: Event<{
|
|
539
|
+
model: FragmentsGroup;
|
|
540
|
+
psetID: number;
|
|
541
|
+
propID: number;
|
|
542
|
+
}>;
|
|
317
543
|
/**
|
|
318
|
-
* Event
|
|
319
|
-
* @param plane - The newly created clipping plane.
|
|
544
|
+
* Event triggered when a Pset is removed.
|
|
320
545
|
*/
|
|
321
|
-
readonly
|
|
546
|
+
readonly onPsetRemoved: Event<{
|
|
547
|
+
model: FragmentsGroup;
|
|
548
|
+
psetID: number;
|
|
549
|
+
}>;
|
|
322
550
|
/**
|
|
323
|
-
* Event
|
|
324
|
-
* @param plane - The deleted clipping plane.
|
|
551
|
+
* Event triggered when data in the model changes.
|
|
325
552
|
*/
|
|
326
|
-
readonly
|
|
327
|
-
|
|
328
|
-
|
|
553
|
+
readonly onDataChanged: Event<{
|
|
554
|
+
model: FragmentsGroup;
|
|
555
|
+
expressID: number;
|
|
556
|
+
}>;
|
|
329
557
|
/**
|
|
330
|
-
*
|
|
331
|
-
* (up). This is desirable when clipping a building horizontally and a
|
|
332
|
-
* clipping plane is created in its roof, which might have a slight
|
|
333
|
-
* slope for draining purposes.
|
|
558
|
+
* Configuration for the WebAssembly module.
|
|
334
559
|
*/
|
|
335
|
-
|
|
560
|
+
wasm: {
|
|
561
|
+
path: string;
|
|
562
|
+
absolute: boolean;
|
|
563
|
+
};
|
|
564
|
+
/** {@link Component.enabled} */
|
|
565
|
+
enabled: boolean;
|
|
336
566
|
/**
|
|
337
|
-
*
|
|
338
|
-
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
339
|
-
* has to be 'true' for this to apply.
|
|
567
|
+
* Map of attribute listeners.
|
|
340
568
|
*/
|
|
341
|
-
|
|
569
|
+
attributeListeners: AttributeListener;
|
|
342
570
|
/**
|
|
343
|
-
* The
|
|
344
|
-
* Default is {@link SimplePlane}.
|
|
571
|
+
* The currently selected model.
|
|
345
572
|
*/
|
|
346
|
-
|
|
573
|
+
selectedModel?: FragmentsGroup;
|
|
347
574
|
/**
|
|
348
|
-
*
|
|
575
|
+
* Map of changed entities in the model.
|
|
349
576
|
*/
|
|
350
|
-
|
|
351
|
-
/** The material used in all the clipping planes. */
|
|
352
|
-
private _material;
|
|
353
|
-
private _size;
|
|
354
|
-
private _enabled;
|
|
355
|
-
private _visible;
|
|
356
|
-
/** {@link Component.enabled} */
|
|
357
|
-
get enabled(): boolean;
|
|
358
|
-
/** {@link Component.enabled} */
|
|
359
|
-
set enabled(state: boolean);
|
|
360
|
-
/** {@link Hideable.visible } */
|
|
361
|
-
get visible(): boolean;
|
|
362
|
-
/** {@link Hideable.visible } */
|
|
363
|
-
set visible(state: boolean);
|
|
364
|
-
/** The material of the clipping plane representation. */
|
|
365
|
-
get material(): THREE.MeshBasicMaterial;
|
|
366
|
-
/** The material of the clipping plane representation. */
|
|
367
|
-
set material(material: THREE.MeshBasicMaterial);
|
|
368
|
-
/** The size of the geometric representation of the clippings planes. */
|
|
369
|
-
get size(): number;
|
|
370
|
-
/** The size of the geometric representation of the clippings planes. */
|
|
371
|
-
set size(size: number);
|
|
577
|
+
changeMap: ChangeMap;
|
|
372
578
|
constructor(components: Components);
|
|
373
579
|
/** {@link Disposable.dispose} */
|
|
374
580
|
dispose(): void;
|
|
375
|
-
/** {@link Createable.create} */
|
|
376
|
-
create(world: World): void;
|
|
377
581
|
/**
|
|
378
|
-
*
|
|
379
|
-
* without the need of the mouse.
|
|
582
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
380
583
|
*
|
|
381
|
-
* @param
|
|
382
|
-
* @
|
|
383
|
-
* @
|
|
384
|
-
* navigation.
|
|
584
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
585
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
586
|
+
* @returns The IFC schema associated with the given model.
|
|
385
587
|
*/
|
|
386
|
-
|
|
588
|
+
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
387
589
|
/**
|
|
388
|
-
*
|
|
590
|
+
* Method to set properties data in the model.
|
|
389
591
|
*
|
|
390
|
-
* @param
|
|
391
|
-
* @param
|
|
392
|
-
*
|
|
592
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
593
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
594
|
+
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
595
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
596
|
+
*
|
|
597
|
+
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
598
|
+
*
|
|
599
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
393
600
|
*/
|
|
394
|
-
|
|
395
|
-
/** Deletes all the existing clipping planes. */
|
|
396
|
-
deleteAll(): void;
|
|
397
|
-
private deletePlane;
|
|
398
|
-
private pickPlane;
|
|
399
|
-
private getAllPlaneMeshes;
|
|
400
|
-
private createPlaneFromIntersection;
|
|
401
|
-
private getWorldNormal;
|
|
402
|
-
private normalizePlaneDirectionY;
|
|
403
|
-
private newPlane;
|
|
404
|
-
private updateMaterialsAndPlanes;
|
|
405
|
-
private _onStartDragging;
|
|
406
|
-
private _onEndDragging;
|
|
407
|
-
}
|
|
408
|
-
import * as THREE from "three";
|
|
409
|
-
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
410
|
-
center: THREE.Vector3;
|
|
411
|
-
halfSizes: THREE.Vector3;
|
|
412
|
-
rotation: THREE.Matrix3;
|
|
413
|
-
transformation: THREE.Matrix4;
|
|
414
|
-
};
|
|
415
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
416
|
-
import * as THREE from "three";
|
|
417
|
-
export declare class MaterialsUtils {
|
|
418
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
419
|
-
}
|
|
420
|
-
export declare class UUID {
|
|
421
|
-
private static _pattern;
|
|
422
|
-
private static _lut;
|
|
423
|
-
static create(): string;
|
|
424
|
-
static validate(uuid: string): void;
|
|
425
|
-
}
|
|
426
|
-
import * as THREE from "three";
|
|
427
|
-
import { Component, Components, Event, World } from "../core";
|
|
428
|
-
export interface VertexPickerConfig {
|
|
429
|
-
showOnlyVertex: boolean;
|
|
430
|
-
snapDistance: number;
|
|
431
|
-
previewElement: HTMLElement;
|
|
432
|
-
}
|
|
433
|
-
export declare class VertexPicker extends Component {
|
|
434
|
-
onVertexFound: Event<THREE.Vector3>;
|
|
435
|
-
onVertexLost: Event<THREE.Vector3>;
|
|
436
|
-
components: Components;
|
|
437
|
-
private _pickedPoint;
|
|
438
|
-
private _config;
|
|
439
|
-
private _enabled;
|
|
440
|
-
private _workingPlane;
|
|
441
|
-
set enabled(value: boolean);
|
|
442
|
-
get enabled(): boolean;
|
|
443
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
444
|
-
set workingPlane(plane: THREE.Plane | null);
|
|
445
|
-
get workingPlane(): THREE.Plane | null;
|
|
446
|
-
set config(value: Partial<VertexPickerConfig>);
|
|
447
|
-
get config(): Partial<VertexPickerConfig>;
|
|
448
|
-
dispose(): void;
|
|
449
|
-
get(world: World): THREE.Vector3 | null;
|
|
450
|
-
private getClosestVertex;
|
|
451
|
-
private getVertices;
|
|
452
|
-
private getVertex;
|
|
453
|
-
}
|
|
454
|
-
import { Components } from "../Components";
|
|
455
|
-
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
456
|
-
import { Component, Event, Disposable, World } from "../Types";
|
|
457
|
-
/**
|
|
458
|
-
* A component that manages and provides culling functionality for meshes in a 3D scene.
|
|
459
|
-
*/
|
|
460
|
-
export declare class Cullers extends Component implements Disposable {
|
|
601
|
+
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
461
602
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
603
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
604
|
+
*
|
|
605
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
606
|
+
* @param name - The name of the Pset.
|
|
607
|
+
* @param description - (Optional) The description of the Pset.
|
|
608
|
+
*
|
|
609
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
610
|
+
*
|
|
611
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
612
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
464
613
|
*/
|
|
465
|
-
|
|
614
|
+
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
615
|
+
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
616
|
+
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
617
|
+
}>;
|
|
466
618
|
/**
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
619
|
+
* Removes a Property Set (Pset) from the given model.
|
|
620
|
+
*
|
|
621
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
622
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
623
|
+
*
|
|
624
|
+
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
625
|
+
*
|
|
626
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
627
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
628
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
629
|
+
*/
|
|
630
|
+
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
471
631
|
/**
|
|
472
|
-
*
|
|
632
|
+
* Creates a new single-value property of type string in the given model.
|
|
633
|
+
*
|
|
634
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
635
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
636
|
+
* @param name - The name of the property.
|
|
637
|
+
* @param value - The value of the property. Must be a string.
|
|
638
|
+
*
|
|
639
|
+
* @returns The newly created single-value property.
|
|
640
|
+
*
|
|
641
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
642
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
473
643
|
*/
|
|
474
|
-
|
|
475
|
-
/** {@link Component.enabled} */
|
|
476
|
-
get enabled(): boolean;
|
|
477
|
-
/** {@link Component.enabled} */
|
|
478
|
-
set enabled(value: boolean);
|
|
479
|
-
constructor(components: Components);
|
|
644
|
+
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
480
645
|
/**
|
|
481
|
-
* Creates a new
|
|
482
|
-
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
646
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
483
647
|
*
|
|
484
|
-
* @param
|
|
485
|
-
* @param
|
|
648
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
649
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
650
|
+
* @param name - The name of the property.
|
|
651
|
+
* @param value - The value of the property. Must be a number.
|
|
486
652
|
*
|
|
487
|
-
* @returns The newly created
|
|
653
|
+
* @returns The newly created single-value property.
|
|
654
|
+
*
|
|
655
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
656
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
488
657
|
*/
|
|
489
|
-
|
|
658
|
+
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
490
659
|
/**
|
|
491
|
-
*
|
|
492
|
-
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
660
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
493
661
|
*
|
|
494
|
-
* @param
|
|
662
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
663
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
664
|
+
* @param name - The name of the property.
|
|
665
|
+
* @param value - The value of the property. Must be a boolean.
|
|
495
666
|
*
|
|
496
|
-
* @returns
|
|
667
|
+
* @returns The newly created single-value property.
|
|
668
|
+
*
|
|
669
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
670
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
497
671
|
*/
|
|
498
|
-
|
|
499
|
-
/** {@link Disposable.dispose} */
|
|
500
|
-
dispose(): void;
|
|
501
|
-
}
|
|
502
|
-
import { MiniMap } from "./src";
|
|
503
|
-
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
504
|
-
import { Components } from "../Components";
|
|
505
|
-
/**
|
|
506
|
-
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID.
|
|
507
|
-
*/
|
|
508
|
-
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
672
|
+
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
509
673
|
/**
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
674
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
675
|
+
*
|
|
676
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
677
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
678
|
+
* @param propID - The express ID of the property to be removed.
|
|
679
|
+
*
|
|
680
|
+
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
681
|
+
*
|
|
682
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
683
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
684
|
+
*/
|
|
685
|
+
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
686
|
+
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
522
687
|
/**
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
688
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
689
|
+
*
|
|
690
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
691
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
692
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
693
|
+
*
|
|
694
|
+
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
695
|
+
*
|
|
696
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
697
|
+
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
698
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
699
|
+
*/
|
|
700
|
+
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
527
701
|
/**
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
702
|
+
* Saves the changes made to the model to a new IFC file.
|
|
703
|
+
*
|
|
704
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
705
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
706
|
+
*
|
|
707
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
708
|
+
*
|
|
709
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
710
|
+
*/
|
|
711
|
+
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
536
712
|
/**
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
713
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
714
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
715
|
+
*
|
|
716
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
717
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
718
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
719
|
+
*
|
|
720
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
721
|
+
*
|
|
722
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
723
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
724
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
725
|
+
*/
|
|
726
|
+
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
727
|
+
private increaseMaxID;
|
|
728
|
+
private newGUID;
|
|
729
|
+
private getOwnerHistory;
|
|
730
|
+
private registerChange;
|
|
731
|
+
private newSingleProperty;
|
|
548
732
|
}
|
|
549
|
-
import * as
|
|
550
|
-
import
|
|
551
|
-
import {
|
|
552
|
-
import {
|
|
733
|
+
import * as WEBIFC from "web-ifc";
|
|
734
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
735
|
+
import { IfcFragmentSettings } from "./src";
|
|
736
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
553
737
|
/**
|
|
554
|
-
*
|
|
738
|
+
* 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).
|
|
555
739
|
*/
|
|
556
|
-
export declare class
|
|
740
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
557
741
|
/**
|
|
558
|
-
* A
|
|
742
|
+
* A unique identifier for the component.
|
|
743
|
+
* This UUID is used to register the component within the Components system.
|
|
559
744
|
*/
|
|
560
|
-
readonly
|
|
745
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
746
|
+
/** {@link Disposable.onDisposed} */
|
|
747
|
+
readonly onDisposed: Event<string>;
|
|
561
748
|
/**
|
|
562
|
-
*
|
|
563
|
-
* This camera is used when the projection mode is set to orthographic.
|
|
749
|
+
* An event triggered when the IFC file starts loading.
|
|
564
750
|
*/
|
|
565
|
-
readonly
|
|
751
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
566
752
|
/**
|
|
567
|
-
*
|
|
568
|
-
* This camera is used when the projection mode is set to perspective.
|
|
753
|
+
* An event triggered when the setup process is completed.
|
|
569
754
|
*/
|
|
570
|
-
readonly
|
|
571
|
-
protected readonly _userInputButtons: any;
|
|
572
|
-
protected readonly _frustumSize = 50;
|
|
573
|
-
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
574
|
-
protected _mode: NavigationMode | null;
|
|
575
|
-
private previousSize;
|
|
755
|
+
readonly onSetup: Event<void>;
|
|
576
756
|
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
757
|
+
* The settings for the IfcLoader.
|
|
758
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
759
|
+
*/
|
|
760
|
+
settings: IfcFragmentSettings;
|
|
761
|
+
/**
|
|
762
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
763
|
+
*/
|
|
764
|
+
webIfc: WEBIFC.IfcAPI;
|
|
765
|
+
/** {@link Component.enabled} */
|
|
766
|
+
enabled: boolean;
|
|
767
|
+
private _material;
|
|
768
|
+
private _spatialTree;
|
|
769
|
+
private _metaData;
|
|
770
|
+
private _fragmentInstances;
|
|
771
|
+
private _civil;
|
|
772
|
+
private _visitedFragments;
|
|
773
|
+
private _materialT;
|
|
585
774
|
constructor(components: Components);
|
|
586
775
|
/** {@link Disposable.dispose} */
|
|
587
776
|
dispose(): void;
|
|
588
777
|
/**
|
|
589
|
-
* Sets
|
|
778
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
590
779
|
*
|
|
591
|
-
* @param
|
|
780
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
781
|
+
* If not provided, the existing settings will be used.
|
|
782
|
+
*
|
|
783
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
784
|
+
*
|
|
785
|
+
* @remarks
|
|
786
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
787
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* '''typescript
|
|
791
|
+
* const ifcLoader = new IfcLoader(components);
|
|
792
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
793
|
+
* '''
|
|
592
794
|
*/
|
|
593
|
-
|
|
795
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
594
796
|
/**
|
|
595
|
-
*
|
|
797
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
596
798
|
*
|
|
597
|
-
* @param
|
|
598
|
-
*
|
|
599
|
-
*
|
|
799
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
800
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
801
|
+
*
|
|
802
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* '''typescript
|
|
806
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
807
|
+
* const group = await ifcLoader.load(ifcData);
|
|
808
|
+
* '''
|
|
600
809
|
*/
|
|
601
|
-
|
|
810
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
602
811
|
/**
|
|
603
|
-
*
|
|
812
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
604
813
|
*
|
|
605
|
-
* @param
|
|
814
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
815
|
+
*
|
|
816
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
817
|
+
*
|
|
818
|
+
* @remarks
|
|
819
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
820
|
+
* It also opens the IFC model using the provided data and settings.
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* '''typescript
|
|
824
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
825
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
826
|
+
* '''
|
|
606
827
|
*/
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
828
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
829
|
+
/**
|
|
830
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
831
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
832
|
+
*
|
|
833
|
+
* @remarks
|
|
834
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* '''typescript
|
|
838
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
839
|
+
* ifcLoader.cleanUp();
|
|
840
|
+
* '''
|
|
841
|
+
*/
|
|
842
|
+
cleanUp(): void;
|
|
843
|
+
private getAllGeometries;
|
|
844
|
+
private getMesh;
|
|
845
|
+
private getGeometry;
|
|
846
|
+
private autoSetWasm;
|
|
612
847
|
}
|
|
613
848
|
import * as WEBIFC from "web-ifc";
|
|
614
|
-
import
|
|
615
|
-
import { Component, Components } from "../../core";
|
|
849
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
850
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
851
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
852
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
616
853
|
/**
|
|
617
|
-
*
|
|
854
|
+
* 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).
|
|
618
855
|
*/
|
|
619
|
-
export declare class
|
|
620
|
-
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
621
|
-
/** {@link Component.enabled} */
|
|
622
|
-
enabled: boolean;
|
|
623
|
-
constructor(components: Components);
|
|
856
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
624
857
|
/**
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
628
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
629
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
630
|
-
* to make the location data available (e.g. absolute position of building).
|
|
858
|
+
* A unique identifier for the component.
|
|
859
|
+
* This UUID is used to register the component within the Components system.
|
|
631
860
|
*/
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
import * as WEBIFC from "web-ifc";
|
|
635
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
636
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
637
|
-
type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
638
|
-
type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
639
|
-
type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
640
|
-
interface ChangeMap {
|
|
641
|
-
[modelID: string]: Set<number>;
|
|
642
|
-
}
|
|
643
|
-
interface AttributeListener {
|
|
644
|
-
[modelID: string]: {
|
|
645
|
-
[expressID: number]: {
|
|
646
|
-
[attributeName: string]: Event<String | Boolean | Number>;
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
651
|
-
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
861
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
652
862
|
/** {@link Disposable.onDisposed} */
|
|
653
863
|
readonly onDisposed: Event<string>;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}>;
|
|
666
|
-
readonly onPsetRemoved: Event<{
|
|
667
|
-
model: FragmentsGroup;
|
|
668
|
-
psetID: number;
|
|
669
|
-
}>;
|
|
670
|
-
readonly onDataChanged: Event<{
|
|
671
|
-
model: FragmentsGroup;
|
|
672
|
-
expressID: number;
|
|
864
|
+
/**
|
|
865
|
+
* Event triggered when relations for a model have been indexed.
|
|
866
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
867
|
+
*
|
|
868
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
869
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
870
|
+
* 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.
|
|
871
|
+
*/
|
|
872
|
+
readonly onRelationsIndexed: Event<{
|
|
873
|
+
modelID: string;
|
|
874
|
+
relationsMap: RelationsMap;
|
|
673
875
|
}>;
|
|
674
|
-
wasm: {
|
|
675
|
-
path: string;
|
|
676
|
-
absolute: boolean;
|
|
677
|
-
};
|
|
678
|
-
enabled: boolean;
|
|
679
|
-
attributeListeners: AttributeListener;
|
|
680
|
-
selectedModel?: FragmentsGroup;
|
|
681
|
-
changeMap: ChangeMap;
|
|
682
|
-
constructor(components: Components);
|
|
683
|
-
dispose(): void;
|
|
684
|
-
private increaseMaxID;
|
|
685
|
-
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
686
|
-
private newGUID;
|
|
687
|
-
private getOwnerHistory;
|
|
688
|
-
private registerChange;
|
|
689
|
-
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
690
|
-
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
691
|
-
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
692
|
-
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
693
|
-
}>;
|
|
694
|
-
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
695
|
-
private newSingleProperty;
|
|
696
|
-
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
697
|
-
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
698
|
-
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
699
|
-
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
700
|
-
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
701
|
-
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
702
|
-
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
703
|
-
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
704
|
-
}
|
|
705
|
-
export {};
|
|
706
|
-
import * as WEBIFC from "web-ifc";
|
|
707
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
708
|
-
import { Disposable, Event, Component, Components } from "../../core";
|
|
709
|
-
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
710
|
-
/**
|
|
711
|
-
* Indexer 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.
|
|
712
|
-
*/
|
|
713
|
-
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
714
|
-
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
715
|
-
/** {@link Disposable.onDisposed} */
|
|
716
|
-
readonly onDisposed: Event<string>;
|
|
717
|
-
enabled: boolean;
|
|
718
|
-
readonly onRelationsIndexed: Event<{
|
|
719
|
-
modelID: string;
|
|
720
|
-
relationsMap: RelationsMap;
|
|
721
|
-
}>;
|
|
722
|
-
private _relToAttributesMap;
|
|
723
|
-
private _inverseAttributes;
|
|
724
|
-
private _ifcRels;
|
|
725
876
|
/**
|
|
726
877
|
* Holds the relationship mappings for each model processed by the indexer.
|
|
727
878
|
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
@@ -731,6 +882,11 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
731
882
|
* of entity relationships within a model.
|
|
732
883
|
*/
|
|
733
884
|
readonly relationMaps: ModelsRelationMap;
|
|
885
|
+
/** {@link Component.enabled} */
|
|
886
|
+
enabled: boolean;
|
|
887
|
+
private _relToAttributesMap;
|
|
888
|
+
private _inverseAttributes;
|
|
889
|
+
private _ifcRels;
|
|
734
890
|
constructor(components: Components);
|
|
735
891
|
private onFragmentsDisposed;
|
|
736
892
|
private indexRelations;
|
|
@@ -827,133 +983,8 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
827
983
|
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
828
984
|
*/
|
|
829
985
|
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
830
|
-
/**
|
|
831
|
-
* Disposes the component, cleaning up resources and detaching event listeners.
|
|
832
|
-
* This ensures that the component is properly cleaned up and does not leave behind any
|
|
833
|
-
* references that could prevent garbage collection.
|
|
834
|
-
*/
|
|
835
|
-
dispose(): void;
|
|
836
|
-
}
|
|
837
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
838
|
-
import * as THREE from "three";
|
|
839
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
840
|
-
import { Disposable, Component, Event, Components } from "../../core";
|
|
841
|
-
export interface Classification {
|
|
842
|
-
[system: string]: {
|
|
843
|
-
[className: string]: FRAGS.FragmentIdMap;
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
export declare class Classifier extends Component implements Disposable {
|
|
847
|
-
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
848
|
-
/** {@link Component.enabled} */
|
|
849
|
-
enabled: boolean;
|
|
850
|
-
list: Classification;
|
|
851
|
-
/** {@link Disposable.onDisposed} */
|
|
852
|
-
readonly onDisposed: Event<unknown>;
|
|
853
|
-
constructor(components: Components);
|
|
854
|
-
private onFragmentsDisposed;
|
|
855
|
-
dispose(): void;
|
|
856
|
-
remove(guid: string): void;
|
|
857
|
-
find(filter?: {
|
|
858
|
-
[name: string]: string[];
|
|
859
|
-
}): FRAGS.FragmentIdMap;
|
|
860
|
-
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
861
|
-
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
862
|
-
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
863
|
-
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
864
|
-
bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
|
|
865
|
-
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
866
|
-
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
867
|
-
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
|
|
868
|
-
}
|
|
869
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
870
|
-
import { Components, Component } from "../../core";
|
|
871
|
-
export declare class Hider extends Component {
|
|
872
|
-
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
873
|
-
enabled: boolean;
|
|
874
|
-
constructor(components: Components);
|
|
875
|
-
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
876
|
-
isolate(items: FRAGS.FragmentIdMap): void;
|
|
877
|
-
private updateCulledVisibility;
|
|
878
|
-
}
|
|
879
|
-
import * as THREE from "three";
|
|
880
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
881
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
882
|
-
import { Component, Components, Disposable, Event } from "../../core";
|
|
883
|
-
/**
|
|
884
|
-
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
|
|
885
|
-
*/
|
|
886
|
-
export declare class BoundingBoxer extends Component implements Disposable {
|
|
887
|
-
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
888
|
-
/** {@link Component.enabled} */
|
|
889
|
-
enabled: boolean;
|
|
890
|
-
/** {@link Disposable.onDisposed} */
|
|
891
|
-
readonly onDisposed: Event<unknown>;
|
|
892
|
-
private _absoluteMin;
|
|
893
|
-
private _absoluteMax;
|
|
894
|
-
private _meshes;
|
|
895
|
-
constructor(components: Components);
|
|
896
|
-
static getDimensions(bbox: THREE.Box3): {
|
|
897
|
-
width: number;
|
|
898
|
-
height: number;
|
|
899
|
-
depth: number;
|
|
900
|
-
center: THREE.Vector3;
|
|
901
|
-
};
|
|
902
|
-
static newBound(positive: boolean): THREE.Vector3;
|
|
903
|
-
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
904
986
|
/** {@link Disposable.dispose} */
|
|
905
987
|
dispose(): void;
|
|
906
|
-
get(): THREE.Box3;
|
|
907
|
-
getSphere(): THREE.Sphere;
|
|
908
|
-
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
909
|
-
reset(): void;
|
|
910
|
-
add(group: FragmentsGroup): void;
|
|
911
|
-
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
912
|
-
private static getFragmentBounds;
|
|
913
|
-
}
|
|
914
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
915
|
-
export declare class Exploder extends Component implements Disposable {
|
|
916
|
-
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
917
|
-
enabled: boolean;
|
|
918
|
-
height: number;
|
|
919
|
-
groupName: string;
|
|
920
|
-
/** {@link Disposable.onDisposed} */
|
|
921
|
-
readonly onDisposed: Event<unknown>;
|
|
922
|
-
list: Set<string>;
|
|
923
|
-
constructor(components: Components);
|
|
924
|
-
dispose(): void;
|
|
925
|
-
set(active: boolean): void;
|
|
926
|
-
}
|
|
927
|
-
import * as WEBIFC from "web-ifc";
|
|
928
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
929
|
-
import { IfcFragmentSettings } from "./src";
|
|
930
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
931
|
-
export declare class IfcLoader extends Component implements Disposable {
|
|
932
|
-
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
933
|
-
readonly onIfcStartedLoading: Event<void>;
|
|
934
|
-
readonly onSetup: Event<void>;
|
|
935
|
-
/** {@link Disposable.onDisposed} */
|
|
936
|
-
readonly onDisposed: Event<string>;
|
|
937
|
-
settings: IfcFragmentSettings;
|
|
938
|
-
enabled: boolean;
|
|
939
|
-
webIfc: WEBIFC.IfcAPI;
|
|
940
|
-
private _material;
|
|
941
|
-
private _spatialTree;
|
|
942
|
-
private _metaData;
|
|
943
|
-
private _fragmentInstances;
|
|
944
|
-
private _civil;
|
|
945
|
-
private _visitedFragments;
|
|
946
|
-
private _materialT;
|
|
947
|
-
constructor(components: Components);
|
|
948
|
-
dispose(): void;
|
|
949
|
-
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
950
|
-
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
951
|
-
readIfcFile(data: Uint8Array): Promise<number>;
|
|
952
|
-
private getAllGeometries;
|
|
953
|
-
cleanUp(): void;
|
|
954
|
-
private getMesh;
|
|
955
|
-
private getGeometry;
|
|
956
|
-
private autoSetWasm;
|
|
957
988
|
}
|
|
958
989
|
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
959
990
|
import * as THREE from "three";
|
|
@@ -961,32 +992,60 @@ import * as FRAGS from "@thatopen/fragments";
|
|
|
961
992
|
import { Component, Components, Event, Disposable } from "../../core";
|
|
962
993
|
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
963
994
|
/**
|
|
964
|
-
*
|
|
995
|
+
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
965
996
|
*/
|
|
966
997
|
export declare class FragmentsManager extends Component implements Disposable {
|
|
998
|
+
/**
|
|
999
|
+
* A unique identifier for the component.
|
|
1000
|
+
* This UUID is used to register the component within the Components system.
|
|
1001
|
+
*/
|
|
967
1002
|
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
968
1003
|
/** {@link Disposable.onDisposed} */
|
|
969
1004
|
readonly onDisposed: Event<unknown>;
|
|
1005
|
+
/**
|
|
1006
|
+
* Event triggered when fragments are loaded.
|
|
1007
|
+
*/
|
|
970
1008
|
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Event triggered when fragments are disposed.
|
|
1011
|
+
*/
|
|
971
1012
|
readonly onFragmentsDisposed: Event<{
|
|
972
1013
|
groupID: string;
|
|
973
1014
|
fragmentIDs: string[];
|
|
974
1015
|
}>;
|
|
975
|
-
/**
|
|
1016
|
+
/**
|
|
1017
|
+
* Map containing all loaded fragments.
|
|
1018
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1019
|
+
*/
|
|
976
1020
|
readonly list: Map<string, Fragment>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Map containing all loaded fragment groups.
|
|
1023
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1024
|
+
*/
|
|
977
1025
|
readonly groups: Map<string, FragmentsGroup>;
|
|
1026
|
+
baseCoordinationModel: string;
|
|
978
1027
|
/** {@link Component.enabled} */
|
|
979
1028
|
enabled: boolean;
|
|
980
|
-
baseCoordinationModel: string;
|
|
981
1029
|
private _loader;
|
|
982
|
-
/**
|
|
1030
|
+
/**
|
|
1031
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1032
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1033
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1034
|
+
*/
|
|
983
1035
|
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
984
1036
|
constructor(components: Components);
|
|
985
1037
|
/** {@link Disposable.dispose} */
|
|
986
1038
|
dispose(): void;
|
|
1039
|
+
/**
|
|
1040
|
+
* Dispose of a specific fragment group.
|
|
1041
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1042
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1043
|
+
*
|
|
1044
|
+
* @param group - The fragment group to be disposed.
|
|
1045
|
+
*/
|
|
987
1046
|
disposeGroup(group: FragmentsGroup): void;
|
|
988
1047
|
/**
|
|
989
|
-
* Loads a
|
|
1048
|
+
* Loads a binary file that contain fragment geometry.
|
|
990
1049
|
* @param data - The binary data to load.
|
|
991
1050
|
* @param config - Optional configuration for loading.
|
|
992
1051
|
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
@@ -1000,7 +1059,7 @@ export declare class FragmentsManager extends Component implements Disposable {
|
|
|
1000
1059
|
relationsMap: RelationsMap;
|
|
1001
1060
|
}>): FragmentsGroup;
|
|
1002
1061
|
/**
|
|
1003
|
-
* Export the specified
|
|
1062
|
+
* Export the specified fragmentsgroup to binary data.
|
|
1004
1063
|
* @param group - the fragments group to be exported.
|
|
1005
1064
|
* @returns the exported data as binary buffer.
|
|
1006
1065
|
*/
|
|
@@ -1026,928 +1085,1655 @@ export declare class FragmentsManager extends Component implements Disposable {
|
|
|
1026
1085
|
modelIdToFragmentIdMap(modelIdMap: {
|
|
1027
1086
|
[modelID: string]: Set<number>;
|
|
1028
1087
|
}): FRAGS.FragmentIdMap;
|
|
1088
|
+
/**
|
|
1089
|
+
* Applies coordinate transformation to the provided models.
|
|
1090
|
+
* If no models are provided, all groups are used.
|
|
1091
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
1092
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
1093
|
+
*
|
|
1094
|
+
* @param models - The models to apply coordinate transformation to.
|
|
1095
|
+
* If not provided, all groups are used.
|
|
1096
|
+
*
|
|
1097
|
+
* @returns {void}
|
|
1098
|
+
*/
|
|
1029
1099
|
coordinate(models?: FragmentsGroup[]): void;
|
|
1030
1100
|
}
|
|
1031
|
-
import * as
|
|
1032
|
-
import { Components,
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
/** {@link Disposable.onDisposed} */
|
|
1044
|
-
readonly onDisposed: Event<unknown>;
|
|
1045
|
-
settings: IfcStreamingSettings;
|
|
1101
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1102
|
+
import { Components, Component } from "../../core";
|
|
1103
|
+
/**
|
|
1104
|
+
* A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
|
|
1105
|
+
*/
|
|
1106
|
+
export declare class Hider extends Component {
|
|
1107
|
+
/**
|
|
1108
|
+
* A unique identifier for the component.
|
|
1109
|
+
* This UUID is used to register the component within the Components system.
|
|
1110
|
+
*/
|
|
1111
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
1112
|
+
/** {@link Component.enabled} */
|
|
1046
1113
|
enabled: boolean;
|
|
1047
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1048
|
-
private _spatialTree;
|
|
1049
|
-
private _metaData;
|
|
1050
|
-
private _visitedGeometries;
|
|
1051
|
-
private _streamSerializer;
|
|
1052
|
-
private _geometries;
|
|
1053
|
-
private _geometryCount;
|
|
1054
|
-
private _civil;
|
|
1055
|
-
private _groupSerializer;
|
|
1056
|
-
private _assets;
|
|
1057
|
-
private _meshesWithHoles;
|
|
1058
1114
|
constructor(components: Components);
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1115
|
+
/**
|
|
1116
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
1117
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
1118
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
1119
|
+
*
|
|
1120
|
+
* @param visible - The visibility state to set for the fragments.
|
|
1121
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
1122
|
+
* If not provided, all fragments will be affected.
|
|
1123
|
+
*
|
|
1124
|
+
* @returns {void}
|
|
1125
|
+
*/
|
|
1126
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
1127
|
+
/**
|
|
1128
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
1129
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
1130
|
+
*
|
|
1131
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
1132
|
+
* If not provided, all fragments will be isolated.
|
|
1133
|
+
*
|
|
1134
|
+
* @returns {void}
|
|
1135
|
+
*/
|
|
1136
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
1137
|
+
private updateCulledVisibility;
|
|
1070
1138
|
}
|
|
1071
1139
|
import * as WEBIFC from "web-ifc";
|
|
1072
|
-
import
|
|
1073
|
-
import {
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1140
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1141
|
+
import { Component, Components } from "../../core";
|
|
1142
|
+
/**
|
|
1143
|
+
* Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
|
|
1144
|
+
*/
|
|
1145
|
+
export declare class IfcJsonExporter extends Component {
|
|
1146
|
+
/**
|
|
1147
|
+
* A unique identifier for the component.
|
|
1148
|
+
* This UUID is used to register the component within the Components system.
|
|
1149
|
+
*/
|
|
1150
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1151
|
+
/** {@link Component.enabled} */
|
|
1152
|
+
enabled: boolean;
|
|
1153
|
+
constructor(components: Components);
|
|
1154
|
+
/**
|
|
1155
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
1156
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1157
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
1158
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
1159
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1160
|
+
* to make the location data available (e.g. absolute position of building).
|
|
1161
|
+
*/
|
|
1162
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1163
|
+
}
|
|
1164
|
+
import * as THREE from "three";
|
|
1165
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
1166
|
+
center: THREE.Vector3;
|
|
1167
|
+
halfSizes: THREE.Vector3;
|
|
1168
|
+
rotation: THREE.Matrix3;
|
|
1169
|
+
transformation: THREE.Matrix4;
|
|
1170
|
+
};
|
|
1171
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1172
|
+
import * as THREE from "three";
|
|
1173
|
+
export declare class MaterialsUtils {
|
|
1174
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
1175
|
+
}
|
|
1176
|
+
import * as THREE from "three";
|
|
1177
|
+
import { Component, Components, Event, World } from "../core";
|
|
1178
|
+
export interface VertexPickerConfig {
|
|
1179
|
+
showOnlyVertex: boolean;
|
|
1180
|
+
snapDistance: number;
|
|
1181
|
+
previewElement: HTMLElement;
|
|
1182
|
+
}
|
|
1183
|
+
export declare class VertexPicker extends Component {
|
|
1184
|
+
onVertexFound: Event<THREE.Vector3>;
|
|
1185
|
+
onVertexLost: Event<THREE.Vector3>;
|
|
1186
|
+
components: Components;
|
|
1187
|
+
private _pickedPoint;
|
|
1188
|
+
private _config;
|
|
1189
|
+
private _enabled;
|
|
1190
|
+
private _workingPlane;
|
|
1191
|
+
set enabled(value: boolean);
|
|
1192
|
+
get enabled(): boolean;
|
|
1193
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1194
|
+
set workingPlane(plane: THREE.Plane | null);
|
|
1195
|
+
get workingPlane(): THREE.Plane | null;
|
|
1196
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
1197
|
+
get config(): Partial<VertexPickerConfig>;
|
|
1198
|
+
dispose(): void;
|
|
1199
|
+
get(world: World): THREE.Vector3 | null;
|
|
1200
|
+
private getClosestVertex;
|
|
1201
|
+
private getVertices;
|
|
1202
|
+
private getVertex;
|
|
1203
|
+
}
|
|
1204
|
+
export declare class UUID {
|
|
1205
|
+
private static _pattern;
|
|
1206
|
+
private static _lut;
|
|
1207
|
+
static create(): string;
|
|
1208
|
+
static validate(uuid: string): void;
|
|
1209
|
+
}
|
|
1210
|
+
import * as WEBIFC from "web-ifc";
|
|
1211
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1212
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1213
|
+
/**
|
|
1214
|
+
* A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
|
|
1215
|
+
*/
|
|
1216
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1217
|
+
/**
|
|
1218
|
+
* A unique identifier for the component.
|
|
1219
|
+
* This UUID is used to register the component within the Components system.
|
|
1220
|
+
*/
|
|
1221
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1222
|
+
/**
|
|
1223
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1224
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1225
|
+
*/
|
|
1226
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1227
|
+
type: number;
|
|
1078
1228
|
data: {
|
|
1079
1229
|
[id: number]: any;
|
|
1080
1230
|
};
|
|
1081
1231
|
}>;
|
|
1082
|
-
|
|
1083
|
-
|
|
1232
|
+
/**
|
|
1233
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
1234
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1235
|
+
*/
|
|
1236
|
+
readonly onProgress: AsyncEvent<number>;
|
|
1237
|
+
/**
|
|
1238
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
1239
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1240
|
+
*/
|
|
1241
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1084
1242
|
/** {@link Disposable.onDisposed} */
|
|
1085
1243
|
readonly onDisposed: Event<string>;
|
|
1244
|
+
/** {@link Component.enabled} */
|
|
1086
1245
|
enabled: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1248
|
+
*/
|
|
1087
1249
|
settings: PropertiesStreamingSettings;
|
|
1250
|
+
/**
|
|
1251
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1252
|
+
*/
|
|
1088
1253
|
webIfc: WEBIFC.IfcAPI;
|
|
1254
|
+
/** {@link Disposable.dispose} */
|
|
1089
1255
|
dispose(): Promise<void>;
|
|
1256
|
+
/**
|
|
1257
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1258
|
+
*
|
|
1259
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1260
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1261
|
+
*/
|
|
1090
1262
|
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1263
|
+
/**
|
|
1264
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1265
|
+
*
|
|
1266
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1267
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1268
|
+
*/
|
|
1091
1269
|
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1092
1270
|
private readIfcFile;
|
|
1093
1271
|
private streamIfcFile;
|
|
1094
1272
|
private streamAllProperties;
|
|
1095
1273
|
private cleanUp;
|
|
1096
1274
|
}
|
|
1097
|
-
import * as THREE from "three";
|
|
1098
|
-
import { Component, Components } from "../../core";
|
|
1099
|
-
export interface MeasureEdge {
|
|
1100
|
-
distance: number;
|
|
1101
|
-
points: THREE.Vector3[];
|
|
1102
|
-
}
|
|
1103
|
-
export declare class MeasurementUtils extends Component {
|
|
1104
|
-
enabled: boolean;
|
|
1105
|
-
static uuid: string;
|
|
1106
|
-
constructor(components: Components);
|
|
1107
|
-
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1108
|
-
edges: MeasureEdge[];
|
|
1109
|
-
indices: Set<number>;
|
|
1110
|
-
} | null;
|
|
1111
|
-
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1112
|
-
private getFaceData;
|
|
1113
|
-
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1114
|
-
p1: THREE.Vector3;
|
|
1115
|
-
p2: THREE.Vector3;
|
|
1116
|
-
p3: THREE.Vector3;
|
|
1117
|
-
faceNormal: THREE.Vector3;
|
|
1118
|
-
};
|
|
1119
|
-
private round;
|
|
1120
|
-
}
|
|
1121
1275
|
import * as WEBIFC from "web-ifc";
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1125
|
-
export declare class IfcCategories {
|
|
1126
|
-
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
1127
|
-
}
|
|
1128
|
-
export declare const IfcElements: {
|
|
1129
|
-
[key: number]: string;
|
|
1130
|
-
};
|
|
1131
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1132
|
-
export declare class IfcPropertiesUtils {
|
|
1133
|
-
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
1134
|
-
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
1135
|
-
[attribute: string]: any;
|
|
1136
|
-
} | null>;
|
|
1137
|
-
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
1138
|
-
[relatingID: number]: number[];
|
|
1139
|
-
}>;
|
|
1140
|
-
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
1141
|
-
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
1142
|
-
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
1143
|
-
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
1144
|
-
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
1145
|
-
key: string | null;
|
|
1146
|
-
name: string | null;
|
|
1147
|
-
}>;
|
|
1148
|
-
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
1149
|
-
key: string | null;
|
|
1150
|
-
value: number | null;
|
|
1151
|
-
}>;
|
|
1152
|
-
static isRel(expressID: number): boolean;
|
|
1153
|
-
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
1154
|
-
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
1155
|
-
}
|
|
1156
|
-
export declare const IfcCategoryMap: {
|
|
1157
|
-
[key: number]: string;
|
|
1158
|
-
};
|
|
1159
|
-
import * as THREE from "three";
|
|
1160
|
-
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
1276
|
+
import { Components, Disposable, Event, Component } from "../../core";
|
|
1277
|
+
import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
|
|
1161
1278
|
/**
|
|
1162
|
-
* A
|
|
1279
|
+
* A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
|
|
1163
1280
|
*/
|
|
1164
|
-
export declare class
|
|
1165
|
-
/** {@link Disposable.onDisposed} */
|
|
1166
|
-
readonly onDisposed: Event<unknown>;
|
|
1167
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
1168
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
1169
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
1170
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
1171
|
-
/** {@link Resizeable.onResize} */
|
|
1172
|
-
readonly onResize: Event<THREE.Vector2>;
|
|
1281
|
+
export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
1173
1282
|
/**
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
* By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
1283
|
+
* A unique identifier for the component.
|
|
1284
|
+
* This UUID is used to register the component within the Components system.
|
|
1177
1285
|
*/
|
|
1178
|
-
|
|
1286
|
+
static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
|
|
1179
1287
|
/**
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1288
|
+
* Event triggered when geometry is streamed.
|
|
1289
|
+
* Contains the streamed geometry data and its buffer.
|
|
1182
1290
|
*/
|
|
1183
|
-
|
|
1291
|
+
readonly onGeometryStreamed: Event<{
|
|
1292
|
+
buffer: Uint8Array;
|
|
1293
|
+
data: StreamedGeometries;
|
|
1294
|
+
}>;
|
|
1184
1295
|
/**
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1296
|
+
* Event triggered when assets are streamed.
|
|
1297
|
+
* Contains the streamed assets.
|
|
1187
1298
|
*/
|
|
1188
|
-
|
|
1299
|
+
readonly onAssetStreamed: Event<StreamedAsset[]>;
|
|
1189
1300
|
/**
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1301
|
+
* Event triggered to indicate the progress of the streaming process.
|
|
1302
|
+
* Contains the progress percentage.
|
|
1192
1303
|
*/
|
|
1193
|
-
|
|
1304
|
+
readonly onProgress: Event<number>;
|
|
1194
1305
|
/**
|
|
1195
|
-
*
|
|
1196
|
-
*
|
|
1306
|
+
* Event triggered when the IFC file is loaded.
|
|
1307
|
+
* Contains the loaded IFC file data.
|
|
1197
1308
|
*/
|
|
1198
|
-
|
|
1309
|
+
readonly onIfcLoaded: Event<Uint8Array>;
|
|
1310
|
+
/** {@link Disposable.onDisposed} */
|
|
1311
|
+
readonly onDisposed: Event<unknown>;
|
|
1199
1312
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
* It provides access to the 3D scene, camera, and other relevant world elements.
|
|
1313
|
+
* Settings for the IfcGeometryTiler.
|
|
1202
1314
|
*/
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
private _plane;
|
|
1207
|
-
private _size;
|
|
1208
|
-
private _tempVector1;
|
|
1209
|
-
private _tempVector2;
|
|
1210
|
-
private _tempTarget;
|
|
1211
|
-
private readonly down;
|
|
1212
|
-
/**
|
|
1213
|
-
* Gets or sets whether the minimap rotation is locked.
|
|
1214
|
-
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
1215
|
-
*/
|
|
1216
|
-
get lockRotation(): boolean;
|
|
1217
|
-
/**
|
|
1218
|
-
* Sets whether the minimap rotation is locked.
|
|
1219
|
-
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
1220
|
-
* @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
|
|
1221
|
-
*/
|
|
1222
|
-
set lockRotation(active: boolean);
|
|
1223
|
-
/**
|
|
1224
|
-
* Gets the current zoom level of the minimap.
|
|
1225
|
-
* The zoom level determines how much of the world is visible on the minimap.
|
|
1226
|
-
* @returns The current zoom level of the minimap.
|
|
1227
|
-
*/
|
|
1228
|
-
get zoom(): number;
|
|
1315
|
+
settings: IfcStreamingSettings;
|
|
1316
|
+
/** {@link Component.enabled} */
|
|
1317
|
+
enabled: boolean;
|
|
1229
1318
|
/**
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1319
|
+
* The WebIFC API instance used for IFC file processing.
|
|
1320
|
+
*/
|
|
1321
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1322
|
+
private _spatialTree;
|
|
1323
|
+
private _metaData;
|
|
1324
|
+
private _visitedGeometries;
|
|
1325
|
+
private _streamSerializer;
|
|
1326
|
+
private _geometries;
|
|
1327
|
+
private _geometryCount;
|
|
1328
|
+
private _civil;
|
|
1329
|
+
private _groupSerializer;
|
|
1330
|
+
private _assets;
|
|
1331
|
+
private _meshesWithHoles;
|
|
1332
|
+
constructor(components: Components);
|
|
1236
1333
|
/** {@link Disposable.dispose} */
|
|
1237
1334
|
dispose(): void;
|
|
1238
|
-
/** Returns the camera used by the MiniMap */
|
|
1239
|
-
get(): THREE.OrthographicCamera;
|
|
1240
|
-
/** {@link Updateable.update} */
|
|
1241
|
-
update(): void;
|
|
1242
|
-
/** {@link Resizeable.getSize} */
|
|
1243
|
-
getSize(): THREE.Vector2;
|
|
1244
|
-
/** {@link Resizeable.resize} */
|
|
1245
|
-
resize(size?: THREE.Vector2): void;
|
|
1246
|
-
private updatePlanes;
|
|
1247
|
-
}
|
|
1248
|
-
export declare const GeometryTypes: Set<number>;
|
|
1249
|
-
import { InverseAttribute } from "./types";
|
|
1250
|
-
export declare const relToAttributesMap: Map<number, {
|
|
1251
|
-
forRelating: InverseAttribute;
|
|
1252
|
-
forRelated: InverseAttribute;
|
|
1253
|
-
}>;
|
|
1254
|
-
/**
|
|
1255
|
-
* 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.
|
|
1256
|
-
*/
|
|
1257
|
-
export declare class Event<T> {
|
|
1258
1335
|
/**
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1336
|
+
* This method streams the IFC file from a given buffer.
|
|
1337
|
+
*
|
|
1338
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1339
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1340
|
+
*
|
|
1341
|
+
* @remarks
|
|
1342
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1343
|
+
*
|
|
1344
|
+
* @example
|
|
1345
|
+
* '''typescript
|
|
1346
|
+
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1347
|
+
* const rawBuffer = await response.arrayBuffer();
|
|
1348
|
+
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1349
|
+
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1350
|
+
* '''
|
|
1261
1351
|
*/
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1352
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1353
|
+
/**
|
|
1354
|
+
* This method streams the IFC file from a given callback.
|
|
1355
|
+
*
|
|
1356
|
+
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
1357
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1358
|
+
*
|
|
1359
|
+
* @remarks
|
|
1360
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1361
|
+
*
|
|
1362
|
+
*/
|
|
1363
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1364
|
+
private readIfcFile;
|
|
1365
|
+
private streamIfcFile;
|
|
1366
|
+
private streamAllGeometries;
|
|
1367
|
+
private cleanUp;
|
|
1368
|
+
private getMesh;
|
|
1369
|
+
private getGeometry;
|
|
1370
|
+
private streamAssets;
|
|
1371
|
+
private streamGeometries;
|
|
1372
|
+
}
|
|
1373
|
+
import * as THREE from "three";
|
|
1374
|
+
import { Components } from "../Components";
|
|
1375
|
+
import { Component } from "../Types";
|
|
1376
|
+
/**
|
|
1377
|
+
* 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).
|
|
1378
|
+
*/
|
|
1379
|
+
export declare class Disposer extends Component {
|
|
1380
|
+
private _disposedComponents;
|
|
1381
|
+
/** {@link Component.enabled} */
|
|
1382
|
+
enabled: boolean;
|
|
1383
|
+
/**
|
|
1384
|
+
* A unique identifier for the component.
|
|
1385
|
+
* This UUID is used to register the component within the Components system.
|
|
1386
|
+
*/
|
|
1387
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
1388
|
+
constructor(components: Components);
|
|
1389
|
+
/**
|
|
1390
|
+
* Return the UUIDs of all disposed components.
|
|
1391
|
+
*/
|
|
1392
|
+
get(): Set<string>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
1395
|
+
* using any of these in other parts of the application, make sure that you
|
|
1396
|
+
* remove them from the mesh before disposing it.
|
|
1397
|
+
*
|
|
1398
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
1399
|
+
* to remove.
|
|
1400
|
+
*
|
|
1401
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
1402
|
+
*
|
|
1403
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
1404
|
+
*/
|
|
1405
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Disposes a geometry from memory.
|
|
1408
|
+
*
|
|
1409
|
+
* @param geometry - the
|
|
1410
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
1411
|
+
* to remove.
|
|
1412
|
+
*/
|
|
1413
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
1414
|
+
private disposeGeometryAndMaterials;
|
|
1415
|
+
private disposeChildren;
|
|
1416
|
+
private static disposeMaterial;
|
|
1417
|
+
}
|
|
1418
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
1419
|
+
import { SimpleRaycaster } from "./src";
|
|
1420
|
+
import { Components } from "../Components";
|
|
1421
|
+
/**
|
|
1422
|
+
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
1423
|
+
*/
|
|
1424
|
+
export declare class Raycasters extends Component implements Disposable {
|
|
1425
|
+
/**
|
|
1426
|
+
* A unique identifier for the component.
|
|
1427
|
+
* This UUID is used to register the component within the Components system.
|
|
1428
|
+
*/
|
|
1429
|
+
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
1430
|
+
/** {@link Component.enabled} */
|
|
1431
|
+
enabled: boolean;
|
|
1432
|
+
/**
|
|
1433
|
+
* A Map that stores raycasters for each world.
|
|
1434
|
+
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
1435
|
+
*/
|
|
1436
|
+
list: Map<string, SimpleRaycaster>;
|
|
1437
|
+
/** {@link Disposable.onDisposed} */
|
|
1438
|
+
onDisposed: Event<unknown>;
|
|
1439
|
+
constructor(components: Components);
|
|
1440
|
+
/**
|
|
1441
|
+
* Retrieves a SimpleRaycaster instance for the given world.
|
|
1442
|
+
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
1443
|
+
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
1444
|
+
*
|
|
1445
|
+
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
1446
|
+
* @returns The SimpleRaycaster instance for the given world.
|
|
1447
|
+
*/
|
|
1448
|
+
get(world: World): SimpleRaycaster;
|
|
1449
|
+
/**
|
|
1450
|
+
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
1451
|
+
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
1452
|
+
*
|
|
1453
|
+
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
1454
|
+
* @returns {void}
|
|
1455
|
+
*/
|
|
1456
|
+
delete(world: World): void;
|
|
1457
|
+
/** {@link Disposable.dispose} */
|
|
1458
|
+
dispose(): void;
|
|
1459
|
+
}
|
|
1460
|
+
import { Component, Disposable, Event } from "../Types";
|
|
1461
|
+
/**
|
|
1462
|
+
* The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
|
|
1463
|
+
*/
|
|
1464
|
+
export declare class Components implements Disposable {
|
|
1465
|
+
/**
|
|
1466
|
+
* The version of the @thatopen/components library.
|
|
1467
|
+
*/
|
|
1468
|
+
static readonly release = "2.0.12";
|
|
1469
|
+
/** {@link Disposable.onDisposed} */
|
|
1470
|
+
readonly onDisposed: Event<void>;
|
|
1471
|
+
/**
|
|
1472
|
+
* The list of components created in this app.
|
|
1473
|
+
* The keys are UUIDs and the values are instances of the components.
|
|
1474
|
+
*/
|
|
1475
|
+
readonly list: Map<string, Component>;
|
|
1476
|
+
/**
|
|
1477
|
+
* If disabled, the animation loop will be stopped.
|
|
1478
|
+
* Default value is false.
|
|
1479
|
+
*/
|
|
1480
|
+
enabled: boolean;
|
|
1481
|
+
private _clock;
|
|
1482
|
+
/**
|
|
1483
|
+
* Adds a component to the list of components.
|
|
1484
|
+
* Throws an error if a component with the same UUID already exists.
|
|
1485
|
+
*
|
|
1486
|
+
* @param uuid - The unique identifier of the component.
|
|
1487
|
+
* @param instance - The instance of the component to be added.
|
|
1488
|
+
*
|
|
1489
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
1490
|
+
*
|
|
1491
|
+
* @internal
|
|
1492
|
+
*/
|
|
1493
|
+
add(uuid: string, instance: Component): void;
|
|
1494
|
+
/**
|
|
1495
|
+
* Retrieves a component instance by its constructor function.
|
|
1496
|
+
* If the component does not exist in the list, it will be created and added.
|
|
1497
|
+
*
|
|
1498
|
+
* @template U - The type of the component to retrieve.
|
|
1499
|
+
* @param Component - The constructor function of the component to retrieve.
|
|
1500
|
+
*
|
|
1501
|
+
* @returns The instance of the requested component.
|
|
1502
|
+
*
|
|
1503
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
1504
|
+
*
|
|
1505
|
+
* @internal
|
|
1506
|
+
*/
|
|
1507
|
+
get<U extends Component>(Component: new (components: Components) => U): U;
|
|
1508
|
+
constructor();
|
|
1509
|
+
/**
|
|
1510
|
+
* Initializes the Components instance.
|
|
1511
|
+
* This method starts the animation loop, sets the enabled flag to true,
|
|
1512
|
+
* and calls the update method.
|
|
1513
|
+
*
|
|
1514
|
+
* @returns {void}
|
|
1515
|
+
*/
|
|
1516
|
+
init(): void;
|
|
1517
|
+
/**
|
|
1518
|
+
* Disposes the memory of all the components and tools of this instance of
|
|
1519
|
+
* the library. A memory leak will be created if:
|
|
1520
|
+
*
|
|
1521
|
+
* - An instance of the library ends up out of scope and this function isn't
|
|
1522
|
+
* called. This is especially relevant in Single Page Applications (React,
|
|
1523
|
+
* Angular, Vue, etc).
|
|
1524
|
+
*
|
|
1525
|
+
* - Any of the objects of this instance (meshes, geometries,materials, etc) is
|
|
1526
|
+
* referenced by a reference type (object or array).
|
|
1527
|
+
*
|
|
1528
|
+
* You can learn more about how Three.js handles memory leaks
|
|
1529
|
+
* [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
1530
|
+
*
|
|
1531
|
+
*/
|
|
1532
|
+
dispose(): void;
|
|
1533
|
+
private update;
|
|
1534
|
+
private static setupBVH;
|
|
1535
|
+
}
|
|
1536
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
1537
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
1538
|
+
import { Components } from "../Components";
|
|
1539
|
+
/**
|
|
1540
|
+
* A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
|
|
1541
|
+
*/
|
|
1542
|
+
export declare class Grids extends Component implements Disposable {
|
|
1543
|
+
/**
|
|
1544
|
+
* A unique identifier for the component.
|
|
1545
|
+
* This UUID is used to register the component within the Components system.
|
|
1546
|
+
*/
|
|
1547
|
+
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
1548
|
+
/**
|
|
1549
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
1550
|
+
*/
|
|
1551
|
+
list: Map<string, SimpleGrid>;
|
|
1552
|
+
/**
|
|
1553
|
+
* The default configuration for grid creation.
|
|
1554
|
+
*/
|
|
1555
|
+
config: Required<GridConfig>;
|
|
1556
|
+
/** {@link Disposable.onDisposed} */
|
|
1557
|
+
readonly onDisposed: Event<unknown>;
|
|
1558
|
+
/** {@link Component.enabled} */
|
|
1559
|
+
enabled: boolean;
|
|
1560
|
+
constructor(components: Components);
|
|
1561
|
+
/**
|
|
1562
|
+
* Creates a new grid for the given world.
|
|
1563
|
+
* Throws an error if a grid already exists for the world.
|
|
1564
|
+
*
|
|
1565
|
+
* @param world - The world to create the grid for.
|
|
1566
|
+
* @returns The newly created grid.
|
|
1567
|
+
*
|
|
1568
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
1569
|
+
*/
|
|
1570
|
+
create(world: World): SimpleGrid;
|
|
1571
|
+
/**
|
|
1572
|
+
* Deletes the grid associated with the given world.
|
|
1573
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
1574
|
+
*
|
|
1575
|
+
* @param world - The world for which to delete the grid.
|
|
1576
|
+
*
|
|
1577
|
+
* @remarks
|
|
1578
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
1579
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
1580
|
+
*/
|
|
1581
|
+
delete(world: World): void;
|
|
1582
|
+
/** {@link Disposable.dispose} */
|
|
1583
|
+
dispose(): void;
|
|
1584
|
+
}
|
|
1585
|
+
import * as THREE from "three";
|
|
1586
|
+
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
1587
|
+
import { SimplePlane } from "./src";
|
|
1588
|
+
import { Components } from "../Components";
|
|
1589
|
+
/**
|
|
1590
|
+
* A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
|
|
1591
|
+
*
|
|
1592
|
+
* @param components - the instance of {@link Components} used.
|
|
1593
|
+
* E.g. {@link SimplePlane}.
|
|
1594
|
+
*/
|
|
1595
|
+
export declare class Clipper extends Component implements Createable, Disposable, Hideable {
|
|
1596
|
+
/**
|
|
1597
|
+
* A unique identifier for the component.
|
|
1598
|
+
* This UUID is used to register the component within the Components system.
|
|
1599
|
+
*/
|
|
1600
|
+
static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
|
|
1601
|
+
/** Event that fires when the user starts dragging a clipping plane. */
|
|
1602
|
+
readonly onBeforeDrag: Event<void>;
|
|
1603
|
+
/** Event that fires when the user stops dragging a clipping plane. */
|
|
1604
|
+
readonly onAfterDrag: Event<void>;
|
|
1605
|
+
/**
|
|
1606
|
+
* Event that fires when the user starts creating a clipping plane.
|
|
1607
|
+
*/
|
|
1608
|
+
readonly onBeforeCreate: Event<unknown>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Event that fires when the user cancels the creation of a clipping plane.
|
|
1611
|
+
*/
|
|
1612
|
+
readonly onBeforeCancel: Event<unknown>;
|
|
1613
|
+
/**
|
|
1614
|
+
* Event that fires after the user cancels the creation of a clipping plane.
|
|
1615
|
+
*/
|
|
1616
|
+
readonly onAfterCancel: Event<unknown>;
|
|
1617
|
+
/**
|
|
1618
|
+
* Event that fires when the user starts deleting a clipping plane.
|
|
1619
|
+
*/
|
|
1620
|
+
readonly onBeforeDelete: Event<unknown>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Event that fires after a clipping plane has been created.
|
|
1623
|
+
* @param plane - The newly created clipping plane.
|
|
1624
|
+
*/
|
|
1625
|
+
readonly onAfterCreate: Event<SimplePlane>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Event that fires after a clipping plane has been deleted.
|
|
1628
|
+
* @param plane - The deleted clipping plane.
|
|
1629
|
+
*/
|
|
1630
|
+
readonly onAfterDelete: Event<SimplePlane>;
|
|
1631
|
+
/** {@link Disposable.onDisposed} */
|
|
1632
|
+
readonly onDisposed: Event<string>;
|
|
1633
|
+
/**
|
|
1634
|
+
* Whether to force the clipping plane to be orthogonal in the Y direction
|
|
1635
|
+
* (up). This is desirable when clipping a building horizontally and a
|
|
1636
|
+
* clipping plane is created in its roof, which might have a slight
|
|
1637
|
+
* slope for draining purposes.
|
|
1638
|
+
*/
|
|
1639
|
+
orthogonalY: boolean;
|
|
1640
|
+
/**
|
|
1641
|
+
* The tolerance that determines whether an almost-horizontal clipping plane
|
|
1642
|
+
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
1643
|
+
* has to be 'true' for this to apply.
|
|
1644
|
+
*/
|
|
1645
|
+
toleranceOrthogonalY: number;
|
|
1646
|
+
/**
|
|
1647
|
+
* The type of clipping plane to be created.
|
|
1648
|
+
* Default is {@link SimplePlane}.
|
|
1649
|
+
*/
|
|
1650
|
+
Type: new (...args: any) => SimplePlane;
|
|
1651
|
+
/**
|
|
1652
|
+
* A list of all the clipping planes created by this component.
|
|
1653
|
+
*/
|
|
1654
|
+
list: SimplePlane[];
|
|
1655
|
+
/** The material used in all the clipping planes. */
|
|
1656
|
+
private _material;
|
|
1657
|
+
private _size;
|
|
1658
|
+
private _enabled;
|
|
1659
|
+
private _visible;
|
|
1660
|
+
/** {@link Component.enabled} */
|
|
1661
|
+
get enabled(): boolean;
|
|
1662
|
+
/** {@link Component.enabled} */
|
|
1663
|
+
set enabled(state: boolean);
|
|
1664
|
+
/** {@link Hideable.visible } */
|
|
1665
|
+
get visible(): boolean;
|
|
1666
|
+
/** {@link Hideable.visible } */
|
|
1667
|
+
set visible(state: boolean);
|
|
1668
|
+
/** The material of the clipping plane representation. */
|
|
1669
|
+
get material(): THREE.MeshBasicMaterial;
|
|
1670
|
+
/** The material of the clipping plane representation. */
|
|
1671
|
+
set material(material: THREE.MeshBasicMaterial);
|
|
1672
|
+
/** The size of the geometric representation of the clippings planes. */
|
|
1673
|
+
get size(): number;
|
|
1674
|
+
/** The size of the geometric representation of the clippings planes. */
|
|
1675
|
+
set size(size: number);
|
|
1676
|
+
constructor(components: Components);
|
|
1677
|
+
/** {@link Disposable.dispose} */
|
|
1678
|
+
dispose(): void;
|
|
1679
|
+
/** {@link Createable.create} */
|
|
1680
|
+
create(world: World): void;
|
|
1681
|
+
/**
|
|
1682
|
+
* Creates a plane in a certain place and with a certain orientation,
|
|
1683
|
+
* without the need of the mouse.
|
|
1684
|
+
*
|
|
1685
|
+
* @param world - the world where this plane should be created.
|
|
1686
|
+
* @param normal - the orientation of the clipping plane.
|
|
1687
|
+
* @param point - the position of the clipping plane.
|
|
1688
|
+
* navigation.
|
|
1689
|
+
*/
|
|
1690
|
+
createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
|
|
1691
|
+
/**
|
|
1692
|
+
* {@link Createable.delete}
|
|
1693
|
+
*
|
|
1694
|
+
* @param world - the world where the plane to delete is.
|
|
1695
|
+
* @param plane - the plane to delete. If undefined, the first plane
|
|
1696
|
+
* found under the cursor will be deleted.
|
|
1697
|
+
*/
|
|
1698
|
+
delete(world: World, plane?: SimplePlane): void;
|
|
1699
|
+
/** Deletes all the existing clipping planes. */
|
|
1700
|
+
deleteAll(): void;
|
|
1701
|
+
private deletePlane;
|
|
1702
|
+
private pickPlane;
|
|
1703
|
+
private getAllPlaneMeshes;
|
|
1704
|
+
private createPlaneFromIntersection;
|
|
1705
|
+
private getWorldNormal;
|
|
1706
|
+
private normalizePlaneDirectionY;
|
|
1707
|
+
private newPlane;
|
|
1708
|
+
private updateMaterialsAndPlanes;
|
|
1709
|
+
private _onStartDragging;
|
|
1710
|
+
private _onEndDragging;
|
|
1711
|
+
}
|
|
1712
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
1713
|
+
import { Components } from "../Components";
|
|
1714
|
+
import { SimpleWorld } from "./src";
|
|
1715
|
+
/**
|
|
1716
|
+
* A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
|
|
1717
|
+
*/
|
|
1718
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
1719
|
+
/**
|
|
1720
|
+
* A unique identifier for the component.
|
|
1721
|
+
* This UUID is used to register the component within the Components system.
|
|
1722
|
+
*/
|
|
1723
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
1724
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
1725
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
1726
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
1727
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
1728
|
+
/** {@link Disposable.onDisposed} */
|
|
1729
|
+
readonly onDisposed: Event<unknown>;
|
|
1730
|
+
/**
|
|
1731
|
+
* An event that is triggered when a new world is created.
|
|
1732
|
+
* The event passes the newly created world as a parameter.
|
|
1733
|
+
*/
|
|
1734
|
+
readonly onWorldCreated: Event<World>;
|
|
1735
|
+
/**
|
|
1736
|
+
* An event that is triggered when a world is deleted.
|
|
1737
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
1738
|
+
*/
|
|
1739
|
+
readonly onWorldDeleted: Event<string>;
|
|
1740
|
+
/**
|
|
1741
|
+
* A collection of worlds managed by this component.
|
|
1742
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
1743
|
+
*/
|
|
1744
|
+
list: Map<string, World>;
|
|
1745
|
+
/** {@link Component.enabled} */
|
|
1746
|
+
enabled: boolean;
|
|
1747
|
+
constructor(components: Components);
|
|
1748
|
+
/**
|
|
1749
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
1750
|
+
*
|
|
1751
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
1752
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
1753
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
1754
|
+
*
|
|
1755
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
1756
|
+
*/
|
|
1757
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
1758
|
+
/**
|
|
1759
|
+
* Deletes a world from the list of worlds.
|
|
1760
|
+
*
|
|
1761
|
+
* @param {World} world - The world to be deleted.
|
|
1762
|
+
*
|
|
1763
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
1764
|
+
*
|
|
1765
|
+
* @returns {void}
|
|
1766
|
+
*/
|
|
1767
|
+
delete(world: World): void;
|
|
1768
|
+
/**
|
|
1769
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
1770
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
1771
|
+
* and triggers the onDisposed event.
|
|
1772
|
+
*
|
|
1773
|
+
* @returns {void}
|
|
1774
|
+
*/
|
|
1775
|
+
dispose(): void;
|
|
1776
|
+
/** {@link Updateable.update} */
|
|
1777
|
+
update(delta?: number): void | Promise<void>;
|
|
1778
|
+
}
|
|
1779
|
+
import * as THREE from "three";
|
|
1780
|
+
import { Components } from "../Components";
|
|
1781
|
+
import { SimpleCamera } from "..";
|
|
1782
|
+
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
1783
|
+
/**
|
|
1784
|
+
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
1785
|
+
*/
|
|
1786
|
+
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
1787
|
+
/**
|
|
1788
|
+
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
1789
|
+
*/
|
|
1790
|
+
readonly projection: ProjectionManager;
|
|
1791
|
+
/**
|
|
1792
|
+
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
1793
|
+
* This camera is used when the projection mode is set to orthographic.
|
|
1794
|
+
*/
|
|
1795
|
+
readonly threeOrtho: THREE.OrthographicCamera;
|
|
1796
|
+
/**
|
|
1797
|
+
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
1798
|
+
* This camera is used when the projection mode is set to perspective.
|
|
1799
|
+
*/
|
|
1800
|
+
readonly threePersp: THREE.PerspectiveCamera;
|
|
1801
|
+
protected readonly _userInputButtons: any;
|
|
1802
|
+
protected readonly _frustumSize = 50;
|
|
1803
|
+
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
1804
|
+
protected _mode: NavigationMode | null;
|
|
1805
|
+
private previousSize;
|
|
1806
|
+
/**
|
|
1807
|
+
* Getter for the current navigation mode.
|
|
1808
|
+
* Throws an error if the mode is not found or the camera is not initialized.
|
|
1809
|
+
*
|
|
1810
|
+
* @returns {NavigationMode} The current navigation mode.
|
|
1811
|
+
*
|
|
1812
|
+
* @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
|
|
1813
|
+
*/
|
|
1814
|
+
get mode(): NavigationMode;
|
|
1815
|
+
constructor(components: Components);
|
|
1816
|
+
/** {@link Disposable.dispose} */
|
|
1817
|
+
dispose(): void;
|
|
1818
|
+
/**
|
|
1819
|
+
* Sets a new {@link NavigationMode} and disables the previous one.
|
|
1820
|
+
*
|
|
1821
|
+
* @param mode - The {@link NavigationMode} to set.
|
|
1822
|
+
*/
|
|
1823
|
+
set(mode: NavModeID): void;
|
|
1824
|
+
/**
|
|
1825
|
+
* Make the camera view fit all the specified meshes.
|
|
1826
|
+
*
|
|
1827
|
+
* @param meshes the meshes to fit. If it is not defined, it will
|
|
1828
|
+
* evaluate {@link Components.meshes}.
|
|
1829
|
+
* @param offset the distance to the fit object
|
|
1830
|
+
*/
|
|
1831
|
+
fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
|
|
1832
|
+
/**
|
|
1833
|
+
* Allows or prevents all user input.
|
|
1834
|
+
*
|
|
1835
|
+
* @param active - whether to enable or disable user inputs.
|
|
1836
|
+
*/
|
|
1837
|
+
setUserInput(active: boolean): void;
|
|
1838
|
+
private disableUserInput;
|
|
1839
|
+
private enableUserInput;
|
|
1840
|
+
private newOrthoCamera;
|
|
1841
|
+
private setOrthoPerspCameraAspect;
|
|
1842
|
+
}
|
|
1843
|
+
import { MiniMap } from "./src";
|
|
1844
|
+
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
1845
|
+
import { Components } from "../Components";
|
|
1846
|
+
/**
|
|
1847
|
+
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
1848
|
+
*/
|
|
1849
|
+
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
1850
|
+
/**
|
|
1851
|
+
* A unique identifier for the component.
|
|
1852
|
+
* This UUID is used to register the component within the Components system.
|
|
1853
|
+
*/
|
|
1854
|
+
static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
|
|
1855
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
1856
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
1857
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
1858
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
1859
|
+
/** {@link Disposable.onDisposed} */
|
|
1860
|
+
readonly onDisposed: Event<unknown>;
|
|
1861
|
+
/** {@link Component.enabled} */
|
|
1862
|
+
enabled: boolean;
|
|
1863
|
+
/**
|
|
1864
|
+
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
1865
|
+
*/
|
|
1866
|
+
list: Map<string, MiniMap>;
|
|
1867
|
+
constructor(components: Components);
|
|
1868
|
+
/**
|
|
1869
|
+
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
1870
|
+
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
1871
|
+
*
|
|
1872
|
+
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
1873
|
+
* @returns The newly created {@link MiniMap} instance.
|
|
1874
|
+
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
1875
|
+
*/
|
|
1876
|
+
create(world: World): MiniMap;
|
|
1877
|
+
/**
|
|
1878
|
+
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
1879
|
+
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
1880
|
+
*
|
|
1881
|
+
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
1882
|
+
* @returns {void}
|
|
1883
|
+
*/
|
|
1884
|
+
delete(id: string): void;
|
|
1885
|
+
/** {@link Disposable.dispose} */
|
|
1886
|
+
dispose(): void;
|
|
1887
|
+
/** {@link Updateable.update} */
|
|
1888
|
+
update(): void;
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
1892
|
+
*/
|
|
1893
|
+
export declare const GeometryTypes: Set<number>;
|
|
1894
|
+
import { Components } from "../Components";
|
|
1895
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
1896
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
1897
|
+
/**
|
|
1898
|
+
* A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
|
|
1899
|
+
*/
|
|
1900
|
+
export declare class Cullers extends Component implements Disposable {
|
|
1901
|
+
/**
|
|
1902
|
+
* A unique identifier for the component.
|
|
1903
|
+
* This UUID is used to register the component within the Components system.
|
|
1904
|
+
*/
|
|
1905
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
1906
|
+
/**
|
|
1907
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
1908
|
+
*/
|
|
1909
|
+
readonly onDisposed: Event<unknown>;
|
|
1910
|
+
private _enabled;
|
|
1911
|
+
/**
|
|
1912
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
1913
|
+
*/
|
|
1914
|
+
list: Map<string, MeshCullerRenderer>;
|
|
1915
|
+
/** {@link Component.enabled} */
|
|
1916
|
+
get enabled(): boolean;
|
|
1917
|
+
/** {@link Component.enabled} */
|
|
1918
|
+
set enabled(value: boolean);
|
|
1919
|
+
constructor(components: Components);
|
|
1920
|
+
/**
|
|
1921
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
1922
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
1923
|
+
*
|
|
1924
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
1925
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
1926
|
+
*
|
|
1927
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
1928
|
+
*/
|
|
1929
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
1267
1930
|
/**
|
|
1268
|
-
*
|
|
1269
|
-
*
|
|
1931
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
1932
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
1933
|
+
*
|
|
1934
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
1935
|
+
*
|
|
1936
|
+
* @returns {void}
|
|
1270
1937
|
*/
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1938
|
+
delete(world: World): void;
|
|
1939
|
+
/** {@link Disposable.dispose} */
|
|
1940
|
+
dispose(): void;
|
|
1941
|
+
}
|
|
1942
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1943
|
+
export declare class IfcPropertiesUtils {
|
|
1944
|
+
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
1945
|
+
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
1946
|
+
[attribute: string]: any;
|
|
1947
|
+
} | null>;
|
|
1948
|
+
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
1949
|
+
[relatingID: number]: number[];
|
|
1950
|
+
}>;
|
|
1951
|
+
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
1952
|
+
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
1953
|
+
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
1954
|
+
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
1955
|
+
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
1956
|
+
key: string | null;
|
|
1957
|
+
name: string | null;
|
|
1958
|
+
}>;
|
|
1959
|
+
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
1960
|
+
key: string | null;
|
|
1961
|
+
value: number | null;
|
|
1962
|
+
}>;
|
|
1963
|
+
static isRel(expressID: number): boolean;
|
|
1964
|
+
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
1965
|
+
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
1281
1966
|
}
|
|
1282
|
-
import { Base } from "./base";
|
|
1283
1967
|
/**
|
|
1284
|
-
*
|
|
1968
|
+
* 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.
|
|
1969
|
+
*
|
|
1970
|
+
* @remarks
|
|
1971
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
1972
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
1973
|
+
*
|
|
1285
1974
|
*/
|
|
1286
|
-
export declare
|
|
1975
|
+
export declare const IfcElements: {
|
|
1976
|
+
[key: number]: string;
|
|
1977
|
+
};
|
|
1978
|
+
/**
|
|
1979
|
+
* 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.
|
|
1980
|
+
*/
|
|
1981
|
+
export declare const IfcCategoryMap: {
|
|
1982
|
+
[key: number]: string;
|
|
1983
|
+
};
|
|
1984
|
+
import * as WEBIFC from "web-ifc";
|
|
1985
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
1986
|
+
export declare class SpatialStructure {
|
|
1987
|
+
itemsByFloor: IfcItemsCategories;
|
|
1988
|
+
private _units;
|
|
1989
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
1990
|
+
cleanUp(): void;
|
|
1991
|
+
}
|
|
1992
|
+
import * as WEBIFC from "web-ifc";
|
|
1993
|
+
export interface IfcItemsCategories {
|
|
1994
|
+
[itemID: number]: number;
|
|
1995
|
+
}
|
|
1996
|
+
export declare class IfcCategories {
|
|
1997
|
+
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
1998
|
+
}
|
|
1999
|
+
import * as WEBIFC from "web-ifc";
|
|
2000
|
+
/** Configuration of the IFC-fragment conversion. */
|
|
2001
|
+
export declare class IfcFragmentSettings {
|
|
2002
|
+
/** Whether to extract the IFC properties into a JSON. */
|
|
2003
|
+
includeProperties: boolean;
|
|
1287
2004
|
/**
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1290
|
-
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
1291
|
-
* will not be updated automatically each frame.
|
|
2005
|
+
* Generate the geometry for categories that are not included by default,
|
|
2006
|
+
* like IFCSPACE.
|
|
1292
2007
|
*/
|
|
1293
|
-
|
|
2008
|
+
optionalCategories: number[];
|
|
2009
|
+
/** Whether to use the coordination data coming from the IFC files. */
|
|
2010
|
+
coordinate: boolean;
|
|
2011
|
+
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2012
|
+
wasm: {
|
|
2013
|
+
path: string;
|
|
2014
|
+
absolute: boolean;
|
|
2015
|
+
logLevel?: WEBIFC.LogLevel;
|
|
2016
|
+
};
|
|
2017
|
+
/** List of categories that won't be converted to fragments. */
|
|
2018
|
+
excludedCategories: Set<number>;
|
|
2019
|
+
/** Whether to save the absolute location of all IFC items. */
|
|
2020
|
+
saveLocations: boolean;
|
|
2021
|
+
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2022
|
+
webIfc: WEBIFC.LoaderSettings;
|
|
2023
|
+
/**
|
|
2024
|
+
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2025
|
+
* If set to true, the path will be set to the default path of the WASM file.
|
|
2026
|
+
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2027
|
+
* Default value is true.
|
|
2028
|
+
*/
|
|
2029
|
+
autoSetWasm: boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2032
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2033
|
+
* If set to null, the default file location handler will be used.
|
|
2034
|
+
*
|
|
2035
|
+
* @param url - The URL of the file to locate.
|
|
2036
|
+
* @returns The absolute path of the file.
|
|
2037
|
+
*/
|
|
2038
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2039
|
+
}
|
|
2040
|
+
import { InverseAttribute } from "./types";
|
|
2041
|
+
export declare const relToAttributesMap: Map<number, {
|
|
2042
|
+
forRelating: InverseAttribute;
|
|
2043
|
+
forRelated: InverseAttribute;
|
|
2044
|
+
}>;
|
|
2045
|
+
import * as WEBIFC from "web-ifc";
|
|
2046
|
+
export declare class IfcMetadataReader {
|
|
2047
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
2048
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
1294
2049
|
}
|
|
1295
2050
|
import * as THREE from "three";
|
|
1296
|
-
import
|
|
1297
|
-
import
|
|
2051
|
+
import * as WEBIFC from "web-ifc";
|
|
2052
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2053
|
+
export declare class CivilReader {
|
|
2054
|
+
defLineMat: THREE.LineBasicMaterial;
|
|
2055
|
+
read(webIfc: WEBIFC.IfcAPI): {
|
|
2056
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
2057
|
+
coordinationMatrix: THREE.Matrix4;
|
|
2058
|
+
} | undefined;
|
|
2059
|
+
get(civilItems: any): {
|
|
2060
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
2061
|
+
coordinationMatrix: THREE.Matrix4;
|
|
2062
|
+
} | undefined;
|
|
2063
|
+
private getCurves;
|
|
2064
|
+
}
|
|
2065
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
1298
2066
|
/**
|
|
1299
|
-
*
|
|
2067
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
1300
2068
|
*/
|
|
1301
|
-
export
|
|
2069
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
1302
2070
|
/**
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
2071
|
+
* Minimum number of geometries to be streamed.
|
|
2072
|
+
* Defaults to 10 geometries.
|
|
1305
2073
|
*/
|
|
1306
|
-
|
|
1307
|
-
/**
|
|
1308
|
-
|
|
2074
|
+
minGeometrySize: number;
|
|
2075
|
+
/**
|
|
2076
|
+
* Minimum amount of assets to be streamed.
|
|
2077
|
+
* Defaults to 1000 assets.
|
|
2078
|
+
*/
|
|
2079
|
+
minAssetsSize: number;
|
|
1309
2080
|
}
|
|
2081
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
1310
2082
|
/**
|
|
1311
|
-
*
|
|
2083
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
1312
2084
|
*/
|
|
1313
|
-
export
|
|
2085
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
1314
2086
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2087
|
+
* Amount of properties to be streamed.
|
|
2088
|
+
* Defaults to 100 properties.
|
|
1318
2089
|
*/
|
|
1319
|
-
|
|
2090
|
+
propertiesSize: number;
|
|
1320
2091
|
}
|
|
2092
|
+
import * as THREE from "three";
|
|
2093
|
+
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
1321
2094
|
/**
|
|
1322
|
-
*
|
|
2095
|
+
* A class representing a 2D minimap of a 3D world.
|
|
1323
2096
|
*/
|
|
1324
|
-
export
|
|
2097
|
+
export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
2098
|
+
/** {@link Disposable.onDisposed} */
|
|
2099
|
+
readonly onDisposed: Event<unknown>;
|
|
2100
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2101
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2102
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2103
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2104
|
+
/** {@link Resizeable.onResize} */
|
|
2105
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
1325
2106
|
/**
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
2107
|
+
* The front offset of the minimap.
|
|
2108
|
+
* It determines how much the minimap's view is offset from the camera's view.
|
|
2109
|
+
* By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
1329
2110
|
*/
|
|
1330
|
-
|
|
1331
|
-
/** Event that fires when the component has been resized. */
|
|
1332
|
-
onResize: Event<THREE.Vector2>;
|
|
2111
|
+
frontOffset: number;
|
|
1333
2112
|
/**
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
1336
|
-
* component.
|
|
2113
|
+
* The override material for the minimap.
|
|
2114
|
+
* It is used to render the depth information of the world onto the minimap.
|
|
1337
2115
|
*/
|
|
1338
|
-
|
|
1339
|
-
}
|
|
1340
|
-
/** Whether this component should be updated each frame. */
|
|
1341
|
-
export interface Updateable {
|
|
1342
|
-
/** Actions that should be executed after updating the component. */
|
|
1343
|
-
onAfterUpdate: Event<any>;
|
|
1344
|
-
/** Actions that should be executed before updating the component. */
|
|
1345
|
-
onBeforeUpdate: Event<any>;
|
|
2116
|
+
overrideMaterial: THREE.MeshDepthMaterial;
|
|
1346
2117
|
/**
|
|
1347
|
-
*
|
|
1348
|
-
*
|
|
2118
|
+
* The background color of the minimap.
|
|
2119
|
+
* It is used to set the background color of the minimap's renderer.
|
|
1349
2120
|
*/
|
|
1350
|
-
|
|
1351
|
-
}
|
|
1352
|
-
/** Basic type to describe the progress of any kind of process. */
|
|
1353
|
-
export interface Progress {
|
|
1354
|
-
/** The amount of things that have been done already. */
|
|
1355
|
-
current: number;
|
|
1356
|
-
/** The total amount of things to be done by the process. */
|
|
1357
|
-
total: number;
|
|
1358
|
-
}
|
|
1359
|
-
/**
|
|
1360
|
-
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
1361
|
-
*/
|
|
1362
|
-
export interface Createable {
|
|
1363
|
-
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
1364
|
-
create: (data: any) => void;
|
|
2121
|
+
backgroundColor: THREE.Color;
|
|
1365
2122
|
/**
|
|
1366
|
-
*
|
|
1367
|
-
*
|
|
2123
|
+
* The WebGL renderer for the minimap.
|
|
2124
|
+
* It is used to render the minimap onto the screen.
|
|
1368
2125
|
*/
|
|
1369
|
-
|
|
2126
|
+
renderer: THREE.WebGLRenderer;
|
|
2127
|
+
/**
|
|
2128
|
+
* A flag indicating whether the minimap is enabled.
|
|
2129
|
+
* If disabled, the minimap will not update or render.
|
|
2130
|
+
*/
|
|
2131
|
+
enabled: boolean;
|
|
2132
|
+
/**
|
|
2133
|
+
* The world in which the minimap is displayed.
|
|
2134
|
+
* It provides access to the 3D scene, camera, and other relevant world elements.
|
|
2135
|
+
*/
|
|
2136
|
+
world: World;
|
|
2137
|
+
private _lockRotation;
|
|
2138
|
+
private _camera;
|
|
2139
|
+
private _plane;
|
|
2140
|
+
private _size;
|
|
2141
|
+
private _tempVector1;
|
|
2142
|
+
private _tempVector2;
|
|
2143
|
+
private _tempTarget;
|
|
2144
|
+
private readonly down;
|
|
2145
|
+
/**
|
|
2146
|
+
* Gets or sets whether the minimap rotation is locked.
|
|
2147
|
+
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2148
|
+
*/
|
|
2149
|
+
get lockRotation(): boolean;
|
|
2150
|
+
/**
|
|
2151
|
+
* Sets whether the minimap rotation is locked.
|
|
2152
|
+
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2153
|
+
* @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
|
|
2154
|
+
*/
|
|
2155
|
+
set lockRotation(active: boolean);
|
|
2156
|
+
/**
|
|
2157
|
+
* Gets the current zoom level of the minimap.
|
|
2158
|
+
* The zoom level determines how much of the world is visible on the minimap.
|
|
2159
|
+
* @returns The current zoom level of the minimap.
|
|
2160
|
+
*/
|
|
2161
|
+
get zoom(): number;
|
|
1370
2162
|
/**
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
2163
|
+
* Sets the zoom level of the minimap.
|
|
2164
|
+
* The zoom level determines how much of the world is visible on the minimap.
|
|
2165
|
+
* @param value - The new zoom level of the minimap.
|
|
1373
2166
|
*/
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
2167
|
+
set zoom(value: number);
|
|
2168
|
+
constructor(world: World);
|
|
2169
|
+
/** {@link Disposable.dispose} */
|
|
2170
|
+
dispose(): void;
|
|
2171
|
+
/** Returns the camera used by the MiniMap */
|
|
2172
|
+
get(): THREE.OrthographicCamera;
|
|
2173
|
+
/** {@link Updateable.update} */
|
|
2174
|
+
update(): void;
|
|
2175
|
+
/** {@link Resizeable.getSize} */
|
|
2176
|
+
getSize(): THREE.Vector2;
|
|
2177
|
+
/** {@link Resizeable.resize} */
|
|
2178
|
+
resize(size?: THREE.Vector2): void;
|
|
2179
|
+
private updatePlanes;
|
|
1377
2180
|
}
|
|
1378
2181
|
/**
|
|
1379
|
-
*
|
|
2182
|
+
* A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
|
|
1380
2183
|
*/
|
|
1381
|
-
export interface
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
*/
|
|
1391
|
-
config: Required<T>;
|
|
2184
|
+
export interface StreamedGeometries {
|
|
2185
|
+
[id: number]: {
|
|
2186
|
+
/** The bounding box of the geometry as a Float32Array. */
|
|
2187
|
+
boundingBox: Float32Array;
|
|
2188
|
+
/** A boolean indicating whether the geometry has holes. */
|
|
2189
|
+
hasHoles: boolean;
|
|
2190
|
+
/** An optional file path for the geometry data. */
|
|
2191
|
+
geometryFile?: string;
|
|
2192
|
+
};
|
|
1392
2193
|
}
|
|
1393
2194
|
/**
|
|
1394
|
-
*
|
|
2195
|
+
* A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
|
|
1395
2196
|
*/
|
|
1396
|
-
export interface
|
|
1397
|
-
/**
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
2197
|
+
export interface StreamedAsset {
|
|
2198
|
+
/** The unique identifier of the asset. */
|
|
2199
|
+
id: number;
|
|
2200
|
+
/** An array of geometries associated with the asset. */
|
|
2201
|
+
geometries: {
|
|
2202
|
+
/** The unique identifier of the geometry. */
|
|
2203
|
+
geometryID: number;
|
|
2204
|
+
/** The transformation matrix of the geometry as a number array. */
|
|
2205
|
+
transformation: number[];
|
|
2206
|
+
/** The color of the geometry as a number array. */
|
|
2207
|
+
color: number[];
|
|
2208
|
+
}[];
|
|
1402
2209
|
}
|
|
1403
2210
|
import * as WEBIFC from "web-ifc";
|
|
1404
|
-
import
|
|
1405
|
-
export declare class
|
|
1406
|
-
|
|
1407
|
-
|
|
2211
|
+
import * as THREE from "three";
|
|
2212
|
+
export declare class Units {
|
|
2213
|
+
factor: number;
|
|
2214
|
+
complement: number;
|
|
2215
|
+
apply(matrix: THREE.Matrix4): void;
|
|
1408
2216
|
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
1412
|
-
import { Components } from "../../Components";
|
|
1413
|
-
/**
|
|
1414
|
-
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
1415
|
-
*/
|
|
1416
|
-
export declare abstract class Base {
|
|
1417
|
-
components: Components;
|
|
1418
|
-
constructor(components: Components);
|
|
1419
|
-
/** Whether is component is {@link Disposable}. */
|
|
1420
|
-
isDisposeable: () => this is Disposable;
|
|
1421
|
-
/** Whether is component is {@link Resizeable}. */
|
|
1422
|
-
isResizeable: () => this is Resizeable;
|
|
1423
|
-
/** Whether is component is {@link Updateable}. */
|
|
1424
|
-
isUpdateable: () => this is Updateable;
|
|
1425
|
-
/** Whether is component is {@link Hideable}. */
|
|
1426
|
-
isHideable: () => this is Hideable;
|
|
1427
|
-
/** Whether is component is {@link Configurable}. */
|
|
1428
|
-
isConfigurable: () => this is Configurable<any>;
|
|
2217
|
+
private getLengthUnits;
|
|
2218
|
+
private getScaleMatrix;
|
|
1429
2219
|
}
|
|
2220
|
+
import * as THREE from "three";
|
|
2221
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
1430
2222
|
/**
|
|
1431
|
-
*
|
|
2223
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
2224
|
+
*
|
|
2225
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
2226
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
2227
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
1432
2228
|
*/
|
|
1433
|
-
export declare class
|
|
2229
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
1434
2230
|
/**
|
|
1435
|
-
*
|
|
1436
|
-
* @param handler - the callback to be added to this event.
|
|
2231
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
1437
2232
|
*/
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
2233
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2234
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2235
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2236
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2237
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2238
|
+
/** {@link Disposable.onDisposed} */
|
|
2239
|
+
readonly onDisposed: Event<unknown>;
|
|
1443
2240
|
/**
|
|
1444
|
-
*
|
|
1445
|
-
* @param handler - the callback to be removed from this event.
|
|
2241
|
+
* Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
|
|
1446
2242
|
*/
|
|
1447
|
-
|
|
1448
|
-
(): Promise<void>;
|
|
1449
|
-
} : {
|
|
1450
|
-
(data: T): Promise<void>;
|
|
1451
|
-
}): void;
|
|
1452
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
1453
|
-
trigger: (data?: T) => Promise<void>;
|
|
1454
|
-
/** Gets rid of all the suscribed events. */
|
|
1455
|
-
reset(): void;
|
|
1456
|
-
private handlers;
|
|
1457
|
-
}
|
|
1458
|
-
import { Base } from "./base";
|
|
1459
|
-
import { World } from "./world";
|
|
1460
|
-
import { Event } from "./event";
|
|
1461
|
-
import { Components } from "../../Components";
|
|
1462
|
-
/**
|
|
1463
|
-
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
1464
|
-
*/
|
|
1465
|
-
export declare abstract class BaseWorldItem extends Base {
|
|
1466
|
-
readonly worlds: Map<string, World>;
|
|
2243
|
+
isDisposing: boolean;
|
|
1467
2244
|
/**
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
2245
|
+
* Indicates whether the world is currently enabled.
|
|
2246
|
+
* When disabled, the world will not be updated.
|
|
1470
2247
|
*/
|
|
1471
|
-
|
|
1472
|
-
world: World;
|
|
1473
|
-
action: "added" | "removed";
|
|
1474
|
-
}>;
|
|
2248
|
+
enabled: boolean;
|
|
1475
2249
|
/**
|
|
1476
|
-
*
|
|
2250
|
+
* A unique identifier for the world.
|
|
1477
2251
|
*/
|
|
1478
|
-
|
|
1479
|
-
protected constructor(components: Components);
|
|
1480
|
-
}
|
|
1481
|
-
import * as THREE from "three";
|
|
1482
|
-
import CameraControls from "camera-controls";
|
|
1483
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
1484
|
-
import { CameraControllable } from "./interfaces";
|
|
1485
|
-
/**
|
|
1486
|
-
* Abstract class representing a camera in the 3D world. All cameras should use this class as a base.
|
|
1487
|
-
*/
|
|
1488
|
-
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2252
|
+
uuid: string;
|
|
1489
2253
|
/**
|
|
1490
|
-
*
|
|
2254
|
+
* An optional name for the world.
|
|
1491
2255
|
*/
|
|
1492
|
-
|
|
2256
|
+
name?: string;
|
|
2257
|
+
private _scene?;
|
|
2258
|
+
private _camera?;
|
|
2259
|
+
private _renderer;
|
|
1493
2260
|
/**
|
|
1494
|
-
*
|
|
2261
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2262
|
+
* @returns The current scene.
|
|
1495
2263
|
*/
|
|
1496
|
-
|
|
2264
|
+
get scene(): T;
|
|
1497
2265
|
/**
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
2266
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2267
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2268
|
+
* @param scene - The new scene to be set.
|
|
1500
2269
|
*/
|
|
1501
|
-
|
|
2270
|
+
set scene(scene: T);
|
|
1502
2271
|
/**
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1505
|
-
* @returns True if the instance is controllable, false otherwise.
|
|
2272
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2273
|
+
* @returns The current camera.
|
|
1506
2274
|
*/
|
|
1507
|
-
|
|
1508
|
-
}
|
|
1509
|
-
import * as THREE from "three";
|
|
1510
|
-
import { Vector2 } from "three";
|
|
1511
|
-
import { Event } from "./event";
|
|
1512
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
1513
|
-
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
1514
|
-
/**
|
|
1515
|
-
* Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
|
|
1516
|
-
*/
|
|
1517
|
-
export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
|
|
2275
|
+
get camera(): U;
|
|
1518
2276
|
/**
|
|
1519
|
-
*
|
|
1520
|
-
*
|
|
1521
|
-
* @
|
|
1522
|
-
* @type {THREE.WebGLRenderer}
|
|
2277
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
2278
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
2279
|
+
* @param camera - The new camera to be set.
|
|
1523
2280
|
*/
|
|
1524
|
-
|
|
1525
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
1526
|
-
onAfterUpdate: Event<unknown>;
|
|
1527
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
1528
|
-
onBeforeUpdate: Event<unknown>;
|
|
1529
|
-
/** {@link Disposable.onDisposed} */
|
|
1530
|
-
readonly onDisposed: Event<undefined>;
|
|
1531
|
-
/** {@link Resizeable.onResize} */
|
|
1532
|
-
readonly onResize: Event<THREE.Vector2>;
|
|
2281
|
+
set camera(camera: U);
|
|
1533
2282
|
/**
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
2283
|
+
* Getter for the renderer.
|
|
2284
|
+
* @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
|
|
1536
2285
|
*/
|
|
1537
|
-
|
|
2286
|
+
get renderer(): S | null;
|
|
2287
|
+
/**
|
|
2288
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
2289
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
2290
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2291
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2292
|
+
*/
|
|
2293
|
+
set renderer(renderer: S | null);
|
|
1538
2294
|
/** {@link Updateable.update} */
|
|
1539
|
-
|
|
2295
|
+
update(delta?: number): void;
|
|
1540
2296
|
/** {@link Disposable.dispose} */
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
2297
|
+
dispose(disposeResources?: boolean): void;
|
|
2298
|
+
}
|
|
2299
|
+
import * as THREE from "three";
|
|
2300
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2301
|
+
import { Components } from "../../Components";
|
|
2302
|
+
/**
|
|
2303
|
+
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
2304
|
+
*/
|
|
2305
|
+
export interface SimpleSceneConfig {
|
|
2306
|
+
directionalLight: {
|
|
2307
|
+
color: THREE.Color;
|
|
2308
|
+
intensity: number;
|
|
2309
|
+
position: THREE.Vector3;
|
|
2310
|
+
};
|
|
2311
|
+
ambientLight: {
|
|
2312
|
+
color: THREE.Color;
|
|
2313
|
+
intensity: number;
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
/**
|
|
2317
|
+
* A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
|
|
2318
|
+
*/
|
|
2319
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
2320
|
+
/** {@link Configurable.isSetup} */
|
|
2321
|
+
isSetup: boolean;
|
|
2322
|
+
/**
|
|
2323
|
+
* The underlying Three.js scene object.
|
|
2324
|
+
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
2325
|
+
*/
|
|
2326
|
+
three: THREE.Scene;
|
|
2327
|
+
/** {@link Configurable.onSetup} */
|
|
2328
|
+
readonly onSetup: Event<SimpleScene>;
|
|
1546
2329
|
/**
|
|
1547
|
-
*
|
|
2330
|
+
* Configuration interface for the {@link SimpleScene}.
|
|
2331
|
+
* Defines properties for directional and ambient lights.
|
|
1548
2332
|
*/
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
* @remarks
|
|
1554
|
-
* This method is typically called when there is a change to the list of clipping planes
|
|
1555
|
-
* used by the active renderer.
|
|
1556
|
-
*/
|
|
1557
|
-
updateClippingPlanes(): void;
|
|
1558
|
-
/**
|
|
1559
|
-
* Sets or removes a clipping plane from the renderer.
|
|
1560
|
-
*
|
|
1561
|
-
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
1562
|
-
* @param plane - The clipping plane to be added or removed.
|
|
1563
|
-
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
1564
|
-
*
|
|
1565
|
-
* @remarks
|
|
1566
|
-
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
1567
|
-
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
1568
|
-
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
1569
|
-
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
1570
|
-
* excluding any planes marked as local.
|
|
1571
|
-
*/
|
|
1572
|
-
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2333
|
+
config: Required<SimpleSceneConfig>;
|
|
2334
|
+
constructor(components: Components);
|
|
2335
|
+
/** {@link Configurable.setup} */
|
|
2336
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
1573
2337
|
}
|
|
1574
2338
|
import * as THREE from "three";
|
|
1575
|
-
import
|
|
1576
|
-
import { Event } from "
|
|
2339
|
+
import CameraControls from "camera-controls";
|
|
2340
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
1577
2341
|
import { Components } from "../../Components";
|
|
1578
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
1579
2342
|
/**
|
|
1580
|
-
*
|
|
2343
|
+
* A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
|
|
1581
2344
|
*/
|
|
1582
|
-
export declare
|
|
2345
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
2346
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2347
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
2348
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2349
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2350
|
+
/**
|
|
2351
|
+
* Event that is triggered when the aspect of the camera has been updated.
|
|
2352
|
+
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2353
|
+
*/
|
|
2354
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
1583
2355
|
/** {@link Disposable.onDisposed} */
|
|
1584
|
-
readonly onDisposed: Event<
|
|
2356
|
+
readonly onDisposed: Event<string>;
|
|
1585
2357
|
/**
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
/** {@link Disposable.dispose} */
|
|
1592
|
-
dispose(): void;
|
|
1593
|
-
}
|
|
1594
|
-
import * as THREE from "three";
|
|
1595
|
-
import { BaseScene } from "./base-scene";
|
|
1596
|
-
import { BaseCamera } from "./base-camera";
|
|
1597
|
-
import { BaseRenderer } from "./base-renderer";
|
|
1598
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
1599
|
-
/**
|
|
1600
|
-
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
1601
|
-
*/
|
|
1602
|
-
export interface World extends Disposable, Updateable {
|
|
2358
|
+
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
2359
|
+
* This camera is used for rendering the scene.
|
|
2360
|
+
*/
|
|
2361
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
2362
|
+
private _allControls;
|
|
1603
2363
|
/**
|
|
1604
|
-
*
|
|
2364
|
+
* The object that controls the camera. An instance of
|
|
2365
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
2366
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
2367
|
+
* object to move, rotate, look at objects, etc.
|
|
1605
2368
|
*/
|
|
1606
|
-
|
|
2369
|
+
get controls(): CameraControls;
|
|
1607
2370
|
/**
|
|
1608
|
-
*
|
|
2371
|
+
* Getter for the enabled state of the camera controls.
|
|
2372
|
+
* If the current world is null, it returns false.
|
|
2373
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
2374
|
+
*
|
|
2375
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
1609
2376
|
*/
|
|
1610
|
-
|
|
2377
|
+
get enabled(): boolean;
|
|
1611
2378
|
/**
|
|
1612
|
-
*
|
|
2379
|
+
* Setter for the enabled state of the camera controls.
|
|
2380
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
2381
|
+
*
|
|
2382
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
1613
2383
|
*/
|
|
1614
|
-
|
|
2384
|
+
set enabled(enabled: boolean);
|
|
2385
|
+
constructor(components: Components);
|
|
2386
|
+
/** {@link Disposable.dispose} */
|
|
2387
|
+
dispose(): void;
|
|
2388
|
+
/** {@link Updateable.update} */
|
|
2389
|
+
update(_delta: number): void;
|
|
1615
2390
|
/**
|
|
1616
|
-
*
|
|
2391
|
+
* Updates the aspect of the camera to match the size of the
|
|
2392
|
+
* {@link Components.renderer}.
|
|
1617
2393
|
*/
|
|
1618
|
-
|
|
2394
|
+
updateAspect: () => void;
|
|
2395
|
+
private setupCamera;
|
|
2396
|
+
private newCameraControls;
|
|
2397
|
+
private setupEvents;
|
|
2398
|
+
private static getSubsetOfThree;
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* 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.
|
|
2402
|
+
*/
|
|
2403
|
+
export declare class Event<T> {
|
|
1619
2404
|
/**
|
|
1620
|
-
*
|
|
2405
|
+
* Add a callback to this event instance.
|
|
2406
|
+
* @param handler - the callback to be added to this event.
|
|
1621
2407
|
*/
|
|
1622
|
-
|
|
2408
|
+
add(handler: T extends void ? {
|
|
2409
|
+
(): void;
|
|
2410
|
+
} : {
|
|
2411
|
+
(data: T): void;
|
|
2412
|
+
}): void;
|
|
1623
2413
|
/**
|
|
1624
|
-
*
|
|
2414
|
+
* Removes a callback from this event instance.
|
|
2415
|
+
* @param handler - the callback to be removed from this event.
|
|
1625
2416
|
*/
|
|
1626
|
-
|
|
2417
|
+
remove(handler: T extends void ? {
|
|
2418
|
+
(): void;
|
|
2419
|
+
} : {
|
|
2420
|
+
(data: T): void;
|
|
2421
|
+
}): void;
|
|
2422
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2423
|
+
trigger: (data?: T) => void;
|
|
2424
|
+
/** Gets rid of all the suscribed events. */
|
|
2425
|
+
reset(): void;
|
|
2426
|
+
private handlers;
|
|
1627
2427
|
}
|
|
1628
2428
|
import * as THREE from "three";
|
|
1629
|
-
import
|
|
1630
|
-
import {
|
|
2429
|
+
import CameraControls from "camera-controls";
|
|
2430
|
+
import { Event } from "./event";
|
|
1631
2431
|
/**
|
|
1632
|
-
*
|
|
2432
|
+
* Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
|
|
1633
2433
|
*/
|
|
1634
|
-
export
|
|
1635
|
-
/** Event that fires when the user starts dragging a clipping plane. */
|
|
1636
|
-
readonly onDraggingStarted: Event<unknown>;
|
|
1637
|
-
/** Event that fires when the user stops dragging a clipping plane. */
|
|
1638
|
-
readonly onDraggingEnded: Event<unknown>;
|
|
1639
|
-
/** {@link Disposable.onDisposed} */
|
|
1640
|
-
readonly onDisposed: Event<unknown>;
|
|
2434
|
+
export interface Disposable {
|
|
1641
2435
|
/**
|
|
1642
|
-
*
|
|
2436
|
+
* Destroys the object from memory to prevent a
|
|
2437
|
+
* [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
1643
2438
|
*/
|
|
1644
|
-
|
|
2439
|
+
dispose: () => void | Promise<void>;
|
|
2440
|
+
/** Fired after the tool has been disposed. */
|
|
2441
|
+
readonly onDisposed: Event<any>;
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2445
|
+
*/
|
|
2446
|
+
export interface Hideable {
|
|
1645
2447
|
/**
|
|
1646
|
-
*
|
|
2448
|
+
* Whether the geometric representation of this component is
|
|
2449
|
+
* currently visible or not in the
|
|
2450
|
+
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
1647
2451
|
*/
|
|
1648
|
-
|
|
2452
|
+
visible: boolean;
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
|
|
2456
|
+
*/
|
|
2457
|
+
export interface Resizeable {
|
|
1649
2458
|
/**
|
|
1650
|
-
*
|
|
2459
|
+
* Sets size of this component (e.g. the resolution of a
|
|
2460
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2461
|
+
* component.
|
|
1651
2462
|
*/
|
|
1652
|
-
|
|
1653
|
-
/**
|
|
1654
|
-
|
|
1655
|
-
/** The world instance to which this plane belongs. */
|
|
1656
|
-
world: World;
|
|
1657
|
-
protected readonly _helper: THREE.Object3D;
|
|
1658
|
-
protected _visible: boolean;
|
|
1659
|
-
protected _enabled: boolean;
|
|
1660
|
-
private _controlsActive;
|
|
1661
|
-
private readonly _arrowBoundBox;
|
|
1662
|
-
private readonly _planeMesh;
|
|
1663
|
-
private readonly _controls;
|
|
1664
|
-
private readonly _hiddenMaterial;
|
|
2463
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2464
|
+
/** Event that fires when the component has been resized. */
|
|
2465
|
+
onResize: Event<THREE.Vector2>;
|
|
1665
2466
|
/**
|
|
1666
|
-
*
|
|
1667
|
-
*
|
|
2467
|
+
* Gets the current size of this component (e.g. the resolution of a
|
|
2468
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2469
|
+
* component.
|
|
1668
2470
|
*/
|
|
1669
|
-
|
|
2471
|
+
getSize: () => THREE.Vector2;
|
|
2472
|
+
}
|
|
2473
|
+
/** Whether this component should be updated each frame. */
|
|
2474
|
+
export interface Updateable {
|
|
2475
|
+
/** Actions that should be executed after updating the component. */
|
|
2476
|
+
onAfterUpdate: Event<any>;
|
|
2477
|
+
/** Actions that should be executed before updating the component. */
|
|
2478
|
+
onBeforeUpdate: Event<any>;
|
|
1670
2479
|
/**
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1673
|
-
* @param {boolean} state - The new enabled state.
|
|
2480
|
+
* Function used to update the state of this component each frame. For
|
|
2481
|
+
* instance, a renderer component will make a render each frame.
|
|
1674
2482
|
*/
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
/**
|
|
1689
|
-
|
|
2483
|
+
update(delta?: number): void;
|
|
2484
|
+
}
|
|
2485
|
+
/** Basic type to describe the progress of any kind of process. */
|
|
2486
|
+
export interface Progress {
|
|
2487
|
+
/** The amount of things that have been done already. */
|
|
2488
|
+
current: number;
|
|
2489
|
+
/** The total amount of things to be done by the process. */
|
|
2490
|
+
total: number;
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
2494
|
+
*/
|
|
2495
|
+
export interface Createable {
|
|
2496
|
+
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
2497
|
+
create: (data: any) => void;
|
|
1690
2498
|
/**
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
* @returns {THREE.Object3D} The helper object of the clipping plane.
|
|
1696
|
-
*/
|
|
1697
|
-
get helper(): THREE.Object3D<THREE.Object3DEventMap>;
|
|
1698
|
-
constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
|
|
2499
|
+
* Finish the creation process of the component, successfully creating an
|
|
2500
|
+
* instance of whatever the component creates.
|
|
2501
|
+
*/
|
|
2502
|
+
endCreation?: (data: any) => void;
|
|
1699
2503
|
/**
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
*
|
|
1707
|
-
* @returns {void}
|
|
1708
|
-
*/
|
|
1709
|
-
setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
|
|
1710
|
-
/** {@link Updateable.update} */
|
|
1711
|
-
update: () => void;
|
|
1712
|
-
/** {@link Disposable.dispose} */
|
|
1713
|
-
dispose(): void;
|
|
1714
|
-
private reset;
|
|
1715
|
-
protected toggleControls(state: boolean): void;
|
|
1716
|
-
private newTransformControls;
|
|
1717
|
-
private initializeControls;
|
|
1718
|
-
private createArrowBoundingBox;
|
|
1719
|
-
private changeDrag;
|
|
1720
|
-
private notifyDraggingChanged;
|
|
1721
|
-
private preventCameraMovement;
|
|
1722
|
-
private newHelper;
|
|
1723
|
-
private static newPlaneMesh;
|
|
2504
|
+
* Cancels the creation process of the component, going back to the state
|
|
2505
|
+
* before starting to create.
|
|
2506
|
+
*/
|
|
2507
|
+
cancelCreation?: (data: any) => void;
|
|
2508
|
+
/** Deletes an existing instance of an element (e.g. a Dimension). */
|
|
2509
|
+
delete: (data: any) => void;
|
|
1724
2510
|
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
export interface
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
2511
|
+
/**
|
|
2512
|
+
* Whether this component supports to be configured.
|
|
2513
|
+
*/
|
|
2514
|
+
export interface Configurable<T extends Record<string, any>> {
|
|
2515
|
+
/** Wether this components has been already configured. */
|
|
2516
|
+
isSetup: boolean;
|
|
2517
|
+
/** Use the provided configuration to setup the tool. */
|
|
2518
|
+
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
2519
|
+
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2520
|
+
readonly onSetup: Event<any>;
|
|
2521
|
+
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2522
|
+
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2523
|
+
*/
|
|
2524
|
+
config: Required<T>;
|
|
1733
2525
|
}
|
|
1734
2526
|
/**
|
|
1735
|
-
*
|
|
1736
|
-
* [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
|
|
1737
|
-
* and translated to typescript by
|
|
1738
|
-
* [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2527
|
+
* Whether a camera uses the Camera Controls library.
|
|
1739
2528
|
*/
|
|
1740
|
-
export
|
|
1741
|
-
/** {@link Disposable.onDisposed} */
|
|
1742
|
-
readonly onDisposed: Event<unknown>;
|
|
1743
|
-
/** The world instance to which this Raycaster belongs. */
|
|
1744
|
-
world: World;
|
|
1745
|
-
/** The components instance to which this grid belongs. */
|
|
1746
|
-
components: Components;
|
|
1747
|
-
/** {@link Hideable.visible} */
|
|
1748
|
-
get visible(): boolean;
|
|
1749
|
-
/** {@link Hideable.visible} */
|
|
1750
|
-
set visible(visible: boolean);
|
|
1751
|
-
/** The material of the grid. */
|
|
1752
|
-
get material(): THREE.ShaderMaterial;
|
|
2529
|
+
export interface CameraControllable {
|
|
1753
2530
|
/**
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
2531
|
+
* An instance of CameraControls that provides camera control functionalities.
|
|
2532
|
+
* This instance is used to manipulate the camera.
|
|
1756
2533
|
*/
|
|
1757
|
-
|
|
2534
|
+
controls: CameraControls;
|
|
2535
|
+
}
|
|
2536
|
+
import { Base } from "./base";
|
|
2537
|
+
/**
|
|
2538
|
+
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
2539
|
+
*/
|
|
2540
|
+
export declare abstract class Component extends Base {
|
|
1758
2541
|
/**
|
|
1759
|
-
* Whether
|
|
1760
|
-
*
|
|
2542
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
2543
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2544
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2545
|
+
* will not be updated automatically each frame.
|
|
1761
2546
|
*/
|
|
1762
|
-
|
|
1763
|
-
/** The Three.js mesh that contains the infinite grid. */
|
|
1764
|
-
readonly three: THREE.Mesh;
|
|
1765
|
-
private _fade;
|
|
1766
|
-
constructor(components: Components, world: World, config: GridConfig);
|
|
1767
|
-
/** {@link Disposable.dispose} */
|
|
1768
|
-
dispose(): void;
|
|
1769
|
-
private setupEvents;
|
|
1770
|
-
private updateZoom;
|
|
2547
|
+
abstract enabled: boolean;
|
|
1771
2548
|
}
|
|
1772
|
-
import
|
|
1773
|
-
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2549
|
+
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
1774
2550
|
import { Components } from "../../Components";
|
|
1775
2551
|
/**
|
|
1776
|
-
*
|
|
2552
|
+
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
1777
2553
|
*/
|
|
1778
|
-
export
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
}
|
|
2554
|
+
export declare abstract class Base {
|
|
2555
|
+
components: Components;
|
|
2556
|
+
constructor(components: Components);
|
|
2557
|
+
/** Whether is component is {@link Disposable}. */
|
|
2558
|
+
isDisposeable: () => this is Disposable;
|
|
2559
|
+
/** Whether is component is {@link Resizeable}. */
|
|
2560
|
+
isResizeable: () => this is Resizeable;
|
|
2561
|
+
/** Whether is component is {@link Updateable}. */
|
|
2562
|
+
isUpdateable: () => this is Updateable;
|
|
2563
|
+
/** Whether is component is {@link Hideable}. */
|
|
2564
|
+
isHideable: () => this is Hideable;
|
|
2565
|
+
/** Whether is component is {@link Configurable}. */
|
|
2566
|
+
isConfigurable: () => this is Configurable<any>;
|
|
1788
2567
|
}
|
|
2568
|
+
import { Base } from "./base";
|
|
2569
|
+
import { World } from "./world";
|
|
2570
|
+
import { Event } from "./event";
|
|
2571
|
+
import { Components } from "../../Components";
|
|
1789
2572
|
/**
|
|
1790
|
-
*
|
|
2573
|
+
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
1791
2574
|
*/
|
|
1792
|
-
export declare class
|
|
1793
|
-
|
|
1794
|
-
isSetup: boolean;
|
|
2575
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
2576
|
+
readonly worlds: Map<string, World>;
|
|
1795
2577
|
/**
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
2578
|
+
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2579
|
+
* The event payload contains the world instance and the action ("added" or "removed").
|
|
1798
2580
|
*/
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
2581
|
+
readonly onWorldChanged: Event<{
|
|
2582
|
+
world: World;
|
|
2583
|
+
action: "added" | "removed";
|
|
2584
|
+
}>;
|
|
1802
2585
|
/**
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
constructor(components: Components);
|
|
1808
|
-
/** {@link Configurable.setup} */
|
|
1809
|
-
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
2586
|
+
* The current world this item is associated with. It can be null if no world is currently active.
|
|
2587
|
+
*/
|
|
2588
|
+
currentWorld: World | null;
|
|
2589
|
+
protected constructor(components: Components);
|
|
1810
2590
|
}
|
|
1811
2591
|
import * as THREE from "three";
|
|
1812
|
-
import
|
|
2592
|
+
import CameraControls from "camera-controls";
|
|
2593
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2594
|
+
import { CameraControllable } from "./interfaces";
|
|
1813
2595
|
/**
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
1816
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
1817
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
1818
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2596
|
+
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
1819
2597
|
*/
|
|
1820
|
-
export declare class
|
|
1821
|
-
/**
|
|
1822
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
1823
|
-
*/
|
|
1824
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
1825
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
1826
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
1827
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
1828
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
1829
|
-
/** {@link Disposable.onDisposed} */
|
|
1830
|
-
readonly onDisposed: Event<unknown>;
|
|
2598
|
+
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
1831
2599
|
/**
|
|
1832
|
-
*
|
|
2600
|
+
* Whether the camera is enabled or not.
|
|
1833
2601
|
*/
|
|
1834
|
-
|
|
2602
|
+
abstract enabled: boolean;
|
|
1835
2603
|
/**
|
|
1836
|
-
*
|
|
1837
|
-
* When disabled, the world will not be updated.
|
|
2604
|
+
* The Three.js camera instance.
|
|
1838
2605
|
*/
|
|
1839
|
-
|
|
2606
|
+
abstract three: THREE.Camera;
|
|
1840
2607
|
/**
|
|
1841
|
-
*
|
|
2608
|
+
* Optional CameraControls instance for controlling the camera.
|
|
2609
|
+
* This property is only available if the camera is controllable.
|
|
1842
2610
|
*/
|
|
1843
|
-
|
|
2611
|
+
abstract controls?: CameraControls;
|
|
1844
2612
|
/**
|
|
1845
|
-
*
|
|
2613
|
+
* Checks whether the instance is {@link CameraControllable}.
|
|
2614
|
+
*
|
|
2615
|
+
* @returns True if the instance is controllable, false otherwise.
|
|
1846
2616
|
*/
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
2617
|
+
hasCameraControls: () => this is CameraControllable;
|
|
2618
|
+
}
|
|
2619
|
+
import * as THREE from "three";
|
|
2620
|
+
import { Vector2 } from "three";
|
|
2621
|
+
import { Event } from "./event";
|
|
2622
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2623
|
+
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
2624
|
+
/**
|
|
2625
|
+
* Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
|
|
2626
|
+
*/
|
|
2627
|
+
export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
|
|
1851
2628
|
/**
|
|
1852
|
-
*
|
|
1853
|
-
*
|
|
2629
|
+
* The three.js WebGLRenderer instance associated with this renderer.
|
|
2630
|
+
*
|
|
2631
|
+
* @abstract
|
|
2632
|
+
* @type {THREE.WebGLRenderer}
|
|
1854
2633
|
*/
|
|
1855
|
-
|
|
2634
|
+
abstract three: THREE.WebGLRenderer;
|
|
2635
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2636
|
+
onAfterUpdate: Event<unknown>;
|
|
2637
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2638
|
+
onBeforeUpdate: Event<unknown>;
|
|
2639
|
+
/** {@link Disposable.onDisposed} */
|
|
2640
|
+
readonly onDisposed: Event<undefined>;
|
|
2641
|
+
/** {@link Resizeable.onResize} */
|
|
2642
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
1856
2643
|
/**
|
|
1857
|
-
*
|
|
1858
|
-
*
|
|
1859
|
-
* @param scene - The new scene to be set.
|
|
2644
|
+
* Event that fires when there has been a change to the list of clipping
|
|
2645
|
+
* planes used by the active renderer.
|
|
1860
2646
|
*/
|
|
1861
|
-
|
|
2647
|
+
readonly onClippingPlanesUpdated: Event<unknown>;
|
|
2648
|
+
/** {@link Updateable.update} */
|
|
2649
|
+
abstract update(delta?: number): void | Promise<void>;
|
|
2650
|
+
/** {@link Disposable.dispose} */
|
|
2651
|
+
abstract dispose(): void;
|
|
2652
|
+
/** {@link Resizeable.getSize} */
|
|
2653
|
+
abstract getSize(): Vector2;
|
|
2654
|
+
/** {@link Resizeable.resize} */
|
|
2655
|
+
abstract resize(size: Vector2 | undefined): void;
|
|
1862
2656
|
/**
|
|
1863
|
-
*
|
|
1864
|
-
* @returns The current camera.
|
|
2657
|
+
* The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
|
|
1865
2658
|
*/
|
|
1866
|
-
|
|
2659
|
+
clippingPlanes: THREE.Plane[];
|
|
1867
2660
|
/**
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
1870
|
-
* @
|
|
2661
|
+
* Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
|
|
2662
|
+
*
|
|
2663
|
+
* @remarks
|
|
2664
|
+
* This method is typically called when there is a change to the list of clipping planes
|
|
2665
|
+
* used by the active renderer.
|
|
1871
2666
|
*/
|
|
1872
|
-
|
|
2667
|
+
updateClippingPlanes(): void;
|
|
1873
2668
|
/**
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
2669
|
+
* Sets or removes a clipping plane from the renderer.
|
|
2670
|
+
*
|
|
2671
|
+
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
2672
|
+
* @param plane - The clipping plane to be added or removed.
|
|
2673
|
+
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
2674
|
+
*
|
|
2675
|
+
* @remarks
|
|
2676
|
+
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
2677
|
+
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
2678
|
+
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
2679
|
+
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
2680
|
+
* excluding any planes marked as local.
|
|
1876
2681
|
*/
|
|
1877
|
-
|
|
2682
|
+
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2683
|
+
}
|
|
2684
|
+
import * as THREE from "three";
|
|
2685
|
+
import { Disposable } from "./interfaces";
|
|
2686
|
+
import { Event } from "./event";
|
|
2687
|
+
import { Components } from "../../Components";
|
|
2688
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2689
|
+
/**
|
|
2690
|
+
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2691
|
+
*/
|
|
2692
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2693
|
+
/** {@link Disposable.onDisposed} */
|
|
2694
|
+
readonly onDisposed: Event<unknown>;
|
|
1878
2695
|
/**
|
|
1879
|
-
*
|
|
1880
|
-
*
|
|
1881
|
-
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
1882
|
-
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2696
|
+
* Abstract property representing the three.js object associated with this scene.
|
|
2697
|
+
* It should be implemented by subclasses.
|
|
1883
2698
|
*/
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
update(delta?: number): void;
|
|
2699
|
+
abstract three: THREE.Object3D;
|
|
2700
|
+
protected constructor(components: Components);
|
|
1887
2701
|
/** {@link Disposable.dispose} */
|
|
1888
|
-
dispose(
|
|
2702
|
+
dispose(): void;
|
|
1889
2703
|
}
|
|
1890
2704
|
import * as THREE from "three";
|
|
1891
|
-
import
|
|
1892
|
-
import {
|
|
1893
|
-
import {
|
|
2705
|
+
import { BaseScene } from "./base-scene";
|
|
2706
|
+
import { BaseCamera } from "./base-camera";
|
|
2707
|
+
import { BaseRenderer } from "./base-renderer";
|
|
2708
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
1894
2709
|
/**
|
|
1895
|
-
*
|
|
2710
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
1896
2711
|
*/
|
|
1897
|
-
export
|
|
1898
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
1899
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
1900
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
1901
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2712
|
+
export interface World extends Disposable, Updateable {
|
|
1902
2713
|
/**
|
|
1903
|
-
*
|
|
1904
|
-
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2714
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
1905
2715
|
*/
|
|
1906
|
-
|
|
1907
|
-
/** {@link Disposable.onDisposed} */
|
|
1908
|
-
readonly onDisposed: Event<string>;
|
|
2716
|
+
meshes: Set<THREE.Mesh>;
|
|
1909
2717
|
/**
|
|
1910
|
-
*
|
|
1911
|
-
* This camera is used for rendering the scene.
|
|
2718
|
+
* The base scene of the world.
|
|
1912
2719
|
*/
|
|
1913
|
-
|
|
1914
|
-
private _allControls;
|
|
2720
|
+
scene: BaseScene;
|
|
1915
2721
|
/**
|
|
1916
|
-
* The
|
|
1917
|
-
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
1918
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
1919
|
-
* object to move, rotate, look at objects, etc.
|
|
2722
|
+
* The base camera of the world.
|
|
1920
2723
|
*/
|
|
1921
|
-
|
|
2724
|
+
camera: BaseCamera;
|
|
1922
2725
|
/**
|
|
1923
|
-
*
|
|
1924
|
-
* If the current world is null, it returns false.
|
|
1925
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
1926
|
-
*
|
|
1927
|
-
* @returns {boolean} The enabled state of the camera controls.
|
|
2726
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
1928
2727
|
*/
|
|
1929
|
-
|
|
2728
|
+
renderer: BaseRenderer | null;
|
|
1930
2729
|
/**
|
|
1931
|
-
*
|
|
1932
|
-
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
1933
|
-
*
|
|
1934
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2730
|
+
* A unique identifier for the world.
|
|
1935
2731
|
*/
|
|
1936
|
-
|
|
1937
|
-
constructor(components: Components);
|
|
1938
|
-
/** {@link Disposable.dispose} */
|
|
1939
|
-
dispose(): void;
|
|
1940
|
-
/** {@link Updateable.update} */
|
|
1941
|
-
update(_delta: number): void;
|
|
2732
|
+
uuid: string;
|
|
1942
2733
|
/**
|
|
1943
|
-
*
|
|
1944
|
-
* {@link Components.renderer}.
|
|
2734
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
1945
2735
|
*/
|
|
1946
|
-
|
|
1947
|
-
private setupCamera;
|
|
1948
|
-
private newCameraControls;
|
|
1949
|
-
private setupEvents;
|
|
1950
|
-
private static getSubsetOfThree;
|
|
2736
|
+
isDisposing: boolean;
|
|
1951
2737
|
}
|
|
1952
2738
|
import * as THREE from "three";
|
|
1953
2739
|
import { BaseRenderer, Event } from "../../Types";
|
|
@@ -2003,91 +2789,39 @@ export declare class SimpleRenderer extends BaseRenderer {
|
|
|
2003
2789
|
private onContextLost;
|
|
2004
2790
|
private onContextBack;
|
|
2005
2791
|
}
|
|
2006
|
-
import * as THREE from "three";
|
|
2007
|
-
import { Disposable, Event } from "../../Types";
|
|
2008
|
-
/**
|
|
2009
|
-
* A helper to easily get the real position of the mouse in the Three.js canvas
|
|
2010
|
-
* to work with tools like the
|
|
2011
|
-
* [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
|
|
2012
|
-
* been transformed through CSS or doesn't occupy the whole screen.
|
|
2013
|
-
*/
|
|
2014
|
-
export declare class Mouse implements Disposable {
|
|
2015
|
-
dom: HTMLCanvasElement;
|
|
2016
|
-
private _event?;
|
|
2017
|
-
private _position;
|
|
2018
|
-
/** {@link Disposable.onDisposed} */
|
|
2019
|
-
readonly onDisposed: Event<unknown>;
|
|
2020
|
-
constructor(dom: HTMLCanvasElement);
|
|
2021
|
-
/**
|
|
2022
|
-
* The real position of the mouse of the Three.js canvas.
|
|
2023
|
-
*/
|
|
2024
|
-
get position(): THREE.Vector2;
|
|
2025
|
-
/** {@link Disposable.dispose} */
|
|
2026
|
-
dispose(): void;
|
|
2027
|
-
private getPositionY;
|
|
2028
|
-
private getPositionX;
|
|
2029
|
-
private updateMouseInfo;
|
|
2030
|
-
private setupEvents;
|
|
2031
|
-
}
|
|
2032
|
-
import * as THREE from "three";
|
|
2033
|
-
import { Components } from "../../Components";
|
|
2034
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2035
|
-
import { Mouse } from "./mouse";
|
|
2036
2792
|
/**
|
|
2037
|
-
*
|
|
2038
|
-
* that allows to easily get items from the scene using the mouse and touch
|
|
2039
|
-
* events.
|
|
2793
|
+
* 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.
|
|
2040
2794
|
*/
|
|
2041
|
-
export declare class
|
|
2042
|
-
/** {@link Component.enabled} */
|
|
2043
|
-
enabled: boolean;
|
|
2044
|
-
/** The components instance to which this Raycaster belongs. */
|
|
2045
|
-
components: Components;
|
|
2046
|
-
/** {@link Disposable.onDisposed} */
|
|
2047
|
-
readonly onDisposed: Event<unknown>;
|
|
2048
|
-
/** The position of the mouse in the screen. */
|
|
2049
|
-
readonly mouse: Mouse;
|
|
2050
|
-
/**
|
|
2051
|
-
* A reference to the Three.js Raycaster instance.
|
|
2052
|
-
* This is used for raycasting operations.
|
|
2053
|
-
*/
|
|
2054
|
-
readonly three: THREE.Raycaster;
|
|
2795
|
+
export declare class AsyncEvent<T> {
|
|
2055
2796
|
/**
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2797
|
+
* Add a callback to this event instance.
|
|
2798
|
+
* @param handler - the callback to be added to this event.
|
|
2058
2799
|
*/
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2800
|
+
add(handler: T extends void ? {
|
|
2801
|
+
(): Promise<void>;
|
|
2802
|
+
} : {
|
|
2803
|
+
(data: T): Promise<void>;
|
|
2804
|
+
}): void;
|
|
2063
2805
|
/**
|
|
2064
|
-
*
|
|
2065
|
-
*
|
|
2066
|
-
* used by the renderer.
|
|
2067
|
-
*
|
|
2068
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
2069
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
2070
|
-
* {@link Components.meshes}.
|
|
2806
|
+
* Removes a callback from this event instance.
|
|
2807
|
+
* @param handler - the callback to be removed from this event.
|
|
2071
2808
|
*/
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
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;
|
|
2083
|
-
private intersect;
|
|
2084
|
-
private filterClippingPlanes;
|
|
2809
|
+
remove(handler: T extends void ? {
|
|
2810
|
+
(): Promise<void>;
|
|
2811
|
+
} : {
|
|
2812
|
+
(data: T): Promise<void>;
|
|
2813
|
+
}): void;
|
|
2814
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2815
|
+
trigger: (data?: T) => Promise<void>;
|
|
2816
|
+
/** Gets rid of all the suscribed events. */
|
|
2817
|
+
reset(): void;
|
|
2818
|
+
private handlers;
|
|
2085
2819
|
}
|
|
2086
2820
|
import * as THREE from "three";
|
|
2087
2821
|
import { Components } from "../../Components";
|
|
2088
2822
|
import { AsyncEvent, Event, World } from "../../Types";
|
|
2089
2823
|
/**
|
|
2090
|
-
*
|
|
2824
|
+
* Settings to configure the CullerRenderer.
|
|
2091
2825
|
*/
|
|
2092
2826
|
export interface CullerRendererSettings {
|
|
2093
2827
|
/**
|
|
@@ -2179,7 +2913,7 @@ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
|
2179
2913
|
import { Components } from "../../Components";
|
|
2180
2914
|
import { Event, World, Disposable } from "../../Types";
|
|
2181
2915
|
/**
|
|
2182
|
-
* A renderer to
|
|
2916
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2183
2917
|
*/
|
|
2184
2918
|
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2185
2919
|
/**
|
|
@@ -2221,16 +2955,39 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
|
|
|
2221
2955
|
*/
|
|
2222
2956
|
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2223
2957
|
/**
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2958
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2959
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2960
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2961
|
+
* @returns {void}
|
|
2962
|
+
*/
|
|
2229
2963
|
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2230
2964
|
private handleWorkerMessage;
|
|
2231
2965
|
private getAvailableMaterial;
|
|
2232
2966
|
}
|
|
2233
2967
|
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2968
|
+
import * as THREE from "three";
|
|
2969
|
+
import { Disposable, Event } from "../../Types";
|
|
2970
|
+
/**
|
|
2971
|
+
* 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.
|
|
2972
|
+
*/
|
|
2973
|
+
export declare class Mouse implements Disposable {
|
|
2974
|
+
dom: HTMLCanvasElement;
|
|
2975
|
+
private _event?;
|
|
2976
|
+
private _position;
|
|
2977
|
+
/** {@link Disposable.onDisposed} */
|
|
2978
|
+
readonly onDisposed: Event<unknown>;
|
|
2979
|
+
constructor(dom: HTMLCanvasElement);
|
|
2980
|
+
/**
|
|
2981
|
+
* The real position of the mouse of the Three.js canvas.
|
|
2982
|
+
*/
|
|
2983
|
+
get position(): THREE.Vector2;
|
|
2984
|
+
/** {@link Disposable.dispose} */
|
|
2985
|
+
dispose(): void;
|
|
2986
|
+
private getPositionY;
|
|
2987
|
+
private getPositionX;
|
|
2988
|
+
private updateMouseInfo;
|
|
2989
|
+
private setupEvents;
|
|
2990
|
+
}
|
|
2234
2991
|
import { NavigationMode } from "./types";
|
|
2235
2992
|
import { OrthoPerspectiveCamera } from "../index";
|
|
2236
2993
|
/**
|
|
@@ -2263,25 +3020,167 @@ export declare class OrbitMode implements NavigationMode {
|
|
|
2263
3020
|
set(active: boolean): void;
|
|
2264
3021
|
private activateOrbitControls;
|
|
2265
3022
|
}
|
|
3023
|
+
import * as THREE from "three";
|
|
3024
|
+
import { Components } from "../../Components";
|
|
3025
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3026
|
+
import { Mouse } from "./mouse";
|
|
3027
|
+
/**
|
|
3028
|
+
* 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.
|
|
3029
|
+
*/
|
|
3030
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
3031
|
+
/** {@link Component.enabled} */
|
|
3032
|
+
enabled: boolean;
|
|
3033
|
+
/** The components instance to which this Raycaster belongs. */
|
|
3034
|
+
components: Components;
|
|
3035
|
+
/** {@link Disposable.onDisposed} */
|
|
3036
|
+
readonly onDisposed: Event<unknown>;
|
|
3037
|
+
/** The position of the mouse in the screen. */
|
|
3038
|
+
readonly mouse: Mouse;
|
|
3039
|
+
/**
|
|
3040
|
+
* A reference to the Three.js Raycaster instance.
|
|
3041
|
+
* This is used for raycasting operations.
|
|
3042
|
+
*/
|
|
3043
|
+
readonly three: THREE.Raycaster;
|
|
3044
|
+
/**
|
|
3045
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
3046
|
+
* This is used to access the camera and meshes.
|
|
3047
|
+
*/
|
|
3048
|
+
world: World;
|
|
3049
|
+
constructor(components: Components, world: World);
|
|
3050
|
+
/** {@link Disposable.dispose} */
|
|
3051
|
+
dispose(): void;
|
|
3052
|
+
/**
|
|
3053
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3054
|
+
* the first item found. This also takes into account the clipping planes
|
|
3055
|
+
* used by the renderer.
|
|
3056
|
+
*
|
|
3057
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3058
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
3059
|
+
* {@link Components.meshes}.
|
|
3060
|
+
*/
|
|
3061
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3062
|
+
/**
|
|
3063
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3064
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
3065
|
+
*
|
|
3066
|
+
* @param origin - The origin of the ray.
|
|
3067
|
+
* @param direction - The direction of the ray.
|
|
3068
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3069
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3070
|
+
*/
|
|
3071
|
+
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;
|
|
3072
|
+
private intersect;
|
|
3073
|
+
private filterClippingPlanes;
|
|
3074
|
+
}
|
|
3075
|
+
/**
|
|
3076
|
+
* The projection system of the camera.
|
|
3077
|
+
*/
|
|
3078
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3079
|
+
/**
|
|
3080
|
+
* The extensible list of supported navigation modes.
|
|
3081
|
+
*/
|
|
3082
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3083
|
+
/**
|
|
3084
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3085
|
+
*/
|
|
3086
|
+
export interface NavigationMode {
|
|
3087
|
+
/** The unique ID of this navigation mode. */
|
|
3088
|
+
id: NavModeID;
|
|
3089
|
+
/**
|
|
3090
|
+
* Enable or disable this navigation mode.
|
|
3091
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3092
|
+
* must be disabled.
|
|
3093
|
+
*
|
|
3094
|
+
* @param active - whether to enable or disable this mode.
|
|
3095
|
+
* @param options - any additional data required to enable or disable it.
|
|
3096
|
+
* */
|
|
3097
|
+
set: (active: boolean, options?: any) => void;
|
|
3098
|
+
/** Whether this navigation mode is active or not. */
|
|
3099
|
+
enabled: boolean;
|
|
3100
|
+
}
|
|
2266
3101
|
import { NavigationMode } from "./types";
|
|
2267
3102
|
import { OrthoPerspectiveCamera } from "../index";
|
|
2268
3103
|
/**
|
|
2269
|
-
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3104
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3105
|
+
*/
|
|
3106
|
+
export declare class PlanMode implements NavigationMode {
|
|
3107
|
+
private camera;
|
|
3108
|
+
/** {@link NavigationMode.enabled} */
|
|
3109
|
+
enabled: boolean;
|
|
3110
|
+
/** {@link NavigationMode.id} */
|
|
3111
|
+
readonly id = "Plan";
|
|
3112
|
+
private mouseAction1?;
|
|
3113
|
+
private mouseAction2?;
|
|
3114
|
+
private mouseInitialized;
|
|
3115
|
+
private readonly defaultAzimuthSpeed;
|
|
3116
|
+
private readonly defaultPolarSpeed;
|
|
3117
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3118
|
+
/** {@link NavigationMode.set} */
|
|
3119
|
+
set(active: boolean): void;
|
|
3120
|
+
}
|
|
3121
|
+
import * as THREE from "three";
|
|
3122
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
3123
|
+
import { Components } from "../../Components";
|
|
3124
|
+
/**
|
|
3125
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
3126
|
+
*/
|
|
3127
|
+
export interface GridConfig {
|
|
3128
|
+
/**
|
|
3129
|
+
* The color of the grid lines.
|
|
3130
|
+
*/
|
|
3131
|
+
color: THREE.Color;
|
|
3132
|
+
/**
|
|
3133
|
+
* The size of the primary grid lines.
|
|
3134
|
+
*/
|
|
3135
|
+
size1: number;
|
|
3136
|
+
/**
|
|
3137
|
+
* The size of the secondary grid lines.
|
|
3138
|
+
*/
|
|
3139
|
+
size2: number;
|
|
3140
|
+
/**
|
|
3141
|
+
* The distance at which the grid lines start to fade away.
|
|
3142
|
+
*/
|
|
3143
|
+
distance: number;
|
|
3144
|
+
}
|
|
3145
|
+
/**
|
|
3146
|
+
* 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).
|
|
2270
3147
|
*/
|
|
2271
|
-
export declare class
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
3148
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
3149
|
+
/** {@link Disposable.onDisposed} */
|
|
3150
|
+
readonly onDisposed: Event<unknown>;
|
|
3151
|
+
/** The world instance to which this Raycaster belongs. */
|
|
3152
|
+
world: World;
|
|
3153
|
+
/** The components instance to which this grid belongs. */
|
|
3154
|
+
components: Components;
|
|
3155
|
+
/** {@link Hideable.visible} */
|
|
3156
|
+
get visible(): boolean;
|
|
3157
|
+
/** {@link Hideable.visible} */
|
|
3158
|
+
set visible(visible: boolean);
|
|
3159
|
+
/** The material of the grid. */
|
|
3160
|
+
get material(): THREE.ShaderMaterial;
|
|
3161
|
+
/**
|
|
3162
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3163
|
+
* perspective cameras and false for orthographic cameras.
|
|
3164
|
+
*/
|
|
3165
|
+
get fade(): boolean;
|
|
3166
|
+
/**
|
|
3167
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3168
|
+
* perspective cameras and false for orthographic cameras.
|
|
3169
|
+
*/
|
|
3170
|
+
set fade(active: boolean);
|
|
3171
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
3172
|
+
readonly three: THREE.Mesh;
|
|
3173
|
+
private _fade;
|
|
3174
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
3175
|
+
/** {@link Disposable.dispose} */
|
|
3176
|
+
dispose(): void;
|
|
3177
|
+
private setupEvents;
|
|
3178
|
+
private updateZoom;
|
|
3179
|
+
}
|
|
3180
|
+
import { BufferGeometry } from "three";
|
|
3181
|
+
import * as THREE from "three";
|
|
3182
|
+
export declare class TransformHelper {
|
|
3183
|
+
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
2285
3184
|
}
|
|
2286
3185
|
import * as THREE from "three";
|
|
2287
3186
|
import { CameraProjection } from "./types";
|
|
@@ -2328,130 +3227,102 @@ export declare class ProjectionManager {
|
|
|
2328
3227
|
private getDistance;
|
|
2329
3228
|
private setPerspectiveCamera;
|
|
2330
3229
|
}
|
|
3230
|
+
import * as THREE from "three";
|
|
3231
|
+
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
3232
|
+
import { Components } from "../../Components";
|
|
2331
3233
|
/**
|
|
2332
|
-
*
|
|
2333
|
-
*/
|
|
2334
|
-
export type CameraProjection = "Perspective" | "Orthographic";
|
|
2335
|
-
/**
|
|
2336
|
-
* The extensible list of supported navigation modes.
|
|
2337
|
-
*/
|
|
2338
|
-
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
2339
|
-
/**
|
|
2340
|
-
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3234
|
+
* Each of the clipping planes created by the clipper.
|
|
2341
3235
|
*/
|
|
2342
|
-
export
|
|
2343
|
-
/**
|
|
2344
|
-
|
|
3236
|
+
export declare class SimplePlane implements Disposable, Hideable {
|
|
3237
|
+
/** Event that fires when the user starts dragging a clipping plane. */
|
|
3238
|
+
readonly onDraggingStarted: Event<unknown>;
|
|
3239
|
+
/** Event that fires when the user stops dragging a clipping plane. */
|
|
3240
|
+
readonly onDraggingEnded: Event<unknown>;
|
|
3241
|
+
/** {@link Disposable.onDisposed} */
|
|
3242
|
+
readonly onDisposed: Event<unknown>;
|
|
2345
3243
|
/**
|
|
2346
|
-
*
|
|
2347
|
-
|
|
2348
|
-
|
|
3244
|
+
* The normal vector of the clipping plane.
|
|
3245
|
+
*/
|
|
3246
|
+
readonly normal: THREE.Vector3;
|
|
3247
|
+
/**
|
|
3248
|
+
* The origin point of the clipping plane.
|
|
3249
|
+
*/
|
|
3250
|
+
readonly origin: THREE.Vector3;
|
|
3251
|
+
/**
|
|
3252
|
+
* The THREE.js Plane object representing the clipping plane.
|
|
3253
|
+
*/
|
|
3254
|
+
readonly three: THREE.Plane;
|
|
3255
|
+
/** The components instance to which this plane belongs. */
|
|
3256
|
+
components: Components;
|
|
3257
|
+
/** The world instance to which this plane belongs. */
|
|
3258
|
+
world: World;
|
|
3259
|
+
protected readonly _helper: THREE.Object3D;
|
|
3260
|
+
protected _visible: boolean;
|
|
3261
|
+
protected _enabled: boolean;
|
|
3262
|
+
private _controlsActive;
|
|
3263
|
+
private readonly _arrowBoundBox;
|
|
3264
|
+
private readonly _planeMesh;
|
|
3265
|
+
private readonly _controls;
|
|
3266
|
+
private readonly _hiddenMaterial;
|
|
3267
|
+
/**
|
|
3268
|
+
* Getter for the enabled state of the clipping plane.
|
|
3269
|
+
* @returns {boolean} The current enabled state.
|
|
3270
|
+
*/
|
|
3271
|
+
get enabled(): boolean;
|
|
3272
|
+
/**
|
|
3273
|
+
* Setter for the enabled state of the clipping plane.
|
|
3274
|
+
* Updates the clipping plane state in the renderer and throws an error if no renderer is found.
|
|
3275
|
+
* @param {boolean} state - The new enabled state.
|
|
3276
|
+
*/
|
|
3277
|
+
set enabled(state: boolean);
|
|
3278
|
+
/** {@link Hideable.visible } */
|
|
3279
|
+
get visible(): boolean;
|
|
3280
|
+
/** {@link Hideable.visible } */
|
|
3281
|
+
set visible(state: boolean);
|
|
3282
|
+
/** The meshes used for raycasting */
|
|
3283
|
+
get meshes(): THREE.Mesh[];
|
|
3284
|
+
/** The material of the clipping plane representation. */
|
|
3285
|
+
get planeMaterial(): THREE.Material | THREE.Material[];
|
|
3286
|
+
/** The material of the clipping plane representation. */
|
|
3287
|
+
set planeMaterial(material: THREE.Material | THREE.Material[]);
|
|
3288
|
+
/** The size of the clipping plane representation. */
|
|
3289
|
+
get size(): number;
|
|
3290
|
+
/** Sets the size of the clipping plane representation. */
|
|
3291
|
+
set size(size: number);
|
|
3292
|
+
/**
|
|
3293
|
+
* Getter for the helper object of the clipping plane.
|
|
3294
|
+
* The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
|
|
3295
|
+
* It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
|
|
2349
3296
|
*
|
|
2350
|
-
* @
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
/** Whether this navigation mode is active or not. */
|
|
2355
|
-
enabled: boolean;
|
|
2356
|
-
}
|
|
2357
|
-
import * as THREE from "three";
|
|
2358
|
-
import * as WEBIFC from "web-ifc";
|
|
2359
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
2360
|
-
export declare class CivilReader {
|
|
2361
|
-
defLineMat: THREE.LineBasicMaterial;
|
|
2362
|
-
read(webIfc: WEBIFC.IfcAPI): {
|
|
2363
|
-
alignments: Map<number, FRAGS.Alignment>;
|
|
2364
|
-
coordinationMatrix: THREE.Matrix4;
|
|
2365
|
-
} | undefined;
|
|
2366
|
-
get(civilItems: any): {
|
|
2367
|
-
alignments: Map<number, FRAGS.Alignment>;
|
|
2368
|
-
coordinationMatrix: THREE.Matrix4;
|
|
2369
|
-
} | undefined;
|
|
2370
|
-
private getCurves;
|
|
2371
|
-
}
|
|
2372
|
-
import * as WEBIFC from "web-ifc";
|
|
2373
|
-
/** Configuration of the IFC-fragment conversion. */
|
|
2374
|
-
export declare class IfcFragmentSettings {
|
|
2375
|
-
/** Whether to extract the IFC properties into a JSON. */
|
|
2376
|
-
includeProperties: boolean;
|
|
3297
|
+
* @returns {THREE.Object3D} The helper object of the clipping plane.
|
|
3298
|
+
*/
|
|
3299
|
+
get helper(): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3300
|
+
constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
|
|
2377
3301
|
/**
|
|
2378
|
-
*
|
|
2379
|
-
*
|
|
3302
|
+
* Sets the clipping plane's normal and origin from the given normal and point.
|
|
3303
|
+
* This method resets the clipping plane's state, updates the normal and origin,
|
|
3304
|
+
* and positions the helper object accordingly.
|
|
3305
|
+
*
|
|
3306
|
+
* @param normal - The new normal vector for the clipping plane.
|
|
3307
|
+
* @param point - The new origin point for the clipping plane.
|
|
3308
|
+
*
|
|
3309
|
+
* @returns {void}
|
|
2380
3310
|
*/
|
|
2381
|
-
|
|
2382
|
-
/**
|
|
2383
|
-
|
|
2384
|
-
/**
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
autoSetWasm: boolean;
|
|
2397
|
-
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2398
|
-
}
|
|
2399
|
-
import * as WEBIFC from "web-ifc";
|
|
2400
|
-
export declare class IfcMetadataReader {
|
|
2401
|
-
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
2402
|
-
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
2403
|
-
}
|
|
2404
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2405
|
-
/** Configuration of the IFC-fragment streaming. */
|
|
2406
|
-
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
2407
|
-
minGeometrySize: number;
|
|
2408
|
-
minAssetsSize: number;
|
|
2409
|
-
}
|
|
2410
|
-
/** Configuration of the IFC-fragment streaming. */
|
|
2411
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
2412
|
-
propertiesSize: number;
|
|
2413
|
-
}
|
|
2414
|
-
export interface StreamedGeometries {
|
|
2415
|
-
[id: number]: {
|
|
2416
|
-
boundingBox: Float32Array;
|
|
2417
|
-
hasHoles: boolean;
|
|
2418
|
-
geometryFile?: string;
|
|
2419
|
-
};
|
|
2420
|
-
}
|
|
2421
|
-
export interface StreamedAsset {
|
|
2422
|
-
id: number;
|
|
2423
|
-
geometries: {
|
|
2424
|
-
geometryID: number;
|
|
2425
|
-
transformation: number[];
|
|
2426
|
-
color: number[];
|
|
2427
|
-
}[];
|
|
2428
|
-
}
|
|
2429
|
-
import * as WEBIFC from "web-ifc";
|
|
2430
|
-
import { AsyncEvent, Component, Disposable, Event } from "../../../core";
|
|
2431
|
-
import { PropertiesStreamingSettings } from "./streaming-settings";
|
|
2432
|
-
export declare class FragmentPropsStreamConverter extends Component implements Disposable {
|
|
2433
|
-
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
2434
|
-
onPropertiesStreamed: AsyncEvent<{
|
|
2435
|
-
type: number;
|
|
2436
|
-
data: {
|
|
2437
|
-
[id: number]: any;
|
|
2438
|
-
};
|
|
2439
|
-
}>;
|
|
2440
|
-
onProgress: AsyncEvent<number>;
|
|
2441
|
-
onIndicesStreamed: AsyncEvent<number[][]>;
|
|
2442
|
-
/** {@link Disposable.onDisposed} */
|
|
2443
|
-
readonly onDisposed: Event<string>;
|
|
2444
|
-
enabled: boolean;
|
|
2445
|
-
settings: PropertiesStreamingSettings;
|
|
2446
|
-
webIfc: WEBIFC.IfcAPI;
|
|
2447
|
-
dispose(): Promise<void>;
|
|
2448
|
-
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
2449
|
-
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
2450
|
-
private readIfcFile;
|
|
2451
|
-
private streamIfcFile;
|
|
2452
|
-
private streamAllProperties;
|
|
2453
|
-
private getIndices;
|
|
2454
|
-
private cleanUp;
|
|
3311
|
+
setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
|
|
3312
|
+
/** {@link Updateable.update} */
|
|
3313
|
+
update: () => void;
|
|
3314
|
+
/** {@link Disposable.dispose} */
|
|
3315
|
+
dispose(): void;
|
|
3316
|
+
private reset;
|
|
3317
|
+
protected toggleControls(state: boolean): void;
|
|
3318
|
+
private newTransformControls;
|
|
3319
|
+
private initializeControls;
|
|
3320
|
+
private createArrowBoundingBox;
|
|
3321
|
+
private changeDrag;
|
|
3322
|
+
private notifyDraggingChanged;
|
|
3323
|
+
private preventCameraMovement;
|
|
3324
|
+
private newHelper;
|
|
3325
|
+
private static newPlaneMesh;
|
|
2455
3326
|
}
|
|
2456
3327
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
2457
3328
|
export interface ModelsRelationMap {
|
|
@@ -2477,20 +3348,5 @@ export type InverseAttributes = [
|
|
|
2477
3348
|
"ContainsElements"
|
|
2478
3349
|
];
|
|
2479
3350
|
export type InverseAttribute = InverseAttributes[number];
|
|
2480
|
-
import * as WEBIFC from "web-ifc";
|
|
2481
|
-
import * as THREE from "three";
|
|
2482
|
-
export declare class Units {
|
|
2483
|
-
factor: number;
|
|
2484
|
-
complement: number;
|
|
2485
|
-
apply(matrix: THREE.Matrix4): void;
|
|
2486
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2487
|
-
private getLengthUnits;
|
|
2488
|
-
private getScaleMatrix;
|
|
2489
|
-
}
|
|
2490
|
-
import { BufferGeometry } from "three";
|
|
2491
|
-
import * as THREE from "three";
|
|
2492
|
-
export declare class TransformHelper {
|
|
2493
|
-
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
2494
|
-
}
|
|
2495
3351
|
|
|
2496
3352
|
}
|