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

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,55 +1,45 @@
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. */
2
+ import { Component, Disposable, World, Event } from "../Types";
3
+ import { SimpleRaycaster } from "./src";
4
+ import { Components } from "../Components";
5
+ export declare class Raycasters extends Component implements Disposable {
6
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
17
7
  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
- */
8
+ list: Map<string, SimpleRaycaster>;
9
+ onDisposed: Event<unknown>;
10
+ constructor(components: Components);
11
+ get(world: World): SimpleRaycaster;
12
+ delete(world: World): void;
50
13
  dispose(): void;
51
- private update;
52
- private static setupBVH;
14
+ }
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>;
53
43
  }
54
44
  import * as THREE from "three";
55
45
  import { Components } from "../Components";
@@ -94,46 +84,26 @@ export declare class Disposer extends Component {
94
84
  private disposeChildren;
95
85
  private static disposeMaterial;
96
86
  }
97
- import { Component, Disposable, World, Event } from "../Types";
98
- import { SimpleRaycaster } from "./src";
99
- import { Components } from "../Components";
100
- export declare class Raycasters extends Component implements Disposable {
101
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
102
- enabled: boolean;
103
- list: Map<string, SimpleRaycaster>;
104
- onDisposed: Event<unknown>;
105
- constructor(components: Components);
106
- get(world: World): SimpleRaycaster;
107
- delete(world: World): void;
108
- dispose(): void;
109
- }
110
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
111
87
  import { Components } from "../Components";
112
- import { SimpleWorld } from "./src";
113
- export declare class Worlds extends Component implements Updateable, Disposable {
114
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
115
- readonly onAfterUpdate: Event<unknown>;
116
- readonly onBeforeUpdate: Event<unknown>;
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} */
117
99
  readonly onDisposed: Event<unknown>;
118
- list: Map<string, World>;
119
- enabled: boolean;
120
- constructor(components: Components);
121
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
122
- delete(world: World): void;
123
- dispose(): void;
124
- update(delta?: number): void | Promise<void>;
125
- }
126
- import { Component, Disposable, World, Event } from "../Types";
127
- import { GridConfig, SimpleGrid } from "./src";
128
- export declare class Grids extends Component implements Disposable {
129
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
130
- list: Map<string, SimpleGrid>;
131
- onDisposed: Event<unknown>;
132
- config: Required<GridConfig>;
133
100
  /** {@link Component.enabled} */
134
- enabled: boolean;
135
- create(world: World): void;
101
+ get enabled(): boolean;
102
+ set enabled(value: boolean);
103
+ constructor(components: Components);
104
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
136
105
  delete(world: World): void;
106
+ /** {@link Disposable.dispose} */
137
107
  dispose(): void;
138
108
  }
139
109
  import * as THREE from "three";
@@ -177,7 +147,7 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
177
147
  * has to be 'true' for this to apply.
178
148
  */
179
149
  toleranceOrthogonalY: number;
180
- planes: T[];
150
+ list: T[];
181
151
  protected PlaneType: new (...args: any) => SimplePlane | T;
182
152
  /** The material used in all the clipping planes. */
183
153
  protected _material: THREE.Material;
@@ -239,6 +209,58 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
239
209
  private _onStartDragging;
240
210
  private _onEndDragging;
241
211
  }
212
+ import { Component, Disposable, Event } from "../Types";
213
+ /**
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.
219
+ */
220
+ export declare class Components implements Disposable {
221
+ static readonly release = "1.4.21";
222
+ /** {@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
+ */
260
+ dispose(): void;
261
+ private update;
262
+ private static setupBVH;
263
+ }
242
264
  import * as THREE from "three";
243
265
  import { Component, Disposable, Event, World } from "../Types";
244
266
  import { Components } from "../Components";
@@ -301,46 +323,6 @@ export declare class Materials extends Component implements Disposable {
301
323
  removeMeshes(id: string, meshes: THREE.Mesh[]): void;
302
324
  }
303
325
  import * as THREE from "three";
