@thatopen/components 2.0.0 → 2.0.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,47 +1,4 @@
1
1
  declare namespace OBC {
2
- import * as THREE from "three";
3
- import { Components } from "../Components";
4
- import { Component } from "../Types";
5
- /**
6
- * A tool to safely remove meshes and geometries from memory to
7
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
8
- */
9
- export declare class Disposer extends Component {
10
- private _disposedComponents;
11
- /** {@link Component.enabled} */
12
- enabled: boolean;
13
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
14
- constructor(components: Components);
15
- /**
16
- * {@link Component.uuid}.
17
- * @return the list of UUIDs of deleted components.
18
- */
19
- get(): Set<string>;
20
- /**
21
- * Removes a mesh, its geometry and its materials from memory. If you are
22
- * using any of these in other parts of the application, make sure that you
23
- * remove them from the mesh before disposing it.
24
- *
25
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
26
- * to remove.
27
- *
28
- * @param materials - whether to dispose the materials of the mesh.
29
- *
30
- * @param recursive - whether to recursively dispose the children of the mesh.
31
- */
32
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
33
- /**
34
- * Disposes a geometry from memory.
35
- *
36
- * @param geometry - the
37
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
38
- * to remove.
39
- */
40
- disposeGeometry(geometry: THREE.BufferGeometry): void;
41
- private disposeGeometryAndMaterials;
42
- private disposeChildren;
43
- private static disposeMaterial;
44
- }
45
2
  import { Component, Disposable, Event } from "../Types";
46
3
  /**
47
4
  * The entry point of the Components library.
@@ -94,6 +51,49 @@ export declare class Components implements Disposable {
94
51
  private update;
95
52
  private static setupBVH;
96
53
  }
54
+ import * as THREE from "three";
55
+ import { Components } from "../Components";
56
+ import { Component } from "../Types";
57
+ /**
58
+ * A tool to safely remove meshes and geometries from memory to
59
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
60
+ */
61
+ export declare class Disposer extends Component {
62
+ private _disposedComponents;
63
+ /** {@link Component.enabled} */
64
+ enabled: boolean;
65
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
66
+ constructor(components: Components);
67
+ /**
68
+ * {@link Component.uuid}.
69
+ * @return the list of UUIDs of deleted components.
70
+ */
71
+ get(): Set<string>;
72
+ /**
73
+ * Removes a mesh, its geometry and its materials from memory. If you are
74
+ * using any of these in other parts of the application, make sure that you
75
+ * remove them from the mesh before disposing it.
76
+ *
77
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
78
+ * to remove.
79
+ *
80
+ * @param materials - whether to dispose the materials of the mesh.
81
+ *
82
+ * @param recursive - whether to recursively dispose the children of the mesh.
83
+ */
84
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
85
+ /**
86
+ * Disposes a geometry from memory.
87
+ *
88
+ * @param geometry - the
89
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
90
+ * to remove.
91
+ */
92
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
93
+ private disposeGeometryAndMaterials;
94
+ private disposeChildren;
95
+ private static disposeMaterial;
96
+ }
97
97
  import { Component, Disposable, World, Event } from "../Types";
98
98
  import { SimpleRaycaster } from "./src";
99
99
  import { Components } from "../Components";
@@ -158,6 +158,71 @@ export declare class Worlds extends Component implements Updateable, Disposable
158
158
  dispose(): void;
159
159
  update(delta?: number): void | Promise<void>;
160
160
  }
161
+ import { Component, Disposable, World, Event } from "../Types";
162
+ import { GridConfig, SimpleGrid } from "./src";
163
+ export declare class Grids extends Component implements Disposable {
164
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
165
+ list: Map<string, SimpleGrid>;
166
+ onDisposed: Event<unknown>;
167
+ config: Required<GridConfig>;
168
+ /** {@link Component.enabled} */
169
+ enabled: boolean;
170
+ create(world: World): SimpleGrid;
171
+ delete(world: World): void;
172
+ dispose(): void;
173
+ }
174
+ import { Components } from "../Components";
175
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
176
+ import { Component, Event, Disposable, World } from "../Types";
177
+ /**
178
+ * A tool to handle big scenes efficiently by automatically hiding the objects
179
+ * that are not visible to the camera.
180
+ */
181
+ export declare class Cullers extends Component implements Disposable {
182
+ /**
183
+ * A unique identifier for the Cullers component.
184
+ */
185
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
186
+ /**
187
+ * Indicates whether the Cullers component is enabled.
188
+ */
189
+ private _enabled;
190
+ /**
191
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
192
+ */
193
+ list: Map<string, MeshCullerRenderer>;
194
+ /**
195
+ * An event that is triggered when the Cullers component is disposed.
196
+ */
197
+ readonly onDisposed: Event<unknown>;
198
+ /**
199
+ * Gets the enabled state of the Cullers component.
200
+ *
201
+ * @returns The current enabled state.
202
+ */
203
+ get enabled(): boolean;
204
+ /**
205
+ * Sets the enabled state of the Cullers component.
206
+ * Also sets the enabled state of all MeshCullerRenderer instances.
207
+ *
208
+ * @param value - The new enabled state.
209
+ */
210
+ set enabled(value: boolean);
211
+ constructor(components: Components);
212
+ /**
213
+ * Creates a new MeshCullerRenderer for the given world.
214
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
215
+ *
216
+ * @param world - The world for which to create the MeshCullerRenderer.
217
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
218
+ *
219
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
220
+ */
221
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
222
+ delete(world: World): void;
223
+ /** {@link Disposable.dispose} */
224
+ dispose(): void;
225
+ }
161
226
  import * as THREE from "three";
162
227
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
163
228
  import { SimplePlane } from "./src";
@@ -257,18 +322,21 @@ export declare class Clipper extends Component implements Createable, Disposable
257
322
  private _onStartDragging;
258
323
  private _onEndDragging;
259
324
  }
260
- import { Component, Disposable, World, Event } from "../Types";
261
- import { GridConfig, SimpleGrid } from "./src";
262
- export declare class Grids extends Component implements Disposable {
263
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
264
- list: Map<string, SimpleGrid>;
265
- onDisposed: Event<unknown>;
266
- config: Required<GridConfig>;
267
- /** {@link Component.enabled} */
325
+ import { MiniMap } from "./src";
326
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
327
+ import { Components } from "../Components";
328
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
329
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
330
+ readonly onAfterUpdate: Event<unknown>;
331
+ readonly onBeforeUpdate: Event<unknown>;
332
+ readonly onDisposed: Event<unknown>;
268
333
  enabled: boolean;
269
- create(world: World): SimpleGrid;
270
- delete(world: World): void;
334
+ list: Map<string, MiniMap>;
335
+ constructor(components: Components);
336
+ create(world: World): MiniMap;
337
+ delete(id: string): void;
271
338
  dispose(): void;
339
+ update(): void;
272
340
  }
273
341
  import * as THREE from "three";
274
342
  import { Components } from "../Components";
@@ -321,94 +389,244 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
321
389
  private newOrthoCamera;
322
390
  private setOrthoPerspCameraAspect;
323
391
  }
324
- import { Components } from "../Components";
325
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
326
- import { Component, Event, Disposable, World } from "../Types";
392
+ import * as THREE from "three";
393
+ import * as FRAGS from "@thatopen/fragments";
394
+ import { FragmentsGroup } from "@thatopen/fragments";
395
+ import { Component, Components, Disposable, Event } from "../../core";
327
396
  /**
328
- * A tool to handle big scenes efficiently by automatically hiding the objects
329
- * that are not visible to the camera.
397
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
398
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
330
399
  */
