@thatopen/components 2.0.18 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +4 -4
- package/dist/namespace.d.ts +1710 -1710
- package/package.json +5 -5
package/dist/namespace.d.ts
CHANGED
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { Components } from "../Components";
|
|
4
|
+
import { Component } from "../Types";
|
|
5
|
+
/**
|
|
6
|
+
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
7
|
+
*/
|
|
8
|
+
export declare class Disposer extends Component {
|
|
9
|
+
private _disposedComponents;
|
|
10
|
+
/** {@link Component.enabled} */
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* A unique identifier for the component.
|
|
14
|
+
* This UUID is used to register the component within the Components system.
|
|
15
|
+
*/
|
|
16
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
17
|
+
constructor(components: Components);
|
|
18
|
+
/**
|
|
19
|
+
* Return the UUIDs of all disposed components.
|
|
20
|
+
*/
|
|
21
|
+
get(): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
24
|
+
* using any of these in other parts of the application, make sure that you
|
|
25
|
+
* remove them from the mesh before disposing it.
|
|
26
|
+
*
|
|
27
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
28
|
+
* to remove.
|
|
29
|
+
*
|
|
30
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
31
|
+
*
|
|
32
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
33
|
+
*/
|
|
34
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
35
|
+
/**
|
|
36
|
+
* Disposes a geometry from memory.
|
|
37
|
+
*
|
|
38
|
+
* @param geometry - the
|
|
39
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
40
|
+
* to remove.
|
|
41
|
+
*/
|
|
42
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
43
|
+
private disposeGeometryAndMaterials;
|
|
44
|
+
private disposeChildren;
|
|
45
|
+
private static disposeMaterial;
|
|
46
|
+
}
|
|
2
47
|
import { Component, Disposable, Event } from "../Types";
|
|
3
48
|
/**
|
|
4
49
|
* 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 +52,7 @@ export declare class Components implements Disposable {
|
|
|
7
52
|
/**
|
|
8
53
|
* The version of the @thatopen/components library.
|
|
9
54
|
*/
|
|
10
|
-
static readonly release = "2.0.
|
|
55
|
+
static readonly release = "2.0.20";
|
|
11
56
|
/** {@link Disposable.onDisposed} */
|
|
12
57
|
readonly onDisposed: Event<void>;
|
|
13
58
|
/**
|
|
@@ -75,51 +120,6 @@ export declare class Components implements Disposable {
|
|
|
75
120
|
private update;
|
|
76
121
|
private static setupBVH;
|
|
77
122
|
}
|
|
78
|
-
import * as THREE from "three";
|
|
79
|
-
import { Components } from "../Components";
|
|
80
|
-
import { Component } from "../Types";
|
|
81
|
-
/**
|
|
82
|
-
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
83
|
-
*/
|
|
84
|
-
export declare class Disposer extends Component {
|
|
85
|
-
private _disposedComponents;
|
|
86
|
-
/** {@link Component.enabled} */
|
|
87
|
-
enabled: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* A unique identifier for the component.
|
|
90
|
-
* This UUID is used to register the component within the Components system.
|
|
91
|
-
*/
|
|
92
|
-
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
93
|
-
constructor(components: Components);
|
|
94
|
-
/**
|
|
95
|
-
* Return the UUIDs of all disposed components.
|
|
96
|
-
*/
|
|
97
|
-
get(): Set<string>;
|
|
98
|
-
/**
|
|
99
|
-
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
100
|
-
* using any of these in other parts of the application, make sure that you
|
|
101
|
-
* remove them from the mesh before disposing it.
|
|
102
|
-
*
|
|
103
|
-
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
104
|
-
* to remove.
|
|
105
|
-
*
|
|
106
|
-
* @param materials - whether to dispose the materials of the mesh.
|
|
107
|
-
*
|
|
108
|
-
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
109
|
-
*/
|
|
110
|
-
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
111
|
-
/**
|
|
112
|
-
* Disposes a geometry from memory.
|
|
113
|
-
*
|
|
114
|
-
* @param geometry - the
|
|
115
|
-
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
116
|
-
* to remove.
|
|
117
|
-
*/
|
|
118
|
-
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
119
|
-
private disposeGeometryAndMaterials;
|
|
120
|
-
private disposeChildren;
|
|
121
|
-
private static disposeMaterial;
|
|
122
|
-
}
|
|
123
123
|
import { Component, Disposable, World, Event } from "../Types";
|
|
124
124
|
import { SimpleRaycaster } from "./src";
|
|
125
125
|
import { Components } from "../Components";
|
|
@@ -162,6 +162,73 @@ export declare class Raycasters extends Component implements Disposable {
|
|
|
162
162
|
/** {@link Disposable.dispose} */
|
|
163
163
|
dispose(): void;
|
|
164
164
|
}
|
|
165
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
166
|
+
import { Components } from "../Components";
|
|
167
|
+
import { SimpleWorld } from "./src";
|
|
168
|
+
/**
|
|
169
|
+
* 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).
|
|
170
|
+
*/
|
|
171
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
172
|
+
/**
|
|
173
|
+
* A unique identifier for the component.
|
|
174
|
+
* This UUID is used to register the component within the Components system.
|
|
175
|
+
*/
|
|
176
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
177
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
178
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
179
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
180
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
181
|
+
/** {@link Disposable.onDisposed} */
|
|
182
|
+
readonly onDisposed: Event<unknown>;
|
|
183
|
+
/**
|
|
184
|
+
* An event that is triggered when a new world is created.
|
|
185
|
+
* The event passes the newly created world as a parameter.
|
|
186
|
+
*/
|
|
187
|
+
readonly onWorldCreated: Event<World>;
|
|
188
|
+
/**
|
|
189
|
+
* An event that is triggered when a world is deleted.
|
|
190
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
191
|
+
*/
|
|
192
|
+
readonly onWorldDeleted: Event<string>;
|
|
193
|
+
/**
|
|
194
|
+
* A collection of worlds managed by this component.
|
|
195
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
196
|
+
*/
|
|
197
|
+
list: Map<string, World>;
|
|
198
|
+
/** {@link Component.enabled} */
|
|
199
|
+
enabled: boolean;
|
|
200
|
+
constructor(components: Components);
|
|
201
|
+
/**
|
|
202
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
203
|
+
*
|
|
204
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
205
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
206
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
207
|
+
*
|
|
208
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
209
|
+
*/
|
|
210
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
211
|
+
/**
|
|
212
|
+
* Deletes a world from the list of worlds.
|
|
213
|
+
*
|
|
214
|
+
* @param {World} world - The world to be deleted.
|
|
215
|
+
*
|
|
216
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
217
|
+
*
|
|
218
|
+
* @returns {void}
|
|
219
|
+
*/
|
|
220
|
+
delete(world: World): void;
|
|
221
|
+
/**
|
|
222
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
223
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
224
|
+
* and triggers the onDisposed event.
|
|
225
|
+
*
|
|
226
|
+
* @returns {void}
|
|
227
|
+
*/
|
|
228
|
+
dispose(): void;
|
|
229
|
+
/** {@link Updateable.update} */
|
|
230
|
+
update(delta?: number): void | Promise<void>;
|
|
231
|
+
}
|
|
165
232
|
import { Component, Disposable, World, Event } from "../Types";
|
|
166
233
|
import { GridConfig, SimpleGrid } from "./src";
|
|
167
234
|
import { Components } from "../Components";
|
|
@@ -338,72 +405,53 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
338
405
|
private _onStartDragging;
|
|
339
406
|
private _onEndDragging;
|
|
340
407
|
}
|
|
341
|
-
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
342
408
|
import { Components } from "../Components";
|
|
343
|
-
import {
|
|
409
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
410
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
344
411
|
/**
|
|
345
|
-
* A
|
|
412
|
+
* 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).
|
|
346
413
|
*/
|
|
347
|
-
export declare class
|
|
414
|
+
export declare class Cullers extends Component implements Disposable {
|
|
348
415
|
/**
|
|
349
416
|
* A unique identifier for the component.
|
|
350
417
|
* This UUID is used to register the component within the Components system.
|
|
351
418
|
*/
|
|
352
|
-
static readonly uuid: "
|
|
353
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
354
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
355
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
356
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
357
|
-
/** {@link Disposable.onDisposed} */
|
|
358
|
-
readonly onDisposed: Event<unknown>;
|
|
359
|
-
/**
|
|
360
|
-
* An event that is triggered when a new world is created.
|
|
361
|
-
* The event passes the newly created world as a parameter.
|
|
362
|
-
*/
|
|
363
|
-
readonly onWorldCreated: Event<World>;
|
|
419
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
364
420
|
/**
|
|
365
|
-
* An event that is triggered when
|
|
366
|
-
* The event passes the UUID of the deleted world as a parameter.
|
|
421
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
367
422
|
*/
|
|
368
|
-
readonly
|
|
423
|
+
readonly onDisposed: Event<unknown>;
|
|
424
|
+
private _enabled;
|
|
369
425
|
/**
|
|
370
|
-
* A
|
|
371
|
-
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
426
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
372
427
|
*/
|
|
373
|
-
list: Map<string,
|
|
428
|
+
list: Map<string, MeshCullerRenderer>;
|
|
374
429
|
/** {@link Component.enabled} */
|
|
375
|
-
enabled: boolean;
|
|
430
|
+
get enabled(): boolean;
|
|
431
|
+
/** {@link Component.enabled} */
|
|
432
|
+
set enabled(value: boolean);
|
|
376
433
|
constructor(components: Components);
|
|
377
434
|
/**
|
|
378
|
-
* Creates a new
|
|
435
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
436
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
379
437
|
*
|
|
380
|
-
* @
|
|
381
|
-
* @
|
|
382
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
438
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
439
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
383
440
|
*
|
|
384
|
-
* @
|
|
441
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
385
442
|
*/
|
|
386
|
-
create
|
|
443
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
387
444
|
/**
|
|
388
|
-
* Deletes
|
|
389
|
-
*
|
|
390
|
-
* @param {World} world - The world to be deleted.
|
|
445
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
446
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
391
447
|
*
|
|
392
|
-
* @
|
|
448
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
393
449
|
*
|
|
394
450
|
* @returns {void}
|
|
395
451
|
*/
|
|
396
452
|
delete(world: World): void;
|
|
397
|
-
/**
|
|
398
|
-
* Disposes of the Worlds component and all its managed worlds.
|
|
399
|
-
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
400
|
-
* and triggers the onDisposed event.
|
|
401
|
-
*
|
|
402
|
-
* @returns {void}
|
|
403
|
-
*/
|
|
453
|
+
/** {@link Disposable.dispose} */
|
|
404
454
|
dispose(): void;
|
|
405
|
-
/** {@link Updateable.update} */
|
|
406
|
-
update(delta?: number): void | Promise<void>;
|
|
407
455
|
}
|
|
408
456
|
import { MiniMap } from "./src";
|
|
409
457
|
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
@@ -452,74 +500,26 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
|
|
|
452
500
|
/** {@link Updateable.update} */
|
|
453
501
|
update(): void;
|
|
454
502
|
}
|
|
503
|
+
import * as THREE from "three";
|
|
455
504
|
import { Components } from "../Components";
|
|
456
|
-
import {
|
|
457
|
-
import {
|
|
505
|
+
import { SimpleCamera } from "..";
|
|
506
|
+
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
458
507
|
/**
|
|
459
|
-
* A
|
|
508
|
+
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
460
509
|
*/
|
|
461
|
-
export declare class
|
|
510
|
+
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
462
511
|
/**
|
|
463
|
-
* A
|
|
464
|
-
* This UUID is used to register the component within the Components system.
|
|
512
|
+
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
465
513
|
*/
|
|
466
|
-
|
|
514
|
+
readonly projection: ProjectionManager;
|
|
467
515
|
/**
|
|
468
|
-
*
|
|
516
|
+
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
517
|
+
* This camera is used when the projection mode is set to orthographic.
|
|
469
518
|
*/
|
|
470
|
-
readonly
|
|
471
|
-
private _enabled;
|
|
519
|
+
readonly threeOrtho: THREE.OrthographicCamera;
|
|
472
520
|
/**
|
|
473
|
-
* A
|
|
474
|
-
|
|
475
|
-
list: Map<string, MeshCullerRenderer>;
|
|
476
|
-
/** {@link Component.enabled} */
|
|
477
|
-
get enabled(): boolean;
|
|
478
|
-
/** {@link Component.enabled} */
|
|
479
|
-
set enabled(value: boolean);
|
|
480
|
-
constructor(components: Components);
|
|
481
|
-
/**
|
|
482
|
-
* Creates a new MeshCullerRenderer for the given world.
|
|
483
|
-
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
484
|
-
*
|
|
485
|
-
* @param world - The world for which to create the MeshCullerRenderer.
|
|
486
|
-
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
487
|
-
*
|
|
488
|
-
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
489
|
-
*/
|
|
490
|
-
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
491
|
-
/**
|
|
492
|
-
* Deletes the MeshCullerRenderer associated with the given world.
|
|
493
|
-
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
494
|
-
*
|
|
495
|
-
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
496
|
-
*
|
|
497
|
-
* @returns {void}
|
|
498
|
-
*/
|
|
499
|
-
delete(world: World): void;
|
|
500
|
-
/** {@link Disposable.dispose} */
|
|
501
|
-
dispose(): void;
|
|
502
|
-
}
|
|
503
|
-
import * as THREE from "three";
|
|
504
|
-
import { Components } from "../Components";
|
|
505
|
-
import { SimpleCamera } from "..";
|
|
506
|
-
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
507
|
-
/**
|
|
508
|
-
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
509
|
-
*/
|
|
510
|
-
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
511
|
-
/**
|
|
512
|
-
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
513
|
-
*/
|
|
514
|
-
readonly projection: ProjectionManager;
|
|
515
|
-
/**
|
|
516
|
-
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
517
|
-
* This camera is used when the projection mode is set to orthographic.
|
|
518
|
-
*/
|
|
519
|
-
readonly threeOrtho: THREE.OrthographicCamera;
|
|
520
|
-
/**
|
|
521
|
-
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
522
|
-
* This camera is used when the projection mode is set to perspective.
|
|
521
|
+
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
522
|
+
* This camera is used when the projection mode is set to perspective.
|
|
523
523
|
*/
|
|
524
524
|
readonly threePersp: THREE.PerspectiveCamera;
|
|
525
525
|
protected readonly _userInputButtons: any;
|
|
@@ -565,1220 +565,1383 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
565
565
|
private setOrthoPerspCameraAspect;
|
|
566
566
|
}
|
|
567
567
|
import * as THREE from "three";
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
rotation: THREE.Matrix3;
|
|
572
|
-
transformation: THREE.Matrix4;
|
|
573
|
-
};
|
|
574
|
-
import * as THREE from "three";
|
|
575
|
-
export declare class MaterialsUtils {
|
|
576
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
577
|
-
}
|
|
578
|
-
export declare class UUID {
|
|
579
|
-
private static _pattern;
|
|
580
|
-
private static _lut;
|
|
581
|
-
static create(): string;
|
|
582
|
-
static validate(uuid: string): void;
|
|
583
|
-
}
|
|
584
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
585
|
-
import * as THREE from "three";
|
|
586
|
-
import { Component, Components, Disposable, Event, World } from "../core";
|
|
587
|
-
/**
|
|
588
|
-
* Configuration interface for the VertexPicker component.
|
|
589
|
-
*/
|
|
590
|
-
export interface VertexPickerConfig {
|
|
591
|
-
/**
|
|
592
|
-
* If true, only vertices will be picked, not the closest point on the face.
|
|
593
|
-
*/
|
|
594
|
-
showOnlyVertex: boolean;
|
|
595
|
-
/**
|
|
596
|
-
* The maximum distance for snapping to a vertex.
|
|
597
|
-
*/
|
|
598
|
-
snapDistance: number;
|
|
599
|
-
/**
|
|
600
|
-
* The HTML element to use for previewing the picked vertex.
|
|
601
|
-
*/
|
|
602
|
-
previewElement: HTMLElement;
|
|
603
|
-
}
|
|
568
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
569
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
570
|
+
import { Component, Components, Disposable, Event } from "../../core";
|
|
604
571
|
/**
|
|
605
|
-
* A
|
|
572
|
+
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
606
573
|
*/
|
|
607
|
-
export declare class
|
|
574
|
+
export declare class BoundingBoxer extends Component implements Disposable {
|
|
575
|
+
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
576
|
+
/** {@link Component.enabled} */
|
|
577
|
+
enabled: boolean;
|
|
608
578
|
/** {@link Disposable.onDisposed} */
|
|
609
579
|
readonly onDisposed: Event<unknown>;
|
|
580
|
+
private _absoluteMin;
|
|
581
|
+
private _absoluteMax;
|
|
582
|
+
private _meshes;
|
|
583
|
+
constructor(components: Components);
|
|
610
584
|
/**
|
|
611
|
-
*
|
|
612
|
-
*
|
|
585
|
+
* A static method to calculate the dimensions of a given bounding box.
|
|
586
|
+
*
|
|
587
|
+
* @param bbox - The bounding box to calculate the dimensions for.
|
|
588
|
+
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
613
589
|
*/
|
|
614
|
-
|
|
590
|
+
static getDimensions(bbox: THREE.Box3): {
|
|
591
|
+
width: number;
|
|
592
|
+
height: number;
|
|
593
|
+
depth: number;
|
|
594
|
+
center: THREE.Vector3;
|
|
595
|
+
};
|
|
615
596
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
597
|
+
* A static method to create a new bounding box boundary.
|
|
598
|
+
*
|
|
599
|
+
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
600
|
+
* @returns A new THREE.Vector3 representing the boundary.
|
|
601
|
+
*
|
|
602
|
+
* @remarks
|
|
603
|
+
* This method is used to create a new boundary for calculating bounding boxes.
|
|
604
|
+
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
605
|
+
* depending on the value of the 'positive' parameter.
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* '''typescript
|
|
609
|
+
* const positiveBound = BoundingBoxer.newBound(true);
|
|
610
|
+
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
611
|
+
*
|
|
612
|
+
* const negativeBound = BoundingBoxer.newBound(false);
|
|
613
|
+
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
614
|
+
* '''
|
|
618
615
|
*/
|
|
619
|
-
|
|
616
|
+
static newBound(positive: boolean): THREE.Vector3;
|
|
620
617
|
/**
|
|
621
|
-
* A
|
|
618
|
+
* A static method to calculate the bounding box of a set of points.
|
|
619
|
+
*
|
|
620
|
+
* @param points - An array of THREE.Vector3 representing the points.
|
|
621
|
+
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
622
|
+
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
623
|
+
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
624
|
+
*
|
|
625
|
+
* @remarks
|
|
626
|
+
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
627
|
+
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
628
|
+
*
|
|
629
|
+
* @example
|
|
630
|
+
* '''typescript
|
|
631
|
+
* const points = [
|
|
632
|
+
* new THREE.Vector3(1, 2, 3),
|
|
633
|
+
* new THREE.Vector3(4, 5, 6),
|
|
634
|
+
* new THREE.Vector3(7, 8, 9),
|
|
635
|
+
* ];
|
|
636
|
+
*
|
|
637
|
+
* const bbox = BoundingBoxer.getBounds(points);
|
|
638
|
+
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
639
|
+
* '''
|
|
622
640
|
*/
|
|
623
|
-
|
|
641
|
+
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
642
|
+
/** {@link Disposable.dispose} */
|
|
643
|
+
dispose(): void;
|
|
624
644
|
/**
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
645
|
+
* Returns the bounding box of the calculated fragments.
|
|
646
|
+
*
|
|
647
|
+
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
648
|
+
*
|
|
649
|
+
* @remarks
|
|
650
|
+
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
651
|
+
* The returned box represents the bounding box of the calculated fragments.
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* '''typescript
|
|
655
|
+
* const boundingBox = boundingBoxer.get();
|
|
656
|
+
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
657
|
+
* '''
|
|
628
658
|
*/
|
|
629
|
-
|
|
630
|
-
private _pickedPoint;
|
|
631
|
-
private _config;
|
|
632
|
-
private _enabled;
|
|
659
|
+
get(): THREE.Box3;
|
|
633
660
|
/**
|
|
634
|
-
*
|
|
635
|
-
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
636
|
-
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
661
|
+
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
637
662
|
*
|
|
638
|
-
* @
|
|
663
|
+
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
664
|
+
*
|
|
665
|
+
* @remarks
|
|
666
|
+
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
667
|
+
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
668
|
+
* The radius is calculated as the distance from the center to the minimum bound.
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* '''typescript
|
|
672
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
673
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
674
|
+
* const boundingSphere = boundingBoxer.getSphere();
|
|
675
|
+
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
676
|
+
* '''
|
|
639
677
|
*/
|
|
640
|
-
|
|
678
|
+
getSphere(): THREE.Sphere;
|
|
641
679
|
/**
|
|
642
|
-
*
|
|
680
|
+
* Returns a THREE.Mesh instance representing the bounding box.
|
|
643
681
|
*
|
|
644
|
-
* @returns
|
|
682
|
+
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
683
|
+
*
|
|
684
|
+
* @remarks
|
|
685
|
+
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
686
|
+
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
687
|
+
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
688
|
+
* The position of the mesh is set to the center of the bounding box.
|
|
689
|
+
*
|
|
690
|
+
* @example
|
|
691
|
+
* '''typescript
|
|
692
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
693
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
694
|
+
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
695
|
+
* scene.add(boundingBoxMesh);
|
|
696
|
+
* '''
|
|
645
697
|
*/
|
|
646
|
-
|
|
698
|
+
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
647
699
|
/**
|
|
648
|
-
*
|
|
700
|
+
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
701
|
+
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
649
702
|
*
|
|
650
|
-
* @
|
|
651
|
-
*
|
|
703
|
+
* @remarks
|
|
704
|
+
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
705
|
+
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
652
706
|
*
|
|
653
707
|
* @example
|
|
654
708
|
* '''typescript
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
709
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
710
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
711
|
+
* // ...
|
|
712
|
+
* boundingBoxer.reset();
|
|
659
713
|
* '''
|
|
660
714
|
*/
|
|
661
|
-
|
|
715
|
+
reset(): void;
|
|
662
716
|
/**
|
|
663
|
-
*
|
|
717
|
+
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
664
718
|
*
|
|
665
|
-
* @
|
|
719
|
+
* @param group - The FragmentsGroup to add.
|
|
720
|
+
*
|
|
721
|
+
* @remarks
|
|
722
|
+
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
723
|
+
* and calls the 'addMesh' method for each fragment's mesh.
|
|
666
724
|
*
|
|
667
725
|
* @example
|
|
668
726
|
* '''typescript
|
|
669
|
-
* const
|
|
670
|
-
*
|
|
727
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
728
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
671
729
|
* '''
|
|
672
730
|
*/
|
|
673
|
-
|
|
674
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
675
|
-
/** {@link Disposable.dispose} */
|
|
676
|
-
dispose(): void;
|
|
731
|
+
add(group: FragmentsGroup): void;
|
|
677
732
|
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* @param world - The World instance to use for raycasting.
|
|
733
|
+
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
681
734
|
*
|
|
682
|
-
* @
|
|
735
|
+
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
736
|
+
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
683
737
|
*
|
|
684
738
|
* @remarks
|
|
685
|
-
* This method
|
|
686
|
-
* If
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
739
|
+
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
740
|
+
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
741
|
+
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* '''typescript
|
|
745
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
746
|
+
* boundingBoxer.addMesh(mesh);
|
|
747
|
+
* '''
|
|
691
748
|
*/
|
|
692
|
-
|
|
693
|
-
private
|
|
694
|
-
private getVertices;
|
|
695
|
-
private getVertex;
|
|
749
|
+
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
750
|
+
private static getFragmentBounds;
|
|
696
751
|
}
|
|
697
|
-
import * as
|
|
698
|
-
import
|
|
699
|
-
import { Disposable,
|
|
700
|
-
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
701
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
752
|
+
import * as THREE from "three";
|
|
753
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
754
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
702
755
|
/**
|
|
703
|
-
*
|
|
756
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
|
|
704
757
|
*/
|
|
705
|
-
export
|
|
706
|
-
/**
|
|
707
|
-
* A unique identifier for the component.
|
|
708
|
-
* This UUID is used to register the component within the Components system.
|
|
709
|
-
*/
|
|
710
|
-
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
711
|
-
/** {@link Disposable.onDisposed} */
|
|
712
|
-
readonly onDisposed: Event<string>;
|
|
758
|
+
export interface Classification {
|
|
713
759
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
718
|
-
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
719
|
-
* 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.
|
|
760
|
+
* A system within the classification.
|
|
761
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
720
762
|
*/
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
763
|
+
[system: string]: {
|
|
764
|
+
/**
|
|
765
|
+
* A class within the system.
|
|
766
|
+
* The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
|
|
767
|
+
*/
|
|
768
|
+
[className: string]: FRAGS.FragmentIdMap;
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* 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).
|
|
773
|
+
*/
|
|
774
|
+
export declare class Classifier extends Component implements Disposable {
|
|
725
775
|
/**
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
729
|
-
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
730
|
-
* that are related through that relation type. This structure allows for efficient querying
|
|
731
|
-
* of entity relationships within a model.
|
|
776
|
+
* A unique identifier for the component.
|
|
777
|
+
* This UUID is used to register the component within the Components system.
|
|
732
778
|
*/
|
|
733
|
-
readonly
|
|
779
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
734
780
|
/** {@link Component.enabled} */
|
|
735
781
|
enabled: boolean;
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
782
|
+
/**
|
|
783
|
+
* A map representing the classification systems.
|
|
784
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
785
|
+
*/
|
|
786
|
+
list: Classification;
|
|
787
|
+
/** {@link Disposable.onDisposed} */
|
|
788
|
+
readonly onDisposed: Event<unknown>;
|
|
739
789
|
constructor(components: Components);
|
|
740
790
|
private onFragmentsDisposed;
|
|
741
|
-
|
|
791
|
+
/** {@link Disposable.dispose} */
|
|
792
|
+
dispose(): void;
|
|
742
793
|
/**
|
|
743
|
-
*
|
|
794
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
795
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
744
796
|
*
|
|
745
|
-
* @param
|
|
746
|
-
|
|
797
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
798
|
+
*/
|
|
799
|
+
remove(guid: string): void;
|
|
800
|
+
/**
|
|
801
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
802
|
+
* If no filter is provided, it returns all fragments.
|
|
747
803
|
*
|
|
748
|
-
* @
|
|
804
|
+
* @param filter - An optional object containing filter criteria.
|
|
805
|
+
* The keys of the object represent the classification system names,
|
|
806
|
+
* and the values are arrays of class names to match.
|
|
807
|
+
*
|
|
808
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
809
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
810
|
+
*
|
|
811
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
749
812
|
*/
|
|
750
|
-
|
|
813
|
+
find(filter?: {
|
|
814
|
+
[name: string]: string[];
|
|
815
|
+
}): FRAGS.FragmentIdMap;
|
|
751
816
|
/**
|
|
752
|
-
*
|
|
753
|
-
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
754
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
817
|
+
* Classifies fragments based on their modelID.
|
|
755
818
|
*
|
|
756
|
-
* The
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
819
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
820
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
821
|
+
*
|
|
822
|
+
* @remarks
|
|
823
|
+
* This method iterates through the fragments in the provided group,
|
|
824
|
+
* and classifies them based on their modelID.
|
|
825
|
+
* The classification is stored in the 'list.models' property,
|
|
826
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
761
827
|
*
|
|
762
|
-
* @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
|
|
763
|
-
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
764
|
-
* representation of the relations indexed by entity expressIDs and relation types.
|
|
765
|
-
* @throws An error if the model does not have properties loaded.
|
|
766
828
|
*/
|
|
767
|
-
|
|
829
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
768
830
|
/**
|
|
769
|
-
*
|
|
831
|
+
* Classifies fragments based on their PredefinedType property.
|
|
770
832
|
*
|
|
771
|
-
* @param
|
|
772
|
-
*
|
|
773
|
-
* @
|
|
774
|
-
*
|
|
833
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
834
|
+
*
|
|
835
|
+
* @remarks
|
|
836
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
837
|
+
* and classifies them based on their PredefinedType property.
|
|
838
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
839
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
840
|
+
*
|
|
841
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
775
842
|
*/
|
|
776
|
-
|
|
843
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
777
844
|
/**
|
|
778
|
-
*
|
|
779
|
-
* This method searches the indexed relation maps for the specified model and entity,
|
|
780
|
-
* returning the IDs of related entities if a match is found.
|
|
845
|
+
* Classifies fragments based on their entity type.
|
|
781
846
|
*
|
|
782
|
-
* @param
|
|
783
|
-
*
|
|
784
|
-
* @
|
|
785
|
-
*
|
|
786
|
-
*
|
|
847
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
848
|
+
*
|
|
849
|
+
* @remarks
|
|
850
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
851
|
+
* and classifies them based on their entity type.
|
|
852
|
+
* The classification is stored in the 'list.entities' property,
|
|
853
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
854
|
+
*
|
|
855
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
787
856
|
*/
|
|
788
|
-
|
|
857
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
789
858
|
/**
|
|
790
|
-
*
|
|
791
|
-
* 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,
|
|
792
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
793
|
-
* The resulting object is then serialized into a JSON string.
|
|
859
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
794
860
|
*
|
|
795
|
-
* @param
|
|
796
|
-
* @
|
|
861
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
862
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
863
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
864
|
+
*
|
|
865
|
+
* @remarks
|
|
866
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
867
|
+
* and classifies them based on the specified IFC relationship.
|
|
868
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
869
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
870
|
+
*
|
|
871
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
797
872
|
*/
|
|
798
|
-
|
|
873
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
799
874
|
/**
|
|
800
|
-
*
|
|
801
|
-
* This method iterates through the relations indexed for the given model,
|
|
802
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
803
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
804
|
-
* The resulting object is then serialized into a JSON string.
|
|
875
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
805
876
|
*
|
|
806
|
-
* @param model The
|
|
807
|
-
*
|
|
808
|
-
*
|
|
877
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
878
|
+
*
|
|
879
|
+
* @remarks
|
|
880
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
881
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
882
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
883
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
884
|
+
*
|
|
885
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
809
886
|
*/
|
|
810
|
-
|
|
887
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
|
|
811
888
|
/**
|
|
812
|
-
*
|
|
813
|
-
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
814
|
-
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
815
|
-
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
816
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
889
|
+
* Sets the color of the specified fragments.
|
|
817
890
|
*
|
|
818
|
-
* @
|
|
819
|
-
*
|
|
891
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
892
|
+
* @param color - The color to set for the fragments.
|
|
893
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
894
|
+
*
|
|
895
|
+
* @remarks
|
|
896
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
897
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
898
|
+
*
|
|
899
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
820
900
|
*/
|
|
821
|
-
|
|
901
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
822
902
|
/**
|
|
823
|
-
*
|
|
824
|
-
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
825
|
-
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
826
|
-
* and the values are maps where each key is a relation type ID and its value is an array
|
|
827
|
-
* of express IDs of entities related through that relation type.
|
|
903
|
+
* Resets the color of the specified fragments to their original color.
|
|
828
904
|
*
|
|
829
|
-
* @param
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
*
|
|
905
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
906
|
+
*
|
|
907
|
+
* @remarks
|
|
908
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
909
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
910
|
+
*
|
|
911
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
833
912
|
*/
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
dispose(): void;
|
|
913
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
914
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
|
|
837
915
|
}
|
|
838
|
-
import
|
|
839
|
-
import * as FRAG from "@thatopen/fragments";
|
|
840
|
-
import { Component, Components } from "../../core";
|
|
916
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
841
917
|
/**
|
|
842
|
-
*
|
|
918
|
+
* 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).
|
|
843
919
|
*/
|
|
844
|
-
export declare class
|
|
920
|
+
export declare class Exploder extends Component implements Disposable {
|
|
845
921
|
/**
|
|
846
922
|
* A unique identifier for the component.
|
|
847
923
|
* This UUID is used to register the component within the Components system.
|
|
848
924
|
*/
|
|
849
|
-
static readonly uuid: "
|
|
925
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
926
|
+
/** {@link Disposable.onDisposed} */
|
|
927
|
+
readonly onDisposed: Event<unknown>;
|
|
850
928
|
/** {@link Component.enabled} */
|
|
851
929
|
enabled: boolean;
|
|
930
|
+
/**
|
|
931
|
+
* The height of the explosion animation.
|
|
932
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
933
|
+
* Default value is 10.
|
|
934
|
+
*/
|
|
935
|
+
height: number;
|
|
936
|
+
/**
|
|
937
|
+
* The group name used for the explosion animation.
|
|
938
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
939
|
+
* Default value is "storeys".
|
|
940
|
+
*/
|
|
941
|
+
groupName: string;
|
|
942
|
+
/**
|
|
943
|
+
* A set of strings representing the exploded items.
|
|
944
|
+
* This set is used to keep track of which items have been exploded.
|
|
945
|
+
*/
|
|
946
|
+
list: Set<string>;
|
|
852
947
|
constructor(components: Components);
|
|
948
|
+
/** {@link Disposable.dispose} */
|
|
949
|
+
dispose(): void;
|
|
853
950
|
/**
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
* @param
|
|
857
|
-
*
|
|
858
|
-
* @
|
|
859
|
-
*
|
|
951
|
+
* Sets the explosion state of the fragments.
|
|
952
|
+
*
|
|
953
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
954
|
+
*
|
|
955
|
+
* @remarks
|
|
956
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
957
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
958
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
959
|
+
*
|
|
960
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
961
|
+
*
|
|
962
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
860
963
|
*/
|
|
861
|
-
|
|
964
|
+
set(active: boolean): void;
|
|
862
965
|
}
|
|
863
|
-
import * as THREE from "three";
|
|
864
966
|
import * as FRAGS from "@thatopen/fragments";
|
|
865
|
-
import {
|
|
866
|
-
import { Component, Components, Disposable, Event } from "../../core";
|
|
967
|
+
import { Components, Component } from "../../core";
|
|
867
968
|
/**
|
|
868
|
-
* A
|
|
969
|
+
* 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).
|
|
869
970
|
*/
|
|
870
|
-
export declare class
|
|
871
|
-
|
|
971
|
+
export declare class Hider extends Component {
|
|
972
|
+
/**
|
|
973
|
+
* A unique identifier for the component.
|
|
974
|
+
* This UUID is used to register the component within the Components system.
|
|
975
|
+
*/
|
|
976
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
872
977
|
/** {@link Component.enabled} */
|
|
873
978
|
enabled: boolean;
|
|
874
|
-
/** {@link Disposable.onDisposed} */
|
|
875
|
-
readonly onDisposed: Event<unknown>;
|
|
876
|
-
private _absoluteMin;
|
|
877
|
-
private _absoluteMax;
|
|
878
|
-
private _meshes;
|
|
879
979
|
constructor(components: Components);
|
|
880
980
|
/**
|
|
881
|
-
*
|
|
981
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
982
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
983
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
882
984
|
*
|
|
883
|
-
* @param
|
|
884
|
-
* @
|
|
985
|
+
* @param visible - The visibility state to set for the fragments.
|
|
986
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
987
|
+
* If not provided, all fragments will be affected.
|
|
988
|
+
*
|
|
989
|
+
* @returns {void}
|
|
885
990
|
*/
|
|
886
|
-
|
|
887
|
-
width: number;
|
|
888
|
-
height: number;
|
|
889
|
-
depth: number;
|
|
890
|
-
center: THREE.Vector3;
|
|
891
|
-
};
|
|
991
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
892
992
|
/**
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
896
|
-
* @returns A new THREE.Vector3 representing the boundary.
|
|
897
|
-
*
|
|
898
|
-
* @remarks
|
|
899
|
-
* This method is used to create a new boundary for calculating bounding boxes.
|
|
900
|
-
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
901
|
-
* depending on the value of the 'positive' parameter.
|
|
993
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
994
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
902
995
|
*
|
|
903
|
-
* @
|
|
904
|
-
*
|
|
905
|
-
* const positiveBound = BoundingBoxer.newBound(true);
|
|
906
|
-
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
996
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
997
|
+
* If not provided, all fragments will be isolated.
|
|
907
998
|
*
|
|
908
|
-
*
|
|
909
|
-
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
910
|
-
* '''
|
|
999
|
+
* @returns {void}
|
|
911
1000
|
*/
|
|
912
|
-
|
|
1001
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
1002
|
+
private updateCulledVisibility;
|
|
1003
|
+
}
|
|
1004
|
+
import * as WEBIFC from "web-ifc";
|
|
1005
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1006
|
+
import { IfcFragmentSettings } from "./src";
|
|
1007
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1008
|
+
/**
|
|
1009
|
+
* 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).
|
|
1010
|
+
*/
|
|
1011
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
913
1012
|
/**
|
|
914
|
-
* A
|
|
915
|
-
*
|
|
916
|
-
* @param points - An array of THREE.Vector3 representing the points.
|
|
917
|
-
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
918
|
-
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
919
|
-
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
920
|
-
*
|
|
921
|
-
* @remarks
|
|
922
|
-
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
923
|
-
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
924
|
-
*
|
|
925
|
-
* @example
|
|
926
|
-
* '''typescript
|
|
927
|
-
* const points = [
|
|
928
|
-
* new THREE.Vector3(1, 2, 3),
|
|
929
|
-
* new THREE.Vector3(4, 5, 6),
|
|
930
|
-
* new THREE.Vector3(7, 8, 9),
|
|
931
|
-
* ];
|
|
932
|
-
*
|
|
933
|
-
* const bbox = BoundingBoxer.getBounds(points);
|
|
934
|
-
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
935
|
-
* '''
|
|
1013
|
+
* A unique identifier for the component.
|
|
1014
|
+
* This UUID is used to register the component within the Components system.
|
|
936
1015
|
*/
|
|
937
|
-
static
|
|
1016
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1017
|
+
/** {@link Disposable.onDisposed} */
|
|
1018
|
+
readonly onDisposed: Event<string>;
|
|
1019
|
+
/**
|
|
1020
|
+
* An event triggered when the IFC file starts loading.
|
|
1021
|
+
*/
|
|
1022
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1023
|
+
/**
|
|
1024
|
+
* An event triggered when the setup process is completed.
|
|
1025
|
+
*/
|
|
1026
|
+
readonly onSetup: Event<void>;
|
|
1027
|
+
/**
|
|
1028
|
+
* The settings for the IfcLoader.
|
|
1029
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1030
|
+
*/
|
|
1031
|
+
settings: IfcFragmentSettings;
|
|
1032
|
+
/**
|
|
1033
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
1034
|
+
*/
|
|
1035
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1036
|
+
/** {@link Component.enabled} */
|
|
1037
|
+
enabled: boolean;
|
|
1038
|
+
private _material;
|
|
1039
|
+
private _spatialTree;
|
|
1040
|
+
private _metaData;
|
|
1041
|
+
private _fragmentInstances;
|
|
1042
|
+
private _civil;
|
|
1043
|
+
private _visitedFragments;
|
|
1044
|
+
private _materialT;
|
|
1045
|
+
constructor(components: Components);
|
|
938
1046
|
/** {@link Disposable.dispose} */
|
|
939
1047
|
dispose(): void;
|
|
940
1048
|
/**
|
|
941
|
-
*
|
|
1049
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
942
1050
|
*
|
|
943
|
-
* @
|
|
1051
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
1052
|
+
* If not provided, the existing settings will be used.
|
|
1053
|
+
*
|
|
1054
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
944
1055
|
*
|
|
945
1056
|
* @remarks
|
|
946
|
-
*
|
|
947
|
-
*
|
|
1057
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1058
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
948
1059
|
*
|
|
949
1060
|
* @example
|
|
950
1061
|
* '''typescript
|
|
951
|
-
* const
|
|
952
|
-
*
|
|
1062
|
+
* const ifcLoader = new IfcLoader(components);
|
|
1063
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
953
1064
|
* '''
|
|
954
1065
|
*/
|
|
955
|
-
|
|
1066
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
956
1067
|
/**
|
|
957
|
-
*
|
|
1068
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
958
1069
|
*
|
|
959
|
-
* @
|
|
1070
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1071
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
960
1072
|
*
|
|
961
|
-
* @
|
|
962
|
-
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
963
|
-
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
964
|
-
* The radius is calculated as the distance from the center to the minimum bound.
|
|
1073
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
965
1074
|
*
|
|
966
1075
|
* @example
|
|
967
1076
|
* '''typescript
|
|
968
|
-
* const
|
|
969
|
-
*
|
|
970
|
-
* const boundingSphere = boundingBoxer.getSphere();
|
|
971
|
-
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
1077
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1078
|
+
* const group = await ifcLoader.load(ifcData);
|
|
972
1079
|
* '''
|
|
973
1080
|
*/
|
|
974
|
-
|
|
1081
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
975
1082
|
/**
|
|
976
|
-
*
|
|
977
|
-
*
|
|
978
|
-
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
1083
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
979
1084
|
*
|
|
980
|
-
* @
|
|
981
|
-
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
982
|
-
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
983
|
-
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
984
|
-
* The position of the mesh is set to the center of the bounding box.
|
|
1085
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
985
1086
|
*
|
|
986
|
-
* @
|
|
987
|
-
* '''typescript
|
|
988
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
989
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
990
|
-
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
991
|
-
* scene.add(boundingBoxMesh);
|
|
992
|
-
* '''
|
|
993
|
-
*/
|
|
994
|
-
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
995
|
-
/**
|
|
996
|
-
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
997
|
-
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
1087
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
998
1088
|
*
|
|
999
1089
|
* @remarks
|
|
1000
|
-
* This method
|
|
1001
|
-
* It
|
|
1090
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1091
|
+
* It also opens the IFC model using the provided data and settings.
|
|
1002
1092
|
*
|
|
1003
1093
|
* @example
|
|
1004
1094
|
* '''typescript
|
|
1005
|
-
* const
|
|
1006
|
-
*
|
|
1007
|
-
* // ...
|
|
1008
|
-
* boundingBoxer.reset();
|
|
1095
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1096
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
1009
1097
|
* '''
|
|
1010
1098
|
*/
|
|
1011
|
-
|
|
1099
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
1012
1100
|
/**
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
* @param group - The FragmentsGroup to add.
|
|
1101
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
1102
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1016
1103
|
*
|
|
1017
1104
|
* @remarks
|
|
1018
|
-
* This method
|
|
1019
|
-
* and calls the 'addMesh' method for each fragment's mesh.
|
|
1105
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
1020
1106
|
*
|
|
1021
1107
|
* @example
|
|
1022
1108
|
* '''typescript
|
|
1023
|
-
* const
|
|
1024
|
-
*
|
|
1109
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1110
|
+
* ifcLoader.cleanUp();
|
|
1025
1111
|
* '''
|
|
1026
1112
|
*/
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
1033
|
-
*
|
|
1034
|
-
* @remarks
|
|
1035
|
-
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
1036
|
-
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
1037
|
-
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
1038
|
-
*
|
|
1039
|
-
* @example
|
|
1040
|
-
* '''typescript
|
|
1041
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1042
|
-
* boundingBoxer.addMesh(mesh);
|
|
1043
|
-
* '''
|
|
1044
|
-
*/
|
|
1045
|
-
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
1046
|
-
private static getFragmentBounds;
|
|
1047
|
-
}
|
|
1048
|
-
import * as WEBIFC from "web-ifc";
|
|
1049
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1050
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
1051
|
-
/**
|
|
1052
|
-
* Types for boolean properties in IFC schema.
|
|
1053
|
-
*/
|
|
1054
|
-
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1055
|
-
/**
|
|
1056
|
-
* Types for string properties in IFC schema.
|
|
1057
|
-
*/
|
|
1058
|
-
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
1059
|
-
/**
|
|
1060
|
-
* Types for numeric properties in IFC schema.
|
|
1061
|
-
*/
|
|
1062
|
-
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
1063
|
-
/**
|
|
1064
|
-
* 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.
|
|
1065
|
-
*/
|
|
1066
|
-
export interface ChangeMap {
|
|
1067
|
-
[modelID: string]: Set<number>;
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* 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.
|
|
1071
|
-
*/
|
|
1072
|
-
export interface AttributeListener {
|
|
1073
|
-
[modelID: string]: {
|
|
1074
|
-
[expressID: number]: {
|
|
1075
|
-
[attributeName: string]: Event<String | Boolean | Number>;
|
|
1076
|
-
};
|
|
1077
|
-
};
|
|
1113
|
+
cleanUp(): void;
|
|
1114
|
+
private getAllGeometries;
|
|
1115
|
+
private getMesh;
|
|
1116
|
+
private getGeometry;
|
|
1117
|
+
private autoSetWasm;
|
|
1078
1118
|
}
|
|
1119
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1120
|
+
import * as THREE from "three";
|
|
1121
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1122
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1123
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1079
1124
|
/**
|
|
1080
|
-
* Component to
|
|
1125
|
+
* 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).
|
|
1081
1126
|
*/
|
|
1082
|
-
export declare class
|
|
1127
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
1083
1128
|
/**
|
|
1084
1129
|
* A unique identifier for the component.
|
|
1085
1130
|
* This UUID is used to register the component within the Components system.
|
|
1086
1131
|
*/
|
|
1087
|
-
static readonly uuid: "
|
|
1132
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1088
1133
|
/** {@link Disposable.onDisposed} */
|
|
1089
|
-
readonly onDisposed: Event<
|
|
1090
|
-
/**
|
|
1091
|
-
* Event triggered when a file is requested for export.
|
|
1092
|
-
*/
|
|
1093
|
-
readonly onRequestFile: Event<unknown>;
|
|
1134
|
+
readonly onDisposed: Event<unknown>;
|
|
1094
1135
|
/**
|
|
1095
|
-
*
|
|
1136
|
+
* Event triggered when fragments are loaded.
|
|
1096
1137
|
*/
|
|
1097
|
-
|
|
1138
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1098
1139
|
/**
|
|
1099
|
-
* Event triggered when
|
|
1140
|
+
* Event triggered when fragments are disposed.
|
|
1100
1141
|
*/
|
|
1101
|
-
readonly
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
elementID: number;
|
|
1142
|
+
readonly onFragmentsDisposed: Event<{
|
|
1143
|
+
groupID: string;
|
|
1144
|
+
fragmentIDs: string[];
|
|
1105
1145
|
}>;
|
|
1106
1146
|
/**
|
|
1107
|
-
*
|
|
1147
|
+
* Map containing all loaded fragments.
|
|
1148
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1108
1149
|
*/
|
|
1109
|
-
readonly
|
|
1110
|
-
model: FragmentsGroup;
|
|
1111
|
-
psetID: number;
|
|
1112
|
-
propID: number;
|
|
1113
|
-
}>;
|
|
1150
|
+
readonly list: Map<string, Fragment>;
|
|
1114
1151
|
/**
|
|
1115
|
-
*
|
|
1152
|
+
* Map containing all loaded fragment groups.
|
|
1153
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1116
1154
|
*/
|
|
1117
|
-
readonly
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1155
|
+
readonly groups: Map<string, FragmentsGroup>;
|
|
1156
|
+
baseCoordinationModel: string;
|
|
1157
|
+
/** {@link Component.enabled} */
|
|
1158
|
+
enabled: boolean;
|
|
1159
|
+
private _loader;
|
|
1121
1160
|
/**
|
|
1122
|
-
*
|
|
1161
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1162
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1163
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1123
1164
|
*/
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1165
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1166
|
+
constructor(components: Components);
|
|
1167
|
+
/** {@link Disposable.dispose} */
|
|
1168
|
+
dispose(): void;
|
|
1128
1169
|
/**
|
|
1129
|
-
*
|
|
1170
|
+
* Dispose of a specific fragment group.
|
|
1171
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1172
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1173
|
+
*
|
|
1174
|
+
* @param group - The fragment group to be disposed.
|
|
1130
1175
|
*/
|
|
1131
|
-
|
|
1132
|
-
path: string;
|
|
1133
|
-
absolute: boolean;
|
|
1134
|
-
};
|
|
1135
|
-
/** {@link Component.enabled} */
|
|
1136
|
-
enabled: boolean;
|
|
1176
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
1137
1177
|
/**
|
|
1138
|
-
*
|
|
1178
|
+
* Loads a binary file that contain fragment geometry.
|
|
1179
|
+
* @param data - The binary data to load.
|
|
1180
|
+
* @param config - Optional configuration for loading.
|
|
1181
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1182
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1183
|
+
* @returns The loaded FragmentsGroup.
|
|
1139
1184
|
*/
|
|
1140
|
-
|
|
1185
|
+
load(data: Uint8Array, config?: Partial<{
|
|
1186
|
+
coordinate: boolean;
|
|
1187
|
+
name: string;
|
|
1188
|
+
properties: FRAGS.IfcProperties;
|
|
1189
|
+
relationsMap: RelationsMap;
|
|
1190
|
+
}>): FragmentsGroup;
|
|
1141
1191
|
/**
|
|
1142
|
-
*
|
|
1192
|
+
* Export the specified fragmentsgroup to binary data.
|
|
1193
|
+
* @param group - the fragments group to be exported.
|
|
1194
|
+
* @returns the exported data as binary buffer.
|
|
1143
1195
|
*/
|
|
1144
|
-
|
|
1196
|
+
export(group: FragmentsGroup): Uint8Array;
|
|
1145
1197
|
/**
|
|
1146
|
-
*
|
|
1198
|
+
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1199
|
+
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1200
|
+
* @returns A map of model IDs to sets of express IDs.
|
|
1147
1201
|
*/
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
dispose(): void;
|
|
1202
|
+
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1203
|
+
[modelID: string]: Set<number>;
|
|
1204
|
+
};
|
|
1152
1205
|
/**
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
* @
|
|
1156
|
-
* @
|
|
1157
|
-
*
|
|
1206
|
+
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1207
|
+
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1208
|
+
* @returns A fragment ID map.
|
|
1209
|
+
* @remarks
|
|
1210
|
+
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1211
|
+
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1212
|
+
* The fragment ID maps are then merged into a single map and returned.
|
|
1213
|
+
* 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.
|
|
1158
1214
|
*/
|
|
1159
|
-
|
|
1215
|
+
modelIdToFragmentIdMap(modelIdMap: {
|
|
1216
|
+
[modelID: string]: Set<number>;
|
|
1217
|
+
}): FRAGS.FragmentIdMap;
|
|
1160
1218
|
/**
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1166
|
-
* The rest of the properties will be set as the properties of the entity.
|
|
1219
|
+
* Applies coordinate transformation to the provided models.
|
|
1220
|
+
* If no models are provided, all groups are used.
|
|
1221
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
1222
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
1167
1223
|
*
|
|
1168
|
-
* @
|
|
1224
|
+
* @param models - The models to apply coordinate transformation to.
|
|
1225
|
+
* If not provided, all groups are used.
|
|
1169
1226
|
*
|
|
1170
|
-
* @
|
|
1227
|
+
* @returns {void}
|
|
1171
1228
|
*/
|
|
1172
|
-
|
|
1229
|
+
coordinate(models?: FragmentsGroup[]): void;
|
|
1230
|
+
}
|
|
1231
|
+
import * as WEBIFC from "web-ifc";
|
|
1232
|
+
import { Components, Disposable, Event, Component } from "../../core";
|
|
1233
|
+
import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
|
|
1234
|
+
/**
|
|
1235
|
+
* 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).
|
|
1236
|
+
*/
|
|
1237
|
+
export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
1173
1238
|
/**
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1177
|
-
* @param name - The name of the Pset.
|
|
1178
|
-
* @param description - (Optional) The description of the Pset.
|
|
1179
|
-
*
|
|
1180
|
-
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1181
|
-
*
|
|
1182
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1183
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1239
|
+
* A unique identifier for the component.
|
|
1240
|
+
* This UUID is used to register the component within the Components system.
|
|
1184
1241
|
*/
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1242
|
+
static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
|
|
1243
|
+
/**
|
|
1244
|
+
* Event triggered when geometry is streamed.
|
|
1245
|
+
* Contains the streamed geometry data and its buffer.
|
|
1246
|
+
*/
|
|
1247
|
+
readonly onGeometryStreamed: Event<{
|
|
1248
|
+
buffer: Uint8Array;
|
|
1249
|
+
data: StreamedGeometries;
|
|
1188
1250
|
}>;
|
|
1189
1251
|
/**
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1192
|
-
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1193
|
-
* @param psetID - The express IDs of the Psets to be removed.
|
|
1194
|
-
*
|
|
1195
|
-
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
1196
|
-
*
|
|
1197
|
-
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1198
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1199
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1252
|
+
* Event triggered when assets are streamed.
|
|
1253
|
+
* Contains the streamed assets.
|
|
1200
1254
|
*/
|
|
1201
|
-
|
|
1255
|
+
readonly onAssetStreamed: Event<StreamedAsset[]>;
|
|
1202
1256
|
/**
|
|
1203
|
-
*
|
|
1204
|
-
*
|
|
1205
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
1206
|
-
* @param type - The type of the property value. Must be a string property type.
|
|
1207
|
-
* @param name - The name of the property.
|
|
1208
|
-
* @param value - The value of the property. Must be a string.
|
|
1209
|
-
*
|
|
1210
|
-
* @returns The newly created single-value property.
|
|
1211
|
-
*
|
|
1212
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1213
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1257
|
+
* Event triggered to indicate the progress of the streaming process.
|
|
1258
|
+
* Contains the progress percentage.
|
|
1214
1259
|
*/
|
|
1215
|
-
|
|
1260
|
+
readonly onProgress: Event<number>;
|
|
1216
1261
|
/**
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
1220
|
-
* @param type - The type of the property value. Must be a numeric property type.
|
|
1221
|
-
* @param name - The name of the property.
|
|
1222
|
-
* @param value - The value of the property. Must be a number.
|
|
1223
|
-
*
|
|
1224
|
-
* @returns The newly created single-value property.
|
|
1225
|
-
*
|
|
1226
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1227
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1228
|
-
*/
|
|
1229
|
-
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1230
|
-
/**
|
|
1231
|
-
* Creates a new single-value property of type boolean in the given model.
|
|
1232
|
-
*
|
|
1233
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
1234
|
-
* @param type - The type of the property value. Must be a boolean property type.
|
|
1235
|
-
* @param name - The name of the property.
|
|
1236
|
-
* @param value - The value of the property. Must be a boolean.
|
|
1237
|
-
*
|
|
1238
|
-
* @returns The newly created single-value property.
|
|
1239
|
-
*
|
|
1240
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1241
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1262
|
+
* Event triggered when the IFC file is loaded.
|
|
1263
|
+
* Contains the loaded IFC file data.
|
|
1242
1264
|
*/
|
|
1243
|
-
|
|
1265
|
+
readonly onIfcLoaded: Event<Uint8Array>;
|
|
1266
|
+
/** {@link Disposable.onDisposed} */
|
|
1267
|
+
readonly onDisposed: Event<unknown>;
|
|
1244
1268
|
/**
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
* @param model - The FragmentsGroup model from which to remove the property.
|
|
1248
|
-
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
1249
|
-
* @param propID - The express ID of the property to be removed.
|
|
1250
|
-
*
|
|
1251
|
-
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
1252
|
-
*
|
|
1253
|
-
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
1254
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1269
|
+
* Settings for the IfcGeometryTiler.
|
|
1255
1270
|
*/
|
|
1256
|
-
|
|
1257
|
-
|
|
1271
|
+
settings: IfcStreamingSettings;
|
|
1272
|
+
/** {@link Component.enabled} */
|
|
1273
|
+
enabled: boolean;
|
|
1258
1274
|
/**
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
* @param model - The FragmentsGroup model in which to add the elements.
|
|
1262
|
-
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
1263
|
-
* @param elementID - The express IDs of the elements to be added.
|
|
1264
|
-
*
|
|
1265
|
-
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
1266
|
-
*
|
|
1267
|
-
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
1268
|
-
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
1269
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1275
|
+
* The WebIFC API instance used for IFC file processing.
|
|
1270
1276
|
*/
|
|
1271
|
-
|
|
1277
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1278
|
+
private _spatialTree;
|
|
1279
|
+
private _metaData;
|
|
1280
|
+
private _visitedGeometries;
|
|
1281
|
+
private _streamSerializer;
|
|
1282
|
+
private _geometries;
|
|
1283
|
+
private _geometryCount;
|
|
1284
|
+
private _civil;
|
|
1285
|
+
private _groupSerializer;
|
|
1286
|
+
private _assets;
|
|
1287
|
+
private _meshesWithHoles;
|
|
1288
|
+
constructor(components: Components);
|
|
1289
|
+
/** {@link Disposable.dispose} */
|
|
1290
|
+
dispose(): void;
|
|
1272
1291
|
/**
|
|
1273
|
-
*
|
|
1292
|
+
* This method streams the IFC file from a given buffer.
|
|
1274
1293
|
*
|
|
1275
|
-
* @param
|
|
1276
|
-
* @
|
|
1294
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1295
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1277
1296
|
*
|
|
1278
|
-
* @
|
|
1297
|
+
* @remarks
|
|
1298
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1279
1299
|
*
|
|
1280
|
-
* @
|
|
1300
|
+
* @example
|
|
1301
|
+
* '''typescript
|
|
1302
|
+
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1303
|
+
* const rawBuffer = await response.arrayBuffer();
|
|
1304
|
+
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1305
|
+
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1306
|
+
* '''
|
|
1281
1307
|
*/
|
|
1282
|
-
|
|
1308
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1283
1309
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
* The listener will trigger an event whenever the attribute's value changes.
|
|
1310
|
+
* This method streams the IFC file from a given callback.
|
|
1286
1311
|
*
|
|
1287
|
-
* @param
|
|
1288
|
-
* @
|
|
1289
|
-
* @param attributeName - The name of the attribute for which to set the listener.
|
|
1312
|
+
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
1313
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1290
1314
|
*
|
|
1291
|
-
* @
|
|
1315
|
+
* @remarks
|
|
1316
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1292
1317
|
*
|
|
1293
|
-
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
1294
|
-
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
1295
|
-
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
1296
1318
|
*/
|
|
1297
|
-
|
|
1298
|
-
private
|
|
1299
|
-
private
|
|
1300
|
-
private
|
|
1301
|
-
private
|
|
1302
|
-
private
|
|
1319
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1320
|
+
private readIfcFile;
|
|
1321
|
+
private streamIfcFile;
|
|
1322
|
+
private streamAllGeometries;
|
|
1323
|
+
private cleanUp;
|
|
1324
|
+
private getMesh;
|
|
1325
|
+
private getGeometry;
|
|
1326
|
+
private streamAssets;
|
|
1327
|
+
private streamGeometries;
|
|
1303
1328
|
}
|
|
1304
|
-
import * as
|
|
1305
|
-
import {
|
|
1329
|
+
import * as WEBIFC from "web-ifc";
|
|
1330
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1331
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1306
1332
|
/**
|
|
1307
|
-
* A component that
|
|
1333
|
+
* 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).
|
|
1308
1334
|
*/
|
|
1309
|
-
export declare class
|
|
1335
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1310
1336
|
/**
|
|
1311
1337
|
* A unique identifier for the component.
|
|
1312
1338
|
* This UUID is used to register the component within the Components system.
|
|
1313
1339
|
*/
|
|
1314
|
-
static readonly uuid: "
|
|
1315
|
-
/** {@link Component.enabled} */
|
|
1316
|
-
enabled: boolean;
|
|
1317
|
-
constructor(components: Components);
|
|
1340
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1318
1341
|
/**
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1321
|
-
* If 'items' is provided, only the specified fragments will be affected.
|
|
1322
|
-
*
|
|
1323
|
-
* @param visible - The visibility state to set for the fragments.
|
|
1324
|
-
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
1325
|
-
* If not provided, all fragments will be affected.
|
|
1326
|
-
*
|
|
1327
|
-
* @returns {void}
|
|
1342
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1343
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1328
1344
|
*/
|
|
1329
|
-
|
|
1345
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1346
|
+
type: number;
|
|
1347
|
+
data: {
|
|
1348
|
+
[id: number]: any;
|
|
1349
|
+
};
|
|
1350
|
+
}>;
|
|
1330
1351
|
/**
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1333
|
-
*
|
|
1334
|
-
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
1335
|
-
* If not provided, all fragments will be isolated.
|
|
1336
|
-
*
|
|
1337
|
-
* @returns {void}
|
|
1352
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
1353
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1338
1354
|
*/
|
|
1339
|
-
|
|
1340
|
-
private updateCulledVisibility;
|
|
1341
|
-
}
|
|
1342
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
1343
|
-
/**
|
|
1344
|
-
* 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).
|
|
1345
|
-
*/
|
|
1346
|
-
export declare class Exploder extends Component implements Disposable {
|
|
1355
|
+
readonly onProgress: AsyncEvent<number>;
|
|
1347
1356
|
/**
|
|
1348
|
-
*
|
|
1349
|
-
*
|
|
1357
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
1358
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1350
1359
|
*/
|
|
1351
|
-
|
|
1360
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1352
1361
|
/** {@link Disposable.onDisposed} */
|
|
1353
|
-
readonly onDisposed: Event<
|
|
1362
|
+
readonly onDisposed: Event<string>;
|
|
1354
1363
|
/** {@link Component.enabled} */
|
|
1355
1364
|
enabled: boolean;
|
|
1356
1365
|
/**
|
|
1357
|
-
*
|
|
1358
|
-
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1359
|
-
* Default value is 10.
|
|
1360
|
-
*/
|
|
1361
|
-
height: number;
|
|
1362
|
-
/**
|
|
1363
|
-
* The group name used for the explosion animation.
|
|
1364
|
-
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1365
|
-
* Default value is "storeys".
|
|
1366
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1366
1367
|
*/
|
|
1367
|
-
|
|
1368
|
+
settings: PropertiesStreamingSettings;
|
|
1368
1369
|
/**
|
|
1369
|
-
*
|
|
1370
|
-
* This set is used to keep track of which items have been exploded.
|
|
1370
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1371
1371
|
*/
|
|
1372
|
-
|
|
1373
|
-
constructor(components: Components);
|
|
1372
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1374
1373
|
/** {@link Disposable.dispose} */
|
|
1375
|
-
dispose(): void
|
|
1374
|
+
dispose(): Promise<void>;
|
|
1376
1375
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
1380
|
-
*
|
|
1381
|
-
* @remarks
|
|
1382
|
-
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
1383
|
-
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1384
|
-
* If 'active' is false, the fragments are moved back to their original position.
|
|
1385
|
-
*
|
|
1386
|
-
* The method also keeps track of the exploded items using the 'list' set.
|
|
1376
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1387
1377
|
*
|
|
1388
|
-
* @
|
|
1378
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1379
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1389
1380
|
*/
|
|
1390
|
-
|
|
1391
|
-
}
|
|
1392
|
-
import * as THREE from "three";
|
|
1393
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1394
|
-
import { Disposable, Component, Event, Components } from "../../core";
|
|
1395
|
-
/**
|
|
1396
|
-
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
|
|
1397
|
-
*/
|
|
1398
|
-
export interface Classification {
|
|
1381
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1399
1382
|
/**
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1383
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1384
|
+
*
|
|
1385
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1386
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1402
1387
|
*/
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
[className: string]: FRAGS.FragmentIdMap;
|
|
1409
|
-
};
|
|
1388
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1389
|
+
private readIfcFile;
|
|
1390
|
+
private streamIfcFile;
|
|
1391
|
+
private streamAllProperties;
|
|
1392
|
+
private cleanUp;
|
|
1410
1393
|
}
|
|
1394
|
+
import * as WEBIFC from "web-ifc";
|
|
1395
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1396
|
+
import { Component, Components } from "../../core";
|
|
1411
1397
|
/**
|
|
1412
|
-
*
|
|
1398
|
+
* 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).
|
|
1413
1399
|
*/
|
|
1414
|
-
export declare class
|
|
1400
|
+
export declare class IfcJsonExporter extends Component {
|
|
1415
1401
|
/**
|
|
1416
1402
|
* A unique identifier for the component.
|
|
1417
1403
|
* This UUID is used to register the component within the Components system.
|
|
1418
1404
|
*/
|
|
1419
|
-
static readonly uuid: "
|
|
1405
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1420
1406
|
/** {@link Component.enabled} */
|
|
1421
1407
|
enabled: boolean;
|
|
1422
|
-
/**
|
|
1423
|
-
* A map representing the classification systems.
|
|
1424
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1425
|
-
*/
|
|
1426
|
-
list: Classification;
|
|
1427
|
-
/** {@link Disposable.onDisposed} */
|
|
1428
|
-
readonly onDisposed: Event<unknown>;
|
|
1429
1408
|
constructor(components: Components);
|
|
1430
|
-
private onFragmentsDisposed;
|
|
1431
|
-
/** {@link Disposable.dispose} */
|
|
1432
|
-
dispose(): void;
|
|
1433
1409
|
/**
|
|
1434
|
-
*
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
* @param
|
|
1410
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
1411
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1412
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
1413
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
1414
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1415
|
+
* to make the location data available (e.g. absolute position of building).
|
|
1438
1416
|
*/
|
|
1439
|
-
|
|
1417
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1418
|
+
}
|
|
1419
|
+
import * as THREE from "three";
|
|
1420
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
1421
|
+
center: THREE.Vector3;
|
|
1422
|
+
halfSizes: THREE.Vector3;
|
|
1423
|
+
rotation: THREE.Matrix3;
|
|
1424
|
+
transformation: THREE.Matrix4;
|
|
1425
|
+
};
|
|
1426
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1427
|
+
import * as THREE from "three";
|
|
1428
|
+
export declare class MaterialsUtils {
|
|
1429
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
1430
|
+
}
|
|
1431
|
+
export declare class UUID {
|
|
1432
|
+
private static _pattern;
|
|
1433
|
+
private static _lut;
|
|
1434
|
+
static create(): string;
|
|
1435
|
+
static validate(uuid: string): void;
|
|
1436
|
+
}
|
|
1437
|
+
import * as THREE from "three";
|
|
1438
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1439
|
+
/**
|
|
1440
|
+
* Configuration interface for the VertexPicker component.
|
|
1441
|
+
*/
|
|
1442
|
+
export interface VertexPickerConfig {
|
|
1440
1443
|
/**
|
|
1441
|
-
*
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
* The
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
*
|
|
1444
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
1445
|
+
*/
|
|
1446
|
+
showOnlyVertex: boolean;
|
|
1447
|
+
/**
|
|
1448
|
+
* The maximum distance for snapping to a vertex.
|
|
1449
|
+
*/
|
|
1450
|
+
snapDistance: number;
|
|
1451
|
+
/**
|
|
1452
|
+
* The HTML element to use for previewing the picked vertex.
|
|
1453
|
+
*/
|
|
1454
|
+
previewElement: HTMLElement;
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1458
|
+
*/
|
|
1459
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
1460
|
+
/** {@link Disposable.onDisposed} */
|
|
1461
|
+
readonly onDisposed: Event<unknown>;
|
|
1462
|
+
/**
|
|
1463
|
+
* An event that is triggered when a vertex is found.
|
|
1464
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1465
|
+
*/
|
|
1466
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1467
|
+
/**
|
|
1468
|
+
* An event that is triggered when a vertex is lost.
|
|
1469
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
1470
|
+
*/
|
|
1471
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
1472
|
+
/**
|
|
1473
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
1474
|
+
*/
|
|
1475
|
+
components: Components;
|
|
1476
|
+
/**
|
|
1477
|
+
* A reference to the working plane used for vertex picking.
|
|
1478
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
1479
|
+
* If this value is null, all vertices are considered valid.
|
|
1480
|
+
*/
|
|
1481
|
+
workingPlane: THREE.Plane | null;
|
|
1482
|
+
private _pickedPoint;
|
|
1483
|
+
private _config;
|
|
1484
|
+
private _enabled;
|
|
1485
|
+
/**
|
|
1486
|
+
* Sets the enabled state of the VertexPicker.
|
|
1487
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
1488
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1450
1489
|
*
|
|
1451
|
-
* @
|
|
1490
|
+
* @param value - The new enabled state.
|
|
1452
1491
|
*/
|
|
1453
|
-
|
|
1454
|
-
[name: string]: string[];
|
|
1455
|
-
}): FRAGS.FragmentIdMap;
|
|
1492
|
+
set enabled(value: boolean);
|
|
1456
1493
|
/**
|
|
1457
|
-
*
|
|
1494
|
+
* Gets the current enabled state of the VertexPicker.
|
|
1458
1495
|
*
|
|
1459
|
-
* @
|
|
1460
|
-
|
|
1496
|
+
* @returns The current enabled state.
|
|
1497
|
+
*/
|
|
1498
|
+
get enabled(): boolean;
|
|
1499
|
+
/**
|
|
1500
|
+
* Sets the configuration for the VertexPicker component.
|
|
1461
1501
|
*
|
|
1462
|
-
* @
|
|
1463
|
-
*
|
|
1464
|
-
* and classifies them based on their modelID.
|
|
1465
|
-
* The classification is stored in the 'list.models' property,
|
|
1466
|
-
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1502
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
1503
|
+
* The properties not provided in the value object will retain their current values.
|
|
1467
1504
|
*
|
|
1505
|
+
* @example
|
|
1506
|
+
* '''typescript
|
|
1507
|
+
* vertexPicker.config = {
|
|
1508
|
+
* snapDistance: 0.5,
|
|
1509
|
+
* showOnlyVertex: true,
|
|
1510
|
+
* };
|
|
1511
|
+
* '''
|
|
1468
1512
|
*/
|
|
1469
|
-
|
|
1513
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
1470
1514
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1515
|
+
* Gets the current configuration for the VertexPicker component.
|
|
1474
1516
|
*
|
|
1475
|
-
* @
|
|
1476
|
-
* This method iterates through the properties of the fragments in the provided group,
|
|
1477
|
-
* and classifies them based on their PredefinedType property.
|
|
1478
|
-
* The classification is stored in the 'list.predefinedTypes' property,
|
|
1479
|
-
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1517
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
1480
1518
|
*
|
|
1481
|
-
* @
|
|
1519
|
+
* @example
|
|
1520
|
+
* '''typescript
|
|
1521
|
+
* const currentConfig = vertexPicker.config;
|
|
1522
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1523
|
+
* '''
|
|
1482
1524
|
*/
|
|
1483
|
-
|
|
1525
|
+
get config(): Partial<VertexPickerConfig>;
|
|
1526
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1527
|
+
/** {@link Disposable.dispose} */
|
|
1528
|
+
dispose(): void;
|
|
1484
1529
|
/**
|
|
1485
|
-
*
|
|
1530
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1486
1531
|
*
|
|
1487
|
-
* @param
|
|
1532
|
+
* @param world - The World instance to use for raycasting.
|
|
1488
1533
|
*
|
|
1489
|
-
* @
|
|
1490
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1491
|
-
* and classifies them based on their entity type.
|
|
1492
|
-
* The classification is stored in the 'list.entities' property,
|
|
1493
|
-
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1534
|
+
* @returns The current picked point, or null if no point is picked.
|
|
1494
1535
|
*
|
|
1495
|
-
* @
|
|
1536
|
+
* @remarks
|
|
1537
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1538
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1539
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1540
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1541
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1542
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1496
1543
|
*/
|
|
1497
|
-
|
|
1544
|
+
get(world: World): THREE.Vector3 | null;
|
|
1545
|
+
private getClosestVertex;
|
|
1546
|
+
private getVertices;
|
|
1547
|
+
private getVertex;
|
|
1548
|
+
}
|
|
1549
|
+
import * as WEBIFC from "web-ifc";
|
|
1550
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1551
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
1552
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
1553
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
1554
|
+
/**
|
|
1555
|
+
* 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).
|
|
1556
|
+
*/
|
|
1557
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
1498
1558
|
/**
|
|
1499
|
-
*
|
|
1559
|
+
* A unique identifier for the component.
|
|
1560
|
+
* This UUID is used to register the component within the Components system.
|
|
1561
|
+
*/
|
|
1562
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
1563
|
+
/** {@link Disposable.onDisposed} */
|
|
1564
|
+
readonly onDisposed: Event<string>;
|
|
1565
|
+
/**
|
|
1566
|
+
* Event triggered when relations for a model have been indexed.
|
|
1567
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
1500
1568
|
*
|
|
1501
|
-
* @
|
|
1502
|
-
* @
|
|
1503
|
-
*
|
|
1569
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
1570
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
1571
|
+
* 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.
|
|
1572
|
+
*/
|
|
1573
|
+
readonly onRelationsIndexed: Event<{
|
|
1574
|
+
modelID: string;
|
|
1575
|
+
relationsMap: RelationsMap;
|
|
1576
|
+
}>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
1579
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
1580
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
1581
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
1582
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
1583
|
+
* of entity relationships within a model.
|
|
1584
|
+
*/
|
|
1585
|
+
readonly relationMaps: ModelsRelationMap;
|
|
1586
|
+
/** {@link Component.enabled} */
|
|
1587
|
+
enabled: boolean;
|
|
1588
|
+
private _relToAttributesMap;
|
|
1589
|
+
private _inverseAttributes;
|
|
1590
|
+
private _ifcRels;
|
|
1591
|
+
constructor(components: Components);
|
|
1592
|
+
private onFragmentsDisposed;
|
|
1593
|
+
private indexRelations;
|
|
1594
|
+
/**
|
|
1595
|
+
* Adds a relation map to the model's relations map.
|
|
1504
1596
|
*
|
|
1505
|
-
* @
|
|
1506
|
-
*
|
|
1507
|
-
* and classifies them based on the specified IFC relationship.
|
|
1508
|
-
* The classification is stored in the 'list' property under the specified system name,
|
|
1509
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1597
|
+
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
1598
|
+
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
1510
1599
|
*
|
|
1511
|
-
* @
|
|
1600
|
+
* @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
|
|
1512
1601
|
*/
|
|
1513
|
-
|
|
1602
|
+
setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
|
|
1514
1603
|
/**
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1604
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
1605
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
1606
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
1518
1607
|
*
|
|
1519
|
-
*
|
|
1520
|
-
*
|
|
1521
|
-
* and
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1608
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
1609
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
1610
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
1611
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1612
|
+
* of entities that are related through that attribute.
|
|
1524
1613
|
*
|
|
1525
|
-
* @
|
|
1614
|
+
* @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
|
|
1615
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
1616
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
1617
|
+
* @throws An error if the model does not have properties loaded.
|
|
1526
1618
|
*/
|
|
1527
|
-
|
|
1619
|
+
process(model: FragmentsGroup): Promise<RelationsMap>;
|
|
1528
1620
|
/**
|
|
1529
|
-
*
|
|
1621
|
+
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
1530
1622
|
*
|
|
1531
|
-
* @param
|
|
1532
|
-
* @param
|
|
1533
|
-
* @
|
|
1623
|
+
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
1624
|
+
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1625
|
+
* @returns A promise that resolves to the relations map for the processed model.
|
|
1626
|
+
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
1627
|
+
*/
|
|
1628
|
+
processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
|
|
1629
|
+
/**
|
|
1630
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
1631
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
1632
|
+
* returning the IDs of related entities if a match is found.
|
|
1534
1633
|
*
|
|
1535
|
-
* @
|
|
1536
|
-
*
|
|
1537
|
-
*
|
|
1634
|
+
* @param model The 'FragmentsGroup' model containing the entity.
|
|
1635
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
1636
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1637
|
+
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1638
|
+
* or the specified relation name is not indexed.
|
|
1639
|
+
*/
|
|
1640
|
+
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
|
|
1641
|
+
/**
|
|
1642
|
+
* Serializes the relations of a given relation map into a JSON string.
|
|
1643
|
+
* 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,
|
|
1644
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1645
|
+
* The resulting object is then serialized into a JSON string.
|
|
1538
1646
|
*
|
|
1539
|
-
* @
|
|
1647
|
+
* @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.
|
|
1648
|
+
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
1540
1649
|
*/
|
|
1541
|
-
|
|
1650
|
+
serializeRelations(relationMap: RelationsMap): string;
|
|
1542
1651
|
/**
|
|
1543
|
-
*
|
|
1652
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
1653
|
+
* This method iterates through the relations indexed for the given model,
|
|
1654
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1655
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1656
|
+
* The resulting object is then serialized into a JSON string.
|
|
1544
1657
|
*
|
|
1545
|
-
* @param
|
|
1658
|
+
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1659
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1660
|
+
* If the model has no indexed relations, 'null' is returned.
|
|
1661
|
+
*/
|
|
1662
|
+
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
1663
|
+
/**
|
|
1664
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
1665
|
+
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
1666
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1667
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1668
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1546
1669
|
*
|
|
1547
|
-
* @
|
|
1548
|
-
*
|
|
1549
|
-
|
|
1670
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
1671
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
1672
|
+
*/
|
|
1673
|
+
serializeAllRelations(): string;
|
|
1674
|
+
/**
|
|
1675
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
1676
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
1677
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1678
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1679
|
+
* of express IDs of entities related through that relation type.
|
|
1550
1680
|
*
|
|
1551
|
-
* @
|
|
1681
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
1682
|
+
* @returns A 'Map' where the key is the express ID of an entity as a number, and the value
|
|
1683
|
+
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
1684
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
1552
1685
|
*/
|
|
1553
|
-
|
|
1554
|
-
|
|
1686
|
+
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
1687
|
+
/** {@link Disposable.dispose} */
|
|
1688
|
+
dispose(): void;
|
|
1689
|
+
}
|
|
1690
|
+
import * as WEBIFC from "web-ifc";
|
|
1691
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1692
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
1693
|
+
/**
|
|
1694
|
+
* Types for boolean properties in IFC schema.
|
|
1695
|
+
*/
|
|
1696
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1697
|
+
/**
|
|
1698
|
+
* Types for string properties in IFC schema.
|
|
1699
|
+
*/
|
|
1700
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
1701
|
+
/**
|
|
1702
|
+
* Types for numeric properties in IFC schema.
|
|
1703
|
+
*/
|
|
1704
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
1705
|
+
/**
|
|
1706
|
+
* 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.
|
|
1707
|
+
*/
|
|
1708
|
+
export interface ChangeMap {
|
|
1709
|
+
[modelID: string]: Set<number>;
|
|
1555
1710
|
}
|
|
1556
|
-
import * as WEBIFC from "web-ifc";
|
|
1557
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1558
|
-
import { IfcFragmentSettings } from "./src";
|
|
1559
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1560
1711
|
/**
|
|
1561
|
-
*
|
|
1712
|
+
* 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.
|
|
1562
1713
|
*/
|
|
1563
|
-
export
|
|
1714
|
+
export interface AttributeListener {
|
|
1715
|
+
[modelID: string]: {
|
|
1716
|
+
[expressID: number]: {
|
|
1717
|
+
[attributeName: string]: Event<String | Boolean | Number>;
|
|
1718
|
+
};
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
/**
|
|
1722
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
1723
|
+
*/
|
|
1724
|
+
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
1564
1725
|
/**
|
|
1565
1726
|
* A unique identifier for the component.
|
|
1566
1727
|
* This UUID is used to register the component within the Components system.
|
|
1567
1728
|
*/
|
|
1568
|
-
static readonly uuid: "
|
|
1729
|
+
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
1569
1730
|
/** {@link Disposable.onDisposed} */
|
|
1570
1731
|
readonly onDisposed: Event<string>;
|
|
1571
1732
|
/**
|
|
1572
|
-
*
|
|
1733
|
+
* Event triggered when a file is requested for export.
|
|
1573
1734
|
*/
|
|
1574
|
-
readonly
|
|
1735
|
+
readonly onRequestFile: Event<unknown>;
|
|
1575
1736
|
/**
|
|
1576
|
-
*
|
|
1737
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
1577
1738
|
*/
|
|
1578
|
-
|
|
1739
|
+
ifcToExport: ArrayBuffer | null;
|
|
1579
1740
|
/**
|
|
1580
|
-
*
|
|
1581
|
-
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1741
|
+
* Event triggered when an element is added to a Pset.
|
|
1582
1742
|
*/
|
|
1583
|
-
|
|
1743
|
+
readonly onElementToPset: Event<{
|
|
1744
|
+
model: FragmentsGroup;
|
|
1745
|
+
psetID: number;
|
|
1746
|
+
elementID: number;
|
|
1747
|
+
}>;
|
|
1584
1748
|
/**
|
|
1585
|
-
*
|
|
1749
|
+
* Event triggered when a property is added to a Pset.
|
|
1586
1750
|
*/
|
|
1587
|
-
|
|
1751
|
+
readonly onPropToPset: Event<{
|
|
1752
|
+
model: FragmentsGroup;
|
|
1753
|
+
psetID: number;
|
|
1754
|
+
propID: number;
|
|
1755
|
+
}>;
|
|
1756
|
+
/**
|
|
1757
|
+
* Event triggered when a Pset is removed.
|
|
1758
|
+
*/
|
|
1759
|
+
readonly onPsetRemoved: Event<{
|
|
1760
|
+
model: FragmentsGroup;
|
|
1761
|
+
psetID: number;
|
|
1762
|
+
}>;
|
|
1763
|
+
/**
|
|
1764
|
+
* Event triggered when data in the model changes.
|
|
1765
|
+
*/
|
|
1766
|
+
readonly onDataChanged: Event<{
|
|
1767
|
+
model: FragmentsGroup;
|
|
1768
|
+
expressID: number;
|
|
1769
|
+
}>;
|
|
1770
|
+
/**
|
|
1771
|
+
* Configuration for the WebAssembly module.
|
|
1772
|
+
*/
|
|
1773
|
+
wasm: {
|
|
1774
|
+
path: string;
|
|
1775
|
+
absolute: boolean;
|
|
1776
|
+
};
|
|
1588
1777
|
/** {@link Component.enabled} */
|
|
1589
1778
|
enabled: boolean;
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1779
|
+
/**
|
|
1780
|
+
* Map of attribute listeners.
|
|
1781
|
+
*/
|
|
1782
|
+
attributeListeners: AttributeListener;
|
|
1783
|
+
/**
|
|
1784
|
+
* The currently selected model.
|
|
1785
|
+
*/
|
|
1786
|
+
selectedModel?: FragmentsGroup;
|
|
1787
|
+
/**
|
|
1788
|
+
* Map of changed entities in the model.
|
|
1789
|
+
*/
|
|
1790
|
+
changeMap: ChangeMap;
|
|
1597
1791
|
constructor(components: Components);
|
|
1598
1792
|
/** {@link Disposable.dispose} */
|
|
1599
1793
|
dispose(): void;
|
|
1600
1794
|
/**
|
|
1601
|
-
*
|
|
1795
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
1602
1796
|
*
|
|
1603
|
-
* @param
|
|
1604
|
-
*
|
|
1797
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
1798
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1799
|
+
* @returns The IFC schema associated with the given model.
|
|
1800
|
+
*/
|
|
1801
|
+
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
1802
|
+
/**
|
|
1803
|
+
* Method to set properties data in the model.
|
|
1605
1804
|
*
|
|
1606
|
-
* @
|
|
1805
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
1806
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
1807
|
+
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1808
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
1607
1809
|
*
|
|
1608
|
-
* @
|
|
1609
|
-
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1610
|
-
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
1810
|
+
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
1611
1811
|
*
|
|
1612
|
-
* @
|
|
1613
|
-
* '''typescript
|
|
1614
|
-
* const ifcLoader = new IfcLoader(components);
|
|
1615
|
-
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1616
|
-
* '''
|
|
1812
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
1617
1813
|
*/
|
|
1618
|
-
|
|
1814
|
+
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
1619
1815
|
/**
|
|
1620
|
-
*
|
|
1816
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
1621
1817
|
*
|
|
1622
|
-
* @param
|
|
1623
|
-
* @param
|
|
1818
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1819
|
+
* @param name - The name of the Pset.
|
|
1820
|
+
* @param description - (Optional) The description of the Pset.
|
|
1624
1821
|
*
|
|
1625
|
-
* @returns A
|
|
1822
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1626
1823
|
*
|
|
1627
|
-
* @
|
|
1628
|
-
*
|
|
1629
|
-
* const ifcLoader = components.get(IfcLoader);
|
|
1630
|
-
* const group = await ifcLoader.load(ifcData);
|
|
1631
|
-
* '''
|
|
1824
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1825
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1632
1826
|
*/
|
|
1633
|
-
|
|
1827
|
+
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
1828
|
+
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
1829
|
+
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
1830
|
+
}>;
|
|
1634
1831
|
/**
|
|
1635
|
-
*
|
|
1636
|
-
*
|
|
1637
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1832
|
+
* Removes a Property Set (Pset) from the given model.
|
|
1638
1833
|
*
|
|
1639
|
-
* @
|
|
1834
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1835
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
1640
1836
|
*
|
|
1641
|
-
* @
|
|
1642
|
-
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1643
|
-
* It also opens the IFC model using the provided data and settings.
|
|
1837
|
+
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
1644
1838
|
*
|
|
1645
|
-
* @
|
|
1646
|
-
* ''
|
|
1647
|
-
*
|
|
1648
|
-
* await ifcLoader.readIfcFile(ifcData);
|
|
1649
|
-
* '''
|
|
1839
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1840
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1841
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1650
1842
|
*/
|
|
1651
|
-
|
|
1843
|
+
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
1652
1844
|
/**
|
|
1653
|
-
*
|
|
1654
|
-
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1845
|
+
* Creates a new single-value property of type string in the given model.
|
|
1655
1846
|
*
|
|
1656
|
-
* @
|
|
1657
|
-
*
|
|
1847
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1848
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
1849
|
+
* @param name - The name of the property.
|
|
1850
|
+
* @param value - The value of the property. Must be a string.
|
|
1658
1851
|
*
|
|
1659
|
-
* @
|
|
1660
|
-
*
|
|
1661
|
-
*
|
|
1662
|
-
*
|
|
1663
|
-
* '''
|
|
1664
|
-
*/
|
|
1665
|
-
cleanUp(): void;
|
|
1666
|
-
private getAllGeometries;
|
|
1667
|
-
private getMesh;
|
|
1668
|
-
private getGeometry;
|
|
1669
|
-
private autoSetWasm;
|
|
1670
|
-
}
|
|
1671
|
-
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1672
|
-
import * as THREE from "three";
|
|
1673
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1674
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1675
|
-
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1676
|
-
/**
|
|
1677
|
-
* 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).
|
|
1678
|
-
*/
|
|
1679
|
-
export declare class FragmentsManager extends Component implements Disposable {
|
|
1680
|
-
/**
|
|
1681
|
-
* A unique identifier for the component.
|
|
1682
|
-
* This UUID is used to register the component within the Components system.
|
|
1683
|
-
*/
|
|
1684
|
-
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1685
|
-
/** {@link Disposable.onDisposed} */
|
|
1686
|
-
readonly onDisposed: Event<unknown>;
|
|
1687
|
-
/**
|
|
1688
|
-
* Event triggered when fragments are loaded.
|
|
1689
|
-
*/
|
|
1690
|
-
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1691
|
-
/**
|
|
1692
|
-
* Event triggered when fragments are disposed.
|
|
1693
|
-
*/
|
|
1694
|
-
readonly onFragmentsDisposed: Event<{
|
|
1695
|
-
groupID: string;
|
|
1696
|
-
fragmentIDs: string[];
|
|
1697
|
-
}>;
|
|
1698
|
-
/**
|
|
1699
|
-
* Map containing all loaded fragments.
|
|
1700
|
-
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1701
|
-
*/
|
|
1702
|
-
readonly list: Map<string, Fragment>;
|
|
1703
|
-
/**
|
|
1704
|
-
* Map containing all loaded fragment groups.
|
|
1705
|
-
* The key is the group's unique identifier, and the value is the group itself.
|
|
1706
|
-
*/
|
|
1707
|
-
readonly groups: Map<string, FragmentsGroup>;
|
|
1708
|
-
baseCoordinationModel: string;
|
|
1709
|
-
/** {@link Component.enabled} */
|
|
1710
|
-
enabled: boolean;
|
|
1711
|
-
private _loader;
|
|
1712
|
-
/**
|
|
1713
|
-
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1714
|
-
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1715
|
-
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1852
|
+
* @returns The newly created single-value property.
|
|
1853
|
+
*
|
|
1854
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1855
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1716
1856
|
*/
|
|
1717
|
-
|
|
1718
|
-
constructor(components: Components);
|
|
1719
|
-
/** {@link Disposable.dispose} */
|
|
1720
|
-
dispose(): void;
|
|
1857
|
+
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1721
1858
|
/**
|
|
1722
|
-
*
|
|
1723
|
-
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1724
|
-
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1859
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
1725
1860
|
*
|
|
1726
|
-
* @param
|
|
1861
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1862
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
1863
|
+
* @param name - The name of the property.
|
|
1864
|
+
* @param value - The value of the property. Must be a number.
|
|
1865
|
+
*
|
|
1866
|
+
* @returns The newly created single-value property.
|
|
1867
|
+
*
|
|
1868
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1869
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1727
1870
|
*/
|
|
1728
|
-
|
|
1871
|
+
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1729
1872
|
/**
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
1732
|
-
* @param
|
|
1733
|
-
* @param
|
|
1734
|
-
* @param
|
|
1735
|
-
* @
|
|
1873
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
1874
|
+
*
|
|
1875
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1876
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
1877
|
+
* @param name - The name of the property.
|
|
1878
|
+
* @param value - The value of the property. Must be a boolean.
|
|
1879
|
+
*
|
|
1880
|
+
* @returns The newly created single-value property.
|
|
1881
|
+
*
|
|
1882
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1883
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1736
1884
|
*/
|
|
1737
|
-
|
|
1738
|
-
coordinate: boolean;
|
|
1739
|
-
name: string;
|
|
1740
|
-
properties: FRAGS.IfcProperties;
|
|
1741
|
-
relationsMap: RelationsMap;
|
|
1742
|
-
}>): FragmentsGroup;
|
|
1885
|
+
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1743
1886
|
/**
|
|
1744
|
-
*
|
|
1745
|
-
*
|
|
1746
|
-
* @
|
|
1887
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
1888
|
+
*
|
|
1889
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
1890
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
1891
|
+
* @param propID - The express ID of the property to be removed.
|
|
1892
|
+
*
|
|
1893
|
+
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
1894
|
+
*
|
|
1895
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
1896
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1747
1897
|
*/
|
|
1748
|
-
|
|
1898
|
+
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
1899
|
+
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
1749
1900
|
/**
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
* @
|
|
1901
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
1902
|
+
*
|
|
1903
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
1904
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
1905
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
1906
|
+
*
|
|
1907
|
+
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
1908
|
+
*
|
|
1909
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
1910
|
+
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
1911
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1753
1912
|
*/
|
|
1754
|
-
|
|
1755
|
-
[modelID: string]: Set<number>;
|
|
1756
|
-
};
|
|
1913
|
+
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
1757
1914
|
/**
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
* @
|
|
1761
|
-
* @
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
1915
|
+
* Saves the changes made to the model to a new IFC file.
|
|
1916
|
+
*
|
|
1917
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
1918
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
1919
|
+
*
|
|
1920
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
1921
|
+
*
|
|
1922
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
1766
1923
|
*/
|
|
1767
|
-
|
|
1768
|
-
[modelID: string]: Set<number>;
|
|
1769
|
-
}): FRAGS.FragmentIdMap;
|
|
1924
|
+
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
1770
1925
|
/**
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1773
|
-
* The first model in the list becomes the base model for coordinate transformation.
|
|
1774
|
-
* All other models are then transformed to match the base model's coordinate system.
|
|
1926
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
1927
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
1775
1928
|
*
|
|
1776
|
-
* @param
|
|
1777
|
-
*
|
|
1929
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
1930
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
1931
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
1778
1932
|
*
|
|
1779
|
-
* @returns
|
|
1933
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
1934
|
+
*
|
|
1935
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
1936
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
1937
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
1780
1938
|
*/
|
|
1781
|
-
|
|
1939
|
+
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
1940
|
+
private increaseMaxID;
|
|
1941
|
+
private newGUID;
|
|
1942
|
+
private getOwnerHistory;
|
|
1943
|
+
private registerChange;
|
|
1944
|
+
private newSingleProperty;
|
|
1782
1945
|
}
|
|
1783
1946
|
import * as THREE from "three";
|
|
1784
1947
|
import { Component, Components } from "../../core";
|
|
@@ -1846,232 +2009,20 @@ export declare class MeasurementUtils extends Component {
|
|
|
1846
2009
|
p3: THREE.Vector3;
|
|
1847
2010
|
faceNormal: THREE.Vector3;
|
|
1848
2011
|
};
|
|
1849
|
-
/**
|
|
1850
|
-
* Method to round the vector's components to a specified number of decimal places.
|
|
1851
|
-
* This is used to ensure numerical precision in edge detection.
|
|
1852
|
-
*
|
|
1853
|
-
* @param vector - The vector to round.
|
|
1854
|
-
* @returns The vector with rounded components.
|
|
1855
|
-
*/
|
|
1856
|
-
round(vector: THREE.Vector3): void;
|
|
1857
|
-
private getFaceData;
|
|
1858
|
-
}
|
|
1859
|
-
import * as WEBIFC from "web-ifc";
|
|
1860
|
-
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1861
|
-
import { PropertiesStreamingSettings } from "./src";
|
|
1862
|
-
/**
|
|
1863
|
-
* 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).
|
|
1864
|
-
*/
|
|
1865
|
-
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1866
|
-
/**
|
|
1867
|
-
* A unique identifier for the component.
|
|
1868
|
-
* This UUID is used to register the component within the Components system.
|
|
1869
|
-
*/
|
|
1870
|
-
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1871
|
-
/**
|
|
1872
|
-
* An event that is triggered when properties are streamed from the IFC file.
|
|
1873
|
-
* The event provides the type of the IFC entity and the corresponding data.
|
|
1874
|
-
*/
|
|
1875
|
-
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1876
|
-
type: number;
|
|
1877
|
-
data: {
|
|
1878
|
-
[id: number]: any;
|
|
1879
|
-
};
|
|
1880
|
-
}>;
|
|
1881
|
-
/**
|
|
1882
|
-
* An event that is triggered to indicate the progress of the streaming process.
|
|
1883
|
-
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1884
|
-
*/
|
|
1885
|
-
readonly onProgress: AsyncEvent<number>;
|
|
1886
|
-
/**
|
|
1887
|
-
* An event that is triggered when indices are streamed from the IFC file.
|
|
1888
|
-
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1889
|
-
*/
|
|
1890
|
-
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1891
|
-
/** {@link Disposable.onDisposed} */
|
|
1892
|
-
readonly onDisposed: Event<string>;
|
|
1893
|
-
/** {@link Component.enabled} */
|
|
1894
|
-
enabled: boolean;
|
|
1895
|
-
/**
|
|
1896
|
-
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1897
|
-
*/
|
|
1898
|
-
settings: PropertiesStreamingSettings;
|
|
1899
|
-
/**
|
|
1900
|
-
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1901
|
-
*/
|
|
1902
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1903
|
-
/** {@link Disposable.dispose} */
|
|
1904
|
-
dispose(): Promise<void>;
|
|
1905
|
-
/**
|
|
1906
|
-
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1907
|
-
*
|
|
1908
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1909
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1910
|
-
*/
|
|
1911
|
-
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1912
|
-
/**
|
|
1913
|
-
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1914
|
-
*
|
|
1915
|
-
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1916
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1917
|
-
*/
|
|
1918
|
-
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1919
|
-
private readIfcFile;
|
|
1920
|
-
private streamIfcFile;
|
|
1921
|
-
private streamAllProperties;
|
|
1922
|
-
private cleanUp;
|
|
1923
|
-
}
|
|
1924
|
-
import * as WEBIFC from "web-ifc";
|
|
1925
|
-
import { Components, Disposable, Event, Component } from "../../core";
|
|
1926
|
-
import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
|
|
1927
|
-
/**
|
|
1928
|
-
* 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).
|
|
1929
|
-
*/
|
|
1930
|
-
export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
1931
|
-
/**
|
|
1932
|
-
* A unique identifier for the component.
|
|
1933
|
-
* This UUID is used to register the component within the Components system.
|
|
1934
|
-
*/
|
|
1935
|
-
static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
|
|
1936
|
-
/**
|
|
1937
|
-
* Event triggered when geometry is streamed.
|
|
1938
|
-
* Contains the streamed geometry data and its buffer.
|
|
1939
|
-
*/
|
|
1940
|
-
readonly onGeometryStreamed: Event<{
|
|
1941
|
-
buffer: Uint8Array;
|
|
1942
|
-
data: StreamedGeometries;
|
|
1943
|
-
}>;
|
|
1944
|
-
/**
|
|
1945
|
-
* Event triggered when assets are streamed.
|
|
1946
|
-
* Contains the streamed assets.
|
|
1947
|
-
*/
|
|
1948
|
-
readonly onAssetStreamed: Event<StreamedAsset[]>;
|
|
1949
|
-
/**
|
|
1950
|
-
* Event triggered to indicate the progress of the streaming process.
|
|
1951
|
-
* Contains the progress percentage.
|
|
1952
|
-
*/
|
|
1953
|
-
readonly onProgress: Event<number>;
|
|
1954
|
-
/**
|
|
1955
|
-
* Event triggered when the IFC file is loaded.
|
|
1956
|
-
* Contains the loaded IFC file data.
|
|
1957
|
-
*/
|
|
1958
|
-
readonly onIfcLoaded: Event<Uint8Array>;
|
|
1959
|
-
/** {@link Disposable.onDisposed} */
|
|
1960
|
-
readonly onDisposed: Event<unknown>;
|
|
1961
|
-
/**
|
|
1962
|
-
* Settings for the IfcGeometryTiler.
|
|
1963
|
-
*/
|
|
1964
|
-
settings: IfcStreamingSettings;
|
|
1965
|
-
/** {@link Component.enabled} */
|
|
1966
|
-
enabled: boolean;
|
|
1967
|
-
/**
|
|
1968
|
-
* The WebIFC API instance used for IFC file processing.
|
|
1969
|
-
*/
|
|
1970
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1971
|
-
private _spatialTree;
|
|
1972
|
-
private _metaData;
|
|
1973
|
-
private _visitedGeometries;
|
|
1974
|
-
private _streamSerializer;
|
|
1975
|
-
private _geometries;
|
|
1976
|
-
private _geometryCount;
|
|
1977
|
-
private _civil;
|
|
1978
|
-
private _groupSerializer;
|
|
1979
|
-
private _assets;
|
|
1980
|
-
private _meshesWithHoles;
|
|
1981
|
-
constructor(components: Components);
|
|
1982
|
-
/** {@link Disposable.dispose} */
|
|
1983
|
-
dispose(): void;
|
|
1984
|
-
/**
|
|
1985
|
-
* This method streams the IFC file from a given buffer.
|
|
1986
|
-
*
|
|
1987
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1988
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1989
|
-
*
|
|
1990
|
-
* @remarks
|
|
1991
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
1992
|
-
*
|
|
1993
|
-
* @example
|
|
1994
|
-
* '''typescript
|
|
1995
|
-
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1996
|
-
* const rawBuffer = await response.arrayBuffer();
|
|
1997
|
-
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1998
|
-
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1999
|
-
* '''
|
|
2000
|
-
*/
|
|
2001
|
-
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
2002
|
-
/**
|
|
2003
|
-
* This method streams the IFC file from a given callback.
|
|
2004
|
-
*
|
|
2005
|
-
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
2006
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
2007
|
-
*
|
|
2008
|
-
* @remarks
|
|
2009
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
2012
|
+
/**
|
|
2013
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
2014
|
+
* This is used to ensure numerical precision in edge detection.
|
|
2010
2015
|
*
|
|
2016
|
+
* @param vector - The vector to round.
|
|
2017
|
+
* @returns The vector with rounded components.
|
|
2011
2018
|
*/
|
|
2012
|
-
|
|
2013
|
-
private
|
|
2014
|
-
private streamIfcFile;
|
|
2015
|
-
private streamAllGeometries;
|
|
2016
|
-
private cleanUp;
|
|
2017
|
-
private getMesh;
|
|
2018
|
-
private getGeometry;
|
|
2019
|
-
private streamAssets;
|
|
2020
|
-
private streamGeometries;
|
|
2021
|
-
}
|
|
2022
|
-
import * as WEBIFC from "web-ifc";
|
|
2023
|
-
export interface IfcItemsCategories {
|
|
2024
|
-
[itemID: number]: number;
|
|
2025
|
-
}
|
|
2026
|
-
export declare class IfcCategories {
|
|
2027
|
-
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2028
|
-
}
|
|
2029
|
-
/**
|
|
2030
|
-
* 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.
|
|
2031
|
-
*
|
|
2032
|
-
* @remarks
|
|
2033
|
-
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2034
|
-
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2035
|
-
*
|
|
2036
|
-
*/
|
|
2037
|
-
export declare const IfcElements: {
|
|
2038
|
-
[key: number]: string;
|
|
2039
|
-
};
|
|
2040
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
2041
|
-
export declare class IfcPropertiesUtils {
|
|
2042
|
-
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2043
|
-
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2044
|
-
[attribute: string]: any;
|
|
2045
|
-
} | null>;
|
|
2046
|
-
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2047
|
-
[relatingID: number]: number[];
|
|
2048
|
-
}>;
|
|
2049
|
-
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2050
|
-
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2051
|
-
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2052
|
-
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2053
|
-
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2054
|
-
key: string | null;
|
|
2055
|
-
name: string | null;
|
|
2056
|
-
}>;
|
|
2057
|
-
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2058
|
-
key: string | null;
|
|
2059
|
-
value: number | null;
|
|
2060
|
-
}>;
|
|
2061
|
-
static isRel(expressID: number): boolean;
|
|
2062
|
-
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2063
|
-
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2019
|
+
round(vector: THREE.Vector3): void;
|
|
2020
|
+
private getFaceData;
|
|
2064
2021
|
}
|
|
2065
2022
|
/**
|
|
2066
2023
|
* A Set of unique numbers representing different types of IFC geometries.
|
|
2067
2024
|
*/
|
|
2068
2025
|
export declare const GeometryTypes: Set<number>;
|
|
2069
|
-
/**
|
|
2070
|
-
* 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.
|
|
2071
|
-
*/
|
|
2072
|
-
export declare const IfcCategoryMap: {
|
|
2073
|
-
[key: number]: string;
|
|
2074
|
-
};
|
|
2075
2026
|
import * as THREE from "three";
|
|
2076
2027
|
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
2077
2028
|
/**
|
|
@@ -2167,6 +2118,14 @@ export declare const relToAttributesMap: Map<number, {
|
|
|
2167
2118
|
forRelated: InverseAttribute;
|
|
2168
2119
|
}>;
|
|
2169
2120
|
import * as WEBIFC from "web-ifc";
|
|
2121
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2122
|
+
export declare class SpatialStructure {
|
|
2123
|
+
itemsByFloor: IfcItemsCategories;
|
|
2124
|
+
private _units;
|
|
2125
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2126
|
+
cleanUp(): void;
|
|
2127
|
+
}
|
|
2128
|
+
import * as WEBIFC from "web-ifc";
|
|
2170
2129
|
/** Configuration of the IFC-fragment conversion. */
|
|
2171
2130
|
export declare class IfcFragmentSettings {
|
|
2172
2131
|
/** Whether to extract the IFC properties into a JSON. */
|
|
@@ -2207,6 +2166,55 @@ export declare class IfcFragmentSettings {
|
|
|
2207
2166
|
*/
|
|
2208
2167
|
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2209
2168
|
}
|
|
2169
|
+
import * as WEBIFC from "web-ifc";
|
|
2170
|
+
export interface IfcItemsCategories {
|
|
2171
|
+
[itemID: number]: number;
|
|
2172
|
+
}
|
|
2173
|
+
export declare class IfcCategories {
|
|
2174
|
+
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* 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.
|
|
2178
|
+
*
|
|
2179
|
+
* @remarks
|
|
2180
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2181
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2182
|
+
*
|
|
2183
|
+
*/
|
|
2184
|
+
export declare const IfcElements: {
|
|
2185
|
+
[key: number]: string;
|
|
2186
|
+
};
|
|
2187
|
+
/**
|
|
2188
|
+
* 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.
|
|
2189
|
+
*/
|
|
2190
|
+
export declare const IfcCategoryMap: {
|
|
2191
|
+
[key: number]: string;
|
|
2192
|
+
};
|
|
2193
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2194
|
+
export declare class IfcPropertiesUtils {
|
|
2195
|
+
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2196
|
+
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2197
|
+
[attribute: string]: any;
|
|
2198
|
+
} | null>;
|
|
2199
|
+
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2200
|
+
[relatingID: number]: number[];
|
|
2201
|
+
}>;
|
|
2202
|
+
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2203
|
+
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2204
|
+
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2205
|
+
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2206
|
+
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2207
|
+
key: string | null;
|
|
2208
|
+
name: string | null;
|
|
2209
|
+
}>;
|
|
2210
|
+
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2211
|
+
key: string | null;
|
|
2212
|
+
value: number | null;
|
|
2213
|
+
}>;
|
|
2214
|
+
static isRel(expressID: number): boolean;
|
|
2215
|
+
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2216
|
+
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2217
|
+
}
|
|
2210
2218
|
/**
|
|
2211
2219
|
* 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.
|
|
2212
2220
|
*/
|
|
@@ -2371,14 +2379,6 @@ export interface CameraControllable {
|
|
|
2371
2379
|
*/
|
|
2372
2380
|
controls: CameraControls;
|
|
2373
2381
|
}
|
|
2374
|
-
import * as WEBIFC from "web-ifc";
|
|
2375
|
-
import { IfcItemsCategories } from "../../../ifc";
|
|
2376
|
-
export declare class SpatialStructure {
|
|
2377
|
-
itemsByFloor: IfcItemsCategories;
|
|
2378
|
-
private _units;
|
|
2379
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2380
|
-
cleanUp(): void;
|
|
2381
|
-
}
|
|
2382
2382
|
import { Base } from "./base";
|
|
2383
2383
|
/**
|
|
2384
2384
|
* 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.
|
|
@@ -2392,6 +2392,25 @@ export declare abstract class Component extends Base {
|
|
|
2392
2392
|
*/
|
|
2393
2393
|
abstract enabled: boolean;
|
|
2394
2394
|
}
|
|
2395
|
+
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2396
|
+
import { Components } from "../../Components";
|
|
2397
|
+
/**
|
|
2398
|
+
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
2399
|
+
*/
|
|
2400
|
+
export declare abstract class Base {
|
|
2401
|
+
components: Components;
|
|
2402
|
+
constructor(components: Components);
|
|
2403
|
+
/** Whether is component is {@link Disposable}. */
|
|
2404
|
+
isDisposeable: () => this is Disposable;
|
|
2405
|
+
/** Whether is component is {@link Resizeable}. */
|
|
2406
|
+
isResizeable: () => this is Resizeable;
|
|
2407
|
+
/** Whether is component is {@link Updateable}. */
|
|
2408
|
+
isUpdateable: () => this is Updateable;
|
|
2409
|
+
/** Whether is component is {@link Hideable}. */
|
|
2410
|
+
isHideable: () => this is Hideable;
|
|
2411
|
+
/** Whether is component is {@link Configurable}. */
|
|
2412
|
+
isConfigurable: () => this is Configurable<any>;
|
|
2413
|
+
}
|
|
2395
2414
|
import { Base } from "./base";
|
|
2396
2415
|
import { World } from "./world";
|
|
2397
2416
|
import { Event } from "./event";
|
|
@@ -2443,59 +2462,6 @@ export declare abstract class BaseCamera extends BaseWorldItem {
|
|
|
2443
2462
|
*/
|
|
2444
2463
|
hasCameraControls: () => this is CameraControllable;
|
|
2445
2464
|
}
|
|
2446
|
-
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2447
|
-
import { Components } from "../../Components";
|
|
2448
|
-
/**
|
|
2449
|
-
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
2450
|
-
*/
|
|
2451
|
-
export declare abstract class Base {
|
|
2452
|
-
components: Components;
|
|
2453
|
-
constructor(components: Components);
|
|
2454
|
-
/** Whether is component is {@link Disposable}. */
|
|
2455
|
-
isDisposeable: () => this is Disposable;
|
|
2456
|
-
/** Whether is component is {@link Resizeable}. */
|
|
2457
|
-
isResizeable: () => this is Resizeable;
|
|
2458
|
-
/** Whether is component is {@link Updateable}. */
|
|
2459
|
-
isUpdateable: () => this is Updateable;
|
|
2460
|
-
/** Whether is component is {@link Hideable}. */
|
|
2461
|
-
isHideable: () => this is Hideable;
|
|
2462
|
-
/** Whether is component is {@link Configurable}. */
|
|
2463
|
-
isConfigurable: () => this is Configurable<any>;
|
|
2464
|
-
}
|
|
2465
|
-
import * as THREE from "three";
|
|
2466
|
-
import { BaseScene } from "./base-scene";
|
|
2467
|
-
import { BaseCamera } from "./base-camera";
|
|
2468
|
-
import { BaseRenderer } from "./base-renderer";
|
|
2469
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
2470
|
-
/**
|
|
2471
|
-
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2472
|
-
*/
|
|
2473
|
-
export interface World extends Disposable, Updateable {
|
|
2474
|
-
/**
|
|
2475
|
-
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2476
|
-
*/
|
|
2477
|
-
meshes: Set<THREE.Mesh>;
|
|
2478
|
-
/**
|
|
2479
|
-
* The base scene of the world.
|
|
2480
|
-
*/
|
|
2481
|
-
scene: BaseScene;
|
|
2482
|
-
/**
|
|
2483
|
-
* The base camera of the world.
|
|
2484
|
-
*/
|
|
2485
|
-
camera: BaseCamera;
|
|
2486
|
-
/**
|
|
2487
|
-
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
2488
|
-
*/
|
|
2489
|
-
renderer: BaseRenderer | null;
|
|
2490
|
-
/**
|
|
2491
|
-
* A unique identifier for the world.
|
|
2492
|
-
*/
|
|
2493
|
-
uuid: string;
|
|
2494
|
-
/**
|
|
2495
|
-
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
2496
|
-
*/
|
|
2497
|
-
isDisposing: boolean;
|
|
2498
|
-
}
|
|
2499
2465
|
import * as THREE from "three";
|
|
2500
2466
|
import { Vector2 } from "three";
|
|
2501
2467
|
import { Event } from "./event";
|
|
@@ -2559,106 +2525,136 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
|
|
|
2559
2525
|
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
2560
2526
|
* excluding any planes marked as local.
|
|
2561
2527
|
*/
|
|
2562
|
-
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2528
|
+
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2529
|
+
}
|
|
2530
|
+
import * as THREE from "three";
|
|
2531
|
+
import { Disposable } from "./interfaces";
|
|
2532
|
+
import { Event } from "./event";
|
|
2533
|
+
import { Components } from "../../Components";
|
|
2534
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2535
|
+
/**
|
|
2536
|
+
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2537
|
+
*/
|
|
2538
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2539
|
+
/** {@link Disposable.onDisposed} */
|
|
2540
|
+
readonly onDisposed: Event<unknown>;
|
|
2541
|
+
/**
|
|
2542
|
+
* Abstract property representing the three.js object associated with this scene.
|
|
2543
|
+
* It should be implemented by subclasses.
|
|
2544
|
+
*/
|
|
2545
|
+
abstract three: THREE.Object3D;
|
|
2546
|
+
protected constructor(components: Components);
|
|
2547
|
+
/** {@link Disposable.dispose} */
|
|
2548
|
+
dispose(): void;
|
|
2549
|
+
}
|
|
2550
|
+
import * as THREE from "three";
|
|
2551
|
+
import { BaseScene } from "./base-scene";
|
|
2552
|
+
import { BaseCamera } from "./base-camera";
|
|
2553
|
+
import { BaseRenderer } from "./base-renderer";
|
|
2554
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
2555
|
+
/**
|
|
2556
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2557
|
+
*/
|
|
2558
|
+
export interface World extends Disposable, Updateable {
|
|
2559
|
+
/**
|
|
2560
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2561
|
+
*/
|
|
2562
|
+
meshes: Set<THREE.Mesh>;
|
|
2563
|
+
/**
|
|
2564
|
+
* The base scene of the world.
|
|
2565
|
+
*/
|
|
2566
|
+
scene: BaseScene;
|
|
2567
|
+
/**
|
|
2568
|
+
* The base camera of the world.
|
|
2569
|
+
*/
|
|
2570
|
+
camera: BaseCamera;
|
|
2571
|
+
/**
|
|
2572
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
2573
|
+
*/
|
|
2574
|
+
renderer: BaseRenderer | null;
|
|
2575
|
+
/**
|
|
2576
|
+
* A unique identifier for the world.
|
|
2577
|
+
*/
|
|
2578
|
+
uuid: string;
|
|
2579
|
+
/**
|
|
2580
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
2581
|
+
*/
|
|
2582
|
+
isDisposing: boolean;
|
|
2563
2583
|
}
|
|
2564
2584
|
import * as THREE from "three";
|
|
2565
|
-
import { Disposable } from "
|
|
2566
|
-
import { Event } from "./event";
|
|
2567
|
-
import { Components } from "../../Components";
|
|
2568
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2585
|
+
import { Disposable, Event } from "../../Types";
|
|
2569
2586
|
/**
|
|
2570
|
-
*
|
|
2587
|
+
* A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
|
|
2571
2588
|
*/
|
|
2572
|
-
export declare
|
|
2589
|
+
export declare class Mouse implements Disposable {
|
|
2590
|
+
dom: HTMLCanvasElement;
|
|
2591
|
+
private _event?;
|
|
2592
|
+
private _position;
|
|
2573
2593
|
/** {@link Disposable.onDisposed} */
|
|
2574
2594
|
readonly onDisposed: Event<unknown>;
|
|
2595
|
+
constructor(dom: HTMLCanvasElement);
|
|
2575
2596
|
/**
|
|
2576
|
-
*
|
|
2577
|
-
* It should be implemented by subclasses.
|
|
2597
|
+
* The real position of the mouse of the Three.js canvas.
|
|
2578
2598
|
*/
|
|
2579
|
-
|
|
2580
|
-
protected constructor(components: Components);
|
|
2599
|
+
get position(): THREE.Vector2;
|
|
2581
2600
|
/** {@link Disposable.dispose} */
|
|
2582
2601
|
dispose(): void;
|
|
2602
|
+
private getPositionY;
|
|
2603
|
+
private getPositionX;
|
|
2604
|
+
private updateMouseInfo;
|
|
2605
|
+
private setupEvents;
|
|
2583
2606
|
}
|
|
2584
2607
|
import * as THREE from "three";
|
|
2585
|
-
import {
|
|
2608
|
+
import { Components } from "../../Components";
|
|
2609
|
+
import { Event, World, Disposable } from "../../Types";
|
|
2610
|
+
import { Mouse } from "./mouse";
|
|
2586
2611
|
/**
|
|
2587
|
-
* A
|
|
2588
|
-
*
|
|
2589
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
2590
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
2591
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2612
|
+
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
2592
2613
|
*/
|
|
2593
|
-
export declare class
|
|
2594
|
-
/**
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2599
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
2600
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2601
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
2614
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
2615
|
+
/** {@link Component.enabled} */
|
|
2616
|
+
enabled: boolean;
|
|
2617
|
+
/** The components instance to which this Raycaster belongs. */
|
|
2618
|
+
components: Components;
|
|
2602
2619
|
/** {@link Disposable.onDisposed} */
|
|
2603
2620
|
readonly onDisposed: Event<unknown>;
|
|
2621
|
+
/** The position of the mouse in the screen. */
|
|
2622
|
+
readonly mouse: Mouse;
|
|
2604
2623
|
/**
|
|
2605
|
-
*
|
|
2606
|
-
|
|
2607
|
-
isDisposing: boolean;
|
|
2608
|
-
/**
|
|
2609
|
-
* Indicates whether the world is currently enabled.
|
|
2610
|
-
* When disabled, the world will not be updated.
|
|
2611
|
-
*/
|
|
2612
|
-
enabled: boolean;
|
|
2613
|
-
/**
|
|
2614
|
-
* A unique identifier for the world.
|
|
2615
|
-
*/
|
|
2616
|
-
uuid: string;
|
|
2617
|
-
/**
|
|
2618
|
-
* An optional name for the world.
|
|
2619
|
-
*/
|
|
2620
|
-
name?: string;
|
|
2621
|
-
private _scene?;
|
|
2622
|
-
private _camera?;
|
|
2623
|
-
private _renderer;
|
|
2624
|
-
/**
|
|
2625
|
-
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2626
|
-
* @returns The current scene.
|
|
2627
|
-
*/
|
|
2628
|
-
get scene(): T;
|
|
2629
|
-
/**
|
|
2630
|
-
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2631
|
-
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2632
|
-
* @param scene - The new scene to be set.
|
|
2633
|
-
*/
|
|
2634
|
-
set scene(scene: T);
|
|
2635
|
-
/**
|
|
2636
|
-
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2637
|
-
* @returns The current camera.
|
|
2624
|
+
* A reference to the Three.js Raycaster instance.
|
|
2625
|
+
* This is used for raycasting operations.
|
|
2638
2626
|
*/
|
|
2639
|
-
|
|
2627
|
+
readonly three: THREE.Raycaster;
|
|
2640
2628
|
/**
|
|
2641
|
-
*
|
|
2642
|
-
*
|
|
2643
|
-
* @param camera - The new camera to be set.
|
|
2629
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
2630
|
+
* This is used to access the camera and meshes.
|
|
2644
2631
|
*/
|
|
2645
|
-
|
|
2632
|
+
world: World;
|
|
2633
|
+
constructor(components: Components, world: World);
|
|
2634
|
+
/** {@link Disposable.dispose} */
|
|
2635
|
+
dispose(): void;
|
|
2646
2636
|
/**
|
|
2647
|
-
*
|
|
2648
|
-
*
|
|
2637
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
2638
|
+
* the first item found. This also takes into account the clipping planes
|
|
2639
|
+
* used by the renderer.
|
|
2640
|
+
*
|
|
2641
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
2642
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
2643
|
+
* {@link Components.meshes}.
|
|
2649
2644
|
*/
|
|
2650
|
-
|
|
2645
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
2651
2646
|
/**
|
|
2652
|
-
*
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
* @param
|
|
2647
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
2648
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
2649
|
+
*
|
|
2650
|
+
* @param origin - The origin of the ray.
|
|
2651
|
+
* @param direction - The direction of the ray.
|
|
2652
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
2653
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
2656
2654
|
*/
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
/** {@link Disposable.dispose} */
|
|
2661
|
-
dispose(disposeResources?: boolean): void;
|
|
2655
|
+
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;
|
|
2656
|
+
private intersect;
|
|
2657
|
+
private filterClippingPlanes;
|
|
2662
2658
|
}
|
|
2663
2659
|
import * as THREE from "three";
|
|
2664
2660
|
import { BaseScene, Configurable, Event } from "../../Types";
|
|
@@ -2754,6 +2750,144 @@ export declare class SimpleRenderer extends BaseRenderer {
|
|
|
2754
2750
|
private onContextBack;
|
|
2755
2751
|
}
|
|
2756
2752
|
import * as THREE from "three";
|
|
2753
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2754
|
+
/**
|
|
2755
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
2756
|
+
*
|
|
2757
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
2758
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
2759
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2760
|
+
*/
|
|
2761
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
2762
|
+
/**
|
|
2763
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2764
|
+
*/
|
|
2765
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2766
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2767
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2768
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2769
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2770
|
+
/** {@link Disposable.onDisposed} */
|
|
2771
|
+
readonly onDisposed: Event<unknown>;
|
|
2772
|
+
/**
|
|
2773
|
+
* 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.
|
|
2774
|
+
*/
|
|
2775
|
+
isDisposing: boolean;
|
|
2776
|
+
/**
|
|
2777
|
+
* Indicates whether the world is currently enabled.
|
|
2778
|
+
* When disabled, the world will not be updated.
|
|
2779
|
+
*/
|
|
2780
|
+
enabled: boolean;
|
|
2781
|
+
/**
|
|
2782
|
+
* A unique identifier for the world.
|
|
2783
|
+
*/
|
|
2784
|
+
uuid: string;
|
|
2785
|
+
/**
|
|
2786
|
+
* An optional name for the world.
|
|
2787
|
+
*/
|
|
2788
|
+
name?: string;
|
|
2789
|
+
private _scene?;
|
|
2790
|
+
private _camera?;
|
|
2791
|
+
private _renderer;
|
|
2792
|
+
/**
|
|
2793
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2794
|
+
* @returns The current scene.
|
|
2795
|
+
*/
|
|
2796
|
+
get scene(): T;
|
|
2797
|
+
/**
|
|
2798
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2799
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2800
|
+
* @param scene - The new scene to be set.
|
|
2801
|
+
*/
|
|
2802
|
+
set scene(scene: T);
|
|
2803
|
+
/**
|
|
2804
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2805
|
+
* @returns The current camera.
|
|
2806
|
+
*/
|
|
2807
|
+
get camera(): U;
|
|
2808
|
+
/**
|
|
2809
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
2810
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
2811
|
+
* @param camera - The new camera to be set.
|
|
2812
|
+
*/
|
|
2813
|
+
set camera(camera: U);
|
|
2814
|
+
/**
|
|
2815
|
+
* Getter for the renderer.
|
|
2816
|
+
* @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).
|
|
2817
|
+
*/
|
|
2818
|
+
get renderer(): S | null;
|
|
2819
|
+
/**
|
|
2820
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
2821
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
2822
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2823
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2824
|
+
*/
|
|
2825
|
+
set renderer(renderer: S | null);
|
|
2826
|
+
/** {@link Updateable.update} */
|
|
2827
|
+
update(delta?: number): void;
|
|
2828
|
+
/** {@link Disposable.dispose} */
|
|
2829
|
+
dispose(disposeResources?: boolean): void;
|
|
2830
|
+
}
|
|
2831
|
+
import * as THREE from "three";
|
|
2832
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2833
|
+
import { Components } from "../../Components";
|
|
2834
|
+
/**
|
|
2835
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
2836
|
+
*/
|
|
2837
|
+
export interface GridConfig {
|
|
2838
|
+
/**
|
|
2839
|
+
* The color of the grid lines.
|
|
2840
|
+
*/
|
|
2841
|
+
color: THREE.Color;
|
|
2842
|
+
/**
|
|
2843
|
+
* The size of the primary grid lines.
|
|
2844
|
+
*/
|
|
2845
|
+
size1: number;
|
|
2846
|
+
/**
|
|
2847
|
+
* The size of the secondary grid lines.
|
|
2848
|
+
*/
|
|
2849
|
+
size2: number;
|
|
2850
|
+
/**
|
|
2851
|
+
* The distance at which the grid lines start to fade away.
|
|
2852
|
+
*/
|
|
2853
|
+
distance: number;
|
|
2854
|
+
}
|
|
2855
|
+
/**
|
|
2856
|
+
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2857
|
+
*/
|
|
2858
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2859
|
+
/** {@link Disposable.onDisposed} */
|
|
2860
|
+
readonly onDisposed: Event<unknown>;
|
|
2861
|
+
/** The world instance to which this Raycaster belongs. */
|
|
2862
|
+
world: World;
|
|
2863
|
+
/** The components instance to which this grid belongs. */
|
|
2864
|
+
components: Components;
|
|
2865
|
+
/** {@link Hideable.visible} */
|
|
2866
|
+
get visible(): boolean;
|
|
2867
|
+
/** {@link Hideable.visible} */
|
|
2868
|
+
set visible(visible: boolean);
|
|
2869
|
+
/** The material of the grid. */
|
|
2870
|
+
get material(): THREE.ShaderMaterial;
|
|
2871
|
+
/**
|
|
2872
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2873
|
+
* perspective cameras and false for orthographic cameras.
|
|
2874
|
+
*/
|
|
2875
|
+
get fade(): boolean;
|
|
2876
|
+
/**
|
|
2877
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2878
|
+
* perspective cameras and false for orthographic cameras.
|
|
2879
|
+
*/
|
|
2880
|
+
set fade(active: boolean);
|
|
2881
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
2882
|
+
readonly three: THREE.Mesh;
|
|
2883
|
+
private _fade;
|
|
2884
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
2885
|
+
/** {@link Disposable.dispose} */
|
|
2886
|
+
dispose(): void;
|
|
2887
|
+
private setupEvents;
|
|
2888
|
+
private updateZoom;
|
|
2889
|
+
}
|
|
2890
|
+
import * as THREE from "three";
|
|
2757
2891
|
import { Components } from "../../Components";
|
|
2758
2892
|
import { AsyncEvent, Event, World } from "../../Types";
|
|
2759
2893
|
/**
|
|
@@ -2930,296 +3064,39 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
|
|
|
2930
3064
|
/**
|
|
2931
3065
|
* Map of color code to THREE.InstancedMesh.
|
|
2932
3066
|
* Used to keep track of color-coded meshes.
|
|
2933
|
-
*/
|
|
2934
|
-
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2935
|
-
/**
|
|
2936
|
-
* Flag to indicate if the renderer is currently processing.
|
|
2937
|
-
* Used to prevent concurrent processing.
|
|
2938
|
-
*/
|
|
2939
|
-
isProcessing: boolean;
|
|
2940
|
-
private _colorCodeMeshMap;
|
|
2941
|
-
private _meshIDColorCodeMap;
|
|
2942
|
-
private _currentVisibleMeshes;
|
|
2943
|
-
private _recentlyHiddenMeshes;
|
|
2944
|
-
private _intervalID;
|
|
2945
|
-
private readonly _transparentMat;
|
|
2946
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2947
|
-
/** {@link Disposable.dispose} */
|
|
2948
|
-
dispose(): void;
|
|
2949
|
-
/**
|
|
2950
|
-
* 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.
|
|
2951
|
-
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2952
|
-
* @returns {void}
|
|
2953
|
-
*/
|
|
2954
|
-
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2955
|
-
/**
|
|
2956
|
-
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2957
|
-
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2958
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2959
|
-
* @returns {void}
|
|
2960
|
-
*/
|
|
2961
|
-
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2962
|
-
private handleWorkerMessage;
|
|
2963
|
-
private getAvailableMaterial;
|
|
2964
|
-
}
|
|
2965
|
-
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2966
|
-
import * as THREE from "three";
|
|
2967
|
-
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2968
|
-
import { Components } from "../../Components";
|
|
2969
|
-
/**
|
|
2970
|
-
* Configuration interface for the {@link SimpleGrid} class.
|
|
2971
|
-
*/
|
|
2972
|
-
export interface GridConfig {
|
|
2973
|
-
/**
|
|
2974
|
-
* The color of the grid lines.
|
|
2975
|
-
*/
|
|
2976
|
-
color: THREE.Color;
|
|
2977
|
-
/**
|
|
2978
|
-
* The size of the primary grid lines.
|
|
2979
|
-
*/
|
|
2980
|
-
size1: number;
|
|
2981
|
-
/**
|
|
2982
|
-
* The size of the secondary grid lines.
|
|
2983
|
-
*/
|
|
2984
|
-
size2: number;
|
|
2985
|
-
/**
|
|
2986
|
-
* The distance at which the grid lines start to fade away.
|
|
2987
|
-
*/
|
|
2988
|
-
distance: number;
|
|
2989
|
-
}
|
|
2990
|
-
/**
|
|
2991
|
-
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2992
|
-
*/
|
|
2993
|
-
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2994
|
-
/** {@link Disposable.onDisposed} */
|
|
2995
|
-
readonly onDisposed: Event<unknown>;
|
|
2996
|
-
/** The world instance to which this Raycaster belongs. */
|
|
2997
|
-
world: World;
|
|
2998
|
-
/** The components instance to which this grid belongs. */
|
|
2999
|
-
components: Components;
|
|
3000
|
-
/** {@link Hideable.visible} */
|
|
3001
|
-
get visible(): boolean;
|
|
3002
|
-
/** {@link Hideable.visible} */
|
|
3003
|
-
set visible(visible: boolean);
|
|
3004
|
-
/** The material of the grid. */
|
|
3005
|
-
get material(): THREE.ShaderMaterial;
|
|
3006
|
-
/**
|
|
3007
|
-
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3008
|
-
* perspective cameras and false for orthographic cameras.
|
|
3009
|
-
*/
|
|
3010
|
-
get fade(): boolean;
|
|
3011
|
-
/**
|
|
3012
|
-
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3013
|
-
* perspective cameras and false for orthographic cameras.
|
|
3014
|
-
*/
|
|
3015
|
-
set fade(active: boolean);
|
|
3016
|
-
/** The Three.js mesh that contains the infinite grid. */
|
|
3017
|
-
readonly three: THREE.Mesh;
|
|
3018
|
-
private _fade;
|
|
3019
|
-
constructor(components: Components, world: World, config: GridConfig);
|
|
3020
|
-
/** {@link Disposable.dispose} */
|
|
3021
|
-
dispose(): void;
|
|
3022
|
-
private setupEvents;
|
|
3023
|
-
private updateZoom;
|
|
3024
|
-
}
|
|
3025
|
-
import * as THREE from "three";
|
|
3026
|
-
import { Disposable, Event } from "../../Types";
|
|
3027
|
-
/**
|
|
3028
|
-
* A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
|
|
3029
|
-
*/
|
|
3030
|
-
export declare class Mouse implements Disposable {
|
|
3031
|
-
dom: HTMLCanvasElement;
|
|
3032
|
-
private _event?;
|
|
3033
|
-
private _position;
|
|
3034
|
-
/** {@link Disposable.onDisposed} */
|
|
3035
|
-
readonly onDisposed: Event<unknown>;
|
|
3036
|
-
constructor(dom: HTMLCanvasElement);
|
|
3037
|
-
/**
|
|
3038
|
-
* The real position of the mouse of the Three.js canvas.
|
|
3039
|
-
*/
|
|
3040
|
-
get position(): THREE.Vector2;
|
|
3041
|
-
/** {@link Disposable.dispose} */
|
|
3042
|
-
dispose(): void;
|
|
3043
|
-
private getPositionY;
|
|
3044
|
-
private getPositionX;
|
|
3045
|
-
private updateMouseInfo;
|
|
3046
|
-
private setupEvents;
|
|
3047
|
-
}
|
|
3048
|
-
import { NavigationMode } from "./types";
|
|
3049
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3050
|
-
/**
|
|
3051
|
-
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3052
|
-
*/
|
|
3053
|
-
export declare class FirstPersonMode implements NavigationMode {
|
|
3054
|
-
private camera;
|
|
3055
|
-
/** {@link NavigationMode.enabled} */
|
|
3056
|
-
enabled: boolean;
|
|
3057
|
-
/** {@link NavigationMode.id} */
|
|
3058
|
-
readonly id = "FirstPerson";
|
|
3059
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3060
|
-
/** {@link NavigationMode.set} */
|
|
3061
|
-
set(active: boolean): void;
|
|
3062
|
-
private setupFirstPersonCamera;
|
|
3063
|
-
}
|
|
3064
|
-
import * as THREE from "three";
|
|
3065
|
-
import { Components } from "../../Components";
|
|
3066
|
-
import { Event, World, Disposable } from "../../Types";
|
|
3067
|
-
import { Mouse } from "./mouse";
|
|
3068
|
-
/**
|
|
3069
|
-
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
3070
|
-
*/
|
|
3071
|
-
export declare class SimpleRaycaster implements Disposable {
|
|
3072
|
-
/** {@link Component.enabled} */
|
|
3073
|
-
enabled: boolean;
|
|
3074
|
-
/** The components instance to which this Raycaster belongs. */
|
|
3075
|
-
components: Components;
|
|
3076
|
-
/** {@link Disposable.onDisposed} */
|
|
3077
|
-
readonly onDisposed: Event<unknown>;
|
|
3078
|
-
/** The position of the mouse in the screen. */
|
|
3079
|
-
readonly mouse: Mouse;
|
|
3080
|
-
/**
|
|
3081
|
-
* A reference to the Three.js Raycaster instance.
|
|
3082
|
-
* This is used for raycasting operations.
|
|
3083
|
-
*/
|
|
3084
|
-
readonly three: THREE.Raycaster;
|
|
3085
|
-
/**
|
|
3086
|
-
* A reference to the world instance to which this Raycaster belongs.
|
|
3087
|
-
* This is used to access the camera and meshes.
|
|
3088
|
-
*/
|
|
3089
|
-
world: World;
|
|
3090
|
-
constructor(components: Components, world: World);
|
|
3091
|
-
/** {@link Disposable.dispose} */
|
|
3092
|
-
dispose(): void;
|
|
3093
|
-
/**
|
|
3094
|
-
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3095
|
-
* the first item found. This also takes into account the clipping planes
|
|
3096
|
-
* used by the renderer.
|
|
3097
|
-
*
|
|
3098
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3099
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
3100
|
-
* {@link Components.meshes}.
|
|
3101
|
-
*/
|
|
3102
|
-
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3103
|
-
/**
|
|
3104
|
-
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3105
|
-
* This method also takes into account the clipping planes used by the renderer.
|
|
3106
|
-
*
|
|
3107
|
-
* @param origin - The origin of the ray.
|
|
3108
|
-
* @param direction - The direction of the ray.
|
|
3109
|
-
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3110
|
-
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3111
|
-
*/
|
|
3112
|
-
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;
|
|
3113
|
-
private intersect;
|
|
3114
|
-
private filterClippingPlanes;
|
|
3115
|
-
}
|
|
3116
|
-
import { NavigationMode } from "./types";
|
|
3117
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3118
|
-
/**
|
|
3119
|
-
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3120
|
-
*/
|
|
3121
|
-
export declare class PlanMode implements NavigationMode {
|
|
3122
|
-
private camera;
|
|
3123
|
-
/** {@link NavigationMode.enabled} */
|
|
3124
|
-
enabled: boolean;
|
|
3125
|
-
/** {@link NavigationMode.id} */
|
|
3126
|
-
readonly id = "Plan";
|
|
3127
|
-
private mouseAction1?;
|
|
3128
|
-
private mouseAction2?;
|
|
3129
|
-
private mouseInitialized;
|
|
3130
|
-
private readonly defaultAzimuthSpeed;
|
|
3131
|
-
private readonly defaultPolarSpeed;
|
|
3132
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3133
|
-
/** {@link NavigationMode.set} */
|
|
3134
|
-
set(active: boolean): void;
|
|
3135
|
-
}
|
|
3136
|
-
import { NavigationMode } from "./types";
|
|
3137
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3138
|
-
/**
|
|
3139
|
-
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3140
|
-
*/
|
|
3141
|
-
export declare class OrbitMode implements NavigationMode {
|
|
3142
|
-
camera: OrthoPerspectiveCamera;
|
|
3143
|
-
/** {@link NavigationMode.enabled} */
|
|
3144
|
-
enabled: boolean;
|
|
3145
|
-
/** {@link NavigationMode.id} */
|
|
3146
|
-
readonly id = "Orbit";
|
|
3147
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3148
|
-
/** {@link NavigationMode.set} */
|
|
3149
|
-
set(active: boolean): void;
|
|
3150
|
-
private activateOrbitControls;
|
|
3151
|
-
}
|
|
3152
|
-
import * as THREE from "three";
|
|
3153
|
-
import { CameraProjection } from "./types";
|
|
3154
|
-
import { Event } from "../../Types";
|
|
3155
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3156
|
-
/**
|
|
3157
|
-
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3158
|
-
*/
|
|
3159
|
-
export declare class ProjectionManager {
|
|
3160
|
-
/**
|
|
3161
|
-
* Event that fires when the {@link CameraProjection} changes.
|
|
3162
|
-
*/
|
|
3163
|
-
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3164
|
-
/**
|
|
3165
|
-
* Current projection mode of the camera.
|
|
3166
|
-
* Default is "Perspective".
|
|
3167
|
-
*/
|
|
3168
|
-
current: CameraProjection;
|
|
3169
|
-
/**
|
|
3170
|
-
* The camera controlled by this ProjectionManager.
|
|
3171
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3172
|
-
*/
|
|
3173
|
-
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3174
|
-
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3175
|
-
matchOrthoDistanceEnabled: boolean;
|
|
3176
|
-
private _component;
|
|
3177
|
-
private _previousDistance;
|
|
3178
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3067
|
+
*/
|
|
3068
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
3179
3069
|
/**
|
|
3180
|
-
*
|
|
3181
|
-
*
|
|
3182
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
3183
|
-
* it will have no effect.
|
|
3070
|
+
* Flag to indicate if the renderer is currently processing.
|
|
3071
|
+
* Used to prevent concurrent processing.
|
|
3184
3072
|
*/
|
|
3185
|
-
|
|
3073
|
+
isProcessing: boolean;
|
|
3074
|
+
private _colorCodeMeshMap;
|
|
3075
|
+
private _meshIDColorCodeMap;
|
|
3076
|
+
private _currentVisibleMeshes;
|
|
3077
|
+
private _recentlyHiddenMeshes;
|
|
3078
|
+
private _intervalID;
|
|
3079
|
+
private readonly _transparentMat;
|
|
3080
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3081
|
+
/** {@link Disposable.dispose} */
|
|
3082
|
+
dispose(): void;
|
|
3186
3083
|
/**
|
|
3187
|
-
*
|
|
3188
|
-
*
|
|
3084
|
+
* 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.
|
|
3085
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3086
|
+
* @returns {void}
|
|
3189
3087
|
*/
|
|
3190
|
-
|
|
3191
|
-
private setOrthoCamera;
|
|
3192
|
-
private getPerspectiveDims;
|
|
3193
|
-
private setupOrthoCamera;
|
|
3194
|
-
private getDistance;
|
|
3195
|
-
private setPerspectiveCamera;
|
|
3196
|
-
}
|
|
3197
|
-
/**
|
|
3198
|
-
* The projection system of the camera.
|
|
3199
|
-
*/
|
|
3200
|
-
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3201
|
-
/**
|
|
3202
|
-
* The extensible list of supported navigation modes.
|
|
3203
|
-
*/
|
|
3204
|
-
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3205
|
-
/**
|
|
3206
|
-
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3207
|
-
*/
|
|
3208
|
-
export interface NavigationMode {
|
|
3209
|
-
/** The unique ID of this navigation mode. */
|
|
3210
|
-
id: NavModeID;
|
|
3088
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3211
3089
|
/**
|
|
3212
|
-
*
|
|
3213
|
-
* When
|
|
3214
|
-
*
|
|
3215
|
-
*
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
/** Whether this navigation mode is active or not. */
|
|
3221
|
-
enabled: boolean;
|
|
3090
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
3091
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
3092
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3093
|
+
* @returns {void}
|
|
3094
|
+
*/
|
|
3095
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3096
|
+
private handleWorkerMessage;
|
|
3097
|
+
private getAvailableMaterial;
|
|
3222
3098
|
}
|
|
3099
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
3223
3100
|
import * as THREE from "three";
|
|
3224
3101
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
3225
3102
|
import { Components } from "../../Components";
|
|
@@ -3328,51 +3205,148 @@ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
|
3328
3205
|
*/
|
|
3329
3206
|
propertiesSize: number;
|
|
3330
3207
|
}
|
|
3331
|
-
import
|
|
3332
|
-
import
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
}
|
|
3344
|
-
|
|
3208
|
+
import { NavigationMode } from "./types";
|
|
3209
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3210
|
+
/**
|
|
3211
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3212
|
+
*/
|
|
3213
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3214
|
+
private camera;
|
|
3215
|
+
/** {@link NavigationMode.enabled} */
|
|
3216
|
+
enabled: boolean;
|
|
3217
|
+
/** {@link NavigationMode.id} */
|
|
3218
|
+
readonly id = "FirstPerson";
|
|
3219
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3220
|
+
/** {@link NavigationMode.set} */
|
|
3221
|
+
set(active: boolean): void;
|
|
3222
|
+
private setupFirstPersonCamera;
|
|
3345
3223
|
}
|
|
3346
|
-
import {
|
|
3224
|
+
import { NavigationMode } from "./types";
|
|
3225
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3347
3226
|
/**
|
|
3348
|
-
*
|
|
3227
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3349
3228
|
*/
|
|
3350
|
-
export declare class
|
|
3229
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3230
|
+
camera: OrthoPerspectiveCamera;
|
|
3231
|
+
/** {@link NavigationMode.enabled} */
|
|
3232
|
+
enabled: boolean;
|
|
3233
|
+
/** {@link NavigationMode.id} */
|
|
3234
|
+
readonly id = "Orbit";
|
|
3235
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3236
|
+
/** {@link NavigationMode.set} */
|
|
3237
|
+
set(active: boolean): void;
|
|
3238
|
+
private activateOrbitControls;
|
|
3239
|
+
}
|
|
3240
|
+
import { NavigationMode } from "./types";
|
|
3241
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3242
|
+
/**
|
|
3243
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3244
|
+
*/
|
|
3245
|
+
export declare class PlanMode implements NavigationMode {
|
|
3246
|
+
private camera;
|
|
3247
|
+
/** {@link NavigationMode.enabled} */
|
|
3248
|
+
enabled: boolean;
|
|
3249
|
+
/** {@link NavigationMode.id} */
|
|
3250
|
+
readonly id = "Plan";
|
|
3251
|
+
private mouseAction1?;
|
|
3252
|
+
private mouseAction2?;
|
|
3253
|
+
private mouseInitialized;
|
|
3254
|
+
private readonly defaultAzimuthSpeed;
|
|
3255
|
+
private readonly defaultPolarSpeed;
|
|
3256
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3257
|
+
/** {@link NavigationMode.set} */
|
|
3258
|
+
set(active: boolean): void;
|
|
3259
|
+
}
|
|
3260
|
+
import * as THREE from "three";
|
|
3261
|
+
import { CameraProjection } from "./types";
|
|
3262
|
+
import { Event } from "../../Types";
|
|
3263
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3264
|
+
/**
|
|
3265
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3266
|
+
*/
|
|
3267
|
+
export declare class ProjectionManager {
|
|
3351
3268
|
/**
|
|
3352
|
-
*
|
|
3353
|
-
* Defaults to 10 geometries.
|
|
3269
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
3354
3270
|
*/
|
|
3355
|
-
|
|
3271
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3356
3272
|
/**
|
|
3357
|
-
*
|
|
3358
|
-
*
|
|
3273
|
+
* Current projection mode of the camera.
|
|
3274
|
+
* Default is "Perspective".
|
|
3359
3275
|
*/
|
|
3360
|
-
|
|
3276
|
+
current: CameraProjection;
|
|
3277
|
+
/**
|
|
3278
|
+
* The camera controlled by this ProjectionManager.
|
|
3279
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3280
|
+
*/
|
|
3281
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3282
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3283
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3284
|
+
private _component;
|
|
3285
|
+
private _previousDistance;
|
|
3286
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3287
|
+
/**
|
|
3288
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3289
|
+
*
|
|
3290
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3291
|
+
* it will have no effect.
|
|
3292
|
+
*/
|
|
3293
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3294
|
+
/**
|
|
3295
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3296
|
+
* and vice versa.
|
|
3297
|
+
*/
|
|
3298
|
+
toggle(): Promise<void>;
|
|
3299
|
+
private setOrthoCamera;
|
|
3300
|
+
private getPerspectiveDims;
|
|
3301
|
+
private setupOrthoCamera;
|
|
3302
|
+
private getDistance;
|
|
3303
|
+
private setPerspectiveCamera;
|
|
3304
|
+
}
|
|
3305
|
+
/**
|
|
3306
|
+
* The projection system of the camera.
|
|
3307
|
+
*/
|
|
3308
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3309
|
+
/**
|
|
3310
|
+
* The extensible list of supported navigation modes.
|
|
3311
|
+
*/
|
|
3312
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3313
|
+
/**
|
|
3314
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3315
|
+
*/
|
|
3316
|
+
export interface NavigationMode {
|
|
3317
|
+
/** The unique ID of this navigation mode. */
|
|
3318
|
+
id: NavModeID;
|
|
3319
|
+
/**
|
|
3320
|
+
* Enable or disable this navigation mode.
|
|
3321
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3322
|
+
* must be disabled.
|
|
3323
|
+
*
|
|
3324
|
+
* @param active - whether to enable or disable this mode.
|
|
3325
|
+
* @param options - any additional data required to enable or disable it.
|
|
3326
|
+
* */
|
|
3327
|
+
set: (active: boolean, options?: any) => void;
|
|
3328
|
+
/** Whether this navigation mode is active or not. */
|
|
3329
|
+
enabled: boolean;
|
|
3361
3330
|
}
|
|
3362
3331
|
import * as WEBIFC from "web-ifc";
|
|
3363
3332
|
export declare class IfcMetadataReader {
|
|
3364
3333
|
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3365
3334
|
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3366
3335
|
}
|
|
3367
|
-
import * as WEBIFC from "web-ifc";
|
|
3368
3336
|
import * as THREE from "three";
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3337
|
+
import * as WEBIFC from "web-ifc";
|
|
3338
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
3339
|
+
export declare class CivilReader {
|
|
3340
|
+
defLineMat: THREE.LineBasicMaterial;
|
|
3341
|
+
read(webIfc: WEBIFC.IfcAPI): {
|
|
3342
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
3343
|
+
coordinationMatrix: THREE.Matrix4;
|
|
3344
|
+
} | undefined;
|
|
3345
|
+
get(civilItems: any): {
|
|
3346
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
3347
|
+
coordinationMatrix: THREE.Matrix4;
|
|
3348
|
+
} | undefined;
|
|
3349
|
+
private getCurves;
|
|
3376
3350
|
}
|
|
3377
3351
|
/**
|
|
3378
3352
|
* 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.
|
|
@@ -3403,10 +3377,31 @@ export interface StreamedAsset {
|
|
|
3403
3377
|
color: number[];
|
|
3404
3378
|
}[];
|
|
3405
3379
|
}
|
|
3406
|
-
import {
|
|
3380
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3381
|
+
/**
|
|
3382
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3383
|
+
*/
|
|
3384
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3385
|
+
/**
|
|
3386
|
+
* Minimum number of geometries to be streamed.
|
|
3387
|
+
* Defaults to 10 geometries.
|
|
3388
|
+
*/
|
|
3389
|
+
minGeometrySize: number;
|
|
3390
|
+
/**
|
|
3391
|
+
* Minimum amount of assets to be streamed.
|
|
3392
|
+
* Defaults to 1000 assets.
|
|
3393
|
+
*/
|
|
3394
|
+
minAssetsSize: number;
|
|
3395
|
+
}
|
|
3396
|
+
import * as WEBIFC from "web-ifc";
|
|
3407
3397
|
import * as THREE from "three";
|
|
3408
|
-
export declare class
|
|
3409
|
-
|
|
3398
|
+
export declare class Units {
|
|
3399
|
+
factor: number;
|
|
3400
|
+
complement: number;
|
|
3401
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3402
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3403
|
+
private getLengthUnits;
|
|
3404
|
+
private getScaleMatrix;
|
|
3410
3405
|
}
|
|
3411
3406
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
3412
3407
|
export interface ModelsRelationMap {
|
|
@@ -3432,5 +3427,10 @@ export type InverseAttributes = [
|
|
|
3432
3427
|
"ContainsElements"
|
|
3433
3428
|
];
|
|
3434
3429
|
export type InverseAttribute = InverseAttributes[number];
|
|
3430
|
+
import { BufferGeometry } from "three";
|
|
3431
|
+
import * as THREE from "three";
|
|
3432
|
+
export declare class TransformHelper {
|
|
3433
|
+
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3434
|
+
}
|
|
3435
3435
|
|
|
3436
3436
|
}
|