304
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
305
- center: THREE.Vector3;
306
- halfSizes: THREE.Vector3;
307
- rotation: THREE.Matrix3;
308
- transformation: THREE.Matrix4;
309
- };
310
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
311
- import * as THREE from "three";
312
- export declare class MaterialsUtils {
313
- static isTransparent(material: THREE.Material): boolean;
314
- }
315
- export declare class UUID {
316
- private static _pattern;
317
- private static _lut;
318
- static create(): string;
319
- static validate(uuid: string): void;
320
- }
321
- import { Components } from "../Components";
322
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
323
- import { Component, Event, Disposable, World } from "../Types";
324
- /**
325
- * A tool to handle big scenes efficiently by automatically hiding the objects
326
- * that are not visible to the camera.
327
- */
328
- export declare class Cullers extends Component implements Disposable {
329
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
330
- private _enabled;
331
- list: Map<string, MeshCullerRenderer>;
332
- /** {@link Disposable.onDisposed} */
333
- readonly onDisposed: Event<unknown>;
334
- /** {@link Component.enabled} */
335
- get enabled(): boolean;
336
- set enabled(value: boolean);
337
- constructor(components: Components);
338
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
339
- delete(world: World): void;
340
- /** {@link Disposable.dispose} */
341
- dispose(): void;
342
- }
343
- import * as THREE from "three";
344
326
  import * as FRAGS from "bim-fragment";
345
327
  import { FragmentsGroup } from "bim-fragment";
346
328
  import { Component, Components, Disposable, Event } from "../../core";
@@ -376,6 +358,24 @@ export declare class FragmentBoundingBox extends Component implements Disposable
376
358
  addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
377
359
  private static getFragmentBounds;
378
360
  }
361
+ export declare class UUID {
362
+ private static _pattern;
363
+ private static _lut;
364
+ static create(): string;
365
+ static validate(uuid: string): void;
366
+ }
367
+ import * as THREE from "three";
368
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
369
+ center: THREE.Vector3;
370
+ halfSizes: THREE.Vector3;
371
+ rotation: THREE.Matrix3;
372
+ transformation: THREE.Matrix4;
373
+ };
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;
378
+ }
379
379
  import * as FRAGS from "bim-fragment";
380
380
  import { Disposable, Component, Event, Components } from "../../core";
381
381
  export interface Classification {
@@ -406,41 +406,8 @@ export declare class FragmentClassifier extends Component implements Disposable
406
406
  byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
407
407
  private saveItem;
408
408
  }
409
- import * as WEBIFC from "web-ifc";
410
- import * as FRAGS from "bim-fragment";
411
- import { IfcFragmentSettings } from "./src";
412
- import { Component, Components, Event, Disposable } from "../../core";
413
- export declare class FragmentIfcLoader extends Component implements Disposable {
414
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
415
- readonly onIfcLoaded: Event<FRAGS.FragmentsGroup>;
416
- readonly onIfcStartedLoading: Event<void>;
417
- readonly onSetup: Event<void>;
418
- /** {@link Disposable.onDisposed} */
419
- readonly onDisposed: Event<string>;
420
- settings: IfcFragmentSettings;
421
- enabled: boolean;
422
- webIfc: WEBIFC.IfcAPI;
423
- private _material;
424
- private _spatialTree;
425
- private _metaData;
426
- private _fragmentInstances;
427
- private _civil;
428
- private _propertyExporter;
429
- private _visitedFragments;
430
- private _materialT;
431
- constructor(components: Components);
432
- dispose(): void;
433
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
434
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
435
- readIfcFile(data: Uint8Array): Promise<number>;
436
- private getAllGeometries;
437
- cleanUp(): void;
438
- private getMesh;
439
- private getGeometry;
440
- private autoSetWasm;
441
- }
442
- import { Fragment, FragmentsGroup } from "bim-fragment";
443
- import * as THREE from "three";
409
+ import { Fragment, FragmentsGroup } from "bim-fragment";
410
+ import * as THREE from "three";
444
411
  import { Component, Components, Event, Disposable } from "../../core";
445
412
  /**
446
413
  * Object that can efficiently load binary files that contain
@@ -484,57 +451,37 @@ export declare class FragmentManager extends Component implements Disposable {
484
451
  coordinate(models?: FragmentsGroup[]): void;
485
452
  }
486
453
  import * as WEBIFC from "web-ifc";
487
- import * as FRAG from "bim-fragment";
488
- /**
489
- * Object to export all the properties from an IFC to a JS object.
490
- */
491
- export declare class IfcJsonExporter {
492
- /**
493
- * Exports all the properties of an IFC into an array of JS objects.
494
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
495
- * @param modelID ID of the IFC model whose properties to extract.
496
- * @param indirect whether to get the indirect relationships as well.
497
- * @param recursiveSpatial whether to get the properties of spatial items recursively
498
- * to make the location data available (e.g. absolute position of building).
499
- */
500
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
501
- }
502
454
  import * as FRAGS from "bim-fragment";