331
- export declare class Cullers extends Component implements Disposable {
332
- /**
333
- * A unique identifier for the Cullers component.
334
- */
335
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
336
- /**
337
- * Indicates whether the Cullers component is enabled.
338
- */
339
- private _enabled;
340
- /**
341
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
342
- */
343
- list: Map<string, MeshCullerRenderer>;
344
- /**
345
- * An event that is triggered when the Cullers component is disposed.
346
- */
400
+ export declare class BoundingBoxer extends Component implements Disposable {
401
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
402
+ /** {@link Component.enabled} */
403
+ enabled: boolean;
404
+ /** {@link Disposable.onDisposed} */
347
405
  readonly onDisposed: Event<unknown>;
348
- /**
349
- * Gets the enabled state of the Cullers component.
350
- *
351
- * @returns The current enabled state.
352
- */
353
- get enabled(): boolean;
354
- /**
355
- * Sets the enabled state of the Cullers component.
356
- * Also sets the enabled state of all MeshCullerRenderer instances.
357
- *
358
- * @param value - The new enabled state.
359
- */
360
- set enabled(value: boolean);
406
+ private _absoluteMin;
407
+ private _absoluteMax;
408
+ private _meshes;
361
409
  constructor(components: Components);
362
- /**
363
- * Creates a new MeshCullerRenderer for the given world.
364
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
365
- *
366
- * @param world - The world for which to create the MeshCullerRenderer.
367
- * @param config - Optional configuration settings for the MeshCullerRenderer.
368
- *
369
- * @returns The newly created or existing MeshCullerRenderer for the given world.
370
- */
371
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
372
- delete(world: World): void;
410
+ static getDimensions(bbox: THREE.Box3): {
411
+ width: number;
412
+ height: number;
413
+ depth: number;
414
+ center: THREE.Vector3;
415
+ };
416
+ static newBound(positive: boolean): THREE.Vector3;
417
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
373
418
  /** {@link Disposable.dispose} */
374
419
  dispose(): void;
420
+ get(): THREE.Box3;
421
+ getSphere(): THREE.Sphere;
422
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
423
+ reset(): void;
424
+ add(group: FragmentsGroup): void;
425
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
426
+ private static getFragmentBounds;
375
427
  }
376
- import { MiniMap } from "./src";
377
- import { Component, Updateable, World, Event, Disposable } from "../Types";
378
- import { Components } from "../Components";
379
- export declare class MiniMaps extends Component implements Updateable, Disposable {
380
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
381
- readonly onAfterUpdate: Event<unknown>;
382
- readonly onBeforeUpdate: Event<unknown>;
383
- readonly onDisposed: Event<unknown>;
428
+ import * as THREE from "three";
429
+ import * as FRAGS from "@thatopen/fragments";
430
+ import { Disposable, Component, Event, Components } from "../../core";
431
+ export interface Classification {
432
+ [system: string]: {
433
+ [className: string]: FRAGS.FragmentIdMap;
434
+ };
435
+ }
436
+ export declare class Classifier extends Component implements Disposable {
437
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
438
+ /** {@link Component.enabled} */
384
439
  enabled: boolean;
385
- list: Map<string, MiniMap>;
440
+ list: Classification;
441
+ /** {@link Disposable.onDisposed} */
442
+ readonly onDisposed: Event<unknown>;
386
443
  constructor(components: Components);
387
- create(world: World): MiniMap;
388
- delete(id: string): void;
444
+ private onFragmentsDisposed;
389
445
  dispose(): void;
390
- update(): void;
446
+ remove(guid: string): void;
447
+ find(filter?: {
448
+ [name: string]: string[];
449
+ }): FRAGS.FragmentIdMap;
450
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
451
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
452
+ byEntity(group: FRAGS.FragmentsGroup): void;
453
+ byStorey(group: FRAGS.FragmentsGroup): void;
454
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
455
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
456
+ resetColor(items: FRAGS.FragmentIdMap): void;
457
+ private saveItem;
458
+ }
459
+ import { Component, Disposable, Event, Components } from "../../core";
460
+ export declare class Exploder extends Component implements Disposable {
461
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
462
+ enabled: boolean;
463
+ height: number;
464
+ groupName: string;
465
+ /** {@link Disposable.onDisposed} */
466
+ readonly onDisposed: Event<unknown>;
467
+ list: Set<string>;
468
+ constructor(components: Components);
469
+ dispose(): void;
470
+ set(active: boolean): void;
391
471
  }
392
472
  import * as WEBIFC from "web-ifc";
393
- import * as FRAG from "@thatopen/fragments";
394
- import { Component, Components } from "../../core";
473
+ import * as FRAGS from "@thatopen/fragments";
474
+ import { IfcFragmentSettings } from "./src";
475
+ import { Component, Components, Event, Disposable } from "../../core";
476
+ export declare class IfcLoader extends Component implements Disposable {
477
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
478
+ readonly onIfcStartedLoading: Event<void>;
479
+ readonly onSetup: Event<void>;
480
+ /** {@link Disposable.onDisposed} */
481
+ readonly onDisposed: Event<string>;
482
+ settings: IfcFragmentSettings;
483
+ enabled: boolean;
484
+ webIfc: WEBIFC.IfcAPI;
485
+ private _material;
486
+ private _spatialTree;
487
+ private _metaData;
488
+ private _fragmentInstances;
489
+ private _civil;
490
+ private _visitedFragments;
491
+ private _materialT;
492
+ constructor(components: Components);
493
+ dispose(): void;
494
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
495
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
496
+ readIfcFile(data: Uint8Array): Promise<number>;
497
+ private getAllGeometries;
498
+ cleanUp(): void;
499
+ private getMesh;
500
+ private getGeometry;
501
+ private autoSetWasm;
502
+ }
503
+ import * as FRAGS from "@thatopen/fragments";
504
+ import { Components, Component } from "../../core";
505
+ export declare class FragmentHider extends Component {
506
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
507
+ enabled: boolean;
508
+ constructor(components: Components);
509
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
510
+ isolate(items: FRAGS.FragmentIdMap): void;
511
+ private updateCulledVisibility;
512
+ }
513
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
514
+ import * as THREE from "three";
515
+ import * as FRAGS from "@thatopen/fragments";
516
+ import { Component, Components, Event, Disposable } from "../../core";
517
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
395
518
  /**
396
- * Object to export all the properties from an IFC to a JS object.
519
+ * Object that can efficiently load binary files that contain
520
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
397
521
  */
398
- export declare class IfcJsonExporter extends Component {
399
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
522
+ export declare class FragmentsManager extends Component implements Disposable {
523
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
524
+ /** {@link Disposable.onDisposed} */
525
+ readonly onDisposed: Event<unknown>;
526
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
527
+ readonly onFragmentsDisposed: Event<{
528
+ groupID: string;
529
+ fragmentIDs: string[];
530
+ }>;
531
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
532
+ readonly list: Map<string, Fragment>;
533
+ readonly groups: Map<string, FragmentsGroup>;
400
534
  /** {@link Component.enabled} */
401
535
  enabled: boolean;
536
+ baseCoordinationModel: string;
537
+ private _loader;
538
+ /** The list of meshes of the created fragments. */
539
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
402
540
  constructor(components: Components);
541
+ /** {@link Disposable.dispose} */
542
+ dispose(): void;
543
+ disposeGroup(group: FragmentsGroup): void;
403
544
  /**
404
- * Exports all the properties of an IFC into an array of JS objects.
405
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
406
- * @param modelID ID of the IFC model whose properties to extract.
407
- * @param indirect whether to get the indirect relationships as well.
408
- * @param recursiveSpatial whether to get the properties of spatial items recursively
409
- * to make the location data available (e.g. absolute position of building).
545
+ * Loads a binar file that contain fragment geometry.
546
+ * @param data - The binary data to load.
547
+ * @param config - Optional configuration for loading.
548
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
549
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
550
+ * @returns The loaded FragmentsGroup.
410
551
  */
411
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
552
+ load(data: Uint8Array, config?: Partial<{
553
+ coordinate: boolean;
554
+ properties: FRAGS.IfcProperties;
555
+ relationsMap: RelationsMap;
556
+ }>): FragmentsGroup;
557
+ /**
558
+ * Export the specified fragments.
559
+ * @param group - the fragments group to be exported.
560
+ * @returns the exported data as binary buffer.
561
+ */
562
+ export(group: FragmentsGroup): Uint8Array;
563
+ coordinate(models?: FragmentsGroup[]): void;
564
+ }
565
+ import * as WEBIFC from "web-ifc";
566
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
567
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
568
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
569
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
570
+ onPropertiesStreamed: AsyncEvent<{
571
+ type: number;
572
+ data: {
573
+ [id: number]: any;
574
+ };
575
+ }>;
576
+ onProgress: AsyncEvent<number>;
577
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
578
+ /** {@link Disposable.onDisposed} */
579
+ readonly onDisposed: Event<string>;
580
+ enabled: boolean;
581
+ settings: PropertiesStreamingSettings;
582
+ webIfc: WEBIFC.IfcAPI;
583
+ dispose(): Promise<void>;
584
+ streamFromBuffer(data: Uint8Array): Promise<void>;
585
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
586
+ private readIfcFile;
587
+ private streamIfcFile;
588
+ private streamAllProperties;
589
+ private cleanUp;
590
+ }
591
+ import * as WEBIFC from "web-ifc";
592
+ import { Components, Disposable, Event, Component } from "../../core";
593
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
594
+ export declare class IfcGeometryTiler extends Component implements Disposable {
595
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
596
+ onGeometryStreamed: Event<{
597
+ buffer: Uint8Array;
598
+ data: StreamedGeometries;
599
+ }>;
600
+ onAssetStreamed: Event<StreamedAsset[]>;
601
+ onProgress: Event<number>;
602
+ onIfcLoaded: Event<Uint8Array>;
603
+ /** {@link Disposable.onDisposed} */
604
+ readonly onDisposed: Event<unknown>;
605
+ settings: IfcStreamingSettings;
606
+ enabled: boolean;
607
+ webIfc: WEBIFC.IfcAPI;
608
+ private _spatialTree;
609
+ private _metaData;
610
+ private _visitedGeometries;
611
+ private _streamSerializer;
612
+ private _geometries;
613
+ private _geometryCount;
614
+ private _civil;
615
+ private _groupSerializer;
616
+ private _assets;
617
+ private _meshesWithHoles;
618
+ constructor(components: Components);
619
+ dispose(): void;
620
+ streamFromBuffer(data: Uint8Array): Promise<void>;
621
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
622
+ private readIfcFile;
623
+ private streamIfcFile;
624
+ private streamAllGeometries;
625
+ private cleanUp;
626
+ private getMesh;
627
+ private getGeometry;
628
+ private streamAssets;
629
+ private streamGeometries;
412
630
  }
413
631
  import * as THREE from "three";
414
632
  export declare function obbFromPoints(vertices: ArrayLike<number>): {
@@ -417,17 +635,41 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
417
635
  rotation: THREE.Matrix3;
418
636
  transformation: THREE.Matrix4;
419
637
  };
638
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
639
+ import * as THREE from "three";
640
+ export declare class MaterialsUtils {
641
+ static isTransparent(material: THREE.Material): boolean;
642
+ }
643
+ import * as THREE from "three";
644
+ import { Component, Components } from "../../core";
645
+ export interface MeasureEdge {
646
+ distance: number;
647
+ points: THREE.Vector3[];
648
+ }
649
+ export declare class MeasurementUtils extends Component {
650
+ enabled: boolean;
651
+ static uuid: string;
652
+ constructor(components: Components);
653
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
654
+ edges: MeasureEdge[];
655
+ indices: Set<number>;
656
+ } | null;
657
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
658
+ private getFaceData;
659
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
660
+ p1: THREE.Vector3;
661
+ p2: THREE.Vector3;
662
+ p3: THREE.Vector3;
663
+ faceNormal: THREE.Vector3;
664
+ };
665
+ private round;
666
+ }
420
667
  export declare class UUID {
421
668
  private static _pattern;
422
669
  private static _lut;
423
670
  static create(): string;
424
671
  static validate(uuid: string): void;
425
672
  }
426
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
427
- import * as THREE from "three";
428
- export declare class MaterialsUtils {
429
- static isTransparent(material: THREE.Material): boolean;
430
- }
431
673
  import * as THREE from "three";
432
674
  import { Component, Components, Event, World } from "../core";
