@thatopen/components 2.0.0-alpha.10 → 2.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/namespace.d.ts +1609 -1609
  2. package/package.json +1 -1
@@ -1,980 +1,950 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
3
- /**
4
- * The entry point of the Components library.
5
- * It can:
6
- * - Create and access all the components of the library.
7
- * - Update all the updatable components automatically.
8
- * - Dispose all the components, preventing memory leaks.
9
- */
10
- export declare class Components implements Disposable {
11
- static readonly release = "1.4.21";
12
- /** {@link Disposable.onDisposed} */
13
- readonly onDisposed: Event<void>;
14
- /** The list of components created in this app. */
15
- readonly list: Map<string, Component>;
16
- /** If disabled, the animation loop will be stopped. */
17
- enabled: boolean;
18
- private _clock;
19
- add(uuid: string, instance: Component): void;
20
- /**
21
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
22
- * doesn't exist, it will instance it automatically.
23
- *
24
- * @param Component - The component to get or create.
25
- */
26
- get<U extends Component>(Component: new (components: Components) => U): U;
27
- constructor();
28
- /**
29
- * Initializes the library. It should be called at the start of the app after
30
- * initializing the scene, the renderer and the
31
- * camera. Additionally, if any component that need a raycaster is
32
- * used, the {@link raycaster} will need to be initialized.
33
- */
34
- init(): void;
35
- /**
36
- * Disposes the memory of all the components and tools of this instance of
37
- * the library. A memory leak will be created if:
38
- *
39
- * - An instance of the library ends up out of scope and this function isn't
40
- * called. This is especially relevant in Single Page Applications (React,
41
- * Angular, Vue, etc).
42
- *
43
- * - Any of the objects of this instance (meshes, geometries, etc) is
44
- * referenced by a reference type (object or array).
45
- *
46
- * You can learn more about how Three.js handles memory leaks
47
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
48
- *
49
- */
50
- dispose(): void;
51
- private update;
52
- private static setupBVH;
53
- }
54
- import { Component, Disposable, World, Event } from "../Types";
55
- import { GridConfig, SimpleGrid } from "./src";
56
- export declare class Grids extends Component implements Disposable {
57
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
58
- list: Map<string, SimpleGrid>;
59
- onDisposed: Event<unknown>;
60
- config: Required<GridConfig>;
61
- /** {@link Component.enabled} */
62
- enabled: boolean;
63
- create(world: World): void;
64
- delete(world: World): void;
65
- dispose(): void;
66
- }
67
- import * as THREE from "three";
68
- import { Components } from "../Components";
69
- import { Component } from "../Types";
70
- /**
71
- * A tool to safely remove meshes and geometries from memory to
72
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
73
- */
74
- export declare class Disposer extends Component {
75
- private _disposedComponents;
76
- /** {@link Component.enabled} */
2
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
3
+ import { Component, Disposable, Event, Components } from "../../core";
4
+ export declare class FragmentExploder extends Component implements Disposable {
5
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
77
6
  enabled: boolean;
78
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
79
- constructor(components: Components);
80
- /**
81
- * {@link Component.uuid}.
82
- * @return the list of UUIDs of deleted components.
83
- */
84
- get(): Set<string>;
85
- /**
86
- * Removes a mesh, its geometry and its materials from memory. If you are
87
- * using any of these in other parts of the application, make sure that you
88
- * remove them from the mesh before disposing it.
89
- *
90
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
91
- * to remove.
92
- *
93
- * @param materials - whether to dispose the materials of the mesh.
94
- *
95
- * @param recursive - whether to recursively dispose the children of the mesh.
96
- */
97
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
98
- /**
99
- * Disposes a geometry from memory.
100
- *
101
- * @param geometry - the
102
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
103
- * to remove.
104
- */
105
- disposeGeometry(geometry: THREE.BufferGeometry): void;
106
- private disposeGeometryAndMaterials;
107
- private disposeChildren;
108
- private static disposeMaterial;
109
- }
110
- import * as THREE from "three";
111
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
112
- import { SimplePlane } from "./src";
113
- import { Components } from "../Components";
114
- /**
115
- * A lightweight component to easily create and handle
116
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
117
- *
118
- * @param components - the instance of {@link Components} used.
119
- * @param planeType - the type of plane to be used by the clipper.
120
- * E.g. {@link SimplePlane}.
121
- */
122
- export declare class Clipper<T extends SimplePlane> extends Component implements Createable, Disposable, Hideable {
123
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
124
- /** {@link Createable.onAfterCreate} */
125
- readonly onAfterCreate: Event<T>;
126
- /** {@link Createable.onAfterDelete} */
127
- readonly onAfterDelete: Event<T>;
128
- /** Event that fires when the user starts dragging a clipping plane. */
129
- readonly onBeforeDrag: Event<void>;
130
- /** Event that fires when the user stops dragging a clipping plane. */
131
- readonly onAfterDrag: Event<void>;
132
- readonly onBeforeCreate: Event<unknown>;
133
- readonly onBeforeCancel: Event<unknown>;
134
- readonly onAfterCancel: Event<unknown>;
135
- readonly onBeforeDelete: Event<unknown>;
7
+ height: number;
8
+ groupName: string;
136
9
  /** {@link Disposable.onDisposed} */
137
10
  readonly onDisposed: Event<string>;
138
- /**
139
- * Whether to force the clipping plane to be orthogonal in the Y direction
140
- * (up). This is desirable when clipping a building horizontally and a
141
- * clipping plane is created in its roof, which might have a slight
142
- * slope for draining purposes.
143
- */
144
- orthogonalY: boolean;
145
- /**
146
- * The tolerance that determines whether an almost-horizontal clipping plane
147
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
148
- * has to be 'true' for this to apply.
149
- */
150
- toleranceOrthogonalY: number;
151
- list: T[];
152
- protected PlaneType: new (...args: any) => SimplePlane | T;
153
- /** The material used in all the clipping planes. */
154
- protected _material: THREE.MeshBasicMaterial;
155
- private _size;
156
- private _enabled;
157
- private _visible;
158
- /** {@link Component.enabled} */
159
- get enabled(): boolean;
160
- /** {@link Component.enabled} */
161
- set enabled(state: boolean);
162
- /** {@link Hideable.visible } */
163
- get visible(): boolean;
164
- /** {@link Hideable.visible } */
165
- set visible(state: boolean);
166
- /** The material of the clipping plane representation. */
167
- get material(): THREE.MeshBasicMaterial;
168
- /** The material of the clipping plane representation. */
169
- set material(material: THREE.MeshBasicMaterial);
170
- /** The size of the geometric representation of the clippings planes. */
171
- get size(): number;
172
- /** The size of the geometric representation of the clippings planes. */
173
- set size(size: number);
11
+ list: Set<string>;
174
12
  constructor(components: Components);
175
- endCreation(): void;
176
- cancelCreation(): void;
177
- /** {@link Disposable.dispose} */
178
13
  dispose(): void;
179
- /** {@link Createable.create} */
180
- create(world: World): void;
181
- /**
182
- * Creates a plane in a certain place and with a certain orientation,
183
- * without the need of the mouse.
184
- *
185
- * @param world - the world where this plane should be created.
186
- * @param normal - the orientation of the clipping plane.
187
- * @param point - the position of the clipping plane.
188
- * navigation.
189
- */
190
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): T;
191
- /**
192
- * {@link Createable.delete}
193
- *
194
- * @param world - the world where the plane to delete is.
195
- * @param plane - the plane to delete. If undefined, the first plane
196
- * found under the cursor will be deleted.
197
- */
198
- delete(world: World, plane?: T): void;
199
- /** Deletes all the existing clipping planes. */
200
- deleteAll(): void;
201
- private deletePlane;
202
- private pickPlane;
203
- private getAllPlaneMeshes;
204
- private createPlaneFromIntersection;
205
- private getWorldNormal;
206
- private normalizePlaneDirectionY;
207
- private newPlane;
208
- protected newPlaneInstance(world: World, point: THREE.Vector3, normal: THREE.Vector3): T;
209
- private updateMaterialsAndPlanes;
210
- private _onStartDragging;
211
- private _onEndDragging;
14
+ explode(): void;
15
+ reset(): void;
16
+ update(): void;
212
17
  }
213
18
  import * as THREE from "three";
214
- import { Component, Disposable, Event } from "../Types";
215
- import { Components } from "../Components";
19
+ import * as FRAGS from "@thatopen/fragments";
20
+ import { FragmentsGroup } from "@thatopen/fragments";
21
+ import { Component, Components, Disposable, Event } from "../../core";
216
22
  /**
217
- * A tool to easily handle the materials of massive amounts of
218
- * objects and scene background easily.
23
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
24
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
219
25
  */