503
- import { FragmentsGroup } from "bim-fragment";
504
- import { Disposable, Event, Component, Components } from "../../core";
505
- import { QueryGroup } from "./src/types";
506
- export interface QueryResult {
507
- [modelID: string]: {
508
- modelEntities: Set<number>;
509
- otherEntities: Set<number>;
510
- };
511
- }
512
- export interface IndexedModels {
513
- [modelID: string]: {
514
- [expressID: number]: Set<number>;
515
- };
516
- }
517
- export declare class IfcPropertiesFinder extends Component implements Disposable {
518
- readonly onFound: Event<FRAGS.FragmentIdMap>;
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>;
519
462
  /** {@link Disposable.onDisposed} */
520
- readonly onDisposed: Event<unknown>;
463
+ readonly onDisposed: Event<string>;
464
+ settings: IfcFragmentSettings;
521
465
  enabled: boolean;
522
- indexedModels: IndexedModels;
523
- private readonly _conditionFunctions;
524
- private _noHandleAttributes;
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;
525
475
  constructor(components: Components);
526
- private onFragmentsDisposed;
527
476
  dispose(): void;
528
- private indexEntityRelations;
529
- find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
530
- private toFragmentMap;
531
- private simpleQuery;
532
- private getMatchingEntities;
533
- private combineArrays;
534
- private getCommonElements;
535
- private arrayIntersection;
536
- private arrayUnion;
537
- private getConditionFunctions;
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;
538
485
  }
539
486
  import { FragmentsGroup } from "bim-fragment";
540
487
  import { Disposable, Event, Component, Components } from "../../core";
@@ -568,6 +515,22 @@ export declare class IfcPropertiesIndexer extends Component implements Disposabl
568
515
  }
569
516
  export {};
570
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";
571
534
  import { FragmentsGroup } from "bim-fragment";
572
535
  import { Component, Disposable, Event, Components } from "../../core";
573
536
  type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
@@ -640,28 +603,50 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
640
603
  setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
641
604
  }
642
605
  export {};