433
675
  export interface VertexPickerConfig {
@@ -457,19 +699,40 @@ export declare class VertexPicker extends Component {
457
699
  private getVertex;
458
700
  }
459
701
  import * as WEBIFC from "web-ifc";
460
- import { FragmentsGroup } from "@thatopen/fragments";
461
- import { Disposable, Event, Component, Components } from "../../core";
462
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
702
+ import * as FRAG from "@thatopen/fragments";
703
+ import { Component, Components } from "../../core";
463
704
  /**
464
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
465
- * It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations.
705
+ * Object to export all the properties from an IFC to a JS object.
466
706
  */
467
- export declare class IfcRelationsIndexer extends Component implements Disposable {
468
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
469
- /** {@link Disposable.onDisposed} */
470
- readonly onDisposed: Event<string>;
707
+ export declare class IfcJsonExporter extends Component {
708
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
709
+ /** {@link Component.enabled} */
471
710
  enabled: boolean;
472
- readonly onRelationsIndexed: Event<{
711
+ constructor(components: Components);
712
+ /**
713
+ * Exports all the properties of an IFC into an array of JS objects.
714
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
715
+ * @param modelID ID of the IFC model whose properties to extract.
716
+ * @param indirect whether to get the indirect relationships as well.
717
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
718
+ * to make the location data available (e.g. absolute position of building).
719
+ */
720
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
721
+ }
722
+ import * as WEBIFC from "web-ifc";
723
+ import { FragmentsGroup } from "@thatopen/fragments";
724
+ import { Disposable, Event, Component, Components } from "../../core";
725
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
726
+ /**
727
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
728
+ * It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations.
729
+ */
730
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
731
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
732
+ /** {@link Disposable.onDisposed} */
733
+ readonly onDisposed: Event<string>;
734
+ enabled: boolean;
735
+ readonly onRelationsIndexed: Event<{
473
736
  modelID: string;
474
737
  relationsMap: RelationsMap;
475
738
  }>;
@@ -568,715 +831,98 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
568
831
  */
569
832
  serializeAllRelations(): string;
570
833
  /**
571
- * Converts a JSON string representing relations between entities into a structured map.
572
- * This method parses the JSON string to reconstruct the relations map that indexes
573
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
574
- * and the values are maps where each key is a relation type ID and its value is an array
575
- * of express IDs of entities related through that relation type.
576
- *
577
- * @param json The JSON string to be parsed into the relations map.
578
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
579
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
580
- * is an array of express IDs (as numbers) of entities related through that relation type.
581
- */
582
- getRelationsMapFromJSON(json: string): RelationsMap;
583
- /**
584
- * Disposes the component, cleaning up resources and detaching event listeners.
585
- * This ensures that the component is properly cleaned up and does not leave behind any
586
- * references that could prevent garbage collection.
587
- */
588
- dispose(): void;
589
- }
590
- export type { InverseAttribute } from "./src/types";
591
- import * as WEBIFC from "web-ifc";
592
- import { FragmentsGroup } from "@thatopen/fragments";
593
- import { Component, Disposable, Event, Components } from "../../core";
594
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
595
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
596
- type NumericPropTypes = "IfcInteger" | "IfcReal";
597
- interface ChangeMap {
598
- [modelID: string]: Set<number>;
599
- }
600
- interface AttributeListener {
601
- [modelID: string]: {
602
- [expressID: number]: {
603
- [attributeName: string]: Event<String | Boolean | Number>;
604
- };
605
- };
606
- }
607
- export declare class IfcPropertiesManager extends Component implements Disposable {
608
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
609
- /** {@link Disposable.onDisposed} */
610
- readonly onDisposed: Event<string>;
611
- readonly onRequestFile: Event<unknown>;
612
- ifcToExport: ArrayBuffer | null;
613
- readonly onElementToPset: Event<{
614
- model: FragmentsGroup;
615
- psetID: number;
616
- elementID: number;
617
- }>;
618
- readonly onPropToPset: Event<{
619
- model: FragmentsGroup;
620
- psetID: number;
621
- propID: number;
622
- }>;
623
- readonly onPsetRemoved: Event<{
624
- model: FragmentsGroup;
625
- psetID: number;
626
- }>;
627
- readonly onDataChanged: Event<{
628
- model: FragmentsGroup;
629
- expressID: number;
630
- }>;
631
- wasm: {
632
- path: string;
633
- absolute: boolean;
634
- };
635
- enabled: boolean;
636
- attributeListeners: AttributeListener;
637
- selectedModel?: FragmentsGroup;
638
- changeMap: ChangeMap;
639
- constructor(components: Components);
640
- dispose(): void;
641
- private increaseMaxID;
642
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
643
- private newGUID;
644
- private getOwnerHistory;
645
- private registerChange;
646
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
647
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
648
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
649
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
650
- }>;
651
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
652
- private newSingleProperty;
653
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
654
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
655
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
656
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
657
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
658
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
659
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
660
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
661
- }
662
- export {};
663
- import * as FRAGS from "@thatopen/fragments";
664
- import { Components, Component } from "../../core";
665
- export declare class FragmentHider extends Component {
666
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
667
- enabled: boolean;
668
- constructor(components: Components);
669
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
670
- isolate(items: FRAGS.FragmentIdMap): void;
671
- private updateCulledVisibility;
672
- }
673
- import * as THREE from "three";
674
- import * as FRAGS from "@thatopen/fragments";
675
- import { Disposable, Component, Event, Components } from "../../core";
676
- export interface Classification {
677
- [system: string]: {
678
- [className: string]: FRAGS.FragmentIdMap;
679
- };
680
- }
681
- export declare class Classifier extends Component implements Disposable {
682
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
683
- /** {@link Component.enabled} */
684
- enabled: boolean;
685
- list: Classification;
686
- /** {@link Disposable.onDisposed} */
687
- readonly onDisposed: Event<unknown>;
688
- constructor(components: Components);
689
- private onFragmentsDisposed;
690
- dispose(): void;
691
- remove(guid: string): void;
692
- find(filter?: {
693
- [name: string]: string[];
694
- }): FRAGS.FragmentIdMap;
695
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
696
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
697
- byEntity(group: FRAGS.FragmentsGroup): void;
698
- byStorey(group: FRAGS.FragmentsGroup): void;
699
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
700
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
701
- resetColor(items: FRAGS.FragmentIdMap): void;
702
- private saveItem;
703
- }
704
- import * as WEBIFC from "web-ifc";
705
- import * as FRAGS from "@thatopen/fragments";
706
- import { IfcFragmentSettings } from "./src";
707
- import { Component, Components, Event, Disposable } from "../../core";
708
- export declare class IfcLoader extends Component implements Disposable {
709
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
710
- readonly onIfcStartedLoading: Event<void>;
711
- readonly onSetup: Event<void>;
712
- /** {@link Disposable.onDisposed} */
713
- readonly onDisposed: Event<string>;
714
- settings: IfcFragmentSettings;
715
- enabled: boolean;
716
- webIfc: WEBIFC.IfcAPI;
717
- private _material;
718
- private _spatialTree;
719
- private _metaData;
720
- private _fragmentInstances;
721
- private _civil;
722
- private _visitedFragments;
723
- private _materialT;
724
- constructor(components: Components);
725
- dispose(): void;
726
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
727
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
728
- readIfcFile(data: Uint8Array): Promise<number>;
729
- private getAllGeometries;
730
- cleanUp(): void;
731
- private getMesh;
732
- private getGeometry;
733
- private autoSetWasm;
734
- }
735
- import * as THREE from "three";
736
- import * as FRAGS from "@thatopen/fragments";
737
- import { FragmentsGroup } from "@thatopen/fragments";
738
- import { Component, Components, Disposable, Event } from "../../core";
739
- /**
740
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
741
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
742
- */
743
- export declare class BoundingBoxer extends Component implements Disposable {
744
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
745
- /** {@link Component.enabled} */
746
- enabled: boolean;
747
- /** {@link Disposable.onDisposed} */
748
- readonly onDisposed: Event<unknown>;
749
- private _absoluteMin;
750
- private _absoluteMax;
751
- private _meshes;
752
- constructor(components: Components);
753
- static getDimensions(bbox: THREE.Box3): {
754
- width: number;
755
- height: number;
756
- depth: number;
757
- center: THREE.Vector3;
758
- };
759
- static newBound(positive: boolean): THREE.Vector3;
760
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
761
- /** {@link Disposable.dispose} */
762
- dispose(): void;
763
- get(): THREE.Box3;
764
- getSphere(): THREE.Sphere;
765
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
766
- reset(): void;
767
- add(group: FragmentsGroup): void;
768
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
769
- private static getFragmentBounds;
770
- }
771
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
772
- import * as THREE from "three";
773
- import * as FRAGS from "@thatopen/fragments";
774
- import { Component, Components, Event, Disposable } from "../../core";
775
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
776
- /**
777
- * Object that can efficiently load binary files that contain
778
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
779
- */
780
- export declare class FragmentsManager extends Component implements Disposable {
781
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
782
- /** {@link Disposable.onDisposed} */
783
- readonly onDisposed: Event<unknown>;
784
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
785
- readonly onFragmentsDisposed: Event<{
786
- groupID: string;
787
- fragmentIDs: string[];
788
- }>;
789
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
790
- readonly list: Map<string, Fragment>;
791
- readonly groups: Map<string, FragmentsGroup>;
792
- /** {@link Component.enabled} */
793
- enabled: boolean;
794
- baseCoordinationModel: string;
795
- private _loader;
796
- /** The list of meshes of the created fragments. */
797
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
798
- constructor(components: Components);
799
- /** {@link Disposable.dispose} */
800
- dispose(): void;
801
- disposeGroup(group: FragmentsGroup): void;
802
- /**
803
- * Loads a binar file that contain fragment geometry.
804
- * @param data - The binary data to load.
805
- * @param config - Optional configuration for loading.
806
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
807
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
808
- * @returns The loaded FragmentsGroup.
809
- */
810
- load(data: Uint8Array, config?: Partial<{
811
- coordinate: boolean;
812
- properties: FRAGS.IfcProperties;
813
- relationsMap: RelationsMap;
814
- }>): FragmentsGroup;
815
- /**
816
- * Export the specified fragments.
817
- * @param group - the fragments group to be exported.
818
- * @returns the exported data as binary buffer.
819
- */
820
- export(group: FragmentsGroup): Uint8Array;
821
- coordinate(models?: FragmentsGroup[]): void;
822
- }
823
- import { Component, Disposable, Event, Components } from "../../core";
824
- export declare class Exploder extends Component implements Disposable {
825
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
826
- enabled: boolean;
827
- height: number;
828
- groupName: string;
829
- /** {@link Disposable.onDisposed} */
830
- readonly onDisposed: Event<unknown>;
831
- list: Set<string>;
832
- constructor(components: Components);
833
- dispose(): void;
834
- set(active: boolean): void;
835
- }
836
- import * as WEBIFC from "web-ifc";
837
- import { Components, Disposable, Event, Component } from "../../core";
838
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
839
- export declare class IfcGeometryTiler extends Component implements Disposable {
840
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
841
- onGeometryStreamed: Event<{
842
- buffer: Uint8Array;
843
- data: StreamedGeometries;
844
- }>;
845
- onAssetStreamed: Event<StreamedAsset[]>;
846
- onProgress: Event<number>;
847
- onIfcLoaded: Event<Uint8Array>;
848
- /** {@link Disposable.onDisposed} */
849
- readonly onDisposed: Event<unknown>;
850
- settings: IfcStreamingSettings;
851
- enabled: boolean;
852
- webIfc: WEBIFC.IfcAPI;
853
- private _spatialTree;
854
- private _metaData;
855
- private _visitedGeometries;
856
- private _streamSerializer;
857
- private _geometries;
858
- private _geometryCount;
859
- private _civil;
860
- private _groupSerializer;
861
- private _assets;
862
- private _meshesWithHoles;
863
- constructor(components: Components);
864
- dispose(): void;
865
- streamFromBuffer(data: Uint8Array): Promise<void>;
866
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
867
- private readIfcFile;
868
- private streamIfcFile;
869
- private streamAllGeometries;
870
- private cleanUp;
871
- private getMesh;
872
- private getGeometry;
873
- private streamAssets;
874
- private streamGeometries;
875
- }
876
- import * as WEBIFC from "web-ifc";
877
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
878
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
879
- export declare class IfcPropertiesTiler extends Component implements Disposable {
880
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
881
- onPropertiesStreamed: AsyncEvent<{
882
- type: number;
883
- data: {
884
- [id: number]: any;
885
- };
886
- }>;
887
- onProgress: AsyncEvent<number>;
888
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
889
- /** {@link Disposable.onDisposed} */
890
- readonly onDisposed: Event<string>;
891
- enabled: boolean;
892
- settings: PropertiesStreamingSettings;
893
- webIfc: WEBIFC.IfcAPI;
894
- dispose(): Promise<void>;
895
- streamFromBuffer(data: Uint8Array): Promise<void>;
896
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
897
- private readIfcFile;
898
- private streamIfcFile;
899
- private streamAllProperties;
900
- private cleanUp;
901
- }
902
- import * as THREE from "three";
903
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
904
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
905
- /** {@link Disposable.onDisposed} */
906
- readonly onDisposed: Event<unknown>;
907
- readonly onAfterUpdate: Event<unknown>;
908
- readonly onBeforeUpdate: Event<unknown>;
909
- readonly onResize: Event<THREE.Vector2>;
910
- frontOffset: number;
911
- overrideMaterial: THREE.MeshDepthMaterial;
912
- backgroundColor: THREE.Color;
913
- renderer: THREE.WebGLRenderer;
914
- enabled: boolean;
915
- world: World;
916
- private _lockRotation;
917
- private _camera;
918
- private _plane;
919
- private _size;
920
- private _tempVector1;
921
- private _tempVector2;
922
- private _tempTarget;
923
- private readonly down;
924
- get lockRotation(): boolean;
925
- set lockRotation(active: boolean);
926
- get zoom(): number;
927
- set zoom(value: number);
928
- constructor(world: World);
929
- dispose(): void;
930
- get(): THREE.OrthographicCamera;
931
- update(): void;
932
- getSize(): THREE.Vector2;
933
- resize(size?: THREE.Vector2): void;
934
- private updatePlanes;
935
- }
936
- import * as THREE from "three";
937
- import { Component, Components } from "../../core";
938
- export interface MeasureEdge {
939
- distance: number;
940
- points: THREE.Vector3[];
941
- }
942
- export declare class MeasurementUtils extends Component {
943
- enabled: boolean;
944
- static uuid: string;
945
- constructor(components: Components);
946
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
947
- edges: MeasureEdge[];
948
- indices: Set<number>;
949
- } | null;
950
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
951
- private getFaceData;
952
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
953
- p1: THREE.Vector3;
954
- p2: THREE.Vector3;
955
- p3: THREE.Vector3;
956
- faceNormal: THREE.Vector3;
957
- };
958
- private round;
959
- }
960
- import * as FRAGS from "@thatopen/fragments";
961
- export declare class IfcPropertiesUtils {
962
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
963
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
964
- [attribute: string]: any;
965
- } | null>;
966
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
967
- [relatingID: number]: number[];
968
- }>;
969
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
970
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
971
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
972
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
973
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
974
- key: string | null;
975
- name: string | null;
976
- }>;
977
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
978
- key: string | null;
979
- value: number | null;
980
- }>;
981
- static isRel(expressID: number): boolean;
982
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
983
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
984
- }
985
- export declare const IfcElements: {
986
- [key: number]: string;
987
- };
988
- export declare const GeometryTypes: Set<number>;
989
- import * as WEBIFC from "web-ifc";
990
- export interface IfcItemsCategories {
991
- [itemID: number]: number;
992
- }
993
- export declare class IfcCategories {
994
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
995
- }
996
- export declare const IfcCategoryMap: {
997
- [key: number]: string;
998
- };
999
- import { InverseAttribute } from "./types";
1000
- export declare const relToAttributesMap: Map<number, {
1001
- forRelating: InverseAttribute;
1002
- forRelated: InverseAttribute;
1003
- }>;
1004
- import { NavigationMode } from "./types";
1005
- import { OrthoPerspectiveCamera } from "../index";
1006
- /**
1007
- * A {@link NavigationMode} that allows first person navigation,
1008
- * simulating FPS video games.
1009
- */
1010
- export declare class FirstPersonMode implements NavigationMode {
1011
- private camera;
1012
- /** {@link NavigationMode.enabled} */
1013
- enabled: boolean;
1014
- /** {@link NavigationMode.id} */
1015
- readonly id = "FirstPerson";
1016
- constructor(camera: OrthoPerspectiveCamera);
1017
- /** {@link NavigationMode.set} */
1018
- set(active: boolean): void;
1019
- private setupFirstPersonCamera;
1020
- }
1021
- import * as THREE from "three";
1022
- import { CameraProjection } from "./types";
1023
- import { Event } from "../../Types";
1024
- import { OrthoPerspectiveCamera } from "../index";
1025
- /**
1026
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1027
- */
1028
- export declare class ProjectionManager {
1029
- /**
1030
- * Event that fires when the {@link CameraProjection} changes.
1031
- */
1032
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1033
- current: CameraProjection;
1034
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1035
- private _component;
1036
- private _previousDistance;
1037
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1038
- matchOrthoDistanceEnabled: boolean;
1039
- constructor(camera: OrthoPerspectiveCamera);
1040
- /**
1041
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1042
- *
1043
- * @param projection - the new projection to set. If it is the current projection,
1044
- * it will have no effect.
1045
- */
1046
- set(projection: CameraProjection): Promise<void>;
1047
- /**
1048
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1049
- * and vice versa.
1050
- */
1051
- toggle(): Promise<void>;
1052
- private setOrthoCamera;
1053
- private getPerspectiveDims;
1054
- private setupOrthoCamera;
1055
- private getDistance;
1056
- private setPerspectiveCamera;
1057
- }
1058
- /**
1059
- * The projection system of the camera.
1060
- */
1061
- export type CameraProjection = "Perspective" | "Orthographic";
1062
- /**
1063
- * The extensible list of supported navigation modes.
1064
- */
1065
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1066
- /**
1067
- * An object that determines the behavior of the camera controls
1068
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1069
- */
1070
- export interface NavigationMode {
1071
- /** The unique ID of this navigation mode. */
1072
- id: NavModeID;
1073
- /**
1074
- * Enable or disable this navigation mode.
1075
- * When a new navigation mode is enabled, the previous navigation mode
1076
- * must be disabled.
1077
- *
1078
- * @param active - whether to enable or disable this mode.
1079
- * @param options - any additional data required to enable or disable it.
1080
- * */
1081
- set: (active: boolean, options?: any) => void;
1082
- /** Whether this navigation mode is active or not. */
1083
- enabled: boolean;
1084
- }
1085
- import { NavigationMode } from "./types";
1086
- import { OrthoPerspectiveCamera } from "../index";
1087
- /**
1088
- * A {@link NavigationMode} that allows 3D navigation and panning
1089
- * like in many 3D and CAD softwares.
1090
- */
1091
- export declare class OrbitMode implements NavigationMode {
1092
- camera: OrthoPerspectiveCamera;
1093
- /** {@link NavigationMode.enabled} */
1094
- enabled: boolean;
1095
- /** {@link NavigationMode.id} */
1096
- readonly id = "Orbit";
1097
- constructor(camera: OrthoPerspectiveCamera);
1098
- /** {@link NavigationMode.set} */
1099
- set(active: boolean): void;
1100
- private activateOrbitControls;
1101
- }
1102
- import { NavigationMode } from "./types";
1103
- import { OrthoPerspectiveCamera } from "../index";
1104
- /**
1105
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1106
- * like many BIM tools.
1107
- */
1108
- export declare class PlanMode implements NavigationMode {
1109
- private camera;
1110
- /** {@link NavigationMode.enabled} */
1111
- enabled: boolean;
1112
- /** {@link NavigationMode.id} */
1113
- readonly id = "Plan";
1114
- private mouseAction1?;
1115
- private mouseAction2?;
1116
- private mouseInitialized;
1117
- private readonly defaultAzimuthSpeed;
1118
- private readonly defaultPolarSpeed;
1119
- constructor(camera: OrthoPerspectiveCamera);
1120
- /** {@link NavigationMode.set} */
1121
- set(active: boolean): void;
1122
- }
1123
- import * as THREE from "three";
1124
- import { Components } from "../../Components";
1125
- import { AsyncEvent, Event, World } from "../../Types";
1126
- export interface CullerRendererSettings {
1127
- updateInterval?: number;
1128
- width?: number;
1129
- height?: number;
1130
- autoUpdate?: boolean;
1131
- }
1132
- /**
1133
- * A base renderer to determine visibility on screen
1134
- */
1135
- export declare class CullerRenderer {
1136
- /** {@link Disposable.onDisposed} */
1137
- readonly onDisposed: Event<string>;
1138
- /**
1139
- * Fires after making the visibility check to the meshes. It lists the
1140
- * meshes that are currently visible, and the ones that were visible
1141
- * just before but not anymore.
1142
- */
1143
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1144
- /** {@link Component.enabled} */
1145
- enabled: boolean;
1146
- /**
1147
- * Needs to check whether there are objects that need to be hidden or shown.
1148
- * You can bind this to the camera movement, to a certain interval, etc.
1149
- */
1150
- needsUpdate: boolean;
1151
- /**
1152
- * Render the internal scene used to determine the object visibility. Used
1153
- * for debugging purposes.
1154
- */
1155
- renderDebugFrame: boolean;
1156
- components: Components;
1157
- readonly world: World;
1158
- readonly renderer: THREE.WebGLRenderer;
1159
- protected autoUpdate: boolean;
1160
- protected updateInterval: number;
1161
- protected readonly worker: Worker;
1162
- protected readonly scene: THREE.Scene;
1163
- private _width;
1164
- private _height;
1165
- private _availableColor;
1166
- private readonly renderTarget;
1167
- private readonly bufferSize;
1168
- private readonly _buffer;
1169
- protected _isWorkerBusy: boolean;
1170
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1171
- /** {@link Disposable.dispose} */
1172
- dispose(): void;
1173
- /**
1174
- * The function that the culler uses to reprocess the scene. Generally it's
1175
- * better to call needsUpdate, but you can also call this to force it.
1176
- * @param force if true, it will refresh the scene even if needsUpdate is
1177
- * not true.
1178
- */
1179
- updateVisibility: (force?: boolean) => Promise<void>;
1180
- protected getAvailableColor(): {
1181
- r: number;
1182
- g: number;
1183
- b: number;
1184
- code: string;
1185
- };
1186
- protected increaseColor(): void;
1187
- protected decreaseColor(): void;
1188
- private applySettings;
1189
- }
1190
- import * as THREE from "three";
1191
- import { Components } from "../../Components";
1192
- import { Event, World, Disposable } from "../../Types";
1193
- import { Mouse } from "./mouse";
1194
- /**
1195
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1196
- * that allows to easily get items from the scene using the mouse and touch
1197
- * events.
1198
- */
1199
- export declare class SimpleRaycaster implements Disposable {
1200
- /** {@link Component.enabled} */
1201
- enabled: boolean;
1202
- components: Components;
1203
- /** {@link Disposable.onDisposed} */
1204
- readonly onDisposed: Event<unknown>;
1205
- /** The position of the mouse in the screen. */
1206
- readonly mouse: Mouse;
1207
- readonly three: THREE.Raycaster;
1208
- world: World;
1209
- constructor(components: Components, world: World);
1210
- /** {@link Disposable.dispose} */
1211
- dispose(): void;
1212
- /**
1213
- * Throws a ray from the camera to the mouse or touch event point and returns
1214
- * the first item found. This also takes into account the clipping planes
1215
- * used by the renderer.
1216
- *
1217
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1218
- * to query. If not provided, it will query all the meshes stored in
1219
- * {@link Components.meshes}.
1220
- */
1221
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1222
- 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;
1223
- private intersect;
1224
- private filterClippingPlanes;
1225
- }
1226
- import * as THREE from "three";
1227
- import { Disposable, Event } from "../../Types";
1228
- /**
1229
- * A helper to easily get the real position of the mouse in the Three.js canvas
1230
- * to work with tools like the
1231
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1232
- * been transformed through CSS or doesn't occupy the whole screen.
1233
- */
1234
- export declare class Mouse implements Disposable {
1235
- dom: HTMLCanvasElement;
1236
- private _event?;
1237
- private _position;
1238
- /** {@link Disposable.onDisposed} */
1239
- readonly onDisposed: Event<unknown>;
1240
- constructor(dom: HTMLCanvasElement);
1241
- /**
1242
- * The real position of the mouse of the Three.js canvas.
834
+ * Converts a JSON string representing relations between entities into a structured map.
835
+ * This method parses the JSON string to reconstruct the relations map that indexes
836
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
837
+ * and the values are maps where each key is a relation type ID and its value is an array
838
+ * of express IDs of entities related through that relation type.
839
+ *
840
+ * @param json The JSON string to be parsed into the relations map.
841
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
842
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
843
+ * is an array of express IDs (as numbers) of entities related through that relation type.
844
+ */
845
+ getRelationsMapFromJSON(json: string): RelationsMap;
846
+ /**
847
+ * Disposes the component, cleaning up resources and detaching event listeners.
848
+ * This ensures that the component is properly cleaned up and does not leave behind any
849
+ * references that could prevent garbage collection.
1243
850
  */
1244
- get position(): THREE.Vector2;
1245
- /** {@link Disposable.dispose} */
1246
851
  dispose(): void;
1247
- private getPositionY;
1248
- private getPositionX;
1249
- private updateMouseInfo;
1250
- private setupEvents;
1251
852
  }