220
- export declare class Materials extends Component implements Disposable {
221
- static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
26
+ export declare class BoundingBoxes extends Component implements Disposable {
27
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
222
28
  /** {@link Component.enabled} */
223
29
  enabled: boolean;
224
30
  /** {@link Disposable.onDisposed} */
225
- readonly onDisposed: Event<string>;
226
- list: {
227
- [id: string]: {
228
- material: THREE.Material;
229
- meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
230
- };
231
- };
232
- private _originals;
31
+ readonly onDisposed: Event<unknown>;
32
+ private _absoluteMin;
33
+ private _absoluteMax;
34
+ private _meshes;
233
35
  constructor(components: Components);
36
+ static getDimensions(bbox: THREE.Box3): {
37
+ width: number;
38
+ height: number;
39
+ depth: number;
40
+ center: THREE.Vector3;
41
+ };
42
+ static newBound(positive: boolean): THREE.Vector3;
43
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
234
44
  /** {@link Disposable.dispose} */
235
45
  dispose(): void;
236
- /**
237
- * Turns the specified material styles on or off.
238
- *
239
- * @param active whether to turn it on or off.
240
- * @param ids the ids of the style to turn on or off.
241
- */
242
- set(active: boolean, ids?: string[]): void;
243
- /**
244
- * Creates a new material style.
245
- * @param id the identifier of the style to create.
246
- * @param material the material of the style.
247
- */
248
- addMaterial(id: string, material: THREE.Material): void;
249
- /**
250
- * Assign meshes to a certain style.
251
- * @param id the identifier of the style.
252
- * @param meshes the meshes to assign to the style.
253
- */
254
- addMeshes(id: string, meshes: THREE.Mesh[]): void;
255
- /**
256
- * Remove meshes from a certain style.
257
- * @param id the identifier of the style.
258
- * @param meshes the meshes to assign to the style.
259
- */
260
- removeMeshes(id: string, meshes: THREE.Mesh[]): void;
46
+ get(): THREE.Box3;
47
+ getSphere(): THREE.Sphere;
48
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
49
+ reset(): void;
50
+ add(group: FragmentsGroup): void;
51
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
52
+ private static getFragmentBounds;
261
53
  }
262
- import { Component, Disposable, World, Event } from "../Types";
263
- import { SimpleRaycaster } from "./src";
264
- import { Components } from "../Components";
265
- export declare class Raycasters extends Component implements Disposable {
266
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
54
+ import * as FRAGS from "@thatopen/fragments";
55
+ import { Components, Component } from "../../core";
56
+ export declare class FragmentHider extends Component {
57
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
267
58
  enabled: boolean;
268
- list: Map<string, SimpleRaycaster>;
269
- onDisposed: Event<unknown>;
270
59
  constructor(components: Components);
271
- get(world: World): SimpleRaycaster;
272
- delete(world: World): void;
273
- dispose(): void;
60
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
61
+ isolate(items: FRAGS.FragmentIdMap): void;
62
+ private updateCulledVisibility;
274
63
  }
275
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
276
- import { Components } from "../Components";
277
- import { SimpleWorld } from "./src";
278
- export declare class Worlds extends Component implements Updateable, Disposable {
279
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
280
- readonly onAfterUpdate: Event<unknown>;
281
- readonly onBeforeUpdate: Event<unknown>;
282
- readonly onDisposed: Event<unknown>;
283
- list: Map<string, World>;
64
+ import * as WEBIFC from "web-ifc";
65
+ import * as FRAGS from "@thatopen/fragments";
66
+ import { IfcFragmentSettings } from "./src";
67
+ import { Component, Components, Event, Disposable } from "../../core";
68
+ export declare class FragmentIfcLoader extends Component implements Disposable {
69
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
70
+ readonly onIfcStartedLoading: Event<void>;
71
+ readonly onSetup: Event<void>;
72
+ /** {@link Disposable.onDisposed} */
73
+ readonly onDisposed: Event<string>;
74
+ settings: IfcFragmentSettings;
284
75
  enabled: boolean;
76
+ webIfc: WEBIFC.IfcAPI;
77
+ private _material;
78
+ private _spatialTree;
79
+ private _metaData;
80
+ private _fragmentInstances;
81
+ private _civil;
82
+ private _propertyExporter;
83
+ private _visitedFragments;
84
+ private _materialT;
285
85
  constructor(components: Components);
286
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
287
- delete(world: World): void;
288
86
  dispose(): void;
289
- update(delta?: number): void | Promise<void>;
87
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
88
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
89
+ readIfcFile(data: Uint8Array): Promise<number>;
90
+ private getAllGeometries;
91
+ cleanUp(): void;
92
+ private getMesh;
93
+ private getGeometry;
94
+ private autoSetWasm;
290
95
  }
291
96
  import * as THREE from "three";
292
- import { Components } from "../../core/Components";
293
- import { SimpleCamera } from "../../core";
294
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
295
- /**
296
- * A flexible camera that uses
297
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
298
- * easily control the camera in 2D and 3D. It supports multiple navigation
299
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
300
- */
301
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
302
- /**
303
- * The current {@link NavigationMode}.
304
- */
305
- mode: NavigationMode;
306
- readonly projection: ProjectionManager;
307
- readonly threeOrtho: THREE.OrthographicCamera;
308
- protected readonly _userInputButtons: any;
309
- protected readonly _frustumSize = 50;
310
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
311
- get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
312
- constructor(components: Components);
313
- /** {@link Disposable.dispose} */
314
- dispose(): void;
315
- /**
316
- * Sets a new {@link NavigationMode} and disables the previous one.
317
- *
318
- * @param mode - The {@link NavigationMode} to set.
319
- */
320
- set(mode: NavModeID): void;
321
- /**
322
- * Make the camera view fit all the specified meshes.
323
- *
324
- * @param meshes the meshes to fit. If it is not defined, it will
325
- * evaluate {@link Components.meshes}.
326
- * @param offset the distance to the fit object
327
- */
328
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
329
- /**
330
- * Allows or prevents all user input.
331
- *
332
- * @param active - whether to enable or disable user inputs.
333
- */
334
- setUserInput(active: boolean): void;
335
- private disableUserInput;
336
- private enableUserInput;
337
- private newOrthoCamera;
338
- private setOrthoCameraAspect;
339
- }
340
- import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
341
- import { MiniMap } from "./src";
342
- export declare class MiniMaps extends Component implements Updateable, Disposable {
343
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
344
- readonly onAfterUpdate: Event<unknown>;
345
- readonly onBeforeUpdate: Event<unknown>;
346
- readonly onDisposed: Event<unknown>;
347
- enabled: boolean;
348
- list: Map<string, MiniMap>;
349
- constructor(components: Components);
350
- create(world: World): MiniMap;
351
- delete(id: string): void;
352
- dispose(): void | Promise<void>;
353
- update(): void;
97
+ export interface MeasureEdge {
98
+ distance: number;
99
+ points: THREE.Vector3[];
354
100
  }
355
- import * as WEBIFC from "web-ifc";
356
- import * as FRAG from "@thatopen/fragments";
357
- /**
358
- * Object to export all the properties from an IFC to a JS object.
359
- */
360
- export declare class IfcJsonExporter {
361
- /**
362
- * Exports all the properties of an IFC into an array of JS objects.
363
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
364
- * @param modelID ID of the IFC model whose properties to extract.
365
- * @param indirect whether to get the indirect relationships as well.
366
- * @param recursiveSpatial whether to get the properties of spatial items recursively
367
- * to make the location data available (e.g. absolute position of building).
368
- */
369
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
101
+ export declare class MeasurementUtils {
102
+ static getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
103
+ edges: MeasureEdge[];
104
+ indices: Set<number>;
105
+ } | null;
106
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
107
+ private static getFaceData;
108
+ static getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
109
+ p1: THREE.Vector3;
110
+ p2: THREE.Vector3;
111
+ p3: THREE.Vector3;
112
+ faceNormal: THREE.Vector3;
113
+ };
114
+ private static round;
370
115
  }
371
116
  import * as THREE from "three";
372
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
373
- center: THREE.Vector3;
374
- halfSizes: THREE.Vector3;
375
- rotation: THREE.Matrix3;
376
- transformation: THREE.Matrix4;
377
- };
378
117
  import * as FRAGS from "@thatopen/fragments";
379
- import { FragmentsGroup } from "@thatopen/fragments";
380
- import { Disposable, Event, Component, Components } from "../../core";
381
- import { QueryGroup } from "./src/types";
382
- export interface QueryResult {
383
- [modelID: string]: {
384
- modelEntities: Set<number>;
385
- otherEntities: Set<number>;
386
- };
387
- }
388
- export interface IndexedModels {
389
- [modelID: string]: {
390
- [expressID: number]: Set<number>;
118
+ import { Disposable, Component, Event, Components } from "../../core";
119
+ export interface Classification {
120
+ [system: string]: {
121
+ [className: string]: FRAGS.FragmentIdMap;
391
122
  };
392
123
  }
393
- export declare class IfcPropertiesFinder extends Component implements Disposable {
394
- readonly onFound: Event<FRAGS.FragmentIdMap>;
124
+ export declare class FragmentClassifier extends Component implements Disposable {
125
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
126
+ /** {@link Component.enabled} */
127
+ enabled: boolean;
128
+ list: Classification;
395
129
  /** {@link Disposable.onDisposed} */
396
130
  readonly onDisposed: Event<unknown>;
397
- enabled: boolean;
398
- indexedModels: IndexedModels;
399
- private readonly _conditionFunctions;
400
- private _noHandleAttributes;
401
131
  constructor(components: Components);
402
132
  private onFragmentsDisposed;
403
133
  dispose(): void;
404
- private indexEntityRelations;
405
- find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
406
- private toFragmentMap;
407
- private simpleQuery;
408
- private getMatchingEntities;
409
- private combineArrays;
410
- private getCommonElements;
411
- private arrayIntersection;
412
- private arrayUnion;
413
- private getConditionFunctions;
134
+ remove(guid: string): void;
135
+ find(filter?: {
136
+ [name: string]: string[];
137
+ }): FRAGS.FragmentIdMap;
138
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
139
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
140
+ byEntity(group: FRAGS.FragmentsGroup): void;
141
+ byStorey(group: FRAGS.FragmentsGroup): void;
142
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
143
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
144
+ resetColor(items: FRAGS.FragmentIdMap): void;
145
+ private saveItem;
414
146
  }
415
147
  import * as WEBIFC from "web-ifc";
416
- import { FragmentsGroup } from "@thatopen/fragments";
417
- import { Component, Disposable, Event, Components } from "../../core";
418
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
419
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
420
- type NumericPropTypes = "IfcInteger" | "IfcReal";
421
- interface ChangeMap {
422
- [modelID: string]: Set<number>;
423
- }
424
- interface AttributeListener {
425
- [modelID: string]: {
426
- [expressID: number]: {
427
- [attributeName: string]: Event<String | Boolean | Number>;
148
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
149
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
150
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
151
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
152
+ onPropertiesStreamed: AsyncEvent<{
153
+ type: number;
154
+ data: {
155
+ [id: number]: any;
428
156
  };
429
- };
430
- }
431
- export declare class IfcPropertiesManager extends Component implements Disposable {
432
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
433
- /** {@link Disposable.onDisposed} */
434
- readonly onDisposed: Event<string>;
435
- readonly onRequestFile: Event<unknown>;
436
- ifcToExport: ArrayBuffer | null;
437
- readonly onElementToPset: Event<{
438
- model: FragmentsGroup;
439
- psetID: number;
440
- elementID: number;
441
- }>;
442
- readonly onPropToPset: Event<{
443
- model: FragmentsGroup;
444
- psetID: number;
445
- propID: number;
446
- }>;
447
- readonly onPsetRemoved: Event<{
448
- model: FragmentsGroup;
449
- psetID: number;
450
157
  }>;
451
- readonly onDataChanged: Event<{
452
- model: FragmentsGroup;
453
- expressID: number;
158
+ onProgress: AsyncEvent<number>;
159
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
160
+ /** {@link Disposable.onDisposed} */
161
+ readonly onDisposed: Event<string>;
162
+ enabled: boolean;
163
+ settings: PropertiesStreamingSettings;
164
+ webIfc: WEBIFC.IfcAPI;
165
+ dispose(): Promise<void>;
166
+ streamFromBuffer(data: Uint8Array): Promise<void>;
167
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
168
+ private readIfcFile;
169
+ private streamIfcFile;
170
+ private streamAllProperties;
171
+ private cleanUp;
172
+ }
173
+ import * as WEBIFC from "web-ifc";
174
+ import { Components, Disposable, Event, Component } from "../../core";
175
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
176
+ export declare class IfcGeometryTiler extends Component implements Disposable {
177
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
178
+ onGeometryStreamed: Event<{
179
+ buffer: Uint8Array;
180
+ data: StreamedGeometries;
454
181
  }>;
455
- wasm: {
456
- path: string;
457
- absolute: boolean;
458
- };
182
+ onAssetStreamed: Event<StreamedAsset[]>;
183
+ onProgress: Event<number>;
184
+ onIfcLoaded: Event<Uint8Array>;
185
+ /** {@link Disposable.onDisposed} */
186
+ readonly onDisposed: Event<unknown>;
187
+ settings: IfcStreamingSettings;
459
188
  enabled: boolean;
460
- attributeListeners: AttributeListener;
461
- selectedModel?: FragmentsGroup;
462
- private _changeMap;
189
+ webIfc: WEBIFC.IfcAPI;
190
+ private _spatialTree;
191
+ private _metaData;
192
+ private _visitedGeometries;
193
+ private _streamSerializer;
194
+ private _geometries;
195
+ private _geometryCount;
196
+ private _civil;
197
+ private _groupSerializer;
198
+ private _assets;
199
+ private _meshesWithHoles;
463
200
  constructor(components: Components);
464
- get(): ChangeMap;
465
201
  dispose(): void;
466
- private increaseMaxID;
467
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
468
- private newGUID;
469
- private getOwnerHistory;
470
- private registerChange;
471
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
472
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
473
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
474
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
475
- }>;
476
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
477
- private newSingleProperty;
478
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
479
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
480
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
481
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
482
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
483
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
484
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
485
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
202
+ streamFromBuffer(data: Uint8Array): Promise<void>;
203
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
204
+ private readIfcFile;
205
+ private streamIfcFile;
206
+ private streamAllGeometries;
207
+ private cleanUp;
208
+ private getMesh;
209
+ private getGeometry;
210
+ private streamAssets;
211
+ private streamGeometries;
486
212
  }
487
- export {};
488
- import { Components } from "../Components";
489
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
490
- import { Component, Event, Disposable, World } from "../Types";
213
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
214
+ import * as THREE from "three";
215
+ import { Component, Components, Event, Disposable } from "../../core";
491
216
  /**
492
- * A tool to handle big scenes efficiently by automatically hiding the objects
493
- * that are not visible to the camera.
217
+ * Object that can efficiently load binary files that contain
218
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
494
219
  */
495
- export declare class Cullers extends Component implements Disposable {
496
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
497
- private _enabled;
498
- list: Map<string, MeshCullerRenderer>;
220
+ export declare class FragmentManager extends Component implements Disposable {
221
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
499
222
  /** {@link Disposable.onDisposed} */
500
223
  readonly onDisposed: Event<unknown>;
224
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
225
+ readonly onFragmentsDisposed: Event<{
226
+ groupID: string;
227
+ fragmentIDs: string[];
228
+ }>;
229
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
230
+ readonly list: Map<string, Fragment>;
231
+ readonly groups: Map<string, FragmentsGroup>;
501
232
  /** {@link Component.enabled} */
502
- get enabled(): boolean;
503
- set enabled(value: boolean);
233
+ enabled: boolean;
234
+ baseCoordinationModel: string;
235
+ private _loader;
236
+ /** The list of meshes of the created fragments. */
237
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
504
238
  constructor(components: Components);
505
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
506
- delete(world: World): void;
507
239
  /** {@link Disposable.dispose} */
508
240
  dispose(): void;
241
+ disposeGroup(group: FragmentsGroup): void;
242
+ /**
243
+ * Loads one or many fragments into the scene.
244
+ * @param data - the bytes containing the data for the fragments to load.
245
+ * @param coordinate - whether this fragmentsgroup should be federated with the others.
246
+ * @returns the list of IDs of the loaded fragments.
247
+ */
248
+ load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
249
+ /**
250
+ * Export the specified fragments.
251
+ * @param group - the fragments group to be exported.
252
+ * @returns the exported data as binary buffer.
253
+ */
254
+ export(group: FragmentsGroup): Uint8Array;
255
+ coordinate(models?: FragmentsGroup[]): void;
509
256
  }
510
- import * as WEBIFC from "web-ifc";
511
- import { FragmentsGroup } from "@thatopen/fragments";
512
- import { Disposable, Event, Component, Components } from "../../core";
513
- import { RelationsMap, ModelsRelationMap, InverseAttributes, InverseAttribute } from "./src/types";
257
+ import * as THREE from "three";
258
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
259
+ center: THREE.Vector3;
260
+ halfSizes: THREE.Vector3;
261
+ rotation: THREE.Matrix3;
262
+ transformation: THREE.Matrix4;
263
+ };
264
+ export declare class UUID {
265
+ private static _pattern;
266
+ private static _lut;
267
+ static create(): string;
268
+ static validate(uuid: string): void;
269
+ }
270
+ import * as THREE from "three";
271
+ import { Component, Components, Event, World, Disposable } from "../core";
272
+ export interface VertexPickerConfig {
273
+ showOnlyVertex: boolean;
274
+ snapDistance: number;
275
+ previewElement: HTMLElement;
276
+ }
277
+ export declare class VertexPicker extends Component implements Disposable {
278
+ onVertexFound: Event<THREE.Vector3>;
279
+ onVertexLost: Event<THREE.Vector3>;
280
+ components: Components;
281
+ private _pickedPoint;
282
+ private _config;
283
+ private _enabled;
284
+ private _workingPlane;
285
+ /** {@link Disposable.onDisposed} */
286
+ readonly onDisposed: Event<unknown>;
287
+ set enabled(value: boolean);
288
+ get enabled(): boolean;
289
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
290
+ [Symbol.dispose](): void;
291
+ set workingPlane(plane: THREE.Plane | null);
292
+ get workingPlane(): THREE.Plane | null;
293
+ set config(value: Partial<VertexPickerConfig>);
294
+ get config(): Partial<VertexPickerConfig>;
295
+ dispose(): void;
296
+ get(world: World): THREE.Vector3 | null;
297
+ private getClosestVertex;
298
+ private getVertices;
299
+ private getVertex;
300
+ }
301
+ import * as THREE from "three";
302
+ export declare class MaterialsUtils {
303
+ static isTransparent(material: THREE.Material): boolean;
304
+ }
305
+ import { Component, Disposable, Event } from "../Types";
514
306
  /**
515
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
516
- * 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.
307
+ * The entry point of the Components library.
308
+ * It can:
309
+ * - Create and access all the components of the library.
310
+ * - Update all the updatable components automatically.
311
+ * - Dispose all the components, preventing memory leaks.
517
312
  */
518
- export declare class IfcRelationsIndexer extends Component implements Disposable {
519
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
313
+ export declare class Components implements Disposable {
314
+ static readonly release = "1.4.21";
520
315
  /** {@link Disposable.onDisposed} */
521
- readonly onDisposed: Event<string>;
316
+ readonly onDisposed: Event<void>;
317
+ /** The list of components created in this app. */
318
+ readonly list: Map<string, Component>;
319
+ /** If disabled, the animation loop will be stopped. */
522
320
  enabled: boolean;
523
- readonly onRelationsIndexed: Event<{
524
- modelID: string;
525
- relationsMap: RelationsMap;
526
- }>;
527
- private _relToAttributesMap;
321
+ private _clock;
322
+ add(uuid: string, instance: Component): void;
528
323
  /**
529
- * Array of inverse attribute names.
530
- * This array is used to define the inverse attributes that the indexer will process and index.
324
+ * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
325
+ * doesn't exist, it will instance it automatically.
326
+ *
327
+ * @param Component - The component to get or create.
531
328
  */
532
- readonly inverseAttributes: InverseAttributes;
329
+ get<U extends Component>(Component: new (components: Components) => U): U;
330
+ constructor();
533
331
  /**
534
- * Holds the relationship mappings for each model processed by the indexer.
535
- * The structure is a map where each key is a model's UUID, and the value is another map.
536
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
537
- * representing a specific relation type, and the value is an array of expressIDs of entities
538
- * that are related through that relation type. This structure allows for efficient querying
539
- * of entity relationships within a model.
332
+ * Initializes the library. It should be called at the start of the app after
333
+ * initializing the scene, the renderer and the
334
+ * camera. Additionally, if any component that need a raycaster is
335
+ * used, the {@link raycaster} will need to be initialized.
540
336
  */
541
- readonly relationMaps: ModelsRelationMap;
542
- constructor(components: Components);
543
- private onFragmentsDisposed;
544
- private getAttributeRels;
337
+ init(): void;
545
338
  /**
546
- * Adds a relation map to the model's relations map.
339
+ * Disposes the memory of all the components and tools of this instance of
340
+ * the library. A memory leak will be created if:
547
341
  *
548
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
549
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
342
+ * - An instance of the library ends up out of scope and this function isn't
343
+ * called. This is especially relevant in Single Page Applications (React,
344
+ * Angular, Vue, etc).
550
345
  *
551
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
552
- */
553
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
554
- /**
555
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
556
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
557
- * and maps them in a structured way to facilitate quick access to related entities.
558
- *
559
- * The process involves querying the model for each relation type associated with the inverse attributes
560
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
561
- * and contains a nested map where each key is an entity's expressID and its value is another map.
562
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
563
- * of entities that are related through that attribute.
346
+ * - Any of the objects of this instance (meshes, geometries, etc) is
347
+ * referenced by a reference type (object or array).
564
348
  *
565
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
566
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
567
- * representation of the relations indexed by entity expressIDs and relation types.
568
- * @throws An error if the model does not have properties loaded.
569
- */
570
- process(model: FragmentsGroup): Promise<RelationsMap>;
571
- /**
572
- * Processes a given model from a WebIfc API to index its IFC entities relations based on predefined inverse attributes.
349
+ * You can learn more about how Three.js handles memory leaks
350
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
573
351
  *
574
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
575
- * @param modelID - The unique identifier of the model within the WebIfc API.
576
- * @returns A promise that resolves to the relations map for the processed model.
577
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
578
352
  */
579
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
353
+ dispose(): void;
354
+ private update;
355
+ private static setupBVH;
356
+ }
357
+ import { Component, Disposable, World, Event } from "../Types";
358
+ import { SimpleRaycaster } from "./src";
359
+ import { Components } from "../Components";
360
+ export declare class Raycasters extends Component implements Disposable {
361
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
362
+ enabled: boolean;
363
+ list: Map<string, SimpleRaycaster>;
364
+ onDisposed: Event<unknown>;
365
+ constructor(components: Components);
366
+ get(world: World): SimpleRaycaster;
367
+ delete(world: World): void;
368
+ dispose(): void;
369
+ }
370
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
371
+ import { Components } from "../Components";
372
+ import { SimpleWorld } from "./src";
373
+ export declare class Worlds extends Component implements Updateable, Disposable {
374
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
375
+ readonly onAfterUpdate: Event<unknown>;
376
+ readonly onBeforeUpdate: Event<unknown>;
377
+ readonly onDisposed: Event<unknown>;
378
+ list: Map<string, World>;
379
+ enabled: boolean;
380
+ constructor(components: Components);
381
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
382
+ delete(world: World): void;
383
+ dispose(): void;
384
+ update(delta?: number): void | Promise<void>;
385
+ }
386
+ import * as THREE from "three";
387
+ import { Components } from "../Components";
388
+ import { Component } from "../Types";
389
+ /**
390
+ * A tool to safely remove meshes and geometries from memory to
391
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
392
+ */
393
+ export declare class Disposer extends Component {
394
+ private _disposedComponents;
395
+ /** {@link Component.enabled} */
396
+ enabled: boolean;
397
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
398
+ constructor(components: Components);
580
399
  /**
581
- * Retrieves the relations of a specific entity within a model based on the given relation name.
582
- * This method searches the indexed relation maps for the specified model and entity,
583
- * returning the IDs of related entities if a match is found.
584
- *
585
- * @param model The 'FragmentsGroup' model containing the entity.
586
- * @param expressID The unique identifier of the entity within the model.
587
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
588
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
589
- * or the specified relation name is not indexed.
400
+ * {@link Component.uuid}.
401
+ * @return the list of UUIDs of deleted components.
590
402
  */
591
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
403
+ get(): Set<string>;
592
404
  /**
593
- * Serializes the relations of a given relation map into a JSON string.
594
- * 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,
595
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
596
- * The resulting object is then serialized into a JSON string.
405
+ * Removes a mesh, its geometry and its materials from memory. If you are
406
+ * using any of these in other parts of the application, make sure that you
407
+ * remove them from the mesh before disposing it.
597
408
  *
598
- * @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.
599
- * @returns A JSON string representing the serialized relations of the given relation map.
600
- */
601
- serializeRelations(relationMap: RelationsMap): string;
602
- /**
603
- * Serializes the relations of a specific model into a JSON string.
604
- * This method iterates through the relations indexed for the given model,
605
- * organizing them into a structured object where each key is an expressID of an entity,
606
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
607
- * The resulting object is then serialized into a JSON string.
409
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
410
+ * to remove.
608
411
  *
609
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
610
- * @returns A JSON string representing the serialized relations of the specified model.
611
- * If the model has no indexed relations, 'null' is returned.
612
- */
613
- serializeModelRelations(model: FragmentsGroup): string | null;
614
- /**
615
- * Serializes all relations of every model processed by the indexer into a JSON string.
616
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
617
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
618
- * and its value is another object mapping entity expressIDs to their related entities, categorized
619
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
412
+ * @param materials - whether to dispose the materials of the mesh.
620
413
  *
621
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
622
- * If no relations have been indexed, an empty object is returned as a JSON string.
414
+ * @param recursive - whether to recursively dispose the children of the mesh.
623
415
  */
624
- serializeAllRelations(): string;
416
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
625
417
  /**
626
- * Converts a JSON string representing relations between entities into a structured map.
627
- * This method parses the JSON string to reconstruct the relations map that indexes
628
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
629
- * and the values are maps where each key is a relation type ID and its value is an array
630
- * of express IDs of entities related through that relation type.
418
+ * Disposes a geometry from memory.
631
419
  *
632
- * @param json The JSON string to be parsed into the relations map.
633
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
634
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
635
- * is an array of express IDs (as numbers) of entities related through that relation type.
636
- */
637
- getRelationsMapFromJSON(json: string): RelationsMap;
638
- /**
639
- * Disposes the component, cleaning up resources and detaching event listeners.
640
- * This ensures that the component is properly cleaned up and does not leave behind any
641
- * references that could prevent garbage collection.
420
+ * @param geometry - the
421
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
422
+ * to remove.
642
423
  */
424
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
425
+ private disposeGeometryAndMaterials;
426
+ private disposeChildren;
427
+ private static disposeMaterial;
428
+ }
429
+ import { Component, Disposable, World, Event } from "../Types";
430
+ import { GridConfig, SimpleGrid } from "./src";
431
+ export declare class Grids extends Component implements Disposable {
432
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
433
+ list: Map<string, SimpleGrid>;
434
+ onDisposed: Event<unknown>;
435
+ config: Required<GridConfig>;
436
+ /** {@link Component.enabled} */
437
+ enabled: boolean;
438
+ create(world: World): void;
439
+ delete(world: World): void;
643
440
  dispose(): void;
644
441
  }
645
442
  import * as THREE from "three";
646
- import * as FRAGS from "@thatopen/fragments";
647
- import { FragmentsGroup } from "@thatopen/fragments";
648
- import { Component, Components, Disposable, Event } from "../../core";
443
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
444
+ import { SimplePlane } from "./src";
445
+ import { Components } from "../Components";
649
446
  /**
650
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
651
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
447
+ * A lightweight component to easily create and handle
448
+ * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
449
+ *
450
+ * @param components - the instance of {@link Components} used.
451
+ * @param planeType - the type of plane to be used by the clipper.
452
+ * E.g. {@link SimplePlane}.
652
453
  */
653
- export declare class BoundingBoxes extends Component implements Disposable {
654
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
655
- /** {@link Component.enabled} */
656
- enabled: boolean;
454
+ export declare class Clipper<T extends SimplePlane> extends Component implements Createable, Disposable, Hideable {
455
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
456
+ /** {@link Createable.onAfterCreate} */
457
+ readonly onAfterCreate: Event<T>;
458
+ /** {@link Createable.onAfterDelete} */
459
+ readonly onAfterDelete: Event<T>;
460
+ /** Event that fires when the user starts dragging a clipping plane. */
461
+ readonly onBeforeDrag: Event<void>;
462
+ /** Event that fires when the user stops dragging a clipping plane. */
463
+ readonly onAfterDrag: Event<void>;
464
+ readonly onBeforeCreate: Event<unknown>;
465
+ readonly onBeforeCancel: Event<unknown>;
466
+ readonly onAfterCancel: Event<unknown>;
467
+ readonly onBeforeDelete: Event<unknown>;
657
468
  /** {@link Disposable.onDisposed} */
658
- readonly onDisposed: Event<unknown>;
659
- private _absoluteMin;
660
- private _absoluteMax;
661
- private _meshes;
469
+ readonly onDisposed: Event<string>;
470
+ /**
471
+ * Whether to force the clipping plane to be orthogonal in the Y direction
472
+ * (up). This is desirable when clipping a building horizontally and a
473
+ * clipping plane is created in its roof, which might have a slight
474
+ * slope for draining purposes.
475
+ */
476
+ orthogonalY: boolean;
477
+ /**
478
+ * The tolerance that determines whether an almost-horizontal clipping plane
479
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
480
+ * has to be 'true' for this to apply.
481
+ */
482
+ toleranceOrthogonalY: number;
483
+ list: T[];
484
+ protected PlaneType: new (...args: any) => SimplePlane | T;
485
+ /** The material used in all the clipping planes. */
486
+ protected _material: THREE.MeshBasicMaterial;
487
+ private _size;
488
+ private _enabled;
489
+ private _visible;
490
+ /** {@link Component.enabled} */
491
+ get enabled(): boolean;
492
+ /** {@link Component.enabled} */
493
+ set enabled(state: boolean);
494
+ /** {@link Hideable.visible } */
495
+ get visible(): boolean;
496
+ /** {@link Hideable.visible } */
497
+ set visible(state: boolean);
498
+ /** The material of the clipping plane representation. */
499
+ get material(): THREE.MeshBasicMaterial;
500
+ /** The material of the clipping plane representation. */
501
+ set material(material: THREE.MeshBasicMaterial);
502
+ /** The size of the geometric representation of the clippings planes. */
503
+ get size(): number;
504
+ /** The size of the geometric representation of the clippings planes. */
505
+ set size(size: number);
662
506
  constructor(components: Components);
663
- static getDimensions(bbox: THREE.Box3): {
664
- width: number;
665
- height: number;
666
- depth: number;
667
- center: THREE.Vector3;
668
- };
669
- static newBound(positive: boolean): THREE.Vector3;
670
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
507
+ endCreation(): void;
508
+ cancelCreation(): void;
671
509
  /** {@link Disposable.dispose} */
672
510
  dispose(): void;
673
- get(): THREE.Box3;
674
- getSphere(): THREE.Sphere;
675
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
676
- reset(): void;
677
- add(group: FragmentsGroup): void;
678
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
679
- private static getFragmentBounds;
680
- }
681
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
682
- import * as FRAGS from "@thatopen/fragments";
683
- import { Components, Component } from "../../core";
684
- export declare class FragmentHider extends Component {
685
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
686
- enabled: boolean;
687
- constructor(components: Components);
688
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
689
- isolate(items: FRAGS.FragmentIdMap): void;
690
- private updateCulledVisibility;
691
- }
692
- import * as THREE from "three";
693
- import * as FRAGS from "@thatopen/fragments";
694
- import { Disposable, Component, Event, Components } from "../../core";
695
- export interface Classification {
696
- [system: string]: {
697
- [className: string]: FRAGS.FragmentIdMap;
698
- };
511
+ /** {@link Createable.create} */
512
+ create(world: World): void;
513
+ /**
514
+ * Creates a plane in a certain place and with a certain orientation,
515
+ * without the need of the mouse.
516
+ *
517
+ * @param world - the world where this plane should be created.
518
+ * @param normal - the orientation of the clipping plane.
519
+ * @param point - the position of the clipping plane.
520
+ * navigation.
521
+ */
522
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): T;
523
+ /**
524
+ * {@link Createable.delete}
525
+ *
526
+ * @param world - the world where the plane to delete is.
527
+ * @param plane - the plane to delete. If undefined, the first plane
528
+ * found under the cursor will be deleted.
529
+ */
530
+ delete(world: World, plane?: T): void;
531
+ /** Deletes all the existing clipping planes. */
532
+ deleteAll(): void;
533
+ private deletePlane;
534
+ private pickPlane;
535
+ private getAllPlaneMeshes;
536
+ private createPlaneFromIntersection;
537
+ private getWorldNormal;
538
+ private normalizePlaneDirectionY;
539
+ private newPlane;
540
+ protected newPlaneInstance(world: World, point: THREE.Vector3, normal: THREE.Vector3): T;
541
+ private updateMaterialsAndPlanes;
542
+ private _onStartDragging;
543
+ private _onEndDragging;
699
544
  }
700
- export declare class FragmentClassifier extends Component implements Disposable {
701
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
702
- /** {@link Component.enabled} */
703
- enabled: boolean;
704
- list: Classification;
705
- /** {@link Disposable.onDisposed} */
545
+ import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
546
+ import { MiniMap } from "./src";
547
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
548
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
549
+ readonly onAfterUpdate: Event<unknown>;
550
+ readonly onBeforeUpdate: Event<unknown>;
706
551
  readonly onDisposed: Event<unknown>;
707
- constructor(components: Components);
708
- private onFragmentsDisposed;
709
- dispose(): void;
710
- remove(guid: string): void;
711
- find(filter?: {
712
- [name: string]: string[];
713
- }): FRAGS.FragmentIdMap;
714
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
715
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
716
- byEntity(group: FRAGS.FragmentsGroup): void;
717
- byStorey(group: FRAGS.FragmentsGroup): void;
718
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
719
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
720
- resetColor(items: FRAGS.FragmentIdMap): void;
721
- private saveItem;
722
- }
723
- import { Component, Disposable, Event, Components } from "../../core";
724
- export declare class FragmentExploder extends Component implements Disposable {
725
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
726
552
  enabled: boolean;
727
- height: number;
728
- groupName: string;
729
- /** {@link Disposable.onDisposed} */
730
- readonly onDisposed: Event<string>;
731
- list: Set<string>;
553
+ list: Map<string, MiniMap>;
732
554
  constructor(components: Components);
733
- dispose(): void;
734
- explode(): void;
735
- reset(): void;
555
+ create(world: World): MiniMap;
556
+ delete(id: string): void;
557
+ dispose(): void | Promise<void>;
736
558
  update(): void;
737
559
  }
738
- import * as WEBIFC from "web-ifc";
739
- import * as FRAGS from "@thatopen/fragments";
740
- import { IfcFragmentSettings } from "./src";
741
- import { Component, Components, Event, Disposable } from "../../core";
742
- export declare class FragmentIfcLoader extends Component implements Disposable {
743
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
744
- readonly onIfcStartedLoading: Event<void>;
745
- readonly onSetup: Event<void>;
746
- /** {@link Disposable.onDisposed} */
747
- readonly onDisposed: Event<string>;
748
- settings: IfcFragmentSettings;
749
- enabled: boolean;
750
- webIfc: WEBIFC.IfcAPI;
751
- private _material;
752
- private _spatialTree;
753
- private _metaData;
754
- private _fragmentInstances;
755
- private _civil;
756
- private _propertyExporter;
757
- private _visitedFragments;
758
- private _materialT;
759
- constructor(components: Components);
760
- dispose(): void;
761
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
762
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
763
- readIfcFile(data: Uint8Array): Promise<number>;
764
- private getAllGeometries;
765
- cleanUp(): void;
766
- private getMesh;
767
- private getGeometry;
768
- private autoSetWasm;
769
- }
770
- import * as WEBIFC from "web-ifc";
771
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
772
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
773
- export declare class IfcPropertiesTiler extends Component implements Disposable {
774
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
775
- onPropertiesStreamed: AsyncEvent<{
776
- type: number;
777
- data: {
778
- [id: number]: any;
779
- };
780
- }>;
781
- onProgress: AsyncEvent<number>;
782
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
783
- /** {@link Disposable.onDisposed} */
784
- readonly onDisposed: Event<string>;
785
- enabled: boolean;
786
- settings: PropertiesStreamingSettings;
787
- webIfc: WEBIFC.IfcAPI;
788
- dispose(): Promise<void>;
789
- streamFromBuffer(data: Uint8Array): Promise<void>;
790
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
791
- private readIfcFile;
792
- private streamIfcFile;
793
- private streamAllProperties;
794
- private cleanUp;
795
- }
796
- import * as WEBIFC from "web-ifc";
797
- import { Components, Disposable, Event, Component } from "../../core";
798
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
799
- export declare class IfcGeometryTiler extends Component implements Disposable {
800
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
801
- onGeometryStreamed: Event<{
802
- buffer: Uint8Array;
803
- data: StreamedGeometries;
804
- }>;
805
- onAssetStreamed: Event<StreamedAsset[]>;
806
- onProgress: Event<number>;
807
- onIfcLoaded: Event<Uint8Array>;
808
- /** {@link Disposable.onDisposed} */
809
- readonly onDisposed: Event<unknown>;
810
- settings: IfcStreamingSettings;
811
- enabled: boolean;
812
- webIfc: WEBIFC.IfcAPI;
813
- private _spatialTree;
814
- private _metaData;
815
- private _visitedGeometries;
816
- private _streamSerializer;
817
- private _geometries;
818
- private _geometryCount;
819
- private _civil;
820
- private _groupSerializer;
821
- private _assets;
822
- private _meshesWithHoles;
823
- constructor(components: Components);
824
- dispose(): void;
825
- streamFromBuffer(data: Uint8Array): Promise<void>;
826
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
827
- private readIfcFile;
828
- private streamIfcFile;
829
- private streamAllGeometries;
830
- private cleanUp;
831
- private getMesh;
832
- private getGeometry;
833
- private streamAssets;
834
- private streamGeometries;
835
- }
836
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
837
560
  import * as THREE from "three";
838
- import { Component, Components, Event, Disposable } from "../../core";
561
+ import { Component, Disposable, Event } from "../Types";
562
+ import { Components } from "../Components";
839
563
  /**
840
- * Object that can efficiently load binary files that contain
841
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
564
+ * A tool to easily handle the materials of massive amounts of
565
+ * objects and scene background easily.
842
566
  */
843
- export declare class FragmentManager extends Component implements Disposable {
844
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
845
- /** {@link Disposable.onDisposed} */
846
- readonly onDisposed: Event<unknown>;
847
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
848
- readonly onFragmentsDisposed: Event<{
849
- groupID: string;
850
- fragmentIDs: string[];
851
- }>;
852
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
853
- readonly list: Map<string, Fragment>;
854
- readonly groups: Map<string, FragmentsGroup>;
567
+ export declare class Materials extends Component implements Disposable {
568
+ static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
855
569
  /** {@link Component.enabled} */
856
570
  enabled: boolean;
857
- baseCoordinationModel: string;
858
- private _loader;
859
- /** The list of meshes of the created fragments. */
860
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
571
+ /** {@link Disposable.onDisposed} */
572
+ readonly onDisposed: Event<string>;
573
+ list: {
574
+ [id: string]: {
575
+ material: THREE.Material;
576
+ meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
577
+ };
578
+ };
579
+ private _originals;
861
580
  constructor(components: Components);
862
581
  /** {@link Disposable.dispose} */
863
582
  dispose(): void;
864
- disposeGroup(group: FragmentsGroup): void;
865
583
  /**
866
- * Loads one or many fragments into the scene.
867
- * @param data - the bytes containing the data for the fragments to load.
868
- * @param coordinate - whether this fragmentsgroup should be federated with the others.
869
- * @returns the list of IDs of the loaded fragments.
584
+ * Turns the specified material styles on or off.
585
+ *
586
+ * @param active whether to turn it on or off.
587
+ * @param ids the ids of the style to turn on or off.
870
588
  */
871
- load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
589
+ set(active: boolean, ids?: string[]): void;
872
590
  /**
873
- * Export the specified fragments.
874
- * @param group - the fragments group to be exported.
875
- * @returns the exported data as binary buffer.
591
+ * Creates a new material style.
592
+ * @param id the identifier of the style to create.
593
+ * @param material the material of the style.
876
594
  */
877
- export(group: FragmentsGroup): Uint8Array;
878
- coordinate(models?: FragmentsGroup[]): void;
595
+ addMaterial(id: string, material: THREE.Material): void;
596
+ /**
597
+ * Assign meshes to a certain style.
598
+ * @param id the identifier of the style.
599
+ * @param meshes the meshes to assign to the style.
600
+ */
601
+ addMeshes(id: string, meshes: THREE.Mesh[]): void;
602
+ /**
603
+ * Remove meshes from a certain style.
604
+ * @param id the identifier of the style.
605
+ * @param meshes the meshes to assign to the style.
606
+ */
607
+ removeMeshes(id: string, meshes: THREE.Mesh[]): void;
879
608
  }
880
609
  import * as THREE from "three";
881
- export declare class MaterialsUtils {
882
- static isTransparent(material: THREE.Material): boolean;
883
- }
884
- export declare class UUID {
885
- private static _pattern;
886
- private static _lut;
887
- static create(): string;
888
- static validate(uuid: string): void;
889
- }
890
- import * as THREE from "three";
891
- import { Component, Components, Event, World, Disposable } from "../core";
892
- export interface VertexPickerConfig {
893
- showOnlyVertex: boolean;
894
- snapDistance: number;
895
- previewElement: HTMLElement;
610
+ import { Components } from "../../core/Components";
611
+ import { SimpleCamera } from "../../core";
612
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
613
+ /**
614
+ * A flexible camera that uses
615
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
616
+ * easily control the camera in 2D and 3D. It supports multiple navigation
617
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
618
+ */
619
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
620
+ /**
621
+ * The current {@link NavigationMode}.
622
+ */
623
+ mode: NavigationMode;
624
+ readonly projection: ProjectionManager;
625
+ readonly threeOrtho: THREE.OrthographicCamera;
626
+ protected readonly _userInputButtons: any;
627
+ protected readonly _frustumSize = 50;
628
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
629
+ get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
630
+ constructor(components: Components);
631
+ /** {@link Disposable.dispose} */
632
+ dispose(): void;
633
+ /**
634
+ * Sets a new {@link NavigationMode} and disables the previous one.
635
+ *
636
+ * @param mode - The {@link NavigationMode} to set.
637
+ */
638
+ set(mode: NavModeID): void;
639
+ /**
640
+ * Make the camera view fit all the specified meshes.
641
+ *
642
+ * @param meshes the meshes to fit. If it is not defined, it will
643
+ * evaluate {@link Components.meshes}.
644
+ * @param offset the distance to the fit object
645
+ */
646
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
647
+ /**
648
+ * Allows or prevents all user input.
649
+ *
650
+ * @param active - whether to enable or disable user inputs.
651
+ */
652
+ setUserInput(active: boolean): void;
653
+ private disableUserInput;
654
+ private enableUserInput;
655
+ private newOrthoCamera;
656
+ private setOrthoCameraAspect;
896
657
  }
897
- export declare class VertexPicker extends Component implements Disposable {
898
- onVertexFound: Event<THREE.Vector3>;
899
- onVertexLost: Event<THREE.Vector3>;
900
- components: Components;
901
- private _pickedPoint;
902
- private _config;
658
+ import { Components } from "../Components";
659
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
660
+ import { Component, Event, Disposable, World } from "../Types";
661
+ /**
662
+ * A tool to handle big scenes efficiently by automatically hiding the objects
663
+ * that are not visible to the camera.
664
+ */
665
+ export declare class Cullers extends Component implements Disposable {
666
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
903
667
  private _enabled;
904
- private _workingPlane;
668
+ list: Map<string, MeshCullerRenderer>;
905
669
  /** {@link Disposable.onDisposed} */
906
670
  readonly onDisposed: Event<unknown>;
907
- set enabled(value: boolean);
671
+ /** {@link Component.enabled} */
908
672
  get enabled(): boolean;
909
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
910
- [Symbol.dispose](): void;
911
- set workingPlane(plane: THREE.Plane | null);
912
- get workingPlane(): THREE.Plane | null;
913
- set config(value: Partial<VertexPickerConfig>);
914
- get config(): Partial<VertexPickerConfig>;
673
+ set enabled(value: boolean);
674
+ constructor(components: Components);
675
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
676
+ delete(world: World): void;
677
+ /** {@link Disposable.dispose} */
915
678
  dispose(): void;
916
- get(world: World): THREE.Vector3 | null;
917
- private getClosestVertex;
918
- private getVertices;
919
- private getVertex;
920
679
  }
921
- export declare const IfcElements: {
922
- [key: number]: string;
923
- };
924
680
  import * as WEBIFC from "web-ifc";
925
- export interface IfcItemsCategories {
926
- [itemID: number]: number;
927
- }
928
- export declare class IfcCategories {
929
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
681
+ import * as FRAG from "@thatopen/fragments";
682
+ /**
683
+ * Object to export all the properties from an IFC to a JS object.
684
+ */
685
+ export declare class IfcJsonExporter {
686
+ /**
687
+ * Exports all the properties of an IFC into an array of JS objects.
688
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
689
+ * @param modelID ID of the IFC model whose properties to extract.
690
+ * @param indirect whether to get the indirect relationships as well.
691
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
692
+ * to make the location data available (e.g. absolute position of building).
693
+ */
694
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
930
695
  }
931
696
  import * as FRAGS from "@thatopen/fragments";
932
- export declare class IfcPropertiesUtils {
933
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
934
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
935
- [attribute: string]: any;
936
- } | null>;
937
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
938
- [relatingID: number]: number[];
939
- }>;
940
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
941
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
942
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
943
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
944
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
945
- key: string | null;
946
- name: string | null;
947
- }>;
948
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
949
- key: string | null;
950
- value: number | null;
697
+ import { FragmentsGroup } from "@thatopen/fragments";
698
+ import { Disposable, Event, Component, Components } from "../../core";
699
+ import { QueryGroup } from "./src/types";
700
+ export interface QueryResult {
701
+ [modelID: string]: {
702
+ modelEntities: Set<number>;
703
+ otherEntities: Set<number>;
704
+ };
705
+ }
706
+ export interface IndexedModels {
707
+ [modelID: string]: {
708
+ [expressID: number]: Set<number>;
709
+ };
710
+ }
711
+ export declare class IfcPropertiesFinder extends Component implements Disposable {
712
+ readonly onFound: Event<FRAGS.FragmentIdMap>;
713
+ /** {@link Disposable.onDisposed} */
714
+ readonly onDisposed: Event<unknown>;
715
+ enabled: boolean;
716
+ indexedModels: IndexedModels;
717
+ private readonly _conditionFunctions;
718
+ private _noHandleAttributes;
719
+ constructor(components: Components);
720
+ private onFragmentsDisposed;
721
+ dispose(): void;
722
+ private indexEntityRelations;
723
+ find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
724
+ private toFragmentMap;
725
+ private simpleQuery;
726
+ private getMatchingEntities;
727
+ private combineArrays;
728
+ private getCommonElements;
729
+ private arrayIntersection;
730
+ private arrayUnion;
731
+ private getConditionFunctions;
732
+ }
733
+ import * as WEBIFC from "web-ifc";
734
+ import { FragmentsGroup } from "@thatopen/fragments";
735
+ import { Disposable, Event, Component, Components } from "../../core";
736
+ import { RelationsMap, ModelsRelationMap, InverseAttributes, InverseAttribute } from "./src/types";
737
+ /**
738
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
739
+ * 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.
740
+ */
741
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
742
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
743
+ /** {@link Disposable.onDisposed} */
744
+ readonly onDisposed: Event<string>;
745
+ enabled: boolean;
746
+ readonly onRelationsIndexed: Event<{
747
+ modelID: string;
748
+ relationsMap: RelationsMap;
951
749
  }>;
952
- static isRel(expressID: number): boolean;
953
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
954
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
750
+ private _relToAttributesMap;
751
+ /**
752
+ * Array of inverse attribute names.
753
+ * This array is used to define the inverse attributes that the indexer will process and index.
754
+ */
755
+ readonly inverseAttributes: InverseAttributes;
756
+ /**
757
+ * Holds the relationship mappings for each model processed by the indexer.
758
+ * The structure is a map where each key is a model's UUID, and the value is another map.
759
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
760
+ * representing a specific relation type, and the value is an array of expressIDs of entities
761
+ * that are related through that relation type. This structure allows for efficient querying
762
+ * of entity relationships within a model.
763
+ */
764
+ readonly relationMaps: ModelsRelationMap;
765
+ constructor(components: Components);
766
+ private onFragmentsDisposed;
767
+ private getAttributeRels;
768
+ /**
769
+ * Adds a relation map to the model's relations map.
770
+ *
771
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
772
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
773
+ *
774
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
775
+ */
776
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
777
+ /**
778
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
779
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
780
+ * and maps them in a structured way to facilitate quick access to related entities.
781
+ *
782
+ * The process involves querying the model for each relation type associated with the inverse attributes
783
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
784
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
785
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
786
+ * of entities that are related through that attribute.
787
+ *
788
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
789
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
790
+ * representation of the relations indexed by entity expressIDs and relation types.
791
+ * @throws An error if the model does not have properties loaded.
792
+ */
793
+ process(model: FragmentsGroup): Promise<RelationsMap>;
794
+ /**
795
+ * Processes a given model from a WebIfc API to index its IFC entities relations based on predefined inverse attributes.
796
+ *
797
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
798
+ * @param modelID - The unique identifier of the model within the WebIfc API.
799
+ * @returns A promise that resolves to the relations map for the processed model.
800
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
801
+ */
802
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
803
+ /**
804
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
805
+ * This method searches the indexed relation maps for the specified model and entity,
806
+ * returning the IDs of related entities if a match is found.
807
+ *
808
+ * @param model The 'FragmentsGroup' model containing the entity.
809
+ * @param expressID The unique identifier of the entity within the model.
810
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
811
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
812
+ * or the specified relation name is not indexed.
813
+ */
814
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
815
+ /**
816
+ * Serializes the relations of a given relation map into a JSON string.
817
+ * 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,
818
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
819
+ * The resulting object is then serialized into a JSON string.
820
+ *
821
+ * @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.
822
+ * @returns A JSON string representing the serialized relations of the given relation map.
823
+ */
824
+ serializeRelations(relationMap: RelationsMap): string;
825
+ /**
826
+ * Serializes the relations of a specific model into a JSON string.
827
+ * This method iterates through the relations indexed for the given model,
828
+ * organizing them into a structured object where each key is an expressID of an entity,
829
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
830
+ * The resulting object is then serialized into a JSON string.
831
+ *
832
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
833
+ * @returns A JSON string representing the serialized relations of the specified model.
834
+ * If the model has no indexed relations, 'null' is returned.
835
+ */
836
+ serializeModelRelations(model: FragmentsGroup): string | null;
837
+ /**
838
+ * Serializes all relations of every model processed by the indexer into a JSON string.
839
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
840
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
841
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
842
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
843
+ *
844
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
845
+ * If no relations have been indexed, an empty object is returned as a JSON string.
846
+ */
847
+ serializeAllRelations(): string;
848
+ /**
849
+ * Converts a JSON string representing relations between entities into a structured map.
850
+ * This method parses the JSON string to reconstruct the relations map that indexes
851
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
852
+ * and the values are maps where each key is a relation type ID and its value is an array
853
+ * of express IDs of entities related through that relation type.
854
+ *
855
+ * @param json The JSON string to be parsed into the relations map.
856
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
857
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
858
+ * is an array of express IDs (as numbers) of entities related through that relation type.
859
+ */
860
+ getRelationsMapFromJSON(json: string): RelationsMap;
861
+ /**
862
+ * Disposes the component, cleaning up resources and detaching event listeners.
863
+ * This ensures that the component is properly cleaned up and does not leave behind any
864
+ * references that could prevent garbage collection.
865
+ */
866
+ dispose(): void;
955
867
  }
956
- export declare const IfcCategoryMap: {
957
- [key: number]: string;
958
- };
959
- import * as THREE from "three";
960
- export interface MeasureEdge {
961
- distance: number;
962
- points: THREE.Vector3[];
868
+ import * as WEBIFC from "web-ifc";
869
+ import { FragmentsGroup } from "@thatopen/fragments";
870
+ import { Component, Disposable, Event, Components } from "../../core";
871
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
872
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
873
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
874
+ interface ChangeMap {
875
+ [modelID: string]: Set<number>;
963
876
  }
964
- export declare class MeasurementUtils {
965
- static getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
966
- edges: MeasureEdge[];
967
- indices: Set<number>;
968
- } | null;
969
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
970
- private static getFaceData;
971
- static getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
972
- p1: THREE.Vector3;
973
- p2: THREE.Vector3;
974
- p3: THREE.Vector3;
975
- faceNormal: THREE.Vector3;
877
+ interface AttributeListener {
878
+ [modelID: string]: {
879
+ [expressID: number]: {
880
+ [attributeName: string]: Event<String | Boolean | Number>;
881
+ };
976
882
  };
977
- private static round;
883
+ }
884
+ export declare class IfcPropertiesManager extends Component implements Disposable {
885
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
886
+ /** {@link Disposable.onDisposed} */
887
+ readonly onDisposed: Event<string>;
888
+ readonly onRequestFile: Event<unknown>;
889
+ ifcToExport: ArrayBuffer | null;
890
+ readonly onElementToPset: Event<{
891
+ model: FragmentsGroup;
892
+ psetID: number;
893
+ elementID: number;
894
+ }>;
895
+ readonly onPropToPset: Event<{
896
+ model: FragmentsGroup;
897
+ psetID: number;
898
+ propID: number;
899
+ }>;
900
+ readonly onPsetRemoved: Event<{
901
+ model: FragmentsGroup;
902
+ psetID: number;
903
+ }>;
904
+ readonly onDataChanged: Event<{
905
+ model: FragmentsGroup;
906
+ expressID: number;
907
+ }>;
908
+ wasm: {
909
+ path: string;
910
+ absolute: boolean;
911
+ };
912
+ enabled: boolean;
913
+ attributeListeners: AttributeListener;
914
+ selectedModel?: FragmentsGroup;
915
+ private _changeMap;
916
+ constructor(components: Components);
917
+ get(): ChangeMap;
918
+ dispose(): void;
919
+ private increaseMaxID;
920
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
921
+ private newGUID;
922
+ private getOwnerHistory;
923
+ private registerChange;
924
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
925
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
926
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
927
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
928
+ }>;
929
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
930
+ private newSingleProperty;
931
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
932
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
933
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
934
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
935
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
936
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
937
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
938
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
939
+ }
940
+ export {};
941
+ import * as WEBIFC from "web-ifc";
942
+ import { IfcItemsCategories } from "../../../ifc";
943
+ export declare class SpatialStructure {
944
+ itemsByFloor: IfcItemsCategories;
945
+ private _units;
946
+ setUp(webIfc: WEBIFC.IfcAPI): void;
947
+ cleanUp(): void;
978
948
  }
979
949
  export declare const GeometryTypes: Set<number>;
980
950
  import * as THREE from "three";
@@ -1011,18 +981,48 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1011
981
  resize(size?: THREE.Vector2): void;
1012
982
  private updatePlanes;
1013
983
  }
984
+ import * as WEBIFC from "web-ifc";
985
+ export interface IfcItemsCategories {
986
+ [itemID: number]: number;
987
+ }
988
+ export declare class IfcCategories {
989
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
990
+ }
1014
991
  export declare const relToAttributesMap: Map<number, {
1015
992
  forRelating?: "IsDecomposedBy" | "Decomposes" | "AssociatedTo" | "HasAssociations" | "ClassificationForObjects" | "IsGroupedBy" | "HasAssignments" | "IsDefinedBy" | "DefinesOcurrence" | "IsTypedBy" | "Types" | "Defines" | "ContainedInStructure" | "ContainsElements" | undefined;
1016
993
  forRelated?: "IsDecomposedBy" | "Decomposes" | "AssociatedTo" | "HasAssociations" | "ClassificationForObjects" | "IsGroupedBy" | "HasAssignments" | "IsDefinedBy" | "DefinesOcurrence" | "IsTypedBy" | "Types" | "Defines" | "ContainedInStructure" | "ContainsElements" | undefined;
1017
994
  }>;
1018
- import * as WEBIFC from "web-ifc";
1019
- import { IfcItemsCategories } from "../../../ifc";
1020
- export declare class SpatialStructure {
1021
- itemsByFloor: IfcItemsCategories;
1022
- private _units;
1023
- setUp(webIfc: WEBIFC.IfcAPI): void;
1024
- cleanUp(): void;
995
+ export declare const getRelationMap: (properties: Record<string, Record<string, any>>, relationType: number, onElementsFound?: ((relatingID: number, relatedIDs: number[]) => void) | undefined) => {
996
+ [relatingID: number]: number[];
997
+ };
998
+ import * as FRAGS from "@thatopen/fragments";
999
+ export declare class IfcPropertiesUtils {
1000
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
1001
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
1002
+ [attribute: string]: any;
1003
+ } | null>;
1004
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
1005
+ [relatingID: number]: number[];
1006
+ }>;
1007
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
1008
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
1009
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
1010
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
1011
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1012
+ key: string | null;
1013
+ name: string | null;
1014
+ }>;
1015
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1016
+ key: string | null;
1017
+ value: number | null;
1018
+ }>;
1019
+ static isRel(expressID: number): boolean;
1020
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1021
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1025
1022
  }
1023
+ export declare const IfcElements: {
1024
+ [key: number]: string;
1025
+ };
1026
1026
  import * as THREE from "three";
1027
1027
  import { Disposable, Event } from "../../Types";
1028
1028
  /**
@@ -1049,9 +1049,65 @@ export declare class Mouse implements Disposable {
1049
1049
  private updateMouseInfo;
1050
1050
  private setupEvents;
1051
1051
  }
1052
- export declare const getRelationMap: (properties: Record<string, Record<string, any>>, relationType: number, onElementsFound?: ((relatingID: number, relatedIDs: number[]) => void) | undefined) => {
1053
- [relatingID: number]: number[];
1052
+ export declare const IfcCategoryMap: {
1053
+ [key: number]: string;
1054
1054
  };
1055
+ import * as WEBIFC from "web-ifc";
1056
+ /** Configuration of the IFC-fragment conversion. */
1057
+ export declare class IfcFragmentSettings {
1058
+ /** Whether to extract the IFC properties into a JSON. */
1059
+ includeProperties: boolean;
1060
+ /**
1061
+ * Generate the geometry for categories that are not included by default,
1062
+ * like IFCSPACE.
1063
+ */
1064
+ optionalCategories: number[];
1065
+ /** Whether to use the coordination data coming from the IFC files. */
1066
+ coordinate: boolean;
1067
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1068
+ wasm: {
1069
+ path: string;
1070
+ absolute: boolean;
1071
+ logLevel?: WEBIFC.LogLevel;
1072
+ };
1073
+ /** List of categories that won't be converted to fragments. */
1074
+ excludedCategories: Set<number>;
1075
+ /** Whether to save the absolute location of all IFC items. */
1076
+ saveLocations: boolean;
1077
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1078
+ webIfc: WEBIFC.LoaderSettings;
1079
+ autoSetWasm: boolean;
1080
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1081
+ }
1082
+ import * as THREE from "three";
1083
+ import * as WEBIFC from "web-ifc";
1084
+ import * as FRAGS from "@thatopen/fragments";
1085
+ export declare class CivilReader {
1086
+ defLineMat: THREE.LineBasicMaterial;
1087
+ read(webIfc: WEBIFC.IfcAPI): {
1088
+ alignments: Map<number, FRAGS.Alignment>;
1089
+ coordinationMatrix: THREE.Matrix4;
1090
+ } | undefined;
1091
+ get(civilItems: any): {
1092
+ alignments: Map<number, FRAGS.Alignment>;
1093
+ coordinationMatrix: THREE.Matrix4;
1094
+ } | undefined;
1095
+ private getCurves;
1096
+ }
1097
+ import * as WEBIFC from "web-ifc";
1098
+ export declare class IfcMetadataReader {
1099
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1100
+ }
1101
+ import * as WEBIFC from "web-ifc";
1102
+ import * as THREE from "three";
1103
+ export declare class Units {
1104
+ factor: number;
1105
+ complement: number;
1106
+ apply(matrix: THREE.Matrix4): void;
1107
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1108
+ private getLengthUnits;
1109
+ private getScaleMatrix;
1110
+ }
1055
1111
  import * as THREE from "three";
1056
1112
  import { Components } from "../../Components";
1057
1113
  import { Event, World, Disposable } from "../../Types";
@@ -1088,278 +1144,333 @@ export declare class SimpleRaycaster implements Disposable {
1088
1144
  private intersect;
1089
1145
  private filterClippingPlanes;
1090
1146
  }
1091
- import { NavigationMode } from "./types";
1092
- /**
1093
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1094
- * like many BIM tools.
1095
- */
1096
- export declare class PlanMode implements NavigationMode {
1097
- private camera;
1098
- /** {@link NavigationMode.enabled} */
1099
- enabled: boolean;
1100
- /** {@link NavigationMode.id} */
1101
- readonly id = "Plan";
1102
- private mouseAction1?;
1103
- private mouseAction2?;
1104
- private mouseInitialized;
1105
- private readonly defaultAzimuthSpeed;
1106
- private readonly defaultPolarSpeed;
1107
- constructor(camera: any);
1108
- /** {@link NavigationMode.set} */
1109
- set(active: boolean): void;
1147
+ import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1148
+ /** Configuration of the IFC-fragment streaming. */
1149
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1150
+ minGeometrySize: number;
1151
+ minAssetsSize: number;
1110
1152
  }
1111
- import { NavigationMode } from "./types";
1112
- /**
1113
- * A {@link NavigationMode} that allows 3D navigation and panning
1114
- * like in many 3D and CAD softwares.
1115
- */
1116
- export declare class OrbitMode implements NavigationMode {
1117
- camera: any;
1118
- /** {@link NavigationMode.enabled} */
1119
- enabled: boolean;
1120
- /** {@link NavigationMode.id} */
1121
- readonly id = "Orbit";
1122
- constructor(camera: any);
1123
- /** {@link NavigationMode.set} */
1124
- set(active: boolean): void;
1125
- private activateOrbitControls;
1153
+ /** Configuration of the IFC-fragment streaming. */
1154
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1155
+ propertiesSize: number;
1126
1156
  }
1127
- /**
1128
- * The projection system of the camera.
1129
- */
1130
- export type CameraProjection = "Perspective" | "Orthographic";
1131
- /**
1132
- * The extensible list of supported navigation modes.
1133
- */
1134
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1135
- /**
1136
- * An object that determines the behavior of the camera controls
1137
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1138
- */
1139
- export interface NavigationMode {
1140
- /** The unique ID of this navigation mode. */
1141
- id: NavModeID;
1142
- /**
1143
- * Enable or disable this navigation mode.
1144
- * When a new navigation mode is enabled, the previous navigation mode
1145
- * must be disabled.
1146
- *
1147
- * @param active - whether to enable or disable this mode.
1148
- * @param options - any additional data required to enable or disable it.
1149
- * */
1150
- set: (active: boolean, options?: any) => void;
1151
- /** Whether this navigation mode is active or not. */
1157
+ export interface StreamedGeometries {
1158
+ [id: number]: {
1159
+ boundingBox: Float32Array;
1160
+ hasHoles: boolean;
1161
+ geometryFile?: string;
1162
+ };
1163
+ }
1164
+ export interface StreamedAsset {
1165
+ id: number;
1166
+ geometries: {
1167
+ geometryID: number;
1168
+ transformation: number[];
1169
+ color: number[];
1170
+ }[];
1171
+ }
1172
+ import * as WEBIFC from "web-ifc";
1173
+ import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1174
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1175
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1176
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1177
+ onPropertiesStreamed: AsyncEvent<{
1178
+ type: number;
1179
+ data: {
1180
+ [id: number]: any;
1181
+ };
1182
+ }>;
1183
+ onProgress: AsyncEvent<number>;
1184
+ onIndicesStreamed: AsyncEvent<number[][]>;
1185
+ /** {@link Disposable.onDisposed} */
1186
+ readonly onDisposed: Event<string>;
1152
1187
  enabled: boolean;
1188
+ settings: PropertiesStreamingSettings;
1189
+ webIfc: WEBIFC.IfcAPI;
1190
+ dispose(): Promise<void>;
1191
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1192
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1193
+ private readIfcFile;
1194
+ private streamIfcFile;
1195
+ private streamAllProperties;
1196
+ private getIndices;
1197
+ private cleanUp;
1153
1198
  }
1154
1199
  import * as THREE from "three";
1155
- import { CameraProjection } from "./types";
1156
- import { Event } from "../../../core";
1157
- import { OrthoPerspectiveCamera } from "../index";
1158
- /**
1159
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1160
- */
1161
- export declare class ProjectionManager {
1162
- /**
1163
- * Event that fires when the {@link CameraProjection} changes.
1164
- */
1165
- readonly onChanged: Event<THREE.Camera>;
1166
- current: CameraProjection;
1167
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1168
- private _component;
1169
- private _previousDistance;
1170
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1171
- matchOrthoDistanceEnabled: boolean;
1172
- constructor(camera: OrthoPerspectiveCamera);
1173
- /**
1174
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1175
- *
1176
- * @param projection - the new projection to set. If it is the current projection,
1177
- * it will have no effect.
1178
- */
1179
- set(projection: CameraProjection): Promise<void>;
1200
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1201
+ import { Components } from "../../Components";
1202
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1180
1203
  /**
1181
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1182
- * and vice versa.
1204
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1183
1205
  */
1184
- toggle(): Promise<void>;
1185
- private setOrthoCamera;
1186
- private getDims;
1187
- private setupOrthoCamera;
1188
- private getDistance;
1189
- private setPerspectiveCamera;
1206
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1207
+ readonly onAfterUpdate: Event<unknown>;
1208
+ readonly onBeforeUpdate: Event<unknown>;
1209
+ enabled: boolean;
1210
+ uuid: string;
1211
+ readonly onDisposed: Event<unknown>;
1212
+ private _scene?;
1213
+ private _camera?;
1214
+ private _renderer;
1215
+ get scene(): T;
1216
+ set scene(scene: T);
1217
+ get camera(): U;
1218
+ set camera(camera: U);
1219
+ get renderer(): S | null;
1220
+ set renderer(renderer: S | null);
1221
+ constructor(components: Components);
1222
+ update(delta?: number): void;
1223
+ dispose(disposeResources?: boolean): void;
1190
1224
  }
1191
- import { NavigationMode } from "./types";
1225
+ import * as THREE from "three";
1226
+ import { BaseRenderer, Event } from "../../Types";
1227
+ import { Components } from "../../Components";
1192
1228
  /**
1193
- * A {@link NavigationMode} that allows first person navigation,
1194
- * simulating FPS video games.
1229
+ * A basic renderer capable of rendering
1230
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1195
1231
  */
1196
- export declare class FirstPersonMode implements NavigationMode {
1197
- private camera;
1198
- /** {@link NavigationMode.enabled} */
1232
+ export declare class SimpleRenderer extends BaseRenderer {
1199
1233
  enabled: boolean;
1200
- /** {@link NavigationMode.id} */
1201
- readonly id = "FirstPerson";
1202
- constructor(camera: any);
1203
- /** {@link NavigationMode.set} */
1204
- set(active: boolean): void;
1205
- private setupFirstPersonCamera;
1234
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1235
+ container: HTMLElement;
1236
+ three: THREE.WebGLRenderer;
1237
+ protected _canvas: HTMLCanvasElement;
1238
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1239
+ protected _resizeObserver: ResizeObserver | null;
1240
+ protected onContainerUpdated: Event<HTMLElement>;
1241
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1242
+ /** {@link Updateable.update} */
1243
+ update(): void;
1244
+ /** {@link Disposable.dispose} */
1245
+ dispose(): void;
1246
+ /** {@link Resizeable.getSize}. */
1247
+ getSize(): THREE.Vector2;
1248
+ /** {@link Resizeable.resize} */
1249
+ resize: (size?: THREE.Vector2) => void;
1250
+ setupEvents(active: boolean): void;
1251
+ private resizeEvent;
1252
+ private setupRenderer;
1253
+ private onContextLost;
1254
+ private onContextBack;
1206
1255
  }
1256
+ import * as THREE from "three";
1257
+ import CameraControls from "camera-controls";
1258
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1259
+ import { Components } from "../../Components";
1207
1260
  /**
1208
- * Simple event handler by
1209
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1210
- * Keep in mind that:
1211
- * - If you want to remove it later, you might want to declare the callback as
1212
- * an object.
1213
- * - If you want to maintain the reference to 'this', you will need to declare
1214
- * the callback as an arrow function.
1261
+ * A basic camera that uses
1262
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1263
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1264
+ * what features it offers.
1215
1265
  */
1216
- export declare class Event<T> {
1266
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1267
+ /** {@link Updateable.onBeforeUpdate} */
1268
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1269
+ /** {@link Updateable.onAfterUpdate} */
1270
+ readonly onAfterUpdate: Event<SimpleCamera>;
1271
+ readonly onAspectUpdated: Event<unknown>;
1272
+ /** {@link Disposable.onDisposed} */
1273
+ readonly onDisposed: Event<string>;
1274
+ readonly three: THREE.PerspectiveCamera;
1275
+ private _allControls;
1217
1276
  /**
1218
- * Add a callback to this event instance.
1219
- * @param handler - the callback to be added to this event.
1277
+ * The object that controls the camera. An instance of
1278
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1279
+ * Transforming the camera directly will have no effect: you need to use this
1280
+ * object to move, rotate, look at objects, etc.
1220
1281
  */
1221
- add(handler: T extends void ? {
1222
- (): void;
1223
- } : {
1224
- (data: T): void;
1225
- }): void;
1282
+ get controls(): CameraControls;
1283
+ /** {@link Component.enabled} */
1284
+ get enabled(): boolean;
1285
+ /** {@link Component.enabled} */
1286
+ set enabled(enabled: boolean);
1287
+ constructor(components: Components);
1288
+ /** {@link Disposable.dispose} */
1289
+ dispose(): void;
1290
+ /** {@link Updateable.update} */
1291
+ update(_delta: number): void;
1226
1292
  /**
1227
- * Removes a callback from this event instance.
1228
- * @param handler - the callback to be removed from this event.
1293
+ * Updates the aspect of the camera to match the size of the
1294
+ * {@link Components.renderer}.
1229
1295
  */
1230
- remove(handler: T extends void ? {
1231
- (): void;
1232
- } : {
1233
- (data: T): void;
1234
- }): void;
1235
- /** Triggers all the callbacks assigned to this event. */
1236
- trigger: (data?: T) => void;
1237
- /** Gets rid of all the suscribed events. */
1238
- reset(): void;
1239
- private handlers;
1296
+ updateAspect: () => void;
1297
+ private setupCamera;
1298
+ private newCameraControls;
1299
+ private setupEvents;
1300
+ private static getSubsetOfThree;
1240
1301
  }
1241
1302
  import * as THREE from "three";
1242
- import CameraControls from "camera-controls";
1243
- import { Event } from "./event";
1244
- /**
1245
- * Whether this component has to be manually destroyed once you are done with
1246
- * it to prevent
1247
- * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1248
- * This also ensures that the DOM events created by that component will be
1249
- * cleaned up.
1250
- */
1251
- export interface Disposable {
1252
- /**
1253
- * Destroys the object from memory to prevent a
1254
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1255
- */
1256
- dispose: () => void | Promise<void>;
1257
- /** Fired after the tool has been {@link Disposable.dispose()} */
1258
- readonly onDisposed: Event<any>;
1303
+ import { BaseScene, Configurable, Event } from "../../Types";
1304
+ import { Components } from "../../Components";
1305
+ export interface SimpleSceneConfig {
1306
+ directionalLight: {
1307
+ color: THREE.Color;
1308
+ intensity: number;
1309
+ position: THREE.Vector3;
1310
+ };
1311
+ ambientLight: {
1312
+ color: THREE.Color;
1313
+ intensity: number;
1314
+ };
1259
1315
  }
1260
1316
  /**
1261
- * Whether the geometric representation of this component can be
1262
- * hidden or shown in the
1263
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1317
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1318
+ * objects hierarchically, and easily dispose them when you are finished with it.
1319
+ * @noInheritDoc
1264
1320
  */
1265
- export interface Hideable {
1266
- /**
1267
- * Whether the geometric representation of this component is
1268
- * currently visible or not in the
1269
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1270
- */
1271
- visible: boolean;
1321
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1322
+ /** {@link Configurable.isSetup} */
1323
+ isSetup: boolean;
1324
+ three: THREE.Scene;
1325
+ /** {@link Configurable.onSetup} */
1326
+ readonly onSetup: Event<SimpleScene>;
1327
+ config: Required<SimpleSceneConfig>;
1328
+ constructor(components: Components);
1329
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1330
+ setup(config?: Partial<SimpleSceneConfig>): void;
1272
1331
  }
1332
+ import * as THREE from "three";
1333
+ import { Hideable, Disposable, Event, World } from "../../Types";
1334
+ import { Components } from "../../Components";
1273
1335
  /**
1274
- * Whether this component can be resized. The meaning of this can vary depending
1275
- * on the component: resizing a
1276
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1277
- * component could mean changing its resolution, whereas resizing a
1278
- * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1336
+ * Each of the planes created by {@link SimpleClipper}.
1279
1337
  */
1280
- export interface Resizeable {
1281
- /**
1282
- * Sets size of this component (e.g. the resolution of a
1283
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1284
- * component.
1285
- */
1286
- resize: (size?: THREE.Vector2) => void;
1287
- /** Event that fires when the component has been resized. */
1288
- onResize: Event<THREE.Vector2>;
1289
- /**
1290
- * Gets the current size of this component (e.g. the resolution of a
1291
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1292
- * component.
1293
- */
1294
- getSize: () => THREE.Vector2;
1295
- }
1296
- /** Whether this component should be updated each frame. */
1297
- export interface Updateable {
1298
- /** Actions that should be executed after updating the component. */
1299
- onAfterUpdate: Event<any>;
1300
- /** Actions that should be executed before updating the component. */
1301
- onBeforeUpdate: Event<any>;
1302
- /**
1303
- * Function used to update the state of this component each frame. For
1304
- * instance, a renderer component will make a render each frame.
1305
- */
1306
- update(delta?: number): void;
1338
+ export declare class SimplePlane implements Disposable, Hideable {
1339
+ /** Event that fires when the user starts dragging a clipping plane. */
1340
+ readonly onDraggingStarted: Event<unknown>;
1341
+ /** Event that fires when the user stops dragging a clipping plane. */
1342
+ readonly onDraggingEnded: Event<unknown>;
1343
+ /** {@link Disposable.onDisposed} */
1344
+ readonly onDisposed: Event<unknown>;
1345
+ readonly normal: THREE.Vector3;
1346
+ readonly origin: THREE.Vector3;
1347
+ readonly three: THREE.Plane;
1348
+ protected readonly _helper: THREE.Object3D;
1349
+ protected _visible: boolean;
1350
+ protected _enabled: boolean;
1351
+ components: Components;
1352
+ world: World;
1353
+ private _controlsActive;
1354
+ private readonly _arrowBoundBox;
1355
+ private readonly _planeMesh;
1356
+ private readonly _controls;
1357
+ private readonly _hiddenMaterial;
1358
+ get enabled(): boolean;
1359
+ /** {@link Component.enabled} */
1360
+ set enabled(state: boolean);
1361
+ /** {@link Hideable.visible } */
1362
+ get visible(): boolean;
1363
+ /** {@link Hideable.visible } */
1364
+ set visible(state: boolean);
1365
+ /** The meshes used for raycasting */
1366
+ get meshes(): THREE.Mesh[];
1367
+ /** The material of the clipping plane representation. */
1368
+ get planeMaterial(): THREE.Material | THREE.Material[];
1369
+ /** The material of the clipping plane representation. */
1370
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
1371
+ /** The size of the clipping plane representation. */
1372
+ get size(): number;
1373
+ /** Sets the size of the clipping plane representation. */
1374
+ set size(size: number);
1375
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1376
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1377
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): Promise<void>;
1378
+ /** {@link Updateable.update} */
1379
+ update: () => Promise<void>;
1380
+ /** {@link Disposable.dispose} */
1381
+ dispose(): void;
1382
+ private reset;
1383
+ protected toggleControls(state: boolean): void;
1384
+ private newTransformControls;
1385
+ private initializeControls;
1386
+ private createArrowBoundingBox;
1387
+ private changeDrag;
1388
+ private notifyDraggingChanged;
1389
+ private preventCameraMovement;
1390
+ private newHelper;
1391
+ private static newPlaneMesh;
1307
1392
  }
1308
- /** Basic type to describe the progress of any kind of process. */
1309
- export interface Progress {
1310
- /** The amount of things that have been done already. */
1311
- current: number;
1312
- /** The total amount of things to be done by the process. */
1313
- total: number;
1393
+ /// <reference types="node" />
1394
+ import * as THREE from "three";
1395
+ import { Hideable, Event, World } from "../../Types";
1396
+ import { Components } from "../../Components";
1397
+ export interface GridConfig {
1398
+ color: THREE.Color;
1399
+ size1: number;
1400
+ size2: number;
1401
+ distance: number;
1314
1402
  }
1315
1403
  /**
1316
- * Whether this component supports create and destroy operations. This generally
1317
- * applies for components that work with instances, such as clipping planes or
1318
- * dimensions.
1404
+ * An infinite grid. Created by
1405
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1406
+ * and translated to typescript by
1407
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1319
1408
  */
1320
- export interface Createable {
1321
- /** Creates a new instance of an element (e.g. a new Dimension). */
1322
- create: (data: any) => void;
1409
+ export declare class SimpleGrid implements Hideable, Disposable {
1410
+ /** {@link Disposable.onDisposed} */
1411
+ readonly onDisposed: Event<unknown>;
1412
+ world: World;
1413
+ components: Components;
1414
+ /** {@link Hideable.visible} */
1415
+ get visible(): boolean;
1416
+ /** {@link Hideable.visible} */
1417
+ set visible(visible: boolean);
1418
+ /** The material of the grid. */
1419
+ get material(): THREE.ShaderMaterial;
1323
1420
  /**
1324
- * Finish the creation process of the component, successfully creating an
1325
- * instance of whatever the component creates.
1421
+ * Whether the grid should fade away with distance. Recommended to be true for
1422
+ * perspective cameras and false for orthographic cameras.
1326
1423
  */
1327
- endCreation?: (data: any) => void;
1424
+ get fade(): boolean;
1328
1425
  /**
1329
- * Cancels the creation process of the component, going back to the state
1330
- * before starting to create.
1426
+ * Whether the grid should fade away with distance. Recommended to be true for
1427
+ * perspective cameras and false for orthographic cameras.
1331
1428
  */
1332
- cancelCreation?: (data: any) => void;
1333
- /** Deletes an existing instance of an element (e.g. a Dimension). */
1334
- delete: (data: any) => void;
1429
+ set fade(active: boolean);
1430
+ private readonly _grid;
1431
+ private _fade;
1432
+ constructor(components: Components, world: World, config: GridConfig);
1433
+ [Symbol.dispose](): void;
1434
+ /** {@link Component.get} */
1435
+ get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1436
+ /** {@link Disposable.dispose} */
1437
+ dispose(): void;
1438
+ private setupEvents;
1439
+ private updateZoom;
1335
1440
  }
1336
1441
  /**
1337
- * Whether this component supports to be configured.
1442
+ * Simple event handler by
1443
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1444
+ * Keep in mind that:
1445
+ * - If you want to remove it later, you might want to declare the callback as
1446
+ * an object.
1447
+ * - If you want to maintain the reference to 'this', you will need to declare
1448
+ * the callback as an arrow function.
1338
1449
  */
1339
- export interface Configurable<T extends Record<string, any>> {
1340
- /** Wether this components has been already configured. */
1341
- isSetup: boolean;
1342
- /** Use the provided configuration to setup the tool. */
1343
- setup: (config?: Partial<T>) => void | Promise<void>;
1344
- /** Fired after successfully calling {@link Configurable.setup()} */
1345
- readonly onSetup: Event<any>;
1346
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1347
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1450
+ export declare class Event<T> {
1451
+ /**
1452
+ * Add a callback to this event instance.
1453
+ * @param handler - the callback to be added to this event.
1348
1454
  */
1349
- config: Required<T>;
1350
- }
1351
- /**
1352
- * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1353
- */
1354
- export interface BVHGeometry extends THREE.BufferGeometry {
1355
- boundsTree: Object | undefined;
1356
- disposeBoundsTree: () => void;
1357
- }
1358
- /**
1359
- * Whether a camera uses the Camera Controls library.
1360
- */
1361
- export interface CameraControllable {
1362
- controls: CameraControls;
1455
+ add(handler: T extends void ? {
1456
+ (): void;
1457
+ } : {
1458
+ (data: T): void;
1459
+ }): void;
1460
+ /**
1461
+ * Removes a callback from this event instance.
1462
+ * @param handler - the callback to be removed from this event.
1463
+ */
1464
+ remove(handler: T extends void ? {
1465
+ (): void;
1466
+ } : {
1467
+ (data: T): void;
1468
+ }): void;
1469
+ /** Triggers all the callbacks assigned to this event. */
1470
+ trigger: (data?: T) => void;
1471
+ /** Gets rid of all the suscribed events. */
1472
+ reset(): void;
1473
+ private handlers;
1363
1474
  }
1364
1475
  /**
1365
1476
  * Simple event handler by
@@ -1395,581 +1506,475 @@ export declare class AsyncEvent<T> {
1395
1506
  reset(): void;
1396
1507
  private handlers;
1397
1508
  }
1398
- import { Base } from "./base";
1399
- /**
1400
- * Components are the building blocks of this library. Components are singleton
1401
- * elements that contain specific functionality. For instance, the SimpleClipper
1402
- * Component can create, delete and handle 3D clipping planes. Components must be
1403
- * unique (they can't be instanced more than once), and have a static UUID that
1404
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1405
- * instance.
1406
- */
1407
- export declare abstract class Component extends Base {
1408
- /**
1409
- * Whether this component is active or not. The behaviour can vary depending
1410
- * on the type of component. E.g. a disabled dimension tool will stop creating
1411
- * dimensions, while a disabled camera will stop moving. A disabled component
1412
- * will not be updated automatically each frame.
1413
- */
1414
- abstract enabled: boolean;
1415
- }
1416
1509
  import * as THREE from "three";
1417
1510
  import CameraControls from "camera-controls";
1418
- import { BaseWorldItem } from "./base-world-item";
1419
- import { CameraControllable } from "./interfaces";
1420
- export declare abstract class BaseCamera extends BaseWorldItem {
1421
- abstract enabled: boolean;
1422
- abstract three: THREE.Camera;
1423
- abstract controls?: CameraControls;
1424
- /** Whether is instance is {@link CameraControllable}. */
1425
- hasCameraControls: () => this is CameraControllable;
1426
- }
1427
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1428
- import { Components } from "../../Components";
1429
- /**
1430
- * Base class of the library. Useful for finding out the interfaces it implements.
1431
- */
1432
- export declare abstract class Base {
1433
- components: Components;
1434
- constructor(components: Components);
1435
- /** Whether is component is {@link Disposable}. */
1436
- isDisposeable: () => this is Disposable;
1437
- /** Whether is component is {@link Resizeable}. */
1438
- isResizeable: () => this is Resizeable;
1439
- /** Whether is component is {@link Updateable}. */
1440
- isUpdateable: () => this is Updateable;
1441
- /** Whether is component is {@link Hideable}. */
1442
- isHideable: () => this is Hideable;
1443
- /** Whether is component is {@link Configurable}. */
1444
- isConfigurable: () => this is Configurable<any>;
1445
- }
1446
- import { Base } from "./base";
1447
- import { World } from "./world";
1448
1511
  import { Event } from "./event";
1449
- import { Components } from "../../Components";
1450
1512
  /**
1451
- * One of the elements that make a world. It can be either a scene, a camera
1452
- * or a renderer.
1513
+ * Whether this component has to be manually destroyed once you are done with
1514
+ * it to prevent
1515
+ * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1516
+ * This also ensures that the DOM events created by that component will be
1517
+ * cleaned up.
1453
1518
  */
1454
- export declare abstract class BaseWorldItem extends Base {
1455
- readonly worlds: Map<string, World>;
1456
- readonly onWorldChanged: Event<{
1457
- world: World;
1458
- action: "added" | "removed";
1459
- }>;
1460
- currentWorld: World | null;
1461
- protected constructor(components: Components);
1462
- }
1463
- import * as THREE from "three";
1464
- import { Vector2 } from "three";
1465
- import { Event } from "./event";
1466
- import { BaseWorldItem } from "./base-world-item";
1467
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1468
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1469
- abstract three: THREE.WebGLRenderer;
1470
- /** {@link Updateable.onBeforeUpdate} */
1471
- onAfterUpdate: Event<unknown>;
1472
- /** {@link Updateable.onAfterUpdate} */
1473
- onBeforeUpdate: Event<unknown>;
1474
- /** {@link Disposable.onDisposed} */
1475
- readonly onDisposed: Event<undefined>;
1476
- readonly onResize: Event<THREE.Vector2>;
1477
- /**
1478
- * Event that fires when there has been a change to the list of clipping
1479
- * planes used by the active renderer.
1480
- */
1481
- readonly onClippingPlanesUpdated: Event<unknown>;
1482
- abstract update(delta?: number): void | Promise<void>;
1483
- abstract dispose(): void;
1484
- abstract getSize(): Vector2;
1485
- abstract resize(size: Vector2 | undefined): void;
1486
- /**
1487
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1488
- * instance of the renderer.
1489
- */
1490
- clippingPlanes: THREE.Plane[];
1519
+ export interface Disposable {
1491
1520
  /**
1492
- * Forces the update of the clipping planes and all components that depend
1493
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1521
+ * Destroys the object from memory to prevent a
1522
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1494
1523
  */
1495
- updateClippingPlanes(): void;
1524
+ dispose: () => void | Promise<void>;
1525
+ /** Fired after the tool has been {@link Disposable.dispose()} */
1526
+ readonly onDisposed: Event<any>;
1527
+ }
1528
+ /**
1529
+ * Whether the geometric representation of this component can be
1530
+ * hidden or shown in the
1531
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1532
+ */
1533
+ export interface Hideable {
1496
1534
  /**
1497
- * Adds or removes a
1498
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1499
- * to the renderer.
1535
+ * Whether the geometric representation of this component is
1536
+ * currently visible or not in the
1537
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1500
1538
  */
1501
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1502
- }
1503
- import * as THREE from "three";
1504
- import { Disposable } from "./interfaces";
1505
- import { Event } from "./event";
1506
- import { Components } from "../../Components";
1507
- import { BaseWorldItem } from "./base-world-item";
1508
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1509
- /** {@link Disposable.onDisposed} */
1510
- readonly onDisposed: Event<unknown>;
1511
- abstract three: THREE.Object3D;
1512
- protected constructor(components: Components);
1513
- /** {@link Disposable.dispose} */
1514
- dispose(): void;
1515
- }
1516
- import * as THREE from "three";
1517
- import { BaseScene } from "./base-scene";
1518
- import { BaseCamera } from "./base-camera";
1519
- import { BaseRenderer } from "./base-renderer";
1520
- import { Updateable, Disposable } from "./interfaces";
1521
- export interface World extends Disposable, Updateable {
1522
- meshes: Set<THREE.Mesh>;
1523
- scene: BaseScene;
1524
- camera: BaseCamera;
1525
- renderer: BaseRenderer | null;
1526
- uuid: string;
1539
+ visible: boolean;
1527
1540
  }
1528
- import * as THREE from "three";
1529
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1530
- import { Components } from "../../Components";
1531
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1541
+ /**
1542
+ * Whether this component can be resized. The meaning of this can vary depending
1543
+ * on the component: resizing a
1544
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1545
+ * component could mean changing its resolution, whereas resizing a
1546
+ * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1547
+ */
1548
+ export interface Resizeable {
1532
1549
  /**
1533
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1550
+ * Sets size of this component (e.g. the resolution of a
1551
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1552
+ * component.
1553
+ */
1554
+ resize: (size?: THREE.Vector2) => void;
1555
+ /** Event that fires when the component has been resized. */
1556
+ onResize: Event<THREE.Vector2>;
1557
+ /**
1558
+ * Gets the current size of this component (e.g. the resolution of a
1559
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1560
+ * component.
1561
+ */
1562
+ getSize: () => THREE.Vector2;
1563
+ }
1564
+ /** Whether this component should be updated each frame. */
1565
+ export interface Updateable {
1566
+ /** Actions that should be executed after updating the component. */
1567
+ onAfterUpdate: Event<any>;
1568
+ /** Actions that should be executed before updating the component. */
1569
+ onBeforeUpdate: Event<any>;
1570
+ /**
1571
+ * Function used to update the state of this component each frame. For
1572
+ * instance, a renderer component will make a render each frame.
1534
1573
  */
1535
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1536
- readonly onAfterUpdate: Event<unknown>;
1537
- readonly onBeforeUpdate: Event<unknown>;
1538
- enabled: boolean;
1539
- uuid: string;
1540
- readonly onDisposed: Event<unknown>;
1541
- private _scene?;
1542
- private _camera?;
1543
- private _renderer;
1544
- get scene(): T;
1545
- set scene(scene: T);
1546
- get camera(): U;
1547
- set camera(camera: U);
1548
- get renderer(): S | null;
1549
- set renderer(renderer: S | null);
1550
- constructor(components: Components);
1551
1574
  update(delta?: number): void;
1552
- dispose(disposeResources?: boolean): void;
1553
1575
  }
1554
- /// <reference types="node" />
1555
- import * as THREE from "three";
1556
- import { Hideable, Event, World } from "../../Types";
1557
- import { Components } from "../../Components";
1558
- export interface GridConfig {
1559
- color: THREE.Color;
1560
- size1: number;
1561
- size2: number;
1562
- distance: number;
1576
+ /** Basic type to describe the progress of any kind of process. */
1577
+ export interface Progress {
1578
+ /** The amount of things that have been done already. */
1579
+ current: number;
1580
+ /** The total amount of things to be done by the process. */
1581
+ total: number;
1563
1582
  }
1564
1583
  /**
1565
- * An infinite grid. Created by
1566
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1567
- * and translated to typescript by
1568
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1584
+ * Whether this component supports create and destroy operations. This generally
1585
+ * applies for components that work with instances, such as clipping planes or
1586
+ * dimensions.
1569
1587
  */
1570
- export declare class SimpleGrid implements Hideable, Disposable {
1571
- /** {@link Disposable.onDisposed} */
1572
- readonly onDisposed: Event<unknown>;
1573
- world: World;
1574
- components: Components;
1575
- /** {@link Hideable.visible} */
1576
- get visible(): boolean;
1577
- /** {@link Hideable.visible} */
1578
- set visible(visible: boolean);
1579
- /** The material of the grid. */
1580
- get material(): THREE.ShaderMaterial;
1588
+ export interface Createable {
1589
+ /** Creates a new instance of an element (e.g. a new Dimension). */
1590
+ create: (data: any) => void;
1581
1591
  /**
1582
- * Whether the grid should fade away with distance. Recommended to be true for
1583
- * perspective cameras and false for orthographic cameras.
1592
+ * Finish the creation process of the component, successfully creating an
1593
+ * instance of whatever the component creates.
1584
1594
  */
1585
- get fade(): boolean;
1595
+ endCreation?: (data: any) => void;
1586
1596
  /**
1587
- * Whether the grid should fade away with distance. Recommended to be true for
1588
- * perspective cameras and false for orthographic cameras.
1597
+ * Cancels the creation process of the component, going back to the state
1598
+ * before starting to create.
1589
1599
  */
1590
- set fade(active: boolean);
1591
- private readonly _grid;
1592
- private _fade;
1593
- constructor(components: Components, world: World, config: GridConfig);
1594
- [Symbol.dispose](): void;
1595
- /** {@link Component.get} */
1596
- get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1597
- /** {@link Disposable.dispose} */
1598
- dispose(): void;
1599
- private setupEvents;
1600
- private updateZoom;
1601
- }
1602
- import * as THREE from "three";
1603
- import { BaseScene, Configurable, Event } from "../../Types";
1604
- import { Components } from "../../Components";
1605
- export interface SimpleSceneConfig {
1606
- directionalLight: {
1607
- color: THREE.Color;
1608
- intensity: number;
1609
- position: THREE.Vector3;
1610
- };
1611
- ambientLight: {
1612
- color: THREE.Color;
1613
- intensity: number;
1614
- };
1600
+ cancelCreation?: (data: any) => void;
1601
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
1602
+ delete: (data: any) => void;
1615
1603
  }
1616
1604
  /**
1617
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1618
- * objects hierarchically, and easily dispose them when you are finished with it.
1619
- * @noInheritDoc
1605
+ * Whether this component supports to be configured.
1620
1606
  */
1621
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1622
- /** {@link Configurable.isSetup} */
1607
+ export interface Configurable<T extends Record<string, any>> {
1608
+ /** Wether this components has been already configured. */
1623
1609
  isSetup: boolean;
1624
- three: THREE.Scene;
1625
- /** {@link Configurable.onSetup} */
1626
- readonly onSetup: Event<SimpleScene>;
1627
- config: Required<SimpleSceneConfig>;
1628
- constructor(components: Components);
1629
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1630
- setup(config?: Partial<SimpleSceneConfig>): void;
1610
+ /** Use the provided configuration to setup the tool. */
1611
+ setup: (config?: Partial<T>) => void | Promise<void>;
1612
+ /** Fired after successfully calling {@link Configurable.setup()} */
1613
+ readonly onSetup: Event<any>;
1614
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1615
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1616
+ */
1617
+ config: Required<T>;
1631
1618
  }
1632
- import * as THREE from "three";
1633
- import CameraControls from "camera-controls";
1634
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1635
- import { Components } from "../../Components";
1636
1619
  /**
1637
- * A basic camera that uses
1638
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1639
- * easily control the camera in 2D and 3D. Check out it's API to find out
1640
- * what features it offers.
1620
+ * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1641
1621
  */
1642
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1643
- /** {@link Updateable.onBeforeUpdate} */
1644
- readonly onBeforeUpdate: Event<SimpleCamera>;
1645
- /** {@link Updateable.onAfterUpdate} */
1646
- readonly onAfterUpdate: Event<SimpleCamera>;
1647
- readonly onAspectUpdated: Event<unknown>;
1648
- /** {@link Disposable.onDisposed} */
1649
- readonly onDisposed: Event<string>;
1650
- readonly three: THREE.PerspectiveCamera;
1651
- private _allControls;
1652
- /**
1653
- * The object that controls the camera. An instance of
1654
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1655
- * Transforming the camera directly will have no effect: you need to use this
1656
- * object to move, rotate, look at objects, etc.
1657
- */
1658
- get controls(): CameraControls;
1659
- /** {@link Component.enabled} */
1660
- get enabled(): boolean;
1661
- /** {@link Component.enabled} */
1662
- set enabled(enabled: boolean);
1663
- constructor(components: Components);
1664
- /** {@link Disposable.dispose} */
1665
- dispose(): void;
1666
- /** {@link Updateable.update} */
1667
- update(_delta: number): void;
1622
+ export interface BVHGeometry extends THREE.BufferGeometry {
1623
+ boundsTree: Object | undefined;
1624
+ disposeBoundsTree: () => void;
1625
+ }
1626
+ /**
1627
+ * Whether a camera uses the Camera Controls library.
1628
+ */
1629
+ export interface CameraControllable {
1630
+ controls: CameraControls;
1631
+ }
1632
+ import { Base } from "./base";
1633
+ /**
1634
+ * Components are the building blocks of this library. Components are singleton
1635
+ * elements that contain specific functionality. For instance, the SimpleClipper
1636
+ * Component can create, delete and handle 3D clipping planes. Components must be
1637
+ * unique (they can't be instanced more than once), and have a static UUID that
1638
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1639
+ * instance.
1640
+ */
1641
+ export declare abstract class Component extends Base {
1668
1642
  /**
1669
- * Updates the aspect of the camera to match the size of the
1670
- * {@link Components.renderer}.
1643
+ * Whether this component is active or not. The behaviour can vary depending
1644
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1645
+ * dimensions, while a disabled camera will stop moving. A disabled component
1646
+ * will not be updated automatically each frame.
1671
1647
  */
1672
- updateAspect: () => void;
1673
- private setupCamera;
1674
- private newCameraControls;
1675
- private setupEvents;
1676
- private static getSubsetOfThree;
1648
+ abstract enabled: boolean;
1677
1649
  }
1678
- import * as THREE from "three";
1679
- import { BaseRenderer, Event } from "../../Types";
1650
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1680
1651
  import { Components } from "../../Components";
1681
1652
  /**
1682
- * A basic renderer capable of rendering
1683
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1653
+ * Base class of the library. Useful for finding out the interfaces it implements.
1684
1654
  */
1685
- export declare class SimpleRenderer extends BaseRenderer {
1686
- enabled: boolean;
1687
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1688
- container: HTMLElement;
1689
- three: THREE.WebGLRenderer;
1690
- protected _canvas: HTMLCanvasElement;
1691
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1692
- protected _resizeObserver: ResizeObserver | null;
1693
- protected onContainerUpdated: Event<HTMLElement>;
1694
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1695
- /** {@link Updateable.update} */
1696
- update(): void;
1697
- /** {@link Disposable.dispose} */
1698
- dispose(): void;
1699
- /** {@link Resizeable.getSize}. */
1700
- getSize(): THREE.Vector2;
1701
- /** {@link Resizeable.resize} */
1702
- resize: (size?: THREE.Vector2) => void;
1703
- setupEvents(active: boolean): void;
1704
- private resizeEvent;
1705
- private setupRenderer;
1706
- private onContextLost;
1707
- private onContextBack;
1655
+ export declare abstract class Base {
1656
+ components: Components;
1657
+ constructor(components: Components);
1658
+ /** Whether is component is {@link Disposable}. */
1659
+ isDisposeable: () => this is Disposable;
1660
+ /** Whether is component is {@link Resizeable}. */
1661
+ isResizeable: () => this is Resizeable;
1662
+ /** Whether is component is {@link Updateable}. */
1663
+ isUpdateable: () => this is Updateable;
1664
+ /** Whether is component is {@link Hideable}. */
1665
+ isHideable: () => this is Hideable;
1666
+ /** Whether is component is {@link Configurable}. */
1667
+ isConfigurable: () => this is Configurable<any>;
1708
1668
  }
1709
- import * as THREE from "three";
1669
+ import { Base } from "./base";
1670
+ import { World } from "./world";
1671
+ import { Event } from "./event";
1710
1672
  import { Components } from "../../Components";
1711
- import { AsyncEvent, Event, World } from "../../Types";
1712
- export interface CullerRendererSettings {
1713
- updateInterval?: number;
1714
- width?: number;
1715
- height?: number;
1716
- autoUpdate?: boolean;
1717
- }
1718
1673
  /**
1719
- * A base renderer to determine visibility on screen
1674
+ * One of the elements that make a world. It can be either a scene, a camera
1675
+ * or a renderer.
1720
1676
  */
1721
- export declare class CullerRenderer {
1677
+ export declare abstract class BaseWorldItem extends Base {
1678
+ readonly worlds: Map<string, World>;
1679
+ readonly onWorldChanged: Event<{
1680
+ world: World;
1681
+ action: "added" | "removed";
1682
+ }>;
1683
+ currentWorld: World | null;
1684
+ protected constructor(components: Components);
1685
+ }
1686
+ import * as THREE from "three";
1687
+ import { Vector2 } from "three";
1688
+ import { Event } from "./event";
1689
+ import { BaseWorldItem } from "./base-world-item";
1690
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1691
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1692
+ abstract three: THREE.WebGLRenderer;
1693
+ /** {@link Updateable.onBeforeUpdate} */
1694
+ onAfterUpdate: Event<unknown>;
1695
+ /** {@link Updateable.onAfterUpdate} */
1696
+ onBeforeUpdate: Event<unknown>;
1722
1697
  /** {@link Disposable.onDisposed} */
1723
- readonly onDisposed: Event<string>;
1698
+ readonly onDisposed: Event<undefined>;
1699
+ readonly onResize: Event<THREE.Vector2>;
1724
1700
  /**
1725
- * Fires after making the visibility check to the meshes. It lists the
1726
- * meshes that are currently visible, and the ones that were visible
1727
- * just before but not anymore.
1701
+ * Event that fires when there has been a change to the list of clipping
1702
+ * planes used by the active renderer.
1728
1703
  */
1729
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1730
- /** {@link Component.enabled} */
1731
- enabled: boolean;
1704
+ readonly onClippingPlanesUpdated: Event<unknown>;
1705
+ abstract update(delta?: number): void | Promise<void>;
1706
+ abstract dispose(): void;
1707
+ abstract getSize(): Vector2;
1708
+ abstract resize(size: Vector2 | undefined): void;
1732
1709
  /**
1733
- * Needs to check whether there are objects that need to be hidden or shown.
1734
- * You can bind this to the camera movement, to a certain interval, etc.
1710
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1711
+ * instance of the renderer.
1735
1712
  */
1736
- needsUpdate: boolean;
1713
+ clippingPlanes: THREE.Plane[];
1737
1714
  /**
1738
- * Render the internal scene used to determine the object visibility. Used
1739
- * for debugging purposes.
1715
+ * Forces the update of the clipping planes and all components that depend
1716
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1740
1717
  */
1741
- renderDebugFrame: boolean;
1742
- components: Components;
1743
- readonly world: World;
1744
- readonly renderer: THREE.WebGLRenderer;
1745
- protected autoUpdate: boolean;
1746
- protected updateInterval: number;
1747
- protected readonly worker: Worker;
1748
- protected readonly scene: THREE.Scene;
1749
- private _width;
1750
- private _height;
1751
- private _availableColor;
1752
- private readonly renderTarget;
1753
- private readonly bufferSize;
1754
- private readonly _buffer;
1755
- protected _isWorkerBusy: boolean;
1756
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1757
- /** {@link Disposable.dispose} */
1758
- dispose(): void;
1718
+ updateClippingPlanes(): void;
1759
1719
  /**
1760
- * The function that the culler uses to reprocess the scene. Generally it's
1761
- * better to call needsUpdate, but you can also call this to force it.
1762
- * @param force if true, it will refresh the scene even if needsUpdate is
1763
- * not true.
1720
+ * Adds or removes a
1721
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1722
+ * to the renderer.
1764
1723
  */
1765
- updateVisibility: (force?: boolean) => Promise<void>;
1766
- protected getAvailableColor(): {
1767
- r: number;
1768
- g: number;
1769
- b: number;
1770
- code: string;
1771
- };
1772
- protected increaseColor(): void;
1773
- protected decreaseColor(): void;
1774
- private applySettings;
1775
- }
1776
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1777
- import * as THREE from "three";
1778
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1779
- import { Components } from "../../Components";
1780
- import { Event, World } from "../../Types";
1781
- /**
1782
- * A renderer to determine a mesh visibility on screen
1783
- */
1784
- export declare class MeshCullerRenderer extends CullerRenderer {
1785
- threshold: number;
1786
- readonly onViewUpdated: Event<{
1787
- seen: Set<THREE.Mesh>;
1788
- unseen: Set<THREE.Mesh>;
1789
- }>;
1790
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1791
- isProcessing: boolean;
1792
- private _colorCodeMeshMap;
1793
- private _meshIDColorCodeMap;
1794
- private _currentVisibleMeshes;
1795
- private _recentlyHiddenMeshes;
1796
- private _intervalID;
1797
- private readonly _transparentMat;
1798
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1799
- dispose(): void;
1800
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1801
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1802
- private handleWorkerMessage;
1803
- private getAvailableMaterial;
1724
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1804
1725
  }
1805
1726
  import * as THREE from "three";
1806
- import { Hideable, Disposable, Event, World } from "../../Types";
1727
+ import { Disposable } from "./interfaces";
1728
+ import { Event } from "./event";
1807
1729
  import { Components } from "../../Components";
1808
- /**
1809
- * Each of the planes created by {@link SimpleClipper}.
1810
- */
1811
- export declare class SimplePlane implements Disposable, Hideable {
1812
- /** Event that fires when the user starts dragging a clipping plane. */
1813
- readonly onDraggingStarted: Event<unknown>;
1814
- /** Event that fires when the user stops dragging a clipping plane. */
1815
- readonly onDraggingEnded: Event<unknown>;
1730
+ import { BaseWorldItem } from "./base-world-item";
1731
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1816
1732
  /** {@link Disposable.onDisposed} */
1817
1733
  readonly onDisposed: Event<unknown>;
1818
- readonly normal: THREE.Vector3;
1819
- readonly origin: THREE.Vector3;
1820
- readonly three: THREE.Plane;
1821
- protected readonly _helper: THREE.Object3D;
1822
- protected _visible: boolean;
1823
- protected _enabled: boolean;
1824
- components: Components;
1825
- world: World;
1826
- private _controlsActive;
1827
- private readonly _arrowBoundBox;
1828
- private readonly _planeMesh;
1829
- private readonly _controls;
1830
- private readonly _hiddenMaterial;
1831
- get enabled(): boolean;
1832
- /** {@link Component.enabled} */
1833
- set enabled(state: boolean);
1834
- /** {@link Hideable.visible } */
1835
- get visible(): boolean;
1836
- /** {@link Hideable.visible } */
1837
- set visible(state: boolean);
1838
- /** The meshes used for raycasting */
1839
- get meshes(): THREE.Mesh[];
1840
- /** The material of the clipping plane representation. */
1841
- get planeMaterial(): THREE.Material | THREE.Material[];
1842
- /** The material of the clipping plane representation. */
1843
- set planeMaterial(material: THREE.Material | THREE.Material[]);
1844
- /** The size of the clipping plane representation. */
1845
- get size(): number;
1846
- /** Sets the size of the clipping plane representation. */
1847
- set size(size: number);
1848
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1849
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1850
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): Promise<void>;
1851
- /** {@link Updateable.update} */
1852
- update: () => Promise<void>;
1734
+ abstract three: THREE.Object3D;
1735
+ protected constructor(components: Components);
1853
1736
  /** {@link Disposable.dispose} */
1854
1737
  dispose(): void;
1855
- private reset;
1856
- protected toggleControls(state: boolean): void;
1857
- private newTransformControls;
1858
- private initializeControls;
1859
- private createArrowBoundingBox;
1860
- private changeDrag;
1861
- private notifyDraggingChanged;
1862
- private preventCameraMovement;
1863
- private newHelper;
1864
- private static newPlaneMesh;
1865
1738
  }
1866
- import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1867
- /** Configuration of the IFC-fragment streaming. */
1868
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1869
- minGeometrySize: number;
1870
- minAssetsSize: number;
1739
+ import * as THREE from "three";
1740
+ import CameraControls from "camera-controls";
1741
+ import { BaseWorldItem } from "./base-world-item";
1742
+ import { CameraControllable } from "./interfaces";
1743
+ export declare abstract class BaseCamera extends BaseWorldItem {
1744
+ abstract enabled: boolean;
1745
+ abstract three: THREE.Camera;
1746
+ abstract controls?: CameraControls;
1747
+ /** Whether is instance is {@link CameraControllable}. */
1748
+ hasCameraControls: () => this is CameraControllable;
1871
1749
  }
1872
- /** Configuration of the IFC-fragment streaming. */
1873
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1874
- propertiesSize: number;
1750
+ import * as THREE from "three";
1751
+ import { BaseScene } from "./base-scene";
1752
+ import { BaseCamera } from "./base-camera";
1753
+ import { BaseRenderer } from "./base-renderer";
1754
+ import { Updateable, Disposable } from "./interfaces";
1755
+ export interface World extends Disposable, Updateable {
1756
+ meshes: Set<THREE.Mesh>;
1757
+ scene: BaseScene;
1758
+ camera: BaseCamera;
1759
+ renderer: BaseRenderer | null;
1760
+ uuid: string;
1875
1761
  }
1876
1762
  import * as THREE from "three";
1877
- import * as WEBIFC from "web-ifc";
1878
- import * as FRAGS from "@thatopen/fragments";
1879
- export declare class CivilReader {
1880
- defLineMat: THREE.LineBasicMaterial;
1881
- read(webIfc: WEBIFC.IfcAPI): {
1882
- alignments: Map<number, FRAGS.Alignment>;
1883
- coordinationMatrix: THREE.Matrix4;
1884
- } | undefined;
1885
- get(civilItems: any): {
1886
- alignments: Map<number, FRAGS.Alignment>;
1887
- coordinationMatrix: THREE.Matrix4;
1888
- } | undefined;
1889
- private getCurves;
1763
+ import { Components } from "../../Components";
1764
+ import { AsyncEvent, Event, World } from "../../Types";
1765
+ export interface CullerRendererSettings {
1766
+ updateInterval?: number;
1767
+ width?: number;
1768
+ height?: number;
1769
+ autoUpdate?: boolean;
1890
1770
  }
1891
- import * as WEBIFC from "web-ifc";
1892
- import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1893
- import { PropertiesStreamingSettings } from "./streaming-settings";
1894
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1895
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1896
- onPropertiesStreamed: AsyncEvent<{
1897
- type: number;
1898
- data: {
1899
- [id: number]: any;
1900
- };
1901
- }>;
1902
- onProgress: AsyncEvent<number>;
1903
- onIndicesStreamed: AsyncEvent<number[][]>;
1771
+ /**
1772
+ * A base renderer to determine visibility on screen
1773
+ */
1774
+ export declare class CullerRenderer {
1904
1775
  /** {@link Disposable.onDisposed} */
1905
1776
  readonly onDisposed: Event<string>;
1777
+ /**
1778
+ * Fires after making the visibility check to the meshes. It lists the
1779
+ * meshes that are currently visible, and the ones that were visible
1780
+ * just before but not anymore.
1781
+ */
1782
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1783
+ /** {@link Component.enabled} */
1906
1784
  enabled: boolean;
1907
- settings: PropertiesStreamingSettings;
1908
- webIfc: WEBIFC.IfcAPI;
1909
- dispose(): Promise<void>;
1910
- streamFromBuffer(data: Uint8Array): Promise<void>;
1911
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1912
- private readIfcFile;
1913
- private streamIfcFile;
1914
- private streamAllProperties;
1915
- private getIndices;
1916
- private cleanUp;
1917
- }
1918
- import * as WEBIFC from "web-ifc";
1919
- /** Configuration of the IFC-fragment conversion. */
1920
- export declare class IfcFragmentSettings {
1921
- /** Whether to extract the IFC properties into a JSON. */
1922
- includeProperties: boolean;
1923
1785
  /**
1924
- * Generate the geometry for categories that are not included by default,
1925
- * like IFCSPACE.
1786
+ * Needs to check whether there are objects that need to be hidden or shown.
1787
+ * You can bind this to the camera movement, to a certain interval, etc.
1926
1788
  */
1927
- optionalCategories: number[];
1928
- /** Whether to use the coordination data coming from the IFC files. */
1929
- coordinate: boolean;
1930
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1931
- wasm: {
1932
- path: string;
1933
- absolute: boolean;
1934
- logLevel?: WEBIFC.LogLevel;
1789
+ needsUpdate: boolean;
1790
+ /**
1791
+ * Render the internal scene used to determine the object visibility. Used
1792
+ * for debugging purposes.
1793
+ */
1794
+ renderDebugFrame: boolean;
1795
+ components: Components;
1796
+ readonly world: World;
1797
+ readonly renderer: THREE.WebGLRenderer;
1798
+ protected autoUpdate: boolean;
1799
+ protected updateInterval: number;
1800
+ protected readonly worker: Worker;
1801
+ protected readonly scene: THREE.Scene;
1802
+ private _width;
1803
+ private _height;
1804
+ private _availableColor;
1805
+ private readonly renderTarget;
1806
+ private readonly bufferSize;
1807
+ private readonly _buffer;
1808
+ protected _isWorkerBusy: boolean;
1809
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1810
+ /** {@link Disposable.dispose} */
1811
+ dispose(): void;
1812
+ /**
1813
+ * The function that the culler uses to reprocess the scene. Generally it's
1814
+ * better to call needsUpdate, but you can also call this to force it.
1815
+ * @param force if true, it will refresh the scene even if needsUpdate is
1816
+ * not true.
1817
+ */
1818
+ updateVisibility: (force?: boolean) => Promise<void>;
1819
+ protected getAvailableColor(): {
1820
+ r: number;
1821
+ g: number;
1822
+ b: number;
1823
+ code: string;
1935
1824
  };
1936
- /** List of categories that won't be converted to fragments. */
1937
- excludedCategories: Set<number>;
1938
- /** Whether to save the absolute location of all IFC items. */
1939
- saveLocations: boolean;
1940
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1941
- webIfc: WEBIFC.LoaderSettings;
1942
- autoSetWasm: boolean;
1943
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1825
+ protected increaseColor(): void;
1826
+ protected decreaseColor(): void;
1827
+ private applySettings;
1944
1828
  }
1945
- import * as WEBIFC from "web-ifc";
1946
- export declare class IfcMetadataReader {
1947
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1829
+ import { NavigationMode } from "./types";
1830
+ /**
1831
+ * A {@link NavigationMode} that allows first person navigation,
1832
+ * simulating FPS video games.
1833
+ */
1834
+ export declare class FirstPersonMode implements NavigationMode {
1835
+ private camera;
1836
+ /** {@link NavigationMode.enabled} */
1837
+ enabled: boolean;
1838
+ /** {@link NavigationMode.id} */
1839
+ readonly id = "FirstPerson";
1840
+ constructor(camera: any);
1841
+ /** {@link NavigationMode.set} */
1842
+ set(active: boolean): void;
1843
+ private setupFirstPersonCamera;
1948
1844
  }
1949
- export interface StreamedGeometries {
1950
- [id: number]: {
1951
- boundingBox: Float32Array;
1952
- hasHoles: boolean;
1953
- geometryFile?: string;
1954
- };
1845
+ import * as THREE from "three";
1846
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1847
+ import { Components } from "../../Components";
1848
+ import { Event, World } from "../../Types";
1849
+ /**
1850
+ * A renderer to determine a mesh visibility on screen
1851
+ */
1852
+ export declare class MeshCullerRenderer extends CullerRenderer {
1853
+ threshold: number;
1854
+ readonly onViewUpdated: Event<{
1855
+ seen: Set<THREE.Mesh>;
1856
+ unseen: Set<THREE.Mesh>;
1857
+ }>;
1858
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1859
+ isProcessing: boolean;
1860
+ private _colorCodeMeshMap;
1861
+ private _meshIDColorCodeMap;
1862
+ private _currentVisibleMeshes;
1863
+ private _recentlyHiddenMeshes;
1864
+ private _intervalID;
1865
+ private readonly _transparentMat;
1866
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1867
+ dispose(): void;
1868
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1869
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1870
+ private handleWorkerMessage;
1871
+ private getAvailableMaterial;
1955
1872
  }
1956
- export interface StreamedAsset {
1957
- id: number;
1958
- geometries: {
1959
- geometryID: number;
1960
- transformation: number[];
1961
- color: number[];
1962
- }[];
1873
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1874
+ import { NavigationMode } from "./types";
1875
+ /**
1876
+ * A {@link NavigationMode} that allows 3D navigation and panning
1877
+ * like in many 3D and CAD softwares.
1878
+ */
1879
+ export declare class OrbitMode implements NavigationMode {
1880
+ camera: any;
1881
+ /** {@link NavigationMode.enabled} */
1882
+ enabled: boolean;
1883
+ /** {@link NavigationMode.id} */
1884
+ readonly id = "Orbit";
1885
+ constructor(camera: any);
1886
+ /** {@link NavigationMode.set} */
1887
+ set(active: boolean): void;
1888
+ private activateOrbitControls;
1889
+ }
1890
+ import { NavigationMode } from "./types";
1891
+ /**
1892
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1893
+ * like many BIM tools.
1894
+ */
1895
+ export declare class PlanMode implements NavigationMode {
1896
+ private camera;
1897
+ /** {@link NavigationMode.enabled} */
1898
+ enabled: boolean;
1899
+ /** {@link NavigationMode.id} */
1900
+ readonly id = "Plan";
1901
+ private mouseAction1?;
1902
+ private mouseAction2?;
1903
+ private mouseInitialized;
1904
+ private readonly defaultAzimuthSpeed;
1905
+ private readonly defaultPolarSpeed;
1906
+ constructor(camera: any);
1907
+ /** {@link NavigationMode.set} */
1908
+ set(active: boolean): void;
1963
1909
  }
1964
- import * as WEBIFC from "web-ifc";
1965
1910
  import * as THREE from "three";
1966
- export declare class Units {
1967
- factor: number;
1968
- complement: number;
1969
- apply(matrix: THREE.Matrix4): void;
1970
- setUp(webIfc: WEBIFC.IfcAPI): void;
1971
- private getLengthUnits;
1972
- private getScaleMatrix;
1911
+ import { CameraProjection } from "./types";
1912
+ import { Event } from "../../../core";
1913
+ import { OrthoPerspectiveCamera } from "../index";
1914
+ /**
1915
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1916
+ */
1917
+ export declare class ProjectionManager {
1918
+ /**
1919
+ * Event that fires when the {@link CameraProjection} changes.
1920
+ */
1921
+ readonly onChanged: Event<THREE.Camera>;
1922
+ current: CameraProjection;
1923
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1924
+ private _component;
1925
+ private _previousDistance;
1926
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1927
+ matchOrthoDistanceEnabled: boolean;
1928
+ constructor(camera: OrthoPerspectiveCamera);
1929
+ /**
1930
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1931
+ *
1932
+ * @param projection - the new projection to set. If it is the current projection,
1933
+ * it will have no effect.
1934
+ */
1935
+ set(projection: CameraProjection): Promise<void>;
1936
+ /**
1937
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1938
+ * and vice versa.
1939
+ */
1940
+ toggle(): Promise<void>;
1941
+ private setOrthoCamera;
1942
+ private getDims;
1943
+ private setupOrthoCamera;
1944
+ private getDistance;
1945
+ private setPerspectiveCamera;
1946
+ }
1947
+ /**
1948
+ * The projection system of the camera.
1949
+ */
1950
+ export type CameraProjection = "Perspective" | "Orthographic";
1951
+ /**
1952
+ * The extensible list of supported navigation modes.
1953
+ */
1954
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1955
+ /**
1956
+ * An object that determines the behavior of the camera controls
1957
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1958
+ */
1959
+ export interface NavigationMode {
1960
+ /** The unique ID of this navigation mode. */
1961
+ id: NavModeID;
1962
+ /**
1963
+ * Enable or disable this navigation mode.
1964
+ * When a new navigation mode is enabled, the previous navigation mode
1965
+ * must be disabled.
1966
+ *
1967
+ * @param active - whether to enable or disable this mode.
1968
+ * @param options - any additional data required to enable or disable it.
1969
+ * */
1970
+ set: (active: boolean, options?: any) => void;
1971
+ /** Whether this navigation mode is active or not. */
1972
+ enabled: boolean;
1973
+ }
1974
+ import { BufferGeometry } from "three";
1975
+ import * as THREE from "three";
1976
+ export declare class TransformHelper {
1977
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1973
1978
  }
1974
1979
  export type RelationsMap = Map<number, Map<number, number[]>>;
1975
1980
  export interface ModelsRelationMap {
@@ -1995,11 +2000,6 @@ export type InverseAttributes = [
1995
2000
  "ContainsElements"
1996
2001
  ];
1997
2002
  export type InverseAttribute = InverseAttributes[number];
1998
- import { BufferGeometry } from "three";
1999
- import * as THREE from "three";
2000
- export declare class TransformHelper {
2001
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
2002
- }
2003
2003
  export type QueryConditions = "is" | "includes" | "startsWith" | "endsWith" | "matches";
2004
2004
  export type ConditionFunctions = {
2005
2005
  [queryCondition in QueryConditions]: (leftValue: string | boolean | number, rightValue: string | boolean | number) => boolean;