643
- export declare const GeometryTypes: Set<number>;
644
- import * as WEBIFC from "web-ifc";
645
- export interface IfcItemsCategories {
646
- [itemID: number]: number;
606
+ import * as FRAGS from "bim-fragment";
607
+ import { FragmentsGroup } from "bim-fragment";
608
+ import { Disposable, Event, Component, Components } from "../../core";
609
+ import { QueryGroup } from "./src/types";
610
+ export interface QueryResult {
611
+ [modelID: string]: {
612
+ modelEntities: Set<number>;
613
+ otherEntities: Set<number>;
614
+ };
647
615
  }
648
- export declare class IfcCategories {
649
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
616
+ export interface IndexedModels {
617
+ [modelID: string]: {
618
+ [expressID: number]: Set<number>;
619
+ };
620
+ }
621
+ export declare class IfcPropertiesFinder extends Component implements Disposable {
622
+ readonly onFound: Event<FRAGS.FragmentIdMap>;
623
+ /** {@link Disposable.onDisposed} */
624
+ readonly onDisposed: Event<unknown>;
625
+ enabled: boolean;
626
+ indexedModels: IndexedModels;
627
+ private readonly _conditionFunctions;
628
+ private _noHandleAttributes;
629
+ constructor(components: Components);
630
+ private onFragmentsDisposed;
631
+ dispose(): void;
632
+ private indexEntityRelations;
633
+ find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
634
+ private toFragmentMap;
635
+ private simpleQuery;
636
+ private getMatchingEntities;
637
+ private combineArrays;
638
+ private getCommonElements;
639
+ private arrayIntersection;
640
+ private arrayUnion;
641
+ private getConditionFunctions;
650
642
  }
643
+ export declare const GeometryTypes: Set<number>;
651
644
  export declare const IfcElements: {
652
645
  [key: number]: string;
653
646
  };
654
647
  export declare const IfcCategoryMap: {
655
648
  [key: number]: string;
656
649
  };
657
- import * as WEBIFC from "web-ifc";
658
- import { IfcItemsCategories } from "../../../ifc";
659
- export declare class SpatialStructure {
660
- itemsByFloor: IfcItemsCategories;
661
- private _units;
662
- setUp(webIfc: WEBIFC.IfcAPI): void;
663
- cleanUp(): void;
664
- }
665
650
  import * as FRAGS from "bim-fragment";
666
651
  export declare class IfcPropertiesUtils {
667
652
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -687,39 +672,12 @@ export declare class IfcPropertiesUtils {
687
672
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
688
673
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
689
674
  }
690
- /**
691
- * Simple event handler by
692
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
693
- * Keep in mind that:
694
- * - If you want to remove it later, you might want to declare the callback as
695
- * an object.
696
- * - If you want to maintain the reference to 'this', you will need to declare
697
- * the callback as an arrow function.
698
- */
699
- export declare class Event<T> {
700
- /**
701
- * Add a callback to this event instance.
702
- * @param handler - the callback to be added to this event.
703
- */
704
- add(handler: T extends void ? {
705
- (): void;
706
- } : {
707
- (data: T): void;
708
- }): void;
709
- /**
710
- * Removes a callback from this event instance.
711
- * @param handler - the callback to be removed from this event.
712
- */
713
- remove(handler: T extends void ? {
714
- (): void;
715
- } : {
716
- (data: T): void;
717
- }): void;
718
- /** Triggers all the callbacks assigned to this event. */
719
- trigger: (data?: T) => void;
720
- /** Gets rid of all the suscribed events. */
721
- reset(): void;
722
- private handlers;
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;
723
681
  }
724
682
  import * as THREE from "three";
725
683
  import CameraControls from "camera-controls";
@@ -874,6 +832,48 @@ export declare abstract class Base {
874
832
  /** Whether is component is {@link Configurable}. */
875
833
  isConfigurable: () => this is Configurable<any>;
876
834
  }
835
+ 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;
841
+ cleanUp(): void;
842
+ }
843
+ /**
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.
851
+ */
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
877
  import { Base } from "./base";
878
878
  /**
879
879
  * Components are the building blocks of this library. Components are singleton
@@ -921,12 +921,83 @@ export declare abstract class BaseCamera extends BaseWorldItem {
921
921
  hasCameraControls: () => this is CameraControllable;
922
922
  }
923
923
  import * as THREE from "three";
924
- import { Vector2 } from "three";
924
+ import { Disposable } from "./interfaces";
925
925
  import { Event } from "./event";
926
+ import { Components } from "../../Components";
926
927
  import { BaseWorldItem } from "./base-world-item";
927
- import { Disposable, Resizeable, Updateable } from "./interfaces";
928
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
929
- abstract three: THREE.WebGLRenderer;
928
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
929
+ /** {@link Disposable.onDisposed} */
930
+ readonly onDisposed: Event<unknown>;
931
+ abstract three: THREE.Object3D;
932
+ protected constructor(components: Components);
933
+ /** {@link Disposable.dispose} */
934
+ dispose(): void;
935
+ }
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;
947
+ }
948
+ import * as THREE from "three";
949
+ import CameraControls from "camera-controls";
950
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
951
+ import { Components } from "../../Components";
952
+ /**
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.
957
+ */
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;
977
+ /** {@link Component.enabled} */
978
+ set enabled(enabled: boolean);
979
+ constructor(components: Components);
980
+ /** {@link Disposable.dispose} */
981
+ dispose(): void;
982
+ /** {@link Updateable.update} */
983
+ update(_delta: number): void;
984
+ /**
985
+ * Updates the aspect of the camera to match the size of the
986
+ * {@link Components.renderer}.
987
+ */
988
+ updateAspect: () => void;
989
+ private setupCamera;
990
+ private newCameraControls;
991
+ private setupEvents;
992
+ private static getSubsetOfThree;
993
+ }
994
+ 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;
930
1001
  /** {@link Updateable.onBeforeUpdate} */
931
1002
  onAfterUpdate: Event<unknown>;
932
1003
  /** {@link Updateable.onAfterUpdate} */
@@ -960,56 +1031,15 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
960
1031
  */
961
1032
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
962
1033
  }