1252
- import * as THREE from "three";
1253
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1254
- import { Components } from "../../Components";
1255
- import { Event, World } from "../../Types";
1256
- /**
1257
- * A renderer to determine a mesh visibility on screen
1258
- */
1259
- export declare class MeshCullerRenderer extends CullerRenderer {
1260
- threshold: number;
1261
- readonly onViewUpdated: Event<{
1262
- seen: Set<THREE.Mesh>;
1263
- unseen: Set<THREE.Mesh>;
853
+ export type { InverseAttribute } from "./src/types";
854
+ import * as WEBIFC from "web-ifc";
855
+ import { FragmentsGroup } from "@thatopen/fragments";
856
+ import { Component, Disposable, Event, Components } from "../../core";
857
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
858
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
859
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
860
+ interface ChangeMap {
861
+ [modelID: string]: Set<number>;
862
+ }
863
+ interface AttributeListener {
864
+ [modelID: string]: {
865
+ [expressID: number]: {
866
+ [attributeName: string]: Event<String | Boolean | Number>;
867
+ };
868
+ };
869
+ }
870
+ export declare class IfcPropertiesManager extends Component implements Disposable {
871
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
872
+ /** {@link Disposable.onDisposed} */
873
+ readonly onDisposed: Event<string>;
874
+ readonly onRequestFile: Event<unknown>;
875
+ ifcToExport: ArrayBuffer | null;
876
+ readonly onElementToPset: Event<{
877
+ model: FragmentsGroup;
878
+ psetID: number;
879
+ elementID: number;
1264
880
  }>;
1265
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1266
- isProcessing: boolean;
1267
- private _colorCodeMeshMap;
1268
- private _meshIDColorCodeMap;
1269
- private _currentVisibleMeshes;
1270
- private _recentlyHiddenMeshes;
1271
- private _intervalID;
1272
- private readonly _transparentMat;
1273
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
881
+ readonly onPropToPset: Event<{
882
+ model: FragmentsGroup;
883
+ psetID: number;
884
+ propID: number;
885
+ }>;
886
+ readonly onPsetRemoved: Event<{
887
+ model: FragmentsGroup;
888
+ psetID: number;
889
+ }>;
890
+ readonly onDataChanged: Event<{
891
+ model: FragmentsGroup;
892
+ expressID: number;
893
+ }>;
894
+ wasm: {
895
+ path: string;
896
+ absolute: boolean;
897
+ };
898
+ enabled: boolean;
899
+ attributeListeners: AttributeListener;
900
+ selectedModel?: FragmentsGroup;
901
+ changeMap: ChangeMap;
902
+ constructor(components: Components);
1274
903
  dispose(): void;
1275
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1276
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1277
- private handleWorkerMessage;
1278
- private getAvailableMaterial;
904
+ private increaseMaxID;
905
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
906
+ private newGUID;
907
+ private getOwnerHistory;
908
+ private registerChange;
909
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
910
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
911
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
912
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
913
+ }>;
914
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
915
+ private newSingleProperty;
916
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
917
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
918
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
919
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
920
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
921
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
922
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
923
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
1279
924
  }
925
+ export {};
1280
926
  import * as WEBIFC from "web-ifc";
1281
927
  import { IfcItemsCategories } from "../../../ifc";
1282
928
  export declare class SpatialStructure {
@@ -1285,7 +931,79 @@ export declare class SpatialStructure {
1285
931
  setUp(webIfc: WEBIFC.IfcAPI): void;
1286
932
  cleanUp(): void;
1287
933
  }
1288
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
934
+ import * as THREE from "three";
935
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
936
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
937
+ /** {@link Disposable.onDisposed} */
938
+ readonly onDisposed: Event<unknown>;
939
+ readonly onAfterUpdate: Event<unknown>;
940
+ readonly onBeforeUpdate: Event<unknown>;
941
+ readonly onResize: Event<THREE.Vector2>;
942
+ frontOffset: number;
943
+ overrideMaterial: THREE.MeshDepthMaterial;
944
+ backgroundColor: THREE.Color;
945
+ renderer: THREE.WebGLRenderer;
946
+ enabled: boolean;
947
+ world: World;
948
+ private _lockRotation;
949
+ private _camera;
950
+ private _plane;
951
+ private _size;
952
+ private _tempVector1;
953
+ private _tempVector2;
954
+ private _tempTarget;
955
+ private readonly down;
956
+ get lockRotation(): boolean;
957
+ set lockRotation(active: boolean);
958
+ get zoom(): number;
959
+ set zoom(value: number);
960
+ constructor(world: World);
961
+ dispose(): void;
962
+ get(): THREE.OrthographicCamera;
963
+ update(): void;
964
+ getSize(): THREE.Vector2;
965
+ resize(size?: THREE.Vector2): void;
966
+ private updatePlanes;
967
+ }
968
+ export declare const GeometryTypes: Set<number>;
969
+ import * as WEBIFC from "web-ifc";
970
+ export interface IfcItemsCategories {
971
+ [itemID: number]: number;
972
+ }
973
+ export declare class IfcCategories {
974
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
975
+ }
976
+ export declare const IfcElements: {
977
+ [key: number]: string;
978
+ };
979
+ import * as FRAGS from "@thatopen/fragments";
980
+ export declare class IfcPropertiesUtils {
981
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
982
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
983
+ [attribute: string]: any;
984
+ } | null>;
985
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
986
+ [relatingID: number]: number[];
987
+ }>;
988
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
989
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
990
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
991
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
992
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
993
+ key: string | null;
994
+ name: string | null;
995
+ }>;
996
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
997
+ key: string | null;
998
+ value: number | null;
999
+ }>;
1000
+ static isRel(expressID: number): boolean;
1001
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1002
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1003
+ }
1004
+ export declare const IfcCategoryMap: {
1005
+ [key: number]: string;
1006
+ };
1289
1007
  /**
1290
1008
  * Simple event handler by
1291
1009
  * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
@@ -1320,6 +1038,45 @@ export declare class Event<T> {
1320
1038
  reset(): void;
1321
1039
  private handlers;
1322
1040
  }
1041
+ /**
1042
+ * Simple event handler by
1043
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1044
+ * Keep in mind that:
1045
+ * - If you want to remove it later, you might want to declare the callback as
1046
+ * an object.
1047
+ * - If you want to maintain the reference to 'this', you will need to declare
1048
+ * the callback as an arrow function.
1049
+ */
1050
+ export declare class AsyncEvent<T> {
1051
+ /**
1052
+ * Add a callback to this event instance.
1053
+ * @param handler - the callback to be added to this event.
1054
+ */
1055
+ add(handler: T extends void ? {
1056
+ (): Promise<void>;
1057
+ } : {
1058
+ (data: T): Promise<void>;
1059
+ }): void;
1060
+ /**
1061
+ * Removes a callback from this event instance.
1062
+ * @param handler - the callback to be removed from this event.
1063
+ */
1064
+ remove(handler: T extends void ? {
1065
+ (): Promise<void>;
1066
+ } : {
1067
+ (data: T): Promise<void>;
1068
+ }): void;
1069
+ /** Triggers all the callbacks assigned to this event. */
1070
+ trigger: (data?: T) => Promise<void>;
1071
+ /** Gets rid of all the suscribed events. */
1072
+ reset(): void;
1073
+ private handlers;
1074
+ }
1075
+ import { InverseAttribute } from "./types";
1076
+ export declare const relToAttributesMap: Map<number, {
1077
+ forRelating: InverseAttribute;
1078
+ forRelated: InverseAttribute;
1079
+ }>;
1323
1080
  import * as THREE from "three";
