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