963
- import * as THREE from "three";
964
- import { Disposable } from "./interfaces";
965
- import { Event } from "./event";
966
- import { Components } from "../../Components";
967
- import { BaseWorldItem } from "./base-world-item";
968
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
969
- /** {@link Disposable.onDisposed} */
970
- readonly onDisposed: Event<unknown>;
971
- abstract three: THREE.Object3D;
972
- protected constructor(components: Components);
973
- /** {@link Disposable.dispose} */
974
- dispose(): void;
975
- }
976
- import * as THREE from "three";
977
- import { BaseScene } from "./base-scene";
978
- import { BaseCamera } from "./base-camera";
979
- import { BaseRenderer } from "./base-renderer";
980
- import { Updateable, Disposable } from "./interfaces";
981
- export interface World extends Disposable, Updateable {
982
- meshes: Set<THREE.Mesh>;
983
- scene: BaseScene;
984
- camera: BaseCamera;
985
- renderer: BaseRenderer | null;
986
- uuid: string;
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;
987
1039
  }
988
- import * as THREE from "three";
989
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
990
- import { Components } from "../../Components";
991
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
992
- /**
993
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
994
- */
995
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
996
- readonly onAfterUpdate: Event<unknown>;
997
- readonly onBeforeUpdate: Event<unknown>;
998
- enabled: boolean;
999
- uuid: string;
1000
- readonly onDisposed: Event<unknown>;
1001
- private _scene?;
1002
- private _camera?;
1003
- private _renderer;
1004
- get scene(): T;
1005
- set scene(scene: T);
1006
- get camera(): U;
1007
- set camera(camera: U);
1008
- get renderer(): S | null;
1009
- set renderer(renderer: S | null);
1010
- constructor(components: Components);
1011
- update(delta?: number): void;
1012
- dispose(disposeResources?: boolean): void;
1040
+ /** Configuration of the IFC-fragment streaming. */
1041
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1042
+ propertiesSize: number;
1013
1043
  }
1014
1044
  import * as THREE from "three";
1015
1045
  import { BaseScene, Configurable, Event } from "../../Types";
@@ -1074,114 +1104,6 @@ export declare class SimpleRenderer extends BaseRenderer {
1074
1104
  private updateContainer;
1075
1105
  }
1076
1106
  import * as THREE from "three";
1077
- import CameraControls from "camera-controls";
1078
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1079
- import { Components } from "../../Components";
1080
- /**
1081
- * A basic camera that uses
1082
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1083
- * easily control the camera in 2D and 3D. Check out it's API to find out
1084
- * what features it offers.
1085
- */
1086
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1087
- /** {@link Updateable.onBeforeUpdate} */
1088
- readonly onBeforeUpdate: Event<SimpleCamera>;
1089
- /** {@link Updateable.onAfterUpdate} */
1090
- readonly onAfterUpdate: Event<SimpleCamera>;
1091
- readonly onAspectUpdated: Event<unknown>;
1092
- /** {@link Disposable.onDisposed} */
1093
- readonly onDisposed: Event<string>;
1094
- readonly three: THREE.PerspectiveCamera;
1095
- private _allControls;
1096
- /**
1097
- * The object that controls the camera. An instance of
1098
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1099
- * Transforming the camera directly will have no effect: you need to use this
1100
- * object to move, rotate, look at objects, etc.
1101
- */
1102
- get controls(): CameraControls;
1103
- /** {@link Component.enabled} */
1104
- get enabled(): boolean;
1105
- /** {@link Component.enabled} */
1106
- set enabled(enabled: boolean);
1107
- constructor(components: Components);
1108
- /** {@link Disposable.dispose} */
1109
- dispose(): void;
1110
- /** {@link Updateable.update} */
1111
- update(_delta: number): void;
1112
- /**
1113
- * Updates the aspect of the camera to match the size of the
1114
- * {@link Components.renderer}.
1115
- */
1116
- updateAspect: () => void;
1117
- private setupCamera;
1118
- private newCameraControls;
1119
- private setupEvents;
1120
- private static getSubsetOfThree;
1121
- }
1122
- import * as THREE from "three";
1123
- import { Disposable, Event } from "../../Types";
1124
- /**
1125
- * A helper to easily get the real position of the mouse in the Three.js canvas
1126
- * to work with tools like the
1127
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1128
- * been transformed through CSS or doesn't occupy the whole screen.
1129
- */
1130
- export declare class Mouse implements Disposable {
1131
- dom: HTMLCanvasElement;
1132
- private _event?;
1133
- private _position;
1134
- /** {@link Disposable.onDisposed} */
1135
- readonly onDisposed: Event<unknown>;
1136
- constructor(dom: HTMLCanvasElement);
1137
- /**
1138
- * The real position of the mouse of the Three.js canvas.
1139
- */
1140
- get position(): THREE.Vector2;
1141
- /** {@link Disposable.dispose} */
1142
- dispose(): void;
1143
- private getPositionY;
1144
- private getPositionX;
1145
- private updateMouseInfo;
1146
- private setupEvents;
1147
- }
1148
- import * as THREE from "three";
1149
- import { Components } from "../../Components";
1150
- import { Event, World, Disposable } from "../../Types";
1151
- import { Mouse } from "./mouse";
1152
- /**
1153
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1154
- * that allows to easily get items from the scene using the mouse and touch
1155
- * events.
1156
- */
1157
- export declare class SimpleRaycaster implements Disposable {
1158
- /** {@link Component.enabled} */
1159
- enabled: boolean;
1160
- components: Components;
1161
- /** {@link Disposable.onDisposed} */
1162
- readonly onDisposed: Event<unknown>;
1163
- /** The position of the mouse in the screen. */
1164
- readonly mouse: Mouse;
1165
- readonly three: THREE.Raycaster;
1166
- world: World;
1167
- constructor(components: Components, world: World);
1168
- /** {@link Disposable.dispose} */
1169
- dispose(): void;
1170
- /**
1171
- * Throws a ray from the camera to the mouse or touch event point and returns
1172
- * the first item found. This also takes into account the clipping planes
1173
- * used by the renderer.
1174
- *
1175
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1176
- * to query. If not provided, it will query all the meshes stored in
1177
- * {@link Components.meshes}.
1178
- */
1179
- castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1180
- 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;
1181
- private intersect;
1182
- private filterClippingPlanes;
1183
- }
1184
- import * as THREE from "three";
1185
1107
  import { Components } from "../../Components";