1324
1081
  import CameraControls from "camera-controls";
1325
1082
  import { Event } from "./event";
@@ -1440,8 +1197,45 @@ export interface BVHGeometry extends THREE.BufferGeometry {
1440
1197
  /**
1441
1198
  * Whether a camera uses the Camera Controls library.
1442
1199
  */
1443
- export interface CameraControllable {
1444
- controls: CameraControls;
1200
+ export interface CameraControllable {
1201
+ controls: CameraControls;
1202
+ }
1203
+ import { Base } from "./base";
1204
+ /**
1205
+ * Components are the building blocks of this library. Components are singleton
1206
+ * elements that contain specific functionality. For instance, the SimpleClipper
1207
+ * Component can create, delete and handle 3D clipping planes. Components must be
1208
+ * unique (they can't be instanced more than once), and have a static UUID that
1209
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1210
+ * instance.
1211
+ */
1212
+ export declare abstract class Component extends Base {
1213
+ /**
1214
+ * Whether this component is active or not. The behaviour can vary depending
1215
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1216
+ * dimensions, while a disabled camera will stop moving. A disabled component
1217
+ * will not be updated automatically each frame.
1218
+ */
1219
+ abstract enabled: boolean;
1220
+ }
1221
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1222
+ import { Components } from "../../Components";
1223
+ /**
1224
+ * Base class of the library. Useful for finding out the interfaces it implements.
1225
+ */
1226
+ export declare abstract class Base {
1227
+ components: Components;
1228
+ constructor(components: Components);
1229
+ /** Whether is component is {@link Disposable}. */
1230
+ isDisposeable: () => this is Disposable;
1231
+ /** Whether is component is {@link Resizeable}. */
1232
+ isResizeable: () => this is Resizeable;
1233
+ /** Whether is component is {@link Updateable}. */
1234
+ isUpdateable: () => this is Updateable;
1235
+ /** Whether is component is {@link Hideable}. */
1236
+ isHideable: () => this is Hideable;
1237
+ /** Whether is component is {@link Configurable}. */
1238
+ isConfigurable: () => this is Configurable<any>;
1445
1239
  }
1446
1240
  import { Base } from "./base";
1447
1241
  import { World } from "./world";
@@ -1460,24 +1254,6 @@ export declare abstract class BaseWorldItem extends Base {
1460
1254
  currentWorld: World | null;
1461
1255
  protected constructor(components: Components);
1462
1256
  }
1463
- import { Base } from "./base";
1464
- /**
1465
- * Components are the building blocks of this library. Components are singleton
1466
- * elements that contain specific functionality. For instance, the SimpleClipper
1467
- * Component can create, delete and handle 3D clipping planes. Components must be
1468
- * unique (they can't be instanced more than once), and have a static UUID that
1469
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1470
- * instance.
1471
- */
1472
- export declare abstract class Component extends Base {
1473
- /**
1474
- * Whether this component is active or not. The behaviour can vary depending
1475
- * on the type of component. E.g. a disabled dimension tool will stop creating
1476
- * dimensions, while a disabled camera will stop moving. A disabled component
1477
- * will not be updated automatically each frame.
1478
- */
1479
- abstract enabled: boolean;
1480
- }
1481
1257
  import * as THREE from "three";
1482
1258
  import CameraControls from "camera-controls";
1483
1259
  import { BaseWorldItem } from "./base-world-item";
@@ -1490,19 +1266,6 @@ export declare abstract class BaseCamera extends BaseWorldItem {
1490
1266
  hasCameraControls: () => this is CameraControllable;
1491
1267
  }
1492
1268
  import * as THREE from "three";
1493
- import { Disposable } from "./interfaces";
1494
- import { Event } from "./event";
1495
- import { Components } from "../../Components";
1496
- import { BaseWorldItem } from "./base-world-item";
1497
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1498
- /** {@link Disposable.onDisposed} */
1499
- readonly onDisposed: Event<unknown>;
1500
- abstract three: THREE.Object3D;
1501
- protected constructor(components: Components);
1502
- /** {@link Disposable.dispose} */
1503
- dispose(): void;
1504
- }
1505
- import * as THREE from "three";
1506
1269
  import { Vector2 } from "three";
1507
1270
  import { Event } from "./event";
1508
1271
  import { BaseWorldItem } from "./base-world-item";
@@ -1543,6 +1306,93 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1543
1306
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1544
1307
  }
