@thatopen/components 2.0.0-alpha.1 → 2.0.0-alpha.3

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.
@@ -1,4 +1,56 @@
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
+ }
2
54
  import { Component, Disposable, World, Event } from "../Types";
3
55
  import { SimpleRaycaster } from "./src";
4
56
  import { Components } from "../Components";
@@ -12,35 +64,6 @@ export declare class Raycasters extends Component implements Disposable {
12
64
  delete(world: World): void;
13
65
  dispose(): void;
14
66
  }
15
- import { Component, Disposable, World, Event } from "../Types";
16
- import { GridConfig, SimpleGrid } from "./src";
17
- export declare class Grids extends Component implements Disposable {
18
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
19
- list: Map<string, SimpleGrid>;
20
- onDisposed: Event<unknown>;
21
- config: Required<GridConfig>;
22
- /** {@link Component.enabled} */
23
- enabled: boolean;
24
- create(world: World): void;
25
- delete(world: World): void;
26
- dispose(): void;
27
- }
28
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
29
- import { Components } from "../Components";
30
- import { SimpleWorld } from "./src";
31
- export declare class Worlds extends Component implements Updateable, Disposable {
32
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
33
- readonly onAfterUpdate: Event<unknown>;
34
- readonly onBeforeUpdate: Event<unknown>;
35
- readonly onDisposed: Event<unknown>;
36
- list: Map<string, World>;
37
- enabled: boolean;
38
- constructor(components: Components);
39
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
40
- delete(world: World): void;
41
- dispose(): void;
42
- update(delta?: number): void | Promise<void>;
43
- }
44
67
  import * as THREE from "three";
45
68
  import { Components } from "../Components";
46
69
  import { Component } from "../Types";
@@ -84,26 +107,17 @@ export declare class Disposer extends Component {
84
107
  private disposeChildren;
85
108
  private static disposeMaterial;
86
109
  }
87
- import { Components } from "../Components";
88
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
89
- import { Component, Event, Disposable, World } from "../Types";
90
- /**
91
- * A tool to handle big scenes efficiently by automatically hiding the objects
92
- * that are not visible to the camera.
93
- */
94
- export declare class Cullers extends Component implements Disposable {
95
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
96
- private _enabled;
97
- list: Map<string, MeshCullerRenderer>;
98
- /** {@link Disposable.onDisposed} */
99
- readonly onDisposed: Event<unknown>;
110
+ import { Component, Disposable, World, Event } from "../Types";
111
+ import { GridConfig, SimpleGrid } from "./src";
112
+ export declare class Grids extends Component implements Disposable {
113
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
114
+ list: Map<string, SimpleGrid>;
115
+ onDisposed: Event<unknown>;
116
+ config: Required<GridConfig>;
100
117
  /** {@link Component.enabled} */
101
- get enabled(): boolean;
102
- set enabled(value: boolean);
103
- constructor(components: Components);
104
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
118
+ enabled: boolean;
119
+ create(world: World): void;
105
120
  delete(world: World): void;
106
- /** {@link Disposable.dispose} */
107
121
  dispose(): void;
108
122
  }
109
123
  import * as THREE from "three";
@@ -209,57 +223,43 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
209
223
  private _onStartDragging;
210
224
  private _onEndDragging;
211
225
  }
212
- import { Component, Disposable, Event } from "../Types";
226
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
227
+ import { Components } from "../Components";
228
+ import { SimpleWorld } from "./src";
229
+ export declare class Worlds extends Component implements Updateable, Disposable {
230
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
231
+ readonly onAfterUpdate: Event<unknown>;
232
+ readonly onBeforeUpdate: Event<unknown>;
233
+ readonly onDisposed: Event<unknown>;
234
+ list: Map<string, World>;
235
+ enabled: boolean;
236
+ constructor(components: Components);
237
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
238
+ delete(world: World): void;
239
+ dispose(): void;
240
+ update(delta?: number): void | Promise<void>;
241
+ }
242
+ import { Components } from "../Components";
243
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
244
+ import { Component, Event, Disposable, World } from "../Types";
213
245
  /**
214
- * The entry point of the Components library.
215
- * It can:
216
- * - Create and access all the components of the library.
217
- * - Update all the updatable components automatically.
218
- * - Dispose all the components, preventing memory leaks.
246
+ * A tool to handle big scenes efficiently by automatically hiding the objects
247
+ * that are not visible to the camera.
219
248
  */
220
- export declare class Components implements Disposable {
221
- static readonly release = "1.4.21";
249
+ export declare class Cullers extends Component implements Disposable {
250
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
251
+ private _enabled;
252
+ list: Map<string, MeshCullerRenderer>;
222
253
  /** {@link Disposable.onDisposed} */
223
- readonly onDisposed: Event<void>;
224
- /** The list of components created in this app. */
225
- readonly list: Map<string, Component>;
226
- /** If disabled, the animation loop will be stopped. */
227
- enabled: boolean;
228
- private _clock;
229
- add(uuid: string, instance: Component): void;
230
- /**
231
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
232
- * doesn't exist, it will instance it automatically.
233
- *
234
- * @param Component - The component to get or create.
235
- */
236
- get<U extends Component>(Component: new (components: Components) => U): U;
237
- constructor();
238
- /**
239
- * Initializes the library. It should be called at the start of the app after
240
- * initializing the scene, the renderer and the
241
- * camera. Additionally, if any component that need a raycaster is
242
- * used, the {@link raycaster} will need to be initialized.
243
- */
244
- init(): void;
245
- /**
246
- * Disposes the memory of all the components and tools of this instance of
247
- * the library. A memory leak will be created if:
248
- *
249
- * - An instance of the library ends up out of scope and this function isn't
250
- * called. This is especially relevant in Single Page Applications (React,
251
- * Angular, Vue, etc).
252
- *
253
- * - Any of the objects of this instance (meshes, geometries, etc) is
254
- * referenced by a reference type (object or array).
255
- *
256
- * You can learn more about how Three.js handles memory leaks
257
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
258
- *
259
- */
254
+ readonly onDisposed: Event<unknown>;
255
+ /** {@link Component.enabled} */
256
+ get enabled(): boolean;
257
+ set enabled(value: boolean);
258
+ constructor(components: Components);
259
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
260
+ delete(world: World): void;
261
+ /** {@link Disposable.dispose} */
260
262
  dispose(): void;
261
- private update;
262
- private static setupBVH;
263
263
  }
264
264
  import * as THREE from "three";
265
265
  import { Component, Disposable, Event, World } from "../Types";
@@ -323,40 +323,24 @@ export declare class Materials extends Component implements Disposable {
323
323
  removeMeshes(id: string, meshes: THREE.Mesh[]): void;
324
324
  }
325
325
  import * as THREE from "three";
326
- import * as FRAGS from "bim-fragment";
327
- import { FragmentsGroup } from "bim-fragment";
328
- import { Component, Components, Disposable, Event } from "../../core";
329
- /**
330
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
331
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
332
- */
333
- export declare class FragmentBoundingBox extends Component implements Disposable {
334
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
335
- /** {@link Component.enabled} */
336
- enabled: boolean;
337
- /** {@link Disposable.onDisposed} */
338
- readonly onDisposed: Event<unknown>;
339
- private _absoluteMin;
340
- private _absoluteMax;
341
- private _meshes;
342
- constructor(components: Components);
343
- static getDimensions(bbox: THREE.Box3): {
344
- width: number;
345
- height: number;
346
- depth: number;
347
- center: THREE.Vector3;
326
+ export interface MeasureEdge {
327
+ distance: number;
328
+ points: THREE.Vector3[];
329
+ }
330
+ export declare class MeasurementUtils {
331
+ static getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
332
+ edges: MeasureEdge[];
333
+ indices: Set<number>;
334
+ } | null;
335
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
336
+ private static getFaceData;
337
+ static getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
338
+ p1: THREE.Vector3;
339
+ p2: THREE.Vector3;
340
+ p3: THREE.Vector3;
341
+ faceNormal: THREE.Vector3;
348
342
  };
349
- static newBound(positive: boolean): THREE.Vector3;
350
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
351
- /** {@link Disposable.dispose} */
352
- dispose(): void;
353
- get(): THREE.Box3;
354
- getSphere(): THREE.Sphere;
355
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
356
- reset(): void;
357
- add(group: FragmentsGroup): void;
358
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
359
- private static getFragmentBounds;
343
+ private static round;
360
344
  }
361
345
  export declare class UUID {
362
346
  private static _pattern;
@@ -371,173 +355,30 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
371
355
  rotation: THREE.Matrix3;
372
356
  transformation: THREE.Matrix4;
373
357
  };
374
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
375
- import * as THREE from "three";
376
- export declare class MaterialsUtils {
377
- static isTransparent(material: THREE.Material): boolean;
358
+ import * as WEBIFC from "web-ifc";
359
+ import * as FRAG from "bim-fragment";
360
+ /**
361
+ * Object to export all the properties from an IFC to a JS object.
362
+ */
363
+ export declare class IfcJsonExporter {
364
+ /**
365
+ * Exports all the properties of an IFC into an array of JS objects.
366
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
367
+ * @param modelID ID of the IFC model whose properties to extract.
368
+ * @param indirect whether to get the indirect relationships as well.
369
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
370
+ * to make the location data available (e.g. absolute position of building).
371
+ */
372
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
378
373
  }
379
- import * as FRAGS from "bim-fragment";
380
- import { Disposable, Component, Event, Components } from "../../core";
381
- export interface Classification {
382
- [system: string]: {
383
- [className: string]: FRAGS.FragmentIdMap;
384
- };
385
- }
386
- export declare class FragmentClassifier extends Component implements Disposable {
387
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
388
- /** {@link Component.enabled} */
389
- enabled: boolean;
390
- private _groupSystems;
391
- /** {@link Disposable.onDisposed} */
392
- readonly onDisposed: Event<unknown>;
393
- constructor(components: Components);
394
- private onFragmentsDisposed;
395
- /** {@link Component.get} */
396
- get(): Classification;
397
- dispose(): void;
398
- remove(guid: string): void;
399
- find(filter?: {
400
- [name: string]: string[];
401
- }): FRAGS.FragmentIdMap;
402
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
403
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
404
- byEntity(group: FRAGS.FragmentsGroup): void;
405
- byStorey(group: FRAGS.FragmentsGroup): void;
406
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
407
- private saveItem;
408
- }
409
- import { Fragment, FragmentsGroup } from "bim-fragment";
410
- import * as THREE from "three";
411
- import { Component, Components, Event, Disposable } from "../../core";
412
- /**
413
- * Object that can efficiently load binary files that contain
414
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
415
- */
416
- export declare class FragmentManager extends Component implements Disposable {
417
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
418
- /** {@link Disposable.onDisposed} */
419
- readonly onDisposed: Event<unknown>;
420
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
421
- readonly onFragmentsDisposed: Event<{
422
- groupID: string;
423
- fragmentIDs: string[];
424
- }>;
425
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
426
- readonly list: Map<string, Fragment>;
427
- readonly groups: Map<string, FragmentsGroup>;
428
- /** {@link Component.enabled} */
429
- enabled: boolean;
430
- baseCoordinationModel: string;
431
- private _loader;
432
- /** The list of meshes of the created fragments. */
433
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
434
- constructor(components: Components);
435
- /** {@link Disposable.dispose} */
436
- dispose(): void;
437
- disposeGroup(group: FragmentsGroup): void;
438
- /**
439
- * Loads one or many fragments into the scene.
440
- * @param data - the bytes containing the data for the fragments to load.
441
- * @param coordinate - whether this fragmentsgroup should be federated with the others.
442
- * @returns the list of IDs of the loaded fragments.
443
- */
444
- load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
445
- /**
446
- * Export the specified fragments.
447
- * @param group - the fragments group to be exported.
448
- * @returns the exported data as binary buffer.
449
- */
450
- export(group: FragmentsGroup): Uint8Array;
451
- coordinate(models?: FragmentsGroup[]): void;
452
- }
453
- import * as WEBIFC from "web-ifc";
454
- import * as FRAGS from "bim-fragment";
455
- import { IfcFragmentSettings } from "./src";
456
- import { Component, Components, Event, Disposable } from "../../core";
457
- export declare class FragmentIfcLoader extends Component implements Disposable {
458
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
459
- readonly onIfcLoaded: Event<FRAGS.FragmentsGroup>;
460
- readonly onIfcStartedLoading: Event<void>;
461
- readonly onSetup: Event<void>;
462
- /** {@link Disposable.onDisposed} */
463
- readonly onDisposed: Event<string>;
464
- settings: IfcFragmentSettings;
465
- enabled: boolean;
466
- webIfc: WEBIFC.IfcAPI;
467
- private _material;
468
- private _spatialTree;
469
- private _metaData;
470
- private _fragmentInstances;
471
- private _civil;
472
- private _propertyExporter;
473
- private _visitedFragments;
474
- private _materialT;
475
- constructor(components: Components);
476
- dispose(): void;
477
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
478
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
479
- readIfcFile(data: Uint8Array): Promise<number>;
480
- private getAllGeometries;
481
- cleanUp(): void;
482
- private getMesh;
483
- private getGeometry;
484
- private autoSetWasm;
485
- }
486
- import { FragmentsGroup } from "bim-fragment";
487
- import { Disposable, Event, Component, Components } from "../../core";
488
- import { IfcPropertiesManager } from "../IfcPropertiesManager";
489
- interface IndexMap {
490
- [modelID: string]: {
491
- [expressID: string]: Set<number>;
492
- };
493
- }
494
- export declare class IfcPropertiesIndexer extends Component implements Disposable {
495
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
496
- /** {@link Disposable.onDisposed} */
497
- readonly onDisposed: Event<string>;
498
- enabled: boolean;
499
- relationsToProcess: number[];
500
- indexMap: IndexMap;
501
- private _propertiesManager;
502
- readonly onPropertiesManagerSet: Event<IfcPropertiesManager>;
503
- set propertiesManager(manager: IfcPropertiesManager | null);
504
- get propertiesManager(): IfcPropertiesManager | null;
505
- constructor(components: Components);
506
- private onFragmentsDisposed;
507
- dispose(): Promise<void>;
508
- getProperties(model: FragmentsGroup, id: string): Promise<any[] | null>;
509
- private getNestedPsets;
510
- private getPsetProperties;
511
- process(model: FragmentsGroup): Promise<void>;
512
- private setEntityIndex;
513
- private cloneProperty;
514
- private clonePropertyArray;
515
- }
516
- export {};
517
- import * as WEBIFC from "web-ifc";
518
- import * as FRAG from "bim-fragment";
519
- /**
520
- * Object to export all the properties from an IFC to a JS object.
521
- */
522
- export declare class IfcJsonExporter {
523
- /**
524
- * Exports all the properties of an IFC into an array of JS objects.
525
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
526
- * @param modelID ID of the IFC model whose properties to extract.
527
- * @param indirect whether to get the indirect relationships as well.
528
- * @param recursiveSpatial whether to get the properties of spatial items recursively
529
- * to make the location data available (e.g. absolute position of building).
530
- */
531
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
532
- }
533
- import * as WEBIFC from "web-ifc";
534
- import { FragmentsGroup } from "bim-fragment";
535
- import { Component, Disposable, Event, Components } from "../../core";
536
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
537
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
538
- type NumericPropTypes = "IfcInteger" | "IfcReal";
539
- interface ChangeMap {
540
- [modelID: string]: Set<number>;
374
+ import * as WEBIFC from "web-ifc";
375
+ import { FragmentsGroup } from "bim-fragment";
376
+ import { Component, Disposable, Event, Components } from "../../core";
377
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
378
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
379
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
380
+ interface ChangeMap {
381
+ [modelID: string]: Set<number>;
541
382
  }
542
383
  interface AttributeListener {
543
384
  [modelID: string]: {
@@ -640,468 +481,588 @@ export declare class IfcPropertiesFinder extends Component implements Disposable
640
481
  private arrayUnion;
641
482
  private getConditionFunctions;
642
483
  }
643
- export declare const GeometryTypes: Set<number>;
644
- export declare const IfcElements: {
645
- [key: number]: string;
646
- };
647
- export declare const IfcCategoryMap: {
648
- [key: number]: string;
649
- };
650
- import * as FRAGS from "bim-fragment";
651
- export declare class IfcPropertiesUtils {
652
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
653
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
654
- [attribute: string]: any;
655
- } | null>;
656
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
657
- [relatingID: number]: number[];
658
- }>;
659
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
660
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
661
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
662
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
663
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
664
- key: string | null;
665
- name: string | null;
666
- }>;
667
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
668
- key: string | null;
669
- value: number | null;
670
- }>;
671
- static isRel(expressID: number): boolean;
672
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
673
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
674
- }
675
- import * as WEBIFC from "web-ifc";
676
- export interface IfcItemsCategories {
677
- [itemID: number]: number;
678
- }
679
- export declare class IfcCategories {
680
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
681
- }
682
484
  import * as THREE from "three";