1186
1108
  import { Event, World } from "../../Types";
1187
1109
  export interface CullerRendererSettings {
@@ -1247,24 +1169,93 @@ export declare class CullerRenderer {
1247
1169
  protected decreaseColor(): void;
1248
1170
  private applySettings;
1249
1171
  }
1250
- import * as THREE from "three";
1251
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1252
- import { Components } from "../../Components";
1253
- import { Event, World } from "../../Types";
1254
- /**
1255
- * A renderer to determine a mesh visibility on screen
1256
- */
1257
- export declare class MeshCullerRenderer extends CullerRenderer {
1258
- threshold: number;
1259
- readonly onViewUpdated: Event<{
1260
- seen: Set<THREE.Mesh>;
1261
- unseen: Set<THREE.Mesh>;
1262
- }>;
1263
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1264
- isProcessing: boolean;
1265
- private _colorCodeMeshMap;
1266
- private _meshIDColorCodeMap;
1267
- private _currentVisibleMeshes;
1172
+ 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;
1189
+ 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);
1202
+ 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;
1213
+ }
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[][]>;
1227
+ /** {@link Disposable.onDisposed} */
1228
+ 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;
1240
+ }
1241
+ import * as THREE from "three";
1242
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1243
+ import { Components } from "../../Components";
1244
+ import { Event, World } from "../../Types";
1245
+ /**
1246
+ * A renderer to determine a mesh visibility on screen
1247
+ */
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;
1268
1259
  private _recentlyHiddenMeshes;
1269
1260
  private readonly _transparentMat;
1270
1261
  constructor(components: Components, world: World, settings?: CullerRendererSettings);
@@ -1274,7 +1265,6 @@ export declare class MeshCullerRenderer extends CullerRenderer {
1274
1265
  private handleWorkerMessage;
1275
1266
  private getAvailableMaterial;
1276
1267
  }
1277
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1278
1268
  /// <reference types="node" />
1279
1269
  import * as THREE from "three";
1280
1270
  import { Hideable, Event, World } from "../../Types";
@@ -1323,6 +1313,113 @@ export declare class SimpleGrid implements Hideable, Disposable {
1323
1313
  private setupEvents;
1324
1314
  private updateZoom;
1325
1315
  }