1545
1308
  import * as THREE from "three";
1309
+ import { Disposable } from "./interfaces";
1310
+ import { Event } from "./event";
1311
+ import { Components } from "../../Components";
1312
+ import { BaseWorldItem } from "./base-world-item";
1313
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1314
+ /** {@link Disposable.onDisposed} */
1315
+ readonly onDisposed: Event<unknown>;
1316
+ abstract three: THREE.Object3D;
1317
+ protected constructor(components: Components);
1318
+ /** {@link Disposable.dispose} */
1319
+ dispose(): void;
1320
+ }
1321
+ import * as THREE from "three";
1322
+ import { BaseScene } from "./base-scene";
1323
+ import { BaseCamera } from "./base-camera";
1324
+ import { BaseRenderer } from "./base-renderer";
1325
+ import { Updateable, Disposable } from "./interfaces";
1326
+ export interface World extends Disposable, Updateable {
1327
+ meshes: Set<THREE.Mesh>;
1328
+ scene: BaseScene;
1329
+ camera: BaseCamera;
1330
+ renderer: BaseRenderer | null;
1331
+ uuid: string;
1332
+ }
1333
+ import * as THREE from "three";
1334
+ import { Disposable, Event } from "../../Types";
1335
+ /**
1336
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1337
+ * to work with tools like the
1338
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1339
+ * been transformed through CSS or doesn't occupy the whole screen.
1340
+ */
1341
+ export declare class Mouse implements Disposable {
1342
+ dom: HTMLCanvasElement;
1343
+ private _event?;
1344
+ private _position;
1345
+ /** {@link Disposable.onDisposed} */
1346
+ readonly onDisposed: Event<unknown>;
1347
+ constructor(dom: HTMLCanvasElement);
1348
+ /**
1349
+ * The real position of the mouse of the Three.js canvas.
1350
+ */
1351
+ get position(): THREE.Vector2;
1352
+ /** {@link Disposable.dispose} */
1353
+ dispose(): void;
1354
+ private getPositionY;
1355
+ private getPositionX;
1356
+ private updateMouseInfo;
1357
+ private setupEvents;
1358
+ }
1359
+ import * as THREE from "three";
1360
+ import { Components } from "../../Components";
1361
+ import { Event, World, Disposable } from "../../Types";
1362
+ import { Mouse } from "./mouse";
1363
+ /**
1364
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1365
+ * that allows to easily get items from the scene using the mouse and touch
1366
+ * events.
1367
+ */
1368
+ export declare class SimpleRaycaster implements Disposable {
1369
+ /** {@link Component.enabled} */
1370
+ enabled: boolean;
1371
+ components: Components;
1372
+ /** {@link Disposable.onDisposed} */
1373
+ readonly onDisposed: Event<unknown>;
1374
+ /** The position of the mouse in the screen. */
1375
+ readonly mouse: Mouse;
1376
+ readonly three: THREE.Raycaster;
1377
+ world: World;
1378
+ constructor(components: Components, world: World);
1379
+ /** {@link Disposable.dispose} */
1380
+ dispose(): void;
1381
+ /**
1382
+ * Throws a ray from the camera to the mouse or touch event point and returns
1383
+ * the first item found. This also takes into account the clipping planes
1384
+ * used by the renderer.
1385
+ *
1386
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1387
+ * to query. If not provided, it will query all the meshes stored in
1388
+ * {@link Components.meshes}.
1389
+ */
1390
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1391
+ 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;
1392
+ private intersect;
1393
+ private filterClippingPlanes;
1394
+ }
1395
+ import * as THREE from "three";
1546
1396
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1547
1397
  import { Components } from "../../Components";
1548
1398
  export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
@@ -1568,39 +1418,113 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
1568
1418
  update(delta?: number): void;
1569
1419
  dispose(disposeResources?: boolean): void;
1570
1420
  }
1421
+ import * as THREE from "three";
1422
+ import { BaseScene, Configurable, Event } from "../../Types";
1423
+ import { Components } from "../../Components";
1424
+ export interface SimpleSceneConfig {
1425
+ directionalLight: {
1426
+ color: THREE.Color;
1427
+ intensity: number;
1428
+ position: THREE.Vector3;
1429
+ };
1430
+ ambientLight: {
1431
+ color: THREE.Color;
1432
+ intensity: number;
1433
+ };
1434
+ }
1571
1435
  /**
1572
- * Simple event handler by
1573
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1574
- * Keep in mind that:
1575
- * - If you want to remove it later, you might want to declare the callback as
1576
- * an object.
1577
- * - If you want to maintain the reference to 'this', you will need to declare
1578
- * the callback as an arrow function.
1436
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1437
+ * objects hierarchically, and easily dispose them when you are finished with it.
1438
+ * @noInheritDoc
1579
1439
  */
1580
- export declare class AsyncEvent<T> {
1581
- /**
1582
- * Add a callback to this event instance.
1583
- * @param handler - the callback to be added to this event.
1584
- */
1585
- add(handler: T extends void ? {
1586
- (): Promise<void>;
1587
- } : {
1588
- (data: T): Promise<void>;
1589
- }): void;
1440
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1441
+ /** {@link Configurable.isSetup} */
1442
+ isSetup: boolean;
1443
+ three: THREE.Scene;
1444
+ /** {@link Configurable.onSetup} */
1445
+ readonly onSetup: Event<SimpleScene>;
1446
+ config: Required<SimpleSceneConfig>;
1447
+ constructor(components: Components);
1448
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1449
+ setup(config?: Partial<SimpleSceneConfig>): void;
1450
+ }
1451
+ import * as THREE from "three";
1452
+ import { BaseRenderer, Event } from "../../Types";
1453
+ import { Components } from "../../Components";
1454
+ /**
1455
+ * A basic renderer capable of rendering
1456
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1457
+ */
1458
+ export declare class SimpleRenderer extends BaseRenderer {
1459
+ enabled: boolean;
1460
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1461
+ container: HTMLElement;
1462
+ three: THREE.WebGLRenderer;
1463
+ protected _canvas: HTMLCanvasElement;
1464
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1465
+ protected _resizeObserver: ResizeObserver | null;
1466
+ protected onContainerUpdated: Event<unknown>;
1467
+ private _resizing;
1468
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1469
+ /** {@link Updateable.update} */
1470
+ update(): void;
1471
+ /** {@link Disposable.dispose} */
1472
+ dispose(): void;
1473
+ /** {@link Resizeable.getSize}. */
1474
+ getSize(): THREE.Vector2;
1475
+ /** {@link Resizeable.resize} */
1476
+ resize: (size?: THREE.Vector2) => void;
1477
+ setupEvents(active: boolean): void;
1478
+ private resizeEvent;
1479
+ private setupRenderer;
1480
+ private onContextLost;
1481
+ private onContextBack;
1482
+ }
1483
+ import * as THREE from "three";
1484
+ import CameraControls from "camera-controls";
1485
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1486
+ import { Components } from "../../Components";
1487
+ /**
1488
+ * A basic camera that uses
1489
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1490
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1491
+ * what features it offers.
1492
+ */
1493
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1494
+ /** {@link Updateable.onBeforeUpdate} */
1495
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1496
+ /** {@link Updateable.onAfterUpdate} */
1497
+ readonly onAfterUpdate: Event<SimpleCamera>;
1498
+ readonly onAspectUpdated: Event<unknown>;
1499
+ /** {@link Disposable.onDisposed} */
1500
+ readonly onDisposed: Event<string>;
1501
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1502
+ private _allControls;
1590
1503
  /**
1591
- * Removes a callback from this event instance.
1592
- * @param handler - the callback to be removed from this event.
1504
+ * The object that controls the camera. An instance of
1505
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1506
+ * Transforming the camera directly will have no effect: you need to use this
1507
+ * object to move, rotate, look at objects, etc.
1593
1508
  */