683
- import CameraControls from "camera-controls";
684
- import { Event } from "./event";
485
+ import { Components } from "../../core/Components";
486
+ import { SimpleCamera } from "../../core";
487
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
685
488
  /**
686
- * Whether this component has to be manually destroyed once you are done with
687
- * it to prevent
688
- * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
689
- * This also ensures that the DOM events created by that component will be
690
- * cleaned up.
489
+ * A flexible camera that uses
490
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
491
+ * easily control the camera in 2D and 3D. It supports multiple navigation
492
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
691
493
  */
692
- export interface Disposable {
494
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
693
495
  /**
694
- * Destroys the object from memory to prevent a
695
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
496
+ * The current {@link NavigationMode}.
696
497
  */
697
- dispose: () => void | Promise<void>;
698
- /** Fired after the tool has been {@link Disposable.dispose()} */
699
- readonly onDisposed: Event<any>;
700
- }
701
- /**
702
- * Whether the geometric representation of this component can be
703
- * hidden or shown in the
704
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
705
- */
706
- export interface Hideable {
498
+ mode: NavigationMode;
499
+ readonly projection: ProjectionManager;
500
+ readonly threeOrtho: THREE.OrthographicCamera;
501
+ protected readonly _userInputButtons: any;
502
+ protected readonly _frustumSize = 50;
503
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
504
+ get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
505
+ constructor(components: Components);
506
+ /** {@link Disposable.dispose} */
507
+ dispose(): void;
707
508
  /**
708
- * Whether the geometric representation of this component is
709
- * currently visible or not in the
710
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
509
+ * Sets a new {@link NavigationMode} and disables the previous one.
510
+ *
511
+ * @param mode - The {@link NavigationMode} to set.
711
512
  */
712
- visible: boolean;
713
- }
714
- /**
715
- * Whether this component can be resized. The meaning of this can vary depending
716
- * on the component: resizing a
717
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
718
- * component could mean changing its resolution, whereas resizing a
719
- * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
720
- */
721
- export interface Resizeable {
513
+ set(mode: NavModeID): void;
722
514
  /**
723
- * Sets size of this component (e.g. the resolution of a
724
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
725
- * component.
515
+ * Make the camera view fit all the specified meshes.
516
+ *
517
+ * @param meshes the meshes to fit. If it is not defined, it will
518
+ * evaluate {@link Components.meshes}.
519
+ * @param offset the distance to the fit object
726
520
  */
727
- resize: (size?: THREE.Vector2) => void;
728
- /** Event that fires when the component has been resized. */
729
- onResize: Event<THREE.Vector2>;
521
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
730
522
  /**
731
- * Gets the current size of this component (e.g. the resolution of a
732
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
733
- * component.
523
+ * Allows or prevents all user input.
524
+ *
525
+ * @param active - whether to enable or disable user inputs.
734
526
  */
735
- getSize: () => THREE.Vector2;
527
+ setUserInput(active: boolean): void;
528
+ private disableUserInput;
529
+ private enableUserInput;
530
+ private newOrthoCamera;
531
+ private setOrthoCameraAspect;
736
532
  }