1316
+ export interface StreamedGeometries {
1317
+ [id: number]: {
1318
+ boundingBox: Float32Array;
1319
+ hasHoles: boolean;
1320
+ geometryFile?: string;
1321
+ };
1322
+ }
1323
+ export interface StreamedAsset {
1324
+ id: number;
1325
+ geometries: {
1326
+ geometryID: number;
1327
+ transformation: number[];
1328
+ color: number[];
1329
+ }[];
1330
+ }
1331
+ import * as THREE from "three";
1332
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1333
+ 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);
1353
+ constructor(components: Components);
1354
+ update(delta?: number): void;
1355
+ dispose(disposeResources?: boolean): void;
1356
+ }
1357
+ import * as THREE from "three";
1358
+ import { Disposable, Event } from "../../Types";
1359
+ /**
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.
1364
+ */
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);
1372
+ /**
1373
+ * The real position of the mouse of the Three.js canvas.
1374
+ */
1375
+ get position(): THREE.Vector2;
1376
+ /** {@link Disposable.dispose} */
1377
+ dispose(): void;
1378
+ private getPositionY;
1379
+ private getPositionX;
1380
+ private updateMouseInfo;
1381
+ private setupEvents;
1382
+ }
1383
+ import * as THREE from "three";
1384
+ import { Components } from "../../Components";
1385
+ import { Event, World, Disposable } from "../../Types";
1386
+ import { Mouse } from "./mouse";
1387
+ /**
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.
1391
+ */
1392
+ export declare class SimpleRaycaster implements Disposable {
1393
+ /** {@link Component.enabled} */
1394
+ enabled: boolean;
1395
+ components: Components;
1396
+ /** {@link Disposable.onDisposed} */
1397
+ 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);
1403
+ /** {@link Disposable.dispose} */
1404
+ dispose(): void;
1405
+ /**
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}.
1413
+ */
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;
1422
+ }
1326
1423
  import * as THREE from "three";
1327
1424
  import { Hideable, Disposable, Event, World } from "../../Types";
1328
1425
  import { Components } from "../../Components";
@@ -1384,99 +1481,6 @@ export declare class SimplePlane implements Disposable, Hideable {
1384
1481
  private newHelper;
1385
1482
  private static newPlaneMesh;
1386
1483
  }
1387
- import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1388
- /** Configuration of the IFC-fragment streaming. */
1389
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1390
- minGeometrySize: number;
1391
- minAssetsSize: number;
1392
- }
1393
- /** Configuration of the IFC-fragment streaming. */
1394
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1395
- propertiesSize: number;
1396
- }
1397
- import * as WEBIFC from "web-ifc";
1398
- import { Component, Disposable, Event } from "../../../core";
1399
- import { PropertiesStreamingSettings } from "./streaming-settings";
1400
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1401
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1402
- onPropertiesStreamed: Event<{
1403
- type: number;
1404
- data: {
1405
- [id: number]: any;
1406
- };
1407
- }>;
1408
- onProgress: Event<number>;
1409
- onIndicesStreamed: Event<number[][]>;
1410
- /** {@link Disposable.onDisposed} */
1411
- readonly onDisposed: Event<string>;
1412
- enabled: boolean;
1413
- settings: PropertiesStreamingSettings;
1414
- webIfc: WEBIFC.IfcAPI;
1415
- dispose(): Promise<void>;
1416
- streamFromBuffer(data: Uint8Array): Promise<void>;
1417
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1418
- private readIfcFile;
1419
- private streamIfcFile;
1420
- private streamAllProperties;
1421
- private getIndices;
1422
- private cleanUp;
1423
- }
1424
- import * as WEBIFC from "web-ifc";
1425
- import { Components, Disposable, Event, Component } from "../../../core";
1426
- import { IfcStreamingSettings } from "./streaming-settings";
1427
- import { StreamedGeometries, StreamedAsset } from "./base-types";
1428
- export declare class FragmentIfcStreamConverter extends Component implements Disposable {
1429
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1430
- onGeometryStreamed: Event<{
1431
- buffer: Uint8Array;
1432
- data: StreamedGeometries;
1433
- }>;
1434
- onAssetStreamed: Event<StreamedAsset[]>;
1435
- onProgress: Event<number>;
1436
- onIfcLoaded: Event<Uint8Array>;
1437
- /** {@link Disposable.onDisposed} */
1438
- readonly onDisposed: Event<unknown>;
1439
- settings: IfcStreamingSettings;
1440
- enabled: boolean;
1441
- webIfc: WEBIFC.IfcAPI;
1442
- private _spatialTree;
1443
- private _metaData;
1444
- private _visitedGeometries;
1445
- private _streamSerializer;
1446
- private _geometries;
1447
- private _geometryCount;
1448
- private _civil;
1449
- private _groupSerializer;
1450
- private _assets;
1451
- private _meshesWithHoles;
1452
- constructor(components: Components);
1453
- dispose(): void;
1454
- streamFromBuffer(data: Uint8Array): Promise<void>;
1455
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1456
- private readIfcFile;
1457
- private streamIfcFile;
1458
- private streamAllGeometries;
1459
- private cleanUp;
1460
- private getMesh;
1461
- private getGeometry;
1462
- private streamAssets;
1463
- private streamGeometries;
1464
- }
1465
- export interface StreamedGeometries {
1466
- [id: number]: {
1467
- boundingBox: Float32Array;
1468
- hasHoles: boolean;
1469
- geometryFile?: string;
1470
- };
1471
- }
1472
- export interface StreamedAsset {
1473
- id: number;
1474
- geometries: {
1475
- geometryID: number;
1476
- transformation: number[];
1477
- color: number[];
1478
- }[];
1479
- }
1480
1484
  import * as WEBIFC from "web-ifc";