1594
- remove(handler: T extends void ? {
1595
- (): Promise<void>;
1596
- } : {
1597
- (data: T): Promise<void>;
1598
- }): void;
1599
- /** Triggers all the callbacks assigned to this event. */
1600
- trigger: (data?: T) => Promise<void>;
1601
- /** Gets rid of all the suscribed events. */
1602
- reset(): void;
1603
- private handlers;
1509
+ get controls(): CameraControls;
1510
+ /** {@link Component.enabled} */
1511
+ get enabled(): boolean;
1512
+ /** {@link Component.enabled} */
1513
+ set enabled(enabled: boolean);
1514
+ constructor(components: Components);
1515
+ /** {@link Disposable.dispose} */
1516
+ dispose(): void;
1517
+ /** {@link Updateable.update} */
1518
+ update(_delta: number): void;
1519
+ /**
1520
+ * Updates the aspect of the camera to match the size of the
1521
+ * {@link Components.renderer}.
1522
+ */
1523
+ updateAspect: () => void;
1524
+ private setupCamera;
1525
+ private newCameraControls;
1526
+ private setupEvents;
1527
+ private static getSubsetOfThree;
1604
1528
  }
1605
1529
  /// <reference types="node" />
1606
1530
  import * as THREE from "three";
@@ -1648,144 +1572,318 @@ export declare class SimpleGrid implements Hideable, Disposable {
1648
1572
  private setupEvents;
1649
1573
  private updateZoom;
1650
1574
  }
1651
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1575
+ import * as THREE from "three";
1652
1576
  import { Components } from "../../Components";
1577
+ import { AsyncEvent, Event, World } from "../../Types";
1578
+ export interface CullerRendererSettings {
1579
+ updateInterval?: number;
1580
+ width?: number;
1581
+ height?: number;
1582
+ autoUpdate?: boolean;
1583
+ }
1653
1584
  /**
1654
- * Base class of the library. Useful for finding out the interfaces it implements.
1585
+ * A base renderer to determine visibility on screen
1655
1586
  */
1656
- export declare abstract class Base {
1587
+ export declare class CullerRenderer {
1588
+ /** {@link Disposable.onDisposed} */
1589
+ readonly onDisposed: Event<string>;
1590
+ /**
1591
+ * Fires after making the visibility check to the meshes. It lists the
1592
+ * meshes that are currently visible, and the ones that were visible
1593
+ * just before but not anymore.
1594
+ */
1595
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1596
+ /** {@link Component.enabled} */
1597
+ enabled: boolean;
1598
+ /**
1599
+ * Needs to check whether there are objects that need to be hidden or shown.
1600
+ * You can bind this to the camera movement, to a certain interval, etc.
1601
+ */
1602
+ needsUpdate: boolean;
1603
+ /**
1604
+ * Render the internal scene used to determine the object visibility. Used
1605
+ * for debugging purposes.
1606
+ */
1607
+ renderDebugFrame: boolean;
1657
1608
  components: Components;
1658
- constructor(components: Components);
1659
- /** Whether is component is {@link Disposable}. */
1660
- isDisposeable: () => this is Disposable;
1661
- /** Whether is component is {@link Resizeable}. */
1662
- isResizeable: () => this is Resizeable;
1663
- /** Whether is component is {@link Updateable}. */
1664
- isUpdateable: () => this is Updateable;
1665
- /** Whether is component is {@link Hideable}. */
1666
- isHideable: () => this is Hideable;
1667
- /** Whether is component is {@link Configurable}. */
1668
- isConfigurable: () => this is Configurable<any>;
1609
+ readonly world: World;
1610
+ readonly renderer: THREE.WebGLRenderer;
1611
+ protected autoUpdate: boolean;
1612
+ protected updateInterval: number;
1613
+ protected readonly worker: Worker;
1614
+ protected readonly scene: THREE.Scene;
1615
+ private _width;
1616
+ private _height;
1617
+ private _availableColor;
1618
+ private readonly renderTarget;
1619
+ private readonly bufferSize;
1620
+ private readonly _buffer;
1621
+ protected _isWorkerBusy: boolean;
1622
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1623
+ /** {@link Disposable.dispose} */
1624
+ dispose(): void;
1625
+ /**
1626
+ * The function that the culler uses to reprocess the scene. Generally it's
1627
+ * better to call needsUpdate, but you can also call this to force it.
1628
+ * @param force if true, it will refresh the scene even if needsUpdate is
1629
+ * not true.
1630
+ */
1631
+ updateVisibility: (force?: boolean) => Promise<void>;
1632
+ protected getAvailableColor(): {
1633
+ r: number;
1634
+ g: number;
1635
+ b: number;
1636
+ code: string;
1637
+ };
1638
+ protected increaseColor(): void;
1639
+ protected decreaseColor(): void;
1640
+ private applySettings;
1669
1641
  }
1670
1642
  import * as THREE from "three";
1671
- import { BaseScene, Configurable, Event } from "../../Types";
1643
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1672
1644
  import { Components } from "../../Components";
1673
- export interface SimpleSceneConfig {
1674
- directionalLight: {
1675
- color: THREE.Color;
1676
- intensity: number;
1677
- position: THREE.Vector3;
1678
- };
1679
- ambientLight: {
1680
- color: THREE.Color;
1681
- intensity: number;
1682
- };
1683
- }
1645
+ import { Event, World } from "../../Types";
1684
1646
  /**
1685
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1686
- * objects hierarchically, and easily dispose them when you are finished with it.
1687
- * @noInheritDoc
1647
+ * A renderer to determine a mesh visibility on screen
1688
1648
  */
1689
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1690
- /** {@link Configurable.isSetup} */
1691
- isSetup: boolean;
1692
- three: THREE.Scene;
1693
- /** {@link Configurable.onSetup} */
1694
- readonly onSetup: Event<SimpleScene>;
1695
- config: Required<SimpleSceneConfig>;
1696
- constructor(components: Components);
1697
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1698
- setup(config?: Partial<SimpleSceneConfig>): void;
1649
+ export declare class MeshCullerRenderer extends CullerRenderer {
1650
+ threshold: number;
1651
+ readonly onViewUpdated: Event<{
1652
+ seen: Set<THREE.Mesh>;
1653
+ unseen: Set<THREE.Mesh>;
1654
+ }>;
1655
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1656
+ isProcessing: boolean;
1657
+ private _colorCodeMeshMap;
1658
+ private _meshIDColorCodeMap;
1659
+ private _currentVisibleMeshes;
1660
+ private _recentlyHiddenMeshes;
1661
+ private _intervalID;
1662
+ private readonly _transparentMat;
1663
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1664
+ dispose(): void;
1665
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1666
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1667
+ private handleWorkerMessage;
1668
+ private getAvailableMaterial;
1699
1669
  }
1700
- import * as THREE from "three";
1701
- import { BaseScene } from "./base-scene";
1702
- import { BaseCamera } from "./base-camera";
1703
- import { BaseRenderer } from "./base-renderer";
1704
- import { Updateable, Disposable } from "./interfaces";
1705
- export interface World extends Disposable, Updateable {
1706
- meshes: Set<THREE.Mesh>;
1707
- scene: BaseScene;
1708
- camera: BaseCamera;
1709
- renderer: BaseRenderer | null;
1710
- uuid: string;
1670
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1671
+ import * as WEBIFC from "web-ifc";
1672
+ /** Configuration of the IFC-fragment conversion. */
1673
+ export declare class IfcFragmentSettings {
1674
+ /** Whether to extract the IFC properties into a JSON. */
1675
+ includeProperties: boolean;
1676
+ /**
1677
+ * Generate the geometry for categories that are not included by default,
1678
+ * like IFCSPACE.
1679
+ */
1680
+ optionalCategories: number[];
1681
+ /** Whether to use the coordination data coming from the IFC files. */
1682
+ coordinate: boolean;
1683
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1684
+ wasm: {
1685
+ path: string;
1686
+ absolute: boolean;
1687
+ logLevel?: WEBIFC.LogLevel;
1688
+ };
1689
+ /** List of categories that won't be converted to fragments. */
1690
+ excludedCategories: Set<number>;
1691
+ /** Whether to save the absolute location of all IFC items. */
1692
+ saveLocations: boolean;
1693
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1694
+ webIfc: WEBIFC.LoaderSettings;
1695
+ autoSetWasm: boolean;
1696
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1711
1697
  }
1712
1698
  import * as THREE from "three";
1713
- import { BaseRenderer, Event } from "../../Types";
1714
- import { Components } from "../../Components";
1699
+ import * as WEBIFC from "web-ifc";
1700
+ import * as FRAGS from "@thatopen/fragments";
1701
+ export declare class CivilReader {
1702
+ defLineMat: THREE.LineBasicMaterial;
1703
+ read(webIfc: WEBIFC.IfcAPI): {
1704
+ alignments: Map<number, FRAGS.Alignment>;
1705
+ coordinationMatrix: THREE.Matrix4;
1706
+ } | undefined;
1707
+ get(civilItems: any): {
1708
+ alignments: Map<number, FRAGS.Alignment>;
1709
+ coordinationMatrix: THREE.Matrix4;
1710
+ } | undefined;
1711
+ private getCurves;
1712
+ }
1713
+ import * as WEBIFC from "web-ifc";
1714
+ export declare class IfcMetadataReader {
1715
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1716
+ }
1717
+ import { NavigationMode } from "./types";
1718
+ import { OrthoPerspectiveCamera } from "../index";
1715
1719
  /**
1716
- * A basic renderer capable of rendering
1717
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1720
+ * A {@link NavigationMode} that allows first person navigation,
1721
+ * simulating FPS video games.
1718
1722
  */
1719
- export declare class SimpleRenderer extends BaseRenderer {
1723
+ export declare class FirstPersonMode implements NavigationMode {
1724
+ private camera;
1725
+ /** {@link NavigationMode.enabled} */
1720
1726
  enabled: boolean;
1721
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1722
- container: HTMLElement;
1723
- three: THREE.WebGLRenderer;
1724
- protected _canvas: HTMLCanvasElement;
1725
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1726
- protected _resizeObserver: ResizeObserver | null;
1727
- protected onContainerUpdated: Event<unknown>;
1728
- private _resizing;
1729
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1730
- /** {@link Updateable.update} */
1731
- update(): void;
1732
- /** {@link Disposable.dispose} */
1733
- dispose(): void;
1734
- /** {@link Resizeable.getSize}. */
1735
- getSize(): THREE.Vector2;
1736
- /** {@link Resizeable.resize} */
1737
- resize: (size?: THREE.Vector2) => void;
1738
- setupEvents(active: boolean): void;
1739
- private resizeEvent;
1740
- private setupRenderer;
1741
- private onContextLost;
1742
- private onContextBack;
1727
+ /** {@link NavigationMode.id} */
1728
+ readonly id = "FirstPerson";
1729
+ constructor(camera: OrthoPerspectiveCamera);
1730
+ /** {@link NavigationMode.set} */
1731
+ set(active: boolean): void;
1732
+ private setupFirstPersonCamera;
1733
+ }
1734
+ import { NavigationMode } from "./types";
1735
+ import { OrthoPerspectiveCamera } from "../index";
1736
+ /**
1737
+ * A {@link NavigationMode} that allows 3D navigation and panning
1738
+ * like in many 3D and CAD softwares.
1739
+ */
1740
+ export declare class OrbitMode implements NavigationMode {
1741
+ camera: OrthoPerspectiveCamera;
1742
+ /** {@link NavigationMode.enabled} */
1743
+ enabled: boolean;
1744
+ /** {@link NavigationMode.id} */
1745
+ readonly id = "Orbit";
1746
+ constructor(camera: OrthoPerspectiveCamera);
1747
+ /** {@link NavigationMode.set} */
1748
+ set(active: boolean): void;
1749
+ private activateOrbitControls;
1750
+ }
1751
+ import { NavigationMode } from "./types";
1752
+ import { OrthoPerspectiveCamera } from "../index";
1753
+ /**
1754
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1755
+ * like many BIM tools.
1756
+ */
1757
+ export declare class PlanMode implements NavigationMode {
1758
+ private camera;
1759
+ /** {@link NavigationMode.enabled} */
1760
+ enabled: boolean;
1761
+ /** {@link NavigationMode.id} */
1762
+ readonly id = "Plan";
1763
+ private mouseAction1?;
1764
+ private mouseAction2?;
1765
+ private mouseInitialized;
1766
+ private readonly defaultAzimuthSpeed;
1767
+ private readonly defaultPolarSpeed;
1768
+ constructor(camera: OrthoPerspectiveCamera);
1769
+ /** {@link NavigationMode.set} */
1770
+ set(active: boolean): void;
1743
1771
  }
1744
1772
  import * as THREE from "three";
1745
- import CameraControls from "camera-controls";
1746
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1747
- import { Components } from "../../Components";
1773
+ import { CameraProjection } from "./types";
1774
+ import { Event } from "../../Types";
1775
+ import { OrthoPerspectiveCamera } from "../index";
1748
1776
  /**
1749
- * A basic camera that uses
1750
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1751
- * easily control the camera in 2D and 3D. Check out it's API to find out
1752
- * what features it offers.
1777
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1753
1778
  */
1754
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1755
- /** {@link Updateable.onBeforeUpdate} */
1756
- readonly onBeforeUpdate: Event<SimpleCamera>;
1757
- /** {@link Updateable.onAfterUpdate} */
1758
- readonly onAfterUpdate: Event<SimpleCamera>;
1759
- readonly onAspectUpdated: Event<unknown>;
1760
- /** {@link Disposable.onDisposed} */
1761
- readonly onDisposed: Event<string>;
1762
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1763
- private _allControls;
1779
+ export declare class ProjectionManager {
1764
1780
  /**
1765
- * The object that controls the camera. An instance of
1766
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1767
- * Transforming the camera directly will have no effect: you need to use this
1768
- * object to move, rotate, look at objects, etc.
1781
+ * Event that fires when the {@link CameraProjection} changes.
1769
1782
  */
1770
- get controls(): CameraControls;
1771
- /** {@link Component.enabled} */
1772
- get enabled(): boolean;
1773
- /** {@link Component.enabled} */
1774
- set enabled(enabled: boolean);
1775
- constructor(components: Components);
1776
- /** {@link Disposable.dispose} */
1777
- dispose(): void;
1778
- /** {@link Updateable.update} */
1779
- update(_delta: number): void;
1783
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1784
+ current: CameraProjection;
1785
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1786
+ private _component;
1787
+ private _previousDistance;
1788
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1789
+ matchOrthoDistanceEnabled: boolean;
1790
+ constructor(camera: OrthoPerspectiveCamera);
1780
1791
  /**
1781
- * Updates the aspect of the camera to match the size of the
1782
- * {@link Components.renderer}.
1792
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1793
+ *
1794
+ * @param projection - the new projection to set. If it is the current projection,
1795
+ * it will have no effect.
1783
1796
  */
1784
- updateAspect: () => void;
1785
- private setupCamera;
1786
- private newCameraControls;
1787
- private setupEvents;
1788
- private static getSubsetOfThree;
1797
+ set(projection: CameraProjection): Promise<void>;
1798
+ /**
1799
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1800
+ * and vice versa.
1801
+ */
1802
+ toggle(): Promise<void>;
1803
+ private setOrthoCamera;
1804
+ private getPerspectiveDims;
1805
+ private setupOrthoCamera;
1806
+ private getDistance;
1807
+ private setPerspectiveCamera;
1808
+ }
1809
+ /**
1810
+ * The projection system of the camera.
1811
+ */
1812
+ export type CameraProjection = "Perspective" | "Orthographic";
1813
+ /**
1814
+ * The extensible list of supported navigation modes.
1815
+ */
1816
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1817
+ /**
1818
+ * An object that determines the behavior of the camera controls
1819
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1820
+ */
1821
+ export interface NavigationMode {
1822
+ /** The unique ID of this navigation mode. */
1823
+ id: NavModeID;
1824
+ /**
1825
+ * Enable or disable this navigation mode.
1826
+ * When a new navigation mode is enabled, the previous navigation mode
1827
+ * must be disabled.
1828
+ *
1829
+ * @param active - whether to enable or disable this mode.
1830
+ * @param options - any additional data required to enable or disable it.
1831
+ * */
1832
+ set: (active: boolean, options?: any) => void;
1833
+ /** Whether this navigation mode is active or not. */
1834
+ enabled: boolean;
1835
+ }
1836
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
1837
+ /** Configuration of the IFC-fragment streaming. */
1838
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1839
+ minGeometrySize: number;
1840
+ minAssetsSize: number;
1841
+ }
1842
+ /** Configuration of the IFC-fragment streaming. */
1843
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1844
+ propertiesSize: number;
1845
+ }
1846
+ import * as WEBIFC from "web-ifc";
1847
+ import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1848
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1849
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1850
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1851
+ onPropertiesStreamed: AsyncEvent<{
1852
+ type: number;
1853
+ data: {
1854
+ [id: number]: any;
1855
+ };
1856
+ }>;
1857
+ onProgress: AsyncEvent<number>;
1858
+ onIndicesStreamed: AsyncEvent<number[][]>;
1859
+ /** {@link Disposable.onDisposed} */
1860
+ readonly onDisposed: Event<string>;
1861
+ enabled: boolean;
1862
+ settings: PropertiesStreamingSettings;
1863
+ webIfc: WEBIFC.IfcAPI;
1864
+ dispose(): Promise<void>;
1865
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1866
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1867
+ private readIfcFile;
1868
+ private streamIfcFile;
1869
+ private streamAllProperties;
1870
+ private getIndices;
1871
+ private cleanUp;
1872
+ }
1873
+ export interface StreamedGeometries {
1874
+ [id: number]: {
1875
+ boundingBox: Float32Array;
1876
+ hasHoles: boolean;
1877
+ geometryFile?: string;
1878
+ };
1879
+ }
1880
+ export interface StreamedAsset {
1881
+ id: number;
1882
+ geometries: {
1883
+ geometryID: number;
1884
+ transformation: number[];
1885
+ color: number[];
1886
+ }[];
1789
1887
  }
