@thatopen/components 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/fragments/FragmentsManager/index.d.ts +2 -3
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +306 -313
- package/dist/namespace.d.ts +1814 -1815
- package/package.json +2 -2
package/dist/namespace.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class Components implements Disposable {
|
|
|
7
7
|
/**
|
|
8
8
|
* The version of the @thatopen/components library.
|
|
9
9
|
*/
|
|
10
|
-
static readonly release = "2.1.
|
|
10
|
+
static readonly release = "2.1.5";
|
|
11
11
|
/** {@link Disposable.onDisposed} */
|
|
12
12
|
readonly onDisposed: Event<void>;
|
|
13
13
|
/**
|
|
@@ -75,6 +75,209 @@ export declare class Components implements Disposable {
|
|
|
75
75
|
private update;
|
|
76
76
|
private static setupBVH;
|
|
77
77
|
}
|
|
78
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
79
|
+
import { SimpleRaycaster } from "./src";
|
|
80
|
+
import { Components } from "../Components";
|
|
81
|
+
/**
|
|
82
|
+
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
83
|
+
*/
|
|
84
|
+
export declare class Raycasters extends Component implements Disposable {
|
|
85
|
+
/**
|
|
86
|
+
* A unique identifier for the component.
|
|
87
|
+
* This UUID is used to register the component within the Components system.
|
|
88
|
+
*/
|
|
89
|
+
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
90
|
+
/** {@link Component.enabled} */
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* A Map that stores raycasters for each world.
|
|
94
|
+
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
95
|
+
*/
|
|
96
|
+
list: Map<string, SimpleRaycaster>;
|
|
97
|
+
/** {@link Disposable.onDisposed} */
|
|
98
|
+
onDisposed: Event<unknown>;
|
|
99
|
+
constructor(components: Components);
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves a SimpleRaycaster instance for the given world.
|
|
102
|
+
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
103
|
+
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
104
|
+
*
|
|
105
|
+
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
106
|
+
* @returns The SimpleRaycaster instance for the given world.
|
|
107
|
+
*/
|
|
108
|
+
get(world: World): SimpleRaycaster;
|
|
109
|
+
/**
|
|
110
|
+
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
111
|
+
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
112
|
+
*
|
|
113
|
+
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
114
|
+
* @returns {void}
|
|
115
|
+
*/
|
|
116
|
+
delete(world: World): void;
|
|
117
|
+
/** {@link Disposable.dispose} */
|
|
118
|
+
dispose(): void;
|
|
119
|
+
}
|
|
120
|
+
import * as THREE from "three";
|
|
121
|
+
import { Components } from "../Components";
|
|
122
|
+
import { Component } from "../Types";
|
|
123
|
+
/**
|
|
124
|
+
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
125
|
+
*/
|
|
126
|
+
export declare class Disposer extends Component {
|
|
127
|
+
private _disposedComponents;
|
|
128
|
+
/** {@link Component.enabled} */
|
|
129
|
+
enabled: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* A unique identifier for the component.
|
|
132
|
+
* This UUID is used to register the component within the Components system.
|
|
133
|
+
*/
|
|
134
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
135
|
+
constructor(components: Components);
|
|
136
|
+
/**
|
|
137
|
+
* Return the UUIDs of all disposed components.
|
|
138
|
+
*/
|
|
139
|
+
get(): Set<string>;
|
|
140
|
+
/**
|
|
141
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
142
|
+
* using any of these in other parts of the application, make sure that you
|
|
143
|
+
* remove them from the mesh before disposing it.
|
|
144
|
+
*
|
|
145
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
146
|
+
* to remove.
|
|
147
|
+
*
|
|
148
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
149
|
+
*
|
|
150
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
151
|
+
*/
|
|
152
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
153
|
+
/**
|
|
154
|
+
* Disposes a geometry from memory.
|
|
155
|
+
*
|
|
156
|
+
* @param geometry - the
|
|
157
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
158
|
+
* to remove.
|
|
159
|
+
*/
|
|
160
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
161
|
+
private disposeGeometryAndMaterials;
|
|
162
|
+
private disposeChildren;
|
|
163
|
+
private static disposeMaterial;
|
|
164
|
+
}
|
|
165
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
166
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
167
|
+
import { Components } from "../Components";
|
|
168
|
+
/**
|
|
169
|
+
* A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
|
|
170
|
+
*/
|
|
171
|
+
export declare class Grids extends Component implements 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: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
177
|
+
/**
|
|
178
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
179
|
+
*/
|
|
180
|
+
list: Map<string, SimpleGrid>;
|
|
181
|
+
/**
|
|
182
|
+
* The default configuration for grid creation.
|
|
183
|
+
*/
|
|
184
|
+
config: Required<GridConfig>;
|
|
185
|
+
/** {@link Disposable.onDisposed} */
|
|
186
|
+
readonly onDisposed: Event<unknown>;
|
|
187
|
+
/** {@link Component.enabled} */
|
|
188
|
+
enabled: boolean;
|
|
189
|
+
constructor(components: Components);
|
|
190
|
+
/**
|
|
191
|
+
* Creates a new grid for the given world.
|
|
192
|
+
* Throws an error if a grid already exists for the world.
|
|
193
|
+
*
|
|
194
|
+
* @param world - The world to create the grid for.
|
|
195
|
+
* @returns The newly created grid.
|
|
196
|
+
*
|
|
197
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
198
|
+
*/
|
|
199
|
+
create(world: World): SimpleGrid;
|
|
200
|
+
/**
|
|
201
|
+
* Deletes the grid associated with the given world.
|
|
202
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
203
|
+
*
|
|
204
|
+
* @param world - The world for which to delete the grid.
|
|
205
|
+
*
|
|
206
|
+
* @remarks
|
|
207
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
208
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
209
|
+
*/
|
|
210
|
+
delete(world: World): void;
|
|
211
|
+
/** {@link Disposable.dispose} */
|
|
212
|
+
dispose(): void;
|
|
213
|
+
}
|
|
214
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
215
|
+
import { Components } from "../Components";
|
|
216
|
+
import { SimpleWorld } from "./src";
|
|
217
|
+
/**
|
|
218
|
+
* 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).
|
|
219
|
+
*/
|
|
220
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
221
|
+
/**
|
|
222
|
+
* A unique identifier for the component.
|
|
223
|
+
* This UUID is used to register the component within the Components system.
|
|
224
|
+
*/
|
|
225
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
226
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
227
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
228
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
229
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
230
|
+
/** {@link Disposable.onDisposed} */
|
|
231
|
+
readonly onDisposed: Event<unknown>;
|
|
232
|
+
/**
|
|
233
|
+
* An event that is triggered when a new world is created.
|
|
234
|
+
* The event passes the newly created world as a parameter.
|
|
235
|
+
*/
|
|
236
|
+
readonly onWorldCreated: Event<World>;
|
|
237
|
+
/**
|
|
238
|
+
* An event that is triggered when a world is deleted.
|
|
239
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
240
|
+
*/
|
|
241
|
+
readonly onWorldDeleted: Event<string>;
|
|
242
|
+
/**
|
|
243
|
+
* A collection of worlds managed by this component.
|
|
244
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
245
|
+
*/
|
|
246
|
+
list: Map<string, World>;
|
|
247
|
+
/** {@link Component.enabled} */
|
|
248
|
+
enabled: boolean;
|
|
249
|
+
constructor(components: Components);
|
|
250
|
+
/**
|
|
251
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
252
|
+
*
|
|
253
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
254
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
255
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
256
|
+
*
|
|
257
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
258
|
+
*/
|
|
259
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
260
|
+
/**
|
|
261
|
+
* Deletes a world from the list of worlds.
|
|
262
|
+
*
|
|
263
|
+
* @param {World} world - The world to be deleted.
|
|
264
|
+
*
|
|
265
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
266
|
+
*
|
|
267
|
+
* @returns {void}
|
|
268
|
+
*/
|
|
269
|
+
delete(world: World): void;
|
|
270
|
+
/**
|
|
271
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
272
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
273
|
+
* and triggers the onDisposed event.
|
|
274
|
+
*
|
|
275
|
+
* @returns {void}
|
|
276
|
+
*/
|
|
277
|
+
dispose(): void;
|
|
278
|
+
/** {@link Updateable.update} */
|
|
279
|
+
update(delta?: number): void | Promise<void>;
|
|
280
|
+
}
|
|
78
281
|
import * as THREE from "three";
|
|
79
282
|
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
80
283
|
import { SimplePlane } from "./src";
|
|
@@ -365,208 +568,251 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
365
568
|
private newOrthoCamera;
|
|
366
569
|
private setOrthoPerspCameraAspect;
|
|
367
570
|
}
|
|
368
|
-
import
|
|
369
|
-
import { Components } from "
|
|
370
|
-
import { SimpleWorld } from "./src";
|
|
571
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
572
|
+
import { Components, Component } from "../../core";
|
|
371
573
|
/**
|
|
372
|
-
* A
|
|
574
|
+
* A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
|
|
373
575
|
*/
|
|
374
|
-
export declare class
|
|
576
|
+
export declare class Hider extends Component {
|
|
375
577
|
/**
|
|
376
578
|
* A unique identifier for the component.
|
|
377
579
|
* This UUID is used to register the component within the Components system.
|
|
378
580
|
*/
|
|
379
|
-
static readonly uuid: "
|
|
380
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
381
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
382
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
383
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
384
|
-
/** {@link Disposable.onDisposed} */
|
|
385
|
-
readonly onDisposed: Event<unknown>;
|
|
386
|
-
/**
|
|
387
|
-
* An event that is triggered when a new world is created.
|
|
388
|
-
* The event passes the newly created world as a parameter.
|
|
389
|
-
*/
|
|
390
|
-
readonly onWorldCreated: Event<World>;
|
|
391
|
-
/**
|
|
392
|
-
* An event that is triggered when a world is deleted.
|
|
393
|
-
* The event passes the UUID of the deleted world as a parameter.
|
|
394
|
-
*/
|
|
395
|
-
readonly onWorldDeleted: Event<string>;
|
|
396
|
-
/**
|
|
397
|
-
* A collection of worlds managed by this component.
|
|
398
|
-
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
399
|
-
*/
|
|
400
|
-
list: Map<string, World>;
|
|
581
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
401
582
|
/** {@link Component.enabled} */
|
|
402
583
|
enabled: boolean;
|
|
403
584
|
constructor(components: Components);
|
|
404
585
|
/**
|
|
405
|
-
*
|
|
586
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
587
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
588
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
406
589
|
*
|
|
407
|
-
* @
|
|
408
|
-
* @
|
|
409
|
-
*
|
|
590
|
+
* @param visible - The visibility state to set for the fragments.
|
|
591
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
592
|
+
* If not provided, all fragments will be affected.
|
|
410
593
|
*
|
|
411
|
-
* @
|
|
594
|
+
* @returns {void}
|
|
412
595
|
*/
|
|
413
|
-
|
|
596
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
414
597
|
/**
|
|
415
|
-
*
|
|
598
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
599
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
416
600
|
*
|
|
417
|
-
* @param
|
|
418
|
-
*
|
|
419
|
-
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
420
|
-
*
|
|
421
|
-
* @returns {void}
|
|
422
|
-
*/
|
|
423
|
-
delete(world: World): void;
|
|
424
|
-
/**
|
|
425
|
-
* Disposes of the Worlds component and all its managed worlds.
|
|
426
|
-
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
427
|
-
* and triggers the onDisposed event.
|
|
601
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
602
|
+
* If not provided, all fragments will be isolated.
|
|
428
603
|
*
|
|
429
604
|
* @returns {void}
|
|
430
605
|
*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
update(delta?: number): void | Promise<void>;
|
|
606
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
607
|
+
private updateCulledVisibility;
|
|
434
608
|
}
|
|
435
|
-
import
|
|
436
|
-
import
|
|
437
|
-
import {
|
|
609
|
+
import * as THREE from "three";
|
|
610
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
611
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
612
|
+
import { Component, Components, Disposable, Event } from "../../core";
|
|
438
613
|
/**
|
|
439
|
-
* A
|
|
614
|
+
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
440
615
|
*/
|
|
441
|
-
export declare class
|
|
442
|
-
|
|
443
|
-
* A unique identifier for the component.
|
|
444
|
-
* This UUID is used to register the component within the Components system.
|
|
445
|
-
*/
|
|
446
|
-
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
616
|
+
export declare class BoundingBoxer extends Component implements Disposable {
|
|
617
|
+
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
447
618
|
/** {@link Component.enabled} */
|
|
448
619
|
enabled: boolean;
|
|
449
|
-
/**
|
|
450
|
-
* A Map that stores raycasters for each world.
|
|
451
|
-
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
452
|
-
*/
|
|
453
|
-
list: Map<string, SimpleRaycaster>;
|
|
454
620
|
/** {@link Disposable.onDisposed} */
|
|
455
|
-
onDisposed: Event<unknown>;
|
|
621
|
+
readonly onDisposed: Event<unknown>;
|
|
622
|
+
private _absoluteMin;
|
|
623
|
+
private _absoluteMax;
|
|
624
|
+
private _meshes;
|
|
456
625
|
constructor(components: Components);
|
|
457
626
|
/**
|
|
458
|
-
*
|
|
459
|
-
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
460
|
-
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
627
|
+
* A static method to calculate the dimensions of a given bounding box.
|
|
461
628
|
*
|
|
462
|
-
* @param
|
|
463
|
-
* @returns
|
|
629
|
+
* @param bbox - The bounding box to calculate the dimensions for.
|
|
630
|
+
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
464
631
|
*/
|
|
465
|
-
|
|
632
|
+
static getDimensions(bbox: THREE.Box3): {
|
|
633
|
+
width: number;
|
|
634
|
+
height: number;
|
|
635
|
+
depth: number;
|
|
636
|
+
center: THREE.Vector3;
|
|
637
|
+
};
|
|
466
638
|
/**
|
|
467
|
-
*
|
|
468
|
-
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
639
|
+
* A static method to create a new bounding box boundary.
|
|
469
640
|
*
|
|
470
|
-
* @param
|
|
471
|
-
* @returns
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
*
|
|
486
|
-
* This UUID is used to register the component within the Components system.
|
|
641
|
+
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
642
|
+
* @returns A new THREE.Vector3 representing the boundary.
|
|
643
|
+
*
|
|
644
|
+
* @remarks
|
|
645
|
+
* This method is used to create a new boundary for calculating bounding boxes.
|
|
646
|
+
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
647
|
+
* depending on the value of the 'positive' parameter.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* '''typescript
|
|
651
|
+
* const positiveBound = BoundingBoxer.newBound(true);
|
|
652
|
+
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
653
|
+
*
|
|
654
|
+
* const negativeBound = BoundingBoxer.newBound(false);
|
|
655
|
+
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
656
|
+
* '''
|
|
487
657
|
*/
|
|
488
|
-
static
|
|
658
|
+
static newBound(positive: boolean): THREE.Vector3;
|
|
489
659
|
/**
|
|
490
|
-
* A
|
|
660
|
+
* A static method to calculate the bounding box of a set of points.
|
|
661
|
+
*
|
|
662
|
+
* @param points - An array of THREE.Vector3 representing the points.
|
|
663
|
+
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
664
|
+
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
665
|
+
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
666
|
+
*
|
|
667
|
+
* @remarks
|
|
668
|
+
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
669
|
+
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* '''typescript
|
|
673
|
+
* const points = [
|
|
674
|
+
* new THREE.Vector3(1, 2, 3),
|
|
675
|
+
* new THREE.Vector3(4, 5, 6),
|
|
676
|
+
* new THREE.Vector3(7, 8, 9),
|
|
677
|
+
* ];
|
|
678
|
+
*
|
|
679
|
+
* const bbox = BoundingBoxer.getBounds(points);
|
|
680
|
+
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
681
|
+
* '''
|
|
491
682
|
*/
|
|
492
|
-
|
|
683
|
+
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
684
|
+
/** {@link Disposable.dispose} */
|
|
685
|
+
dispose(): void;
|
|
493
686
|
/**
|
|
494
|
-
*
|
|
687
|
+
* Returns the bounding box of the calculated fragments.
|
|
688
|
+
*
|
|
689
|
+
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
690
|
+
*
|
|
691
|
+
* @remarks
|
|
692
|
+
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
693
|
+
* The returned box represents the bounding box of the calculated fragments.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* '''typescript
|
|
697
|
+
* const boundingBox = boundingBoxer.get();
|
|
698
|
+
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
699
|
+
* '''
|
|
495
700
|
*/
|
|
496
|
-
|
|
497
|
-
/** {@link Disposable.onDisposed} */
|
|
498
|
-
readonly onDisposed: Event<unknown>;
|
|
499
|
-
/** {@link Component.enabled} */
|
|
500
|
-
enabled: boolean;
|
|
501
|
-
constructor(components: Components);
|
|
701
|
+
get(): THREE.Box3;
|
|
502
702
|
/**
|
|
503
|
-
*
|
|
504
|
-
* Throws an error if a grid already exists for the world.
|
|
703
|
+
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
505
704
|
*
|
|
506
|
-
* @
|
|
507
|
-
* @returns The newly created grid.
|
|
705
|
+
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
508
706
|
*
|
|
509
|
-
* @
|
|
707
|
+
* @remarks
|
|
708
|
+
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
709
|
+
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
710
|
+
* The radius is calculated as the distance from the center to the minimum bound.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* '''typescript
|
|
714
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
715
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
716
|
+
* const boundingSphere = boundingBoxer.getSphere();
|
|
717
|
+
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
718
|
+
* '''
|
|
510
719
|
*/
|
|
511
|
-
|
|
720
|
+
getSphere(): THREE.Sphere;
|
|
512
721
|
/**
|
|
513
|
-
*
|
|
514
|
-
* If a grid does not exist for the given world, this method does nothing.
|
|
722
|
+
* Returns a THREE.Mesh instance representing the bounding box.
|
|
515
723
|
*
|
|
516
|
-
* @
|
|
724
|
+
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
517
725
|
*
|
|
518
726
|
* @remarks
|
|
519
|
-
* This method
|
|
520
|
-
*
|
|
727
|
+
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
728
|
+
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
729
|
+
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
730
|
+
* The position of the mesh is set to the center of the bounding box.
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* '''typescript
|
|
734
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
735
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
736
|
+
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
737
|
+
* scene.add(boundingBoxMesh);
|
|
738
|
+
* '''
|
|
521
739
|
*/
|
|
522
|
-
|
|
523
|
-
/** {@link Disposable.dispose} */
|
|
524
|
-
dispose(): void;
|
|
525
|
-
}
|
|
526
|
-
import * as THREE from "three";
|
|
527
|
-
import { Components } from "../Components";
|
|
528
|
-
import { Component } from "../Types";
|
|
529
|
-
/**
|
|
530
|
-
* 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).
|
|
531
|
-
*/
|
|
532
|
-
export declare class Disposer extends Component {
|
|
533
|
-
private _disposedComponents;
|
|
534
|
-
/** {@link Component.enabled} */
|
|
535
|
-
enabled: boolean;
|
|
740
|
+
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
536
741
|
/**
|
|
537
|
-
*
|
|
538
|
-
* This
|
|
742
|
+
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
743
|
+
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
744
|
+
*
|
|
745
|
+
* @remarks
|
|
746
|
+
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
747
|
+
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* '''typescript
|
|
751
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
752
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
753
|
+
* // ...
|
|
754
|
+
* boundingBoxer.reset();
|
|
755
|
+
* '''
|
|
539
756
|
*/
|
|
540
|
-
|
|
541
|
-
constructor(components: Components);
|
|
757
|
+
reset(): void;
|
|
542
758
|
/**
|
|
543
|
-
*
|
|
759
|
+
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
760
|
+
*
|
|
761
|
+
* @param group - The FragmentsGroup to add.
|
|
762
|
+
*
|
|
763
|
+
* @remarks
|
|
764
|
+
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
765
|
+
* and calls the 'addMesh' method for each fragment's mesh.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* '''typescript
|
|
769
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
770
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
771
|
+
* '''
|
|
544
772
|
*/
|
|
545
|
-
|
|
773
|
+
add(group: FragmentsGroup): void;
|
|
546
774
|
/**
|
|
547
|
-
*
|
|
548
|
-
* using any of these in other parts of the application, make sure that you
|
|
549
|
-
* remove them from the mesh before disposing it.
|
|
775
|
+
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
550
776
|
*
|
|
551
|
-
* @param
|
|
552
|
-
*
|
|
777
|
+
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
778
|
+
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
553
779
|
*
|
|
554
|
-
* @
|
|
780
|
+
* @remarks
|
|
781
|
+
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
782
|
+
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
783
|
+
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
555
784
|
*
|
|
556
|
-
* @
|
|
785
|
+
* @example
|
|
786
|
+
* '''typescript
|
|
787
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
788
|
+
* boundingBoxer.addMesh(mesh);
|
|
789
|
+
* '''
|
|
557
790
|
*/
|
|
558
|
-
|
|
791
|
+
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
559
792
|
/**
|
|
560
|
-
*
|
|
793
|
+
* Uses a FragmentIdMap to add its meshes to the bb calculation.
|
|
561
794
|
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
795
|
+
* This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
|
|
796
|
+
* and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
|
|
797
|
+
*
|
|
798
|
+
* @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
|
|
799
|
+
*
|
|
800
|
+
* @remarks
|
|
801
|
+
* This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
|
|
802
|
+
* It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* '''typescript
|
|
806
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
807
|
+
* const fragmentIdMap: FRAGS.FragmentIdMap = {
|
|
808
|
+
* '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
|
|
809
|
+
* '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
|
|
810
|
+
* };
|
|
811
|
+
* boundingBoxer.addFragmentIdMap(fragmentIdMap);
|
|
812
|
+
* '''
|
|
565
813
|
*/
|
|
566
|
-
|
|
567
|
-
private
|
|
568
|
-
private disposeChildren;
|
|
569
|
-
private static disposeMaterial;
|
|
814
|
+
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
815
|
+
private static getFragmentBounds;
|
|
570
816
|
}
|
|
571
817
|
import * as THREE from "three";
|
|
572
818
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -739,251 +985,281 @@ export declare class Classifier extends Component implements Disposable {
|
|
|
739
985
|
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
740
986
|
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
741
987
|
}
|
|
742
|
-
import
|
|
743
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
744
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
745
|
-
import { Component, Components, Disposable, Event } from "../../core";
|
|
988
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
746
989
|
/**
|
|
747
|
-
*
|
|
990
|
+
* The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
|
|
748
991
|
*/
|
|
749
|
-
export declare class
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
992
|
+
export declare class Exploder extends Component implements Disposable {
|
|
993
|
+
/**
|
|
994
|
+
* A unique identifier for the component.
|
|
995
|
+
* This UUID is used to register the component within the Components system.
|
|
996
|
+
*/
|
|
997
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
753
998
|
/** {@link Disposable.onDisposed} */
|
|
754
999
|
readonly onDisposed: Event<unknown>;
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
private _meshes;
|
|
758
|
-
constructor(components: Components);
|
|
1000
|
+
/** {@link Component.enabled} */
|
|
1001
|
+
enabled: boolean;
|
|
759
1002
|
/**
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
763
|
-
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
1003
|
+
* The height of the explosion animation.
|
|
1004
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1005
|
+
* Default value is 10.
|
|
764
1006
|
*/
|
|
765
|
-
|
|
766
|
-
width: number;
|
|
767
|
-
height: number;
|
|
768
|
-
depth: number;
|
|
769
|
-
center: THREE.Vector3;
|
|
770
|
-
};
|
|
1007
|
+
height: number;
|
|
771
1008
|
/**
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
* @returns A new THREE.Vector3 representing the boundary.
|
|
776
|
-
*
|
|
777
|
-
* @remarks
|
|
778
|
-
* This method is used to create a new boundary for calculating bounding boxes.
|
|
779
|
-
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
780
|
-
* depending on the value of the 'positive' parameter.
|
|
781
|
-
*
|
|
782
|
-
* @example
|
|
783
|
-
* '''typescript
|
|
784
|
-
* const positiveBound = BoundingBoxer.newBound(true);
|
|
785
|
-
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
786
|
-
*
|
|
787
|
-
* const negativeBound = BoundingBoxer.newBound(false);
|
|
788
|
-
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
789
|
-
* '''
|
|
1009
|
+
* The group name used for the explosion animation.
|
|
1010
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1011
|
+
* Default value is "storeys".
|
|
790
1012
|
*/
|
|
791
|
-
|
|
1013
|
+
groupName: string;
|
|
792
1014
|
/**
|
|
793
|
-
* A
|
|
1015
|
+
* A set of strings representing the exploded items.
|
|
1016
|
+
* This set is used to keep track of which items have been exploded.
|
|
1017
|
+
*/
|
|
1018
|
+
list: Set<string>;
|
|
1019
|
+
constructor(components: Components);
|
|
1020
|
+
/** {@link Disposable.dispose} */
|
|
1021
|
+
dispose(): void;
|
|
1022
|
+
/**
|
|
1023
|
+
* Sets the explosion state of the fragments.
|
|
794
1024
|
*
|
|
795
|
-
* @param
|
|
796
|
-
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
797
|
-
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
798
|
-
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
1025
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
799
1026
|
*
|
|
800
1027
|
* @remarks
|
|
801
|
-
* This method
|
|
802
|
-
* If
|
|
1028
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
1029
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1030
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
803
1031
|
*
|
|
804
|
-
*
|
|
805
|
-
* '''typescript
|
|
806
|
-
* const points = [
|
|
807
|
-
* new THREE.Vector3(1, 2, 3),
|
|
808
|
-
* new THREE.Vector3(4, 5, 6),
|
|
809
|
-
* new THREE.Vector3(7, 8, 9),
|
|
810
|
-
* ];
|
|
1032
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
811
1033
|
*
|
|
812
|
-
*
|
|
813
|
-
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
814
|
-
* '''
|
|
1034
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
815
1035
|
*/
|
|
816
|
-
|
|
1036
|
+
set(active: boolean): void;
|
|
1037
|
+
}
|
|
1038
|
+
import * as WEBIFC from "web-ifc";
|
|
1039
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1040
|
+
import { IfcFragmentSettings } from "./src";
|
|
1041
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1042
|
+
/**
|
|
1043
|
+
* The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
|
|
1044
|
+
*/
|
|
1045
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
1046
|
+
/**
|
|
1047
|
+
* A unique identifier for the component.
|
|
1048
|
+
* This UUID is used to register the component within the Components system.
|
|
1049
|
+
*/
|
|
1050
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1051
|
+
/** {@link Disposable.onDisposed} */
|
|
1052
|
+
readonly onDisposed: Event<string>;
|
|
1053
|
+
/**
|
|
1054
|
+
* An event triggered when the IFC file starts loading.
|
|
1055
|
+
*/
|
|
1056
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1057
|
+
/**
|
|
1058
|
+
* An event triggered when the setup process is completed.
|
|
1059
|
+
*/
|
|
1060
|
+
readonly onSetup: Event<void>;
|
|
1061
|
+
/**
|
|
1062
|
+
* The settings for the IfcLoader.
|
|
1063
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1064
|
+
*/
|
|
1065
|
+
settings: IfcFragmentSettings;
|
|
1066
|
+
/**
|
|
1067
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
1068
|
+
*/
|
|
1069
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1070
|
+
/** {@link Component.enabled} */
|
|
1071
|
+
enabled: boolean;
|
|
1072
|
+
private _material;
|
|
1073
|
+
private _spatialTree;
|
|
1074
|
+
private _metaData;
|
|
1075
|
+
private _fragmentInstances;
|
|
1076
|
+
private _civil;
|
|
1077
|
+
private _visitedFragments;
|
|
1078
|
+
private _materialT;
|
|
1079
|
+
constructor(components: Components);
|
|
817
1080
|
/** {@link Disposable.dispose} */
|
|
818
1081
|
dispose(): void;
|
|
819
1082
|
/**
|
|
820
|
-
*
|
|
1083
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
821
1084
|
*
|
|
822
|
-
* @
|
|
1085
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
1086
|
+
* If not provided, the existing settings will be used.
|
|
1087
|
+
*
|
|
1088
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
823
1089
|
*
|
|
824
1090
|
* @remarks
|
|
825
|
-
*
|
|
826
|
-
*
|
|
1091
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1092
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
827
1093
|
*
|
|
828
1094
|
* @example
|
|
829
1095
|
* '''typescript
|
|
830
|
-
* const
|
|
831
|
-
*
|
|
1096
|
+
* const ifcLoader = new IfcLoader(components);
|
|
1097
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
832
1098
|
* '''
|
|
833
1099
|
*/
|
|
834
|
-
|
|
1100
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
835
1101
|
/**
|
|
836
|
-
*
|
|
1102
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
837
1103
|
*
|
|
838
|
-
* @
|
|
1104
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1105
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
839
1106
|
*
|
|
840
|
-
* @
|
|
841
|
-
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
842
|
-
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
843
|
-
* The radius is calculated as the distance from the center to the minimum bound.
|
|
1107
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
844
1108
|
*
|
|
845
1109
|
* @example
|
|
846
1110
|
* '''typescript
|
|
847
|
-
* const
|
|
848
|
-
*
|
|
849
|
-
* const boundingSphere = boundingBoxer.getSphere();
|
|
850
|
-
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
1111
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1112
|
+
* const group = await ifcLoader.load(ifcData);
|
|
851
1113
|
* '''
|
|
852
1114
|
*/
|
|
853
|
-
|
|
1115
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
854
1116
|
/**
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
1117
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
858
1118
|
*
|
|
859
|
-
* @
|
|
860
|
-
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
861
|
-
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
862
|
-
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
863
|
-
* The position of the mesh is set to the center of the bounding box.
|
|
1119
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
864
1120
|
*
|
|
865
|
-
* @
|
|
866
|
-
* '''typescript
|
|
867
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
868
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
869
|
-
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
870
|
-
* scene.add(boundingBoxMesh);
|
|
871
|
-
* '''
|
|
872
|
-
*/
|
|
873
|
-
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
874
|
-
/**
|
|
875
|
-
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
876
|
-
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
1121
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
877
1122
|
*
|
|
878
1123
|
* @remarks
|
|
879
|
-
* This method
|
|
880
|
-
* It
|
|
1124
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1125
|
+
* It also opens the IFC model using the provided data and settings.
|
|
881
1126
|
*
|
|
882
1127
|
* @example
|
|
883
1128
|
* '''typescript
|
|
884
|
-
* const
|
|
885
|
-
*
|
|
886
|
-
* // ...
|
|
887
|
-
* boundingBoxer.reset();
|
|
1129
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1130
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
888
1131
|
* '''
|
|
889
1132
|
*/
|
|
890
|
-
|
|
1133
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
891
1134
|
/**
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
* @param group - The FragmentsGroup to add.
|
|
1135
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
1136
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
895
1137
|
*
|
|
896
1138
|
* @remarks
|
|
897
|
-
* This method
|
|
898
|
-
* and calls the 'addMesh' method for each fragment's mesh.
|
|
1139
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
899
1140
|
*
|
|
900
1141
|
* @example
|
|
901
1142
|
* '''typescript
|
|
902
|
-
* const
|
|
903
|
-
*
|
|
1143
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1144
|
+
* ifcLoader.cleanUp();
|
|
904
1145
|
* '''
|
|
905
1146
|
*/
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
912
|
-
*
|
|
913
|
-
* @remarks
|
|
914
|
-
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
915
|
-
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
916
|
-
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
917
|
-
*
|
|
918
|
-
* @example
|
|
919
|
-
* '''typescript
|
|
920
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
921
|
-
* boundingBoxer.addMesh(mesh);
|
|
922
|
-
* '''
|
|
923
|
-
*/
|
|
924
|
-
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
925
|
-
/**
|
|
926
|
-
* Uses a FragmentIdMap to add its meshes to the bb calculation.
|
|
927
|
-
*
|
|
928
|
-
* This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
|
|
929
|
-
* and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
|
|
930
|
-
*
|
|
931
|
-
* @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
|
|
932
|
-
*
|
|
933
|
-
* @remarks
|
|
934
|
-
* This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
|
|
935
|
-
* It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
|
|
936
|
-
*
|
|
937
|
-
* @example
|
|
938
|
-
* '''typescript
|
|
939
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
940
|
-
* const fragmentIdMap: FRAGS.FragmentIdMap = {
|
|
941
|
-
* '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
|
|
942
|
-
* '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
|
|
943
|
-
* };
|
|
944
|
-
* boundingBoxer.addFragmentIdMap(fragmentIdMap);
|
|
945
|
-
* '''
|
|
946
|
-
*/
|
|
947
|
-
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
948
|
-
private static getFragmentBounds;
|
|
1147
|
+
cleanUp(): void;
|
|
1148
|
+
private getAllGeometries;
|
|
1149
|
+
private getMesh;
|
|
1150
|
+
private getGeometry;
|
|
1151
|
+
private autoSetWasm;
|
|
949
1152
|
}
|
|
1153
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1154
|
+
import * as THREE from "three";
|
|
950
1155
|
import * as FRAGS from "@thatopen/fragments";
|
|
951
|
-
import { Components,
|
|
1156
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1157
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
952
1158
|
/**
|
|
953
|
-
*
|
|
1159
|
+
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
954
1160
|
*/
|
|
955
|
-
export declare class
|
|
1161
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
956
1162
|
/**
|
|
957
1163
|
* A unique identifier for the component.
|
|
958
1164
|
* This UUID is used to register the component within the Components system.
|
|
959
1165
|
*/
|
|
960
|
-
static readonly uuid: "
|
|
1166
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1167
|
+
/** {@link Disposable.onDisposed} */
|
|
1168
|
+
readonly onDisposed: Event<unknown>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Event triggered when fragments are loaded.
|
|
1171
|
+
*/
|
|
1172
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Event triggered when fragments are disposed.
|
|
1175
|
+
*/
|
|
1176
|
+
readonly onFragmentsDisposed: Event<{
|
|
1177
|
+
groupID: string;
|
|
1178
|
+
fragmentIDs: string[];
|
|
1179
|
+
}>;
|
|
1180
|
+
/**
|
|
1181
|
+
* Map containing all loaded fragments.
|
|
1182
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1183
|
+
*/
|
|
1184
|
+
readonly list: Map<string, Fragment>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Map containing all loaded fragment groups.
|
|
1187
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1188
|
+
*/
|
|
1189
|
+
readonly groups: Map<string, FragmentsGroup>;
|
|
1190
|
+
baseCoordinationModel: string;
|
|
1191
|
+
baseCoordinationMatrix: THREE.Matrix4;
|
|
961
1192
|
/** {@link Component.enabled} */
|
|
962
1193
|
enabled: boolean;
|
|
1194
|
+
private _loader;
|
|
1195
|
+
/**
|
|
1196
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1197
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1198
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1199
|
+
*/
|
|
1200
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
963
1201
|
constructor(components: Components);
|
|
1202
|
+
/** {@link Disposable.dispose} */
|
|
1203
|
+
dispose(): void;
|
|
964
1204
|
/**
|
|
965
|
-
*
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
*
|
|
969
|
-
* @param visible - The visibility state to set for the fragments.
|
|
970
|
-
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
971
|
-
* If not provided, all fragments will be affected.
|
|
1205
|
+
* Dispose of a specific fragment group.
|
|
1206
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1207
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
972
1208
|
*
|
|
973
|
-
* @
|
|
1209
|
+
* @param group - The fragment group to be disposed.
|
|
974
1210
|
*/
|
|
975
|
-
|
|
1211
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
976
1212
|
/**
|
|
977
|
-
*
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
* @param
|
|
981
|
-
*
|
|
1213
|
+
* Loads a binary file that contain fragment geometry.
|
|
1214
|
+
* @param data - The binary data to load.
|
|
1215
|
+
* @param config - Optional configuration for loading.
|
|
1216
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1217
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1218
|
+
* @returns The loaded FragmentsGroup.
|
|
1219
|
+
*/
|
|
1220
|
+
load(data: Uint8Array, config?: Partial<{
|
|
1221
|
+
coordinate: boolean;
|
|
1222
|
+
name: string;
|
|
1223
|
+
properties: FRAGS.IfcProperties;
|
|
1224
|
+
relationsMap: RelationsMap;
|
|
1225
|
+
}>): FragmentsGroup;
|
|
1226
|
+
/**
|
|
1227
|
+
* Export the specified fragmentsgroup to binary data.
|
|
1228
|
+
* @param group - the fragments group to be exported.
|
|
1229
|
+
* @returns the exported data as binary buffer.
|
|
1230
|
+
*/
|
|
1231
|
+
export(group: FragmentsGroup): Uint8Array;
|
|
1232
|
+
/**
|
|
1233
|
+
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1234
|
+
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1235
|
+
* @returns A map of model IDs to sets of express IDs.
|
|
1236
|
+
*/
|
|
1237
|
+
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1238
|
+
[modelID: string]: Set<number>;
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1242
|
+
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1243
|
+
* @returns A fragment ID map.
|
|
1244
|
+
* @remarks
|
|
1245
|
+
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1246
|
+
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1247
|
+
* The fragment ID maps are then merged into a single map and returned.
|
|
1248
|
+
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1249
|
+
*/
|
|
1250
|
+
modelIdToFragmentIdMap(modelIdMap: {
|
|
1251
|
+
[modelID: string]: Set<number>;
|
|
1252
|
+
}): FRAGS.FragmentIdMap;
|
|
1253
|
+
/**
|
|
1254
|
+
* Applies coordinate transformation to the provided models.
|
|
1255
|
+
* If no models are provided, all groups are used.
|
|
1256
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
1257
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
982
1258
|
*
|
|
983
|
-
* @
|
|
1259
|
+
* @param models - The models to apply coordinate transformation to.
|
|
1260
|
+
* If not provided, all models are used.
|
|
984
1261
|
*/
|
|
985
|
-
|
|
986
|
-
private updateCulledVisibility;
|
|
1262
|
+
coordinate(models?: FragmentsGroup[]): void;
|
|
987
1263
|
}
|
|
988
1264
|
import * as WEBIFC from "web-ifc";
|
|
989
1265
|
import { Components, Disposable, Event, Component } from "../../core";
|
|
@@ -1083,507 +1359,486 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
|
1083
1359
|
private streamAssets;
|
|
1084
1360
|
private streamGeometries;
|
|
1085
1361
|
}
|
|
1086
|
-
import
|
|
1087
|
-
import
|
|
1088
|
-
import
|
|
1089
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1090
|
-
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1362
|
+
import * as WEBIFC from "web-ifc";
|
|
1363
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1364
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1091
1365
|
/**
|
|
1092
|
-
*
|
|
1366
|
+
* A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
|
|
1093
1367
|
*/
|
|
1094
|
-
export declare class
|
|
1368
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1095
1369
|
/**
|
|
1096
1370
|
* A unique identifier for the component.
|
|
1097
1371
|
* This UUID is used to register the component within the Components system.
|
|
1098
1372
|
*/
|
|
1099
|
-
static readonly uuid: "
|
|
1100
|
-
/** {@link Disposable.onDisposed} */
|
|
1101
|
-
readonly onDisposed: Event<unknown>;
|
|
1102
|
-
/**
|
|
1103
|
-
* Event triggered when fragments are loaded.
|
|
1104
|
-
*/
|
|
1105
|
-
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1373
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1106
1374
|
/**
|
|
1107
|
-
*
|
|
1375
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1376
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1108
1377
|
*/
|
|
1109
|
-
readonly
|
|
1110
|
-
|
|
1111
|
-
|
|
1378
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1379
|
+
type: number;
|
|
1380
|
+
data: {
|
|
1381
|
+
[id: number]: any;
|
|
1382
|
+
};
|
|
1112
1383
|
}>;
|
|
1113
1384
|
/**
|
|
1114
|
-
*
|
|
1115
|
-
* The
|
|
1385
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
1386
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1116
1387
|
*/
|
|
1117
|
-
readonly
|
|
1388
|
+
readonly onProgress: AsyncEvent<number>;
|
|
1118
1389
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
* The key is the
|
|
1390
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
1391
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1121
1392
|
*/
|
|
1122
|
-
readonly
|
|
1123
|
-
|
|
1393
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1394
|
+
/** {@link Disposable.onDisposed} */
|
|
1395
|
+
readonly onDisposed: Event<string>;
|
|
1124
1396
|
/** {@link Component.enabled} */
|
|
1125
1397
|
enabled: boolean;
|
|
1126
|
-
private _loader;
|
|
1127
1398
|
/**
|
|
1128
|
-
*
|
|
1129
|
-
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1130
|
-
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1399
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1131
1400
|
*/
|
|
1132
|
-
|
|
1133
|
-
|
|
1401
|
+
settings: PropertiesStreamingSettings;
|
|
1402
|
+
/**
|
|
1403
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1404
|
+
*/
|
|
1405
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1134
1406
|
/** {@link Disposable.dispose} */
|
|
1135
|
-
dispose(): void
|
|
1407
|
+
dispose(): Promise<void>;
|
|
1136
1408
|
/**
|
|
1137
|
-
*
|
|
1138
|
-
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1139
|
-
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1409
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1140
1410
|
*
|
|
1141
|
-
* @param
|
|
1411
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1412
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1142
1413
|
*/
|
|
1143
|
-
|
|
1414
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1144
1415
|
/**
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
* @param
|
|
1148
|
-
* @
|
|
1149
|
-
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1150
|
-
* @returns The loaded FragmentsGroup.
|
|
1416
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1417
|
+
*
|
|
1418
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1419
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1151
1420
|
*/
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1421
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1422
|
+
private readIfcFile;
|
|
1423
|
+
private streamIfcFile;
|
|
1424
|
+
private streamAllProperties;
|
|
1425
|
+
private cleanUp;
|
|
1426
|
+
}
|
|
1427
|
+
import * as THREE from "three";
|
|
1428
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1429
|
+
import { Component, Components } from "../../core";
|
|
1430
|
+
/**
|
|
1431
|
+
* Represents an edge measurement result.
|
|
1432
|
+
*/
|
|
1433
|
+
export interface MeasureEdge {
|
|
1158
1434
|
/**
|
|
1159
|
-
*
|
|
1160
|
-
* @param group - the fragments group to be exported.
|
|
1161
|
-
* @returns the exported data as binary buffer.
|
|
1435
|
+
* The distance between the two points of the edge.
|
|
1162
1436
|
*/
|
|
1163
|
-
|
|
1437
|
+
distance: number;
|
|
1164
1438
|
/**
|
|
1165
|
-
*
|
|
1166
|
-
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1167
|
-
* @returns A map of model IDs to sets of express IDs.
|
|
1168
|
-
*/
|
|
1169
|
-
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1170
|
-
[modelID: string]: Set<number>;
|
|
1171
|
-
};
|
|
1172
|
-
/**
|
|
1173
|
-
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1174
|
-
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1175
|
-
* @returns A fragment ID map.
|
|
1176
|
-
* @remarks
|
|
1177
|
-
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1178
|
-
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1179
|
-
* The fragment ID maps are then merged into a single map and returned.
|
|
1180
|
-
* 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.
|
|
1181
|
-
*/
|
|
1182
|
-
modelIdToFragmentIdMap(modelIdMap: {
|
|
1183
|
-
[modelID: string]: Set<number>;
|
|
1184
|
-
}): FRAGS.FragmentIdMap;
|
|
1185
|
-
/**
|
|
1186
|
-
* Applies coordinate transformation to the provided models.
|
|
1187
|
-
* If no models are provided, all groups are used.
|
|
1188
|
-
* The first model in the list becomes the base model for coordinate transformation.
|
|
1189
|
-
* All other models are then transformed to match the base model's coordinate system.
|
|
1190
|
-
*
|
|
1191
|
-
* @param models - The models to apply coordinate transformation to.
|
|
1192
|
-
* If not provided, all groups are used.
|
|
1193
|
-
*
|
|
1194
|
-
* @returns {void}
|
|
1439
|
+
* The two points that define the edge.
|
|
1195
1440
|
*/
|
|
1196
|
-
|
|
1441
|
+
points: THREE.Vector3[];
|
|
1197
1442
|
}
|
|
1198
|
-
import * as WEBIFC from "web-ifc";
|
|
1199
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1200
|
-
import { Disposable, Event, Component, Components } from "../../core";
|
|
1201
|
-
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
1202
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
1203
1443
|
/**
|
|
1204
|
-
*
|
|
1444
|
+
* Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
|
|
1205
1445
|
*/
|
|
1206
|
-
export declare class
|
|
1446
|
+
export declare class MeasurementUtils extends Component {
|
|
1207
1447
|
/**
|
|
1208
1448
|
* A unique identifier for the component.
|
|
1209
1449
|
* This UUID is used to register the component within the Components system.
|
|
1210
1450
|
*/
|
|
1211
|
-
static
|
|
1212
|
-
/** {@link Disposable.onDisposed} */
|
|
1213
|
-
readonly onDisposed: Event<string>;
|
|
1214
|
-
/**
|
|
1215
|
-
* Event triggered when relations for a model have been indexed.
|
|
1216
|
-
* This event provides the model's UUID and the relations map generated for that model.
|
|
1217
|
-
*
|
|
1218
|
-
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
1219
|
-
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
1220
|
-
* 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.
|
|
1221
|
-
*/
|
|
1222
|
-
readonly onRelationsIndexed: Event<{
|
|
1223
|
-
modelID: string;
|
|
1224
|
-
relationsMap: RelationsMap;
|
|
1225
|
-
}>;
|
|
1226
|
-
/**
|
|
1227
|
-
* Holds the relationship mappings for each model processed by the indexer.
|
|
1228
|
-
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
1229
|
-
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
1230
|
-
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
1231
|
-
* that are related through that relation type. This structure allows for efficient querying
|
|
1232
|
-
* of entity relationships within a model.
|
|
1233
|
-
*/
|
|
1234
|
-
readonly relationMaps: ModelsRelationMap;
|
|
1451
|
+
static uuid: string;
|
|
1235
1452
|
/** {@link Component.enabled} */
|
|
1236
1453
|
enabled: boolean;
|
|
1237
|
-
private _relToAttributesMap;
|
|
1238
|
-
private _inverseAttributes;
|
|
1239
|
-
private _ifcRels;
|
|
1240
1454
|
constructor(components: Components);
|
|
1241
|
-
private onFragmentsDisposed;
|
|
1242
|
-
private indexRelations;
|
|
1243
1455
|
/**
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
1247
|
-
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
1456
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
1248
1457
|
*
|
|
1249
|
-
* @
|
|
1458
|
+
* @param point - The point from which to calculate the distance.
|
|
1459
|
+
* @param lineStart - The start point of the line segment.
|
|
1460
|
+
* @param lineEnd - The end point of the line segment.
|
|
1461
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
1462
|
+
* @returns The distance from the point to the line segment.
|
|
1250
1463
|
*/
|
|
1251
|
-
|
|
1464
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1252
1465
|
/**
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
1256
|
-
*
|
|
1257
|
-
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
1258
|
-
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
1259
|
-
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
1260
|
-
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1261
|
-
* of entities that are related through that attribute.
|
|
1466
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
1467
|
+
* It also returns the edges of the found face and their indices.
|
|
1262
1468
|
*
|
|
1263
|
-
* @param
|
|
1264
|
-
* @
|
|
1265
|
-
*
|
|
1266
|
-
* @
|
|
1469
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1470
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
1471
|
+
* @param instance - The instance of the mesh (optional).
|
|
1472
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1267
1473
|
*/
|
|
1268
|
-
|
|
1474
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1475
|
+
edges: MeasureEdge[];
|
|
1476
|
+
indices: Set<number>;
|
|
1477
|
+
} | null;
|
|
1269
1478
|
/**
|
|
1270
|
-
*
|
|
1479
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
1480
|
+
* It also applies instance transformation if provided.
|
|
1271
1481
|
*
|
|
1272
|
-
* @param
|
|
1273
|
-
* @param
|
|
1274
|
-
* @
|
|
1275
|
-
*
|
|
1482
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1483
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
1484
|
+
* @param instance - The instance of the mesh (optional).
|
|
1485
|
+
* @returns An object containing the vertices and normal of the face.
|
|
1486
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
1276
1487
|
*/
|
|
1277
|
-
|
|
1488
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1489
|
+
p1: THREE.Vector3;
|
|
1490
|
+
p2: THREE.Vector3;
|
|
1491
|
+
p3: THREE.Vector3;
|
|
1492
|
+
faceNormal: THREE.Vector3;
|
|
1493
|
+
};
|
|
1278
1494
|
/**
|
|
1279
|
-
*
|
|
1280
|
-
* This
|
|
1281
|
-
* returning the IDs of related entities if a match is found.
|
|
1495
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
1496
|
+
* This is used to ensure numerical precision in edge detection.
|
|
1282
1497
|
*
|
|
1283
|
-
* @param
|
|
1284
|
-
* @
|
|
1285
|
-
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1286
|
-
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1287
|
-
* or the specified relation name is not indexed.
|
|
1498
|
+
* @param vector - The vector to round.
|
|
1499
|
+
* @returns The vector with rounded components.
|
|
1288
1500
|
*/
|
|
1289
|
-
|
|
1501
|
+
round(vector: THREE.Vector3): void;
|
|
1290
1502
|
/**
|
|
1291
|
-
*
|
|
1292
|
-
* 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,
|
|
1293
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1294
|
-
* The resulting object is then serialized into a JSON string.
|
|
1503
|
+
* Calculates the volume of a set of fragments.
|
|
1295
1504
|
*
|
|
1296
|
-
* @param
|
|
1297
|
-
* @returns
|
|
1298
|
-
*/
|
|
1299
|
-
serializeRelations(relationMap: RelationsMap): string;
|
|
1300
|
-
/**
|
|
1301
|
-
* Serializes the relations of a specific model into a JSON string.
|
|
1302
|
-
* This method iterates through the relations indexed for the given model,
|
|
1303
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1304
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1305
|
-
* The resulting object is then serialized into a JSON string.
|
|
1505
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
1506
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
1306
1507
|
*
|
|
1307
|
-
* @
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
*/
|
|
1311
|
-
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
1312
|
-
/**
|
|
1313
|
-
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
1314
|
-
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
1315
|
-
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1316
|
-
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1317
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1508
|
+
* @remarks
|
|
1509
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
1510
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
1318
1511
|
*
|
|
1319
|
-
* @
|
|
1320
|
-
*
|
|
1512
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
1513
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
1321
1514
|
*/
|
|
1322
|
-
|
|
1515
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
1323
1516
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
1326
|
-
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1327
|
-
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1328
|
-
* of express IDs of entities related through that relation type.
|
|
1517
|
+
* Calculates the total volume of a set of meshes.
|
|
1329
1518
|
*
|
|
1330
|
-
* @param
|
|
1331
|
-
* @returns
|
|
1332
|
-
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
1333
|
-
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
1334
|
-
*/
|
|
1335
|
-
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
1336
|
-
/** {@link Disposable.dispose} */
|
|
1337
|
-
dispose(): void;
|
|
1338
|
-
/**
|
|
1339
|
-
* Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
|
|
1519
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
1520
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
1340
1521
|
*
|
|
1341
|
-
* @
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1522
|
+
* @remarks
|
|
1523
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
1524
|
+
* and its bounding sphere.
|
|
1344
1525
|
*
|
|
1345
|
-
* @returns A 'Set' with the expressIDs of the found items.
|
|
1346
1526
|
*/
|
|
1347
|
-
|
|
1527
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
1528
|
+
private getFaceData;
|
|
1529
|
+
private getVolumeOfMesh;
|
|
1530
|
+
private getSignedVolumeOfTriangle;
|
|
1348
1531
|
}
|
|
1349
|
-
import * as
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1532
|
+
import * as THREE from "three";
|
|
1533
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
1534
|
+
center: THREE.Vector3;
|
|
1535
|
+
halfSizes: THREE.Vector3;
|
|
1536
|
+
rotation: THREE.Matrix3;
|
|
1537
|
+
transformation: THREE.Matrix4;
|
|
1538
|
+
};
|
|
1539
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1540
|
+
import * as THREE from "three";
|
|
1541
|
+
export declare class MaterialsUtils {
|
|
1542
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
1543
|
+
}
|
|
1544
|
+
export declare class UUID {
|
|
1545
|
+
private static _pattern;
|
|
1546
|
+
private static _lut;
|
|
1547
|
+
static create(): string;
|
|
1548
|
+
static validate(uuid: string): void;
|
|
1549
|
+
}
|
|
1550
|
+
import * as THREE from "three";
|
|
1551
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1353
1552
|
/**
|
|
1354
|
-
*
|
|
1553
|
+
* Configuration interface for the VertexPicker component.
|
|
1355
1554
|
*/
|
|
1356
|
-
export
|
|
1555
|
+
export interface VertexPickerConfig {
|
|
1357
1556
|
/**
|
|
1358
|
-
*
|
|
1359
|
-
* This UUID is used to register the component within the Components system.
|
|
1557
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
1360
1558
|
*/
|
|
1361
|
-
|
|
1362
|
-
/** {@link Disposable.onDisposed} */
|
|
1363
|
-
readonly onDisposed: Event<string>;
|
|
1559
|
+
showOnlyVertex: boolean;
|
|
1364
1560
|
/**
|
|
1365
|
-
*
|
|
1561
|
+
* The maximum distance for snapping to a vertex.
|
|
1366
1562
|
*/
|
|
1367
|
-
|
|
1563
|
+
snapDistance: number;
|
|
1368
1564
|
/**
|
|
1369
|
-
*
|
|
1565
|
+
* The HTML element to use for previewing the picked vertex.
|
|
1370
1566
|
*/
|
|
1371
|
-
|
|
1567
|
+
previewElement: HTMLElement;
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1571
|
+
*/
|
|
1572
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
1573
|
+
/** {@link Disposable.onDisposed} */
|
|
1574
|
+
readonly onDisposed: Event<unknown>;
|
|
1372
1575
|
/**
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1576
|
+
* An event that is triggered when a vertex is found.
|
|
1577
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1375
1578
|
*/
|
|
1376
|
-
|
|
1579
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1377
1580
|
/**
|
|
1378
|
-
*
|
|
1581
|
+
* An event that is triggered when a vertex is lost.
|
|
1582
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
1379
1583
|
*/
|
|
1380
|
-
|
|
1381
|
-
/** {@link Component.enabled} */
|
|
1382
|
-
enabled: boolean;
|
|
1383
|
-
private _material;
|
|
1384
|
-
private _spatialTree;
|
|
1385
|
-
private _metaData;
|
|
1386
|
-
private _fragmentInstances;
|
|
1387
|
-
private _civil;
|
|
1388
|
-
private _visitedFragments;
|
|
1389
|
-
private _materialT;
|
|
1390
|
-
constructor(components: Components);
|
|
1391
|
-
/** {@link Disposable.dispose} */
|
|
1392
|
-
dispose(): void;
|
|
1584
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
1393
1585
|
/**
|
|
1394
|
-
*
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
*
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1586
|
+
* An event that is triggered when the picker is enabled or disabled
|
|
1587
|
+
*/
|
|
1588
|
+
readonly onEnabled: Event<boolean>;
|
|
1589
|
+
/**
|
|
1590
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
1591
|
+
*/
|
|
1592
|
+
components: Components;
|
|
1593
|
+
/**
|
|
1594
|
+
* A reference to the working plane used for vertex picking.
|
|
1595
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
1596
|
+
* If this value is null, all vertices are considered valid.
|
|
1597
|
+
*/
|
|
1598
|
+
workingPlane: THREE.Plane | null;
|
|
1599
|
+
private _pickedPoint;
|
|
1600
|
+
private _config;
|
|
1601
|
+
private _enabled;
|
|
1602
|
+
/**
|
|
1603
|
+
* Sets the enabled state of the VertexPicker.
|
|
1604
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
1605
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1404
1606
|
*
|
|
1405
|
-
* @
|
|
1406
|
-
* '''typescript
|
|
1407
|
-
* const ifcLoader = new IfcLoader(components);
|
|
1408
|
-
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1409
|
-
* '''
|
|
1607
|
+
* @param value - The new enabled state.
|
|
1410
1608
|
*/
|
|
1411
|
-
|
|
1609
|
+
set enabled(value: boolean);
|
|
1412
1610
|
/**
|
|
1413
|
-
*
|
|
1611
|
+
* Gets the current enabled state of the VertexPicker.
|
|
1414
1612
|
*
|
|
1415
|
-
* @
|
|
1416
|
-
|
|
1613
|
+
* @returns The current enabled state.
|
|
1614
|
+
*/
|
|
1615
|
+
get enabled(): boolean;
|
|
1616
|
+
/**
|
|
1617
|
+
* Sets the configuration for the VertexPicker component.
|
|
1417
1618
|
*
|
|
1418
|
-
* @
|
|
1619
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
1620
|
+
* The properties not provided in the value object will retain their current values.
|
|
1419
1621
|
*
|
|
1420
1622
|
* @example
|
|
1421
1623
|
* '''typescript
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1624
|
+
* vertexPicker.config = {
|
|
1625
|
+
* snapDistance: 0.5,
|
|
1626
|
+
* showOnlyVertex: true,
|
|
1627
|
+
* };
|
|
1424
1628
|
* '''
|
|
1425
1629
|
*/
|
|
1426
|
-
|
|
1630
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
1427
1631
|
/**
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1431
|
-
*
|
|
1432
|
-
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
1632
|
+
* Gets the current configuration for the VertexPicker component.
|
|
1433
1633
|
*
|
|
1434
|
-
* @
|
|
1435
|
-
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1436
|
-
* It also opens the IFC model using the provided data and settings.
|
|
1634
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
1437
1635
|
*
|
|
1438
1636
|
* @example
|
|
1439
1637
|
* '''typescript
|
|
1440
|
-
* const
|
|
1441
|
-
*
|
|
1638
|
+
* const currentConfig = vertexPicker.config;
|
|
1639
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1442
1640
|
* '''
|
|
1443
1641
|
*/
|
|
1444
|
-
|
|
1642
|
+
get config(): Partial<VertexPickerConfig>;
|
|
1643
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1644
|
+
/** {@link Disposable.dispose} */
|
|
1645
|
+
dispose(): void;
|
|
1445
1646
|
/**
|
|
1446
|
-
*
|
|
1447
|
-
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1647
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1448
1648
|
*
|
|
1449
|
-
* @
|
|
1450
|
-
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
1649
|
+
* @param world - The World instance to use for raycasting.
|
|
1451
1650
|
*
|
|
1452
|
-
* @
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1651
|
+
* @returns The current picked point, or null if no point is picked.
|
|
1652
|
+
*
|
|
1653
|
+
* @remarks
|
|
1654
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1655
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1656
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1657
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1658
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1659
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1457
1660
|
*/
|
|
1458
|
-
|
|
1459
|
-
private
|
|
1460
|
-
private
|
|
1461
|
-
private
|
|
1462
|
-
private autoSetWasm;
|
|
1661
|
+
get(world: World): THREE.Vector3 | null;
|
|
1662
|
+
private getClosestVertex;
|
|
1663
|
+
private getVertices;
|
|
1664
|
+
private getVertex;
|
|
1463
1665
|
}
|
|
1464
|
-
import
|
|
1666
|
+
import * as WEBIFC from "web-ifc";
|
|
1667
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1668
|
+
import { Component, Components } from "../../core";
|
|
1465
1669
|
/**
|
|
1466
|
-
*
|
|
1670
|
+
* Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
|
|
1467
1671
|
*/
|
|
1468
|
-
export declare class
|
|
1672
|
+
export declare class IfcJsonExporter extends Component {
|
|
1469
1673
|
/**
|
|
1470
1674
|
* A unique identifier for the component.
|
|
1471
1675
|
* This UUID is used to register the component within the Components system.
|
|
1472
1676
|
*/
|
|
1473
|
-
static readonly uuid: "
|
|
1474
|
-
/** {@link Disposable.onDisposed} */
|
|
1475
|
-
readonly onDisposed: Event<unknown>;
|
|
1677
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1476
1678
|
/** {@link Component.enabled} */
|
|
1477
1679
|
enabled: boolean;
|
|
1478
|
-
/**
|
|
1479
|
-
* The height of the explosion animation.
|
|
1480
|
-
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1481
|
-
* Default value is 10.
|
|
1482
|
-
*/
|
|
1483
|
-
height: number;
|
|
1484
|
-
/**
|
|
1485
|
-
* The group name used for the explosion animation.
|
|
1486
|
-
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1487
|
-
* Default value is "storeys".
|
|
1488
|
-
*/
|
|
1489
|
-
groupName: string;
|
|
1490
|
-
/**
|
|
1491
|
-
* A set of strings representing the exploded items.
|
|
1492
|
-
* This set is used to keep track of which items have been exploded.
|
|
1493
|
-
*/
|
|
1494
|
-
list: Set<string>;
|
|
1495
1680
|
constructor(components: Components);
|
|
1496
|
-
/** {@link Disposable.dispose} */
|
|
1497
|
-
dispose(): void;
|
|
1498
1681
|
/**
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
* @param
|
|
1502
|
-
*
|
|
1503
|
-
* @
|
|
1504
|
-
*
|
|
1505
|
-
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1506
|
-
* If 'active' is false, the fragments are moved back to their original position.
|
|
1507
|
-
*
|
|
1508
|
-
* The method also keeps track of the exploded items using the 'list' set.
|
|
1509
|
-
*
|
|
1510
|
-
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
1682
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
1683
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1684
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
1685
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
1686
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1687
|
+
* to make the location data available (e.g. absolute position of building).
|
|
1511
1688
|
*/
|
|
1512
|
-
|
|
1689
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1513
1690
|
}
|
|
1514
1691
|
import * as WEBIFC from "web-ifc";
|
|
1515
|
-
import {
|
|
1516
|
-
import {
|
|
1692
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1693
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
1694
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
1695
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
1517
1696
|
/**
|
|
1518
|
-
*
|
|
1697
|
+
* Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
|
|
1519
1698
|
*/
|
|
1520
|
-
export declare class
|
|
1699
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
1521
1700
|
/**
|
|
1522
1701
|
* A unique identifier for the component.
|
|
1523
1702
|
* This UUID is used to register the component within the Components system.
|
|
1524
1703
|
*/
|
|
1525
|
-
static readonly uuid: "
|
|
1704
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
1705
|
+
/** {@link Disposable.onDisposed} */
|
|
1706
|
+
readonly onDisposed: Event<string>;
|
|
1526
1707
|
/**
|
|
1527
|
-
*
|
|
1528
|
-
*
|
|
1708
|
+
* Event triggered when relations for a model have been indexed.
|
|
1709
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
1710
|
+
*
|
|
1711
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
1712
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
1713
|
+
* The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
1529
1714
|
*/
|
|
1530
|
-
readonly
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
[id: number]: any;
|
|
1534
|
-
};
|
|
1715
|
+
readonly onRelationsIndexed: Event<{
|
|
1716
|
+
modelID: string;
|
|
1717
|
+
relationsMap: RelationsMap;
|
|
1535
1718
|
}>;
|
|
1536
1719
|
/**
|
|
1537
|
-
*
|
|
1538
|
-
* The
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
*
|
|
1543
|
-
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1720
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
1721
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
1722
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
1723
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
1724
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
1725
|
+
* of entity relationships within a model.
|
|
1544
1726
|
*/
|
|
1545
|
-
readonly
|
|
1546
|
-
/** {@link Disposable.onDisposed} */
|
|
1547
|
-
readonly onDisposed: Event<string>;
|
|
1727
|
+
readonly relationMaps: ModelsRelationMap;
|
|
1548
1728
|
/** {@link Component.enabled} */
|
|
1549
1729
|
enabled: boolean;
|
|
1730
|
+
private _relToAttributesMap;
|
|
1731
|
+
private _inverseAttributes;
|
|
1732
|
+
private _ifcRels;
|
|
1733
|
+
constructor(components: Components);
|
|
1734
|
+
private onFragmentsDisposed;
|
|
1735
|
+
private indexRelations;
|
|
1550
1736
|
/**
|
|
1551
|
-
*
|
|
1552
|
-
*/
|
|
1553
|
-
settings: PropertiesStreamingSettings;
|
|
1554
|
-
/**
|
|
1555
|
-
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1556
|
-
*/
|
|
1557
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1558
|
-
/** {@link Disposable.dispose} */
|
|
1559
|
-
dispose(): Promise<void>;
|
|
1560
|
-
/**
|
|
1561
|
-
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1737
|
+
* Adds a relation map to the model's relations map.
|
|
1562
1738
|
*
|
|
1563
|
-
* @param
|
|
1564
|
-
* @
|
|
1565
|
-
*/
|
|
1566
|
-
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1567
|
-
/**
|
|
1568
|
-
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1739
|
+
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
1740
|
+
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
1569
1741
|
*
|
|
1570
|
-
* @
|
|
1571
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1742
|
+
* @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
|
|
1572
1743
|
*/
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1744
|
+
setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
|
|
1745
|
+
/**
|
|
1746
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
1747
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
1748
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
1749
|
+
*
|
|
1750
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
1751
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
1752
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
1753
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1754
|
+
* of entities that are related through that attribute.
|
|
1755
|
+
*
|
|
1756
|
+
* @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
|
|
1757
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
1758
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
1759
|
+
* @throws An error if the model does not have properties loaded.
|
|
1760
|
+
*/
|
|
1761
|
+
process(model: FragmentsGroup): Promise<RelationsMap>;
|
|
1762
|
+
/**
|
|
1763
|
+
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
1764
|
+
*
|
|
1765
|
+
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
1766
|
+
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1767
|
+
* @returns A promise that resolves to the relations map for the processed model.
|
|
1768
|
+
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
1769
|
+
*/
|
|
1770
|
+
processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
|
|
1771
|
+
/**
|
|
1772
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
1773
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
1774
|
+
* returning the IDs of related entities if a match is found.
|
|
1775
|
+
*
|
|
1776
|
+
* @param model The 'FragmentsGroup' model containing the entity.
|
|
1777
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
1778
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1779
|
+
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1780
|
+
* or the specified relation name is not indexed.
|
|
1781
|
+
*/
|
|
1782
|
+
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
|
|
1783
|
+
/**
|
|
1784
|
+
* Serializes the relations of a given relation map into a JSON string.
|
|
1785
|
+
* This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
|
|
1786
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1787
|
+
* The resulting object is then serialized into a JSON string.
|
|
1788
|
+
*
|
|
1789
|
+
* @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
|
|
1790
|
+
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
1791
|
+
*/
|
|
1792
|
+
serializeRelations(relationMap: RelationsMap): string;
|
|
1793
|
+
/**
|
|
1794
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
1795
|
+
* This method iterates through the relations indexed for the given model,
|
|
1796
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1797
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1798
|
+
* The resulting object is then serialized into a JSON string.
|
|
1799
|
+
*
|
|
1800
|
+
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1801
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1802
|
+
* If the model has no indexed relations, 'null' is returned.
|
|
1803
|
+
*/
|
|
1804
|
+
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
1805
|
+
/**
|
|
1806
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
1807
|
+
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
1808
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1809
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1810
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1811
|
+
*
|
|
1812
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
1813
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
1814
|
+
*/
|
|
1815
|
+
serializeAllRelations(): string;
|
|
1816
|
+
/**
|
|
1817
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
1818
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
1819
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1820
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1821
|
+
* of express IDs of entities related through that relation type.
|
|
1822
|
+
*
|
|
1823
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
1824
|
+
* @returns A 'Map' where the key is the express ID of an entity as a number, and the value
|
|
1825
|
+
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
1826
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
1827
|
+
*/
|
|
1828
|
+
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
1829
|
+
/** {@link Disposable.dispose} */
|
|
1830
|
+
dispose(): void;
|
|
1831
|
+
/**
|
|
1832
|
+
* Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
|
|
1833
|
+
*
|
|
1834
|
+
* @param model The BIM model whose children to get.
|
|
1835
|
+
* @param id The expressID of the item whose children to get.
|
|
1836
|
+
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
1837
|
+
*
|
|
1838
|
+
* @returns A 'Set' with the expressIDs of the found items.
|
|
1839
|
+
*/
|
|
1840
|
+
getElementsChildren(model: FragmentsGroup, id: number, found?: Set<number>): Set<number>;
|
|
1578
1841
|
}
|
|
1579
|
-
import * as THREE from "three";
|
|
1580
|
-
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
1581
|
-
center: THREE.Vector3;
|
|
1582
|
-
halfSizes: THREE.Vector3;
|
|
1583
|
-
rotation: THREE.Matrix3;
|
|
1584
|
-
transformation: THREE.Matrix4;
|
|
1585
|
-
};
|
|
1586
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1587
1842
|
import * as WEBIFC from "web-ifc";
|
|
1588
1843
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1589
1844
|
import { Component, Disposable, Event, Components } from "../../core";
|
|
@@ -1840,275 +2095,104 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
|
|
|
1840
2095
|
private registerChange;
|
|
1841
2096
|
private newSingleProperty;
|
|
1842
2097
|
}
|
|
1843
|
-
import * as WEBIFC from "web-ifc";
|
|
1844
|
-
import * as FRAG from "@thatopen/fragments";
|
|
1845
|
-
import { Component, Components } from "../../core";
|
|
1846
2098
|
/**
|
|
1847
|
-
*
|
|
2099
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
1848
2100
|
*/
|
|
1849
|
-
export declare
|
|
1850
|
-
/**
|
|
1851
|
-
* A unique identifier for the component.
|
|
1852
|
-
* This UUID is used to register the component within the Components system.
|
|
1853
|
-
*/
|
|
1854
|
-
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1855
|
-
/** {@link Component.enabled} */
|
|
1856
|
-
enabled: boolean;
|
|
1857
|
-
constructor(components: Components);
|
|
1858
|
-
/**
|
|
1859
|
-
* Exports all the properties of an IFC into an array of JS objects.
|
|
1860
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1861
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
1862
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
1863
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1864
|
-
* to make the location data available (e.g. absolute position of building).
|
|
1865
|
-
*/
|
|
1866
|
-
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1867
|
-
}
|
|
1868
|
-
import * as THREE from "three";
|
|
1869
|
-
export declare class MaterialsUtils {
|
|
1870
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
1871
|
-
}
|
|
2101
|
+
export declare const GeometryTypes: Set<number>;
|
|
1872
2102
|
import * as THREE from "three";
|
|
1873
|
-
import {
|
|
2103
|
+
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
1874
2104
|
/**
|
|
1875
|
-
*
|
|
2105
|
+
* A class representing a 2D minimap of a 3D world.
|
|
1876
2106
|
*/
|
|
1877
|
-
export
|
|
2107
|
+
export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
2108
|
+
/** {@link Disposable.onDisposed} */
|
|
2109
|
+
readonly onDisposed: Event<unknown>;
|
|
2110
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2111
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2112
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2113
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2114
|
+
/** {@link Resizeable.onResize} */
|
|
2115
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
1878
2116
|
/**
|
|
1879
|
-
*
|
|
2117
|
+
* The front offset of the minimap.
|
|
2118
|
+
* It determines how much the minimap's view is offset from the camera's view.
|
|
2119
|
+
* By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
1880
2120
|
*/
|
|
1881
|
-
|
|
2121
|
+
frontOffset: number;
|
|
1882
2122
|
/**
|
|
1883
|
-
* The
|
|
2123
|
+
* The override material for the minimap.
|
|
2124
|
+
* It is used to render the depth information of the world onto the minimap.
|
|
1884
2125
|
*/
|
|
1885
|
-
|
|
2126
|
+
overrideMaterial: THREE.MeshDepthMaterial;
|
|
1886
2127
|
/**
|
|
1887
|
-
* The
|
|
2128
|
+
* The background color of the minimap.
|
|
2129
|
+
* It is used to set the background color of the minimap's renderer.
|
|
1888
2130
|
*/
|
|
1889
|
-
|
|
1890
|
-
}
|
|
1891
|
-
/**
|
|
1892
|
-
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1893
|
-
*/
|
|
1894
|
-
export declare class VertexPicker extends Component implements Disposable {
|
|
1895
|
-
/** {@link Disposable.onDisposed} */
|
|
1896
|
-
readonly onDisposed: Event<unknown>;
|
|
2131
|
+
backgroundColor: THREE.Color;
|
|
1897
2132
|
/**
|
|
1898
|
-
*
|
|
1899
|
-
*
|
|
2133
|
+
* The WebGL renderer for the minimap.
|
|
2134
|
+
* It is used to render the minimap onto the screen.
|
|
1900
2135
|
*/
|
|
1901
|
-
|
|
2136
|
+
renderer: THREE.WebGLRenderer;
|
|
1902
2137
|
/**
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
2138
|
+
* A flag indicating whether the minimap is enabled.
|
|
2139
|
+
* If disabled, the minimap will not update or render.
|
|
1905
2140
|
*/
|
|
1906
|
-
|
|
2141
|
+
enabled: boolean;
|
|
1907
2142
|
/**
|
|
1908
|
-
*
|
|
2143
|
+
* The world in which the minimap is displayed.
|
|
2144
|
+
* It provides access to the 3D scene, camera, and other relevant world elements.
|
|
1909
2145
|
*/
|
|
1910
|
-
|
|
2146
|
+
world: World;
|
|
2147
|
+
private _lockRotation;
|
|
2148
|
+
private _camera;
|
|
2149
|
+
private _plane;
|
|
2150
|
+
private _size;
|
|
2151
|
+
private _tempVector1;
|
|
2152
|
+
private _tempVector2;
|
|
2153
|
+
private _tempTarget;
|
|
2154
|
+
private readonly down;
|
|
1911
2155
|
/**
|
|
1912
|
-
*
|
|
2156
|
+
* Gets or sets whether the minimap rotation is locked.
|
|
2157
|
+
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
1913
2158
|
*/
|
|
1914
|
-
|
|
2159
|
+
get lockRotation(): boolean;
|
|
1915
2160
|
/**
|
|
1916
|
-
*
|
|
1917
|
-
*
|
|
1918
|
-
* If
|
|
2161
|
+
* Sets whether the minimap rotation is locked.
|
|
2162
|
+
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2163
|
+
* @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
|
|
1919
2164
|
*/
|
|
1920
|
-
|
|
1921
|
-
private _pickedPoint;
|
|
1922
|
-
private _config;
|
|
1923
|
-
private _enabled;
|
|
2165
|
+
set lockRotation(active: boolean);
|
|
1924
2166
|
/**
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
* @param value - The new enabled state.
|
|
2167
|
+
* Gets the current zoom level of the minimap.
|
|
2168
|
+
* The zoom level determines how much of the world is visible on the minimap.
|
|
2169
|
+
* @returns The current zoom level of the minimap.
|
|
1930
2170
|
*/
|
|
1931
|
-
|
|
2171
|
+
get zoom(): number;
|
|
1932
2172
|
/**
|
|
1933
|
-
*
|
|
1934
|
-
*
|
|
1935
|
-
* @
|
|
2173
|
+
* Sets the zoom level of the minimap.
|
|
2174
|
+
* The zoom level determines how much of the world is visible on the minimap.
|
|
2175
|
+
* @param value - The new zoom level of the minimap.
|
|
1936
2176
|
*/
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
* @returns A copy of the current VertexPickerConfig object.
|
|
1957
|
-
*
|
|
1958
|
-
* @example
|
|
1959
|
-
* '''typescript
|
|
1960
|
-
* const currentConfig = vertexPicker.config;
|
|
1961
|
-
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1962
|
-
* '''
|
|
1963
|
-
*/
|
|
1964
|
-
get config(): Partial<VertexPickerConfig>;
|
|
1965
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1966
|
-
/** {@link Disposable.dispose} */
|
|
1967
|
-
dispose(): void;
|
|
1968
|
-
/**
|
|
1969
|
-
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1970
|
-
*
|
|
1971
|
-
* @param world - The World instance to use for raycasting.
|
|
1972
|
-
*
|
|
1973
|
-
* @returns The current picked point, or null if no point is picked.
|
|
1974
|
-
*
|
|
1975
|
-
* @remarks
|
|
1976
|
-
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1977
|
-
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1978
|
-
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1979
|
-
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1980
|
-
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1981
|
-
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1982
|
-
*/
|
|
1983
|
-
get(world: World): THREE.Vector3 | null;
|
|
1984
|
-
private getClosestVertex;
|
|
1985
|
-
private getVertices;
|
|
1986
|
-
private getVertex;
|
|
1987
|
-
}
|
|
1988
|
-
export declare class UUID {
|
|
1989
|
-
private static _pattern;
|
|
1990
|
-
private static _lut;
|
|
1991
|
-
static create(): string;
|
|
1992
|
-
static validate(uuid: string): void;
|
|
1993
|
-
}
|
|
1994
|
-
import * as THREE from "three";
|
|
1995
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1996
|
-
import { Component, Components } from "../../core";
|
|
1997
|
-
/**
|
|
1998
|
-
* Represents an edge measurement result.
|
|
1999
|
-
*/
|
|
2000
|
-
export interface MeasureEdge {
|
|
2001
|
-
/**
|
|
2002
|
-
* The distance between the two points of the edge.
|
|
2003
|
-
*/
|
|
2004
|
-
distance: number;
|
|
2005
|
-
/**
|
|
2006
|
-
* The two points that define the edge.
|
|
2007
|
-
*/
|
|
2008
|
-
points: THREE.Vector3[];
|
|
2009
|
-
}
|
|
2010
|
-
/**
|
|
2011
|
-
* Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
|
|
2012
|
-
*/
|
|
2013
|
-
export declare class MeasurementUtils extends Component {
|
|
2014
|
-
/**
|
|
2015
|
-
* A unique identifier for the component.
|
|
2016
|
-
* This UUID is used to register the component within the Components system.
|
|
2017
|
-
*/
|
|
2018
|
-
static uuid: string;
|
|
2019
|
-
/** {@link Component.enabled} */
|
|
2020
|
-
enabled: boolean;
|
|
2021
|
-
constructor(components: Components);
|
|
2022
|
-
/**
|
|
2023
|
-
* Utility method to calculate the distance from a point to a line segment.
|
|
2024
|
-
*
|
|
2025
|
-
* @param point - The point from which to calculate the distance.
|
|
2026
|
-
* @param lineStart - The start point of the line segment.
|
|
2027
|
-
* @param lineEnd - The end point of the line segment.
|
|
2028
|
-
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
2029
|
-
* @returns The distance from the point to the line segment.
|
|
2030
|
-
*/
|
|
2031
|
-
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
2032
|
-
/**
|
|
2033
|
-
* Method to get the face of a mesh that contains a given triangle index.
|
|
2034
|
-
* It also returns the edges of the found face and their indices.
|
|
2035
|
-
*
|
|
2036
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
2037
|
-
* @param triangleIndex - The index of the triangle within the mesh.
|
|
2038
|
-
* @param instance - The instance of the mesh (optional).
|
|
2039
|
-
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
2040
|
-
*/
|
|
2041
|
-
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
2042
|
-
edges: MeasureEdge[];
|
|
2043
|
-
indices: Set<number>;
|
|
2044
|
-
} | null;
|
|
2045
|
-
/**
|
|
2046
|
-
* Method to get the vertices and normal of a mesh face at a given index.
|
|
2047
|
-
* It also applies instance transformation if provided.
|
|
2048
|
-
*
|
|
2049
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
2050
|
-
* @param faceIndex - The index of the face within the mesh.
|
|
2051
|
-
* @param instance - The instance of the mesh (optional).
|
|
2052
|
-
* @returns An object containing the vertices and normal of the face.
|
|
2053
|
-
* @throws Will throw an error if the geometry is not indexed.
|
|
2054
|
-
*/
|
|
2055
|
-
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
2056
|
-
p1: THREE.Vector3;
|
|
2057
|
-
p2: THREE.Vector3;
|
|
2058
|
-
p3: THREE.Vector3;
|
|
2059
|
-
faceNormal: THREE.Vector3;
|
|
2060
|
-
};
|
|
2061
|
-
/**
|
|
2062
|
-
* Method to round the vector's components to a specified number of decimal places.
|
|
2063
|
-
* This is used to ensure numerical precision in edge detection.
|
|
2064
|
-
*
|
|
2065
|
-
* @param vector - The vector to round.
|
|
2066
|
-
* @returns The vector with rounded components.
|
|
2067
|
-
*/
|
|
2068
|
-
round(vector: THREE.Vector3): void;
|
|
2069
|
-
/**
|
|
2070
|
-
* Calculates the volume of a set of fragments.
|
|
2071
|
-
*
|
|
2072
|
-
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
2073
|
-
* @returns The total volume of the fragments and the bounding sphere.
|
|
2074
|
-
*
|
|
2075
|
-
* @remarks
|
|
2076
|
-
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
2077
|
-
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
2078
|
-
*
|
|
2079
|
-
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
2080
|
-
* @throws Will throw an error if the fragment manager is not available.
|
|
2081
|
-
*/
|
|
2082
|
-
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
2083
|
-
/**
|
|
2084
|
-
* Calculates the total volume of a set of meshes.
|
|
2085
|
-
*
|
|
2086
|
-
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
2087
|
-
* @returns The total volume of the meshes and the bounding sphere.
|
|
2088
|
-
*
|
|
2089
|
-
* @remarks
|
|
2090
|
-
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
2091
|
-
* and its bounding sphere.
|
|
2092
|
-
*
|
|
2093
|
-
*/
|
|
2094
|
-
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
2095
|
-
private getFaceData;
|
|
2096
|
-
private getVolumeOfMesh;
|
|
2097
|
-
private getSignedVolumeOfTriangle;
|
|
2098
|
-
}
|
|
2099
|
-
import * as WEBIFC from "web-ifc";
|
|
2100
|
-
import { IfcItemsCategories } from "../../../ifc";
|
|
2101
|
-
export declare class SpatialStructure {
|
|
2102
|
-
itemsByFloor: IfcItemsCategories;
|
|
2103
|
-
private _units;
|
|
2104
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2105
|
-
cleanUp(): void;
|
|
2106
|
-
}
|
|
2107
|
-
import * as WEBIFC from "web-ifc";
|
|
2108
|
-
/** Configuration of the IFC-fragment conversion. */
|
|
2109
|
-
export declare class IfcFragmentSettings {
|
|
2110
|
-
/** Whether to extract the IFC properties into a JSON. */
|
|
2111
|
-
includeProperties: boolean;
|
|
2177
|
+
set zoom(value: number);
|
|
2178
|
+
constructor(world: World);
|
|
2179
|
+
/** {@link Disposable.dispose} */
|
|
2180
|
+
dispose(): void;
|
|
2181
|
+
/** Returns the camera used by the MiniMap */
|
|
2182
|
+
get(): THREE.OrthographicCamera;
|
|
2183
|
+
/** {@link Updateable.update} */
|
|
2184
|
+
update(): void;
|
|
2185
|
+
/** {@link Resizeable.getSize} */
|
|
2186
|
+
getSize(): THREE.Vector2;
|
|
2187
|
+
/** {@link Resizeable.resize} */
|
|
2188
|
+
resize(size?: THREE.Vector2): void;
|
|
2189
|
+
private updatePlanes;
|
|
2190
|
+
}
|
|
2191
|
+
import * as WEBIFC from "web-ifc";
|
|
2192
|
+
/** Configuration of the IFC-fragment conversion. */
|
|
2193
|
+
export declare class IfcFragmentSettings {
|
|
2194
|
+
/** Whether to extract the IFC properties into a JSON. */
|
|
2195
|
+
includeProperties: boolean;
|
|
2112
2196
|
/**
|
|
2113
2197
|
* Generate the geometry for categories that are not included by default,
|
|
2114
2198
|
* like IFCSPACE.
|
|
@@ -2145,10 +2229,14 @@ export declare class IfcFragmentSettings {
|
|
|
2145
2229
|
*/
|
|
2146
2230
|
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2147
2231
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2232
|
+
import * as WEBIFC from "web-ifc";
|
|
2233
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2234
|
+
export declare class SpatialStructure {
|
|
2235
|
+
itemsByFloor: IfcItemsCategories;
|
|
2236
|
+
private _units;
|
|
2237
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2238
|
+
cleanUp(): void;
|
|
2239
|
+
}
|
|
2152
2240
|
import * as WEBIFC from "web-ifc";
|
|
2153
2241
|
export interface IfcItemsCategories {
|
|
2154
2242
|
[itemID: number]: number;
|
|
@@ -2167,423 +2255,407 @@ export declare class IfcCategories {
|
|
|
2167
2255
|
export declare const IfcElements: {
|
|
2168
2256
|
[key: number]: string;
|
|
2169
2257
|
};
|
|
2170
|
-
import { InverseAttribute } from "./types";
|
|
2171
|
-
export declare const relToAttributesMap: Map<number, {
|
|
2172
|
-
forRelating: InverseAttribute;
|
|
2173
|
-
forRelated: InverseAttribute;
|
|
2174
|
-
}>;
|
|
2175
2258
|
/**
|
|
2176
2259
|
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
2177
2260
|
*/
|
|
2178
2261
|
export declare const IfcCategoryMap: {
|
|
2179
2262
|
[key: number]: string;
|
|
2180
2263
|
};
|
|
2181
|
-
import * as
|
|
2182
|
-
|
|
2264
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2265
|
+
export declare class IfcPropertiesUtils {
|
|
2266
|
+
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2267
|
+
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2268
|
+
[attribute: string]: any;
|
|
2269
|
+
} | null>;
|
|
2270
|
+
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2271
|
+
[relatingID: number]: number[];
|
|
2272
|
+
}>;
|
|
2273
|
+
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2274
|
+
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2275
|
+
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2276
|
+
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2277
|
+
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2278
|
+
key: string | null;
|
|
2279
|
+
name: string | null;
|
|
2280
|
+
}>;
|
|
2281
|
+
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2282
|
+
key: string | null;
|
|
2283
|
+
value: number | null;
|
|
2284
|
+
}>;
|
|
2285
|
+
static isRel(expressID: number): boolean;
|
|
2286
|
+
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2287
|
+
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2288
|
+
}
|
|
2183
2289
|
/**
|
|
2184
|
-
*
|
|
2290
|
+
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
2185
2291
|
*/
|
|
2186
|
-
export declare class
|
|
2187
|
-
/** {@link Disposable.onDisposed} */
|
|
2188
|
-
readonly onDisposed: Event<unknown>;
|
|
2189
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2190
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
2191
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2192
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
2193
|
-
/** {@link Resizeable.onResize} */
|
|
2194
|
-
readonly onResize: Event<THREE.Vector2>;
|
|
2195
|
-
/**
|
|
2196
|
-
* The front offset of the minimap.
|
|
2197
|
-
* It determines how much the minimap's view is offset from the camera's view.
|
|
2198
|
-
* By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
|
|
2199
|
-
*/
|
|
2200
|
-
frontOffset: number;
|
|
2201
|
-
/**
|
|
2202
|
-
* The override material for the minimap.
|
|
2203
|
-
* It is used to render the depth information of the world onto the minimap.
|
|
2204
|
-
*/
|
|
2205
|
-
overrideMaterial: THREE.MeshDepthMaterial;
|
|
2292
|
+
export declare class Event<T> {
|
|
2206
2293
|
/**
|
|
2207
|
-
*
|
|
2208
|
-
*
|
|
2294
|
+
* Add a callback to this event instance.
|
|
2295
|
+
* @param handler - the callback to be added to this event.
|
|
2209
2296
|
*/
|
|
2210
|
-
|
|
2297
|
+
add(handler: T extends void ? {
|
|
2298
|
+
(): void;
|
|
2299
|
+
} : {
|
|
2300
|
+
(data: T): void;
|
|
2301
|
+
}): void;
|
|
2211
2302
|
/**
|
|
2212
|
-
*
|
|
2213
|
-
*
|
|
2303
|
+
* Removes a callback from this event instance.
|
|
2304
|
+
* @param handler - the callback to be removed from this event.
|
|
2214
2305
|
*/
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
private _tempVector1;
|
|
2231
|
-
private _tempVector2;
|
|
2232
|
-
private _tempTarget;
|
|
2233
|
-
private readonly down;
|
|
2234
|
-
/**
|
|
2235
|
-
* Gets or sets whether the minimap rotation is locked.
|
|
2236
|
-
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2237
|
-
*/
|
|
2238
|
-
get lockRotation(): boolean;
|
|
2239
|
-
/**
|
|
2240
|
-
* Sets whether the minimap rotation is locked.
|
|
2241
|
-
* When rotation is locked, the minimap will always face the same direction as the camera.
|
|
2242
|
-
* @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
|
|
2243
|
-
*/
|
|
2244
|
-
set lockRotation(active: boolean);
|
|
2306
|
+
remove(handler: T extends void ? {
|
|
2307
|
+
(): void;
|
|
2308
|
+
} : {
|
|
2309
|
+
(data: T): void;
|
|
2310
|
+
}): void;
|
|
2311
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2312
|
+
trigger: (data?: T) => void;
|
|
2313
|
+
/** Gets rid of all the suscribed events. */
|
|
2314
|
+
reset(): void;
|
|
2315
|
+
private handlers;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* 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.
|
|
2319
|
+
*/
|
|
2320
|
+
export declare class AsyncEvent<T> {
|
|
2245
2321
|
/**
|
|
2246
|
-
*
|
|
2247
|
-
*
|
|
2248
|
-
* @returns The current zoom level of the minimap.
|
|
2322
|
+
* Add a callback to this event instance.
|
|
2323
|
+
* @param handler - the callback to be added to this event.
|
|
2249
2324
|
*/
|
|
2250
|
-
|
|
2325
|
+
add(handler: T extends void ? {
|
|
2326
|
+
(): Promise<void>;
|
|
2327
|
+
} : {
|
|
2328
|
+
(data: T): Promise<void>;
|
|
2329
|
+
}): void;
|
|
2251
2330
|
/**
|
|
2252
|
-
*
|
|
2253
|
-
*
|
|
2254
|
-
* @param value - The new zoom level of the minimap.
|
|
2331
|
+
* Removes a callback from this event instance.
|
|
2332
|
+
* @param handler - the callback to be removed from this event.
|
|
2255
2333
|
*/
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
/** {@link Resizeable.resize} */
|
|
2267
|
-
resize(size?: THREE.Vector2): void;
|
|
2268
|
-
private updatePlanes;
|
|
2269
|
-
}
|
|
2270
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
2271
|
-
export declare class IfcPropertiesUtils {
|
|
2272
|
-
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2273
|
-
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2274
|
-
[attribute: string]: any;
|
|
2275
|
-
} | null>;
|
|
2276
|
-
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2277
|
-
[relatingID: number]: number[];
|
|
2278
|
-
}>;
|
|
2279
|
-
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2280
|
-
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2281
|
-
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2282
|
-
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2283
|
-
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2284
|
-
key: string | null;
|
|
2285
|
-
name: string | null;
|
|
2286
|
-
}>;
|
|
2287
|
-
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2288
|
-
key: string | null;
|
|
2289
|
-
value: number | null;
|
|
2290
|
-
}>;
|
|
2291
|
-
static isRel(expressID: number): boolean;
|
|
2292
|
-
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2293
|
-
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2334
|
+
remove(handler: T extends void ? {
|
|
2335
|
+
(): Promise<void>;
|
|
2336
|
+
} : {
|
|
2337
|
+
(data: T): Promise<void>;
|
|
2338
|
+
}): void;
|
|
2339
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2340
|
+
trigger: (data?: T) => Promise<void>;
|
|
2341
|
+
/** Gets rid of all the suscribed events. */
|
|
2342
|
+
reset(): void;
|
|
2343
|
+
private handlers;
|
|
2294
2344
|
}
|
|
2295
2345
|
import * as THREE from "three";
|
|
2296
|
-
import
|
|
2297
|
-
import {
|
|
2346
|
+
import CameraControls from "camera-controls";
|
|
2347
|
+
import { Event } from "./event";
|
|
2298
2348
|
/**
|
|
2299
|
-
*
|
|
2349
|
+
* Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
|
|
2300
2350
|
*/
|
|
2301
|
-
export interface
|
|
2302
|
-
/**
|
|
2303
|
-
* The color of the grid lines.
|
|
2304
|
-
*/
|
|
2305
|
-
color: THREE.Color;
|
|
2306
|
-
/**
|
|
2307
|
-
* The size of the primary grid lines.
|
|
2308
|
-
*/
|
|
2309
|
-
size1: number;
|
|
2310
|
-
/**
|
|
2311
|
-
* The size of the secondary grid lines.
|
|
2312
|
-
*/
|
|
2313
|
-
size2: number;
|
|
2351
|
+
export interface Disposable {
|
|
2314
2352
|
/**
|
|
2315
|
-
*
|
|
2353
|
+
* Destroys the object from memory to prevent a
|
|
2354
|
+
* [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
2316
2355
|
*/
|
|
2317
|
-
|
|
2356
|
+
dispose: () => void | Promise<void>;
|
|
2357
|
+
/** Fired after the tool has been disposed. */
|
|
2358
|
+
readonly onDisposed: Event<any>;
|
|
2318
2359
|
}
|
|
2319
2360
|
/**
|
|
2320
|
-
*
|
|
2361
|
+
* Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2321
2362
|
*/
|
|
2322
|
-
export
|
|
2323
|
-
/** {@link Disposable.onDisposed} */
|
|
2324
|
-
readonly onDisposed: Event<unknown>;
|
|
2325
|
-
/** The world instance to which this Raycaster belongs. */
|
|
2326
|
-
world: World;
|
|
2327
|
-
/** The components instance to which this grid belongs. */
|
|
2328
|
-
components: Components;
|
|
2329
|
-
/** {@link Hideable.visible} */
|
|
2330
|
-
get visible(): boolean;
|
|
2331
|
-
/** {@link Hideable.visible} */
|
|
2332
|
-
set visible(visible: boolean);
|
|
2333
|
-
/** The material of the grid. */
|
|
2334
|
-
get material(): THREE.ShaderMaterial;
|
|
2335
|
-
/**
|
|
2336
|
-
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2337
|
-
* perspective cameras and false for orthographic cameras.
|
|
2338
|
-
*/
|
|
2339
|
-
get fade(): boolean;
|
|
2363
|
+
export interface Hideable {
|
|
2340
2364
|
/**
|
|
2341
|
-
* Whether the
|
|
2342
|
-
*
|
|
2365
|
+
* Whether the geometric representation of this component is
|
|
2366
|
+
* currently visible or not in the
|
|
2367
|
+
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2343
2368
|
*/
|
|
2344
|
-
|
|
2345
|
-
/** The Three.js mesh that contains the infinite grid. */
|
|
2346
|
-
readonly three: THREE.Mesh;
|
|
2347
|
-
private _fade;
|
|
2348
|
-
constructor(components: Components, world: World, config: GridConfig);
|
|
2349
|
-
/** {@link Disposable.dispose} */
|
|
2350
|
-
dispose(): void;
|
|
2351
|
-
private setupEvents;
|
|
2352
|
-
private updateZoom;
|
|
2369
|
+
visible: boolean;
|
|
2353
2370
|
}
|
|
2354
|
-
import * as THREE from "three";
|
|
2355
|
-
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2356
2371
|
/**
|
|
2357
|
-
*
|
|
2358
|
-
*
|
|
2359
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
2360
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
2361
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2372
|
+
* Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
|
|
2362
2373
|
*/
|
|
2363
|
-
export
|
|
2364
|
-
/**
|
|
2365
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2366
|
-
*/
|
|
2367
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2368
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2369
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
2370
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2371
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
2372
|
-
/** {@link Disposable.onDisposed} */
|
|
2373
|
-
readonly onDisposed: Event<unknown>;
|
|
2374
|
-
/**
|
|
2375
|
-
* 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.
|
|
2376
|
-
*/
|
|
2377
|
-
isDisposing: boolean;
|
|
2378
|
-
/**
|
|
2379
|
-
* Indicates whether the world is currently enabled.
|
|
2380
|
-
* When disabled, the world will not be updated.
|
|
2381
|
-
*/
|
|
2382
|
-
enabled: boolean;
|
|
2383
|
-
/**
|
|
2384
|
-
* A unique identifier for the world.
|
|
2385
|
-
*/
|
|
2386
|
-
uuid: string;
|
|
2374
|
+
export interface Resizeable {
|
|
2387
2375
|
/**
|
|
2388
|
-
*
|
|
2376
|
+
* Sets size of this component (e.g. the resolution of a
|
|
2377
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2378
|
+
* component.
|
|
2389
2379
|
*/
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
private _renderer;
|
|
2380
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2381
|
+
/** Event that fires when the component has been resized. */
|
|
2382
|
+
onResize: Event<THREE.Vector2>;
|
|
2394
2383
|
/**
|
|
2395
|
-
*
|
|
2396
|
-
*
|
|
2384
|
+
* Gets the current size of this component (e.g. the resolution of a
|
|
2385
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2386
|
+
* component.
|
|
2397
2387
|
*/
|
|
2398
|
-
|
|
2388
|
+
getSize: () => THREE.Vector2;
|
|
2389
|
+
}
|
|
2390
|
+
/** Whether this component should be updated each frame. */
|
|
2391
|
+
export interface Updateable {
|
|
2392
|
+
/** Actions that should be executed after updating the component. */
|
|
2393
|
+
onAfterUpdate: Event<any>;
|
|
2394
|
+
/** Actions that should be executed before updating the component. */
|
|
2395
|
+
onBeforeUpdate: Event<any>;
|
|
2399
2396
|
/**
|
|
2400
|
-
*
|
|
2401
|
-
*
|
|
2402
|
-
* @param scene - The new scene to be set.
|
|
2397
|
+
* Function used to update the state of this component each frame. For
|
|
2398
|
+
* instance, a renderer component will make a render each frame.
|
|
2403
2399
|
*/
|
|
2404
|
-
|
|
2400
|
+
update(delta?: number): void;
|
|
2401
|
+
}
|
|
2402
|
+
/** Basic type to describe the progress of any kind of process. */
|
|
2403
|
+
export interface Progress {
|
|
2404
|
+
/** The amount of things that have been done already. */
|
|
2405
|
+
current: number;
|
|
2406
|
+
/** The total amount of things to be done by the process. */
|
|
2407
|
+
total: number;
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
2411
|
+
*/
|
|
2412
|
+
export interface Createable {
|
|
2413
|
+
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
2414
|
+
create: (data: any) => void;
|
|
2405
2415
|
/**
|
|
2406
|
-
*
|
|
2407
|
-
*
|
|
2416
|
+
* Finish the creation process of the component, successfully creating an
|
|
2417
|
+
* instance of whatever the component creates.
|
|
2408
2418
|
*/
|
|
2409
|
-
|
|
2419
|
+
endCreation?: (data: any) => void;
|
|
2410
2420
|
/**
|
|
2411
|
-
*
|
|
2412
|
-
*
|
|
2413
|
-
* @param camera - The new camera to be set.
|
|
2421
|
+
* Cancels the creation process of the component, going back to the state
|
|
2422
|
+
* before starting to create.
|
|
2414
2423
|
*/
|
|
2415
|
-
|
|
2416
|
-
/**
|
|
2417
|
-
|
|
2418
|
-
|
|
2424
|
+
cancelCreation?: (data: any) => void;
|
|
2425
|
+
/** Deletes an existing instance of an element (e.g. a Dimension). */
|
|
2426
|
+
delete: (data: any) => void;
|
|
2427
|
+
}
|
|
2428
|
+
/**
|
|
2429
|
+
* Whether this component supports to be configured.
|
|
2430
|
+
*/
|
|
2431
|
+
export interface Configurable<T extends Record<string, any>> {
|
|
2432
|
+
/** Wether this components has been already configured. */
|
|
2433
|
+
isSetup: boolean;
|
|
2434
|
+
/** Use the provided configuration to setup the tool. */
|
|
2435
|
+
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
2436
|
+
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2437
|
+
readonly onSetup: Event<any>;
|
|
2438
|
+
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2439
|
+
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2419
2440
|
*/
|
|
2420
|
-
|
|
2441
|
+
config: Required<T>;
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Whether a camera uses the Camera Controls library.
|
|
2445
|
+
*/
|
|
2446
|
+
export interface CameraControllable {
|
|
2421
2447
|
/**
|
|
2422
|
-
*
|
|
2423
|
-
*
|
|
2424
|
-
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2425
|
-
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2448
|
+
* An instance of CameraControls that provides camera control functionalities.
|
|
2449
|
+
* This instance is used to manipulate the camera.
|
|
2426
2450
|
*/
|
|
2427
|
-
|
|
2428
|
-
/** {@link Updateable.update} */
|
|
2429
|
-
update(delta?: number): void;
|
|
2430
|
-
/** {@link Disposable.dispose} */
|
|
2431
|
-
dispose(disposeResources?: boolean): void;
|
|
2451
|
+
controls: CameraControls;
|
|
2432
2452
|
}
|
|
2433
|
-
import
|
|
2434
|
-
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2453
|
+
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2435
2454
|
import { Components } from "../../Components";
|
|
2436
2455
|
/**
|
|
2437
|
-
*
|
|
2456
|
+
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
2438
2457
|
*/
|
|
2439
|
-
export
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
}
|
|
2458
|
+
export declare abstract class Base {
|
|
2459
|
+
components: Components;
|
|
2460
|
+
constructor(components: Components);
|
|
2461
|
+
/** Whether is component is {@link Disposable}. */
|
|
2462
|
+
isDisposeable: () => this is Disposable;
|
|
2463
|
+
/** Whether is component is {@link Resizeable}. */
|
|
2464
|
+
isResizeable: () => this is Resizeable;
|
|
2465
|
+
/** Whether is component is {@link Updateable}. */
|
|
2466
|
+
isUpdateable: () => this is Updateable;
|
|
2467
|
+
/** Whether is component is {@link Hideable}. */
|
|
2468
|
+
isHideable: () => this is Hideable;
|
|
2469
|
+
/** Whether is component is {@link Configurable}. */
|
|
2470
|
+
isConfigurable: () => this is Configurable<any>;
|
|
2449
2471
|
}
|
|
2472
|
+
import { Base } from "./base";
|
|
2450
2473
|
/**
|
|
2451
|
-
*
|
|
2474
|
+
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
2452
2475
|
*/
|
|
2453
|
-
export declare class
|
|
2454
|
-
/** {@link Configurable.isSetup} */
|
|
2455
|
-
isSetup: boolean;
|
|
2456
|
-
/**
|
|
2457
|
-
* The underlying Three.js scene object.
|
|
2458
|
-
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
2459
|
-
*/
|
|
2460
|
-
three: THREE.Scene;
|
|
2461
|
-
/** {@link Configurable.onSetup} */
|
|
2462
|
-
readonly onSetup: Event<SimpleScene>;
|
|
2476
|
+
export declare abstract class Component extends Base {
|
|
2463
2477
|
/**
|
|
2464
|
-
*
|
|
2465
|
-
*
|
|
2478
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
2479
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2480
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2481
|
+
* will not be updated automatically each frame.
|
|
2466
2482
|
*/
|
|
2467
|
-
|
|
2468
|
-
constructor(components: Components);
|
|
2469
|
-
/** {@link Configurable.setup} */
|
|
2470
|
-
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
2483
|
+
abstract enabled: boolean;
|
|
2471
2484
|
}
|
|
2472
|
-
import
|
|
2473
|
-
|
|
2485
|
+
import { InverseAttribute } from "./types";
|
|
2486
|
+
export declare const relToAttributesMap: Map<number, {
|
|
2487
|
+
forRelating: InverseAttribute;
|
|
2488
|
+
forRelated: InverseAttribute;
|
|
2489
|
+
}>;
|
|
2490
|
+
import { Base } from "./base";
|
|
2491
|
+
import { World } from "./world";
|
|
2492
|
+
import { Event } from "./event";
|
|
2474
2493
|
import { Components } from "../../Components";
|
|
2475
2494
|
/**
|
|
2476
|
-
*
|
|
2495
|
+
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
2477
2496
|
*/
|
|
2478
|
-
export declare class
|
|
2497
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
2498
|
+
readonly worlds: Map<string, World>;
|
|
2479
2499
|
/**
|
|
2480
|
-
*
|
|
2481
|
-
*
|
|
2500
|
+
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2501
|
+
* The event payload contains the world instance and the action ("added" or "removed").
|
|
2482
2502
|
*/
|
|
2483
|
-
|
|
2503
|
+
readonly onWorldChanged: Event<{
|
|
2504
|
+
world: World;
|
|
2505
|
+
action: "added" | "removed";
|
|
2506
|
+
}>;
|
|
2484
2507
|
/**
|
|
2485
|
-
* The
|
|
2508
|
+
* The current world this item is associated with. It can be null if no world is currently active.
|
|
2486
2509
|
*/
|
|
2487
|
-
|
|
2510
|
+
currentWorld: World | null;
|
|
2511
|
+
protected constructor(components: Components);
|
|
2512
|
+
}
|
|
2513
|
+
import * as THREE from "three";
|
|
2514
|
+
import { Vector2 } from "three";
|
|
2515
|
+
import { Event } from "./event";
|
|
2516
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2517
|
+
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
2518
|
+
/**
|
|
2519
|
+
* Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
|
|
2520
|
+
*/
|
|
2521
|
+
export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
|
|
2488
2522
|
/**
|
|
2489
|
-
* The
|
|
2523
|
+
* The three.js WebGLRenderer instance associated with this renderer.
|
|
2524
|
+
*
|
|
2525
|
+
* @abstract
|
|
2526
|
+
* @type {THREE.WebGLRenderer}
|
|
2490
2527
|
*/
|
|
2491
|
-
three: THREE.WebGLRenderer;
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2528
|
+
abstract three: THREE.WebGLRenderer;
|
|
2529
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2530
|
+
onAfterUpdate: Event<unknown>;
|
|
2531
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2532
|
+
onBeforeUpdate: Event<unknown>;
|
|
2533
|
+
/** {@link Disposable.onDisposed} */
|
|
2534
|
+
readonly onDisposed: Event<undefined>;
|
|
2535
|
+
/** {@link Resizeable.onResize} */
|
|
2536
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
2497
2537
|
/**
|
|
2498
|
-
*
|
|
2499
|
-
*
|
|
2500
|
-
* @param components - The components instance.
|
|
2501
|
-
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
2502
|
-
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
2538
|
+
* Event that fires when there has been a change to the list of clipping
|
|
2539
|
+
* planes used by the active renderer.
|
|
2503
2540
|
*/
|
|
2504
|
-
|
|
2541
|
+
readonly onClippingPlanesUpdated: Event<unknown>;
|
|
2505
2542
|
/** {@link Updateable.update} */
|
|
2506
|
-
update(): void
|
|
2543
|
+
abstract update(delta?: number): void | Promise<void>;
|
|
2507
2544
|
/** {@link Disposable.dispose} */
|
|
2508
|
-
dispose(): void;
|
|
2509
|
-
/** {@link Resizeable.getSize}
|
|
2510
|
-
getSize():
|
|
2545
|
+
abstract dispose(): void;
|
|
2546
|
+
/** {@link Resizeable.getSize} */
|
|
2547
|
+
abstract getSize(): Vector2;
|
|
2511
2548
|
/** {@link Resizeable.resize} */
|
|
2512
|
-
resize
|
|
2549
|
+
abstract resize(size: Vector2 | undefined): void;
|
|
2513
2550
|
/**
|
|
2514
|
-
*
|
|
2551
|
+
* The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
|
|
2552
|
+
*/
|
|
2553
|
+
clippingPlanes: THREE.Plane[];
|
|
2554
|
+
/**
|
|
2555
|
+
* Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
|
|
2515
2556
|
*
|
|
2516
|
-
* @
|
|
2557
|
+
* @remarks
|
|
2558
|
+
* This method is typically called when there is a change to the list of clipping planes
|
|
2559
|
+
* used by the active renderer.
|
|
2560
|
+
*/
|
|
2561
|
+
updateClippingPlanes(): void;
|
|
2562
|
+
/**
|
|
2563
|
+
* Sets or removes a clipping plane from the renderer.
|
|
2517
2564
|
*
|
|
2518
|
-
* @
|
|
2565
|
+
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
2566
|
+
* @param plane - The clipping plane to be added or removed.
|
|
2567
|
+
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
2568
|
+
*
|
|
2569
|
+
* @remarks
|
|
2570
|
+
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
2571
|
+
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
2572
|
+
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
2573
|
+
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
2574
|
+
* excluding any planes marked as local.
|
|
2519
2575
|
*/
|
|
2520
|
-
|
|
2521
|
-
private resizeEvent;
|
|
2522
|
-
private setupRenderer;
|
|
2523
|
-
private onContextLost;
|
|
2524
|
-
private onContextBack;
|
|
2576
|
+
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2525
2577
|
}
|
|
2526
2578
|
import * as THREE from "three";
|
|
2527
2579
|
import CameraControls from "camera-controls";
|
|
2528
|
-
import {
|
|
2529
|
-
import {
|
|
2580
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2581
|
+
import { CameraControllable } from "./interfaces";
|
|
2530
2582
|
/**
|
|
2531
|
-
*
|
|
2583
|
+
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2532
2584
|
*/
|
|
2533
|
-
export declare class
|
|
2534
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2535
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
2536
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2537
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2585
|
+
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2538
2586
|
/**
|
|
2539
|
-
*
|
|
2540
|
-
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2587
|
+
* Whether the camera is enabled or not.
|
|
2541
2588
|
*/
|
|
2542
|
-
|
|
2543
|
-
/** {@link Disposable.onDisposed} */
|
|
2544
|
-
readonly onDisposed: Event<string>;
|
|
2589
|
+
abstract enabled: boolean;
|
|
2545
2590
|
/**
|
|
2546
|
-
*
|
|
2547
|
-
* This camera is used for rendering the scene.
|
|
2591
|
+
* The Three.js camera instance.
|
|
2548
2592
|
*/
|
|
2549
|
-
three: THREE.
|
|
2550
|
-
private _allControls;
|
|
2593
|
+
abstract three: THREE.Camera;
|
|
2551
2594
|
/**
|
|
2552
|
-
*
|
|
2553
|
-
*
|
|
2554
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
2555
|
-
* object to move, rotate, look at objects, etc.
|
|
2595
|
+
* Optional CameraControls instance for controlling the camera.
|
|
2596
|
+
* This property is only available if the camera is controllable.
|
|
2556
2597
|
*/
|
|
2557
|
-
|
|
2598
|
+
abstract controls?: CameraControls;
|
|
2558
2599
|
/**
|
|
2559
|
-
*
|
|
2560
|
-
* If the current world is null, it returns false.
|
|
2561
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
2600
|
+
* Checks whether the instance is {@link CameraControllable}.
|
|
2562
2601
|
*
|
|
2563
|
-
* @returns
|
|
2602
|
+
* @returns True if the instance is controllable, false otherwise.
|
|
2564
2603
|
*/
|
|
2565
|
-
|
|
2604
|
+
hasCameraControls: () => this is CameraControllable;
|
|
2605
|
+
}
|
|
2606
|
+
import * as THREE from "three";
|
|
2607
|
+
import { Disposable } from "./interfaces";
|
|
2608
|
+
import { Event } from "./event";
|
|
2609
|
+
import { Components } from "../../Components";
|
|
2610
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2611
|
+
/**
|
|
2612
|
+
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2613
|
+
*/
|
|
2614
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2615
|
+
/** {@link Disposable.onDisposed} */
|
|
2616
|
+
readonly onDisposed: Event<unknown>;
|
|
2566
2617
|
/**
|
|
2567
|
-
*
|
|
2568
|
-
*
|
|
2569
|
-
*
|
|
2570
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2618
|
+
* Abstract property representing the three.js object associated with this scene.
|
|
2619
|
+
* It should be implemented by subclasses.
|
|
2571
2620
|
*/
|
|
2572
|
-
|
|
2573
|
-
constructor(components: Components);
|
|
2621
|
+
abstract three: THREE.Object3D;
|
|
2622
|
+
protected constructor(components: Components);
|
|
2574
2623
|
/** {@link Disposable.dispose} */
|
|
2575
2624
|
dispose(): void;
|
|
2576
|
-
|
|
2577
|
-
|
|
2625
|
+
}
|
|
2626
|
+
import * as THREE from "three";
|
|
2627
|
+
import { BaseScene } from "./base-scene";
|
|
2628
|
+
import { BaseCamera } from "./base-camera";
|
|
2629
|
+
import { BaseRenderer } from "./base-renderer";
|
|
2630
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
2631
|
+
/**
|
|
2632
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2633
|
+
*/
|
|
2634
|
+
export interface World extends Disposable, Updateable {
|
|
2635
|
+
/**
|
|
2636
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2637
|
+
*/
|
|
2638
|
+
meshes: Set<THREE.Mesh>;
|
|
2639
|
+
/**
|
|
2640
|
+
* The base scene of the world.
|
|
2641
|
+
*/
|
|
2642
|
+
scene: BaseScene;
|
|
2643
|
+
/**
|
|
2644
|
+
* The base camera of the world.
|
|
2645
|
+
*/
|
|
2646
|
+
camera: BaseCamera;
|
|
2647
|
+
/**
|
|
2648
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
2649
|
+
*/
|
|
2650
|
+
renderer: BaseRenderer | null;
|
|
2651
|
+
/**
|
|
2652
|
+
* A unique identifier for the world.
|
|
2653
|
+
*/
|
|
2654
|
+
uuid: string;
|
|
2578
2655
|
/**
|
|
2579
|
-
*
|
|
2580
|
-
* {@link Components.renderer}.
|
|
2656
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
2581
2657
|
*/
|
|
2582
|
-
|
|
2583
|
-
private setupCamera;
|
|
2584
|
-
private newCameraControls;
|
|
2585
|
-
private setupEvents;
|
|
2586
|
-
private static getSubsetOfThree;
|
|
2658
|
+
isDisposing: boolean;
|
|
2587
2659
|
}
|
|
2588
2660
|
import * as THREE from "three";
|
|
2589
2661
|
import { Disposable, Event } from "../../Types";
|
|
@@ -2608,6 +2680,17 @@ export declare class Mouse implements Disposable {
|
|
|
2608
2680
|
private updateMouseInfo;
|
|
2609
2681
|
private setupEvents;
|
|
2610
2682
|
}
|
|
2683
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2684
|
+
/**
|
|
2685
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
2686
|
+
*/
|
|
2687
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
2688
|
+
/**
|
|
2689
|
+
* Amount of properties to be streamed.
|
|
2690
|
+
* Defaults to 100 properties.
|
|
2691
|
+
*/
|
|
2692
|
+
propertiesSize: number;
|
|
2693
|
+
}
|
|
2611
2694
|
import * as THREE from "three";
|
|
2612
2695
|
import { Components } from "../../Components";
|
|
2613
2696
|
import { Event, World, Disposable } from "../../Types";
|
|
@@ -2661,518 +2744,568 @@ export declare class SimpleRaycaster implements Disposable {
|
|
|
2661
2744
|
private filterClippingPlanes;
|
|
2662
2745
|
}
|
|
2663
2746
|
import * as THREE from "three";
|
|
2664
|
-
import {
|
|
2665
|
-
import { AsyncEvent, Event, World } from "../../Types";
|
|
2747
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2666
2748
|
/**
|
|
2667
|
-
*
|
|
2749
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
2750
|
+
*
|
|
2751
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
2752
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
2753
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2668
2754
|
*/
|
|
2669
|
-
export
|
|
2755
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
2670
2756
|
/**
|
|
2671
|
-
*
|
|
2672
|
-
* Default value is 1000.
|
|
2757
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2673
2758
|
*/
|
|
2674
|
-
|
|
2759
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2760
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2761
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2762
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2763
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2764
|
+
/** {@link Disposable.onDisposed} */
|
|
2765
|
+
readonly onDisposed: Event<unknown>;
|
|
2675
2766
|
/**
|
|
2676
|
-
*
|
|
2677
|
-
* Default value is 512.
|
|
2767
|
+
* 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.
|
|
2678
2768
|
*/
|
|
2679
|
-
|
|
2769
|
+
isDisposing: boolean;
|
|
2680
2770
|
/**
|
|
2681
|
-
*
|
|
2682
|
-
*
|
|
2771
|
+
* Indicates whether the world is currently enabled.
|
|
2772
|
+
* When disabled, the world will not be updated.
|
|
2683
2773
|
*/
|
|
2684
|
-
|
|
2774
|
+
enabled: boolean;
|
|
2685
2775
|
/**
|
|
2686
|
-
*
|
|
2687
|
-
* Default value is true.
|
|
2776
|
+
* A unique identifier for the world.
|
|
2688
2777
|
*/
|
|
2689
|
-
|
|
2690
|
-
}
|
|
2691
|
-
/**
|
|
2692
|
-
* A base renderer to determine visibility on screen.
|
|
2693
|
-
*/
|
|
2694
|
-
export declare class CullerRenderer {
|
|
2695
|
-
/** {@link Disposable.onDisposed} */
|
|
2696
|
-
readonly onDisposed: Event<string>;
|
|
2778
|
+
uuid: string;
|
|
2697
2779
|
/**
|
|
2698
|
-
*
|
|
2699
|
-
* meshes that are currently visible, and the ones that were visible
|
|
2700
|
-
* just before but not anymore.
|
|
2780
|
+
* An optional name for the world.
|
|
2701
2781
|
*/
|
|
2702
|
-
|
|
2782
|
+
name?: string;
|
|
2783
|
+
private _scene?;
|
|
2784
|
+
private _camera?;
|
|
2785
|
+
private _renderer;
|
|
2703
2786
|
/**
|
|
2704
|
-
*
|
|
2787
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2788
|
+
* @returns The current scene.
|
|
2705
2789
|
*/
|
|
2706
|
-
|
|
2790
|
+
get scene(): T;
|
|
2707
2791
|
/**
|
|
2708
|
-
*
|
|
2709
|
-
*
|
|
2792
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2793
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2794
|
+
* @param scene - The new scene to be set.
|
|
2710
2795
|
*/
|
|
2711
|
-
|
|
2796
|
+
set scene(scene: T);
|
|
2712
2797
|
/**
|
|
2713
|
-
*
|
|
2714
|
-
*
|
|
2798
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2799
|
+
* @returns The current camera.
|
|
2715
2800
|
*/
|
|
2716
|
-
|
|
2717
|
-
/** The components instance to which this renderer belongs. */
|
|
2718
|
-
components: Components;
|
|
2719
|
-
/** The world instance to which this renderer belongs. */
|
|
2720
|
-
readonly world: World;
|
|
2721
|
-
/** The THREE.js renderer used to make the visibility test. */
|
|
2722
|
-
readonly renderer: THREE.WebGLRenderer;
|
|
2723
|
-
protected autoUpdate: boolean;
|
|
2724
|
-
protected updateInterval: number;
|
|
2725
|
-
protected readonly worker: Worker;
|
|
2726
|
-
protected readonly scene: THREE.Scene;
|
|
2727
|
-
private _width;
|
|
2728
|
-
private _height;
|
|
2729
|
-
private _availableColor;
|
|
2730
|
-
private readonly renderTarget;
|
|
2731
|
-
private readonly bufferSize;
|
|
2732
|
-
private readonly _buffer;
|
|
2733
|
-
protected _isWorkerBusy: boolean;
|
|
2734
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2735
|
-
/** {@link Disposable.dispose} */
|
|
2736
|
-
dispose(): void;
|
|
2801
|
+
get camera(): U;
|
|
2737
2802
|
/**
|
|
2738
|
-
*
|
|
2739
|
-
*
|
|
2740
|
-
* @param
|
|
2741
|
-
* not true.
|
|
2803
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
2804
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
2805
|
+
* @param camera - The new camera to be set.
|
|
2742
2806
|
*/
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2807
|
+
set camera(camera: U);
|
|
2808
|
+
/**
|
|
2809
|
+
* Getter for the renderer.
|
|
2810
|
+
* @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).
|
|
2811
|
+
*/
|
|
2812
|
+
get renderer(): S | null;
|
|
2813
|
+
/**
|
|
2814
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
2815
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
2816
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2817
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2818
|
+
*/
|
|
2819
|
+
set renderer(renderer: S | null);
|
|
2820
|
+
/** {@link Updateable.update} */
|
|
2821
|
+
update(delta?: number): void;
|
|
2822
|
+
/** {@link Disposable.dispose} */
|
|
2823
|
+
dispose(disposeResources?: boolean): void;
|
|
2824
|
+
}
|
|
2825
|
+
import * as THREE from "three";
|
|
2826
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2827
|
+
import { Components } from "../../Components";
|
|
2828
|
+
/**
|
|
2829
|
+
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
2830
|
+
*/
|
|
2831
|
+
export interface SimpleSceneConfig {
|
|
2832
|
+
directionalLight: {
|
|
2833
|
+
color: THREE.Color;
|
|
2834
|
+
intensity: number;
|
|
2835
|
+
position: THREE.Vector3;
|
|
2749
2836
|
};
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2837
|
+
ambientLight: {
|
|
2838
|
+
color: THREE.Color;
|
|
2839
|
+
intensity: number;
|
|
2840
|
+
};
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
|
|
2844
|
+
*/
|
|
2845
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
2846
|
+
/** {@link Configurable.isSetup} */
|
|
2847
|
+
isSetup: boolean;
|
|
2848
|
+
/**
|
|
2849
|
+
* The underlying Three.js scene object.
|
|
2850
|
+
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
2851
|
+
*/
|
|
2852
|
+
three: THREE.Scene;
|
|
2853
|
+
/** {@link Configurable.onSetup} */
|
|
2854
|
+
readonly onSetup: Event<SimpleScene>;
|
|
2855
|
+
/**
|
|
2856
|
+
* Configuration interface for the {@link SimpleScene}.
|
|
2857
|
+
* Defines properties for directional and ambient lights.
|
|
2858
|
+
*/
|
|
2859
|
+
config: Required<SimpleSceneConfig>;
|
|
2860
|
+
constructor(components: Components);
|
|
2861
|
+
/** {@link Configurable.setup} */
|
|
2862
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
2753
2863
|
}
|
|
2754
2864
|
import * as THREE from "three";
|
|
2755
|
-
import {
|
|
2865
|
+
import { BaseRenderer, Event } from "../../Types";
|
|
2756
2866
|
import { Components } from "../../Components";
|
|
2757
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2758
2867
|
/**
|
|
2759
|
-
* A renderer
|
|
2868
|
+
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
2760
2869
|
*/
|
|
2761
|
-
export declare class
|
|
2870
|
+
export declare class SimpleRenderer extends BaseRenderer {
|
|
2762
2871
|
/**
|
|
2763
|
-
*
|
|
2764
|
-
*
|
|
2872
|
+
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
2873
|
+
* Default is 'true'.
|
|
2765
2874
|
*/
|
|
2766
|
-
|
|
2767
|
-
seen: Set<THREE.Mesh>;
|
|
2768
|
-
unseen: Set<THREE.Mesh>;
|
|
2769
|
-
}>;
|
|
2875
|
+
enabled: boolean;
|
|
2770
2876
|
/**
|
|
2771
|
-
*
|
|
2772
|
-
* Default value is 100.
|
|
2877
|
+
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
2773
2878
|
*/
|
|
2774
|
-
|
|
2879
|
+
container: HTMLElement;
|
|
2775
2880
|
/**
|
|
2776
|
-
*
|
|
2777
|
-
* Used to keep track of color-coded meshes.
|
|
2881
|
+
* The THREE.js WebGLRenderer instance.
|
|
2778
2882
|
*/
|
|
2779
|
-
|
|
2883
|
+
three: THREE.WebGLRenderer;
|
|
2884
|
+
protected _canvas: HTMLCanvasElement;
|
|
2885
|
+
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
2886
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
2887
|
+
protected onContainerUpdated: Event<unknown>;
|
|
2888
|
+
private _resizing;
|
|
2780
2889
|
/**
|
|
2781
|
-
*
|
|
2782
|
-
*
|
|
2890
|
+
* Constructor for the SimpleRenderer class.
|
|
2891
|
+
*
|
|
2892
|
+
* @param components - The components instance.
|
|
2893
|
+
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
2894
|
+
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
2783
2895
|
*/
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
private _currentVisibleMeshes;
|
|
2788
|
-
private _recentlyHiddenMeshes;
|
|
2789
|
-
private _intervalID;
|
|
2790
|
-
private readonly _transparentMat;
|
|
2791
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2896
|
+
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
2897
|
+
/** {@link Updateable.update} */
|
|
2898
|
+
update(): void;
|
|
2792
2899
|
/** {@link Disposable.dispose} */
|
|
2793
2900
|
dispose(): void;
|
|
2901
|
+
/** {@link Resizeable.getSize}. */
|
|
2902
|
+
getSize(): THREE.Vector2;
|
|
2903
|
+
/** {@link Resizeable.resize} */
|
|
2904
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2794
2905
|
/**
|
|
2795
|
-
*
|
|
2796
|
-
*
|
|
2797
|
-
* @
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
/**
|
|
2801
|
-
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2802
|
-
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2803
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2804
|
-
* @returns {void}
|
|
2906
|
+
* Sets up and manages the event listeners for the renderer.
|
|
2907
|
+
*
|
|
2908
|
+
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
2909
|
+
*
|
|
2910
|
+
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
2805
2911
|
*/
|
|
2806
|
-
|
|
2807
|
-
private
|
|
2808
|
-
private
|
|
2912
|
+
setupEvents(active: boolean): void;
|
|
2913
|
+
private resizeEvent;
|
|
2914
|
+
private setupRenderer;
|
|
2915
|
+
private onContextLost;
|
|
2916
|
+
private onContextBack;
|
|
2809
2917
|
}
|
|
2810
|
-
|
|
2918
|
+
import * as THREE from "three";
|
|
2919
|
+
import CameraControls from "camera-controls";
|
|
2920
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
2921
|
+
import { Components } from "../../Components";
|
|
2811
2922
|
/**
|
|
2812
|
-
*
|
|
2923
|
+
* A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
|
|
2813
2924
|
*/
|
|
2814
|
-
export declare class
|
|
2925
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
2926
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2927
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
2928
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2929
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2815
2930
|
/**
|
|
2816
|
-
*
|
|
2817
|
-
*
|
|
2931
|
+
* Event that is triggered when the aspect of the camera has been updated.
|
|
2932
|
+
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2818
2933
|
*/
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
(data: T): void;
|
|
2823
|
-
}): void;
|
|
2934
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
2935
|
+
/** {@link Disposable.onDisposed} */
|
|
2936
|
+
readonly onDisposed: Event<string>;
|
|
2824
2937
|
/**
|
|
2825
|
-
*
|
|
2826
|
-
*
|
|
2938
|
+
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
2939
|
+
* This camera is used for rendering the scene.
|
|
2827
2940
|
*/
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
} : {
|
|
2831
|
-
(data: T): void;
|
|
2832
|
-
}): void;
|
|
2833
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2834
|
-
trigger: (data?: T) => void;
|
|
2835
|
-
/** Gets rid of all the suscribed events. */
|
|
2836
|
-
reset(): void;
|
|
2837
|
-
private handlers;
|
|
2838
|
-
}
|
|
2839
|
-
import { Base } from "./base";
|
|
2840
|
-
/**
|
|
2841
|
-
* 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.
|
|
2842
|
-
*/
|
|
2843
|
-
export declare abstract class Component extends Base {
|
|
2941
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
2942
|
+
private _allControls;
|
|
2844
2943
|
/**
|
|
2845
|
-
*
|
|
2846
|
-
*
|
|
2847
|
-
*
|
|
2848
|
-
*
|
|
2944
|
+
* The object that controls the camera. An instance of
|
|
2945
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
2946
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
2947
|
+
* object to move, rotate, look at objects, etc.
|
|
2849
2948
|
*/
|
|
2850
|
-
|
|
2851
|
-
}
|
|
2852
|
-
/**
|
|
2853
|
-
* 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.
|
|
2854
|
-
*/
|
|
2855
|
-
export declare class AsyncEvent<T> {
|
|
2949
|
+
get controls(): CameraControls;
|
|
2856
2950
|
/**
|
|
2857
|
-
*
|
|
2858
|
-
*
|
|
2951
|
+
* Getter for the enabled state of the camera controls.
|
|
2952
|
+
* If the current world is null, it returns false.
|
|
2953
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
2954
|
+
*
|
|
2955
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
2859
2956
|
*/
|
|
2860
|
-
|
|
2861
|
-
(): Promise<void>;
|
|
2862
|
-
} : {
|
|
2863
|
-
(data: T): Promise<void>;
|
|
2864
|
-
}): void;
|
|
2957
|
+
get enabled(): boolean;
|
|
2865
2958
|
/**
|
|
2866
|
-
*
|
|
2867
|
-
*
|
|
2959
|
+
* Setter for the enabled state of the camera controls.
|
|
2960
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
2961
|
+
*
|
|
2962
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2868
2963
|
*/
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
}
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
trigger: (data?: T) => Promise<void>;
|
|
2876
|
-
/** Gets rid of all the suscribed events. */
|
|
2877
|
-
reset(): void;
|
|
2878
|
-
private handlers;
|
|
2879
|
-
}
|
|
2880
|
-
import * as THREE from "three";
|
|
2881
|
-
import CameraControls from "camera-controls";
|
|
2882
|
-
import { Event } from "./event";
|
|
2883
|
-
/**
|
|
2884
|
-
* Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
|
|
2885
|
-
*/
|
|
2886
|
-
export interface Disposable {
|
|
2964
|
+
set enabled(enabled: boolean);
|
|
2965
|
+
constructor(components: Components);
|
|
2966
|
+
/** {@link Disposable.dispose} */
|
|
2967
|
+
dispose(): void;
|
|
2968
|
+
/** {@link Updateable.update} */
|
|
2969
|
+
update(_delta: number): void;
|
|
2887
2970
|
/**
|
|
2888
|
-
*
|
|
2889
|
-
*
|
|
2971
|
+
* Updates the aspect of the camera to match the size of the
|
|
2972
|
+
* {@link Components.renderer}.
|
|
2890
2973
|
*/
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2974
|
+
updateAspect: () => void;
|
|
2975
|
+
private setupCamera;
|
|
2976
|
+
private newCameraControls;
|
|
2977
|
+
private setupEvents;
|
|
2978
|
+
private static getSubsetOfThree;
|
|
2894
2979
|
}
|
|
2980
|
+
import * as THREE from "three";
|
|
2981
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2982
|
+
import { Components } from "../../Components";
|
|
2895
2983
|
/**
|
|
2896
|
-
*
|
|
2984
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
2897
2985
|
*/
|
|
2898
|
-
export interface
|
|
2986
|
+
export interface GridConfig {
|
|
2899
2987
|
/**
|
|
2900
|
-
*
|
|
2901
|
-
* currently visible or not in the
|
|
2902
|
-
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2988
|
+
* The color of the grid lines.
|
|
2903
2989
|
*/
|
|
2904
|
-
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
|
|
2908
|
-
*/
|
|
2909
|
-
export interface Resizeable {
|
|
2990
|
+
color: THREE.Color;
|
|
2910
2991
|
/**
|
|
2911
|
-
*
|
|
2912
|
-
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2913
|
-
* component.
|
|
2992
|
+
* The size of the primary grid lines.
|
|
2914
2993
|
*/
|
|
2915
|
-
|
|
2916
|
-
/** Event that fires when the component has been resized. */
|
|
2917
|
-
onResize: Event<THREE.Vector2>;
|
|
2994
|
+
size1: number;
|
|
2918
2995
|
/**
|
|
2919
|
-
*
|
|
2920
|
-
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2921
|
-
* component.
|
|
2996
|
+
* The size of the secondary grid lines.
|
|
2922
2997
|
*/
|
|
2923
|
-
|
|
2924
|
-
}
|
|
2925
|
-
/** Whether this component should be updated each frame. */
|
|
2926
|
-
export interface Updateable {
|
|
2927
|
-
/** Actions that should be executed after updating the component. */
|
|
2928
|
-
onAfterUpdate: Event<any>;
|
|
2929
|
-
/** Actions that should be executed before updating the component. */
|
|
2930
|
-
onBeforeUpdate: Event<any>;
|
|
2998
|
+
size2: number;
|
|
2931
2999
|
/**
|
|
2932
|
-
*
|
|
2933
|
-
* instance, a renderer component will make a render each frame.
|
|
3000
|
+
* The distance at which the grid lines start to fade away.
|
|
2934
3001
|
*/
|
|
2935
|
-
|
|
2936
|
-
}
|
|
2937
|
-
/** Basic type to describe the progress of any kind of process. */
|
|
2938
|
-
export interface Progress {
|
|
2939
|
-
/** The amount of things that have been done already. */
|
|
2940
|
-
current: number;
|
|
2941
|
-
/** The total amount of things to be done by the process. */
|
|
2942
|
-
total: number;
|
|
3002
|
+
distance: number;
|
|
2943
3003
|
}
|
|
2944
3004
|
/**
|
|
2945
|
-
*
|
|
3005
|
+
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2946
3006
|
*/
|
|
2947
|
-
export
|
|
2948
|
-
/**
|
|
2949
|
-
|
|
3007
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
3008
|
+
/** {@link Disposable.onDisposed} */
|
|
3009
|
+
readonly onDisposed: Event<unknown>;
|
|
3010
|
+
/** The world instance to which this Raycaster belongs. */
|
|
3011
|
+
world: World;
|
|
3012
|
+
/** The components instance to which this grid belongs. */
|
|
3013
|
+
components: Components;
|
|
3014
|
+
/** {@link Hideable.visible} */
|
|
3015
|
+
get visible(): boolean;
|
|
3016
|
+
/** {@link Hideable.visible} */
|
|
3017
|
+
set visible(visible: boolean);
|
|
3018
|
+
/** The material of the grid. */
|
|
3019
|
+
get material(): THREE.ShaderMaterial;
|
|
2950
3020
|
/**
|
|
2951
|
-
*
|
|
2952
|
-
*
|
|
3021
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3022
|
+
* perspective cameras and false for orthographic cameras.
|
|
2953
3023
|
*/
|
|
2954
|
-
|
|
3024
|
+
get fade(): boolean;
|
|
2955
3025
|
/**
|
|
2956
|
-
*
|
|
2957
|
-
*
|
|
3026
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
3027
|
+
* perspective cameras and false for orthographic cameras.
|
|
2958
3028
|
*/
|
|
2959
|
-
|
|
2960
|
-
/**
|
|
2961
|
-
|
|
3029
|
+
set fade(active: boolean);
|
|
3030
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
3031
|
+
readonly three: THREE.Mesh;
|
|
3032
|
+
private _fade;
|
|
3033
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
3034
|
+
/** {@link Disposable.dispose} */
|
|
3035
|
+
dispose(): void;
|
|
3036
|
+
private setupEvents;
|
|
3037
|
+
private updateZoom;
|
|
2962
3038
|
}
|
|
3039
|
+
import { NavigationMode } from "./types";
|
|
3040
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
2963
3041
|
/**
|
|
2964
|
-
*
|
|
3042
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
2965
3043
|
*/
|
|
2966
|
-
export
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
/**
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
3044
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3045
|
+
private camera;
|
|
3046
|
+
/** {@link NavigationMode.enabled} */
|
|
3047
|
+
enabled: boolean;
|
|
3048
|
+
/** {@link NavigationMode.id} */
|
|
3049
|
+
readonly id = "FirstPerson";
|
|
3050
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3051
|
+
/** {@link NavigationMode.set} */
|
|
3052
|
+
set(active: boolean): void;
|
|
3053
|
+
private setupFirstPersonCamera;
|
|
3054
|
+
}
|
|
3055
|
+
import { NavigationMode } from "./types";
|
|
3056
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3057
|
+
/**
|
|
3058
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3059
|
+
*/
|
|
3060
|
+
export declare class PlanMode implements NavigationMode {
|
|
3061
|
+
private camera;
|
|
3062
|
+
/** {@link NavigationMode.enabled} */
|
|
3063
|
+
enabled: boolean;
|
|
3064
|
+
/** {@link NavigationMode.id} */
|
|
3065
|
+
readonly id = "Plan";
|
|
3066
|
+
private mouseAction1?;
|
|
3067
|
+
private mouseAction2?;
|
|
3068
|
+
private mouseInitialized;
|
|
3069
|
+
private readonly defaultAzimuthSpeed;
|
|
3070
|
+
private readonly defaultPolarSpeed;
|
|
3071
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3072
|
+
/** {@link NavigationMode.set} */
|
|
3073
|
+
set(active: boolean): void;
|
|
2977
3074
|
}
|
|
3075
|
+
import { NavigationMode } from "./types";
|
|
3076
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
2978
3077
|
/**
|
|
2979
|
-
*
|
|
3078
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
2980
3079
|
*/
|
|
2981
|
-
export
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3080
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3081
|
+
camera: OrthoPerspectiveCamera;
|
|
3082
|
+
/** {@link NavigationMode.enabled} */
|
|
3083
|
+
enabled: boolean;
|
|
3084
|
+
/** {@link NavigationMode.id} */
|
|
3085
|
+
readonly id = "Orbit";
|
|
3086
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3087
|
+
/** {@link NavigationMode.set} */
|
|
3088
|
+
set(active: boolean): void;
|
|
3089
|
+
private activateOrbitControls;
|
|
2987
3090
|
}
|
|
2988
3091
|
import * as THREE from "three";
|
|
2989
|
-
import
|
|
2990
|
-
import {
|
|
2991
|
-
import {
|
|
3092
|
+
import { CameraProjection } from "./types";
|
|
3093
|
+
import { Event } from "../../Types";
|
|
3094
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
2992
3095
|
/**
|
|
2993
|
-
*
|
|
3096
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
2994
3097
|
*/
|
|
2995
|
-
export declare
|
|
3098
|
+
export declare class ProjectionManager {
|
|
2996
3099
|
/**
|
|
2997
|
-
*
|
|
3100
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
2998
3101
|
*/
|
|
2999
|
-
|
|
3102
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3000
3103
|
/**
|
|
3001
|
-
*
|
|
3104
|
+
* Current projection mode of the camera.
|
|
3105
|
+
* Default is "Perspective".
|
|
3002
3106
|
*/
|
|
3003
|
-
|
|
3107
|
+
current: CameraProjection;
|
|
3004
3108
|
/**
|
|
3005
|
-
*
|
|
3006
|
-
*
|
|
3109
|
+
* The camera controlled by this ProjectionManager.
|
|
3110
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3007
3111
|
*/
|
|
3008
|
-
|
|
3112
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3113
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3114
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3115
|
+
private _component;
|
|
3116
|
+
private _previousDistance;
|
|
3117
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3009
3118
|
/**
|
|
3010
|
-
*
|
|
3119
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3011
3120
|
*
|
|
3012
|
-
* @
|
|
3121
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3122
|
+
* it will have no effect.
|
|
3013
3123
|
*/
|
|
3014
|
-
|
|
3124
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3125
|
+
/**
|
|
3126
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3127
|
+
* and vice versa.
|
|
3128
|
+
*/
|
|
3129
|
+
toggle(): Promise<void>;
|
|
3130
|
+
private setOrthoCamera;
|
|
3131
|
+
private getPerspectiveDims;
|
|
3132
|
+
private setupOrthoCamera;
|
|
3133
|
+
private getDistance;
|
|
3134
|
+
private setPerspectiveCamera;
|
|
3015
3135
|
}
|
|
3016
|
-
import * as THREE from "three";
|
|
3017
|
-
import { Vector2 } from "three";
|
|
3018
|
-
import { Event } from "./event";
|
|
3019
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
3020
|
-
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
3021
3136
|
/**
|
|
3022
|
-
*
|
|
3137
|
+
* The projection system of the camera.
|
|
3023
3138
|
*/
|
|
3024
|
-
export
|
|
3139
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3140
|
+
/**
|
|
3141
|
+
* The extensible list of supported navigation modes.
|
|
3142
|
+
*/
|
|
3143
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3144
|
+
/**
|
|
3145
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3146
|
+
*/
|
|
3147
|
+
export interface NavigationMode {
|
|
3148
|
+
/** The unique ID of this navigation mode. */
|
|
3149
|
+
id: NavModeID;
|
|
3025
3150
|
/**
|
|
3026
|
-
*
|
|
3151
|
+
* Enable or disable this navigation mode.
|
|
3152
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3153
|
+
* must be disabled.
|
|
3027
3154
|
*
|
|
3028
|
-
* @
|
|
3029
|
-
* @
|
|
3030
|
-
*/
|
|
3031
|
-
|
|
3032
|
-
/**
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3155
|
+
* @param active - whether to enable or disable this mode.
|
|
3156
|
+
* @param options - any additional data required to enable or disable it.
|
|
3157
|
+
* */
|
|
3158
|
+
set: (active: boolean, options?: any) => void;
|
|
3159
|
+
/** Whether this navigation mode is active or not. */
|
|
3160
|
+
enabled: boolean;
|
|
3161
|
+
}
|
|
3162
|
+
import * as THREE from "three";
|
|
3163
|
+
import { Components } from "../../Components";
|
|
3164
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
3165
|
+
/**
|
|
3166
|
+
* Settings to configure the CullerRenderer.
|
|
3167
|
+
*/
|
|
3168
|
+
export interface CullerRendererSettings {
|
|
3040
3169
|
/**
|
|
3041
|
-
*
|
|
3042
|
-
*
|
|
3170
|
+
* Interval in milliseconds at which the visibility check should be performed.
|
|
3171
|
+
* Default value is 1000.
|
|
3043
3172
|
*/
|
|
3044
|
-
|
|
3045
|
-
/** {@link Updateable.update} */
|
|
3046
|
-
abstract update(delta?: number): void | Promise<void>;
|
|
3047
|
-
/** {@link Disposable.dispose} */
|
|
3048
|
-
abstract dispose(): void;
|
|
3049
|
-
/** {@link Resizeable.getSize} */
|
|
3050
|
-
abstract getSize(): Vector2;
|
|
3051
|
-
/** {@link Resizeable.resize} */
|
|
3052
|
-
abstract resize(size: Vector2 | undefined): void;
|
|
3173
|
+
updateInterval?: number;
|
|
3053
3174
|
/**
|
|
3054
|
-
*
|
|
3175
|
+
* Width of the render target used for visibility checks.
|
|
3176
|
+
* Default value is 512.
|
|
3055
3177
|
*/
|
|
3056
|
-
|
|
3178
|
+
width?: number;
|
|
3057
3179
|
/**
|
|
3058
|
-
*
|
|
3059
|
-
*
|
|
3060
|
-
* @remarks
|
|
3061
|
-
* This method is typically called when there is a change to the list of clipping planes
|
|
3062
|
-
* used by the active renderer.
|
|
3180
|
+
* Height of the render target used for visibility checks.
|
|
3181
|
+
* Default value is 512.
|
|
3063
3182
|
*/
|
|
3064
|
-
|
|
3183
|
+
height?: number;
|
|
3065
3184
|
/**
|
|
3066
|
-
*
|
|
3067
|
-
*
|
|
3068
|
-
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
3069
|
-
* @param plane - The clipping plane to be added or removed.
|
|
3070
|
-
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
3071
|
-
*
|
|
3072
|
-
* @remarks
|
|
3073
|
-
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
3074
|
-
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
3075
|
-
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
3076
|
-
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
3077
|
-
* excluding any planes marked as local.
|
|
3185
|
+
* Whether the visibility check should be performed automatically.
|
|
3186
|
+
* Default value is true.
|
|
3078
3187
|
*/
|
|
3079
|
-
|
|
3188
|
+
autoUpdate?: boolean;
|
|
3080
3189
|
}
|
|
3081
|
-
import * as THREE from "three";
|
|
3082
|
-
import { Disposable } from "./interfaces";
|
|
3083
|
-
import { Event } from "./event";
|
|
3084
|
-
import { Components } from "../../Components";
|
|
3085
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
3086
3190
|
/**
|
|
3087
|
-
*
|
|
3191
|
+
* A base renderer to determine visibility on screen.
|
|
3088
3192
|
*/
|
|
3089
|
-
export declare
|
|
3193
|
+
export declare class CullerRenderer {
|
|
3090
3194
|
/** {@link Disposable.onDisposed} */
|
|
3091
|
-
readonly onDisposed: Event<
|
|
3195
|
+
readonly onDisposed: Event<string>;
|
|
3092
3196
|
/**
|
|
3093
|
-
*
|
|
3094
|
-
*
|
|
3197
|
+
* Fires after making the visibility check to the meshes. It lists the
|
|
3198
|
+
* meshes that are currently visible, and the ones that were visible
|
|
3199
|
+
* just before but not anymore.
|
|
3095
3200
|
*/
|
|
3096
|
-
|
|
3097
|
-
protected constructor(components: Components);
|
|
3098
|
-
/** {@link Disposable.dispose} */
|
|
3099
|
-
dispose(): void;
|
|
3100
|
-
}
|
|
3101
|
-
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
3102
|
-
import { Components } from "../../Components";
|
|
3103
|
-
/**
|
|
3104
|
-
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
3105
|
-
*/
|
|
3106
|
-
export declare abstract class Base {
|
|
3107
|
-
components: Components;
|
|
3108
|
-
constructor(components: Components);
|
|
3109
|
-
/** Whether is component is {@link Disposable}. */
|
|
3110
|
-
isDisposeable: () => this is Disposable;
|
|
3111
|
-
/** Whether is component is {@link Resizeable}. */
|
|
3112
|
-
isResizeable: () => this is Resizeable;
|
|
3113
|
-
/** Whether is component is {@link Updateable}. */
|
|
3114
|
-
isUpdateable: () => this is Updateable;
|
|
3115
|
-
/** Whether is component is {@link Hideable}. */
|
|
3116
|
-
isHideable: () => this is Hideable;
|
|
3117
|
-
/** Whether is component is {@link Configurable}. */
|
|
3118
|
-
isConfigurable: () => this is Configurable<any>;
|
|
3119
|
-
}
|
|
3120
|
-
import { Base } from "./base";
|
|
3121
|
-
import { World } from "./world";
|
|
3122
|
-
import { Event } from "./event";
|
|
3123
|
-
import { Components } from "../../Components";
|
|
3124
|
-
/**
|
|
3125
|
-
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
3126
|
-
*/
|
|
3127
|
-
export declare abstract class BaseWorldItem extends Base {
|
|
3128
|
-
readonly worlds: Map<string, World>;
|
|
3201
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
3129
3202
|
/**
|
|
3130
|
-
*
|
|
3131
|
-
* The event payload contains the world instance and the action ("added" or "removed").
|
|
3203
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
3132
3204
|
*/
|
|
3133
|
-
|
|
3134
|
-
world: World;
|
|
3135
|
-
action: "added" | "removed";
|
|
3136
|
-
}>;
|
|
3205
|
+
enabled: boolean;
|
|
3137
3206
|
/**
|
|
3138
|
-
*
|
|
3207
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
3208
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
3139
3209
|
*/
|
|
3140
|
-
|
|
3141
|
-
|
|
3210
|
+
needsUpdate: boolean;
|
|
3211
|
+
/**
|
|
3212
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
3213
|
+
* for debugging purposes.
|
|
3214
|
+
*/
|
|
3215
|
+
renderDebugFrame: boolean;
|
|
3216
|
+
/** The components instance to which this renderer belongs. */
|
|
3217
|
+
components: Components;
|
|
3218
|
+
/** The world instance to which this renderer belongs. */
|
|
3219
|
+
readonly world: World;
|
|
3220
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
3221
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
3222
|
+
protected autoUpdate: boolean;
|
|
3223
|
+
protected updateInterval: number;
|
|
3224
|
+
protected readonly worker: Worker;
|
|
3225
|
+
protected readonly scene: THREE.Scene;
|
|
3226
|
+
private _width;
|
|
3227
|
+
private _height;
|
|
3228
|
+
private _availableColor;
|
|
3229
|
+
private readonly renderTarget;
|
|
3230
|
+
private readonly bufferSize;
|
|
3231
|
+
private readonly _buffer;
|
|
3232
|
+
protected _isWorkerBusy: boolean;
|
|
3233
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3234
|
+
/** {@link Disposable.dispose} */
|
|
3235
|
+
dispose(): void;
|
|
3236
|
+
/**
|
|
3237
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
3238
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
3239
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
3240
|
+
* not true.
|
|
3241
|
+
*/
|
|
3242
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
3243
|
+
protected getAvailableColor(): {
|
|
3244
|
+
r: number;
|
|
3245
|
+
g: number;
|
|
3246
|
+
b: number;
|
|
3247
|
+
code: string;
|
|
3248
|
+
};
|
|
3249
|
+
protected increaseColor(): void;
|
|
3250
|
+
protected decreaseColor(): void;
|
|
3251
|
+
private applySettings;
|
|
3142
3252
|
}
|
|
3253
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
3143
3254
|
import * as THREE from "three";
|
|
3144
|
-
import {
|
|
3145
|
-
import {
|
|
3146
|
-
import {
|
|
3147
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
3255
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
3256
|
+
import { Components } from "../../Components";
|
|
3257
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3148
3258
|
/**
|
|
3149
|
-
*
|
|
3259
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
3150
3260
|
*/
|
|
3151
|
-
export
|
|
3261
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
3152
3262
|
/**
|
|
3153
|
-
*
|
|
3263
|
+
* Event triggered when the visibility of meshes is updated.
|
|
3264
|
+
* Contains two sets: seen and unseen.
|
|
3154
3265
|
*/
|
|
3155
|
-
|
|
3266
|
+
readonly onViewUpdated: Event<{
|
|
3267
|
+
seen: Set<THREE.Mesh>;
|
|
3268
|
+
unseen: Set<THREE.Mesh>;
|
|
3269
|
+
}>;
|
|
3156
3270
|
/**
|
|
3157
|
-
*
|
|
3271
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
3272
|
+
* Default value is 100.
|
|
3158
3273
|
*/
|
|
3159
|
-
|
|
3274
|
+
threshold: number;
|
|
3160
3275
|
/**
|
|
3161
|
-
*
|
|
3276
|
+
* Map of color code to THREE.InstancedMesh.
|
|
3277
|
+
* Used to keep track of color-coded meshes.
|
|
3162
3278
|
*/
|
|
3163
|
-
|
|
3279
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
3164
3280
|
/**
|
|
3165
|
-
*
|
|
3281
|
+
* Flag to indicate if the renderer is currently processing.
|
|
3282
|
+
* Used to prevent concurrent processing.
|
|
3166
3283
|
*/
|
|
3167
|
-
|
|
3284
|
+
isProcessing: boolean;
|
|
3285
|
+
private _colorCodeMeshMap;
|
|
3286
|
+
private _meshIDColorCodeMap;
|
|
3287
|
+
private _currentVisibleMeshes;
|
|
3288
|
+
private _recentlyHiddenMeshes;
|
|
3289
|
+
private _intervalID;
|
|
3290
|
+
private readonly _transparentMat;
|
|
3291
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3292
|
+
/** {@link Disposable.dispose} */
|
|
3293
|
+
dispose(): void;
|
|
3168
3294
|
/**
|
|
3169
|
-
*
|
|
3295
|
+
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
3296
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3297
|
+
* @returns {void}
|
|
3170
3298
|
*/
|
|
3171
|
-
|
|
3299
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3172
3300
|
/**
|
|
3173
|
-
*
|
|
3301
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
3302
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
3303
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3304
|
+
* @returns {void}
|
|
3174
3305
|
*/
|
|
3175
|
-
|
|
3306
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3307
|
+
private handleWorkerMessage;
|
|
3308
|
+
private getAvailableMaterial;
|
|
3176
3309
|
}
|
|
3177
3310
|
import * as THREE from "three";
|
|
3178
3311
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
@@ -3273,11 +3406,6 @@ export declare class SimplePlane implements Disposable, Hideable {
|
|
|
3273
3406
|
private newHelper;
|
|
3274
3407
|
private static newPlaneMesh;
|
|
3275
3408
|
}
|
|
3276
|
-
import * as WEBIFC from "web-ifc";
|
|
3277
|
-
export declare class IfcMetadataReader {
|
|
3278
|
-
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3279
|
-
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3280
|
-
}
|
|
3281
3409
|
import * as THREE from "three";
|
|
3282
3410
|
import * as WEBIFC from "web-ifc";
|
|
3283
3411
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -3293,128 +3421,36 @@ export declare class CivilReader {
|
|
|
3293
3421
|
} | undefined;
|
|
3294
3422
|
private getCurves;
|
|
3295
3423
|
}
|
|
3296
|
-
import
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
*/
|
|
3301
|
-
export declare class FirstPersonMode implements NavigationMode {
|
|
3302
|
-
private camera;
|
|
3303
|
-
/** {@link NavigationMode.enabled} */
|
|
3304
|
-
enabled: boolean;
|
|
3305
|
-
/** {@link NavigationMode.id} */
|
|
3306
|
-
readonly id = "FirstPerson";
|
|
3307
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3308
|
-
/** {@link NavigationMode.set} */
|
|
3309
|
-
set(active: boolean): void;
|
|
3310
|
-
private setupFirstPersonCamera;
|
|
3311
|
-
}
|
|
3312
|
-
import { NavigationMode } from "./types";
|
|
3313
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3314
|
-
/**
|
|
3315
|
-
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3316
|
-
*/
|
|
3317
|
-
export declare class OrbitMode implements NavigationMode {
|
|
3318
|
-
camera: OrthoPerspectiveCamera;
|
|
3319
|
-
/** {@link NavigationMode.enabled} */
|
|
3320
|
-
enabled: boolean;
|
|
3321
|
-
/** {@link NavigationMode.id} */
|
|
3322
|
-
readonly id = "Orbit";
|
|
3323
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3324
|
-
/** {@link NavigationMode.set} */
|
|
3325
|
-
set(active: boolean): void;
|
|
3326
|
-
private activateOrbitControls;
|
|
3424
|
+
import * as WEBIFC from "web-ifc";
|
|
3425
|
+
export declare class IfcMetadataReader {
|
|
3426
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3427
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3327
3428
|
}
|
|
3328
|
-
import
|
|
3329
|
-
import { CameraProjection } from "./types";
|
|
3330
|
-
import { Event } from "../../Types";
|
|
3331
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3429
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3332
3430
|
/**
|
|
3333
|
-
*
|
|
3431
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3334
3432
|
*/
|
|
3335
|
-
export declare class
|
|
3336
|
-
/**
|
|
3337
|
-
* Event that fires when the {@link CameraProjection} changes.
|
|
3338
|
-
*/
|
|
3339
|
-
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3340
|
-
/**
|
|
3341
|
-
* Current projection mode of the camera.
|
|
3342
|
-
* Default is "Perspective".
|
|
3343
|
-
*/
|
|
3344
|
-
current: CameraProjection;
|
|
3345
|
-
/**
|
|
3346
|
-
* The camera controlled by this ProjectionManager.
|
|
3347
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3348
|
-
*/
|
|
3349
|
-
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3350
|
-
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3351
|
-
matchOrthoDistanceEnabled: boolean;
|
|
3352
|
-
private _component;
|
|
3353
|
-
private _previousDistance;
|
|
3354
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3433
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3355
3434
|
/**
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3358
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
3359
|
-
* it will have no effect.
|
|
3435
|
+
* Minimum number of geometries to be streamed.
|
|
3436
|
+
* Defaults to 10 geometries.
|
|
3360
3437
|
*/
|
|
3361
|
-
|
|
3438
|
+
minGeometrySize: number;
|
|
3362
3439
|
/**
|
|
3363
|
-
*
|
|
3364
|
-
*
|
|
3440
|
+
* Minimum amount of assets to be streamed.
|
|
3441
|
+
* Defaults to 1000 assets.
|
|
3365
3442
|
*/
|
|
3366
|
-
|
|
3367
|
-
private setOrthoCamera;
|
|
3368
|
-
private getPerspectiveDims;
|
|
3369
|
-
private setupOrthoCamera;
|
|
3370
|
-
private getDistance;
|
|
3371
|
-
private setPerspectiveCamera;
|
|
3372
|
-
}
|
|
3373
|
-
import { NavigationMode } from "./types";
|
|
3374
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3375
|
-
/**
|
|
3376
|
-
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3377
|
-
*/
|
|
3378
|
-
export declare class PlanMode implements NavigationMode {
|
|
3379
|
-
private camera;
|
|
3380
|
-
/** {@link NavigationMode.enabled} */
|
|
3381
|
-
enabled: boolean;
|
|
3382
|
-
/** {@link NavigationMode.id} */
|
|
3383
|
-
readonly id = "Plan";
|
|
3384
|
-
private mouseAction1?;
|
|
3385
|
-
private mouseAction2?;
|
|
3386
|
-
private mouseInitialized;
|
|
3387
|
-
private readonly defaultAzimuthSpeed;
|
|
3388
|
-
private readonly defaultPolarSpeed;
|
|
3389
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3390
|
-
/** {@link NavigationMode.set} */
|
|
3391
|
-
set(active: boolean): void;
|
|
3443
|
+
minAssetsSize: number;
|
|
3392
3444
|
}
|
|
3393
|
-
|
|
3394
|
-
*
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3403
|
-
*/
|
|
3404
|
-
export interface NavigationMode {
|
|
3405
|
-
/** The unique ID of this navigation mode. */
|
|
3406
|
-
id: NavModeID;
|
|
3407
|
-
/**
|
|
3408
|
-
* Enable or disable this navigation mode.
|
|
3409
|
-
* When a new navigation mode is enabled, the previous navigation mode
|
|
3410
|
-
* must be disabled.
|
|
3411
|
-
*
|
|
3412
|
-
* @param active - whether to enable or disable this mode.
|
|
3413
|
-
* @param options - any additional data required to enable or disable it.
|
|
3414
|
-
* */
|
|
3415
|
-
set: (active: boolean, options?: any) => void;
|
|
3416
|
-
/** Whether this navigation mode is active or not. */
|
|
3417
|
-
enabled: boolean;
|
|
3445
|
+
import * as WEBIFC from "web-ifc";
|
|
3446
|
+
import * as THREE from "three";
|
|
3447
|
+
export declare class Units {
|
|
3448
|
+
factor: number;
|
|
3449
|
+
complement: number;
|
|
3450
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3451
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3452
|
+
private getLengthUnits;
|
|
3453
|
+
private getScaleMatrix;
|
|
3418
3454
|
}
|
|
3419
3455
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
3420
3456
|
export interface ModelsRelationMap {
|
|
@@ -3440,37 +3476,6 @@ export type InverseAttributes = [
|
|
|
3440
3476
|
"ContainsElements"
|
|
3441
3477
|
];
|
|
3442
3478
|
export type InverseAttribute = InverseAttributes[number];
|
|
3443
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3444
|
-
/**
|
|
3445
|
-
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3446
|
-
*/
|
|
3447
|
-
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3448
|
-
/**
|
|
3449
|
-
* Minimum number of geometries to be streamed.
|
|
3450
|
-
* Defaults to 10 geometries.
|
|
3451
|
-
*/
|
|
3452
|
-
minGeometrySize: number;
|
|
3453
|
-
/**
|
|
3454
|
-
* Minimum amount of assets to be streamed.
|
|
3455
|
-
* Defaults to 1000 assets.
|
|
3456
|
-
*/
|
|
3457
|
-
minAssetsSize: number;
|
|
3458
|
-
}
|
|
3459
|
-
import { BufferGeometry } from "three";
|
|
3460
|
-
import * as THREE from "three";
|
|
3461
|
-
export declare class TransformHelper {
|
|
3462
|
-
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3463
|
-
}
|
|
3464
|
-
import * as WEBIFC from "web-ifc";
|
|
3465
|
-
import * as THREE from "three";
|
|
3466
|
-
export declare class Units {
|
|
3467
|
-
factor: number;
|
|
3468
|
-
complement: number;
|
|
3469
|
-
apply(matrix: THREE.Matrix4): void;
|
|
3470
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3471
|
-
private getLengthUnits;
|
|
3472
|
-
private getScaleMatrix;
|
|
3473
|
-
}
|
|
3474
3479
|
/**
|
|
3475
3480
|
* A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
|
|
3476
3481
|
*/
|
|
@@ -3500,16 +3505,10 @@ export interface StreamedAsset {
|
|
|
3500
3505
|
color: number[];
|
|
3501
3506
|
}[];
|
|
3502
3507
|
}
|
|
3503
|
-
import {
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3508
|
-
/**
|
|
3509
|
-
* Amount of properties to be streamed.
|
|
3510
|
-
* Defaults to 100 properties.
|
|
3511
|
-
*/
|
|
3512
|
-
propertiesSize: number;
|
|
3508
|
+
import { BufferGeometry } from "three";
|
|
3509
|
+
import * as THREE from "three";
|
|
3510
|
+
export declare class TransformHelper {
|
|
3511
|
+
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3513
3512
|
}
|
|
3514
3513
|
|
|
3515
3514
|
}
|