1481
1485
  import * as THREE from "three";
1482
1486
  export declare class Units {
@@ -1487,21 +1491,6 @@ export declare class Units {
1487
1491
  private getLengthUnits;
1488
1492
  private getScaleMatrix;
1489
1493
  }
1490
- import * as THREE from "three";
1491
- import * as WEBIFC from "web-ifc";
1492
- import * as FRAGS from "bim-fragment";
1493
- export declare class CivilReader {
1494
- defLineMat: THREE.LineBasicMaterial;
1495
- read(webIfc: WEBIFC.IfcAPI): {
1496
- alignments: Map<number, FRAGS.Alignment>;
1497
- coordinationMatrix: THREE.Matrix4;
1498
- } | undefined;
1499
- get(civilItems: any): {
1500
- alignments: Map<number, FRAGS.Alignment>;
1501
- coordinationMatrix: THREE.Matrix4;
1502
- } | undefined;
1503
- private getCurves;
1504
- }
1505
1494
  import * as WEBIFC from "web-ifc";
1506
1495
  /** Configuration of the IFC-fragment conversion. */
1507
1496
  export declare class IfcFragmentSettings {
@@ -1529,9 +1518,35 @@ export declare class IfcFragmentSettings {
1529
1518
  autoSetWasm: boolean;
1530
1519
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1531
1520
  }
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
+ import * as THREE from "three";
1532
1537
  import * as WEBIFC from "web-ifc";
1533
- export declare class IfcMetadataReader {
1534
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1538
+ import * as FRAGS from "bim-fragment";
1539
+ export declare class CivilReader {
1540
+ defLineMat: THREE.LineBasicMaterial;
1541
+ read(webIfc: WEBIFC.IfcAPI): {
1542
+ alignments: Map<number, FRAGS.Alignment>;
1543
+ coordinationMatrix: THREE.Matrix4;
1544
+ } | undefined;
1545
+ get(civilItems: any): {
1546
+ alignments: Map<number, FRAGS.Alignment>;
1547
+ coordinationMatrix: THREE.Matrix4;
1548
+ } | undefined;
1549
+ private getCurves;
1535
1550
  }
1536
1551
  import { BufferGeometry } from "three";
1537
1552
  import * as THREE from "three";
@@ -1561,20 +1576,169 @@ export interface Query {
1561
1576
  description?: string;
1562
1577
  groups: QueryGroup;
1563
1578
  }
1564
- import { Component, Disposable, Event, Components } from "../../core";
1565
- export declare class FragmentExploder extends Component implements Disposable {
1566
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
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} */
1567
1587
  enabled: boolean;
1568
- height: number;
1569
- groupName: string;
1570
- /** {@link Disposable.onDisposed} */
1571
- readonly onDisposed: Event<string>;
1572
- list: Set<string>;
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} */
1646
+ 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;
1694
+ }
1695
+ 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>;
1573
1715
  constructor(components: Components);
1716
+ /** {@link Disposable.dispose} */
1574
1717
  dispose(): void;
1575
- explode(): void;
1576
- reset(): void;
1577
- update(): 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;
1578
1742
  }
1579
1743
 
1580
1744
  }