1790
1888
  import * as THREE from "three";
1791
1889
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1848,89 +1946,6 @@ export declare class SimplePlane implements Disposable, Hideable {
1848
1946
  private newHelper;
1849
1947
  private static newPlaneMesh;
1850
1948
  }
1851
- import { IfcFragmentSettings } from "../../IfcLoader/src";
1852
- /** Configuration of the IFC-fragment streaming. */
1853
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1854
- minGeometrySize: number;
1855
- minAssetsSize: number;
1856
- }
1857
- /** Configuration of the IFC-fragment streaming. */
1858
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1859
- propertiesSize: number;
1860
- }
1861
- export interface StreamedGeometries {
1862
- [id: number]: {
1863
- boundingBox: Float32Array;
1864
- hasHoles: boolean;
1865
- geometryFile?: string;
1866
- };
1867
- }
1868
- export interface StreamedAsset {
1869
- id: number;
1870
- geometries: {
1871
- geometryID: number;
1872
- transformation: number[];
1873
- color: number[];
1874
- }[];
1875
- }
1876
- import * as WEBIFC from "web-ifc";
1877
- /** Configuration of the IFC-fragment conversion. */
1878
- export declare class IfcFragmentSettings {
1879
- /** Whether to extract the IFC properties into a JSON. */
1880
- includeProperties: boolean;
1881
- /**
1882
- * Generate the geometry for categories that are not included by default,
1883
- * like IFCSPACE.
1884
- */
1885
- optionalCategories: number[];
1886
- /** Whether to use the coordination data coming from the IFC files. */
1887
- coordinate: boolean;
1888
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1889
- wasm: {
1890
- path: string;
1891
- absolute: boolean;
1892
- logLevel?: WEBIFC.LogLevel;
1893
- };
1894
- /** List of categories that won't be converted to fragments. */
1895
- excludedCategories: Set<number>;
1896
- /** Whether to save the absolute location of all IFC items. */
1897
- saveLocations: boolean;
1898
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1899
- webIfc: WEBIFC.LoaderSettings;
1900
- autoSetWasm: boolean;
1901
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1902
- }
1903
- import * as WEBIFC from "web-ifc";
1904
- import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1905
- import { PropertiesStreamingSettings } from "./streaming-settings";
1906
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1907
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1908
- onPropertiesStreamed: AsyncEvent<{
1909
- type: number;
1910
- data: {
1911
- [id: number]: any;
1912
- };
1913
- }>;
1914
- onProgress: AsyncEvent<number>;
1915
- onIndicesStreamed: AsyncEvent<number[][]>;
1916
- /** {@link Disposable.onDisposed} */
1917
- readonly onDisposed: Event<string>;
1918
- enabled: boolean;
1919
- settings: PropertiesStreamingSettings;
1920
- webIfc: WEBIFC.IfcAPI;
1921
- dispose(): Promise<void>;
1922
- streamFromBuffer(data: Uint8Array): Promise<void>;
1923
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1924
- private readIfcFile;
1925
- private streamIfcFile;
1926
- private streamAllProperties;
1927
- private getIndices;
1928
- private cleanUp;
1929
- }
1930
- import * as WEBIFC from "web-ifc";
1931
- export declare class IfcMetadataReader {
1932
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1933
- }
1934
1949
  import * as WEBIFC from "web-ifc";
1935
1950
  import * as THREE from "three";
1936
1951
  export declare class Units {
@@ -1970,20 +1985,5 @@ import * as THREE from "three";
1970
1985
  export declare class TransformHelper {
1971
1986
  getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1972
1987
  }
1973
- import * as THREE from "three";
1974
- import * as WEBIFC from "web-ifc";
1975
- import * as FRAGS from "@thatopen/fragments";
1976
- export declare class CivilReader {
1977
- defLineMat: THREE.LineBasicMaterial;
1978
- read(webIfc: WEBIFC.IfcAPI): {
1979
- alignments: Map<number, FRAGS.Alignment>;
1980
- coordinationMatrix: THREE.Matrix4;
1981
- } | undefined;
1982
- get(civilItems: any): {
1983
- alignments: Map<number, FRAGS.Alignment>;
1984
- coordinationMatrix: THREE.Matrix4;
1985
- } | undefined;
1986
- private getCurves;
1987
- }
1988
1988
 
1989
1989
  }