737
- /** Whether this component should be updated each frame. */
738
- export interface Updateable {
739
- /** Actions that should be executed after updating the component. */
740
- onAfterUpdate: Event<any>;
741
- /** Actions that should be executed before updating the component. */
742
- onBeforeUpdate: Event<any>;
743
- /**
744
- * Function used to update the state of this component each frame. For
745
- * instance, a renderer component will make a render each frame.
746
- */
747
- update(delta?: number): void | Promise<void>;
533
+ import { FragmentsGroup } from "bim-fragment";
534
+ import { Disposable, Event, Component, Components } from "../../core";
535
+ import { IfcPropertiesManager } from "../IfcPropertiesManager";
536
+ interface IndexMap {
537
+ [modelID: string]: {
538
+ [expressID: string]: Set<number>;
539
+ };
748
540
  }
749
- /** Basic type to describe the progress of any kind of process. */
750
- export interface Progress {
751
- /** The amount of things that have been done already. */
752
- current: number;
753
- /** The total amount of things to be done by the process. */
754
- total: number;
541
+ export declare class IfcPropertiesIndexer extends Component implements Disposable {
542
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
543
+ /** {@link Disposable.onDisposed} */
544
+ readonly onDisposed: Event<string>;
545
+ enabled: boolean;
546
+ relationsToProcess: number[];
547
+ indexMap: IndexMap;
548
+ private _propertiesManager;
549
+ readonly onPropertiesManagerSet: Event<IfcPropertiesManager>;
550
+ set propertiesManager(manager: IfcPropertiesManager | null);
551
+ get propertiesManager(): IfcPropertiesManager | null;
552
+ constructor(components: Components);
553
+ private onFragmentsDisposed;
554
+ dispose(): Promise<void>;
555
+ getProperties(model: FragmentsGroup, id: string): Promise<any[] | null>;
556
+ private getNestedPsets;
557
+ private getPsetProperties;
558
+ process(model: FragmentsGroup): Promise<void>;
559
+ private setEntityIndex;
560
+ private cloneProperty;
561
+ private clonePropertyArray;
755
562
  }
756
- /**
757
- * Whether this component supports create and destroy operations. This generally
758
- * applies for components that work with instances, such as clipping planes or
759
- * dimensions.
760
- */
761
- export interface Createable {
762
- readonly onBeforeCreate: Event<any>;
763
- /** Creates a new instance of an element (e.g. a new Dimension). */
764
- create: (data: any) => void;
765
- /** Fired after successfully calling {@link Createable.create} */
766
- readonly onAfterCreate: Event<any>;
767
- /**
768
- * Finish the creation process of the component, successfully creating an
769
- * instance of whatever the component creates.
770
- */
771
- endCreation: (data: any) => void;
772
- /** Fired before calling {@link Createable.cancelCreation}. */
773
- readonly onBeforeCancel: Event<any>;
774
- /**
775
- * Cancels the creation process of the component, going back to the state
776
- * before starting to create.
777
- */
778
- cancelCreation: (data: any) => void;
779
- /** Fired after calling {@link Createable.cancelCreation}. */
780
- readonly onAfterCancel: Event<any>;
781
- /** Fired before calling {@link Createable.delete}. */
782
- readonly onBeforeDelete: Event<any>;
783
- /** Deletes an existing instance of an element (e.g. a Dimension). */
784
- delete: (data: any) => void;
785
- /** Fired after successfully calling {@link Createable.delete()} */
786
- readonly onAfterDelete: Event<any>;
563
+ export {};
564
+ import * as FRAGS from "bim-fragment";
565
+ import { Disposable, Component, Event, Components } from "../../core";
566
+ export interface Classification {
567
+ [system: string]: {
568
+ [className: string]: FRAGS.FragmentIdMap;
569
+ };
787
570
  }
788
- /**
789
- * Whether this component supports to be configured.
790
- */
791
- export interface Configurable<T extends Record<string, any>> {
792
- /** Wether this components has been already configured. */
793
- isSetup: boolean;
794
- /** Use the provided configuration to setup the tool. */
795
- setup: (config?: Partial<T>) => void | Promise<void>;
796
- /** Fired after successfully calling {@link Configurable.setup()} */
797
- readonly onSetup: Event<any>;
798
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
799
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
800
- */
801
- config: Required<T>;
571
+ export declare class FragmentClassifier extends Component implements Disposable {
572
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
573
+ /** {@link Component.enabled} */
574
+ enabled: boolean;
575
+ private _groupSystems;
576
+ /** {@link Disposable.onDisposed} */
577
+ readonly onDisposed: Event<unknown>;
578
+ constructor(components: Components);
579
+ private onFragmentsDisposed;
580
+ /** {@link Component.get} */
581
+ get(): Classification;
582
+ dispose(): void;
583
+ remove(guid: string): void;
584
+ find(filter?: {
585
+ [name: string]: string[];
586
+ }): FRAGS.FragmentIdMap;
587
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
588
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
589
+ byEntity(group: FRAGS.FragmentsGroup): void;
590
+ byStorey(group: FRAGS.FragmentsGroup): void;
591
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
592
+ private saveItem;
802
593
  }
594
+ import * as THREE from "three";
595
+ import * as FRAGS from "bim-fragment";
596
+ import { FragmentsGroup } from "bim-fragment";
597
+ import { Component, Components, Disposable, Event } from "../../core";
803
598
  /**
804
- * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
599
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
600
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
805
601
  */
806
- export interface BVHGeometry extends THREE.BufferGeometry {
807
- boundsTree: Object | undefined;
808
- disposeBoundsTree: () => void;
602
+ export declare class FragmentBoundingBox extends Component implements Disposable {
603
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
604
+ /** {@link Component.enabled} */
605
+ enabled: boolean;
606
+ /** {@link Disposable.onDisposed} */
607
+ readonly onDisposed: Event<unknown>;
608
+ private _absoluteMin;
609
+ private _absoluteMax;
610
+ private _meshes;
611
+ constructor(components: Components);
612
+ static getDimensions(bbox: THREE.Box3): {
613
+ width: number;
614
+ height: number;
615
+ depth: number;
616
+ center: THREE.Vector3;
617
+ };
618
+ static newBound(positive: boolean): THREE.Vector3;
619
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
620
+ /** {@link Disposable.dispose} */
621
+ dispose(): void;
622
+ get(): THREE.Box3;
623
+ getSphere(): THREE.Sphere;
624
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
625
+ reset(): void;
626
+ add(group: FragmentsGroup): void;
627
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
628
+ private static getFragmentBounds;
809
629
  }
810
- /**
811
- * Whether a camera uses the Camera Controls library.
812
- */
813
- export interface CameraControllable {
814
- controls: CameraControls;
630
+ import { Component, Disposable, Event, Components } from "../../core";
631
+ export declare class FragmentExploder extends Component implements Disposable {
632
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
633
+ enabled: boolean;
634
+ height: number;
635
+ groupName: string;
636
+ /** {@link Disposable.onDisposed} */
637
+ readonly onDisposed: Event<string>;
638
+ list: Set<string>;
639
+ constructor(components: Components);
640
+ dispose(): void;
641
+ explode(): void;
642
+ reset(): void;
643
+ update(): void;
815
644
  }
816
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
817
- import { Components } from "../../Components";
818
- /**
819
- * Base class of the library. Useful for finding out the interfaces it implements.
820
- */
821
- export declare abstract class Base {
822
- components: Components;
645
+ import * as FRAGS from "bim-fragment";
646
+ import { Components, Component } from "../../core";
647
+ export declare class FragmentHider extends Component {
648
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
649
+ enabled: boolean;
823
650
  constructor(components: Components);
824
- /** Whether is component is {@link Disposable}. */
825
- isDisposeable: () => this is Disposable;
826
- /** Whether is component is {@link Resizeable}. */
827
- isResizeable: () => this is Resizeable;
828
- /** Whether is component is {@link Updateable}. */
829
- isUpdateable: () => this is Updateable;
830
- /** Whether is component is {@link Hideable}. */
831
- isHideable: () => this is Hideable;
832
- /** Whether is component is {@link Configurable}. */
833
- isConfigurable: () => this is Configurable<any>;
651
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
652
+ isolate(items: FRAGS.FragmentIdMap): void;
653
+ private updateCulledVisibility;
834
654
  }
835
655
  import * as WEBIFC from "web-ifc";
836
- import { IfcItemsCategories } from "../../../ifc";
837
- export declare class SpatialStructure {
838
- itemsByFloor: IfcItemsCategories;
839
- private _units;
840
- setUp(webIfc: WEBIFC.IfcAPI): void;
656
+ import * as FRAGS from "bim-fragment";
657
+ import { IfcFragmentSettings } from "./src";
658
+ import { Component, Components, Event, Disposable } from "../../core";
659
+ export declare class FragmentIfcLoader extends Component implements Disposable {
660
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
661
+ readonly onIfcStartedLoading: Event<void>;
662
+ readonly onSetup: Event<void>;
663
+ /** {@link Disposable.onDisposed} */
664
+ readonly onDisposed: Event<string>;
665
+ settings: IfcFragmentSettings;
666
+ enabled: boolean;
667
+ webIfc: WEBIFC.IfcAPI;
668
+ private _material;
669
+ private _spatialTree;
670
+ private _metaData;
671
+ private _fragmentInstances;
672
+ private _civil;
673
+ private _propertyExporter;
674
+ private _visitedFragments;
675
+ private _materialT;
676
+ constructor(components: Components);
677
+ dispose(): void;
678
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
679
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
680
+ readIfcFile(data: Uint8Array): Promise<number>;
681
+ private getAllGeometries;
841
682
  cleanUp(): void;
683
+ private getMesh;
684
+ private getGeometry;
685
+ private autoSetWasm;
842
686
  }
687
+ import { Fragment, FragmentsGroup } from "bim-fragment";
688
+ import * as THREE from "three";
689
+ import { Component, Components, Event, Disposable } from "../../core";
843
690
  /**
844
- * Simple event handler by
845
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
846
- * Keep in mind that:
847
- * - If you want to remove it later, you might want to declare the callback as
848
- * an object.
849
- * - If you want to maintain the reference to 'this', you will need to declare
850
- * the callback as an arrow function.
691
+ * Object that can efficiently load binary files that contain
692
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
851
693
  */
852
- export declare class Event<T> {
853
- /**
854
- * Add a callback to this event instance.
855
- * @param handler - the callback to be added to this event.
856
- */
857
- add(handler: T extends void ? {
858
- (): void;
859
- } : {
860
- (data: T): void;
861
- }): void;
862
- /**
863
- * Removes a callback from this event instance.
864
- * @param handler - the callback to be removed from this event.
865
- */
866
- remove(handler: T extends void ? {
867
- (): void;
868
- } : {
869
- (data: T): void;
870
- }): void;
871
- /** Triggers all the callbacks assigned to this event. */
872
- trigger: (data?: T) => void;
873
- /** Gets rid of all the suscribed events. */
874
- reset(): void;
875
- private handlers;
876
- }
877
- import { Base } from "./base";
878
- /**
879
- * Components are the building blocks of this library. Components are singleton
880
- * elements that contain specific functionality. For instance, the SimpleClipper
881
- * Component can create, delete and handle 3D clipping planes. Components must be
882
- * unique (they can't be instanced more than once), and have a static UUID that
883
- * identifies them uniquely. The can be accessed globally using the {@link Components}
884
- * instance.
885
- */
886
- export declare abstract class Component extends Base {
694
+ export declare class FragmentManager extends Component implements Disposable {
695
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
696
+ /** {@link Disposable.onDisposed} */
697
+ readonly onDisposed: Event<unknown>;
698
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
699
+ readonly onFragmentsDisposed: Event<{
700
+ groupID: string;
701
+ fragmentIDs: string[];
702
+ }>;
703
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
704
+ readonly list: Map<string, Fragment>;
705
+ readonly groups: Map<string, FragmentsGroup>;
706
+ /** {@link Component.enabled} */
707
+ enabled: boolean;
708
+ baseCoordinationModel: string;
709
+ private _loader;
710
+ /** The list of meshes of the created fragments. */
711
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
712
+ constructor(components: Components);
713
+ /** {@link Disposable.dispose} */
714
+ dispose(): void;
715
+ disposeGroup(group: FragmentsGroup): void;
887
716
  /**
888
- * Whether this component is active or not. The behaviour can vary depending
889
- * on the type of component. E.g. a disabled dimension tool will stop creating
890
- * dimensions, while a disabled camera will stop moving. A disabled component
891
- * will not be updated automatically each frame.
717
+ * Loads one or many fragments into the scene.
718
+ * @param data - the bytes containing the data for the fragments to load.
719
+ * @param coordinate - whether this fragmentsgroup should be federated with the others.
720
+ * @returns the list of IDs of the loaded fragments.
892
721
  */
893
- abstract enabled: boolean;
894
- }
895
- import { Base } from "./base";
896
- import { World } from "./world";
897
- import { Event } from "./event";
898
- import { Components } from "../../Components";
899
- /**
900
- * One of the elements that make a world. It can be either a scene, a camera
901
- * or a renderer.
902
- */
903
- export declare abstract class BaseWorldItem extends Base {
904
- readonly worlds: Map<string, World>;
905
- readonly onWorldChanged: Event<{
906
- world: World;
907
- action: "added" | "removed";
908
- }>;
909
- currentWorld: World | null;
910
- protected constructor(components: Components);
722
+ load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
723
+ /**
724
+ * Export the specified fragments.
725
+ * @param group - the fragments group to be exported.
726
+ * @returns the exported data as binary buffer.
727
+ */
728
+ export(group: FragmentsGroup): Uint8Array;
729
+ coordinate(models?: FragmentsGroup[]): void;
911
730
  }
912
731
  import * as THREE from "three";
913
- import CameraControls from "camera-controls";
914
- import { BaseWorldItem } from "./base-world-item";
915
- import { CameraControllable } from "./interfaces";
916
- export declare abstract class BaseCamera extends BaseWorldItem {
917
- abstract enabled: boolean;
918
- abstract three: THREE.Camera;
919
- abstract controls?: CameraControls;
920
- /** Whether is instance is {@link CameraControllable}. */
921
- hasCameraControls: () => this is CameraControllable;
732
+ export declare class MaterialsUtils {
733
+ static isTransparent(material: THREE.Material): boolean;
922
734
  }
923
735
  import * as THREE from "three";
924
- import { Disposable } from "./interfaces";
925
- import { Event } from "./event";
926
- import { Components } from "../../Components";
927
- import { BaseWorldItem } from "./base-world-item";
928
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
736
+ import { Component, Components, Event, World, Disposable } from "../core";
737
+ export interface VertexPickerConfig {
738
+ showOnlyVertex: boolean;
739
+ snapDistance: number;
740
+ previewElement: HTMLElement;
741
+ }
742
+ export declare class VertexPicker extends Component implements Disposable {
743
+ onVertexFound: Event<THREE.Vector3>;
744
+ onVertexLost: Event<THREE.Vector3>;
745
+ components: Components;
746
+ private _pickedPoint;
747
+ private _config;
748
+ private _enabled;
749
+ private _workingPlane;
929
750
  /** {@link Disposable.onDisposed} */
930
751
  readonly onDisposed: Event<unknown>;
931
- abstract three: THREE.Object3D;
932
- protected constructor(components: Components);
933
- /** {@link Disposable.dispose} */
752
+ set enabled(value: boolean);
753
+ get enabled(): boolean;
754
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
755
+ [Symbol.dispose](): void;
756
+ set workingPlane(plane: THREE.Plane | null);
757
+ get workingPlane(): THREE.Plane | null;
758
+ set config(value: Partial<VertexPickerConfig>);
759
+ get config(): Partial<VertexPickerConfig>;
934
760
  dispose(): void;
761
+ get(world: World): THREE.Vector3 | null;
762
+ private getClosestVertex;
763
+ private getVertices;
764
+ private getVertex;
935
765
  }
936
- import * as THREE from "three";
937
- import { BaseScene } from "./base-scene";
938
- import { BaseCamera } from "./base-camera";
939
- import { BaseRenderer } from "./base-renderer";
940
- import { Updateable, Disposable } from "./interfaces";
941
- export interface World extends Disposable, Updateable {
942
- meshes: Set<THREE.Mesh>;
943
- scene: BaseScene;
944
- camera: BaseCamera;
945
- renderer: BaseRenderer | null;
946
- uuid: string;
766
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
767
+ export declare const IfcCategoryMap: {
768
+ [key: number]: string;
769
+ };
770
+ export declare const IfcElements: {
771
+ [key: number]: string;
772
+ };
773
+ import * as FRAGS from "bim-fragment";
774
+ export declare class IfcPropertiesUtils {
775
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
776
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
777
+ [attribute: string]: any;
778
+ } | null>;
779
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
780
+ [relatingID: number]: number[];
781
+ }>;
782
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
783
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
784
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
785
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
786
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
787
+ key: string | null;
788
+ name: string | null;
789
+ }>;
790
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
791
+ key: string | null;
792
+ value: number | null;
793
+ }>;
794
+ static isRel(expressID: number): boolean;
795
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
796
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
797
+ }
798
+ import * as WEBIFC from "web-ifc";
799
+ export interface IfcItemsCategories {
800
+ [itemID: number]: number;
801
+ }
802
+ export declare class IfcCategories {
803
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
947
804
  }
805
+ export declare const GeometryTypes: Set<number>;
948
806
  import * as THREE from "three";
949
- import CameraControls from "camera-controls";
950
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
951
807
  import { Components } from "../../Components";
808
+ import { Event, World, Disposable } from "../../Types";
809
+ import { Mouse } from "./mouse";
952
810
  /**
953
- * A basic camera that uses
954
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
955
- * easily control the camera in 2D and 3D. Check out it's API to find out
956
- * what features it offers.
811
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
812
+ * that allows to easily get items from the scene using the mouse and touch
813
+ * events.
957
814
  */
958
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
959
- /** {@link Updateable.onBeforeUpdate} */
960
- readonly onBeforeUpdate: Event<SimpleCamera>;
961
- /** {@link Updateable.onAfterUpdate} */
962
- readonly onAfterUpdate: Event<SimpleCamera>;
963
- readonly onAspectUpdated: Event<unknown>;
964
- /** {@link Disposable.onDisposed} */
965
- readonly onDisposed: Event<string>;
966
- readonly three: THREE.PerspectiveCamera;
967
- private _allControls;
968
- /**
969
- * The object that controls the camera. An instance of
970
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
971
- * Transforming the camera directly will have no effect: you need to use this
972
- * object to move, rotate, look at objects, etc.
973
- */
974
- get controls(): CameraControls;
975
- /** {@link Component.enabled} */
976
- get enabled(): boolean;
815
+ export declare class SimpleRaycaster implements Disposable {
977
816
  /** {@link Component.enabled} */
978
- set enabled(enabled: boolean);
979
- constructor(components: Components);
817
+ enabled: boolean;
818
+ components: Components;
819
+ /** {@link Disposable.onDisposed} */
820
+ readonly onDisposed: Event<unknown>;
821
+ /** The position of the mouse in the screen. */
822
+ readonly mouse: Mouse;
823
+ readonly three: THREE.Raycaster;
824
+ world: World;
825
+ constructor(components: Components, world: World);
980
826
  /** {@link Disposable.dispose} */
981
827
  dispose(): void;
982
- /** {@link Updateable.update} */
983
- update(_delta: number): void;
984
828
  /**
985
- * Updates the aspect of the camera to match the size of the
986
- * {@link Components.renderer}.
829
+ * Throws a ray from the camera to the mouse or touch event point and returns
830
+ * the first item found. This also takes into account the clipping planes
831
+ * used by the renderer.
832
+ *
833
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
834
+ * to query. If not provided, it will query all the meshes stored in
835
+ * {@link Components.meshes}.
987
836
  */
988
- updateAspect: () => void;
989
- private setupCamera;
990
- private newCameraControls;
991
- private setupEvents;
992
- private static getSubsetOfThree;
837
+ castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
838
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
839
+ private intersect;
840
+ private filterClippingPlanes;
841
+ }
842
+ import { NavigationMode } from "./types";
843
+ /**
844
+ * A {@link NavigationMode} that allows first person navigation,
845
+ * simulating FPS video games.
846
+ */
847
+ export declare class FirstPersonMode implements NavigationMode {
848
+ private camera;
849
+ /** {@link NavigationMode.enabled} */
850
+ enabled: boolean;
851
+ /** {@link NavigationMode.id} */
852
+ readonly id = "FirstPerson";
853
+ constructor(camera: any);
854
+ /** {@link NavigationMode.set} */
855
+ set(active: boolean): void;
856
+ private setupFirstPersonCamera;
993
857
  }
994
858
  import * as THREE from "three";
995
- import { Vector2 } from "three";
996
- import { Event } from "./event";
997
- import { BaseWorldItem } from "./base-world-item";
998
- import { Disposable, Resizeable, Updateable } from "./interfaces";
999
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1000
- abstract three: THREE.WebGLRenderer;
1001
- /** {@link Updateable.onBeforeUpdate} */
1002
- onAfterUpdate: Event<unknown>;
1003
- /** {@link Updateable.onAfterUpdate} */
1004
- onBeforeUpdate: Event<unknown>;
859
+ import { Disposable, Event } from "../../Types";
860
+ /**
861
+ * A helper to easily get the real position of the mouse in the Three.js canvas
862
+ * to work with tools like the
863
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
864
+ * been transformed through CSS or doesn't occupy the whole screen.
865
+ */
866
+ export declare class Mouse implements Disposable {
867
+ dom: HTMLCanvasElement;
868
+ private _event?;
869
+ private _position;
1005
870
  /** {@link Disposable.onDisposed} */
1006
- readonly onDisposed: Event<undefined>;
1007
- readonly onResize: Event<THREE.Vector2>;
871
+ readonly onDisposed: Event<unknown>;
872
+ constructor(dom: HTMLCanvasElement);
1008
873
  /**
1009
- * Event that fires when there has been a change to the list of clipping
1010
- * planes used by the active renderer.
874
+ * The real position of the mouse of the Three.js canvas.
1011
875
  */
1012
- readonly onClippingPlanesUpdated: Event<unknown>;
1013
- abstract update(delta?: number): void | Promise<void>;
1014
- abstract dispose(): void;
1015
- abstract getSize(): Vector2;
1016
- abstract resize(size: Vector2 | undefined): void;
876
+ get position(): THREE.Vector2;
877
+ /** {@link Disposable.dispose} */
878
+ dispose(): void;
879
+ private getPositionY;
880
+ private getPositionX;
881
+ private updateMouseInfo;
882
+ private setupEvents;
883
+ }
884
+ import { NavigationMode } from "./types";
885
+ /**
886
+ * A {@link NavigationMode} that allows 3D navigation and panning
887
+ * like in many 3D and CAD softwares.
888
+ */
889
+ export declare class OrbitMode implements NavigationMode {
890
+ camera: any;
891
+ /** {@link NavigationMode.enabled} */
892
+ enabled: boolean;
893
+ /** {@link NavigationMode.id} */
894
+ readonly id = "Orbit";
895
+ constructor(camera: any);
896
+ /** {@link NavigationMode.set} */
897
+ set(active: boolean): void;
898
+ private activateOrbitControls;
899
+ }
900
+ import * as WEBIFC from "web-ifc";
901
+ import { IfcItemsCategories } from "../../../ifc";
902
+ export declare class SpatialStructure {
903
+ itemsByFloor: IfcItemsCategories;
904
+ private _units;
905
+ setUp(webIfc: WEBIFC.IfcAPI): void;
906
+ cleanUp(): void;
907
+ }
908
+ import { NavigationMode } from "./types";
909
+ /**
910
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
911
+ * like many BIM tools.
912
+ */
913
+ export declare class PlanMode implements NavigationMode {
914
+ private camera;
915
+ /** {@link NavigationMode.enabled} */
916
+ enabled: boolean;
917
+ /** {@link NavigationMode.id} */
918
+ readonly id = "Plan";
919
+ private mouseAction1?;
920
+ private mouseAction2?;
921
+ private mouseInitialized;
922
+ private readonly defaultAzimuthSpeed;
923
+ private readonly defaultPolarSpeed;
924
+ constructor(camera: any);
925
+ /** {@link NavigationMode.set} */
926
+ set(active: boolean): void;
927
+ }
928
+ /**
929
+ * The projection system of the camera.
930
+ */
931
+ export type CameraProjection = "Perspective" | "Orthographic";
932
+ /**
933
+ * The extensible list of supported navigation modes.
934
+ */
935
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
936
+ /**
937
+ * An object that determines the behavior of the camera controls
938
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
939
+ */
940
+ export interface NavigationMode {
941
+ /** The unique ID of this navigation mode. */
942
+ id: NavModeID;
1017
943
  /**
1018
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1019
- * instance of the renderer.
1020
- */
1021
- clippingPlanes: THREE.Plane[];
944
+ * Enable or disable this navigation mode.
945
+ * When a new navigation mode is enabled, the previous navigation mode
946
+ * must be disabled.
947
+ *
948
+ * @param active - whether to enable or disable this mode.
949
+ * @param options - any additional data required to enable or disable it.
950
+ * */
951
+ set: (active: boolean, options?: any) => void;
952
+ /** Whether this navigation mode is active or not. */
953
+ enabled: boolean;
954
+ }
955
+ /// <reference types="node" />
956
+ import * as THREE from "three";
957
+ import { Hideable, Event, World } from "../../Types";
958
+ import { Components } from "../../Components";
959
+ export interface GridConfig {
960
+ color: THREE.Color;
961
+ size1: number;
962
+ size2: number;
963
+ distance: number;
964
+ }
965
+ /**
966
+ * An infinite grid. Created by
967
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
968
+ * and translated to typescript by
969
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
970
+ */
971
+ export declare class SimpleGrid implements Hideable, Disposable {
972
+ /** {@link Disposable.onDisposed} */
973
+ readonly onDisposed: Event<unknown>;
974
+ world: World;
975
+ components: Components;
976
+ /** {@link Hideable.visible} */
977
+ get visible(): boolean;
978
+ /** {@link Hideable.visible} */
979
+ set visible(visible: boolean);
980
+ /** The material of the grid. */
981
+ get material(): THREE.ShaderMaterial;
1022
982
  /**
1023
- * Forces the update of the clipping planes and all components that depend
1024
- * on them that are subscribed to 'onClippingPlanesUpdated'.
983
+ * Whether the grid should fade away with distance. Recommended to be true for
984
+ * perspective cameras and false for orthographic cameras.
1025
985
  */
1026
- updateClippingPlanes(): void;
986
+ get fade(): boolean;
1027
987
  /**
1028
- * Adds or removes a
1029
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1030
- * to the renderer.
988
+ * Whether the grid should fade away with distance. Recommended to be true for
989
+ * perspective cameras and false for orthographic cameras.
1031
990
  */
1032
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1033
- }
1034
- import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1035
- /** Configuration of the IFC-fragment streaming. */
1036
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1037
- minGeometrySize: number;
1038
- minAssetsSize: number;
1039
- }
1040
- /** Configuration of the IFC-fragment streaming. */
1041
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1042
- propertiesSize: number;
991
+ set fade(active: boolean);
992
+ private readonly _grid;
993
+ private _fade;
994
+ constructor(components: Components, world: World, config: GridConfig);
995
+ [Symbol.dispose](): void;
996
+ /** {@link Component.get} */
997
+ get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
998
+ /** {@link Disposable.dispose} */
999
+ dispose(): void;
1000
+ private setupEvents;
1001
+ private updateZoom;
1043
1002
  }
1044
1003
  import * as THREE from "three";
1045
- import { BaseScene, Configurable, Event } from "../../Types";
1046
- import { Components } from "../../Components";
1047
- export interface SimpleSceneConfig {
1048
- directionalLight: {
1049
- color: THREE.Color;
1050
- intensity: number;
1051
- position: THREE.Vector3;
1052
- };
1053
- ambientLight: {
1054
- color: THREE.Color;
1055
- intensity: number;
1056
- };
1057
- }
1004
+ import { CameraProjection } from "./types";
1005
+ import { Event } from "../../../core";
1006
+ import { OrthoPerspectiveCamera } from "../index";
1058
1007
  /**
1059
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1060
- * objects hierarchically, and easily dispose them when you are finished with it.
1061
- * @noInheritDoc
1008
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1062
1009
  */
1063
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1064
- /** {@link Configurable.isSetup} */
1065
- isSetup: boolean;
1066
- three: THREE.Scene;
1067
- /** {@link Configurable.onSetup} */
1068
- readonly onSetup: Event<SimpleScene>;
1069
- config: Required<SimpleSceneConfig>;
1070
- constructor(components: Components);
1071
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1072
- setup(config?: Partial<SimpleSceneConfig>): void;
1010
+ export declare class ProjectionManager {
1011
+ /**
1012
+ * Event that fires when the {@link CameraProjection} changes.
1013
+ */
1014
+ readonly onChanged: Event<THREE.Camera>;
1015
+ current: CameraProjection;
1016
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1017
+ private _component;
1018
+ private _previousDistance;
1019
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1020
+ matchOrthoDistanceEnabled: boolean;
1021
+ constructor(camera: OrthoPerspectiveCamera);
1022
+ /**
1023
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1024
+ *
1025
+ * @param projection - the new projection to set. If it is the current projection,
1026
+ * it will have no effect.
1027
+ */
1028
+ set(projection: CameraProjection): Promise<void>;
1029
+ /**
1030
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1031
+ * and vice versa.
1032
+ */
1033
+ toggle(): Promise<void>;
1034
+ private setOrthoCamera;
1035
+ private getDims;
1036
+ private setupOrthoCamera;
1037
+ private getDistance;
1038
+ private setPerspectiveCamera;
1073
1039
  }
1074
1040
  import * as THREE from "three";
1075
- import { BaseRenderer, Event } from "../../Types";
1041
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1076
1042
  import { Components } from "../../Components";
1043
+ import { Event, World } from "../../Types";
1077
1044
  /**
1078
- * A basic renderer capable of rendering
1079
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1045
+ * A renderer to determine a mesh visibility on screen
1080
1046
  */
1081
- export declare class SimpleRenderer extends BaseRenderer {
1082
- /** {@link Component.enabled} */
1083
- enabled: boolean;
1084
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1085
- container: HTMLElement | null;
1086
- three: THREE.WebGLRenderer;
1087
- protected _canvas: HTMLCanvasElement;
1088
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1089
- protected onContainerUpdated: Event<HTMLElement>;
1090
- constructor(components: Components, container?: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1091
- /** {@link Updateable.update} */
1092
- update(): void;
1093
- /** {@link Disposable.dispose} */
1047
+ export declare class MeshCullerRenderer extends CullerRenderer {
1048
+ threshold: number;
1049
+ readonly onViewUpdated: Event<{
1050
+ seen: Set<THREE.Mesh>;
1051
+ unseen: Set<THREE.Mesh>;
1052
+ }>;
1053
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1054
+ isProcessing: boolean;
1055
+ private _colorCodeMeshMap;
1056
+ private _meshIDColorCodeMap;
1057
+ private _currentVisibleMeshes;
1058
+ private _recentlyHiddenMeshes;
1059
+ private readonly _transparentMat;
1060
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1094
1061
  dispose(): void;
1095
- /** {@link Resizeable.getSize}. */
1096
- getSize(): THREE.Vector2;
1097
- /** {@link Resizeable.resize} */
1098
- resize: (size?: THREE.Vector2) => void;
1099
- setupEvents(active: boolean): void;
1100
- private resizeEvent;
1101
- private setupRenderer;
1102
- private onContextLost;
1103
- private onContextBack;
1104
- private updateContainer;
1062
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1063
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1064
+ private handleWorkerMessage;
1065
+ private getAvailableMaterial;
1105
1066
  }
1106
1067
  import * as THREE from "three";
1107
1068
  import { Components } from "../../Components";
@@ -1170,255 +1131,436 @@ export declare class CullerRenderer {
1170
1131
  private applySettings;
1171
1132
  }
1172
1133
  export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1173
- import * as WEBIFC from "web-ifc";
1174
- import { Components, Disposable, Event, Component } from "../../../core";
1175
- import { IfcStreamingSettings } from "./streaming-settings";
1176
- import { StreamedGeometries, StreamedAsset } from "./base-types";
1177
- export declare class FragmentIfcStreamConverter extends Component implements Disposable {
1178
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1179
- onGeometryStreamed: Event<{
1180
- buffer: Uint8Array;
1181
- data: StreamedGeometries;
1182
- }>;
1183
- onAssetStreamed: Event<StreamedAsset[]>;
1184
- onProgress: Event<number>;
1185
- onIfcLoaded: Event<Uint8Array>;
1186
- /** {@link Disposable.onDisposed} */
1187
- readonly onDisposed: Event<unknown>;
1188
- settings: IfcStreamingSettings;
1134
+ import * as THREE from "three";
1135
+ import { BaseRenderer, Event } from "../../Types";
1136
+ import { Components } from "../../Components";
1137
+ /**
1138
+ * A basic renderer capable of rendering
1139
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1140
+ */
1141
+ export declare class SimpleRenderer extends BaseRenderer {
1142
+ /** {@link Component.enabled} */
1189
1143
  enabled: boolean;
1190
- webIfc: WEBIFC.IfcAPI;
1191
- private _spatialTree;
1192
- private _metaData;
1193
- private _visitedGeometries;
1194
- private _streamSerializer;
1195
- private _geometries;
1196
- private _geometryCount;
1197
- private _civil;
1198
- private _groupSerializer;
1199
- private _assets;
1200
- private _meshesWithHoles;
1201
- constructor(components: Components);
1144
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1145
+ container: HTMLElement | null;
1146
+ three: THREE.WebGLRenderer;
1147
+ protected _canvas: HTMLCanvasElement;
1148
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1149
+ protected onContainerUpdated: Event<HTMLElement>;
1150
+ constructor(components: Components, container?: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1151
+ /** {@link Updateable.update} */
1152
+ update(): void;
1153
+ /** {@link Disposable.dispose} */
1202
1154
  dispose(): void;
1203
- streamFromBuffer(data: Uint8Array): Promise<void>;
1204
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1205
- private readIfcFile;
1206
- private streamIfcFile;
1207
- private streamAllGeometries;
1208
- private cleanUp;
1209
- private getMesh;
1210
- private getGeometry;
1211
- private streamAssets;
1212
- private streamGeometries;
1155
+ /** {@link Resizeable.getSize}. */
1156
+ getSize(): THREE.Vector2;
1157
+ /** {@link Resizeable.resize} */
1158
+ resize: (size?: THREE.Vector2) => void;
1159
+ setupEvents(active: boolean): void;
1160
+ private resizeEvent;
1161
+ private setupRenderer;
1162
+ private onContextLost;
1163
+ private onContextBack;
1164
+ private updateContainer;
1213
1165
  }
1214
- import * as WEBIFC from "web-ifc";
1215
- import { Component, Disposable, Event } from "../../../core";
1216
- import { PropertiesStreamingSettings } from "./streaming-settings";
1217
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1218
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1219
- onPropertiesStreamed: Event<{
1220
- type: number;
1221
- data: {
1222
- [id: number]: any;
1223
- };
1224
- }>;
1225
- onProgress: Event<number>;
1226
- onIndicesStreamed: Event<number[][]>;
1166
+ import * as THREE from "three";
1167
+ import CameraControls from "camera-controls";
1168
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1169
+ import { Components } from "../../Components";
1170
+ /**
1171
+ * A basic camera that uses
1172
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1173
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1174
+ * what features it offers.
1175
+ */
1176
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1177
+ /** {@link Updateable.onBeforeUpdate} */
1178
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1179
+ /** {@link Updateable.onAfterUpdate} */
1180
+ readonly onAfterUpdate: Event<SimpleCamera>;
1181
+ readonly onAspectUpdated: Event<unknown>;
1227
1182
  /** {@link Disposable.onDisposed} */
1228
1183
  readonly onDisposed: Event<string>;
1229
- enabled: boolean;
1230
- settings: PropertiesStreamingSettings;
1231
- webIfc: WEBIFC.IfcAPI;
1232
- dispose(): Promise<void>;
1233
- streamFromBuffer(data: Uint8Array): Promise<void>;
1234
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1235
- private readIfcFile;
1236
- private streamIfcFile;
1237
- private streamAllProperties;
1238
- private getIndices;
1239
- private cleanUp;
1184
+ readonly three: THREE.PerspectiveCamera;
1185
+ private _allControls;
1186
+ /**
1187
+ * The object that controls the camera. An instance of
1188
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1189
+ * Transforming the camera directly will have no effect: you need to use this
1190
+ * object to move, rotate, look at objects, etc.
1191
+ */
1192
+ get controls(): CameraControls;
1193
+ /** {@link Component.enabled} */
1194
+ get enabled(): boolean;
1195
+ /** {@link Component.enabled} */
1196
+ set enabled(enabled: boolean);
1197
+ constructor(components: Components);
1198
+ /** {@link Disposable.dispose} */
1199
+ dispose(): void;
1200
+ /** {@link Updateable.update} */
1201
+ update(_delta: number): void;
1202
+ /**
1203
+ * Updates the aspect of the camera to match the size of the
1204
+ * {@link Components.renderer}.
1205
+ */
1206
+ updateAspect: () => void;
1207
+ private setupCamera;
1208
+ private newCameraControls;
1209
+ private setupEvents;
1210
+ private static getSubsetOfThree;
1240
1211
  }
1241
1212
  import * as THREE from "three";
1242
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1213
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1243
1214
  import { Components } from "../../Components";
1244
- import { Event, World } from "../../Types";
1215
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1216
+ /**
1217
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1218
+ */
1219
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1220
+ readonly onAfterUpdate: Event<unknown>;
1221
+ readonly onBeforeUpdate: Event<unknown>;
1222
+ enabled: boolean;
1223
+ uuid: string;
1224
+ readonly onDisposed: Event<unknown>;
1225
+ private _scene?;
1226
+ private _camera?;
1227
+ private _renderer;
1228
+ get scene(): T;
1229
+ set scene(scene: T);
1230
+ get camera(): U;
1231
+ set camera(camera: U);
1232
+ get renderer(): S | null;
1233
+ set renderer(renderer: S | null);
1234
+ constructor(components: Components);
1235
+ update(delta?: number): void;
1236
+ dispose(disposeResources?: boolean): void;
1237
+ }
1245
1238
  /**
1246
- * A renderer to determine a mesh visibility on screen
1239
+ * Simple event handler by
1240
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1241
+ * Keep in mind that:
1242
+ * - If you want to remove it later, you might want to declare the callback as
1243
+ * an object.
1244
+ * - If you want to maintain the reference to 'this', you will need to declare
1245
+ * the callback as an arrow function.
1247
1246
  */
1248
- export declare class MeshCullerRenderer extends CullerRenderer {
1249
- threshold: number;
1250
- readonly onViewUpdated: Event<{
1251
- seen: Set<THREE.Mesh>;
1252
- unseen: Set<THREE.Mesh>;
1253
- }>;
1254
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1255
- isProcessing: boolean;
1256
- private _colorCodeMeshMap;
1257
- private _meshIDColorCodeMap;
1258
- private _currentVisibleMeshes;
1259
- private _recentlyHiddenMeshes;
1260
- private readonly _transparentMat;
1261
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1262
- dispose(): void;
1263
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1264
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1265
- private handleWorkerMessage;
1266
- private getAvailableMaterial;
1247
+ export declare class Event<T> {
1248
+ /**
1249
+ * Add a callback to this event instance.
1250
+ * @param handler - the callback to be added to this event.
1251
+ */
1252
+ add(handler: T extends void ? {
1253
+ (): void;
1254
+ } : {
1255
+ (data: T): void;
1256
+ }): void;
1257
+ /**
1258
+ * Removes a callback from this event instance.
1259
+ * @param handler - the callback to be removed from this event.
1260
+ */
1261
+ remove(handler: T extends void ? {
1262
+ (): void;
1263
+ } : {
1264
+ (data: T): void;
1265
+ }): void;
1266
+ /** Triggers all the callbacks assigned to this event. */
1267
+ trigger: (data?: T) => void;
1268
+ /** Gets rid of all the suscribed events. */
1269
+ reset(): void;
1270
+ private handlers;
1267
1271
  }
1268
- /// <reference types="node" />
1269
1272
  import * as THREE from "three";
1270
- import { Hideable, Event, World } from "../../Types";
1271
- import { Components } from "../../Components";
1272
- export interface GridConfig {
1273
- color: THREE.Color;
1274
- size1: number;
1275
- size2: number;
1276
- distance: number;
1273
+ import CameraControls from "camera-controls";
1274
+ import { Event } from "./event";
1275
+ /**
1276
+ * Whether this component has to be manually destroyed once you are done with
1277
+ * it to prevent
1278
+ * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1279
+ * This also ensures that the DOM events created by that component will be
1280
+ * cleaned up.
1281
+ */
1282
+ export interface Disposable {
1283
+ /**
1284
+ * Destroys the object from memory to prevent a
1285
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1286
+ */
1287
+ dispose: () => void | Promise<void>;
1288
+ /** Fired after the tool has been {@link Disposable.dispose()} */
1289
+ readonly onDisposed: Event<any>;
1277
1290
  }
1278
1291
  /**
1279
- * An infinite grid. Created by
1280
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1281
- * and translated to typescript by
1282
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1292
+ * Whether the geometric representation of this component can be
1293
+ * hidden or shown in the
1294
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1283
1295
  */
1284
- export declare class SimpleGrid implements Hideable, Disposable {
1285
- /** {@link Disposable.onDisposed} */
1286
- readonly onDisposed: Event<unknown>;
1287
- world: World;
1288
- components: Components;
1289
- /** {@link Hideable.visible} */
1290
- get visible(): boolean;
1291
- /** {@link Hideable.visible} */
1292
- set visible(visible: boolean);
1293
- /** The material of the grid. */
1294
- get material(): THREE.ShaderMaterial;
1296
+ export interface Hideable {
1295
1297
  /**
1296
- * Whether the grid should fade away with distance. Recommended to be true for
1297
- * perspective cameras and false for orthographic cameras.
1298
+ * Whether the geometric representation of this component is
1299
+ * currently visible or not in the
1300
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1298
1301
  */
1299
- get fade(): boolean;
1302
+ visible: boolean;
1303
+ }
1304
+ /**
1305
+ * Whether this component can be resized. The meaning of this can vary depending
1306
+ * on the component: resizing a
1307
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1308
+ * component could mean changing its resolution, whereas resizing a
1309
+ * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1310
+ */
1311
+ export interface Resizeable {
1300
1312
  /**
1301
- * Whether the grid should fade away with distance. Recommended to be true for
1302
- * perspective cameras and false for orthographic cameras.
1313
+ * Sets size of this component (e.g. the resolution of a
1314
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1315
+ * component.
1303
1316
  */
1304
- set fade(active: boolean);
1305
- private readonly _grid;
1306
- private _fade;
1307
- constructor(components: Components, world: World, config: GridConfig);
1308
- [Symbol.dispose](): void;
1309
- /** {@link Component.get} */
1310
- get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1311
- /** {@link Disposable.dispose} */
1312
- dispose(): void;
1313
- private setupEvents;
1314
- private updateZoom;
1317
+ resize: (size?: THREE.Vector2) => void;
1318
+ /** Event that fires when the component has been resized. */
1319
+ onResize: Event<THREE.Vector2>;
1320
+ /**
1321
+ * Gets the current size of this component (e.g. the resolution of a
1322
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1323
+ * component.
1324
+ */
1325
+ getSize: () => THREE.Vector2;
1315
1326
  }
1316
- export interface StreamedGeometries {
1317
- [id: number]: {
1318
- boundingBox: Float32Array;
1319
- hasHoles: boolean;
1320
- geometryFile?: string;
1321
- };
1327
+ /** Whether this component should be updated each frame. */
1328
+ export interface Updateable {
1329
+ /** Actions that should be executed after updating the component. */
1330
+ onAfterUpdate: Event<any>;
1331
+ /** Actions that should be executed before updating the component. */
1332
+ onBeforeUpdate: Event<any>;
1333
+ /**
1334
+ * Function used to update the state of this component each frame. For
1335
+ * instance, a renderer component will make a render each frame.
1336
+ */
1337
+ update(delta?: number): void;
1322
1338
  }
1323
- export interface StreamedAsset {
1324
- id: number;
1325
- geometries: {
1326
- geometryID: number;
1327
- transformation: number[];
1328
- color: number[];
1329
- }[];
1339
+ /** Basic type to describe the progress of any kind of process. */
1340
+ export interface Progress {
1341
+ /** The amount of things that have been done already. */
1342
+ current: number;
1343
+ /** The total amount of things to be done by the process. */
1344
+ total: number;
1345
+ }
1346
+ /**
1347
+ * Whether this component supports create and destroy operations. This generally
1348
+ * applies for components that work with instances, such as clipping planes or
1349
+ * dimensions.
1350
+ */
1351
+ export interface Createable {
1352
+ /** Creates a new instance of an element (e.g. a new Dimension). */
1353
+ create: (data: any) => void;
1354
+ /**
1355
+ * Finish the creation process of the component, successfully creating an
1356
+ * instance of whatever the component creates.
1357
+ */
1358
+ endCreation?: (data: any) => void;
1359
+ /**
1360
+ * Cancels the creation process of the component, going back to the state
1361
+ * before starting to create.
1362
+ */
1363
+ cancelCreation?: (data: any) => void;
1364
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
1365
+ delete: (data: any) => void;
1366
+ }
1367
+ /**
1368
+ * Whether this component supports to be configured.
1369
+ */
1370
+ export interface Configurable<T extends Record<string, any>> {
1371
+ /** Wether this components has been already configured. */
1372
+ isSetup: boolean;
1373
+ /** Use the provided configuration to setup the tool. */
1374
+ setup: (config?: Partial<T>) => void | Promise<void>;
1375
+ /** Fired after successfully calling {@link Configurable.setup()} */
1376
+ readonly onSetup: Event<any>;
1377
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1378
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1379
+ */
1380
+ config: Required<T>;
1381
+ }
1382
+ /**
1383
+ * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1384
+ */
1385
+ export interface BVHGeometry extends THREE.BufferGeometry {
1386
+ boundsTree: Object | undefined;
1387
+ disposeBoundsTree: () => void;
1388
+ }
1389
+ /**
1390
+ * Whether a camera uses the Camera Controls library.
1391
+ */
1392
+ export interface CameraControllable {
1393
+ controls: CameraControls;
1330
1394
  }
1331
1395
  import * as THREE from "three";
1332
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1396
+ import { BaseScene, Configurable, Event } from "../../Types";
1333
1397
  import { Components } from "../../Components";
1334
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1335
- /**
1336
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1337
- */
1338
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1339
- readonly onAfterUpdate: Event<unknown>;
1340
- readonly onBeforeUpdate: Event<unknown>;
1341
- enabled: boolean;
1342
- uuid: string;
1343
- readonly onDisposed: Event<unknown>;
1344
- private _scene?;
1345
- private _camera?;
1346
- private _renderer;
1347
- get scene(): T;
1348
- set scene(scene: T);
1349
- get camera(): U;
1350
- set camera(camera: U);
1351
- get renderer(): S | null;
1352
- set renderer(renderer: S | null);
1398
+ export interface SimpleSceneConfig {
1399
+ directionalLight: {
1400
+ color: THREE.Color;
1401
+ intensity: number;
1402
+ position: THREE.Vector3;
1403
+ };
1404
+ ambientLight: {
1405
+ color: THREE.Color;
1406
+ intensity: number;
1407
+ };
1408
+ }
1409
+ /**
1410
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1411
+ * objects hierarchically, and easily dispose them when you are finished with it.
1412
+ * @noInheritDoc
1413
+ */
1414
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1415
+ /** {@link Configurable.isSetup} */
1416
+ isSetup: boolean;
1417
+ three: THREE.Scene;
1418
+ /** {@link Configurable.onSetup} */
1419
+ readonly onSetup: Event<SimpleScene>;
1420
+ config: Required<SimpleSceneConfig>;
1353
1421
  constructor(components: Components);
1354
- update(delta?: number): void;
1355
- dispose(disposeResources?: boolean): void;
1422
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1423
+ setup(config?: Partial<SimpleSceneConfig>): void;
1356
1424
  }
1357
- import * as THREE from "three";
1358
- import { Disposable, Event } from "../../Types";
1425
+ import { Base } from "./base";
1359
1426
  /**
1360
- * A helper to easily get the real position of the mouse in the Three.js canvas
1361
- * to work with tools like the
1362
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1363
- * been transformed through CSS or doesn't occupy the whole screen.
1427
+ * Components are the building blocks of this library. Components are singleton
1428
+ * elements that contain specific functionality. For instance, the SimpleClipper
1429
+ * Component can create, delete and handle 3D clipping planes. Components must be
1430
+ * unique (they can't be instanced more than once), and have a static UUID that
1431
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1432
+ * instance.
1364
1433
  */
1365
- export declare class Mouse implements Disposable {
1366
- dom: HTMLCanvasElement;
1367
- private _event?;
1368
- private _position;
1369
- /** {@link Disposable.onDisposed} */
1370
- readonly onDisposed: Event<unknown>;
1371
- constructor(dom: HTMLCanvasElement);
1434
+ export declare abstract class Component extends Base {
1372
1435
  /**
1373
- * The real position of the mouse of the Three.js canvas.
1436
+ * Whether this component is active or not. The behaviour can vary depending
1437
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1438
+ * dimensions, while a disabled camera will stop moving. A disabled component
1439
+ * will not be updated automatically each frame.
1374
1440
  */
1375
- get position(): THREE.Vector2;
1376
- /** {@link Disposable.dispose} */
1377
- dispose(): void;
1378
- private getPositionY;
1379
- private getPositionX;
1380
- private updateMouseInfo;
1381
- private setupEvents;
1441
+ abstract enabled: boolean;
1382
1442
  }
1383
- import * as THREE from "three";
1443
+ import { Base } from "./base";
1444
+ import { World } from "./world";
1445
+ import { Event } from "./event";
1384
1446
  import { Components } from "../../Components";
1385
- import { Event, World, Disposable } from "../../Types";
1386
- import { Mouse } from "./mouse";
1387
1447
  /**
1388
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1389
- * that allows to easily get items from the scene using the mouse and touch
1390
- * events.
1448
+ * One of the elements that make a world. It can be either a scene, a camera
1449
+ * or a renderer.
1391
1450
  */
1392
- export declare class SimpleRaycaster implements Disposable {
1393
- /** {@link Component.enabled} */
1394
- enabled: boolean;
1451
+ export declare abstract class BaseWorldItem extends Base {
1452
+ readonly worlds: Map<string, World>;
1453
+ readonly onWorldChanged: Event<{
1454
+ world: World;
1455
+ action: "added" | "removed";
1456
+ }>;
1457
+ currentWorld: World | null;
1458
+ protected constructor(components: Components);
1459
+ }
1460
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1461
+ import { Components } from "../../Components";
1462
+ /**
1463
+ * Base class of the library. Useful for finding out the interfaces it implements.
1464
+ */
1465
+ export declare abstract class Base {
1395
1466
  components: Components;
1467
+ constructor(components: Components);
1468
+ /** Whether is component is {@link Disposable}. */
1469
+ isDisposeable: () => this is Disposable;
1470
+ /** Whether is component is {@link Resizeable}. */
1471
+ isResizeable: () => this is Resizeable;
1472
+ /** Whether is component is {@link Updateable}. */
1473
+ isUpdateable: () => this is Updateable;
1474
+ /** Whether is component is {@link Hideable}. */
1475
+ isHideable: () => this is Hideable;
1476
+ /** Whether is component is {@link Configurable}. */
1477
+ isConfigurable: () => this is Configurable<any>;
1478
+ }
1479
+ import * as THREE from "three";
1480
+ import CameraControls from "camera-controls";
1481
+ import { BaseWorldItem } from "./base-world-item";
1482
+ import { CameraControllable } from "./interfaces";
1483
+ export declare abstract class BaseCamera extends BaseWorldItem {
1484
+ abstract enabled: boolean;
1485
+ abstract three: THREE.Camera;
1486
+ abstract controls?: CameraControls;
1487
+ /** Whether is instance is {@link CameraControllable}. */
1488
+ hasCameraControls: () => this is CameraControllable;
1489
+ }
1490
+ import * as THREE from "three";
1491
+ import { Disposable } from "./interfaces";
1492
+ import { Event } from "./event";
1493
+ import { Components } from "../../Components";
1494
+ import { BaseWorldItem } from "./base-world-item";
1495
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1396
1496
  /** {@link Disposable.onDisposed} */
1397
1497
  readonly onDisposed: Event<unknown>;
1398
- /** The position of the mouse in the screen. */
1399
- readonly mouse: Mouse;
1400
- readonly three: THREE.Raycaster;
1401
- world: World;
1402
- constructor(components: Components, world: World);
1498
+ abstract three: THREE.Object3D;
1499
+ protected constructor(components: Components);
1403
1500
  /** {@link Disposable.dispose} */
1404
1501
  dispose(): void;
1502
+ }
1503
+ import * as THREE from "three";
1504
+ import { BaseScene } from "./base-scene";
1505
+ import { BaseCamera } from "./base-camera";
1506
+ import { BaseRenderer } from "./base-renderer";
1507
+ import { Updateable, Disposable } from "./interfaces";
1508
+ export interface World extends Disposable, Updateable {
1509
+ meshes: Set<THREE.Mesh>;
1510
+ scene: BaseScene;
1511
+ camera: BaseCamera;
1512
+ renderer: BaseRenderer | null;
1513
+ uuid: string;
1514
+ }
1515
+ import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1516
+ /** Configuration of the IFC-fragment streaming. */
1517
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1518
+ minGeometrySize: number;
1519
+ minAssetsSize: number;
1520
+ }
1521
+ /** Configuration of the IFC-fragment streaming. */
1522
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1523
+ propertiesSize: number;
1524
+ }
1525
+ import * as THREE from "three";
1526
+ import { Vector2 } from "three";
1527
+ import { Event } from "./event";
1528
+ import { BaseWorldItem } from "./base-world-item";
1529
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1530
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1531
+ abstract three: THREE.WebGLRenderer;
1532
+ /** {@link Updateable.onBeforeUpdate} */
1533
+ onAfterUpdate: Event<unknown>;
1534
+ /** {@link Updateable.onAfterUpdate} */
1535
+ onBeforeUpdate: Event<unknown>;
1536
+ /** {@link Disposable.onDisposed} */
1537
+ readonly onDisposed: Event<undefined>;
1538
+ readonly onResize: Event<THREE.Vector2>;
1405
1539
  /**
1406
- * Throws a ray from the camera to the mouse or touch event point and returns
1407
- * the first item found. This also takes into account the clipping planes
1408
- * used by the renderer.
1409
- *
1410
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1411
- * to query. If not provided, it will query all the meshes stored in
1412
- * {@link Components.meshes}.
1540
+ * Event that fires when there has been a change to the list of clipping
1541
+ * planes used by the active renderer.
1413
1542
  */
1414
- castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1415
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1416
- private intersect;
1417
- private filterClippingPlanes;
1418
- }
1419
- import * as WEBIFC from "web-ifc";
1420
- export declare class IfcMetadataReader {
1421
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1543
+ readonly onClippingPlanesUpdated: Event<unknown>;
1544
+ abstract update(delta?: number): void | Promise<void>;
1545
+ abstract dispose(): void;
1546
+ abstract getSize(): Vector2;
1547
+ abstract resize(size: Vector2 | undefined): void;
1548
+ /**
1549
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1550
+ * instance of the renderer.
1551
+ */
1552
+ clippingPlanes: THREE.Plane[];
1553
+ /**
1554
+ * Forces the update of the clipping planes and all components that depend
1555
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1556
+ */
1557
+ updateClippingPlanes(): void;
1558
+ /**
1559
+ * Adds or removes a
1560
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1561
+ * to the renderer.
1562
+ */
1563
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1422
1564
  }
1423
1565
  import * as THREE from "three";
1424
1566
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1482,14 +1624,72 @@ export declare class SimplePlane implements Disposable, Hideable {
1482
1624
  private static newPlaneMesh;
1483
1625
  }
1484
1626
  import * as WEBIFC from "web-ifc";
1485
- import * as THREE from "three";
1486
- export declare class Units {
1487
- factor: number;
1488
- complement: number;
1489
- apply(matrix: THREE.Matrix4): void;
1490
- setUp(webIfc: WEBIFC.IfcAPI): void;
1491
- private getLengthUnits;
1492
- private getScaleMatrix;
1627
+ import { Components, Disposable, Event, Component } from "../../../core";
1628
+ import { IfcStreamingSettings } from "./streaming-settings";
1629
+ import { StreamedGeometries, StreamedAsset } from "./base-types";
1630
+ export declare class FragmentIfcStreamConverter extends Component implements Disposable {
1631
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1632
+ onGeometryStreamed: Event<{
1633
+ buffer: Uint8Array;
1634
+ data: StreamedGeometries;
1635
+ }>;
1636
+ onAssetStreamed: Event<StreamedAsset[]>;
1637
+ onProgress: Event<number>;
1638
+ onIfcLoaded: Event<Uint8Array>;
1639
+ /** {@link Disposable.onDisposed} */
1640
+ readonly onDisposed: Event<unknown>;
1641
+ settings: IfcStreamingSettings;
1642
+ enabled: boolean;
1643
+ webIfc: WEBIFC.IfcAPI;
1644
+ private _spatialTree;
1645
+ private _metaData;
1646
+ private _visitedGeometries;
1647
+ private _streamSerializer;
1648
+ private _geometries;
1649
+ private _geometryCount;
1650
+ private _civil;
1651
+ private _groupSerializer;
1652
+ private _assets;
1653
+ private _meshesWithHoles;
1654
+ constructor(components: Components);
1655
+ dispose(): void;
1656
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1657
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1658
+ private readIfcFile;
1659
+ private streamIfcFile;
1660
+ private streamAllGeometries;
1661
+ private cleanUp;
1662
+ private getMesh;
1663
+ private getGeometry;
1664
+ private streamAssets;
1665
+ private streamGeometries;
1666
+ }
1667
+ import * as WEBIFC from "web-ifc";
1668
+ import { Component, Disposable, Event } from "../../../core";
1669
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1670
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1671
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1672
+ onPropertiesStreamed: Event<{
1673
+ type: number;
1674
+ data: {
1675
+ [id: number]: any;
1676
+ };
1677
+ }>;
1678
+ onProgress: Event<number>;
1679
+ onIndicesStreamed: Event<number[][]>;
1680
+ /** {@link Disposable.onDisposed} */
1681
+ readonly onDisposed: Event<string>;
1682
+ enabled: boolean;
1683
+ settings: PropertiesStreamingSettings;
1684
+ webIfc: WEBIFC.IfcAPI;
1685
+ dispose(): Promise<void>;
1686
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1687
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1688
+ private readIfcFile;
1689
+ private streamIfcFile;
1690
+ private streamAllProperties;
1691
+ private getIndices;
1692
+ private cleanUp;
1493
1693
  }
1494
1694
  import * as WEBIFC from "web-ifc";
1495
1695
  /** Configuration of the IFC-fragment conversion. */
@@ -1518,21 +1718,6 @@ export declare class IfcFragmentSettings {
1518
1718
  autoSetWasm: boolean;
1519
1719
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1520
1720
  }
1521
- import { Component, Disposable, Event, Components } from "../../core";
1522
- export declare class FragmentExploder extends Component implements Disposable {
1523
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1524
- enabled: boolean;
1525
- height: number;
1526
- groupName: string;
1527
- /** {@link Disposable.onDisposed} */
1528
- readonly onDisposed: Event<string>;
1529
- list: Set<string>;
1530
- constructor(components: Components);
1531
- dispose(): void;
1532
- explode(): void;
1533
- reset(): void;
1534
- update(): void;
1535
- }
1536
1721
  import * as THREE from "three";
1537
1722
  import * as WEBIFC from "web-ifc";
1538
1723
  import * as FRAGS from "bim-fragment";
@@ -1548,6 +1733,35 @@ export declare class CivilReader {
1548
1733
  } | undefined;
1549
1734
  private getCurves;
1550
1735
  }
1736
+ import * as WEBIFC from "web-ifc";
1737
+ export declare class IfcMetadataReader {
1738
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1739
+ }
1740
+ import * as WEBIFC from "web-ifc";
1741
+ import * as THREE from "three";
1742
+ export declare class Units {
1743
+ factor: number;
1744
+ complement: number;
1745
+ apply(matrix: THREE.Matrix4): void;
1746
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1747
+ private getLengthUnits;
1748
+ private getScaleMatrix;
1749
+ }
1750
+ export interface StreamedGeometries {
1751
+ [id: number]: {
1752
+ boundingBox: Float32Array;
1753
+ hasHoles: boolean;
1754
+ geometryFile?: string;
1755
+ };
1756
+ }
1757
+ export interface StreamedAsset {
1758
+ id: number;
1759
+ geometries: {
1760
+ geometryID: number;
1761
+ transformation: number[];
1762
+ color: number[];
1763
+ }[];
1764
+ }
1551
1765
  import { BufferGeometry } from "three";
1552
1766
  import * as THREE from "three";
1553
1767
  export declare class TransformHelper {
@@ -1576,169 +1790,54 @@ export interface Query {
1576
1790
  description?: string;
1577
1791
  groups: QueryGroup;
1578
1792
  }
1579
- import { NavigationMode } from "./types";
1580
- /**
1581
- * A {@link NavigationMode} that allows 3D navigation and panning
1582
- * like in many 3D and CAD softwares.
1583
- */
1584
- export declare class OrbitMode implements NavigationMode {
1585
- camera: any;
1586
- /** {@link NavigationMode.enabled} */
1587
- enabled: boolean;
1588
- /** {@link NavigationMode.id} */
1589
- readonly id = "Orbit";
1590
- constructor(camera: any);
1591
- /** {@link NavigationMode.set} */
1592
- set(active: boolean): void;
1593
- private activateOrbitControls;
1594
- }
1595
- /**
1596
- * The projection system of the camera.
1597
- */
1598
- export type CameraProjection = "Perspective" | "Orthographic";
1599
- /**
1600
- * The extensible list of supported navigation modes.
1601
- */
1602
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1603
- /**
1604
- * An object that determines the behavior of the camera controls
1605
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1606
- */
1607
- export interface NavigationMode {
1608
- /** The unique ID of this navigation mode. */
1609
- id: NavModeID;
1610
- /**
1611
- * Enable or disable this navigation mode.
1612
- * When a new navigation mode is enabled, the previous navigation mode
1613
- * must be disabled.
1614
- *
1615
- * @param active - whether to enable or disable this mode.
1616
- * @param options - any additional data required to enable or disable it.
1617
- * */
1618
- set: (active: boolean, options?: any) => void;
1619
- /** Whether this navigation mode is active or not. */
1620
- enabled: boolean;
1621
- }
1622
- import { NavigationMode } from "./types";
1623
- /**
1624
- * A {@link NavigationMode} that allows first person navigation,
1625
- * simulating FPS video games.
1626
- */
1627
- export declare class FirstPersonMode implements NavigationMode {
1628
- private camera;
1629
- /** {@link NavigationMode.enabled} */
1630
- enabled: boolean;
1631
- /** {@link NavigationMode.id} */
1632
- readonly id = "FirstPerson";
1633
- constructor(camera: any);
1634
- /** {@link NavigationMode.set} */
1635
- set(active: boolean): void;
1636
- private setupFirstPersonCamera;
1637
- }
1638
- import { NavigationMode } from "./types";
1639
- /**
1640
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1641
- * like many BIM tools.
1642
- */
1643
- export declare class PlanMode implements NavigationMode {
1644
- private camera;
1645
- /** {@link NavigationMode.enabled} */
1793
+ import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
1794
+ import { MiniMap } from "./src";
1795
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
1796
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
1797
+ readonly onAfterUpdate: Event<unknown>;
1798
+ readonly onBeforeUpdate: Event<unknown>;
1799
+ readonly onDisposed: Event<unknown>;
1646
1800
  enabled: boolean;
1647
- /** {@link NavigationMode.id} */
1648
- readonly id = "Plan";
1649
- private mouseAction1?;
1650
- private mouseAction2?;
1651
- private mouseInitialized;
1652
- private readonly defaultAzimuthSpeed;
1653
- private readonly defaultPolarSpeed;
1654
- constructor(camera: any);
1655
- /** {@link NavigationMode.set} */
1656
- set(active: boolean): void;
1657
- }
1658
- import * as THREE from "three";
1659
- import { CameraProjection } from "./types";
1660
- import { Event } from "../../../core";
1661
- import { OrthoPerspectiveCamera } from "../index";
1662
- /**
1663
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1664
- */
1665
- export declare class ProjectionManager {
1666
- /**
1667
- * Event that fires when the {@link CameraProjection} changes.
1668
- */
1669
- readonly onProjectionChanged: Event<THREE.Camera>;
1670
- projection: CameraProjection;
1671
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1672
- private _component;
1673
- private _previousDistance;
1674
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1675
- matchOrthoDistanceEnabled: boolean;
1676
- constructor(camera: OrthoPerspectiveCamera);
1677
- /**
1678
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1679
- *
1680
- * @param projection - the new projection to set. If it is the current projection,
1681
- * it will have no effect.
1682
- */
1683
- set(projection: CameraProjection): Promise<void>;
1684
- /**
1685
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1686
- * and vice versa.
1687
- */
1688
- toggle(): Promise<void>;
1689
- private setOrthoCamera;
1690
- private getDims;
1691
- private setupOrthoCamera;
1692
- private getDistance;
1693
- private setPerspectiveCamera;
1801
+ list: Map<string, MiniMap>;
1802
+ constructor(components: Components);
1803
+ create(world: World): MiniMap;
1804
+ delete(id: string): void;
1805
+ dispose(): void | Promise<void>;
1806
+ update(): void;
1694
1807
  }
1695
1808
  import * as THREE from "three";
1696
- import { Components } from "../../core/Components";
1697
- import { SimpleCamera } from "../../core";
1698
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
1699
- /**
1700
- * A flexible camera that uses
1701
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1702
- * easily control the camera in 2D and 3D. It supports multiple navigation
1703
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
1704
- */
1705
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
1706
- /**
1707
- * The current {@link NavigationMode}.
1708
- */
1709
- mode: NavigationMode;
1710
- readonly core: ProjectionManager;
1711
- readonly threeOrtho: THREE.OrthographicCamera;
1712
- protected readonly _userInputButtons: any;
1713
- protected readonly _frustumSize = 50;
1714
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
1715
- constructor(components: Components);
1716
- /** {@link Disposable.dispose} */
1809
+ import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
1810
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1811
+ /** {@link Disposable.onDisposed} */
1812
+ readonly onDisposed: Event<unknown>;
1813
+ readonly onAfterUpdate: Event<unknown>;
1814
+ readonly onBeforeUpdate: Event<unknown>;
1815
+ readonly onResize: Event<THREE.Vector2>;
1816
+ frontOffset: number;
1817
+ overrideMaterial: THREE.MeshDepthMaterial;
1818
+ backgroundColor: THREE.Color;
1819
+ renderer: THREE.WebGLRenderer;
1820
+ enabled: boolean;
1821
+ world: World;
1822
+ private _lockRotation;
1823
+ private _camera;
1824
+ private _plane;
1825
+ private _size;
1826
+ private _tempVector1;
1827
+ private _tempVector2;
1828
+ private _tempTarget;
1829
+ private readonly down;
1830
+ get lockRotation(): boolean;
1831
+ set lockRotation(active: boolean);
1832
+ get zoom(): number;
1833
+ set zoom(value: number);
1834
+ constructor(world: World);
1717
1835
  dispose(): void;
1718
- /**
1719
- * Sets a new {@link NavigationMode} and disables the previous one.
1720
- *
1721
- * @param mode - The {@link NavigationMode} to set.
1722
- */
1723
- set(mode: NavModeID): void;
1724
- /**
1725
- * Make the camera view fit all the specified meshes.
1726
- *
1727
- * @param meshes the meshes to fit. If it is not defined, it will
1728
- * evaluate {@link Components.meshes}.
1729
- * @param offset the distance to the fit object
1730
- */
1731
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
1732
- /**
1733
- * Allows or prevents all user input.
1734
- *
1735
- * @param active - whether to enable or disable user inputs.
1736
- */
1737
- setUserInput(active: boolean): void;
1738
- private disableUserInput;
1739
- private enableUserInput;
1740
- private newOrthoCamera;
1741
- private setOrthoCameraAspect;
1836
+ get(): THREE.OrthographicCamera;
1837
+ update(): void;
1838
+ getSize(): THREE.Vector2;
1839
+ resize(size?: THREE.Vector2): void;
1840
+ private updatePlanes;
1742
1841
  }
1743
1842
 
1744
1843
  }