@thatopen/components 2.1.22 → 2.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/ifc/IfcRelationsIndexer/src/relToAttributesMap.d.ts +1 -1
- package/dist/ifc/IfcRelationsIndexer/src/types.d.ts +10 -2
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +170 -141
- package/dist/namespace.d.ts +1981 -1973
- package/package.json +2 -2
package/dist/namespace.d.ts
CHANGED
|
@@ -1,4 +1,130 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
+
import { SimpleScene, SimpleSceneConfig } from "../Worlds";
|
|
3
|
+
import { DistanceRenderer } from "./src";
|
|
4
|
+
import { Disposable } from "../Types";
|
|
5
|
+
/**
|
|
6
|
+
* Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
|
|
7
|
+
* as well as shadows.
|
|
8
|
+
*/
|
|
9
|
+
export interface ShadowedSceneConfig extends SimpleSceneConfig {
|
|
10
|
+
shadows: {
|
|
11
|
+
cascade: number;
|
|
12
|
+
resolution: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A scene that supports efficient cast shadows.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ShadowedScene extends SimpleScene implements Disposable {
|
|
19
|
+
private _distanceRenderer?;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the bias property should be set automatically depending on the shadow distance.
|
|
22
|
+
*/
|
|
23
|
+
autoBias: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Configuration interface for the {@link ShadowedScene}.
|
|
26
|
+
* Defines properties for directional and ambient lights, as well as shadows.
|
|
27
|
+
*/
|
|
28
|
+
config: Required<ShadowedSceneConfig>;
|
|
29
|
+
private _lightsWithShadow;
|
|
30
|
+
private _isComputingShadows;
|
|
31
|
+
private _shadowsEnabled;
|
|
32
|
+
private _bias;
|
|
33
|
+
/**
|
|
34
|
+
* The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
|
|
35
|
+
*/
|
|
36
|
+
get bias(): number;
|
|
37
|
+
/**
|
|
38
|
+
* The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
|
|
39
|
+
*/
|
|
40
|
+
set bias(value: number);
|
|
41
|
+
/**
|
|
42
|
+
* Getter to see whether the shadows are enabled or not in this scene instance.
|
|
43
|
+
*/
|
|
44
|
+
get shadowsEnabled(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Setter to control whether the shadows are enabled or not in this scene instance.
|
|
47
|
+
*/
|
|
48
|
+
set shadowsEnabled(value: boolean);
|
|
49
|
+
/**
|
|
50
|
+
* Getter to get the renderer used to determine the farthest distance from the camera.
|
|
51
|
+
*/
|
|
52
|
+
get distanceRenderer(): DistanceRenderer;
|
|
53
|
+
/** {@link Configurable.setup} */
|
|
54
|
+
setup(config?: Partial<ShadowedSceneConfig>): void;
|
|
55
|
+
/** {@link Disposable.dispose} */
|
|
56
|
+
dispose(): void;
|
|
57
|
+
/** Update all the shadows of the scene. */
|
|
58
|
+
updateShadows(): Promise<void>;
|
|
59
|
+
private recomputeShadows;
|
|
60
|
+
}
|
|
61
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
62
|
+
import { Components } from "../Components";
|
|
63
|
+
import { SimpleWorld } from "./src";
|
|
64
|
+
/**
|
|
65
|
+
* 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).
|
|
66
|
+
*/
|
|
67
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
68
|
+
/**
|
|
69
|
+
* A unique identifier for the component.
|
|
70
|
+
* This UUID is used to register the component within the Components system.
|
|
71
|
+
*/
|
|
72
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
73
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
74
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
75
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
76
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
77
|
+
/** {@link Disposable.onDisposed} */
|
|
78
|
+
readonly onDisposed: Event<unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* An event that is triggered when a new world is created.
|
|
81
|
+
* The event passes the newly created world as a parameter.
|
|
82
|
+
*/
|
|
83
|
+
readonly onWorldCreated: Event<World>;
|
|
84
|
+
/**
|
|
85
|
+
* An event that is triggered when a world is deleted.
|
|
86
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
87
|
+
*/
|
|
88
|
+
readonly onWorldDeleted: Event<string>;
|
|
89
|
+
/**
|
|
90
|
+
* A collection of worlds managed by this component.
|
|
91
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
92
|
+
*/
|
|
93
|
+
list: Map<string, World>;
|
|
94
|
+
/** {@link Component.enabled} */
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
constructor(components: Components);
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
99
|
+
*
|
|
100
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
101
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
102
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
103
|
+
*
|
|
104
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
105
|
+
*/
|
|
106
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
107
|
+
/**
|
|
108
|
+
* Deletes a world from the list of worlds.
|
|
109
|
+
*
|
|
110
|
+
* @param {World} world - The world to be deleted.
|
|
111
|
+
*
|
|
112
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
113
|
+
*
|
|
114
|
+
* @returns {void}
|
|
115
|
+
*/
|
|
116
|
+
delete(world: World): void;
|
|
117
|
+
/**
|
|
118
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
119
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
120
|
+
* and triggers the onDisposed event.
|
|
121
|
+
*
|
|
122
|
+
* @returns {void}
|
|
123
|
+
*/
|
|
124
|
+
dispose(): void;
|
|
125
|
+
/** {@link Updateable.update} */
|
|
126
|
+
update(delta?: number): void | Promise<void>;
|
|
127
|
+
}
|
|
2
128
|
import { Component, Disposable, Event } from "../Types";
|
|
3
129
|
/**
|
|
4
130
|
* The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
|
|
@@ -7,7 +133,7 @@ export declare class Components implements Disposable {
|
|
|
7
133
|
/**
|
|
8
134
|
* The version of the @thatopen/components library.
|
|
9
135
|
*/
|
|
10
|
-
static readonly release = "2.1.
|
|
136
|
+
static readonly release = "2.1.24";
|
|
11
137
|
/** {@link Disposable.onDisposed} */
|
|
12
138
|
readonly onDisposed: Event<void>;
|
|
13
139
|
/**
|
|
@@ -76,200 +202,192 @@ export declare class Components implements Disposable {
|
|
|
76
202
|
private static setupBVH;
|
|
77
203
|
}
|
|
78
204
|
import * as THREE from "three";
|
|
79
|
-
import
|
|
80
|
-
import {
|
|
81
|
-
|
|
82
|
-
* Represents an edge measurement result.
|
|
83
|
-
*/
|
|
84
|
-
export interface MeasureEdge {
|
|
85
|
-
/**
|
|
86
|
-
* The distance between the two points of the edge.
|
|
87
|
-
*/
|
|
88
|
-
distance: number;
|
|
89
|
-
/**
|
|
90
|
-
* The two points that define the edge.
|
|
91
|
-
*/
|
|
92
|
-
points: THREE.Vector3[];
|
|
93
|
-
}
|
|
205
|
+
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
206
|
+
import { SimplePlane } from "./src";
|
|
207
|
+
import { Components } from "../Components";
|
|
94
208
|
/**
|
|
95
|
-
*
|
|
209
|
+
* 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).
|
|
210
|
+
*
|
|
211
|
+
* @param components - the instance of {@link Components} used.
|
|
212
|
+
* E.g. {@link SimplePlane}.
|
|
96
213
|
*/
|
|
97
|
-
export declare class
|
|
214
|
+
export declare class Clipper extends Component implements Createable, Disposable, Hideable {
|
|
98
215
|
/**
|
|
99
216
|
* A unique identifier for the component.
|
|
100
217
|
* This UUID is used to register the component within the Components system.
|
|
101
218
|
*/
|
|
102
|
-
static uuid:
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
219
|
+
static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
|
|
220
|
+
/** Event that fires when the user starts dragging a clipping plane. */
|
|
221
|
+
readonly onBeforeDrag: Event<void>;
|
|
222
|
+
/** Event that fires when the user stops dragging a clipping plane. */
|
|
223
|
+
readonly onAfterDrag: Event<void>;
|
|
106
224
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* @param point - The point from which to calculate the distance.
|
|
110
|
-
* @param lineStart - The start point of the line segment.
|
|
111
|
-
* @param lineEnd - The end point of the line segment.
|
|
112
|
-
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
113
|
-
* @returns The distance from the point to the line segment.
|
|
225
|
+
* Event that fires when the user starts creating a clipping plane.
|
|
114
226
|
*/
|
|
115
|
-
|
|
227
|
+
readonly onBeforeCreate: Event<unknown>;
|
|
116
228
|
/**
|
|
117
|
-
*
|
|
118
|
-
* It also returns the edges of the found face and their indices.
|
|
119
|
-
*
|
|
120
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
121
|
-
* @param triangleIndex - The index of the triangle within the mesh.
|
|
122
|
-
* @param instance - The instance of the mesh (optional).
|
|
123
|
-
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
229
|
+
* Event that fires when the user cancels the creation of a clipping plane.
|
|
124
230
|
*/
|
|
125
|
-
|
|
126
|
-
edges: MeasureEdge[];
|
|
127
|
-
indices: Set<number>;
|
|
128
|
-
} | null;
|
|
231
|
+
readonly onBeforeCancel: Event<unknown>;
|
|
129
232
|
/**
|
|
130
|
-
*
|
|
131
|
-
* It also applies instance transformation if provided.
|
|
132
|
-
*
|
|
133
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
134
|
-
* @param faceIndex - The index of the face within the mesh.
|
|
135
|
-
* @param instance - The instance of the mesh (optional).
|
|
136
|
-
* @returns An object containing the vertices and normal of the face.
|
|
137
|
-
* @throws Will throw an error if the geometry is not indexed.
|
|
233
|
+
* Event that fires after the user cancels the creation of a clipping plane.
|
|
138
234
|
*/
|
|
139
|
-
|
|
140
|
-
p1: THREE.Vector3;
|
|
141
|
-
p2: THREE.Vector3;
|
|
142
|
-
p3: THREE.Vector3;
|
|
143
|
-
faceNormal: THREE.Vector3;
|
|
144
|
-
};
|
|
235
|
+
readonly onAfterCancel: Event<unknown>;
|
|
145
236
|
/**
|
|
146
|
-
*
|
|
147
|
-
* This is used to ensure numerical precision in edge detection.
|
|
148
|
-
*
|
|
149
|
-
* @param vector - The vector to round.
|
|
150
|
-
* @returns The vector with rounded components.
|
|
237
|
+
* Event that fires when the user starts deleting a clipping plane.
|
|
151
238
|
*/
|
|
152
|
-
|
|
239
|
+
readonly onBeforeDelete: Event<unknown>;
|
|
153
240
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
157
|
-
* @returns The total volume of the fragments and the bounding sphere.
|
|
158
|
-
*
|
|
159
|
-
* @remarks
|
|
160
|
-
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
161
|
-
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
162
|
-
*
|
|
163
|
-
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
164
|
-
* @throws Will throw an error if the fragment manager is not available.
|
|
241
|
+
* Event that fires after a clipping plane has been created.
|
|
242
|
+
* @param plane - The newly created clipping plane.
|
|
165
243
|
*/
|
|
166
|
-
|
|
244
|
+
readonly onAfterCreate: Event<SimplePlane>;
|
|
167
245
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
171
|
-
* @returns The total volume of the meshes and the bounding sphere.
|
|
172
|
-
*
|
|
173
|
-
* @remarks
|
|
174
|
-
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
175
|
-
* and its bounding sphere.
|
|
176
|
-
*
|
|
246
|
+
* Event that fires after a clipping plane has been deleted.
|
|
247
|
+
* @param plane - The deleted clipping plane.
|
|
177
248
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
private getSignedVolumeOfTriangle;
|
|
182
|
-
}
|
|
183
|
-
import { Component, Disposable, World, Event } from "../Types";
|
|
184
|
-
import { GridConfig, SimpleGrid } from "./src";
|
|
185
|
-
import { Components } from "../Components";
|
|
186
|
-
/**
|
|
187
|
-
* 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).
|
|
188
|
-
*/
|
|
189
|
-
export declare class Grids extends Component implements Disposable {
|
|
249
|
+
readonly onAfterDelete: Event<SimplePlane>;
|
|
250
|
+
/** {@link Disposable.onDisposed} */
|
|
251
|
+
readonly onDisposed: Event<string>;
|
|
190
252
|
/**
|
|
191
|
-
*
|
|
192
|
-
* This
|
|
253
|
+
* Whether to force the clipping plane to be orthogonal in the Y direction
|
|
254
|
+
* (up). This is desirable when clipping a building horizontally and a
|
|
255
|
+
* clipping plane is created in its roof, which might have a slight
|
|
256
|
+
* slope for draining purposes.
|
|
193
257
|
*/
|
|
194
|
-
|
|
258
|
+
orthogonalY: boolean;
|
|
195
259
|
/**
|
|
196
|
-
*
|
|
260
|
+
* The tolerance that determines whether an almost-horizontal clipping plane
|
|
261
|
+
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
262
|
+
* has to be 'true' for this to apply.
|
|
197
263
|
*/
|
|
198
|
-
|
|
264
|
+
toleranceOrthogonalY: number;
|
|
199
265
|
/**
|
|
200
|
-
* The
|
|
266
|
+
* The type of clipping plane to be created.
|
|
267
|
+
* Default is {@link SimplePlane}.
|
|
201
268
|
*/
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
|
|
269
|
+
Type: new (...args: any) => SimplePlane;
|
|
270
|
+
/**
|
|
271
|
+
* A list of all the clipping planes created by this component.
|
|
272
|
+
*/
|
|
273
|
+
list: SimplePlane[];
|
|
274
|
+
/** The material used in all the clipping planes. */
|
|
275
|
+
private _material;
|
|
276
|
+
private _size;
|
|
277
|
+
private _enabled;
|
|
278
|
+
private _visible;
|
|
205
279
|
/** {@link Component.enabled} */
|
|
206
|
-
enabled: boolean;
|
|
280
|
+
get enabled(): boolean;
|
|
281
|
+
/** {@link Component.enabled} */
|
|
282
|
+
set enabled(state: boolean);
|
|
283
|
+
/** {@link Hideable.visible } */
|
|
284
|
+
get visible(): boolean;
|
|
285
|
+
/** {@link Hideable.visible } */
|
|
286
|
+
set visible(state: boolean);
|
|
287
|
+
/** The material of the clipping plane representation. */
|
|
288
|
+
get material(): THREE.MeshBasicMaterial;
|
|
289
|
+
/** The material of the clipping plane representation. */
|
|
290
|
+
set material(material: THREE.MeshBasicMaterial);
|
|
291
|
+
/** The size of the geometric representation of the clippings planes. */
|
|
292
|
+
get size(): number;
|
|
293
|
+
/** The size of the geometric representation of the clippings planes. */
|
|
294
|
+
set size(size: number);
|
|
207
295
|
constructor(components: Components);
|
|
296
|
+
/** {@link Disposable.dispose} */
|
|
297
|
+
dispose(): void;
|
|
298
|
+
/** {@link Createable.create} */
|
|
299
|
+
create(world: World): SimplePlane | null;
|
|
208
300
|
/**
|
|
209
|
-
* Creates a
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* @param world - The world to create the grid for.
|
|
213
|
-
* @returns The newly created grid.
|
|
301
|
+
* Creates a plane in a certain place and with a certain orientation,
|
|
302
|
+
* without the need of the mouse.
|
|
214
303
|
*
|
|
215
|
-
* @
|
|
304
|
+
* @param world - the world where this plane should be created.
|
|
305
|
+
* @param normal - the orientation of the clipping plane.
|
|
306
|
+
* @param point - the position of the clipping plane.
|
|
307
|
+
* navigation.
|
|
216
308
|
*/
|
|
217
|
-
|
|
309
|
+
createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
|
|
218
310
|
/**
|
|
219
|
-
*
|
|
220
|
-
* If a grid does not exist for the given world, this method does nothing.
|
|
311
|
+
* {@link Createable.delete}
|
|
221
312
|
*
|
|
222
|
-
* @param world -
|
|
313
|
+
* @param world - the world where the plane to delete is.
|
|
314
|
+
* @param plane - the plane to delete. If undefined, the first plane
|
|
315
|
+
* found under the cursor will be deleted.
|
|
316
|
+
*/
|
|
317
|
+
delete(world: World, plane?: SimplePlane): void;
|
|
318
|
+
/**
|
|
319
|
+
* Deletes all the existing clipping planes.
|
|
223
320
|
*
|
|
224
|
-
* @
|
|
225
|
-
* This method will dispose of the grid and remove it from the internal list.
|
|
226
|
-
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
321
|
+
* @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
|
|
227
322
|
*/
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
323
|
+
deleteAll(types?: Set<string>): void;
|
|
324
|
+
private deletePlane;
|
|
325
|
+
private pickPlane;
|
|
326
|
+
private getAllPlaneMeshes;
|
|
327
|
+
private createPlaneFromIntersection;
|
|
328
|
+
private getWorldNormal;
|
|
329
|
+
private normalizePlaneDirectionY;
|
|
330
|
+
private newPlane;
|
|
331
|
+
private updateMaterialsAndPlanes;
|
|
332
|
+
private _onStartDragging;
|
|
333
|
+
private _onEndDragging;
|
|
231
334
|
}
|
|
232
|
-
import
|
|
233
|
-
import { SimpleRaycaster } from "./src";
|
|
335
|
+
import * as THREE from "three";
|
|
234
336
|
import { Components } from "../Components";
|
|
337
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
338
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
235
339
|
/**
|
|
236
|
-
* A component that
|
|
340
|
+
* 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).
|
|
237
341
|
*/
|
|
238
|
-
export declare class
|
|
342
|
+
export declare class Cullers extends Component implements Disposable {
|
|
239
343
|
/**
|
|
240
344
|
* A unique identifier for the component.
|
|
241
345
|
* This UUID is used to register the component within the Components system.
|
|
242
346
|
*/
|
|
243
|
-
static readonly uuid: "
|
|
244
|
-
/** {@link Component.enabled} */
|
|
245
|
-
enabled: boolean;
|
|
347
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
246
348
|
/**
|
|
247
|
-
*
|
|
248
|
-
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
349
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
249
350
|
*/
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
351
|
+
readonly onDisposed: Event<unknown>;
|
|
352
|
+
private _enabled;
|
|
353
|
+
/**
|
|
354
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
355
|
+
*/
|
|
356
|
+
list: Map<string, MeshCullerRenderer>;
|
|
357
|
+
/** {@link Component.enabled} */
|
|
358
|
+
get enabled(): boolean;
|
|
359
|
+
/** {@link Component.enabled} */
|
|
360
|
+
set enabled(value: boolean);
|
|
253
361
|
constructor(components: Components);
|
|
254
362
|
/**
|
|
255
|
-
*
|
|
256
|
-
* If a
|
|
257
|
-
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
363
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
364
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
258
365
|
*
|
|
259
|
-
* @param world - The world for which to
|
|
260
|
-
* @
|
|
366
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
367
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
368
|
+
*
|
|
369
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
261
370
|
*/
|
|
262
|
-
|
|
371
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
263
372
|
/**
|
|
264
|
-
* Deletes the
|
|
265
|
-
* If a
|
|
373
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
374
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
375
|
+
*
|
|
376
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
266
377
|
*
|
|
267
|
-
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
268
378
|
* @returns {void}
|
|
269
379
|
*/
|
|
270
380
|
delete(world: World): void;
|
|
271
381
|
/** {@link Disposable.dispose} */
|
|
272
382
|
dispose(): void;
|
|
383
|
+
/**
|
|
384
|
+
* Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
|
|
385
|
+
*
|
|
386
|
+
* @param meshes - The meshes to update.
|
|
387
|
+
*
|
|
388
|
+
* @returns {void}
|
|
389
|
+
*/
|
|
390
|
+
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
273
391
|
}
|
|
274
392
|
import { MiniMap } from "./src";
|
|
275
393
|
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
@@ -318,329 +436,143 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
|
|
|
318
436
|
/** {@link Updateable.update} */
|
|
319
437
|
update(): void;
|
|
320
438
|
}
|
|
321
|
-
import {
|
|
322
|
-
import {
|
|
323
|
-
import {
|
|
324
|
-
/**
|
|
325
|
-
* Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
|
|
326
|
-
* as well as shadows.
|
|
327
|
-
*/
|
|
328
|
-
export interface ShadowedSceneConfig extends SimpleSceneConfig {
|
|
329
|
-
shadows: {
|
|
330
|
-
cascade: number;
|
|
331
|
-
resolution: number;
|
|
332
|
-
};
|
|
333
|
-
}
|
|
439
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
440
|
+
import { SimpleRaycaster } from "./src";
|
|
441
|
+
import { Components } from "../Components";
|
|
334
442
|
/**
|
|
335
|
-
* A
|
|
443
|
+
* 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).
|
|
336
444
|
*/
|
|
337
|
-
export declare class
|
|
338
|
-
private _distanceRenderer?;
|
|
339
|
-
/**
|
|
340
|
-
* Whether the bias property should be set automatically depending on the shadow distance.
|
|
341
|
-
*/
|
|
342
|
-
autoBias: boolean;
|
|
343
|
-
/**
|
|
344
|
-
* Configuration interface for the {@link ShadowedScene}.
|
|
345
|
-
* Defines properties for directional and ambient lights, as well as shadows.
|
|
346
|
-
*/
|
|
347
|
-
config: Required<ShadowedSceneConfig>;
|
|
348
|
-
private _lightsWithShadow;
|
|
349
|
-
private _isComputingShadows;
|
|
350
|
-
private _shadowsEnabled;
|
|
351
|
-
private _bias;
|
|
352
|
-
/**
|
|
353
|
-
* The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
|
|
354
|
-
*/
|
|
355
|
-
get bias(): number;
|
|
445
|
+
export declare class Raycasters extends Component implements Disposable {
|
|
356
446
|
/**
|
|
357
|
-
*
|
|
447
|
+
* A unique identifier for the component.
|
|
448
|
+
* This UUID is used to register the component within the Components system.
|
|
358
449
|
*/
|
|
359
|
-
|
|
450
|
+
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
451
|
+
/** {@link Component.enabled} */
|
|
452
|
+
enabled: boolean;
|
|
360
453
|
/**
|
|
361
|
-
*
|
|
454
|
+
* A Map that stores raycasters for each world.
|
|
455
|
+
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
362
456
|
*/
|
|
363
|
-
|
|
457
|
+
list: Map<string, SimpleRaycaster>;
|
|
458
|
+
/** {@link Disposable.onDisposed} */
|
|
459
|
+
onDisposed: Event<unknown>;
|
|
460
|
+
constructor(components: Components);
|
|
364
461
|
/**
|
|
365
|
-
*
|
|
462
|
+
* Retrieves a SimpleRaycaster instance for the given world.
|
|
463
|
+
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
464
|
+
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
465
|
+
*
|
|
466
|
+
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
467
|
+
* @returns The SimpleRaycaster instance for the given world.
|
|
366
468
|
*/
|
|
367
|
-
|
|
469
|
+
get(world: World): SimpleRaycaster;
|
|
368
470
|
/**
|
|
369
|
-
*
|
|
471
|
+
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
472
|
+
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
473
|
+
*
|
|
474
|
+
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
475
|
+
* @returns {void}
|
|
370
476
|
*/
|
|
371
|
-
|
|
372
|
-
/** {@link Configurable.setup} */
|
|
373
|
-
setup(config?: Partial<ShadowedSceneConfig>): void;
|
|
477
|
+
delete(world: World): void;
|
|
374
478
|
/** {@link Disposable.dispose} */
|
|
375
479
|
dispose(): void;
|
|
376
|
-
/** Update all the shadows of the scene. */
|
|
377
|
-
updateShadows(): Promise<void>;
|
|
378
|
-
private recomputeShadows;
|
|
379
480
|
}
|
|
380
|
-
import { Component, Disposable,
|
|
481
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
482
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
381
483
|
import { Components } from "../Components";
|
|
382
|
-
import { SimpleWorld } from "./src";
|
|
383
484
|
/**
|
|
384
|
-
* A
|
|
485
|
+
* 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).
|
|
385
486
|
*/
|
|
386
|
-
export declare class
|
|
487
|
+
export declare class Grids extends Component implements Disposable {
|
|
387
488
|
/**
|
|
388
489
|
* A unique identifier for the component.
|
|
389
490
|
* This UUID is used to register the component within the Components system.
|
|
390
491
|
*/
|
|
391
|
-
static readonly uuid: "
|
|
392
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
393
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
394
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
395
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
396
|
-
/** {@link Disposable.onDisposed} */
|
|
397
|
-
readonly onDisposed: Event<unknown>;
|
|
398
|
-
/**
|
|
399
|
-
* An event that is triggered when a new world is created.
|
|
400
|
-
* The event passes the newly created world as a parameter.
|
|
401
|
-
*/
|
|
402
|
-
readonly onWorldCreated: Event<World>;
|
|
492
|
+
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
403
493
|
/**
|
|
404
|
-
*
|
|
405
|
-
* The event passes the UUID of the deleted world as a parameter.
|
|
494
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
406
495
|
*/
|
|
407
|
-
|
|
496
|
+
list: Map<string, SimpleGrid>;
|
|
408
497
|
/**
|
|
409
|
-
*
|
|
410
|
-
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
498
|
+
* The default configuration for grid creation.
|
|
411
499
|
*/
|
|
412
|
-
|
|
500
|
+
config: Required<GridConfig>;
|
|
501
|
+
/** {@link Disposable.onDisposed} */
|
|
502
|
+
readonly onDisposed: Event<unknown>;
|
|
413
503
|
/** {@link Component.enabled} */
|
|
414
504
|
enabled: boolean;
|
|
415
505
|
constructor(components: Components);
|
|
416
506
|
/**
|
|
417
|
-
* Creates a new
|
|
507
|
+
* Creates a new grid for the given world.
|
|
508
|
+
* Throws an error if a grid already exists for the world.
|
|
418
509
|
*
|
|
419
|
-
* @
|
|
420
|
-
* @
|
|
421
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
510
|
+
* @param world - The world to create the grid for.
|
|
511
|
+
* @returns The newly created grid.
|
|
422
512
|
*
|
|
423
|
-
* @throws
|
|
513
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
424
514
|
*/
|
|
425
|
-
create
|
|
515
|
+
create(world: World): SimpleGrid;
|
|
426
516
|
/**
|
|
427
|
-
* Deletes
|
|
428
|
-
*
|
|
429
|
-
* @param {World} world - The world to be deleted.
|
|
517
|
+
* Deletes the grid associated with the given world.
|
|
518
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
430
519
|
*
|
|
431
|
-
* @
|
|
520
|
+
* @param world - The world for which to delete the grid.
|
|
432
521
|
*
|
|
433
|
-
* @
|
|
522
|
+
* @remarks
|
|
523
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
524
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
434
525
|
*/
|
|
435
526
|
delete(world: World): void;
|
|
436
|
-
/**
|
|
437
|
-
* Disposes of the Worlds component and all its managed worlds.
|
|
438
|
-
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
439
|
-
* and triggers the onDisposed event.
|
|
440
|
-
*
|
|
441
|
-
* @returns {void}
|
|
442
|
-
*/
|
|
527
|
+
/** {@link Disposable.dispose} */
|
|
443
528
|
dispose(): void;
|
|
444
|
-
/** {@link Updateable.update} */
|
|
445
|
-
update(delta?: number): void | Promise<void>;
|
|
446
529
|
}
|
|
447
530
|
import * as THREE from "three";
|
|
448
531
|
import { Components } from "../Components";
|
|
449
|
-
import {
|
|
450
|
-
import { Component, Event, Disposable, World } from "../Types";
|
|
532
|
+
import { Component } from "../Types";
|
|
451
533
|
/**
|
|
452
|
-
* A
|
|
534
|
+
* 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).
|
|
453
535
|
*/
|
|
454
|
-
export declare class
|
|
536
|
+
export declare class Disposer extends Component {
|
|
537
|
+
private _disposedComponents;
|
|
538
|
+
/** {@link Component.enabled} */
|
|
539
|
+
enabled: boolean;
|
|
455
540
|
/**
|
|
456
541
|
* A unique identifier for the component.
|
|
457
542
|
* This UUID is used to register the component within the Components system.
|
|
458
543
|
*/
|
|
459
|
-
static readonly uuid: "
|
|
460
|
-
/**
|
|
461
|
-
* An event that is triggered when the Cullers component is disposed.
|
|
462
|
-
*/
|
|
463
|
-
readonly onDisposed: Event<unknown>;
|
|
464
|
-
private _enabled;
|
|
465
|
-
/**
|
|
466
|
-
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
467
|
-
*/
|
|
468
|
-
list: Map<string, MeshCullerRenderer>;
|
|
469
|
-
/** {@link Component.enabled} */
|
|
470
|
-
get enabled(): boolean;
|
|
471
|
-
/** {@link Component.enabled} */
|
|
472
|
-
set enabled(value: boolean);
|
|
544
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
473
545
|
constructor(components: Components);
|
|
474
546
|
/**
|
|
475
|
-
*
|
|
476
|
-
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
477
|
-
*
|
|
478
|
-
* @param world - The world for which to create the MeshCullerRenderer.
|
|
479
|
-
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
480
|
-
*
|
|
481
|
-
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
482
|
-
*/
|
|
483
|
-
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
484
|
-
/**
|
|
485
|
-
* Deletes the MeshCullerRenderer associated with the given world.
|
|
486
|
-
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
487
|
-
*
|
|
488
|
-
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
489
|
-
*
|
|
490
|
-
* @returns {void}
|
|
547
|
+
* Return the UUIDs of all disposed components.
|
|
491
548
|
*/
|
|
492
|
-
|
|
493
|
-
/** {@link Disposable.dispose} */
|
|
494
|
-
dispose(): void;
|
|
549
|
+
get(): Set<string>;
|
|
495
550
|
/**
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
551
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
552
|
+
* using any of these in other parts of the application, make sure that you
|
|
553
|
+
* remove them from the mesh before disposing it.
|
|
499
554
|
*
|
|
500
|
-
* @
|
|
501
|
-
|
|
502
|
-
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
503
|
-
}
|
|
504
|
-
import * as THREE from "three";
|
|
505
|
-
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
506
|
-
import { SimplePlane } from "./src";
|
|
507
|
-
import { Components } from "../Components";
|
|
508
|
-
/**
|
|
509
|
-
* 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).
|
|
510
|
-
*
|
|
511
|
-
* @param components - the instance of {@link Components} used.
|
|
512
|
-
* E.g. {@link SimplePlane}.
|
|
513
|
-
*/
|
|
514
|
-
export declare class Clipper extends Component implements Createable, Disposable, Hideable {
|
|
515
|
-
/**
|
|
516
|
-
* A unique identifier for the component.
|
|
517
|
-
* This UUID is used to register the component within the Components system.
|
|
518
|
-
*/
|
|
519
|
-
static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
|
|
520
|
-
/** Event that fires when the user starts dragging a clipping plane. */
|
|
521
|
-
readonly onBeforeDrag: Event<void>;
|
|
522
|
-
/** Event that fires when the user stops dragging a clipping plane. */
|
|
523
|
-
readonly onAfterDrag: Event<void>;
|
|
524
|
-
/**
|
|
525
|
-
* Event that fires when the user starts creating a clipping plane.
|
|
526
|
-
*/
|
|
527
|
-
readonly onBeforeCreate: Event<unknown>;
|
|
528
|
-
/**
|
|
529
|
-
* Event that fires when the user cancels the creation of a clipping plane.
|
|
530
|
-
*/
|
|
531
|
-
readonly onBeforeCancel: Event<unknown>;
|
|
532
|
-
/**
|
|
533
|
-
* Event that fires after the user cancels the creation of a clipping plane.
|
|
534
|
-
*/
|
|
535
|
-
readonly onAfterCancel: Event<unknown>;
|
|
536
|
-
/**
|
|
537
|
-
* Event that fires when the user starts deleting a clipping plane.
|
|
538
|
-
*/
|
|
539
|
-
readonly onBeforeDelete: Event<unknown>;
|
|
540
|
-
/**
|
|
541
|
-
* Event that fires after a clipping plane has been created.
|
|
542
|
-
* @param plane - The newly created clipping plane.
|
|
543
|
-
*/
|
|
544
|
-
readonly onAfterCreate: Event<SimplePlane>;
|
|
545
|
-
/**
|
|
546
|
-
* Event that fires after a clipping plane has been deleted.
|
|
547
|
-
* @param plane - The deleted clipping plane.
|
|
548
|
-
*/
|
|
549
|
-
readonly onAfterDelete: Event<SimplePlane>;
|
|
550
|
-
/** {@link Disposable.onDisposed} */
|
|
551
|
-
readonly onDisposed: Event<string>;
|
|
552
|
-
/**
|
|
553
|
-
* Whether to force the clipping plane to be orthogonal in the Y direction
|
|
554
|
-
* (up). This is desirable when clipping a building horizontally and a
|
|
555
|
-
* clipping plane is created in its roof, which might have a slight
|
|
556
|
-
* slope for draining purposes.
|
|
557
|
-
*/
|
|
558
|
-
orthogonalY: boolean;
|
|
559
|
-
/**
|
|
560
|
-
* The tolerance that determines whether an almost-horizontal clipping plane
|
|
561
|
-
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
562
|
-
* has to be 'true' for this to apply.
|
|
563
|
-
*/
|
|
564
|
-
toleranceOrthogonalY: number;
|
|
565
|
-
/**
|
|
566
|
-
* The type of clipping plane to be created.
|
|
567
|
-
* Default is {@link SimplePlane}.
|
|
568
|
-
*/
|
|
569
|
-
Type: new (...args: any) => SimplePlane;
|
|
570
|
-
/**
|
|
571
|
-
* A list of all the clipping planes created by this component.
|
|
572
|
-
*/
|
|
573
|
-
list: SimplePlane[];
|
|
574
|
-
/** The material used in all the clipping planes. */
|
|
575
|
-
private _material;
|
|
576
|
-
private _size;
|
|
577
|
-
private _enabled;
|
|
578
|
-
private _visible;
|
|
579
|
-
/** {@link Component.enabled} */
|
|
580
|
-
get enabled(): boolean;
|
|
581
|
-
/** {@link Component.enabled} */
|
|
582
|
-
set enabled(state: boolean);
|
|
583
|
-
/** {@link Hideable.visible } */
|
|
584
|
-
get visible(): boolean;
|
|
585
|
-
/** {@link Hideable.visible } */
|
|
586
|
-
set visible(state: boolean);
|
|
587
|
-
/** The material of the clipping plane representation. */
|
|
588
|
-
get material(): THREE.MeshBasicMaterial;
|
|
589
|
-
/** The material of the clipping plane representation. */
|
|
590
|
-
set material(material: THREE.MeshBasicMaterial);
|
|
591
|
-
/** The size of the geometric representation of the clippings planes. */
|
|
592
|
-
get size(): number;
|
|
593
|
-
/** The size of the geometric representation of the clippings planes. */
|
|
594
|
-
set size(size: number);
|
|
595
|
-
constructor(components: Components);
|
|
596
|
-
/** {@link Disposable.dispose} */
|
|
597
|
-
dispose(): void;
|
|
598
|
-
/** {@link Createable.create} */
|
|
599
|
-
create(world: World): SimplePlane | null;
|
|
600
|
-
/**
|
|
601
|
-
* Creates a plane in a certain place and with a certain orientation,
|
|
602
|
-
* without the need of the mouse.
|
|
555
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
556
|
+
* to remove.
|
|
603
557
|
*
|
|
604
|
-
* @param
|
|
605
|
-
* @param normal - the orientation of the clipping plane.
|
|
606
|
-
* @param point - the position of the clipping plane.
|
|
607
|
-
* navigation.
|
|
608
|
-
*/
|
|
609
|
-
createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
|
|
610
|
-
/**
|
|
611
|
-
* {@link Createable.delete}
|
|
558
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
612
559
|
*
|
|
613
|
-
* @param
|
|
614
|
-
* @param plane - the plane to delete. If undefined, the first plane
|
|
615
|
-
* found under the cursor will be deleted.
|
|
560
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
616
561
|
*/
|
|
617
|
-
|
|
562
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
618
563
|
/**
|
|
619
|
-
*
|
|
564
|
+
* Disposes a geometry from memory.
|
|
620
565
|
*
|
|
621
|
-
* @param
|
|
566
|
+
* @param geometry - the
|
|
567
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
568
|
+
* to remove.
|
|
622
569
|
*/
|
|
623
|
-
|
|
624
|
-
private
|
|
625
|
-
private
|
|
626
|
-
private
|
|
627
|
-
private createPlaneFromIntersection;
|
|
628
|
-
private getWorldNormal;
|
|
629
|
-
private normalizePlaneDirectionY;
|
|
630
|
-
private newPlane;
|
|
631
|
-
private updateMaterialsAndPlanes;
|
|
632
|
-
private _onStartDragging;
|
|
633
|
-
private _onEndDragging;
|
|
570
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
571
|
+
private disposeGeometryAndMaterials;
|
|
572
|
+
private disposeChildren;
|
|
573
|
+
private static disposeMaterial;
|
|
634
574
|
}
|
|
635
575
|
import * as THREE from "three";
|
|
636
|
-
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
637
|
-
center: THREE.Vector3;
|
|
638
|
-
halfSizes: THREE.Vector3;
|
|
639
|
-
rotation: THREE.Matrix3;
|
|
640
|
-
transformation: THREE.Matrix4;
|
|
641
|
-
};
|
|
642
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
643
|
-
import * as THREE from "three";
|
|
644
576
|
import { Components } from "../Components";
|
|
645
577
|
import { SimpleCamera } from "..";
|
|
646
578
|
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
@@ -704,691 +636,566 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
704
636
|
private newOrthoCamera;
|
|
705
637
|
private setOrthoPerspCameraAspect;
|
|
706
638
|
}
|
|
707
|
-
import
|
|
639
|
+
import * as THREE from "three";
|
|
640
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
641
|
+
center: THREE.Vector3;
|
|
642
|
+
halfSizes: THREE.Vector3;
|
|
643
|
+
rotation: THREE.Matrix3;
|
|
644
|
+
transformation: THREE.Matrix4;
|
|
645
|
+
};
|
|
646
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
647
|
+
import * as THREE from "three";
|
|
648
|
+
export declare class MaterialsUtils {
|
|
649
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
650
|
+
}
|
|
651
|
+
import * as THREE from "three";
|
|
652
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
653
|
+
import { Component, Components } from "../../core";
|
|
708
654
|
/**
|
|
709
|
-
*
|
|
655
|
+
* Represents an edge measurement result.
|
|
710
656
|
*/
|
|
711
|
-
export
|
|
657
|
+
export interface MeasureEdge {
|
|
712
658
|
/**
|
|
713
|
-
*
|
|
714
|
-
* This UUID is used to register the component within the Components system.
|
|
659
|
+
* The distance between the two points of the edge.
|
|
715
660
|
*/
|
|
716
|
-
|
|
717
|
-
/** {@link Disposable.onDisposed} */
|
|
718
|
-
readonly onDisposed: Event<unknown>;
|
|
719
|
-
/** {@link Component.enabled} */
|
|
720
|
-
enabled: boolean;
|
|
721
|
-
/**
|
|
722
|
-
* The height of the explosion animation.
|
|
723
|
-
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
724
|
-
* Default value is 10.
|
|
725
|
-
*/
|
|
726
|
-
height: number;
|
|
727
|
-
/**
|
|
728
|
-
* The group name used for the explosion animation.
|
|
729
|
-
* This property specifies the group of fragments that will be affected by the explosion.
|
|
730
|
-
* Default value is "storeys".
|
|
731
|
-
*/
|
|
732
|
-
groupName: string;
|
|
733
|
-
/**
|
|
734
|
-
* A set of strings representing the exploded items.
|
|
735
|
-
* This set is used to keep track of which items have been exploded.
|
|
736
|
-
*/
|
|
737
|
-
list: Set<string>;
|
|
738
|
-
constructor(components: Components);
|
|
739
|
-
/** {@link Disposable.dispose} */
|
|
740
|
-
dispose(): void;
|
|
741
|
-
/**
|
|
742
|
-
* Sets the explosion state of the fragments.
|
|
743
|
-
*
|
|
744
|
-
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
745
|
-
*
|
|
746
|
-
* @remarks
|
|
747
|
-
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
748
|
-
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
749
|
-
* If 'active' is false, the fragments are moved back to their original position.
|
|
750
|
-
*
|
|
751
|
-
* The method also keeps track of the exploded items using the 'list' set.
|
|
752
|
-
*
|
|
753
|
-
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
754
|
-
*/
|
|
755
|
-
set(active: boolean): void;
|
|
756
|
-
}
|
|
757
|
-
import * as THREE from "three";
|
|
758
|
-
export declare class MaterialsUtils {
|
|
759
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
760
|
-
}
|
|
761
|
-
import * as THREE from "three";
|
|
762
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
763
|
-
import { Disposable, Component, Event, Components } from "../../core";
|
|
764
|
-
/**
|
|
765
|
-
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
766
|
-
*/
|
|
767
|
-
export interface Classification {
|
|
661
|
+
distance: number;
|
|
768
662
|
/**
|
|
769
|
-
*
|
|
770
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
663
|
+
* The two points that define the edge.
|
|
771
664
|
*/
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* A class within the system.
|
|
775
|
-
* The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
|
|
776
|
-
*/
|
|
777
|
-
[className: string]: {
|
|
778
|
-
map: FRAGS.FragmentIdMap;
|
|
779
|
-
name: string;
|
|
780
|
-
id: number | null;
|
|
781
|
-
};
|
|
782
|
-
};
|
|
665
|
+
points: THREE.Vector3[];
|
|
783
666
|
}
|
|
784
667
|
/**
|
|
785
|
-
*
|
|
668
|
+
* 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).
|
|
786
669
|
*/
|
|
787
|
-
export declare class
|
|
670
|
+
export declare class MeasurementUtils extends Component {
|
|
788
671
|
/**
|
|
789
672
|
* A unique identifier for the component.
|
|
790
673
|
* This UUID is used to register the component within the Components system.
|
|
791
674
|
*/
|
|
792
|
-
static
|
|
675
|
+
static uuid: string;
|
|
793
676
|
/** {@link Component.enabled} */
|
|
794
677
|
enabled: boolean;
|
|
795
|
-
/**
|
|
796
|
-
* A map representing the classification systems.
|
|
797
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
798
|
-
*/
|
|
799
|
-
list: Classification;
|
|
800
|
-
/** {@link Disposable.onDisposed} */
|
|
801
|
-
readonly onDisposed: Event<unknown>;
|
|
802
678
|
constructor(components: Components);
|
|
803
|
-
private onFragmentsDisposed;
|
|
804
|
-
/** {@link Disposable.dispose} */
|
|
805
|
-
dispose(): void;
|
|
806
|
-
/**
|
|
807
|
-
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
808
|
-
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
809
|
-
*
|
|
810
|
-
* @param guid - The unique identifier of the fragment to be removed.
|
|
811
|
-
*/
|
|
812
|
-
remove(guid: string): void;
|
|
813
|
-
/**
|
|
814
|
-
* Finds and returns fragments based on the provided filter criteria.
|
|
815
|
-
* If no filter is provided, it returns all fragments.
|
|
816
|
-
*
|
|
817
|
-
* @param filter - An optional object containing filter criteria.
|
|
818
|
-
* The keys of the object represent the classification system names,
|
|
819
|
-
* and the values are arrays of class names to match.
|
|
820
|
-
*
|
|
821
|
-
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
822
|
-
* where the express IDs are filtered based on the provided filter criteria.
|
|
823
|
-
*
|
|
824
|
-
* @throws Will throw an error if the fragments map is malformed.
|
|
825
|
-
*/
|
|
826
|
-
find(filter?: {
|
|
827
|
-
[name: string]: string[];
|
|
828
|
-
}): FRAGS.FragmentIdMap;
|
|
829
|
-
/**
|
|
830
|
-
* Classifies fragments based on their modelID.
|
|
831
|
-
*
|
|
832
|
-
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
833
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
834
|
-
*
|
|
835
|
-
* @remarks
|
|
836
|
-
* This method iterates through the fragments in the provided group,
|
|
837
|
-
* and classifies them based on their modelID.
|
|
838
|
-
* The classification is stored in the 'list.models' property,
|
|
839
|
-
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
840
|
-
*
|
|
841
|
-
*/
|
|
842
|
-
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
843
679
|
/**
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
847
|
-
*
|
|
848
|
-
* @remarks
|
|
849
|
-
* This method iterates through the properties of the fragments in the provided group,
|
|
850
|
-
* and classifies them based on their PredefinedType property.
|
|
851
|
-
* The classification is stored in the 'list.predefinedTypes' property,
|
|
852
|
-
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
680
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
853
681
|
*
|
|
854
|
-
* @
|
|
682
|
+
* @param point - The point from which to calculate the distance.
|
|
683
|
+
* @param lineStart - The start point of the line segment.
|
|
684
|
+
* @param lineEnd - The end point of the line segment.
|
|
685
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
686
|
+
* @returns The distance from the point to the line segment.
|
|
855
687
|
*/
|
|
856
|
-
|
|
688
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
857
689
|
/**
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
861
|
-
*
|
|
862
|
-
* @remarks
|
|
863
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
864
|
-
* and classifies them based on their entity type.
|
|
865
|
-
* The classification is stored in the 'list.entities' property,
|
|
866
|
-
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
690
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
691
|
+
* It also returns the edges of the found face and their indices.
|
|
867
692
|
*
|
|
868
|
-
* @
|
|
693
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
694
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
695
|
+
* @param instance - The instance of the mesh (optional).
|
|
696
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
869
697
|
*/
|
|
870
|
-
|
|
698
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
699
|
+
edges: MeasureEdge[];
|
|
700
|
+
indices: Set<number>;
|
|
701
|
+
} | null;
|
|
871
702
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
875
|
-
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
876
|
-
* @param systemName - The name of the classification system to store the classification.
|
|
877
|
-
*
|
|
878
|
-
* @remarks
|
|
879
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
880
|
-
* and classifies them based on the specified IFC relationship.
|
|
881
|
-
* The classification is stored in the 'list' property under the specified system name,
|
|
882
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
703
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
704
|
+
* It also applies instance transformation if provided.
|
|
883
705
|
*
|
|
884
|
-
* @
|
|
706
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
707
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
708
|
+
* @param instance - The instance of the mesh (optional).
|
|
709
|
+
* @returns An object containing the vertices and normal of the face.
|
|
710
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
885
711
|
*/
|
|
886
|
-
|
|
712
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
713
|
+
p1: THREE.Vector3;
|
|
714
|
+
p2: THREE.Vector3;
|
|
715
|
+
p3: THREE.Vector3;
|
|
716
|
+
faceNormal: THREE.Vector3;
|
|
717
|
+
};
|
|
887
718
|
/**
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
891
|
-
* @param config - The configuration for the classifier. It includes "useProperties", which is true by default
|
|
892
|
-
* (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
|
|
893
|
-
* the classifier just pick the WEBIFC categories provided.
|
|
894
|
-
*
|
|
895
|
-
* @remarks
|
|
896
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
897
|
-
* and classifies them based on their spatial structure in the IFC model.
|
|
898
|
-
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
899
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
719
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
720
|
+
* This is used to ensure numerical precision in edge detection.
|
|
900
721
|
*
|
|
901
|
-
* @
|
|
722
|
+
* @param vector - The vector to round.
|
|
723
|
+
* @returns The vector with rounded components.
|
|
902
724
|
*/
|
|
903
|
-
|
|
904
|
-
useProperties?: boolean;
|
|
905
|
-
isolate?: Set<number>;
|
|
906
|
-
}): Promise<void>;
|
|
725
|
+
round(vector: THREE.Vector3): void;
|
|
907
726
|
/**
|
|
908
|
-
*
|
|
727
|
+
* Calculates the volume of a set of fragments.
|
|
909
728
|
*
|
|
910
|
-
* @param
|
|
911
|
-
* @
|
|
912
|
-
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
729
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
730
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
913
731
|
*
|
|
914
732
|
* @remarks
|
|
915
|
-
* This method
|
|
916
|
-
*
|
|
733
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
734
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
917
735
|
*
|
|
918
|
-
* @throws Will throw an error if the
|
|
736
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
737
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
919
738
|
*/
|
|
920
|
-
|
|
739
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
921
740
|
/**
|
|
922
|
-
*
|
|
741
|
+
* Calculates the total volume of a set of meshes.
|
|
923
742
|
*
|
|
924
|
-
* @param
|
|
743
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
744
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
925
745
|
*
|
|
926
746
|
* @remarks
|
|
927
|
-
* This method
|
|
928
|
-
* and
|
|
747
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
748
|
+
* and its bounding sphere.
|
|
929
749
|
*
|
|
930
|
-
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
931
750
|
*/
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
private static _pattern;
|
|
937
|
-
private static _lut;
|
|
938
|
-
static create(): string;
|
|
939
|
-
static validate(uuid: string): void;
|
|
751
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
752
|
+
private getFaceData;
|
|
753
|
+
private getVolumeOfMesh;
|
|
754
|
+
private getSignedVolumeOfTriangle;
|
|
940
755
|
}
|
|
941
|
-
import
|
|
942
|
-
import
|
|
943
|
-
import
|
|
944
|
-
import {
|
|
945
|
-
|
|
756
|
+
import * as WEBIFC from "web-ifc";
|
|
757
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
758
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
759
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
760
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
946
761
|
/**
|
|
947
|
-
*
|
|
762
|
+
* 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).
|
|
948
763
|
*/
|
|
949
|
-
export declare class
|
|
764
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
950
765
|
/**
|
|
951
766
|
* A unique identifier for the component.
|
|
952
767
|
* This UUID is used to register the component within the Components system.
|
|
953
768
|
*/
|
|
954
|
-
static readonly uuid: "
|
|
769
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
955
770
|
/** {@link Disposable.onDisposed} */
|
|
956
|
-
readonly onDisposed: Event<
|
|
957
|
-
/**
|
|
958
|
-
* Event triggered when fragments are loaded.
|
|
959
|
-
*/
|
|
960
|
-
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
771
|
+
readonly onDisposed: Event<string>;
|
|
961
772
|
/**
|
|
962
|
-
* Event triggered when
|
|
773
|
+
* Event triggered when relations for a model have been indexed.
|
|
774
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
775
|
+
*
|
|
776
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
777
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
778
|
+
* 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.
|
|
963
779
|
*/
|
|
964
|
-
readonly
|
|
965
|
-
|
|
966
|
-
|
|
780
|
+
readonly onRelationsIndexed: Event<{
|
|
781
|
+
modelID: string;
|
|
782
|
+
relationsMap: RelationsMap;
|
|
967
783
|
}>;
|
|
968
784
|
/**
|
|
969
|
-
*
|
|
970
|
-
* The key is
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
*
|
|
975
|
-
* The key is the group's unique identifier, and the value is the group itself.
|
|
785
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
786
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
787
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
788
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
789
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
790
|
+
* of entity relationships within a model.
|
|
976
791
|
*/
|
|
977
|
-
readonly
|
|
978
|
-
baseCoordinationModel: string;
|
|
979
|
-
baseCoordinationMatrix: THREE.Matrix4;
|
|
792
|
+
readonly relationMaps: ModelsRelationMap;
|
|
980
793
|
/** {@link Component.enabled} */
|
|
981
794
|
enabled: boolean;
|
|
982
|
-
private
|
|
795
|
+
private _relToAttributesMap;
|
|
796
|
+
private _inverseAttributes;
|
|
797
|
+
private _ifcRels;
|
|
798
|
+
constructor(components: Components);
|
|
799
|
+
private onFragmentsDisposed;
|
|
800
|
+
private indexRelations;
|
|
801
|
+
private getAttributeIndex;
|
|
983
802
|
/**
|
|
984
|
-
*
|
|
985
|
-
*
|
|
986
|
-
* @
|
|
803
|
+
* Adds a relation map to the model's relations map.
|
|
804
|
+
*
|
|
805
|
+
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
806
|
+
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
807
|
+
*
|
|
808
|
+
* @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
|
|
987
809
|
*/
|
|
988
|
-
|
|
989
|
-
constructor(components: Components);
|
|
990
|
-
/** {@link Disposable.dispose} */
|
|
991
|
-
dispose(): void;
|
|
810
|
+
setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
|
|
992
811
|
/**
|
|
993
|
-
*
|
|
994
|
-
* This method
|
|
995
|
-
*
|
|
812
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
813
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
814
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
996
815
|
*
|
|
997
|
-
*
|
|
816
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
817
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
818
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
819
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
820
|
+
* of entities that are related through that attribute.
|
|
821
|
+
*
|
|
822
|
+
* @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
|
|
823
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
824
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
825
|
+
* @throws An error if the model does not have properties loaded.
|
|
998
826
|
*/
|
|
999
|
-
|
|
827
|
+
process(model: FragmentsGroup): Promise<RelationsMap>;
|
|
1000
828
|
/**
|
|
1001
|
-
*
|
|
1002
|
-
*
|
|
1003
|
-
* @param
|
|
1004
|
-
* @param
|
|
1005
|
-
* @
|
|
1006
|
-
*
|
|
1007
|
-
* @returns The loaded FragmentsGroup.
|
|
829
|
+
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
830
|
+
*
|
|
831
|
+
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
832
|
+
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
833
|
+
* @returns A promise that resolves to the relations map for the processed model.
|
|
834
|
+
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
1008
835
|
*/
|
|
1009
|
-
|
|
1010
|
-
coordinate: boolean;
|
|
1011
|
-
name: string;
|
|
1012
|
-
properties: FRAGS.IfcProperties;
|
|
1013
|
-
relationsMap: RelationsMap;
|
|
1014
|
-
isStreamed?: boolean;
|
|
1015
|
-
}>): FragmentsGroup;
|
|
836
|
+
processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
|
|
1016
837
|
/**
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
838
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
839
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
840
|
+
* returning the IDs of related entities if a match is found.
|
|
841
|
+
*
|
|
842
|
+
* @param model The 'FragmentsGroup' model containing the entity.
|
|
843
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
844
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
845
|
+
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
846
|
+
* or the specified relation name is not indexed.
|
|
1020
847
|
*/
|
|
1021
|
-
|
|
848
|
+
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
|
|
1022
849
|
/**
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
850
|
+
* Serializes the relations of a given relation map into a JSON string.
|
|
851
|
+
* This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
|
|
852
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
853
|
+
* The resulting object is then serialized into a JSON string.
|
|
854
|
+
*
|
|
855
|
+
* @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
856
|
+
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
1026
857
|
*/
|
|
1027
|
-
|
|
1028
|
-
[modelID: string]: Set<number>;
|
|
1029
|
-
};
|
|
858
|
+
serializeRelations(relationMap: RelationsMap): string;
|
|
1030
859
|
/**
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
860
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
861
|
+
* This method iterates through the relations indexed for the given model,
|
|
862
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
863
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
864
|
+
* The resulting object is then serialized into a JSON string.
|
|
865
|
+
*
|
|
866
|
+
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
867
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
868
|
+
* If the model has no indexed relations, 'null' is returned.
|
|
1039
869
|
*/
|
|
1040
|
-
|
|
1041
|
-
[modelID: string]: Set<number>;
|
|
1042
|
-
}): FRAGS.FragmentIdMap;
|
|
870
|
+
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
1043
871
|
/**
|
|
1044
|
-
*
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
872
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
873
|
+
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
874
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
875
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
876
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1048
877
|
*
|
|
1049
|
-
* @
|
|
1050
|
-
*
|
|
878
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
879
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
1051
880
|
*/
|
|
1052
|
-
|
|
881
|
+
serializeAllRelations(): string;
|
|
1053
882
|
/**
|
|
1054
|
-
*
|
|
883
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
884
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
885
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
886
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
887
|
+
* of express IDs of entities related through that relation type.
|
|
1055
888
|
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
889
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
890
|
+
* @returns A 'Map' where the key is the express ID of an entity as a number, and the value
|
|
891
|
+
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
892
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
893
|
+
*/
|
|
894
|
+
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
895
|
+
/** {@link Disposable.dispose} */
|
|
896
|
+
dispose(): void;
|
|
897
|
+
/**
|
|
898
|
+
* Adds relations between an entity and other entities in a BIM model.
|
|
1060
899
|
*
|
|
1061
|
-
* @param
|
|
1062
|
-
*
|
|
900
|
+
* @param model - The BIM model to which the relations will be added.
|
|
901
|
+
* @param expressID - The expressID of the entity within the model.
|
|
902
|
+
* @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
|
|
903
|
+
* @param relIDs - The expressIDs of the related entities within the model.
|
|
1063
904
|
*
|
|
1064
|
-
* @
|
|
1065
|
-
* This should be a THREE.Matrix4 representing the object's transformation matrix.
|
|
905
|
+
* @throws An error if the relation name is not a valid relation name.
|
|
1066
906
|
*/
|
|
1067
|
-
|
|
907
|
+
addEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute, ...relIDs: number[]): void;
|
|
1068
908
|
/**
|
|
1069
|
-
*
|
|
909
|
+
* Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
|
|
1070
910
|
*
|
|
1071
|
-
* @param model
|
|
1072
|
-
* @param
|
|
911
|
+
* @param model The BIM model whose children to get.
|
|
912
|
+
* @param expressID The expressID of the item whose children to get.
|
|
913
|
+
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
1073
914
|
*
|
|
915
|
+
* @returns A 'Set' with the expressIDs of the found items.
|
|
1074
916
|
*/
|
|
1075
|
-
|
|
917
|
+
getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
|
|
1076
918
|
}
|
|
1077
919
|
import * as WEBIFC from "web-ifc";
|
|
1078
|
-
import {
|
|
1079
|
-
import {
|
|
920
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
921
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
1080
922
|
/**
|
|
1081
|
-
*
|
|
923
|
+
* Types for boolean properties in IFC schema.
|
|
1082
924
|
*/
|
|
1083
|
-
export
|
|
925
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
926
|
+
/**
|
|
927
|
+
* Types for string properties in IFC schema.
|
|
928
|
+
*/
|
|
929
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
930
|
+
/**
|
|
931
|
+
* Types for numeric properties in IFC schema.
|
|
932
|
+
*/
|
|
933
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
934
|
+
/**
|
|
935
|
+
* 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.
|
|
936
|
+
*/
|
|
937
|
+
export interface ChangeMap {
|
|
938
|
+
[modelID: string]: Set<number>;
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* 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.
|
|
942
|
+
*/
|
|
943
|
+
export interface AttributeListener {
|
|
944
|
+
[modelID: string]: {
|
|
945
|
+
[expressID: number]: {
|
|
946
|
+
[attributeName: string]: Event<String | Boolean | Number>;
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
952
|
+
*/
|
|
953
|
+
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
1084
954
|
/**
|
|
1085
955
|
* A unique identifier for the component.
|
|
1086
956
|
* This UUID is used to register the component within the Components system.
|
|
1087
957
|
*/
|
|
1088
|
-
static readonly uuid: "
|
|
958
|
+
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
959
|
+
/** {@link Disposable.onDisposed} */
|
|
960
|
+
readonly onDisposed: Event<string>;
|
|
1089
961
|
/**
|
|
1090
|
-
* Event triggered when
|
|
1091
|
-
* Contains the streamed geometry data and its buffer.
|
|
962
|
+
* Event triggered when a file is requested for export.
|
|
1092
963
|
*/
|
|
1093
|
-
readonly
|
|
1094
|
-
buffer: Uint8Array;
|
|
1095
|
-
data: StreamedGeometries;
|
|
1096
|
-
}>;
|
|
964
|
+
readonly onRequestFile: Event<unknown>;
|
|
1097
965
|
/**
|
|
1098
|
-
*
|
|
1099
|
-
* Contains the streamed assets.
|
|
966
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
1100
967
|
*/
|
|
1101
|
-
|
|
968
|
+
ifcToExport: ArrayBuffer | null;
|
|
1102
969
|
/**
|
|
1103
|
-
* Event triggered
|
|
1104
|
-
* Contains the progress percentage.
|
|
970
|
+
* Event triggered when an element is added to a Pset.
|
|
1105
971
|
*/
|
|
1106
|
-
readonly
|
|
972
|
+
readonly onElementToPset: Event<{
|
|
973
|
+
model: FragmentsGroup;
|
|
974
|
+
psetID: number;
|
|
975
|
+
elementID: number;
|
|
976
|
+
}>;
|
|
1107
977
|
/**
|
|
1108
|
-
* Event triggered when
|
|
1109
|
-
* Contains the loaded IFC file data.
|
|
978
|
+
* Event triggered when a property is added to a Pset.
|
|
1110
979
|
*/
|
|
1111
|
-
readonly
|
|
1112
|
-
|
|
1113
|
-
|
|
980
|
+
readonly onPropToPset: Event<{
|
|
981
|
+
model: FragmentsGroup;
|
|
982
|
+
psetID: number;
|
|
983
|
+
propID: number;
|
|
984
|
+
}>;
|
|
1114
985
|
/**
|
|
1115
|
-
*
|
|
986
|
+
* Event triggered when a Pset is removed.
|
|
1116
987
|
*/
|
|
1117
|
-
|
|
988
|
+
readonly onPsetRemoved: Event<{
|
|
989
|
+
model: FragmentsGroup;
|
|
990
|
+
psetID: number;
|
|
991
|
+
}>;
|
|
992
|
+
/**
|
|
993
|
+
* Event triggered when data in the model changes.
|
|
994
|
+
*/
|
|
995
|
+
readonly onDataChanged: Event<{
|
|
996
|
+
model: FragmentsGroup;
|
|
997
|
+
expressID: number;
|
|
998
|
+
}>;
|
|
999
|
+
/**
|
|
1000
|
+
* Configuration for the WebAssembly module.
|
|
1001
|
+
*/
|
|
1002
|
+
wasm: {
|
|
1003
|
+
path: string;
|
|
1004
|
+
absolute: boolean;
|
|
1005
|
+
};
|
|
1118
1006
|
/** {@link Component.enabled} */
|
|
1119
1007
|
enabled: boolean;
|
|
1120
1008
|
/**
|
|
1121
|
-
*
|
|
1009
|
+
* Map of attribute listeners.
|
|
1122
1010
|
*/
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
private _assets;
|
|
1133
|
-
private _meshesWithHoles;
|
|
1011
|
+
attributeListeners: AttributeListener;
|
|
1012
|
+
/**
|
|
1013
|
+
* The currently selected model.
|
|
1014
|
+
*/
|
|
1015
|
+
selectedModel?: FragmentsGroup;
|
|
1016
|
+
/**
|
|
1017
|
+
* Map of changed entities in the model.
|
|
1018
|
+
*/
|
|
1019
|
+
changeMap: ChangeMap;
|
|
1134
1020
|
constructor(components: Components);
|
|
1135
1021
|
/** {@link Disposable.dispose} */
|
|
1136
1022
|
dispose(): void;
|
|
1137
1023
|
/**
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1141
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1142
|
-
*
|
|
1143
|
-
* @remarks
|
|
1144
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
1024
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
1145
1025
|
*
|
|
1146
|
-
* @
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1149
|
-
* const rawBuffer = await response.arrayBuffer();
|
|
1150
|
-
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1151
|
-
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1152
|
-
* '''
|
|
1026
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
1027
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1028
|
+
* @returns The IFC schema associated with the given model.
|
|
1153
1029
|
*/
|
|
1154
|
-
|
|
1030
|
+
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
1155
1031
|
/**
|
|
1156
|
-
*
|
|
1032
|
+
* Method to set properties data in the model.
|
|
1157
1033
|
*
|
|
1158
|
-
* @param
|
|
1159
|
-
* @
|
|
1034
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
1035
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
1036
|
+
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1037
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
1160
1038
|
*
|
|
1161
|
-
* @
|
|
1162
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
1039
|
+
* @returns A promise that resolves when all the properties have been set.
|
|
1163
1040
|
*
|
|
1041
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
1164
1042
|
*/
|
|
1165
|
-
|
|
1166
|
-
private readIfcFile;
|
|
1167
|
-
private streamIfcFile;
|
|
1168
|
-
private streamAllGeometries;
|
|
1169
|
-
private cleanUp;
|
|
1170
|
-
private getMesh;
|
|
1171
|
-
private getGeometry;
|
|
1172
|
-
private streamAssets;
|
|
1173
|
-
private streamGeometries;
|
|
1174
|
-
}
|
|
1175
|
-
import * as WEBIFC from "web-ifc";
|
|
1176
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1177
|
-
import { IfcFragmentSettings } from "./src";
|
|
1178
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1179
|
-
/**
|
|
1180
|
-
* 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).
|
|
1181
|
-
*/
|
|
1182
|
-
export declare class IfcLoader extends Component implements Disposable {
|
|
1183
|
-
/**
|
|
1184
|
-
* A unique identifier for the component.
|
|
1185
|
-
* This UUID is used to register the component within the Components system.
|
|
1186
|
-
*/
|
|
1187
|
-
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1188
|
-
/** {@link Disposable.onDisposed} */
|
|
1189
|
-
readonly onDisposed: Event<string>;
|
|
1190
|
-
/**
|
|
1191
|
-
* An event triggered when the IFC file starts loading.
|
|
1192
|
-
*/
|
|
1193
|
-
readonly onIfcStartedLoading: Event<void>;
|
|
1043
|
+
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
1194
1044
|
/**
|
|
1195
|
-
*
|
|
1045
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
1046
|
+
*
|
|
1047
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1048
|
+
* @param name - The name of the Pset.
|
|
1049
|
+
* @param description - (Optional) The description of the Pset.
|
|
1050
|
+
*
|
|
1051
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1052
|
+
*
|
|
1053
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1054
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1196
1055
|
*/
|
|
1197
|
-
|
|
1056
|
+
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
1057
|
+
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
1058
|
+
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
1059
|
+
}>;
|
|
1198
1060
|
/**
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1061
|
+
* Removes a Property Set (Pset) from the given model.
|
|
1062
|
+
*
|
|
1063
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1064
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
1065
|
+
*
|
|
1066
|
+
* @returns A promise that resolves when all the Psets have been removed.
|
|
1067
|
+
*
|
|
1068
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1069
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1070
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1201
1071
|
*/
|
|
1202
|
-
|
|
1072
|
+
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
1203
1073
|
/**
|
|
1204
|
-
*
|
|
1074
|
+
* Creates a new single-value property of type string in the given model.
|
|
1075
|
+
*
|
|
1076
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1077
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
1078
|
+
* @param name - The name of the property.
|
|
1079
|
+
* @param value - The value of the property. Must be a string.
|
|
1080
|
+
*
|
|
1081
|
+
* @returns The newly created single-value property.
|
|
1082
|
+
*
|
|
1083
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1084
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1205
1085
|
*/
|
|
1206
|
-
|
|
1207
|
-
/** {@link Component.enabled} */
|
|
1208
|
-
enabled: boolean;
|
|
1209
|
-
private _material;
|
|
1210
|
-
private _spatialTree;
|
|
1211
|
-
private _metaData;
|
|
1212
|
-
private _fragmentInstances;
|
|
1213
|
-
private _civil;
|
|
1214
|
-
private _visitedFragments;
|
|
1215
|
-
private _materialT;
|
|
1216
|
-
constructor(components: Components);
|
|
1217
|
-
/** {@link Disposable.dispose} */
|
|
1218
|
-
dispose(): void;
|
|
1086
|
+
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1219
1087
|
/**
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
* @param config - Optional configuration settings for the IfcLoader.
|
|
1223
|
-
* If not provided, the existing settings will be used.
|
|
1088
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
1224
1089
|
*
|
|
1225
|
-
* @
|
|
1090
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1091
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
1092
|
+
* @param name - The name of the property.
|
|
1093
|
+
* @param value - The value of the property. Must be a number.
|
|
1226
1094
|
*
|
|
1227
|
-
* @
|
|
1228
|
-
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1229
|
-
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
1095
|
+
* @returns The newly created single-value property.
|
|
1230
1096
|
*
|
|
1231
|
-
* @
|
|
1232
|
-
*
|
|
1233
|
-
* const ifcLoader = new IfcLoader(components);
|
|
1234
|
-
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1235
|
-
* '''
|
|
1097
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1098
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1236
1099
|
*/
|
|
1237
|
-
|
|
1100
|
+
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1238
1101
|
/**
|
|
1239
|
-
*
|
|
1102
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
1240
1103
|
*
|
|
1241
|
-
* @param
|
|
1242
|
-
* @param
|
|
1104
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1105
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
1106
|
+
* @param name - The name of the property.
|
|
1107
|
+
* @param value - The value of the property. Must be a boolean.
|
|
1243
1108
|
*
|
|
1244
|
-
* @returns
|
|
1109
|
+
* @returns The newly created single-value property.
|
|
1245
1110
|
*
|
|
1246
|
-
* @
|
|
1247
|
-
*
|
|
1248
|
-
* const ifcLoader = components.get(IfcLoader);
|
|
1249
|
-
* const group = await ifcLoader.load(ifcData);
|
|
1250
|
-
* '''
|
|
1111
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1112
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1251
1113
|
*/
|
|
1252
|
-
|
|
1114
|
+
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1253
1115
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1116
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
1257
1117
|
*
|
|
1258
|
-
* @
|
|
1118
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
1119
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
1120
|
+
* @param propID - The express ID of the property to be removed.
|
|
1259
1121
|
*
|
|
1260
|
-
* @
|
|
1261
|
-
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1262
|
-
* It also opens the IFC model using the provided data and settings.
|
|
1122
|
+
* @returns A promise that resolves when the property has been removed.
|
|
1263
1123
|
*
|
|
1264
|
-
* @
|
|
1265
|
-
* ''
|
|
1266
|
-
* const ifcLoader = components.get(IfcLoader);
|
|
1267
|
-
* await ifcLoader.readIfcFile(ifcData);
|
|
1268
|
-
* '''
|
|
1124
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
1125
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1269
1126
|
*/
|
|
1270
|
-
|
|
1127
|
+
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
1128
|
+
addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
|
|
1271
1129
|
/**
|
|
1272
|
-
*
|
|
1273
|
-
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1130
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
1274
1131
|
*
|
|
1275
|
-
* @
|
|
1276
|
-
*
|
|
1132
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
1133
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
1134
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
1277
1135
|
*
|
|
1278
|
-
* @
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
*/
|
|
1284
|
-
cleanUp(): void;
|
|
1285
|
-
private getAllGeometries;
|
|
1286
|
-
private getMesh;
|
|
1287
|
-
private getGeometry;
|
|
1288
|
-
private autoSetWasm;
|
|
1289
|
-
}
|
|
1290
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1291
|
-
import { Components, Component } from "../../core";
|
|
1292
|
-
/**
|
|
1293
|
-
* 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).
|
|
1294
|
-
*/
|
|
1295
|
-
export declare class Hider extends Component {
|
|
1296
|
-
/**
|
|
1297
|
-
* A unique identifier for the component.
|
|
1298
|
-
* This UUID is used to register the component within the Components system.
|
|
1136
|
+
* @returns A promise that resolves when all the elements have been added.
|
|
1137
|
+
*
|
|
1138
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
1139
|
+
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
1140
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1299
1141
|
*/
|
|
1300
|
-
|
|
1301
|
-
/** {@link Component.enabled} */
|
|
1302
|
-
enabled: boolean;
|
|
1303
|
-
constructor(components: Components);
|
|
1142
|
+
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
1304
1143
|
/**
|
|
1305
|
-
*
|
|
1306
|
-
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
1307
|
-
* If 'items' is provided, only the specified fragments will be affected.
|
|
1144
|
+
* Saves the changes made to the model to a new IFC file.
|
|
1308
1145
|
*
|
|
1309
|
-
* @param
|
|
1310
|
-
* @param
|
|
1311
|
-
* If not provided, all fragments will be affected.
|
|
1146
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
1147
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
1312
1148
|
*
|
|
1313
|
-
* @returns
|
|
1149
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
1150
|
+
*
|
|
1151
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
1314
1152
|
*/
|
|
1315
|
-
|
|
1153
|
+
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
1316
1154
|
/**
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1155
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
1156
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
1319
1157
|
*
|
|
1320
|
-
* @param
|
|
1321
|
-
*
|
|
1158
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
1159
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
1160
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
1322
1161
|
*
|
|
1323
|
-
* @returns
|
|
1162
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
1163
|
+
*
|
|
1164
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
1165
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
1166
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
1324
1167
|
*/
|
|
1325
|
-
|
|
1326
|
-
private
|
|
1168
|
+
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
1169
|
+
private increaseMaxID;
|
|
1170
|
+
private newGUID;
|
|
1171
|
+
private getOwnerHistory;
|
|
1172
|
+
private registerChange;
|
|
1173
|
+
private newSingleProperty;
|
|
1327
1174
|
}
|
|
1328
1175
|
import * as WEBIFC from "web-ifc";
|
|
1329
|
-
import
|
|
1330
|
-
import {
|
|
1176
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1177
|
+
import { Component, Components } from "../../core";
|
|
1331
1178
|
/**
|
|
1332
|
-
*
|
|
1179
|
+
* 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).
|
|
1333
1180
|
*/
|
|
1334
|
-
export declare class
|
|
1181
|
+
export declare class IfcJsonExporter extends Component {
|
|
1335
1182
|
/**
|
|
1336
1183
|
* A unique identifier for the component.
|
|
1337
1184
|
* This UUID is used to register the component within the Components system.
|
|
1338
1185
|
*/
|
|
1339
|
-
static readonly uuid: "
|
|
1340
|
-
/**
|
|
1341
|
-
* An event that is triggered when properties are streamed from the IFC file.
|
|
1342
|
-
* The event provides the type of the IFC entity and the corresponding data.
|
|
1343
|
-
*/
|
|
1344
|
-
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1345
|
-
type: number;
|
|
1346
|
-
data: {
|
|
1347
|
-
[id: number]: any;
|
|
1348
|
-
};
|
|
1349
|
-
}>;
|
|
1350
|
-
/**
|
|
1351
|
-
* An event that is triggered to indicate the progress of the streaming process.
|
|
1352
|
-
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1353
|
-
*/
|
|
1354
|
-
readonly onProgress: AsyncEvent<number>;
|
|
1355
|
-
/**
|
|
1356
|
-
* An event that is triggered when indices are streamed from the IFC file.
|
|
1357
|
-
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1358
|
-
*/
|
|
1359
|
-
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1360
|
-
/** {@link Disposable.onDisposed} */
|
|
1361
|
-
readonly onDisposed: Event<string>;
|
|
1186
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1362
1187
|
/** {@link Component.enabled} */
|
|
1363
1188
|
enabled: boolean;
|
|
1189
|
+
constructor(components: Components);
|
|
1364
1190
|
/**
|
|
1365
|
-
*
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
*
|
|
1370
|
-
|
|
1371
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1372
|
-
/** {@link Disposable.dispose} */
|
|
1373
|
-
dispose(): Promise<void>;
|
|
1374
|
-
/**
|
|
1375
|
-
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1376
|
-
*
|
|
1377
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1378
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1379
|
-
*/
|
|
1380
|
-
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1381
|
-
/**
|
|
1382
|
-
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1383
|
-
*
|
|
1384
|
-
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1385
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1191
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
1192
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1193
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
1194
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
1195
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1196
|
+
* to make the location data available (e.g. absolute position of building).
|
|
1386
1197
|
*/
|
|
1387
|
-
|
|
1388
|
-
private readIfcFile;
|
|
1389
|
-
private streamIfcFile;
|
|
1390
|
-
private streamAllProperties;
|
|
1391
|
-
private cleanUp;
|
|
1198
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1392
1199
|
}
|
|
1393
1200
|
import * as THREE from "three";
|
|
1394
1201
|
import { Component, Components, Disposable, Event, World } from "../core";
|
|
@@ -1506,50 +1313,93 @@ export declare class VertexPicker extends Component implements Disposable {
|
|
|
1506
1313
|
private getVertices;
|
|
1507
1314
|
private getVertex;
|
|
1508
1315
|
}
|
|
1509
|
-
import
|
|
1510
|
-
import { Components } from "../Components";
|
|
1511
|
-
import { Component } from "../Types";
|
|
1316
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
1512
1317
|
/**
|
|
1513
|
-
*
|
|
1318
|
+
* 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).
|
|
1514
1319
|
*/
|
|
1515
|
-
export declare class
|
|
1516
|
-
private _disposedComponents;
|
|
1517
|
-
/** {@link Component.enabled} */
|
|
1518
|
-
enabled: boolean;
|
|
1320
|
+
export declare class Exploder extends Component implements Disposable {
|
|
1519
1321
|
/**
|
|
1520
1322
|
* A unique identifier for the component.
|
|
1521
1323
|
* This UUID is used to register the component within the Components system.
|
|
1522
1324
|
*/
|
|
1523
|
-
static readonly uuid: "
|
|
1524
|
-
|
|
1325
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
1326
|
+
/** {@link Disposable.onDisposed} */
|
|
1327
|
+
readonly onDisposed: Event<unknown>;
|
|
1328
|
+
/** {@link Component.enabled} */
|
|
1329
|
+
enabled: boolean;
|
|
1525
1330
|
/**
|
|
1526
|
-
*
|
|
1331
|
+
* The height of the explosion animation.
|
|
1332
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1333
|
+
* Default value is 10.
|
|
1527
1334
|
*/
|
|
1528
|
-
|
|
1335
|
+
height: number;
|
|
1529
1336
|
/**
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1337
|
+
* The group name used for the explosion animation.
|
|
1338
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1339
|
+
* Default value is "storeys".
|
|
1340
|
+
*/
|
|
1341
|
+
groupName: string;
|
|
1342
|
+
/**
|
|
1343
|
+
* A set of strings representing the exploded items.
|
|
1344
|
+
* This set is used to keep track of which items have been exploded.
|
|
1345
|
+
*/
|
|
1346
|
+
list: Set<string>;
|
|
1347
|
+
constructor(components: Components);
|
|
1348
|
+
/** {@link Disposable.dispose} */
|
|
1349
|
+
dispose(): void;
|
|
1350
|
+
/**
|
|
1351
|
+
* Sets the explosion state of the fragments.
|
|
1533
1352
|
*
|
|
1534
|
-
* @param
|
|
1535
|
-
* to remove.
|
|
1353
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
1536
1354
|
*
|
|
1537
|
-
* @
|
|
1355
|
+
* @remarks
|
|
1356
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
1357
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1358
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
1538
1359
|
*
|
|
1539
|
-
*
|
|
1360
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
1361
|
+
*
|
|
1362
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
1540
1363
|
*/
|
|
1541
|
-
|
|
1364
|
+
set(active: boolean): void;
|
|
1365
|
+
}
|
|
1366
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1367
|
+
import { Components, Component } from "../../core";
|
|
1368
|
+
/**
|
|
1369
|
+
* 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).
|
|
1370
|
+
*/
|
|
1371
|
+
export declare class Hider extends Component {
|
|
1542
1372
|
/**
|
|
1543
|
-
*
|
|
1373
|
+
* A unique identifier for the component.
|
|
1374
|
+
* This UUID is used to register the component within the Components system.
|
|
1375
|
+
*/
|
|
1376
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
1377
|
+
/** {@link Component.enabled} */
|
|
1378
|
+
enabled: boolean;
|
|
1379
|
+
constructor(components: Components);
|
|
1380
|
+
/**
|
|
1381
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
1382
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
1383
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
1544
1384
|
*
|
|
1545
|
-
* @param
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1385
|
+
* @param visible - The visibility state to set for the fragments.
|
|
1386
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
1387
|
+
* If not provided, all fragments will be affected.
|
|
1388
|
+
*
|
|
1389
|
+
* @returns {void}
|
|
1548
1390
|
*/
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1391
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
1392
|
+
/**
|
|
1393
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
1394
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
1395
|
+
*
|
|
1396
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
1397
|
+
* If not provided, all fragments will be isolated.
|
|
1398
|
+
*
|
|
1399
|
+
* @returns {void}
|
|
1400
|
+
*/
|
|
1401
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
1402
|
+
private updateCulledVisibility;
|
|
1553
1403
|
}
|
|
1554
1404
|
import * as THREE from "three";
|
|
1555
1405
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -1760,456 +1610,647 @@ export declare class BoundingBoxer extends Component implements Disposable {
|
|
|
1760
1610
|
private static getFragmentBounds;
|
|
1761
1611
|
}
|
|
1762
1612
|
import * as WEBIFC from "web-ifc";
|
|
1763
|
-
import * as
|
|
1764
|
-
import {
|
|
1613
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1614
|
+
import { IfcFragmentSettings } from "./src";
|
|
1615
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1765
1616
|
/**
|
|
1766
|
-
*
|
|
1617
|
+
* 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).
|
|
1767
1618
|
*/
|
|
1768
|
-
export declare class
|
|
1619
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
1769
1620
|
/**
|
|
1770
1621
|
* A unique identifier for the component.
|
|
1771
1622
|
* This UUID is used to register the component within the Components system.
|
|
1772
1623
|
*/
|
|
1773
|
-
static readonly uuid: "
|
|
1774
|
-
/** {@link
|
|
1775
|
-
|
|
1776
|
-
constructor(components: Components);
|
|
1624
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1625
|
+
/** {@link Disposable.onDisposed} */
|
|
1626
|
+
readonly onDisposed: Event<string>;
|
|
1777
1627
|
/**
|
|
1778
|
-
*
|
|
1779
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1780
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
1781
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
1782
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1783
|
-
* to make the location data available (e.g. absolute position of building).
|
|
1628
|
+
* An event triggered when the IFC file starts loading.
|
|
1784
1629
|
*/
|
|
1785
|
-
|
|
1630
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1631
|
+
/**
|
|
1632
|
+
* An event triggered when the setup process is completed.
|
|
1633
|
+
*/
|
|
1634
|
+
readonly onSetup: Event<void>;
|
|
1635
|
+
/**
|
|
1636
|
+
* The settings for the IfcLoader.
|
|
1637
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1638
|
+
*/
|
|
1639
|
+
settings: IfcFragmentSettings;
|
|
1640
|
+
/**
|
|
1641
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
1642
|
+
*/
|
|
1643
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1644
|
+
/** {@link Component.enabled} */
|
|
1645
|
+
enabled: boolean;
|
|
1646
|
+
private _material;
|
|
1647
|
+
private _spatialTree;
|
|
1648
|
+
private _metaData;
|
|
1649
|
+
private _fragmentInstances;
|
|
1650
|
+
private _civil;
|
|
1651
|
+
private _visitedFragments;
|
|
1652
|
+
private _materialT;
|
|
1653
|
+
constructor(components: Components);
|
|
1654
|
+
/** {@link Disposable.dispose} */
|
|
1655
|
+
dispose(): void;
|
|
1656
|
+
/**
|
|
1657
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
1658
|
+
*
|
|
1659
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
1660
|
+
* If not provided, the existing settings will be used.
|
|
1661
|
+
*
|
|
1662
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
1663
|
+
*
|
|
1664
|
+
* @remarks
|
|
1665
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1666
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
1667
|
+
*
|
|
1668
|
+
* @example
|
|
1669
|
+
* '''typescript
|
|
1670
|
+
* const ifcLoader = new IfcLoader(components);
|
|
1671
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1672
|
+
* '''
|
|
1673
|
+
*/
|
|
1674
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
1677
|
+
*
|
|
1678
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1679
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
1680
|
+
*
|
|
1681
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
1682
|
+
*
|
|
1683
|
+
* @example
|
|
1684
|
+
* '''typescript
|
|
1685
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1686
|
+
* const group = await ifcLoader.load(ifcData);
|
|
1687
|
+
* '''
|
|
1688
|
+
*/
|
|
1689
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
1690
|
+
/**
|
|
1691
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
1692
|
+
*
|
|
1693
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1694
|
+
*
|
|
1695
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
1696
|
+
*
|
|
1697
|
+
* @remarks
|
|
1698
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1699
|
+
* It also opens the IFC model using the provided data and settings.
|
|
1700
|
+
*
|
|
1701
|
+
* @example
|
|
1702
|
+
* '''typescript
|
|
1703
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1704
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
1705
|
+
* '''
|
|
1706
|
+
*/
|
|
1707
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
1710
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1711
|
+
*
|
|
1712
|
+
* @remarks
|
|
1713
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
1714
|
+
*
|
|
1715
|
+
* @example
|
|
1716
|
+
* '''typescript
|
|
1717
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1718
|
+
* ifcLoader.cleanUp();
|
|
1719
|
+
* '''
|
|
1720
|
+
*/
|
|
1721
|
+
cleanUp(): void;
|
|
1722
|
+
private getAllGeometries;
|
|
1723
|
+
private getMesh;
|
|
1724
|
+
private getGeometry;
|
|
1725
|
+
private autoSetWasm;
|
|
1786
1726
|
}
|
|
1787
|
-
import
|
|
1788
|
-
import
|
|
1789
|
-
import
|
|
1790
|
-
import {
|
|
1791
|
-
|
|
1727
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1728
|
+
import * as THREE from "three";
|
|
1729
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1730
|
+
import { Component, Components, Event, Disposable, DataMap } from "../../core";
|
|
1731
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1792
1732
|
/**
|
|
1793
|
-
*
|
|
1733
|
+
* 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).
|
|
1794
1734
|
*/
|
|
1795
|
-
export declare class
|
|
1735
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
1796
1736
|
/**
|
|
1797
1737
|
* A unique identifier for the component.
|
|
1798
1738
|
* This UUID is used to register the component within the Components system.
|
|
1799
1739
|
*/
|
|
1800
|
-
static readonly uuid: "
|
|
1740
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1801
1741
|
/** {@link Disposable.onDisposed} */
|
|
1802
|
-
readonly onDisposed: Event<
|
|
1742
|
+
readonly onDisposed: Event<unknown>;
|
|
1803
1743
|
/**
|
|
1804
|
-
* Event triggered when
|
|
1805
|
-
* This event provides the model's UUID and the relations map generated for that model.
|
|
1806
|
-
*
|
|
1807
|
-
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
1808
|
-
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
1809
|
-
* 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.
|
|
1744
|
+
* Event triggered when fragments are loaded.
|
|
1810
1745
|
*/
|
|
1811
|
-
readonly
|
|
1812
|
-
|
|
1813
|
-
|
|
1746
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Event triggered when fragments are disposed.
|
|
1749
|
+
*/
|
|
1750
|
+
readonly onFragmentsDisposed: Event<{
|
|
1751
|
+
groupID: string;
|
|
1752
|
+
fragmentIDs: string[];
|
|
1814
1753
|
}>;
|
|
1815
1754
|
/**
|
|
1816
|
-
*
|
|
1817
|
-
* The
|
|
1818
|
-
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
1819
|
-
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
1820
|
-
* that are related through that relation type. This structure allows for efficient querying
|
|
1821
|
-
* of entity relationships within a model.
|
|
1755
|
+
* DataMap containing all loaded fragments.
|
|
1756
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1822
1757
|
*/
|
|
1823
|
-
readonly
|
|
1758
|
+
readonly list: DataMap<string, Fragment>;
|
|
1759
|
+
/**
|
|
1760
|
+
* DataMap containing all loaded fragment groups.
|
|
1761
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1762
|
+
*/
|
|
1763
|
+
readonly groups: DataMap<string, FragmentsGroup>;
|
|
1764
|
+
baseCoordinationModel: string;
|
|
1765
|
+
baseCoordinationMatrix: THREE.Matrix4;
|
|
1824
1766
|
/** {@link Component.enabled} */
|
|
1825
1767
|
enabled: boolean;
|
|
1826
|
-
private
|
|
1827
|
-
|
|
1828
|
-
|
|
1768
|
+
private _loader;
|
|
1769
|
+
/**
|
|
1770
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1771
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1772
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1773
|
+
*/
|
|
1774
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1829
1775
|
constructor(components: Components);
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
private getAttributeIndex;
|
|
1776
|
+
/** {@link Disposable.dispose} */
|
|
1777
|
+
dispose(): void;
|
|
1833
1778
|
/**
|
|
1834
|
-
*
|
|
1779
|
+
* Dispose of a specific fragment group.
|
|
1780
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1781
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1835
1782
|
*
|
|
1836
|
-
* @param
|
|
1837
|
-
|
|
1783
|
+
* @param group - The fragment group to be disposed.
|
|
1784
|
+
*/
|
|
1785
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
1786
|
+
/**
|
|
1787
|
+
* Loads a binary file that contain fragment geometry.
|
|
1788
|
+
* @param data - The binary data to load.
|
|
1789
|
+
* @param config - Optional configuration for loading.
|
|
1790
|
+
* @param config.isStreamed - Optional setting to determine whether this model is streamed or not.
|
|
1791
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1792
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1793
|
+
* @returns The loaded FragmentsGroup.
|
|
1794
|
+
*/
|
|
1795
|
+
load(data: Uint8Array, config?: Partial<{
|
|
1796
|
+
coordinate: boolean;
|
|
1797
|
+
name: string;
|
|
1798
|
+
properties: FRAGS.IfcProperties;
|
|
1799
|
+
relationsMap: RelationsMap;
|
|
1800
|
+
isStreamed?: boolean;
|
|
1801
|
+
}>): FragmentsGroup;
|
|
1802
|
+
/**
|
|
1803
|
+
* Export the specified fragmentsgroup to binary data.
|
|
1804
|
+
* @param group - the fragments group to be exported.
|
|
1805
|
+
* @returns the exported data as binary buffer.
|
|
1806
|
+
*/
|
|
1807
|
+
export(group: FragmentsGroup): Uint8Array;
|
|
1808
|
+
/**
|
|
1809
|
+
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1810
|
+
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1811
|
+
* @returns A map of model IDs to sets of express IDs.
|
|
1812
|
+
*/
|
|
1813
|
+
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1814
|
+
[modelID: string]: Set<number>;
|
|
1815
|
+
};
|
|
1816
|
+
/**
|
|
1817
|
+
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1818
|
+
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1819
|
+
* @returns A fragment ID map.
|
|
1820
|
+
* @remarks
|
|
1821
|
+
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1822
|
+
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1823
|
+
* The fragment ID maps are then merged into a single map and returned.
|
|
1824
|
+
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1825
|
+
*/
|
|
1826
|
+
modelIdToFragmentIdMap(modelIdMap: {
|
|
1827
|
+
[modelID: string]: Set<number>;
|
|
1828
|
+
}): FRAGS.FragmentIdMap;
|
|
1829
|
+
/**
|
|
1830
|
+
* Applies coordinate transformation to the provided models.
|
|
1831
|
+
* If no models are provided, all groups are used.
|
|
1832
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
1833
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
1838
1834
|
*
|
|
1839
|
-
* @
|
|
1835
|
+
* @param models - The models to apply coordinate transformation to.
|
|
1836
|
+
* If not provided, all models are used.
|
|
1840
1837
|
*/
|
|
1841
|
-
|
|
1838
|
+
coordinate(models?: FragmentsGroup[]): void;
|
|
1842
1839
|
/**
|
|
1843
|
-
*
|
|
1844
|
-
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
1845
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
1840
|
+
* Applies the base coordinate system to the provided object.
|
|
1846
1841
|
*
|
|
1847
|
-
*
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1851
|
-
* of entities that are related through that attribute.
|
|
1842
|
+
* This function takes an object and its original coordinate system as input.
|
|
1843
|
+
* It then inverts the original coordinate system and applies the base coordinate system
|
|
1844
|
+
* to the object. This ensures that the object's position, rotation, and scale are
|
|
1845
|
+
* transformed to match the base coordinate system (which is taken from the first model loaded).
|
|
1852
1846
|
*
|
|
1853
|
-
* @param
|
|
1854
|
-
*
|
|
1855
|
-
*
|
|
1856
|
-
* @
|
|
1847
|
+
* @param object - The object to which the base coordinate system will be applied.
|
|
1848
|
+
* This should be an instance of THREE.Object3D.
|
|
1849
|
+
*
|
|
1850
|
+
* @param originalCoordinateSystem - The original coordinate system of the object.
|
|
1851
|
+
* This should be a THREE.Matrix4 representing the object's transformation matrix.
|
|
1857
1852
|
*/
|
|
1858
|
-
|
|
1853
|
+
applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
|
|
1859
1854
|
/**
|
|
1860
|
-
*
|
|
1855
|
+
* Creates a copy of the whole model or a part of it.
|
|
1856
|
+
*
|
|
1857
|
+
* @param model - The model to clone.
|
|
1858
|
+
* @param items - Optional - The part of the model to be cloned. If not given, the whole group is cloned.
|
|
1861
1859
|
*
|
|
1862
|
-
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
1863
|
-
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1864
|
-
* @returns A promise that resolves to the relations map for the processed model.
|
|
1865
|
-
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
1866
1860
|
*/
|
|
1867
|
-
|
|
1861
|
+
clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
|
|
1862
|
+
}
|
|
1863
|
+
import * as WEBIFC from "web-ifc";
|
|
1864
|
+
import { Components, Disposable, Event, Component } from "../../core";
|
|
1865
|
+
import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
|
|
1866
|
+
/**
|
|
1867
|
+
* 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).
|
|
1868
|
+
*/
|
|
1869
|
+
export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
1868
1870
|
/**
|
|
1869
|
-
*
|
|
1870
|
-
* This
|
|
1871
|
-
* returning the IDs of related entities if a match is found.
|
|
1872
|
-
*
|
|
1873
|
-
* @param model The 'FragmentsGroup' model containing the entity.
|
|
1874
|
-
* @param expressID The unique identifier of the entity within the model.
|
|
1875
|
-
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1876
|
-
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1877
|
-
* or the specified relation name is not indexed.
|
|
1871
|
+
* A unique identifier for the component.
|
|
1872
|
+
* This UUID is used to register the component within the Components system.
|
|
1878
1873
|
*/
|
|
1879
|
-
|
|
1874
|
+
static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
|
|
1880
1875
|
/**
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
1883
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1884
|
-
* The resulting object is then serialized into a JSON string.
|
|
1885
|
-
*
|
|
1886
|
-
* @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
1887
|
-
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
1876
|
+
* Event triggered when geometry is streamed.
|
|
1877
|
+
* Contains the streamed geometry data and its buffer.
|
|
1888
1878
|
*/
|
|
1889
|
-
|
|
1879
|
+
readonly onGeometryStreamed: Event<{
|
|
1880
|
+
buffer: Uint8Array;
|
|
1881
|
+
data: StreamedGeometries;
|
|
1882
|
+
}>;
|
|
1890
1883
|
/**
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1893
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1894
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1895
|
-
* The resulting object is then serialized into a JSON string.
|
|
1896
|
-
*
|
|
1897
|
-
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1898
|
-
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1899
|
-
* If the model has no indexed relations, 'null' is returned.
|
|
1884
|
+
* Event triggered when assets are streamed.
|
|
1885
|
+
* Contains the streamed assets.
|
|
1900
1886
|
*/
|
|
1901
|
-
|
|
1887
|
+
readonly onAssetStreamed: Event<StreamedAsset[]>;
|
|
1902
1888
|
/**
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
1905
|
-
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1906
|
-
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1907
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1908
|
-
*
|
|
1909
|
-
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
1910
|
-
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
1889
|
+
* Event triggered to indicate the progress of the streaming process.
|
|
1890
|
+
* Contains the progress percentage.
|
|
1911
1891
|
*/
|
|
1912
|
-
|
|
1892
|
+
readonly onProgress: Event<number>;
|
|
1913
1893
|
/**
|
|
1914
|
-
*
|
|
1915
|
-
*
|
|
1916
|
-
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1917
|
-
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1918
|
-
* of express IDs of entities related through that relation type.
|
|
1919
|
-
*
|
|
1920
|
-
* @param json The JSON string to be parsed into the relations map.
|
|
1921
|
-
* @returns A 'Map' where the key is the express ID of an entity as a number, and the value
|
|
1922
|
-
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
1923
|
-
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
1894
|
+
* Event triggered when the IFC file is loaded.
|
|
1895
|
+
* Contains the loaded IFC file data.
|
|
1924
1896
|
*/
|
|
1925
|
-
|
|
1897
|
+
readonly onIfcLoaded: Event<Uint8Array>;
|
|
1898
|
+
/** {@link Disposable.onDisposed} */
|
|
1899
|
+
readonly onDisposed: Event<unknown>;
|
|
1900
|
+
/**
|
|
1901
|
+
* Settings for the IfcGeometryTiler.
|
|
1902
|
+
*/
|
|
1903
|
+
settings: IfcStreamingSettings;
|
|
1904
|
+
/** {@link Component.enabled} */
|
|
1905
|
+
enabled: boolean;
|
|
1906
|
+
/**
|
|
1907
|
+
* The WebIFC API instance used for IFC file processing.
|
|
1908
|
+
*/
|
|
1909
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1910
|
+
private _spatialTree;
|
|
1911
|
+
private _metaData;
|
|
1912
|
+
private _visitedGeometries;
|
|
1913
|
+
private _streamSerializer;
|
|
1914
|
+
private _geometries;
|
|
1915
|
+
private _geometryCount;
|
|
1916
|
+
private _civil;
|
|
1917
|
+
private _groupSerializer;
|
|
1918
|
+
private _assets;
|
|
1919
|
+
private _meshesWithHoles;
|
|
1920
|
+
constructor(components: Components);
|
|
1926
1921
|
/** {@link Disposable.dispose} */
|
|
1927
1922
|
dispose(): void;
|
|
1928
1923
|
/**
|
|
1929
|
-
*
|
|
1924
|
+
* This method streams the IFC file from a given buffer.
|
|
1930
1925
|
*
|
|
1931
|
-
* @param
|
|
1932
|
-
* @
|
|
1933
|
-
* @param relationName - The IFC schema inverse attribute of the relation to add (e.g., "IsDefinedBy", "ContainsElements").
|
|
1934
|
-
* @param relIDs - The expressIDs of the related entities within the model.
|
|
1926
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1927
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1935
1928
|
*
|
|
1936
|
-
* @
|
|
1929
|
+
* @remarks
|
|
1930
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1931
|
+
*
|
|
1932
|
+
* @example
|
|
1933
|
+
* '''typescript
|
|
1934
|
+
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1935
|
+
* const rawBuffer = await response.arrayBuffer();
|
|
1936
|
+
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1937
|
+
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1938
|
+
* '''
|
|
1937
1939
|
*/
|
|
1938
|
-
|
|
1940
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1939
1941
|
/**
|
|
1940
|
-
*
|
|
1942
|
+
* This method streams the IFC file from a given callback.
|
|
1941
1943
|
*
|
|
1942
|
-
* @param
|
|
1943
|
-
* @
|
|
1944
|
-
*
|
|
1944
|
+
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
1945
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1946
|
+
*
|
|
1947
|
+
* @remarks
|
|
1948
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1945
1949
|
*
|
|
1946
|
-
* @returns A 'Set' with the expressIDs of the found items.
|
|
1947
1950
|
*/
|
|
1948
|
-
|
|
1951
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1952
|
+
private readIfcFile;
|
|
1953
|
+
private streamIfcFile;
|
|
1954
|
+
private streamAllGeometries;
|
|
1955
|
+
private cleanUp;
|
|
1956
|
+
private getMesh;
|
|
1957
|
+
private getGeometry;
|
|
1958
|
+
private streamAssets;
|
|
1959
|
+
private streamGeometries;
|
|
1949
1960
|
}
|
|
1950
1961
|
import * as WEBIFC from "web-ifc";
|
|
1951
|
-
import {
|
|
1952
|
-
import {
|
|
1953
|
-
/**
|
|
1954
|
-
* Types for boolean properties in IFC schema.
|
|
1955
|
-
*/
|
|
1956
|
-
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1957
|
-
/**
|
|
1958
|
-
* Types for string properties in IFC schema.
|
|
1959
|
-
*/
|
|
1960
|
-
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
1961
|
-
/**
|
|
1962
|
-
* Types for numeric properties in IFC schema.
|
|
1963
|
-
*/
|
|
1964
|
-
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
1965
|
-
/**
|
|
1966
|
-
* 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.
|
|
1967
|
-
*/
|
|
1968
|
-
export interface ChangeMap {
|
|
1969
|
-
[modelID: string]: Set<number>;
|
|
1970
|
-
}
|
|
1971
|
-
/**
|
|
1972
|
-
* 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.
|
|
1973
|
-
*/
|
|
1974
|
-
export interface AttributeListener {
|
|
1975
|
-
[modelID: string]: {
|
|
1976
|
-
[expressID: number]: {
|
|
1977
|
-
[attributeName: string]: Event<String | Boolean | Number>;
|
|
1978
|
-
};
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1962
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1963
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1981
1964
|
/**
|
|
1982
|
-
*
|
|
1965
|
+
* 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).
|
|
1983
1966
|
*/
|
|
1984
|
-
export declare class
|
|
1967
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1985
1968
|
/**
|
|
1986
1969
|
* A unique identifier for the component.
|
|
1987
1970
|
* This UUID is used to register the component within the Components system.
|
|
1988
1971
|
*/
|
|
1989
|
-
static readonly uuid: "
|
|
1990
|
-
/** {@link Disposable.onDisposed} */
|
|
1991
|
-
readonly onDisposed: Event<string>;
|
|
1972
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1992
1973
|
/**
|
|
1993
|
-
*
|
|
1974
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1975
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1994
1976
|
*/
|
|
1995
|
-
readonly
|
|
1977
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1978
|
+
type: number;
|
|
1979
|
+
data: {
|
|
1980
|
+
[id: number]: any;
|
|
1981
|
+
};
|
|
1982
|
+
}>;
|
|
1996
1983
|
/**
|
|
1997
|
-
*
|
|
1984
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
1985
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1998
1986
|
*/
|
|
1999
|
-
|
|
1987
|
+
readonly onProgress: AsyncEvent<number>;
|
|
2000
1988
|
/**
|
|
2001
|
-
*
|
|
1989
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
1990
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
2002
1991
|
*/
|
|
2003
|
-
readonly
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
1992
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1993
|
+
/** {@link Disposable.onDisposed} */
|
|
1994
|
+
readonly onDisposed: Event<string>;
|
|
1995
|
+
/** {@link Component.enabled} */
|
|
1996
|
+
enabled: boolean;
|
|
2008
1997
|
/**
|
|
2009
|
-
*
|
|
1998
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
2010
1999
|
*/
|
|
2011
|
-
|
|
2012
|
-
model: FragmentsGroup;
|
|
2013
|
-
psetID: number;
|
|
2014
|
-
propID: number;
|
|
2015
|
-
}>;
|
|
2000
|
+
settings: PropertiesStreamingSettings;
|
|
2016
2001
|
/**
|
|
2017
|
-
*
|
|
2002
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
2018
2003
|
*/
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
}>;
|
|
2004
|
+
webIfc: WEBIFC.IfcAPI;
|
|
2005
|
+
/** {@link Disposable.dispose} */
|
|
2006
|
+
dispose(): Promise<void>;
|
|
2023
2007
|
/**
|
|
2024
|
-
*
|
|
2008
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
2009
|
+
*
|
|
2010
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
2011
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
2025
2012
|
*/
|
|
2026
|
-
|
|
2027
|
-
model: FragmentsGroup;
|
|
2028
|
-
expressID: number;
|
|
2029
|
-
}>;
|
|
2013
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
2030
2014
|
/**
|
|
2031
|
-
*
|
|
2015
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
2016
|
+
*
|
|
2017
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
2018
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
2032
2019
|
*/
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2020
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
2021
|
+
private readIfcFile;
|
|
2022
|
+
private streamIfcFile;
|
|
2023
|
+
private streamAllProperties;
|
|
2024
|
+
private cleanUp;
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* 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.
|
|
2028
|
+
*
|
|
2029
|
+
* @remarks
|
|
2030
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2031
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2032
|
+
*
|
|
2033
|
+
*/
|
|
2034
|
+
export declare const IfcElements: {
|
|
2035
|
+
[key: number]: string;
|
|
2036
|
+
};
|
|
2037
|
+
export declare class UUID {
|
|
2038
|
+
private static _pattern;
|
|
2039
|
+
private static _lut;
|
|
2040
|
+
static create(): string;
|
|
2041
|
+
static validate(uuid: string): void;
|
|
2042
|
+
}
|
|
2043
|
+
import * as THREE from "three";
|
|
2044
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2045
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
2046
|
+
/**
|
|
2047
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
2048
|
+
*/
|
|
2049
|
+
export interface Classification {
|
|
2039
2050
|
/**
|
|
2040
|
-
*
|
|
2051
|
+
* A system within the classification.
|
|
2052
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
2041
2053
|
*/
|
|
2042
|
-
|
|
2054
|
+
[system: string]: {
|
|
2055
|
+
/**
|
|
2056
|
+
* A class within the system.
|
|
2057
|
+
* The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
|
|
2058
|
+
*/
|
|
2059
|
+
[className: string]: {
|
|
2060
|
+
map: FRAGS.FragmentIdMap;
|
|
2061
|
+
name: string;
|
|
2062
|
+
id: number | null;
|
|
2063
|
+
};
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* 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).
|
|
2068
|
+
*/
|
|
2069
|
+
export declare class Classifier extends Component implements Disposable {
|
|
2043
2070
|
/**
|
|
2044
|
-
*
|
|
2071
|
+
* A unique identifier for the component.
|
|
2072
|
+
* This UUID is used to register the component within the Components system.
|
|
2045
2073
|
*/
|
|
2046
|
-
|
|
2074
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
2075
|
+
/** {@link Component.enabled} */
|
|
2076
|
+
enabled: boolean;
|
|
2047
2077
|
/**
|
|
2048
|
-
*
|
|
2078
|
+
* A map representing the classification systems.
|
|
2079
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
2049
2080
|
*/
|
|
2050
|
-
|
|
2081
|
+
list: Classification;
|
|
2082
|
+
/** {@link Disposable.onDisposed} */
|
|
2083
|
+
readonly onDisposed: Event<unknown>;
|
|
2051
2084
|
constructor(components: Components);
|
|
2085
|
+
private onFragmentsDisposed;
|
|
2052
2086
|
/** {@link Disposable.dispose} */
|
|
2053
2087
|
dispose(): void;
|
|
2054
2088
|
/**
|
|
2055
|
-
*
|
|
2056
|
-
*
|
|
2057
|
-
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
2058
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
2059
|
-
* @returns The IFC schema associated with the given model.
|
|
2060
|
-
*/
|
|
2061
|
-
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
2062
|
-
/**
|
|
2063
|
-
* Method to set properties data in the model.
|
|
2064
|
-
*
|
|
2065
|
-
* @param model - The FragmentsGroup model in which to set the properties.
|
|
2066
|
-
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
2067
|
-
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
2068
|
-
* The rest of the properties will be set as the properties of the entity.
|
|
2069
|
-
*
|
|
2070
|
-
* @returns A promise that resolves when all the properties have been set.
|
|
2071
|
-
*
|
|
2072
|
-
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
2073
|
-
*/
|
|
2074
|
-
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
2075
|
-
/**
|
|
2076
|
-
* Creates a new Property Set (Pset) in the given model.
|
|
2077
|
-
*
|
|
2078
|
-
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
2079
|
-
* @param name - The name of the Pset.
|
|
2080
|
-
* @param description - (Optional) The description of the Pset.
|
|
2081
|
-
*
|
|
2082
|
-
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
2089
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
2090
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
2083
2091
|
*
|
|
2084
|
-
* @
|
|
2085
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2092
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
2086
2093
|
*/
|
|
2087
|
-
|
|
2088
|
-
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
2089
|
-
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
2090
|
-
}>;
|
|
2094
|
+
remove(guid: string): void;
|
|
2091
2095
|
/**
|
|
2092
|
-
*
|
|
2096
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
2097
|
+
* If no filter is provided, it returns all fragments.
|
|
2093
2098
|
*
|
|
2094
|
-
* @param
|
|
2095
|
-
*
|
|
2099
|
+
* @param filter - An optional object containing filter criteria.
|
|
2100
|
+
* The keys of the object represent the classification system names,
|
|
2101
|
+
* and the values are arrays of class names to match.
|
|
2096
2102
|
*
|
|
2097
|
-
* @returns A
|
|
2103
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
2104
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
2098
2105
|
*
|
|
2099
|
-
* @throws Will throw an error if
|
|
2100
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
2101
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
2106
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
2102
2107
|
*/
|
|
2103
|
-
|
|
2108
|
+
find(filter?: {
|
|
2109
|
+
[name: string]: string[];
|
|
2110
|
+
}): FRAGS.FragmentIdMap;
|
|
2104
2111
|
/**
|
|
2105
|
-
*
|
|
2112
|
+
* Classifies fragments based on their modelID.
|
|
2106
2113
|
*
|
|
2107
|
-
* @param
|
|
2108
|
-
* @param
|
|
2109
|
-
* @param name - The name of the property.
|
|
2110
|
-
* @param value - The value of the property. Must be a string.
|
|
2114
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
2115
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
2111
2116
|
*
|
|
2112
|
-
* @
|
|
2117
|
+
* @remarks
|
|
2118
|
+
* This method iterates through the fragments in the provided group,
|
|
2119
|
+
* and classifies them based on their modelID.
|
|
2120
|
+
* The classification is stored in the 'list.models' property,
|
|
2121
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
2113
2122
|
*
|
|
2114
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
2115
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2116
2123
|
*/
|
|
2117
|
-
|
|
2124
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
2118
2125
|
/**
|
|
2119
|
-
*
|
|
2126
|
+
* Classifies fragments based on their PredefinedType property.
|
|
2120
2127
|
*
|
|
2121
|
-
* @param
|
|
2122
|
-
* @param type - The type of the property value. Must be a numeric property type.
|
|
2123
|
-
* @param name - The name of the property.
|
|
2124
|
-
* @param value - The value of the property. Must be a number.
|
|
2128
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
2125
2129
|
*
|
|
2126
|
-
* @
|
|
2130
|
+
* @remarks
|
|
2131
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
2132
|
+
* and classifies them based on their PredefinedType property.
|
|
2133
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
2134
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
2127
2135
|
*
|
|
2128
|
-
* @throws Will throw an error if the
|
|
2129
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2136
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
2130
2137
|
*/
|
|
2131
|
-
|
|
2138
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
2132
2139
|
/**
|
|
2133
|
-
*
|
|
2140
|
+
* Classifies fragments based on their entity type.
|
|
2134
2141
|
*
|
|
2135
|
-
* @param
|
|
2136
|
-
* @param type - The type of the property value. Must be a boolean property type.
|
|
2137
|
-
* @param name - The name of the property.
|
|
2138
|
-
* @param value - The value of the property. Must be a boolean.
|
|
2142
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
2139
2143
|
*
|
|
2140
|
-
* @
|
|
2144
|
+
* @remarks
|
|
2145
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
2146
|
+
* and classifies them based on their entity type.
|
|
2147
|
+
* The classification is stored in the 'list.entities' property,
|
|
2148
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
2141
2149
|
*
|
|
2142
|
-
* @throws Will throw an error if the
|
|
2143
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
2150
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
2144
2151
|
*/
|
|
2145
|
-
|
|
2152
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
2146
2153
|
/**
|
|
2147
|
-
*
|
|
2154
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
2148
2155
|
*
|
|
2149
|
-
* @param
|
|
2150
|
-
* @param
|
|
2151
|
-
* @param
|
|
2156
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
2157
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
2158
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
2152
2159
|
*
|
|
2153
|
-
* @
|
|
2160
|
+
* @remarks
|
|
2161
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
2162
|
+
* and classifies them based on the specified IFC relationship.
|
|
2163
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
2164
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
2154
2165
|
*
|
|
2155
|
-
* @throws Will throw an error if the
|
|
2156
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
2166
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
2157
2167
|
*/
|
|
2158
|
-
|
|
2159
|
-
addElementToPset(model: FragmentsGroup, psetID: number, ...expressIDs: number[]): Promise<void>;
|
|
2168
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
2160
2169
|
/**
|
|
2161
|
-
*
|
|
2170
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
2162
2171
|
*
|
|
2163
|
-
* @param model - The FragmentsGroup
|
|
2164
|
-
* @param
|
|
2165
|
-
*
|
|
2172
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
2173
|
+
* @param config - The configuration for the classifier. It includes "useProperties", which is true by default
|
|
2174
|
+
* (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
|
|
2175
|
+
* the classifier just pick the WEBIFC categories provided.
|
|
2166
2176
|
*
|
|
2167
|
-
* @
|
|
2177
|
+
* @remarks
|
|
2178
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
2179
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
2180
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
2181
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
2168
2182
|
*
|
|
2169
|
-
* @throws Will throw an error if the
|
|
2170
|
-
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
2171
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
2183
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
2172
2184
|
*/
|
|
2173
|
-
|
|
2185
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
|
|
2186
|
+
useProperties?: boolean;
|
|
2187
|
+
isolate?: Set<number>;
|
|
2188
|
+
}): Promise<void>;
|
|
2174
2189
|
/**
|
|
2175
|
-
*
|
|
2190
|
+
* Sets the color of the specified fragments.
|
|
2176
2191
|
*
|
|
2177
|
-
* @param
|
|
2178
|
-
* @param
|
|
2192
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
2193
|
+
* @param color - The color to set for the fragments.
|
|
2194
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
2179
2195
|
*
|
|
2180
|
-
* @
|
|
2196
|
+
* @remarks
|
|
2197
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
2198
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
2181
2199
|
*
|
|
2182
|
-
* @throws Will throw an error if
|
|
2200
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
2183
2201
|
*/
|
|
2184
|
-
|
|
2202
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
2185
2203
|
/**
|
|
2186
|
-
*
|
|
2187
|
-
* The listener will trigger an event whenever the attribute's value changes.
|
|
2204
|
+
* Resets the color of the specified fragments to their original color.
|
|
2188
2205
|
*
|
|
2189
|
-
* @param
|
|
2190
|
-
* @param expressID - The express ID of the entity for which to set the listener.
|
|
2191
|
-
* @param attributeName - The name of the attribute for which to set the listener.
|
|
2206
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
2192
2207
|
*
|
|
2193
|
-
* @
|
|
2208
|
+
* @remarks
|
|
2209
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
2210
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
2194
2211
|
*
|
|
2195
|
-
* @throws Will throw an error if the
|
|
2196
|
-
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
2197
|
-
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
2212
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
2198
2213
|
*/
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2214
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
2215
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
2216
|
+
}
|
|
2217
|
+
/**
|
|
2218
|
+
* 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.
|
|
2219
|
+
*/
|
|
2220
|
+
export declare const IfcCategoryMap: {
|
|
2221
|
+
[key: number]: string;
|
|
2222
|
+
};
|
|
2223
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2224
|
+
export declare class IfcPropertiesUtils {
|
|
2225
|
+
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2226
|
+
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2227
|
+
[attribute: string]: any;
|
|
2228
|
+
} | null>;
|
|
2229
|
+
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2230
|
+
[relatingID: number]: number[];
|
|
2231
|
+
}>;
|
|
2232
|
+
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2233
|
+
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2234
|
+
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2235
|
+
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2236
|
+
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2237
|
+
key: string | null;
|
|
2238
|
+
name: string | null;
|
|
2239
|
+
}>;
|
|
2240
|
+
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2241
|
+
key: string | null;
|
|
2242
|
+
value: number | null;
|
|
2243
|
+
}>;
|
|
2244
|
+
static isRel(expressID: number): boolean;
|
|
2245
|
+
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2246
|
+
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2205
2247
|
}
|
|
2206
2248
|
import * as WEBIFC from "web-ifc";
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
cleanUp(): void;
|
|
2249
|
+
export interface IfcItemsCategories {
|
|
2250
|
+
[itemID: number]: number;
|
|
2251
|
+
}
|
|
2252
|
+
export declare class IfcCategories {
|
|
2253
|
+
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2213
2254
|
}
|
|
2214
2255
|
import * as THREE from "three";
|
|
2215
2256
|
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
@@ -2300,6 +2341,11 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
|
2300
2341
|
resize(size?: THREE.Vector2): void;
|
|
2301
2342
|
private updatePlanes;
|
|
2302
2343
|
}
|
|
2344
|
+
import { InverseAttribute } from "./types";
|
|
2345
|
+
export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
|
|
2346
|
+
forRelating: InverseAttribute;
|
|
2347
|
+
forRelated: InverseAttribute;
|
|
2348
|
+
}>;
|
|
2303
2349
|
import * as FRAGS from "@thatopen/fragments";
|
|
2304
2350
|
import * as WEBIFC from "web-ifc";
|
|
2305
2351
|
export declare class SpatialIdsFinder {
|
|
@@ -2339,63 +2385,14 @@ export declare class IfcFragmentSettings {
|
|
|
2339
2385
|
*/
|
|
2340
2386
|
autoSetWasm: boolean;
|
|
2341
2387
|
/**
|
|
2342
|
-
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2343
|
-
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2344
|
-
* If set to null, the default file location handler will be used.
|
|
2345
|
-
*
|
|
2346
|
-
* @param url - The URL of the file to locate.
|
|
2347
|
-
* @returns The absolute path of the file.
|
|
2348
|
-
*/
|
|
2349
|
-
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2350
|
-
}
|
|
2351
|
-
/**
|
|
2352
|
-
* 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.
|
|
2353
|
-
*
|
|
2354
|
-
* @remarks
|
|
2355
|
-
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2356
|
-
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2357
|
-
*
|
|
2358
|
-
*/
|
|
2359
|
-
export declare const IfcElements: {
|
|
2360
|
-
[key: number]: string;
|
|
2361
|
-
};
|
|
2362
|
-
import * as WEBIFC from "web-ifc";
|
|
2363
|
-
export interface IfcItemsCategories {
|
|
2364
|
-
[itemID: number]: number;
|
|
2365
|
-
}
|
|
2366
|
-
export declare class IfcCategories {
|
|
2367
|
-
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2368
|
-
}
|
|
2369
|
-
/**
|
|
2370
|
-
* 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.
|
|
2371
|
-
*/
|
|
2372
|
-
export declare const IfcCategoryMap: {
|
|
2373
|
-
[key: number]: string;
|
|
2374
|
-
};
|
|
2375
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
2376
|
-
export declare class IfcPropertiesUtils {
|
|
2377
|
-
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2378
|
-
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2379
|
-
[attribute: string]: any;
|
|
2380
|
-
} | null>;
|
|
2381
|
-
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2382
|
-
[relatingID: number]: number[];
|
|
2383
|
-
}>;
|
|
2384
|
-
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2385
|
-
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2386
|
-
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2387
|
-
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2388
|
-
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2389
|
-
key: string | null;
|
|
2390
|
-
name: string | null;
|
|
2391
|
-
}>;
|
|
2392
|
-
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2393
|
-
key: string | null;
|
|
2394
|
-
value: number | null;
|
|
2395
|
-
}>;
|
|
2396
|
-
static isRel(expressID: number): boolean;
|
|
2397
|
-
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2398
|
-
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2388
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2389
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2390
|
+
* If set to null, the default file location handler will be used.
|
|
2391
|
+
*
|
|
2392
|
+
* @param url - The URL of the file to locate.
|
|
2393
|
+
* @returns The absolute path of the file.
|
|
2394
|
+
*/
|
|
2395
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2399
2396
|
}
|
|
2400
2397
|
import * as THREE from "three";
|
|
2401
2398
|
import { Event, World } from "../../Types";
|
|
@@ -2464,6 +2461,18 @@ export declare class DistanceRenderer {
|
|
|
2464
2461
|
compute: () => Promise<void>;
|
|
2465
2462
|
private handleWorkerMessage;
|
|
2466
2463
|
}
|
|
2464
|
+
import * as WEBIFC from "web-ifc";
|
|
2465
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2466
|
+
export declare class SpatialStructure {
|
|
2467
|
+
itemsByFloor: IfcItemsCategories;
|
|
2468
|
+
private _units;
|
|
2469
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2470
|
+
cleanUp(): void;
|
|
2471
|
+
}
|
|
2472
|
+
/**
|
|
2473
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
2474
|
+
*/
|
|
2475
|
+
export declare const GeometryTypes: Set<number>;
|
|
2467
2476
|
import * as THREE from "three";
|
|
2468
2477
|
import { Components } from "../../Components";
|
|
2469
2478
|
import { AsyncEvent, Event, World } from "../../Types";
|
|
@@ -2500,329 +2509,124 @@ export declare class CullerRenderer {
|
|
|
2500
2509
|
readonly onDisposed: Event<string>;
|
|
2501
2510
|
/**
|
|
2502
2511
|
* Fires after making the visibility check to the meshes. It lists the
|
|
2503
|
-
* meshes that are currently visible, and the ones that were visible
|
|
2504
|
-
* just before but not anymore.
|
|
2505
|
-
*/
|
|
2506
|
-
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2507
|
-
/**
|
|
2508
|
-
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2509
|
-
*/
|
|
2510
|
-
enabled: boolean;
|
|
2511
|
-
/**
|
|
2512
|
-
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2513
|
-
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2514
|
-
*/
|
|
2515
|
-
needsUpdate: boolean;
|
|
2516
|
-
/**
|
|
2517
|
-
* Render the internal scene used to determine the object visibility. Used
|
|
2518
|
-
* for debugging purposes.
|
|
2519
|
-
*/
|
|
2520
|
-
renderDebugFrame: boolean;
|
|
2521
|
-
/** The components instance to which this renderer belongs. */
|
|
2522
|
-
components: Components;
|
|
2523
|
-
/** The world instance to which this renderer belongs. */
|
|
2524
|
-
readonly world: World;
|
|
2525
|
-
/** The THREE.js renderer used to make the visibility test. */
|
|
2526
|
-
readonly renderer: THREE.WebGLRenderer;
|
|
2527
|
-
protected autoUpdate: boolean;
|
|
2528
|
-
protected updateInterval: number;
|
|
2529
|
-
protected readonly worker: Worker;
|
|
2530
|
-
protected readonly scene: THREE.Scene;
|
|
2531
|
-
private _width;
|
|
2532
|
-
private _height;
|
|
2533
|
-
private _availableColor;
|
|
2534
|
-
private readonly renderTarget;
|
|
2535
|
-
private readonly bufferSize;
|
|
2536
|
-
private readonly _buffer;
|
|
2537
|
-
protected _isWorkerBusy: boolean;
|
|
2538
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2539
|
-
/** {@link Disposable.dispose} */
|
|
2540
|
-
dispose(): void;
|
|
2541
|
-
/**
|
|
2542
|
-
* The function that the culler uses to reprocess the scene. Generally it's
|
|
2543
|
-
* better to call needsUpdate, but you can also call this to force it.
|
|
2544
|
-
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2545
|
-
* not true.
|
|
2546
|
-
*/
|
|
2547
|
-
updateVisibility: (force?: boolean) => Promise<void>;
|
|
2548
|
-
protected getAvailableColor(): {
|
|
2549
|
-
r: number;
|
|
2550
|
-
g: number;
|
|
2551
|
-
b: number;
|
|
2552
|
-
code: string;
|
|
2553
|
-
};
|
|
2554
|
-
protected increaseColor(): void;
|
|
2555
|
-
protected decreaseColor(): void;
|
|
2556
|
-
private applySettings;
|
|
2557
|
-
}
|
|
2558
|
-
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2559
|
-
/**
|
|
2560
|
-
* A Set of unique numbers representing different types of IFC geometries.
|
|
2561
|
-
*/
|
|
2562
|
-
export declare const GeometryTypes: Set<number>;
|
|
2563
|
-
import * as THREE from "three";
|
|
2564
|
-
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2565
|
-
import { Components } from "../../Components";
|
|
2566
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2567
|
-
/**
|
|
2568
|
-
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2569
|
-
*/
|
|
2570
|
-
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2571
|
-
/**
|
|
2572
|
-
* Event triggered when the visibility of meshes is updated.
|
|
2573
|
-
* Contains two sets: seen and unseen.
|
|
2574
|
-
*/
|
|
2575
|
-
readonly onViewUpdated: Event<{
|
|
2576
|
-
seen: Set<THREE.Mesh>;
|
|
2577
|
-
unseen: Set<THREE.Mesh>;
|
|
2578
|
-
}>;
|
|
2579
|
-
/**
|
|
2580
|
-
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2581
|
-
* Default value is 100.
|
|
2582
|
-
*/
|
|
2583
|
-
threshold: number;
|
|
2584
|
-
/**
|
|
2585
|
-
* Map of color code to THREE.InstancedMesh.
|
|
2586
|
-
* Used to keep track of color-coded meshes.
|
|
2587
|
-
*/
|
|
2588
|
-
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2589
|
-
/**
|
|
2590
|
-
* Flag to indicate if the renderer is currently processing.
|
|
2591
|
-
* Used to prevent concurrent processing.
|
|
2592
|
-
*/
|
|
2593
|
-
isProcessing: boolean;
|
|
2594
|
-
private _colorCodeMeshMap;
|
|
2595
|
-
private _meshIDColorCodeMap;
|
|
2596
|
-
private _currentVisibleMeshes;
|
|
2597
|
-
private _recentlyHiddenMeshes;
|
|
2598
|
-
private _intervalID;
|
|
2599
|
-
private readonly _transparentMat;
|
|
2600
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2601
|
-
/** {@link Disposable.dispose} */
|
|
2602
|
-
dispose(): void;
|
|
2603
|
-
/**
|
|
2604
|
-
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
2605
|
-
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2606
|
-
* @returns {void}
|
|
2607
|
-
*/
|
|
2608
|
-
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2609
|
-
/**
|
|
2610
|
-
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2611
|
-
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2612
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2613
|
-
* @returns {void}
|
|
2614
|
-
*/
|
|
2615
|
-
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2616
|
-
/**
|
|
2617
|
-
* Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
|
|
2618
|
-
*
|
|
2619
|
-
* @param meshes - The meshes to update.
|
|
2620
|
-
*
|
|
2621
|
-
* @returns {void}
|
|
2622
|
-
*/
|
|
2623
|
-
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
2624
|
-
private handleWorkerMessage;
|
|
2625
|
-
private getAvailableMaterial;
|
|
2626
|
-
}
|
|
2627
|
-
import * as THREE from "three";
|
|
2628
|
-
import { BaseRenderer, Event } from "../../Types";
|
|
2629
|
-
import { Components } from "../../Components";
|
|
2630
|
-
/**
|
|
2631
|
-
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
2632
|
-
*/
|
|
2633
|
-
export declare class SimpleRenderer extends BaseRenderer {
|
|
2634
|
-
/**
|
|
2635
|
-
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
2636
|
-
* Default is 'true'.
|
|
2637
|
-
*/
|
|
2638
|
-
enabled: boolean;
|
|
2639
|
-
/**
|
|
2640
|
-
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
2641
|
-
*/
|
|
2642
|
-
container: HTMLElement;
|
|
2643
|
-
/**
|
|
2644
|
-
* The THREE.js WebGLRenderer instance.
|
|
2645
|
-
*/
|
|
2646
|
-
three: THREE.WebGLRenderer;
|
|
2647
|
-
protected _canvas: HTMLCanvasElement;
|
|
2648
|
-
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
2649
|
-
protected _resizeObserver: ResizeObserver | null;
|
|
2650
|
-
protected onContainerUpdated: Event<unknown>;
|
|
2651
|
-
private _resizing;
|
|
2652
|
-
/**
|
|
2653
|
-
* Constructor for the SimpleRenderer class.
|
|
2654
|
-
*
|
|
2655
|
-
* @param components - The components instance.
|
|
2656
|
-
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
2657
|
-
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
2658
|
-
*/
|
|
2659
|
-
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
2660
|
-
/** {@link Updateable.update} */
|
|
2661
|
-
update(): void;
|
|
2662
|
-
/** {@link Disposable.dispose} */
|
|
2663
|
-
dispose(): void;
|
|
2664
|
-
/** {@link Resizeable.getSize}. */
|
|
2665
|
-
getSize(): THREE.Vector2;
|
|
2666
|
-
/** {@link Resizeable.resize} */
|
|
2667
|
-
resize: (size?: THREE.Vector2) => void;
|
|
2668
|
-
/**
|
|
2669
|
-
* Sets up and manages the event listeners for the renderer.
|
|
2670
|
-
*
|
|
2671
|
-
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
2672
|
-
*
|
|
2673
|
-
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
2674
|
-
*/
|
|
2675
|
-
setupEvents(active: boolean): void;
|
|
2676
|
-
private resizeEvent;
|
|
2677
|
-
private setupRenderer;
|
|
2678
|
-
private onContextLost;
|
|
2679
|
-
private onContextBack;
|
|
2680
|
-
}
|
|
2681
|
-
import { InverseAttribute } from "./types";
|
|
2682
|
-
export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711, {
|
|
2683
|
-
forRelating: InverseAttribute;
|
|
2684
|
-
forRelated: InverseAttribute;
|
|
2685
|
-
}>;
|
|
2686
|
-
import * as THREE from "three";
|
|
2687
|
-
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2688
|
-
/**
|
|
2689
|
-
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
2690
|
-
*
|
|
2691
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
2692
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
2693
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2694
|
-
*/
|
|
2695
|
-
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
2696
|
-
/**
|
|
2697
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2698
|
-
*/
|
|
2699
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2700
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2701
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
2702
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2703
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
2704
|
-
/** {@link Disposable.onDisposed} */
|
|
2705
|
-
readonly onDisposed: Event<unknown>;
|
|
2706
|
-
/**
|
|
2707
|
-
* 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.
|
|
2708
|
-
*/
|
|
2709
|
-
isDisposing: boolean;
|
|
2710
|
-
/**
|
|
2711
|
-
* Indicates whether the world is currently enabled.
|
|
2712
|
-
* When disabled, the world will not be updated.
|
|
2713
|
-
*/
|
|
2714
|
-
enabled: boolean;
|
|
2715
|
-
/**
|
|
2716
|
-
* A unique identifier for the world.
|
|
2717
|
-
*/
|
|
2718
|
-
uuid: string;
|
|
2719
|
-
/**
|
|
2720
|
-
* An optional name for the world.
|
|
2721
|
-
*/
|
|
2722
|
-
name?: string;
|
|
2723
|
-
private _scene?;
|
|
2724
|
-
private _camera?;
|
|
2725
|
-
private _renderer;
|
|
2726
|
-
/**
|
|
2727
|
-
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2728
|
-
* @returns The current scene.
|
|
2729
|
-
*/
|
|
2730
|
-
get scene(): T;
|
|
2731
|
-
/**
|
|
2732
|
-
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2733
|
-
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2734
|
-
* @param scene - The new scene to be set.
|
|
2735
|
-
*/
|
|
2736
|
-
set scene(scene: T);
|
|
2737
|
-
/**
|
|
2738
|
-
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2739
|
-
* @returns The current camera.
|
|
2512
|
+
* meshes that are currently visible, and the ones that were visible
|
|
2513
|
+
* just before but not anymore.
|
|
2740
2514
|
*/
|
|
2741
|
-
|
|
2515
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2742
2516
|
/**
|
|
2743
|
-
*
|
|
2744
|
-
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
2745
|
-
* @param camera - The new camera to be set.
|
|
2517
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2746
2518
|
*/
|
|
2747
|
-
|
|
2519
|
+
enabled: boolean;
|
|
2748
2520
|
/**
|
|
2749
|
-
*
|
|
2750
|
-
*
|
|
2521
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2522
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2751
2523
|
*/
|
|
2752
|
-
|
|
2524
|
+
needsUpdate: boolean;
|
|
2753
2525
|
/**
|
|
2754
|
-
*
|
|
2755
|
-
*
|
|
2756
|
-
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2757
|
-
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2526
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
2527
|
+
* for debugging purposes.
|
|
2758
2528
|
*/
|
|
2759
|
-
|
|
2760
|
-
/**
|
|
2761
|
-
|
|
2529
|
+
renderDebugFrame: boolean;
|
|
2530
|
+
/** The components instance to which this renderer belongs. */
|
|
2531
|
+
components: Components;
|
|
2532
|
+
/** The world instance to which this renderer belongs. */
|
|
2533
|
+
readonly world: World;
|
|
2534
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
2535
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
2536
|
+
protected autoUpdate: boolean;
|
|
2537
|
+
protected updateInterval: number;
|
|
2538
|
+
protected readonly worker: Worker;
|
|
2539
|
+
protected readonly scene: THREE.Scene;
|
|
2540
|
+
private _width;
|
|
2541
|
+
private _height;
|
|
2542
|
+
private _availableColor;
|
|
2543
|
+
private readonly renderTarget;
|
|
2544
|
+
private readonly bufferSize;
|
|
2545
|
+
private readonly _buffer;
|
|
2546
|
+
protected _isWorkerBusy: boolean;
|
|
2547
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2762
2548
|
/** {@link Disposable.dispose} */
|
|
2763
|
-
dispose(
|
|
2549
|
+
dispose(): void;
|
|
2550
|
+
/**
|
|
2551
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
2552
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
2553
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2554
|
+
* not true.
|
|
2555
|
+
*/
|
|
2556
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
2557
|
+
protected getAvailableColor(): {
|
|
2558
|
+
r: number;
|
|
2559
|
+
g: number;
|
|
2560
|
+
b: number;
|
|
2561
|
+
code: string;
|
|
2562
|
+
};
|
|
2563
|
+
protected increaseColor(): void;
|
|
2564
|
+
protected decreaseColor(): void;
|
|
2565
|
+
private applySettings;
|
|
2764
2566
|
}
|
|
2765
2567
|
import * as THREE from "three";
|
|
2766
|
-
import
|
|
2767
|
-
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
2568
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2768
2569
|
import { Components } from "../../Components";
|
|
2570
|
+
import { Event, World, Disposable } from "../../Types";
|
|
2769
2571
|
/**
|
|
2770
|
-
* A
|
|
2572
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2771
2573
|
*/
|
|
2772
|
-
export declare class
|
|
2773
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2774
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
2775
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2776
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2777
|
-
/**
|
|
2778
|
-
* Event that is triggered when the aspect of the camera has been updated.
|
|
2779
|
-
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2780
|
-
*/
|
|
2781
|
-
readonly onAspectUpdated: Event<unknown>;
|
|
2782
|
-
/** {@link Disposable.onDisposed} */
|
|
2783
|
-
readonly onDisposed: Event<string>;
|
|
2574
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2784
2575
|
/**
|
|
2785
|
-
*
|
|
2786
|
-
*
|
|
2576
|
+
* Event triggered when the visibility of meshes is updated.
|
|
2577
|
+
* Contains two sets: seen and unseen.
|
|
2787
2578
|
*/
|
|
2788
|
-
|
|
2789
|
-
|
|
2579
|
+
readonly onViewUpdated: Event<{
|
|
2580
|
+
seen: Set<THREE.Mesh>;
|
|
2581
|
+
unseen: Set<THREE.Mesh>;
|
|
2582
|
+
}>;
|
|
2790
2583
|
/**
|
|
2791
|
-
*
|
|
2792
|
-
*
|
|
2793
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
2794
|
-
* object to move, rotate, look at objects, etc.
|
|
2584
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2585
|
+
* Default value is 100.
|
|
2795
2586
|
*/
|
|
2796
|
-
|
|
2587
|
+
threshold: number;
|
|
2797
2588
|
/**
|
|
2798
|
-
*
|
|
2799
|
-
*
|
|
2800
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
2801
|
-
*
|
|
2802
|
-
* @returns {boolean} The enabled state of the camera controls.
|
|
2589
|
+
* Map of color code to THREE.InstancedMesh.
|
|
2590
|
+
* Used to keep track of color-coded meshes.
|
|
2803
2591
|
*/
|
|
2804
|
-
|
|
2592
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2805
2593
|
/**
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2594
|
+
* Flag to indicate if the renderer is currently processing.
|
|
2595
|
+
* Used to prevent concurrent processing.
|
|
2810
2596
|
*/
|
|
2811
|
-
|
|
2812
|
-
|
|
2597
|
+
isProcessing: boolean;
|
|
2598
|
+
private _colorCodeMeshMap;
|
|
2599
|
+
private _meshIDColorCodeMap;
|
|
2600
|
+
private _currentVisibleMeshes;
|
|
2601
|
+
private _recentlyHiddenMeshes;
|
|
2602
|
+
private _intervalID;
|
|
2603
|
+
private readonly _transparentMat;
|
|
2604
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2813
2605
|
/** {@link Disposable.dispose} */
|
|
2814
2606
|
dispose(): void;
|
|
2815
|
-
/** {@link Updateable.update} */
|
|
2816
|
-
update(_delta: number): void;
|
|
2817
2607
|
/**
|
|
2818
|
-
*
|
|
2819
|
-
*
|
|
2608
|
+
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
2609
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2610
|
+
* @returns {void}
|
|
2820
2611
|
*/
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2612
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2613
|
+
/**
|
|
2614
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2615
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2616
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2617
|
+
* @returns {void}
|
|
2618
|
+
*/
|
|
2619
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2620
|
+
/**
|
|
2621
|
+
* Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
|
|
2622
|
+
*
|
|
2623
|
+
* @param meshes - The meshes to update.
|
|
2624
|
+
*
|
|
2625
|
+
* @returns {void}
|
|
2626
|
+
*/
|
|
2627
|
+
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
2628
|
+
private handleWorkerMessage;
|
|
2629
|
+
private getAvailableMaterial;
|
|
2826
2630
|
}
|
|
2827
2631
|
/**
|
|
2828
2632
|
* 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.
|
|
@@ -2852,44 +2656,47 @@ export declare class Event<T> {
|
|
|
2852
2656
|
reset(): void;
|
|
2853
2657
|
private handlers;
|
|
2854
2658
|
}
|
|
2855
|
-
|
|
2856
|
-
import {
|
|
2857
|
-
import { Components } from "../../Components";
|
|
2659
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2660
|
+
import { Base } from "./base";
|
|
2858
2661
|
/**
|
|
2859
|
-
*
|
|
2662
|
+
* 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.
|
|
2860
2663
|
*/
|
|
2861
|
-
export
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
intensity: number;
|
|
2870
|
-
};
|
|
2664
|
+
export declare abstract class Component extends Base {
|
|
2665
|
+
/**
|
|
2666
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
2667
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2668
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2669
|
+
* will not be updated automatically each frame.
|
|
2670
|
+
*/
|
|
2671
|
+
abstract enabled: boolean;
|
|
2871
2672
|
}
|
|
2872
2673
|
/**
|
|
2873
|
-
*
|
|
2674
|
+
* 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.
|
|
2874
2675
|
*/
|
|
2875
|
-
export declare class
|
|
2876
|
-
/** {@link Configurable.isSetup} */
|
|
2877
|
-
isSetup: boolean;
|
|
2676
|
+
export declare class AsyncEvent<T> {
|
|
2878
2677
|
/**
|
|
2879
|
-
*
|
|
2880
|
-
*
|
|
2678
|
+
* Add a callback to this event instance.
|
|
2679
|
+
* @param handler - the callback to be added to this event.
|
|
2881
2680
|
*/
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2681
|
+
add(handler: T extends void ? {
|
|
2682
|
+
(): Promise<void>;
|
|
2683
|
+
} : {
|
|
2684
|
+
(data: T): Promise<void>;
|
|
2685
|
+
}): void;
|
|
2885
2686
|
/**
|
|
2886
|
-
*
|
|
2887
|
-
*
|
|
2687
|
+
* Removes a callback from this event instance.
|
|
2688
|
+
* @param handler - the callback to be removed from this event.
|
|
2888
2689
|
*/
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2690
|
+
remove(handler: T extends void ? {
|
|
2691
|
+
(): Promise<void>;
|
|
2692
|
+
} : {
|
|
2693
|
+
(data: T): Promise<void>;
|
|
2694
|
+
}): void;
|
|
2695
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2696
|
+
trigger: (data?: T) => Promise<void>;
|
|
2697
|
+
/** Gets rid of all the suscribed events. */
|
|
2698
|
+
reset(): void;
|
|
2699
|
+
private handlers;
|
|
2893
2700
|
}
|
|
2894
2701
|
import * as THREE from "three";
|
|
2895
2702
|
import CameraControls from "camera-controls";
|
|
@@ -2985,60 +2792,19 @@ export interface Configurable<T extends Record<string, any>> {
|
|
|
2985
2792
|
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2986
2793
|
readonly onSetup: Event<any>;
|
|
2987
2794
|
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2988
|
-
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2989
|
-
*/
|
|
2990
|
-
config: Required<T>;
|
|
2991
|
-
}
|
|
2992
|
-
/**
|
|
2993
|
-
* Whether a camera uses the Camera Controls library.
|
|
2994
|
-
*/
|
|
2995
|
-
export interface CameraControllable {
|
|
2996
|
-
/**
|
|
2997
|
-
* An instance of CameraControls that provides camera control functionalities.
|
|
2998
|
-
* This instance is used to manipulate the camera.
|
|
2999
|
-
*/
|
|
3000
|
-
controls: CameraControls;
|
|
3001
|
-
}
|
|
3002
|
-
/**
|
|
3003
|
-
* 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.
|
|
3004
|
-
*/
|
|
3005
|
-
export declare class AsyncEvent<T> {
|
|
3006
|
-
/**
|
|
3007
|
-
* Add a callback to this event instance.
|
|
3008
|
-
* @param handler - the callback to be added to this event.
|
|
3009
|
-
*/
|
|
3010
|
-
add(handler: T extends void ? {
|
|
3011
|
-
(): Promise<void>;
|
|
3012
|
-
} : {
|
|
3013
|
-
(data: T): Promise<void>;
|
|
3014
|
-
}): void;
|
|
3015
|
-
/**
|
|
3016
|
-
* Removes a callback from this event instance.
|
|
3017
|
-
* @param handler - the callback to be removed from this event.
|
|
3018
|
-
*/
|
|
3019
|
-
remove(handler: T extends void ? {
|
|
3020
|
-
(): Promise<void>;
|
|
3021
|
-
} : {
|
|
3022
|
-
(data: T): Promise<void>;
|
|
3023
|
-
}): void;
|
|
3024
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
3025
|
-
trigger: (data?: T) => Promise<void>;
|
|
3026
|
-
/** Gets rid of all the suscribed events. */
|
|
3027
|
-
reset(): void;
|
|
3028
|
-
private handlers;
|
|
2795
|
+
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2796
|
+
*/
|
|
2797
|
+
config: Required<T>;
|
|
3029
2798
|
}
|
|
3030
|
-
import { Base } from "./base";
|
|
3031
2799
|
/**
|
|
3032
|
-
*
|
|
2800
|
+
* Whether a camera uses the Camera Controls library.
|
|
3033
2801
|
*/
|
|
3034
|
-
export
|
|
2802
|
+
export interface CameraControllable {
|
|
3035
2803
|
/**
|
|
3036
|
-
*
|
|
3037
|
-
*
|
|
3038
|
-
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
3039
|
-
* will not be updated automatically each frame.
|
|
2804
|
+
* An instance of CameraControls that provides camera control functionalities.
|
|
2805
|
+
* This instance is used to manipulate the camera.
|
|
3040
2806
|
*/
|
|
3041
|
-
|
|
2807
|
+
controls: CameraControls;
|
|
3042
2808
|
}
|
|
3043
2809
|
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
3044
2810
|
import { Components } from "../../Components";
|
|
@@ -3059,29 +2825,6 @@ export declare abstract class Base {
|
|
|
3059
2825
|
/** Whether is component is {@link Configurable}. */
|
|
3060
2826
|
isConfigurable: () => this is Configurable<any>;
|
|
3061
2827
|
}
|
|
3062
|
-
import { Base } from "./base";
|
|
3063
|
-
import { World } from "./world";
|
|
3064
|
-
import { Event } from "./event";
|
|
3065
|
-
import { Components } from "../../Components";
|
|
3066
|
-
/**
|
|
3067
|
-
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
3068
|
-
*/
|
|
3069
|
-
export declare abstract class BaseWorldItem extends Base {
|
|
3070
|
-
readonly worlds: Map<string, World>;
|
|
3071
|
-
/**
|
|
3072
|
-
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
3073
|
-
* The event payload contains the world instance and the action ("added" or "removed").
|
|
3074
|
-
*/
|
|
3075
|
-
readonly onWorldChanged: Event<{
|
|
3076
|
-
world: World;
|
|
3077
|
-
action: "added" | "removed";
|
|
3078
|
-
}>;
|
|
3079
|
-
/**
|
|
3080
|
-
* The current world this item is associated with. It can be null if no world is currently active.
|
|
3081
|
-
*/
|
|
3082
|
-
currentWorld: World | null;
|
|
3083
|
-
protected constructor(components: Components);
|
|
3084
|
-
}
|
|
3085
2828
|
import * as THREE from "three";
|
|
3086
2829
|
import CameraControls from "camera-controls";
|
|
3087
2830
|
import { BaseWorldItem } from "./base-world-item";
|
|
@@ -3233,6 +2976,29 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
|
|
|
3233
2976
|
/** {@link Disposable.dispose} */
|
|
3234
2977
|
dispose(): void;
|
|
3235
2978
|
}
|
|
2979
|
+
import { Base } from "./base";
|
|
2980
|
+
import { World } from "./world";
|
|
2981
|
+
import { Event } from "./event";
|
|
2982
|
+
import { Components } from "../../Components";
|
|
2983
|
+
/**
|
|
2984
|
+
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
2985
|
+
*/
|
|
2986
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
2987
|
+
readonly worlds: Map<string, World>;
|
|
2988
|
+
/**
|
|
2989
|
+
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2990
|
+
* The event payload contains the world instance and the action ("added" or "removed").
|
|
2991
|
+
*/
|
|
2992
|
+
readonly onWorldChanged: Event<{
|
|
2993
|
+
world: World;
|
|
2994
|
+
action: "added" | "removed";
|
|
2995
|
+
}>;
|
|
2996
|
+
/**
|
|
2997
|
+
* The current world this item is associated with. It can be null if no world is currently active.
|
|
2998
|
+
*/
|
|
2999
|
+
currentWorld: World | null;
|
|
3000
|
+
protected constructor(components: Components);
|
|
3001
|
+
}
|
|
3236
3002
|
import { Event } from "./event";
|
|
3237
3003
|
/**
|
|
3238
3004
|
* A class that extends the built-in Set class and provides additional functionality.
|
|
@@ -3282,6 +3048,124 @@ export declare class DataSet<T> extends Set<T> {
|
|
|
3282
3048
|
*/
|
|
3283
3049
|
dispose(): void;
|
|
3284
3050
|
}
|
|
3051
|
+
import * as THREE from "three";
|
|
3052
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
3053
|
+
/**
|
|
3054
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
3055
|
+
*
|
|
3056
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
3057
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
3058
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
3059
|
+
*/
|
|
3060
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
3061
|
+
/**
|
|
3062
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
3063
|
+
*/
|
|
3064
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
3065
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
3066
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
3067
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
3068
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
3069
|
+
/** {@link Disposable.onDisposed} */
|
|
3070
|
+
readonly onDisposed: Event<unknown>;
|
|
3071
|
+
/**
|
|
3072
|
+
* 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.
|
|
3073
|
+
*/
|
|
3074
|
+
isDisposing: boolean;
|
|
3075
|
+
/**
|
|
3076
|
+
* Indicates whether the world is currently enabled.
|
|
3077
|
+
* When disabled, the world will not be updated.
|
|
3078
|
+
*/
|
|
3079
|
+
enabled: boolean;
|
|
3080
|
+
/**
|
|
3081
|
+
* A unique identifier for the world.
|
|
3082
|
+
*/
|
|
3083
|
+
uuid: string;
|
|
3084
|
+
/**
|
|
3085
|
+
* An optional name for the world.
|
|
3086
|
+
*/
|
|
3087
|
+
name?: string;
|
|
3088
|
+
private _scene?;
|
|
3089
|
+
private _camera?;
|
|
3090
|
+
private _renderer;
|
|
3091
|
+
/**
|
|
3092
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
3093
|
+
* @returns The current scene.
|
|
3094
|
+
*/
|
|
3095
|
+
get scene(): T;
|
|
3096
|
+
/**
|
|
3097
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
3098
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
3099
|
+
* @param scene - The new scene to be set.
|
|
3100
|
+
*/
|
|
3101
|
+
set scene(scene: T);
|
|
3102
|
+
/**
|
|
3103
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
3104
|
+
* @returns The current camera.
|
|
3105
|
+
*/
|
|
3106
|
+
get camera(): U;
|
|
3107
|
+
/**
|
|
3108
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
3109
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
3110
|
+
* @param camera - The new camera to be set.
|
|
3111
|
+
*/
|
|
3112
|
+
set camera(camera: U);
|
|
3113
|
+
/**
|
|
3114
|
+
* Getter for the renderer.
|
|
3115
|
+
* @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).
|
|
3116
|
+
*/
|
|
3117
|
+
get renderer(): S | null;
|
|
3118
|
+
/**
|
|
3119
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
3120
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
3121
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
3122
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
3123
|
+
*/
|
|
3124
|
+
set renderer(renderer: S | null);
|
|
3125
|
+
/** {@link Updateable.update} */
|
|
3126
|
+
update(delta?: number): void;
|
|
3127
|
+
/** {@link Disposable.dispose} */
|
|
3128
|
+
dispose(disposeResources?: boolean): void;
|
|
3129
|
+
}
|
|
3130
|
+
import * as THREE from "three";
|
|
3131
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3132
|
+
import { Components } from "../../Components";
|
|
3133
|
+
/**
|
|
3134
|
+
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
3135
|
+
*/
|
|
3136
|
+
export interface SimpleSceneConfig {
|
|
3137
|
+
directionalLight: {
|
|
3138
|
+
color: THREE.Color;
|
|
3139
|
+
intensity: number;
|
|
3140
|
+
position: THREE.Vector3;
|
|
3141
|
+
};
|
|
3142
|
+
ambientLight: {
|
|
3143
|
+
color: THREE.Color;
|
|
3144
|
+
intensity: number;
|
|
3145
|
+
};
|
|
3146
|
+
}
|
|
3147
|
+
/**
|
|
3148
|
+
* 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.
|
|
3149
|
+
*/
|
|
3150
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
3151
|
+
/** {@link Configurable.isSetup} */
|
|
3152
|
+
isSetup: boolean;
|
|
3153
|
+
/**
|
|
3154
|
+
* The underlying Three.js scene object.
|
|
3155
|
+
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
3156
|
+
*/
|
|
3157
|
+
three: THREE.Scene;
|
|
3158
|
+
/** {@link Configurable.onSetup} */
|
|
3159
|
+
readonly onSetup: Event<SimpleScene>;
|
|
3160
|
+
/**
|
|
3161
|
+
* Configuration interface for the {@link SimpleScene}.
|
|
3162
|
+
* Defines properties for directional and ambient lights.
|
|
3163
|
+
*/
|
|
3164
|
+
config: Required<SimpleSceneConfig>;
|
|
3165
|
+
constructor(components: Components);
|
|
3166
|
+
/** {@link Configurable.setup} */
|
|
3167
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
3168
|
+
}
|
|
3285
3169
|
import { Event } from "./event";
|
|
3286
3170
|
/**
|
|
3287
3171
|
* A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
|
|
@@ -3305,42 +3189,190 @@ export declare class DataMap<K, V> extends Map<K, V> {
|
|
|
3305
3189
|
value: V;
|
|
3306
3190
|
}>;
|
|
3307
3191
|
/**
|
|
3308
|
-
* An event triggered when an item is deleted from the map.
|
|
3192
|
+
* An event triggered when an item is deleted from the map.
|
|
3193
|
+
*/
|
|
3194
|
+
readonly onItemDeleted: Event<unknown>;
|
|
3195
|
+
/**
|
|
3196
|
+
* An event triggered when the map is cleared.
|
|
3197
|
+
*/
|
|
3198
|
+
readonly onCleared: Event<unknown>;
|
|
3199
|
+
/**
|
|
3200
|
+
* Constructs a new DataMap instance.
|
|
3201
|
+
*
|
|
3202
|
+
* @param iterable - An iterable object containing key-value pairs to populate the map.
|
|
3203
|
+
*/
|
|
3204
|
+
constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
|
|
3205
|
+
/**
|
|
3206
|
+
* Clears the map and triggers the onCleared event.
|
|
3207
|
+
*/
|
|
3208
|
+
clear(): void;
|
|
3209
|
+
/**
|
|
3210
|
+
* Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
|
|
3211
|
+
*
|
|
3212
|
+
* @param key - The key of the item to set.
|
|
3213
|
+
* @param value - The value of the item to set.
|
|
3214
|
+
* @returns The DataMap instance.
|
|
3215
|
+
*/
|
|
3216
|
+
set(key: K, value: V): this;
|
|
3217
|
+
/**
|
|
3218
|
+
* Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
|
|
3219
|
+
*
|
|
3220
|
+
* @param key - The key of the item to delete.
|
|
3221
|
+
* @returns True if the key was found and deleted; otherwise, false.
|
|
3222
|
+
*/
|
|
3223
|
+
delete(key: K): boolean;
|
|
3224
|
+
/**
|
|
3225
|
+
* Clears the map and resets the events.
|
|
3226
|
+
*/
|
|
3227
|
+
dispose(): void;
|
|
3228
|
+
}
|
|
3229
|
+
import * as THREE from "three";
|
|
3230
|
+
import { BaseRenderer, Event } from "../../Types";
|
|
3231
|
+
import { Components } from "../../Components";
|
|
3232
|
+
/**
|
|
3233
|
+
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
3234
|
+
*/
|
|
3235
|
+
export declare class SimpleRenderer extends BaseRenderer {
|
|
3236
|
+
/**
|
|
3237
|
+
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
3238
|
+
* Default is 'true'.
|
|
3239
|
+
*/
|
|
3240
|
+
enabled: boolean;
|
|
3241
|
+
/**
|
|
3242
|
+
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
3243
|
+
*/
|
|
3244
|
+
container: HTMLElement;
|
|
3245
|
+
/**
|
|
3246
|
+
* The THREE.js WebGLRenderer instance.
|
|
3247
|
+
*/
|
|
3248
|
+
three: THREE.WebGLRenderer;
|
|
3249
|
+
protected _canvas: HTMLCanvasElement;
|
|
3250
|
+
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
3251
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
3252
|
+
protected onContainerUpdated: Event<unknown>;
|
|
3253
|
+
private _resizing;
|
|
3254
|
+
/**
|
|
3255
|
+
* Constructor for the SimpleRenderer class.
|
|
3256
|
+
*
|
|
3257
|
+
* @param components - The components instance.
|
|
3258
|
+
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
3259
|
+
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
3260
|
+
*/
|
|
3261
|
+
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
3262
|
+
/** {@link Updateable.update} */
|
|
3263
|
+
update(): void;
|
|
3264
|
+
/** {@link Disposable.dispose} */
|
|
3265
|
+
dispose(): void;
|
|
3266
|
+
/** {@link Resizeable.getSize}. */
|
|
3267
|
+
getSize(): THREE.Vector2;
|
|
3268
|
+
/** {@link Resizeable.resize} */
|
|
3269
|
+
resize: (size?: THREE.Vector2) => void;
|
|
3270
|
+
/**
|
|
3271
|
+
* Sets up and manages the event listeners for the renderer.
|
|
3272
|
+
*
|
|
3273
|
+
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
3274
|
+
*
|
|
3275
|
+
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
3309
3276
|
*/
|
|
3310
|
-
|
|
3277
|
+
setupEvents(active: boolean): void;
|
|
3278
|
+
private resizeEvent;
|
|
3279
|
+
private setupRenderer;
|
|
3280
|
+
private onContextLost;
|
|
3281
|
+
private onContextBack;
|
|
3282
|
+
}
|
|
3283
|
+
import * as THREE from "three";
|
|
3284
|
+
import CameraControls from "camera-controls";
|
|
3285
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
3286
|
+
import { Components } from "../../Components";
|
|
3287
|
+
/**
|
|
3288
|
+
* 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.
|
|
3289
|
+
*/
|
|
3290
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
3291
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
3292
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
3293
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
3294
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
3311
3295
|
/**
|
|
3312
|
-
*
|
|
3296
|
+
* Event that is triggered when the aspect of the camera has been updated.
|
|
3297
|
+
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
3313
3298
|
*/
|
|
3314
|
-
readonly
|
|
3299
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
3300
|
+
/** {@link Disposable.onDisposed} */
|
|
3301
|
+
readonly onDisposed: Event<string>;
|
|
3315
3302
|
/**
|
|
3316
|
-
*
|
|
3317
|
-
*
|
|
3318
|
-
* @param iterable - An iterable object containing key-value pairs to populate the map.
|
|
3303
|
+
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
3304
|
+
* This camera is used for rendering the scene.
|
|
3319
3305
|
*/
|
|
3320
|
-
|
|
3306
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3307
|
+
private _allControls;
|
|
3321
3308
|
/**
|
|
3322
|
-
*
|
|
3309
|
+
* The object that controls the camera. An instance of
|
|
3310
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
3311
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
3312
|
+
* object to move, rotate, look at objects, etc.
|
|
3323
3313
|
*/
|
|
3324
|
-
|
|
3314
|
+
get controls(): CameraControls;
|
|
3325
3315
|
/**
|
|
3326
|
-
*
|
|
3316
|
+
* Getter for the enabled state of the camera controls.
|
|
3317
|
+
* If the current world is null, it returns false.
|
|
3318
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
3327
3319
|
*
|
|
3328
|
-
* @
|
|
3329
|
-
* @param value - The value of the item to set.
|
|
3330
|
-
* @returns The DataMap instance.
|
|
3320
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
3331
3321
|
*/
|
|
3332
|
-
|
|
3322
|
+
get enabled(): boolean;
|
|
3333
3323
|
/**
|
|
3334
|
-
*
|
|
3324
|
+
* Setter for the enabled state of the camera controls.
|
|
3325
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
3335
3326
|
*
|
|
3336
|
-
* @param
|
|
3337
|
-
* @returns True if the key was found and deleted; otherwise, false.
|
|
3327
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3338
3328
|
*/
|
|
3339
|
-
|
|
3329
|
+
set enabled(enabled: boolean);
|
|
3330
|
+
constructor(components: Components);
|
|
3331
|
+
/** {@link Disposable.dispose} */
|
|
3332
|
+
dispose(): void;
|
|
3333
|
+
/** {@link Updateable.update} */
|
|
3334
|
+
update(_delta: number): void;
|
|
3340
3335
|
/**
|
|
3341
|
-
*
|
|
3336
|
+
* Updates the aspect of the camera to match the size of the
|
|
3337
|
+
* {@link Components.renderer}.
|
|
3342
3338
|
*/
|
|
3343
|
-
|
|
3339
|
+
updateAspect: () => void;
|
|
3340
|
+
private setupCamera;
|
|
3341
|
+
private newCameraControls;
|
|
3342
|
+
private setupEvents;
|
|
3343
|
+
private static getSubsetOfThree;
|
|
3344
|
+
}
|
|
3345
|
+
import { NavigationMode } from "./types";
|
|
3346
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3347
|
+
/**
|
|
3348
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3349
|
+
*/
|
|
3350
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3351
|
+
private camera;
|
|
3352
|
+
/** {@link NavigationMode.enabled} */
|
|
3353
|
+
enabled: boolean;
|
|
3354
|
+
/** {@link NavigationMode.id} */
|
|
3355
|
+
readonly id = "FirstPerson";
|
|
3356
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3357
|
+
/** {@link NavigationMode.set} */
|
|
3358
|
+
set(active: boolean): void;
|
|
3359
|
+
private setupFirstPersonCamera;
|
|
3360
|
+
}
|
|
3361
|
+
import { NavigationMode } from "./types";
|
|
3362
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3363
|
+
/**
|
|
3364
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3365
|
+
*/
|
|
3366
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3367
|
+
camera: OrthoPerspectiveCamera;
|
|
3368
|
+
/** {@link NavigationMode.enabled} */
|
|
3369
|
+
enabled: boolean;
|
|
3370
|
+
/** {@link NavigationMode.id} */
|
|
3371
|
+
readonly id = "Orbit";
|
|
3372
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3373
|
+
/** {@link NavigationMode.set} */
|
|
3374
|
+
set(active: boolean): void;
|
|
3375
|
+
private activateOrbitControls;
|
|
3344
3376
|
}
|
|
3345
3377
|
import * as THREE from "three";
|
|
3346
3378
|
import { Disposable, Event } from "../../Types";
|
|
@@ -3365,6 +3397,52 @@ export declare class Mouse implements Disposable {
|
|
|
3365
3397
|
private updateMouseInfo;
|
|
3366
3398
|
private setupEvents;
|
|
3367
3399
|
}
|
|
3400
|
+
import { NavigationMode } from "./types";
|
|
3401
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3402
|
+
/**
|
|
3403
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3404
|
+
*/
|
|
3405
|
+
export declare class PlanMode implements NavigationMode {
|
|
3406
|
+
private camera;
|
|
3407
|
+
/** {@link NavigationMode.enabled} */
|
|
3408
|
+
enabled: boolean;
|
|
3409
|
+
/** {@link NavigationMode.id} */
|
|
3410
|
+
readonly id = "Plan";
|
|
3411
|
+
private mouseAction1?;
|
|
3412
|
+
private mouseAction2?;
|
|
3413
|
+
private mouseInitialized;
|
|
3414
|
+
private readonly defaultAzimuthSpeed;
|
|
3415
|
+
private readonly defaultPolarSpeed;
|
|
3416
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3417
|
+
/** {@link NavigationMode.set} */
|
|
3418
|
+
set(active: boolean): void;
|
|
3419
|
+
}
|
|
3420
|
+
/**
|
|
3421
|
+
* The projection system of the camera.
|
|
3422
|
+
*/
|
|
3423
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3424
|
+
/**
|
|
3425
|
+
* The extensible list of supported navigation modes.
|
|
3426
|
+
*/
|
|
3427
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3428
|
+
/**
|
|
3429
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3430
|
+
*/
|
|
3431
|
+
export interface NavigationMode {
|
|
3432
|
+
/** The unique ID of this navigation mode. */
|
|
3433
|
+
id: NavModeID;
|
|
3434
|
+
/**
|
|
3435
|
+
* Enable or disable this navigation mode.
|
|
3436
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3437
|
+
* must be disabled.
|
|
3438
|
+
*
|
|
3439
|
+
* @param active - whether to enable or disable this mode.
|
|
3440
|
+
* @param options - any additional data required to enable or disable it.
|
|
3441
|
+
* */
|
|
3442
|
+
set: (active: boolean, options?: any) => void;
|
|
3443
|
+
/** Whether this navigation mode is active or not. */
|
|
3444
|
+
enabled: boolean;
|
|
3445
|
+
}
|
|
3368
3446
|
import * as THREE from "three";
|
|
3369
3447
|
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
3370
3448
|
import { Components } from "../../Components";
|
|
@@ -3450,133 +3528,76 @@ export declare class SimpleRaycaster implements Disposable {
|
|
|
3450
3528
|
* This is used to access the camera and meshes.
|
|
3451
3529
|
*/
|
|
3452
3530
|
world: World;
|
|
3453
|
-
constructor(components: Components, world: World);
|
|
3454
|
-
/** {@link Disposable.dispose} */
|
|
3455
|
-
dispose(): void;
|
|
3456
|
-
/**
|
|
3457
|
-
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3458
|
-
* the first item found. This also takes into account the clipping planes
|
|
3459
|
-
* used by the renderer.
|
|
3460
|
-
*
|
|
3461
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3462
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
3463
|
-
* {@link Components.meshes}.
|
|
3464
|
-
*/
|
|
3465
|
-
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3466
|
-
/**
|
|
3467
|
-
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3468
|
-
* This method also takes into account the clipping planes used by the renderer.
|
|
3469
|
-
*
|
|
3470
|
-
* @param origin - The origin of the ray.
|
|
3471
|
-
* @param direction - The direction of the ray.
|
|
3472
|
-
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3473
|
-
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3474
|
-
*/
|
|
3475
|
-
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;
|
|
3476
|
-
private intersect;
|
|
3477
|
-
private filterClippingPlanes;
|
|
3478
|
-
}
|
|
3479
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3480
|
-
/**
|
|
3481
|
-
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3482
|
-
*/
|
|
3483
|
-
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3484
|
-
/**
|
|
3485
|
-
* Minimum number of geometries to be streamed.
|
|
3486
|
-
* Defaults to 10 geometries.
|
|
3487
|
-
*/
|
|
3488
|
-
minGeometrySize: number;
|
|
3489
|
-
/**
|
|
3490
|
-
* Minimum amount of assets to be streamed.
|
|
3491
|
-
* Defaults to 1000 assets.
|
|
3492
|
-
*/
|
|
3493
|
-
minAssetsSize: number;
|
|
3494
|
-
}
|
|
3495
|
-
import * as THREE from "three";
|
|
3496
|
-
import * as WEBIFC from "web-ifc";
|
|
3497
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
3498
|
-
export declare class CivilReader {
|
|
3499
|
-
defLineMat: THREE.LineBasicMaterial;
|
|
3500
|
-
read(webIfc: WEBIFC.IfcAPI): {
|
|
3501
|
-
alignments: Map<number, FRAGS.Alignment>;
|
|
3502
|
-
coordinationMatrix: THREE.Matrix4;
|
|
3503
|
-
} | undefined;
|
|
3504
|
-
get(civilItems: any): {
|
|
3505
|
-
alignments: Map<number, FRAGS.Alignment>;
|
|
3506
|
-
coordinationMatrix: THREE.Matrix4;
|
|
3507
|
-
} | undefined;
|
|
3508
|
-
private getCurves;
|
|
3509
|
-
}
|
|
3510
|
-
/**
|
|
3511
|
-
* 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.
|
|
3512
|
-
*/
|
|
3513
|
-
export interface StreamedGeometries {
|
|
3514
|
-
[id: number]: {
|
|
3515
|
-
/** The bounding box of the geometry as a Float32Array. */
|
|
3516
|
-
boundingBox: Float32Array;
|
|
3517
|
-
/** A boolean indicating whether the geometry has holes. */
|
|
3518
|
-
hasHoles: boolean;
|
|
3519
|
-
/** An optional file path for the geometry data. */
|
|
3520
|
-
geometryFile?: string;
|
|
3521
|
-
};
|
|
3522
|
-
}
|
|
3523
|
-
/**
|
|
3524
|
-
* 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.
|
|
3525
|
-
*/
|
|
3526
|
-
export interface StreamedAsset {
|
|
3527
|
-
/** The unique identifier of the asset. */
|
|
3528
|
-
id: number;
|
|
3529
|
-
/** An array of geometries associated with the asset. */
|
|
3530
|
-
geometries: {
|
|
3531
|
-
/** The unique identifier of the geometry. */
|
|
3532
|
-
geometryID: number;
|
|
3533
|
-
/** The transformation matrix of the geometry as a number array. */
|
|
3534
|
-
transformation: number[];
|
|
3535
|
-
/** The color of the geometry as a number array. */
|
|
3536
|
-
color: number[];
|
|
3537
|
-
}[];
|
|
3538
|
-
}
|
|
3539
|
-
import * as WEBIFC from "web-ifc";
|
|
3540
|
-
export declare class IfcMetadataReader {
|
|
3541
|
-
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3542
|
-
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3543
|
-
}
|
|
3544
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3545
|
-
/**
|
|
3546
|
-
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3547
|
-
*/
|
|
3548
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3531
|
+
constructor(components: Components, world: World);
|
|
3532
|
+
/** {@link Disposable.dispose} */
|
|
3533
|
+
dispose(): void;
|
|
3549
3534
|
/**
|
|
3550
|
-
*
|
|
3551
|
-
*
|
|
3535
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3536
|
+
* the first item found. This also takes into account the clipping planes
|
|
3537
|
+
* used by the renderer.
|
|
3538
|
+
*
|
|
3539
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3540
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
3541
|
+
* {@link Components.meshes}.
|
|
3552
3542
|
*/
|
|
3553
|
-
|
|
3543
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3544
|
+
/**
|
|
3545
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3546
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
3547
|
+
*
|
|
3548
|
+
* @param origin - The origin of the ray.
|
|
3549
|
+
* @param direction - The direction of the ray.
|
|
3550
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3551
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3552
|
+
*/
|
|
3553
|
+
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;
|
|
3554
|
+
private intersect;
|
|
3555
|
+
private filterClippingPlanes;
|
|
3554
3556
|
}
|
|
3555
|
-
import * as WEBIFC from "web-ifc";
|
|
3556
3557
|
import * as THREE from "three";
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
complement: number;
|
|
3560
|
-
apply(matrix: THREE.Matrix4): void;
|
|
3561
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3562
|
-
private getLengthUnits;
|
|
3563
|
-
private getScaleMatrix;
|
|
3564
|
-
}
|
|
3565
|
-
import { NavigationMode } from "./types";
|
|
3558
|
+
import { CameraProjection } from "./types";
|
|
3559
|
+
import { Event } from "../../Types";
|
|
3566
3560
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3567
3561
|
/**
|
|
3568
|
-
*
|
|
3562
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3569
3563
|
*/
|
|
3570
|
-
export declare class
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3564
|
+
export declare class ProjectionManager {
|
|
3565
|
+
/**
|
|
3566
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
3567
|
+
*/
|
|
3568
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3569
|
+
/**
|
|
3570
|
+
* Current projection mode of the camera.
|
|
3571
|
+
* Default is "Perspective".
|
|
3572
|
+
*/
|
|
3573
|
+
current: CameraProjection;
|
|
3574
|
+
/**
|
|
3575
|
+
* The camera controlled by this ProjectionManager.
|
|
3576
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3577
|
+
*/
|
|
3578
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3579
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3580
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3581
|
+
private _component;
|
|
3582
|
+
private _previousDistance;
|
|
3576
3583
|
constructor(camera: OrthoPerspectiveCamera);
|
|
3577
|
-
/**
|
|
3578
|
-
|
|
3579
|
-
|
|
3584
|
+
/**
|
|
3585
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3586
|
+
*
|
|
3587
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3588
|
+
* it will have no effect.
|
|
3589
|
+
*/
|
|
3590
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3591
|
+
/**
|
|
3592
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3593
|
+
* and vice versa.
|
|
3594
|
+
*/
|
|
3595
|
+
toggle(): Promise<void>;
|
|
3596
|
+
private setOrthoCamera;
|
|
3597
|
+
private getPerspectiveDims;
|
|
3598
|
+
private setupOrthoCamera;
|
|
3599
|
+
private getDistance;
|
|
3600
|
+
private setPerspectiveCamera;
|
|
3580
3601
|
}
|
|
3581
3602
|
import * as THREE from "three";
|
|
3582
3603
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
@@ -3677,112 +3698,96 @@ export declare class SimplePlane implements Disposable, Hideable {
|
|
|
3677
3698
|
private newHelper;
|
|
3678
3699
|
private static newPlaneMesh;
|
|
3679
3700
|
}
|
|
3680
|
-
import
|
|
3681
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3682
|
-
/**
|
|
3683
|
-
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3684
|
-
*/
|
|
3685
|
-
export declare class PlanMode implements NavigationMode {
|
|
3686
|
-
private camera;
|
|
3687
|
-
/** {@link NavigationMode.enabled} */
|
|
3688
|
-
enabled: boolean;
|
|
3689
|
-
/** {@link NavigationMode.id} */
|
|
3690
|
-
readonly id = "Plan";
|
|
3691
|
-
private mouseAction1?;
|
|
3692
|
-
private mouseAction2?;
|
|
3693
|
-
private mouseInitialized;
|
|
3694
|
-
private readonly defaultAzimuthSpeed;
|
|
3695
|
-
private readonly defaultPolarSpeed;
|
|
3696
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3697
|
-
/** {@link NavigationMode.set} */
|
|
3698
|
-
set(active: boolean): void;
|
|
3699
|
-
}
|
|
3701
|
+
import * as WEBIFC from "web-ifc";
|
|
3700
3702
|
import * as THREE from "three";
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3703
|
+
export declare class Units {
|
|
3704
|
+
factor: number;
|
|
3705
|
+
complement: number;
|
|
3706
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3707
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3708
|
+
private getLengthUnits;
|
|
3709
|
+
private getScaleMatrix;
|
|
3710
|
+
}
|
|
3711
|
+
import * as WEBIFC from "web-ifc";
|
|
3712
|
+
export declare class IfcMetadataReader {
|
|
3713
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3714
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3715
|
+
}
|
|
3716
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3704
3717
|
/**
|
|
3705
|
-
*
|
|
3718
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3706
3719
|
*/
|
|
3707
|
-
export declare class
|
|
3708
|
-
/**
|
|
3709
|
-
* Event that fires when the {@link CameraProjection} changes.
|
|
3710
|
-
*/
|
|
3711
|
-
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3712
|
-
/**
|
|
3713
|
-
* Current projection mode of the camera.
|
|
3714
|
-
* Default is "Perspective".
|
|
3715
|
-
*/
|
|
3716
|
-
current: CameraProjection;
|
|
3717
|
-
/**
|
|
3718
|
-
* The camera controlled by this ProjectionManager.
|
|
3719
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3720
|
-
*/
|
|
3721
|
-
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3722
|
-
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3723
|
-
matchOrthoDistanceEnabled: boolean;
|
|
3724
|
-
private _component;
|
|
3725
|
-
private _previousDistance;
|
|
3726
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3720
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3727
3721
|
/**
|
|
3728
|
-
*
|
|
3729
|
-
*
|
|
3730
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
3731
|
-
* it will have no effect.
|
|
3722
|
+
* Minimum number of geometries to be streamed.
|
|
3723
|
+
* Defaults to 10 geometries.
|
|
3732
3724
|
*/
|
|
3733
|
-
|
|
3725
|
+
minGeometrySize: number;
|
|
3734
3726
|
/**
|
|
3735
|
-
*
|
|
3736
|
-
*
|
|
3727
|
+
* Minimum amount of assets to be streamed.
|
|
3728
|
+
* Defaults to 1000 assets.
|
|
3737
3729
|
*/
|
|
3738
|
-
|
|
3739
|
-
private setOrthoCamera;
|
|
3740
|
-
private getPerspectiveDims;
|
|
3741
|
-
private setupOrthoCamera;
|
|
3742
|
-
private getDistance;
|
|
3743
|
-
private setPerspectiveCamera;
|
|
3730
|
+
minAssetsSize: number;
|
|
3744
3731
|
}
|
|
3745
|
-
import
|
|
3746
|
-
import
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
private activateOrbitControls;
|
|
3732
|
+
import * as THREE from "three";
|
|
3733
|
+
import * as WEBIFC from "web-ifc";
|
|
3734
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
3735
|
+
export declare class CivilReader {
|
|
3736
|
+
defLineMat: THREE.LineBasicMaterial;
|
|
3737
|
+
read(webIfc: WEBIFC.IfcAPI): {
|
|
3738
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
3739
|
+
coordinationMatrix: THREE.Matrix4;
|
|
3740
|
+
} | undefined;
|
|
3741
|
+
get(civilItems: any): {
|
|
3742
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
3743
|
+
coordinationMatrix: THREE.Matrix4;
|
|
3744
|
+
} | undefined;
|
|
3745
|
+
private getCurves;
|
|
3760
3746
|
}
|
|
3747
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3761
3748
|
/**
|
|
3762
|
-
*
|
|
3749
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3763
3750
|
*/
|
|
3764
|
-
export
|
|
3751
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3752
|
+
/**
|
|
3753
|
+
* Amount of properties to be streamed.
|
|
3754
|
+
* Defaults to 100 properties.
|
|
3755
|
+
*/
|
|
3756
|
+
propertiesSize: number;
|
|
3757
|
+
}
|
|
3765
3758
|
/**
|
|
3766
|
-
*
|
|
3759
|
+
* 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.
|
|
3767
3760
|
*/
|
|
3768
|
-
export
|
|
3761
|
+
export interface StreamedGeometries {
|
|
3762
|
+
[id: number]: {
|
|
3763
|
+
/** The bounding box of the geometry as a Float32Array. */
|
|
3764
|
+
boundingBox: Float32Array;
|
|
3765
|
+
/** A boolean indicating whether the geometry has holes. */
|
|
3766
|
+
hasHoles: boolean;
|
|
3767
|
+
/** An optional file path for the geometry data. */
|
|
3768
|
+
geometryFile?: string;
|
|
3769
|
+
};
|
|
3770
|
+
}
|
|
3769
3771
|
/**
|
|
3770
|
-
*
|
|
3772
|
+
* 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.
|
|
3771
3773
|
*/
|
|
3772
|
-
export interface
|
|
3773
|
-
/** The unique
|
|
3774
|
-
id:
|
|
3775
|
-
/**
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3774
|
+
export interface StreamedAsset {
|
|
3775
|
+
/** The unique identifier of the asset. */
|
|
3776
|
+
id: number;
|
|
3777
|
+
/** An array of geometries associated with the asset. */
|
|
3778
|
+
geometries: {
|
|
3779
|
+
/** The unique identifier of the geometry. */
|
|
3780
|
+
geometryID: number;
|
|
3781
|
+
/** The transformation matrix of the geometry as a number array. */
|
|
3782
|
+
transformation: number[];
|
|
3783
|
+
/** The color of the geometry as a number array. */
|
|
3784
|
+
color: number[];
|
|
3785
|
+
}[];
|
|
3786
|
+
}
|
|
3787
|
+
import { BufferGeometry } from "three";
|
|
3788
|
+
import * as THREE from "three";
|
|
3789
|
+
export declare class TransformHelper {
|
|
3790
|
+
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3786
3791
|
}
|
|
3787
3792
|
import * as WEBIFC from "web-ifc";
|
|
3788
3793
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
@@ -3811,7 +3816,12 @@ export type InverseAttributes = [
|
|
|
3811
3816
|
"AssignedToFlowElement",
|
|
3812
3817
|
"ConnectedTo",
|
|
3813
3818
|
"ConnectedFrom",
|
|
3814
|
-
"ReferencedBy"
|
|
3819
|
+
"ReferencedBy",
|
|
3820
|
+
"Declares",
|
|
3821
|
+
"HasContext",
|
|
3822
|
+
"Controls",
|
|
3823
|
+
"IsNestedBy",
|
|
3824
|
+
"Nests"
|
|
3815
3825
|
];
|
|
3816
3826
|
export type InverseAttribute = InverseAttributes[number];
|
|
3817
3827
|
/**
|
|
@@ -3828,13 +3838,11 @@ export type IfcRelations = [
|
|
|
3828
3838
|
typeof WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
3829
3839
|
typeof WEBIFC.IFCRELFLOWCONTROLELEMENTS,
|
|
3830
3840
|
typeof WEBIFC.IFCRELCONNECTSELEMENTS,
|
|
3831
|
-
typeof WEBIFC.IFCRELASSIGNSTOPRODUCT
|
|
3841
|
+
typeof WEBIFC.IFCRELASSIGNSTOPRODUCT,
|
|
3842
|
+
typeof WEBIFC.IFCRELDECLARES,
|
|
3843
|
+
typeof WEBIFC.IFCRELASSIGNSTOCONTROL,
|
|
3844
|
+
typeof WEBIFC.IFCRELNESTS
|
|
3832
3845
|
];
|
|
3833
3846
|
export type IfcRelation = IfcRelations[number];
|
|
3834
|
-
import { BufferGeometry } from "three";
|
|
3835
|
-
import * as THREE from "three";
|
|
3836
|
-
export declare class TransformHelper {
|
|
3837
|
-
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3838
|
-
}
|
|
3839
3847
|
|
|
3840
3848
|
}
|