@thatopen/components 2.0.0-alpha.13 → 2.0.0-alpha.14

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, World, Event } from "../Types";
46
3
  import { SimpleRaycaster } from "./src";
47
4
  import { Components } from "../Components";
@@ -120,6 +77,49 @@ export declare class Grids extends Component implements Disposable {
120
77
  delete(world: World): void;
121
78
  dispose(): void;
122
79
  }
80
+ import * as THREE from "three";
81
+ import { Components } from "../Components";
82
+ import { Component } from "../Types";
83
+ /**
84
+ * A tool to safely remove meshes and geometries from memory to
85
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
86
+ */
87
+ export declare class Disposer extends Component {
88
+ private _disposedComponents;
89
+ /** {@link Component.enabled} */
90
+ enabled: boolean;
91
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
92
+ constructor(components: Components);
93
+ /**
94
+ * {@link Component.uuid}.
95
+ * @return the list of UUIDs of deleted components.
96
+ */
97
+ get(): Set<string>;
98
+ /**
99
+ * Removes a mesh, its geometry and its materials from memory. If you are
100
+ * using any of these in other parts of the application, make sure that you
101
+ * remove them from the mesh before disposing it.
102
+ *
103
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
+ * to remove.
105
+ *
106
+ * @param materials - whether to dispose the materials of the mesh.
107
+ *
108
+ * @param recursive - whether to recursively dispose the children of the mesh.
109
+ */
110
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
111
+ /**
112
+ * Disposes a geometry from memory.
113
+ *
114
+ * @param geometry - the
115
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
+ * to remove.
117
+ */
118
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
119
+ private disposeGeometryAndMaterials;
120
+ private disposeChildren;
121
+ private static disposeMaterial;
122
+ }
123
123
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
124
124
  import { Components } from "../Components";
125
125
  import { SimpleWorld } from "./src";
@@ -240,53 +240,68 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
240
240
  private _onEndDragging;
241
241
  }
242
242
  import * as THREE from "three";
243
- import { Component, Disposable, Event } from "../Types";
244
- import { Components } from "../Components";
245
- /**
246
- * A tool to easily handle the materials of massive amounts of
247
- * objects and scene background easily.
248
- */
249
- export declare class Materials extends Component implements Disposable {
250
- static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
251
- /** {@link Component.enabled} */
252
- enabled: boolean;
243
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
244
+ center: THREE.Vector3;
245
+ halfSizes: THREE.Vector3;
246
+ rotation: THREE.Matrix3;
247
+ transformation: THREE.Matrix4;
248
+ };
249
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
250
+ import * as THREE from "three";
251
+ export declare class MaterialsUtils {
252
+ static isTransparent(material: THREE.Material): boolean;
253
+ }
254
+ import * as THREE from "three";
255
+ import { Component, Components, Event, World, Disposable } from "../core";
256
+ export interface VertexPickerConfig {
257
+ showOnlyVertex: boolean;
258
+ snapDistance: number;
259
+ previewElement: HTMLElement;
260
+ }
261
+ export declare class VertexPicker extends Component implements Disposable {
262
+ onVertexFound: Event<THREE.Vector3>;
263
+ onVertexLost: Event<THREE.Vector3>;
264
+ components: Components;
265
+ private _pickedPoint;
266
+ private _config;
267
+ private _enabled;
268
+ private _workingPlane;
253
269
  /** {@link Disposable.onDisposed} */
254
- readonly onDisposed: Event<string>;
255
- list: {
256
- [id: string]: {
257
- material: THREE.Material;
258
- meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
259
- };
260
- };
261
- private _originals;
262
- constructor(components: Components);
263
- /** {@link Disposable.dispose} */
270
+ readonly onDisposed: Event<unknown>;
271
+ set enabled(value: boolean);
272
+ get enabled(): boolean;
273
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
274
+ [Symbol.dispose](): void;
275
+ set workingPlane(plane: THREE.Plane | null);
276
+ get workingPlane(): THREE.Plane | null;
277
+ set config(value: Partial<VertexPickerConfig>);
278
+ get config(): Partial<VertexPickerConfig>;
264
279
  dispose(): void;
265
- /**
266
- * Turns the specified material styles on or off.
267
- *
268
- * @param active whether to turn it on or off.
269
- * @param ids the ids of the style to turn on or off.
270
- */
271
- set(active: boolean, ids?: string[]): void;
272
- /**
273
- * Creates a new material style.
274
- * @param id the identifier of the style to create.
275
- * @param material the material of the style.
276
- */
277
- addMaterial(id: string, material: THREE.Material): void;
278
- /**
279
- * Assign meshes to a certain style.
280
- * @param id the identifier of the style.
281
- * @param meshes the meshes to assign to the style.
282
- */
283
- addMeshes(id: string, meshes: THREE.Mesh[]): void;
284
- /**
285
- * Remove meshes from a certain style.
286
- * @param id the identifier of the style.
287
- * @param meshes the meshes to assign to the style.
288
- */
289
- removeMeshes(id: string, meshes: THREE.Mesh[]): void;
280
+ get(world: World): THREE.Vector3 | null;
281
+ private getClosestVertex;
282
+ private getVertices;
283
+ private getVertex;
284
+ }
285
+ export declare class UUID {
286
+ private static _pattern;
287
+ private static _lut;
288
+ static create(): string;
289
+ static validate(uuid: string): void;
290
+ }
291
+ import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
292
+ import { MiniMap } from "./src";
293
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
294
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
295
+ readonly onAfterUpdate: Event<unknown>;
296
+ readonly onBeforeUpdate: Event<unknown>;
297
+ readonly onDisposed: Event<unknown>;
298
+ enabled: boolean;
299
+ list: Map<string, MiniMap>;
300
+ constructor(components: Components);
301
+ create(world: World): MiniMap;
302
+ delete(id: string): void;
303
+ dispose(): void | Promise<void>;
304
+ update(): void;
290
305
  }
291
306
  import { Components } from "../Components";
292
307
  import { MeshCullerRenderer, CullerRendererSettings } from "./src";
@@ -310,21 +325,6 @@ export declare class Cullers extends Component implements Disposable {
310
325
  /** {@link Disposable.dispose} */
311
326
  dispose(): void;
312
327
  }
313
- import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
314
- import { MiniMap } from "./src";
315
- export declare class MiniMaps extends Component implements Updateable, Disposable {
316
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
317
- readonly onAfterUpdate: Event<unknown>;
318
- readonly onBeforeUpdate: Event<unknown>;
319
- readonly onDisposed: Event<unknown>;
320
- enabled: boolean;
321
- list: Map<string, MiniMap>;
322
- constructor(components: Components);
323
- create(world: World): MiniMap;
324
- delete(id: string): void;
325
- dispose(): void | Promise<void>;
326
- update(): void;
327
- }
328
328
  import * as THREE from "three";
329
329
  import { Components } from "../../core/Components";
330
330
  import { SimpleCamera } from "../../core";
@@ -374,264 +374,55 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
374
374
  private newOrthoCamera;
375
375
  private setOrthoCameraAspect;
376
376
  }
377
- import * as WEBIFC from "web-ifc";
378
- import * as FRAG from "@thatopen/fragments";
377
+ import * as THREE from "three";
378
+ import { Component, Disposable, Event } from "../Types";
379
+ import { Components } from "../Components";
379
380
  /**
380
- * Object to export all the properties from an IFC to a JS object.
381
+ * A tool to easily handle the materials of massive amounts of
382
+ * objects and scene background easily.
381
383
  */
382
- export declare class IfcJsonExporter {
384
+ export declare class Materials extends Component implements Disposable {
385
+ static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
386
+ /** {@link Component.enabled} */
387
+ enabled: boolean;
388
+ /** {@link Disposable.onDisposed} */
389
+ readonly onDisposed: Event<string>;
390
+ list: {
391
+ [id: string]: {
392
+ material: THREE.Material;
393
+ meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
394
+ };
395
+ };
396
+ private _originals;
397
+ constructor(components: Components);
398
+ /** {@link Disposable.dispose} */
399
+ dispose(): void;
383
400
  /**
384
- * Exports all the properties of an IFC into an array of JS objects.
385
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
386
- * @param modelID ID of the IFC model whose properties to extract.
387
- * @param indirect whether to get the indirect relationships as well.
388
- * @param recursiveSpatial whether to get the properties of spatial items recursively
389
- * to make the location data available (e.g. absolute position of building).
401
+ * Turns the specified material styles on or off.
402
+ *
403
+ * @param active whether to turn it on or off.
404
+ * @param ids the ids of the style to turn on or off.
390
405
  */
391
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
392
- }
393
- import * as FRAGS from "@thatopen/fragments";
394
- import { FragmentsGroup } from "@thatopen/fragments";
395
- import { Disposable, Event, Component, Components } from "../../core";
396
- import { QueryGroup } from "./src/types";
397
- export interface QueryResult {
398
- [modelID: string]: {
399
- modelEntities: Set<number>;
400
- otherEntities: Set<number>;
401
- };
402
- }
403
- export interface IndexedModels {
404
- [modelID: string]: {
405
- [expressID: number]: Set<number>;
406
- };
407
- }
408
- export declare class IfcPropertiesFinder extends Component implements Disposable {
409
- readonly onFound: Event<FRAGS.FragmentIdMap>;
410
- /** {@link Disposable.onDisposed} */
411
- readonly onDisposed: Event<unknown>;
412
- enabled: boolean;
413
- indexedModels: IndexedModels;
414
- private readonly _conditionFunctions;
415
- private _noHandleAttributes;
416
- constructor(components: Components);
417
- private onFragmentsDisposed;
418
- dispose(): void;
419
- private indexEntityRelations;
420
- find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
421
- private toFragmentMap;
422
- private simpleQuery;
423
- private getMatchingEntities;
424
- private combineArrays;
425
- private getCommonElements;
426
- private arrayIntersection;
427
- private arrayUnion;
428
- private getConditionFunctions;
429
- }
430
- import * as WEBIFC from "web-ifc";
431
- import { FragmentsGroup } from "@thatopen/fragments";
432
- import { Disposable, Event, Component, Components } from "../../core";
433
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
434
- /**
435
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
436
- * 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.
437
- */
438
- export declare class IfcRelationsIndexer extends Component implements Disposable {
439
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
440
- /** {@link Disposable.onDisposed} */
441
- readonly onDisposed: Event<string>;
442
- enabled: boolean;
443
- readonly onRelationsIndexed: Event<{
444
- modelID: string;
445
- relationsMap: RelationsMap;
446
- }>;
447
- private _relToAttributesMap;
448
- private _inverseAttributes;
449
- private _ifcRels;
450
- /**
451
- * Holds the relationship mappings for each model processed by the indexer.
452
- * The structure is a map where each key is a model's UUID, and the value is another map.
453
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
454
- * representing a specific relation type, and the value is an array of expressIDs of entities
455
- * that are related through that relation type. This structure allows for efficient querying
456
- * of entity relationships within a model.
457
- */
458
- readonly relationMaps: ModelsRelationMap;
459
- constructor(components: Components);
460
- private onFragmentsDisposed;
461
- /**
462
- * Adds a relation map to the model's relations map.
463
- *
464
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
465
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
466
- *
467
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
468
- */
469
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
470
- /**
471
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
472
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
473
- * and maps them in a structured way to facilitate quick access to related entities.
474
- *
475
- * The process involves querying the model for each relation type associated with the inverse attributes
476
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
477
- * and contains a nested map where each key is an entity's expressID and its value is another map.
478
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
479
- * of entities that are related through that attribute.
480
- *
481
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
482
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
483
- * representation of the relations indexed by entity expressIDs and relation types.
484
- * @throws An error if the model does not have properties loaded.
485
- */
486
- process(model: FragmentsGroup): Promise<RelationsMap>;
487
- /**
488
- * Processes a given model from a WebIfc API to index its IFC entities relations.
489
- *
490
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
491
- * @param modelID - The unique identifier of the model within the WebIfc API.
492
- * @returns A promise that resolves to the relations map for the processed model.
493
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
494
- */
495
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
496
- /**
497
- * Retrieves the relations of a specific entity within a model based on the given relation name.
498
- * This method searches the indexed relation maps for the specified model and entity,
499
- * returning the IDs of related entities if a match is found.
500
- *
501
- * @param model The 'FragmentsGroup' model containing the entity.
502
- * @param expressID The unique identifier of the entity within the model.
503
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
504
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
505
- * or the specified relation name is not indexed.
506
- */
507
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
508
- /**
509
- * Serializes the relations of a given relation map into a JSON string.
510
- * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
511
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
512
- * The resulting object is then serialized into a JSON string.
513
- *
514
- * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
515
- * @returns A JSON string representing the serialized relations of the given relation map.
516
- */
517
- serializeRelations(relationMap: RelationsMap): string;
518
- /**
519
- * Serializes the relations of a specific model into a JSON string.
520
- * This method iterates through the relations indexed for the given model,
521
- * organizing them into a structured object where each key is an expressID of an entity,
522
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
523
- * The resulting object is then serialized into a JSON string.
524
- *
525
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
526
- * @returns A JSON string representing the serialized relations of the specified model.
527
- * If the model has no indexed relations, 'null' is returned.
528
- */
529
- serializeModelRelations(model: FragmentsGroup): string | null;
406
+ set(active: boolean, ids?: string[]): void;
530
407
  /**
531
- * Serializes all relations of every model processed by the indexer into a JSON string.
532
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
533
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
534
- * and its value is another object mapping entity expressIDs to their related entities, categorized
535
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
536
- *
537
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
538
- * If no relations have been indexed, an empty object is returned as a JSON string.
408
+ * Creates a new material style.
409
+ * @param id the identifier of the style to create.
410
+ * @param material the material of the style.
539
411
  */
540
- serializeAllRelations(): string;
412
+ addMaterial(id: string, material: THREE.Material): void;
541
413
  /**
542
- * Converts a JSON string representing relations between entities into a structured map.
543
- * This method parses the JSON string to reconstruct the relations map that indexes
544
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
545
- * and the values are maps where each key is a relation type ID and its value is an array
546
- * of express IDs of entities related through that relation type.
547
- *
548
- * @param json The JSON string to be parsed into the relations map.
549
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
550
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
551
- * is an array of express IDs (as numbers) of entities related through that relation type.
414
+ * Assign meshes to a certain style.
415
+ * @param id the identifier of the style.
416
+ * @param meshes the meshes to assign to the style.
552
417
  */
553
- getRelationsMapFromJSON(json: string): RelationsMap;
418
+ addMeshes(id: string, meshes: THREE.Mesh[]): void;
554
419
  /**
555
- * Disposes the component, cleaning up resources and detaching event listeners.
556
- * This ensures that the component is properly cleaned up and does not leave behind any
557
- * references that could prevent garbage collection.
420
+ * Remove meshes from a certain style.
421
+ * @param id the identifier of the style.
422
+ * @param meshes the meshes to assign to the style.
558
423
  */
559
- dispose(): void;
560
- }
561
- export type { InverseAttribute } from "./src/types";
562
- import * as WEBIFC from "web-ifc";
563
- import { FragmentsGroup } from "@thatopen/fragments";
564
- import { Component, Disposable, Event, Components } from "../../core";
565
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
566
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
567
- type NumericPropTypes = "IfcInteger" | "IfcReal";
568
- interface ChangeMap {
569
- [modelID: string]: Set<number>;
570
- }
571
- interface AttributeListener {
572
- [modelID: string]: {
573
- [expressID: number]: {
574
- [attributeName: string]: Event<String | Boolean | Number>;
575
- };
576
- };
577
- }
578
- export declare class IfcPropertiesManager extends Component implements Disposable {
579
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
580
- /** {@link Disposable.onDisposed} */
581
- readonly onDisposed: Event<string>;
582
- readonly onRequestFile: Event<unknown>;
583
- ifcToExport: ArrayBuffer | null;
584
- readonly onElementToPset: Event<{
585
- model: FragmentsGroup;
586
- psetID: number;
587
- elementID: number;
588
- }>;
589
- readonly onPropToPset: Event<{
590
- model: FragmentsGroup;
591
- psetID: number;
592
- propID: number;
593
- }>;
594
- readonly onPsetRemoved: Event<{
595
- model: FragmentsGroup;
596
- psetID: number;
597
- }>;
598
- readonly onDataChanged: Event<{
599
- model: FragmentsGroup;
600
- expressID: number;
601
- }>;
602
- wasm: {
603
- path: string;
604
- absolute: boolean;
605
- };
606
- enabled: boolean;
607
- attributeListeners: AttributeListener;
608
- selectedModel?: FragmentsGroup;
609
- private _changeMap;
610
- constructor(components: Components);
611
- get(): ChangeMap;
612
- dispose(): void;
613
- private increaseMaxID;
614
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
615
- private newGUID;
616
- private getOwnerHistory;
617
- private registerChange;
618
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
619
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
620
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
621
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
622
- }>;
623
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
624
- private newSingleProperty;
625
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
626
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
627
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
628
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
629
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
630
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
631
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
632
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
424
+ removeMeshes(id: string, meshes: THREE.Mesh[]): void;
633
425
  }
634
- export {};
635
426
  import * as THREE from "three";
636
427
  export interface MeasureEdge {
637
428
  distance: number;
@@ -688,87 +479,23 @@ export declare class BoundingBoxes extends Component implements Disposable {
688
479
  addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
689
480
  private static getFragmentBounds;
690
481
  }
691
- import { Component, Disposable, Event, Components } from "../../core";
692
- export declare class FragmentExploder extends Component implements Disposable {
693
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
482
+ import * as THREE from "three";
483
+ import * as FRAGS from "@thatopen/fragments";
484
+ import { Disposable, Component, Event, Components } from "../../core";
485
+ export interface Classification {
486
+ [system: string]: {
487
+ [className: string]: FRAGS.FragmentIdMap;
488
+ };
489
+ }
490
+ export declare class FragmentClassifier extends Component implements Disposable {
491
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
492
+ /** {@link Component.enabled} */
694
493
  enabled: boolean;
695
- height: number;
696
- groupName: string;
494
+ list: Classification;
697
495
  /** {@link Disposable.onDisposed} */
698
- readonly onDisposed: Event<string>;
699
- list: Set<string>;
496
+ readonly onDisposed: Event<unknown>;
700
497
  constructor(components: Components);
701
- dispose(): void;
702
- explode(): void;
703
- reset(): void;
704
- update(): void;
705
- }
706
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
707
- import * as THREE from "three";
708
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
709
- center: THREE.Vector3;
710
- halfSizes: THREE.Vector3;
711
- rotation: THREE.Matrix3;
712
- transformation: THREE.Matrix4;
713
- };
714
- import * as THREE from "three";
715
- export declare class MaterialsUtils {
716
- static isTransparent(material: THREE.Material): boolean;
717
- }
718
- import * as THREE from "three";
719
- import { Component, Components, Event, World, Disposable } from "../core";
720
- export interface VertexPickerConfig {
721
- showOnlyVertex: boolean;
722
- snapDistance: number;
723
- previewElement: HTMLElement;
724
- }
725
- export declare class VertexPicker extends Component implements Disposable {
726
- onVertexFound: Event<THREE.Vector3>;
727
- onVertexLost: Event<THREE.Vector3>;
728
- components: Components;
729
- private _pickedPoint;
730
- private _config;
731
- private _enabled;
732
- private _workingPlane;
733
- /** {@link Disposable.onDisposed} */
734
- readonly onDisposed: Event<unknown>;
735
- set enabled(value: boolean);
736
- get enabled(): boolean;
737
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
738
- [Symbol.dispose](): void;
739
- set workingPlane(plane: THREE.Plane | null);
740
- get workingPlane(): THREE.Plane | null;
741
- set config(value: Partial<VertexPickerConfig>);
742
- get config(): Partial<VertexPickerConfig>;
743
- dispose(): void;
744
- get(world: World): THREE.Vector3 | null;
745
- private getClosestVertex;
746
- private getVertices;
747
- private getVertex;
748
- }
749
- export declare class UUID {
750
- private static _pattern;
751
- private static _lut;
752
- static create(): string;
753
- static validate(uuid: string): void;
754
- }
755
- import * as THREE from "three";
756
- import * as FRAGS from "@thatopen/fragments";
757
- import { Disposable, Component, Event, Components } from "../../core";
758
- export interface Classification {
759
- [system: string]: {
760
- [className: string]: FRAGS.FragmentIdMap;
761
- };
762
- }
763
- export declare class FragmentClassifier extends Component implements Disposable {
764
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
765
- /** {@link Component.enabled} */
766
- enabled: boolean;
767
- list: Classification;
768
- /** {@link Disposable.onDisposed} */
769
- readonly onDisposed: Event<unknown>;
770
- constructor(components: Components);
771
- private onFragmentsDisposed;
498
+ private onFragmentsDisposed;
772
499
  dispose(): void;
773
500
  remove(guid: string): void;
774
501
  find(filter?: {
@@ -783,6 +510,21 @@ export declare class FragmentClassifier extends Component implements Disposable
783
510
  resetColor(items: FRAGS.FragmentIdMap): void;
784
511
  private saveItem;
785
512
  }
513
+ import { Component, Disposable, Event, Components } from "../../core";
514
+ export declare class FragmentExploder extends Component implements Disposable {
515
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
516
+ enabled: boolean;
517
+ height: number;
518
+ groupName: string;
519
+ /** {@link Disposable.onDisposed} */
520
+ readonly onDisposed: Event<string>;
521
+ list: Set<string>;
522
+ constructor(components: Components);
523
+ dispose(): void;
524
+ explode(): void;
525
+ reset(): void;
526
+ update(): void;
527
+ }
786
528
  import * as FRAGS from "@thatopen/fragments";
787
529
  import { Components, Component } from "../../core";
788
530
  export declare class FragmentHider extends Component {
@@ -944,223 +686,334 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
944
686
  private cleanUp;
945
687
  }
946
688
  import * as WEBIFC from "web-ifc";
947
- export interface IfcItemsCategories {
948
- [itemID: number]: number;
949
- }
950
- export declare class IfcCategories {
951
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
689
+ import * as FRAG from "@thatopen/fragments";
690
+ /**
691
+ * Object to export all the properties from an IFC to a JS object.
692
+ */
693
+ export declare class IfcJsonExporter {
694
+ /**
695
+ * Exports all the properties of an IFC into an array of JS objects.
696
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
697
+ * @param modelID ID of the IFC model whose properties to extract.
698
+ * @param indirect whether to get the indirect relationships as well.
699
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
700
+ * to make the location data available (e.g. absolute position of building).
701
+ */
702
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
952
703
  }
953
- export declare const IfcElements: {
954
- [key: number]: string;
955
- };
956
704
  import * as FRAGS from "@thatopen/fragments";
957
- export declare class IfcPropertiesUtils {
958
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
959
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
960
- [attribute: string]: any;
961
- } | null>;
962
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
963
- [relatingID: number]: number[];
964
- }>;
965
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
966
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
967
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
968
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
969
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
970
- key: string | null;
971
- name: string | null;
972
- }>;
973
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
974
- key: string | null;
975
- value: number | null;
976
- }>;
977
- static isRel(expressID: number): boolean;
978
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
979
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
705
+ import { FragmentsGroup } from "@thatopen/fragments";
706
+ import { Disposable, Event, Component, Components } from "../../core";
707
+ import { QueryGroup } from "./src/types";
708
+ export interface QueryResult {
709
+ [modelID: string]: {
710
+ modelEntities: Set<number>;
711
+ otherEntities: Set<number>;
712
+ };
980
713
  }
981
- export declare const IfcCategoryMap: {
982
- [key: number]: string;
983
- };
984
- import * as THREE from "three";
985
- import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
986
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
714
+ export interface IndexedModels {
715
+ [modelID: string]: {
716
+ [expressID: number]: Set<number>;
717
+ };
718
+ }
719
+ export declare class IfcPropertiesFinder extends Component implements Disposable {
720
+ readonly onFound: Event<FRAGS.FragmentIdMap>;
987
721
  /** {@link Disposable.onDisposed} */
988
722
  readonly onDisposed: Event<unknown>;
989
- readonly onAfterUpdate: Event<unknown>;
990
- readonly onBeforeUpdate: Event<unknown>;
991
- readonly onResize: Event<THREE.Vector2>;
992
- frontOffset: number;
993
- overrideMaterial: THREE.MeshDepthMaterial;
994
- backgroundColor: THREE.Color;
995
- renderer: THREE.WebGLRenderer;
996
723
  enabled: boolean;
997
- world: World;
998
- private _lockRotation;
999
- private _camera;
1000
- private _plane;
1001
- private _size;
1002
- private _tempVector1;
1003
- private _tempVector2;
1004
- private _tempTarget;
1005
- private readonly down;
1006
- get lockRotation(): boolean;
1007
- set lockRotation(active: boolean);
1008
- get zoom(): number;
1009
- set zoom(value: number);
1010
- constructor(world: World);
724
+ indexedModels: IndexedModels;
725
+ private readonly _conditionFunctions;
726
+ private _noHandleAttributes;
727
+ constructor(components: Components);
728
+ private onFragmentsDisposed;
1011
729
  dispose(): void;
1012
- get(): THREE.OrthographicCamera;
1013
- update(): void;
1014
- getSize(): THREE.Vector2;
1015
- resize(size?: THREE.Vector2): void;
1016
- private updatePlanes;
730
+ private indexEntityRelations;
731
+ find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
732
+ private toFragmentMap;
733
+ private simpleQuery;
734
+ private getMatchingEntities;
735
+ private combineArrays;
736
+ private getCommonElements;
737
+ private arrayIntersection;
738
+ private arrayUnion;
739
+ private getConditionFunctions;
1017
740
  }
1018
- export declare const GeometryTypes: Set<number>;
1019
- import * as THREE from "three";
1020
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1021
- import { Components } from "../../Components";
1022
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
741
+ import * as WEBIFC from "web-ifc";
742
+ import { FragmentsGroup } from "@thatopen/fragments";
743
+ import { Disposable, Event, Component, Components } from "../../core";
744
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
745
+ /**
746
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
747
+ * 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.
748
+ */
749
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
750
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
751
+ /** {@link Disposable.onDisposed} */
752
+ readonly onDisposed: Event<string>;
753
+ enabled: boolean;
754
+ readonly onRelationsIndexed: Event<{
755
+ modelID: string;
756
+ relationsMap: RelationsMap;
757
+ }>;
758
+ private _relToAttributesMap;
759
+ private _inverseAttributes;
760
+ private _ifcRels;
1023
761
  /**
1024
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
762
+ * Holds the relationship mappings for each model processed by the indexer.
763
+ * The structure is a map where each key is a model's UUID, and the value is another map.
764
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
765
+ * representing a specific relation type, and the value is an array of expressIDs of entities
766
+ * that are related through that relation type. This structure allows for efficient querying
767
+ * of entity relationships within a model.
1025
768
  */
1026
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1027
- readonly onAfterUpdate: Event<unknown>;
1028
- readonly onBeforeUpdate: Event<unknown>;
1029
- enabled: boolean;
1030
- uuid: string;
1031
- readonly onDisposed: Event<unknown>;
1032
- private _scene?;
1033
- private _camera?;
1034
- private _renderer;
1035
- get scene(): T;
1036
- set scene(scene: T);
1037
- get camera(): U;
1038
- set camera(camera: U);
1039
- get renderer(): S | null;
1040
- set renderer(renderer: S | null);
769
+ readonly relationMaps: ModelsRelationMap;
1041
770
  constructor(components: Components);
1042
- update(delta?: number): void;
1043
- dispose(disposeResources?: boolean): void;
771
+ private onFragmentsDisposed;
772
+ /**
773
+ * Adds a relation map to the model's relations map.
774
+ *
775
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
776
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
777
+ *
778
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
779
+ */
780
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
781
+ /**
782
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
783
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
784
+ * and maps them in a structured way to facilitate quick access to related entities.
785
+ *
786
+ * The process involves querying the model for each relation type associated with the inverse attributes
787
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
788
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
789
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
790
+ * of entities that are related through that attribute.
791
+ *
792
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
793
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
794
+ * representation of the relations indexed by entity expressIDs and relation types.
795
+ * @throws An error if the model does not have properties loaded.
796
+ */
797
+ process(model: FragmentsGroup): Promise<RelationsMap>;
798
+ /**
799
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
800
+ *
801
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
802
+ * @param modelID - The unique identifier of the model within the WebIfc API.
803
+ * @returns A promise that resolves to the relations map for the processed model.
804
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
805
+ */
806
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
807
+ /**
808
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
809
+ * This method searches the indexed relation maps for the specified model and entity,
810
+ * returning the IDs of related entities if a match is found.
811
+ *
812
+ * @param model The 'FragmentsGroup' model containing the entity.
813
+ * @param expressID The unique identifier of the entity within the model.
814
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
815
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
816
+ * or the specified relation name is not indexed.
817
+ */
818
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
819
+ /**
820
+ * Serializes the relations of a given relation map into a JSON string.
821
+ * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
822
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
823
+ * The resulting object is then serialized into a JSON string.
824
+ *
825
+ * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
826
+ * @returns A JSON string representing the serialized relations of the given relation map.
827
+ */
828
+ serializeRelations(relationMap: RelationsMap): string;
829
+ /**
830
+ * Serializes the relations of a specific model into a JSON string.
831
+ * This method iterates through the relations indexed for the given model,
832
+ * organizing them into a structured object where each key is an expressID of an entity,
833
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
834
+ * The resulting object is then serialized into a JSON string.
835
+ *
836
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
837
+ * @returns A JSON string representing the serialized relations of the specified model.
838
+ * If the model has no indexed relations, 'null' is returned.
839
+ */
840
+ serializeModelRelations(model: FragmentsGroup): string | null;
841
+ /**
842
+ * Serializes all relations of every model processed by the indexer into a JSON string.
843
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
844
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
845
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
846
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
847
+ *
848
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
849
+ * If no relations have been indexed, an empty object is returned as a JSON string.
850
+ */
851
+ serializeAllRelations(): string;
852
+ /**
853
+ * Converts a JSON string representing relations between entities into a structured map.
854
+ * This method parses the JSON string to reconstruct the relations map that indexes
855
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
856
+ * and the values are maps where each key is a relation type ID and its value is an array
857
+ * of express IDs of entities related through that relation type.
858
+ *
859
+ * @param json The JSON string to be parsed into the relations map.
860
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
861
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
862
+ * is an array of express IDs (as numbers) of entities related through that relation type.
863
+ */
864
+ getRelationsMapFromJSON(json: string): RelationsMap;
865
+ /**
866
+ * Disposes the component, cleaning up resources and detaching event listeners.
867
+ * This ensures that the component is properly cleaned up and does not leave behind any
868
+ * references that could prevent garbage collection.
869
+ */
870
+ dispose(): void;
1044
871
  }
1045
- import { InverseAttribute } from "./types";
1046
- export declare const relToAttributesMap: Map<number, {
1047
- forRelating: InverseAttribute;
1048
- forRelated: InverseAttribute;
1049
- }>;
872
+ export type { InverseAttribute } from "./src/types";
1050
873
  import * as WEBIFC from "web-ifc";
1051
- import { IfcItemsCategories } from "../../../ifc";
1052
- export declare class SpatialStructure {
1053
- itemsByFloor: IfcItemsCategories;
1054
- private _units;
1055
- setUp(webIfc: WEBIFC.IfcAPI): void;
1056
- cleanUp(): void;
874
+ import { FragmentsGroup } from "@thatopen/fragments";
875
+ import { Component, Disposable, Event, Components } from "../../core";
876
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
877
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
878
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
879
+ interface ChangeMap {
880
+ [modelID: string]: Set<number>;
1057
881
  }
1058
- import * as THREE from "three";
1059
- import { BaseScene, Configurable, Event } from "../../Types";
1060
- import { Components } from "../../Components";
1061
- export interface SimpleSceneConfig {
1062
- directionalLight: {
1063
- color: THREE.Color;
1064
- intensity: number;
1065
- position: THREE.Vector3;
1066
- };
1067
- ambientLight: {
1068
- color: THREE.Color;
1069
- intensity: number;
882
+ interface AttributeListener {
883
+ [modelID: string]: {
884
+ [expressID: number]: {
885
+ [attributeName: string]: Event<String | Boolean | Number>;
886
+ };
1070
887
  };
1071
888
  }
1072
- /**
1073
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1074
- * objects hierarchically, and easily dispose them when you are finished with it.
1075
- * @noInheritDoc
1076
- */
1077
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1078
- /** {@link Configurable.isSetup} */
1079
- isSetup: boolean;
1080
- three: THREE.Scene;
1081
- /** {@link Configurable.onSetup} */
1082
- readonly onSetup: Event<SimpleScene>;
1083
- config: Required<SimpleSceneConfig>;
1084
- constructor(components: Components);
1085
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1086
- setup(config?: Partial<SimpleSceneConfig>): void;
1087
- }
1088
- import * as THREE from "three";
1089
- import { BaseRenderer, Event } from "../../Types";
1090
- import { Components } from "../../Components";
1091
- /**
1092
- * A basic renderer capable of rendering
1093
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1094
- */
1095
- export declare class SimpleRenderer extends BaseRenderer {
889
+ export declare class IfcPropertiesManager extends Component implements Disposable {
890
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
891
+ /** {@link Disposable.onDisposed} */
892
+ readonly onDisposed: Event<string>;
893
+ readonly onRequestFile: Event<unknown>;
894
+ ifcToExport: ArrayBuffer | null;
895
+ readonly onElementToPset: Event<{
896
+ model: FragmentsGroup;
897
+ psetID: number;
898
+ elementID: number;
899
+ }>;
900
+ readonly onPropToPset: Event<{
901
+ model: FragmentsGroup;
902
+ psetID: number;
903
+ propID: number;
904
+ }>;
905
+ readonly onPsetRemoved: Event<{
906
+ model: FragmentsGroup;
907
+ psetID: number;
908
+ }>;
909
+ readonly onDataChanged: Event<{
910
+ model: FragmentsGroup;
911
+ expressID: number;
912
+ }>;
913
+ wasm: {
914
+ path: string;
915
+ absolute: boolean;
916
+ };
1096
917
  enabled: boolean;
1097
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1098
- container: HTMLElement;
1099
- three: THREE.WebGLRenderer;
1100
- protected _canvas: HTMLCanvasElement;
1101
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1102
- protected _resizeObserver: ResizeObserver | null;
1103
- protected onContainerUpdated: Event<HTMLElement>;
1104
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1105
- /** {@link Updateable.update} */
1106
- update(): void;
1107
- /** {@link Disposable.dispose} */
918
+ attributeListeners: AttributeListener;
919
+ selectedModel?: FragmentsGroup;
920
+ private _changeMap;
921
+ constructor(components: Components);
922
+ get(): ChangeMap;
1108
923
  dispose(): void;
1109
- /** {@link Resizeable.getSize}. */
1110
- getSize(): THREE.Vector2;
1111
- /** {@link Resizeable.resize} */
1112
- resize: (size?: THREE.Vector2) => void;
1113
- setupEvents(active: boolean): void;
1114
- private resizeEvent;
1115
- private setupRenderer;
1116
- private onContextLost;
1117
- private onContextBack;
924
+ private increaseMaxID;
925
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
926
+ private newGUID;
927
+ private getOwnerHistory;
928
+ private registerChange;
929
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
930
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
931
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
932
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
933
+ }>;
934
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
935
+ private newSingleProperty;
936
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
937
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
938
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
939
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
940
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
941
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
942
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
943
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
944
+ }
945
+ export {};
946
+ import * as WEBIFC from "web-ifc";
947
+ export interface IfcItemsCategories {
948
+ [itemID: number]: number;
949
+ }
950
+ export declare class IfcCategories {
951
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1118
952
  }
953
+ export declare const IfcCategoryMap: {
954
+ [key: number]: string;
955
+ };
956
+ export declare const IfcElements: {
957
+ [key: number]: string;
958
+ };
1119
959
  import * as THREE from "three";
1120
- import CameraControls from "camera-controls";
1121
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1122
- import { Components } from "../../Components";
1123
- /**
1124
- * A basic camera that uses
1125
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1126
- * easily control the camera in 2D and 3D. Check out it's API to find out
1127
- * what features it offers.
1128
- */
1129
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1130
- /** {@link Updateable.onBeforeUpdate} */
1131
- readonly onBeforeUpdate: Event<SimpleCamera>;
1132
- /** {@link Updateable.onAfterUpdate} */
1133
- readonly onAfterUpdate: Event<SimpleCamera>;
1134
- readonly onAspectUpdated: Event<unknown>;
960
+ import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
961
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1135
962
  /** {@link Disposable.onDisposed} */
1136
- readonly onDisposed: Event<string>;
1137
- readonly three: THREE.PerspectiveCamera;
1138
- private _allControls;
1139
- /**
1140
- * The object that controls the camera. An instance of
1141
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1142
- * Transforming the camera directly will have no effect: you need to use this
1143
- * object to move, rotate, look at objects, etc.
1144
- */
1145
- get controls(): CameraControls;
1146
- /** {@link Component.enabled} */
1147
- get enabled(): boolean;
1148
- /** {@link Component.enabled} */
1149
- set enabled(enabled: boolean);
1150
- constructor(components: Components);
1151
- /** {@link Disposable.dispose} */
963
+ readonly onDisposed: Event<unknown>;
964
+ readonly onAfterUpdate: Event<unknown>;
965
+ readonly onBeforeUpdate: Event<unknown>;
966
+ readonly onResize: Event<THREE.Vector2>;
967
+ frontOffset: number;
968
+ overrideMaterial: THREE.MeshDepthMaterial;
969
+ backgroundColor: THREE.Color;
970
+ renderer: THREE.WebGLRenderer;
971
+ enabled: boolean;
972
+ world: World;
973
+ private _lockRotation;
974
+ private _camera;
975
+ private _plane;
976
+ private _size;
977
+ private _tempVector1;
978
+ private _tempVector2;
979
+ private _tempTarget;
980
+ private readonly down;
981
+ get lockRotation(): boolean;
982
+ set lockRotation(active: boolean);
983
+ get zoom(): number;
984
+ set zoom(value: number);
985
+ constructor(world: World);
1152
986
  dispose(): void;
1153
- /** {@link Updateable.update} */
1154
- update(_delta: number): void;
1155
- /**
1156
- * Updates the aspect of the camera to match the size of the
1157
- * {@link Components.renderer}.
1158
- */
1159
- updateAspect: () => void;
1160
- private setupCamera;
1161
- private newCameraControls;
1162
- private setupEvents;
1163
- private static getSubsetOfThree;
987
+ get(): THREE.OrthographicCamera;
988
+ update(): void;
989
+ getSize(): THREE.Vector2;
990
+ resize(size?: THREE.Vector2): void;
991
+ private updatePlanes;
992
+ }
993
+ import * as FRAGS from "@thatopen/fragments";
994
+ export declare class IfcPropertiesUtils {
995
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
996
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
997
+ [attribute: string]: any;
998
+ } | null>;
999
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
1000
+ [relatingID: number]: number[];
1001
+ }>;
1002
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
1003
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
1004
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
1005
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
1006
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1007
+ key: string | null;
1008
+ name: string | null;
1009
+ }>;
1010
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1011
+ key: string | null;
1012
+ value: number | null;
1013
+ }>;
1014
+ static isRel(expressID: number): boolean;
1015
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1016
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1164
1017
  }
1165
1018
  /**
1166
1019
  * Simple event handler by
@@ -1390,6 +1243,7 @@ export declare abstract class Base {
1390
1243
  /** Whether is component is {@link Configurable}. */
1391
1244
  isConfigurable: () => this is Configurable<any>;
1392
1245
  }
1246
+ export declare const GeometryTypes: Set<number>;
1393
1247
  import { Base } from "./base";
1394
1248
  import { World } from "./world";
1395
1249
  import { Event } from "./event";
@@ -1407,6 +1261,19 @@ export declare abstract class BaseWorldItem extends Base {
1407
1261
  currentWorld: World | null;
1408
1262
  protected constructor(components: Components);
1409
1263
  }
1264
+ import * as WEBIFC from "web-ifc";
1265
+ import { IfcItemsCategories } from "../../../ifc";
1266
+ export declare class SpatialStructure {
1267
+ itemsByFloor: IfcItemsCategories;
1268
+ private _units;
1269
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1270
+ cleanUp(): void;
1271
+ }
1272
+ import { InverseAttribute } from "./types";
1273
+ export declare const relToAttributesMap: Map<number, {
1274
+ forRelating: InverseAttribute;
1275
+ forRelated: InverseAttribute;
1276
+ }>;
1410
1277
  import * as THREE from "three";
1411
1278
  import { Vector2 } from "three";
1412
1279
  import { Event } from "./event";
@@ -1483,169 +1350,200 @@ export interface World extends Disposable, Updateable {
1483
1350
  renderer: BaseRenderer | null;
1484
1351
  uuid: string;
1485
1352
  }
1486
- import { NavigationMode } from "./types";
1487
- /**
1488
- * A {@link NavigationMode} that allows first person navigation,
1489
- * simulating FPS video games.
1490
- */
1491
- export declare class FirstPersonMode implements NavigationMode {
1492
- private camera;
1493
- /** {@link NavigationMode.enabled} */
1494
- enabled: boolean;
1495
- /** {@link NavigationMode.id} */
1496
- readonly id = "FirstPerson";
1497
- constructor(camera: any);
1498
- /** {@link NavigationMode.set} */
1499
- set(active: boolean): void;
1500
- private setupFirstPersonCamera;
1501
- }
1502
- import { NavigationMode } from "./types";
1503
- /**
1504
- * A {@link NavigationMode} that allows 3D navigation and panning
1505
- * like in many 3D and CAD softwares.
1506
- */
1507
- export declare class OrbitMode implements NavigationMode {
1508
- camera: any;
1509
- /** {@link NavigationMode.enabled} */
1510
- enabled: boolean;
1511
- /** {@link NavigationMode.id} */
1512
- readonly id = "Orbit";
1513
- constructor(camera: any);
1514
- /** {@link NavigationMode.set} */
1515
- set(active: boolean): void;
1516
- private activateOrbitControls;
1517
- }
1518
- import { NavigationMode } from "./types";
1519
- /**
1520
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1521
- * like many BIM tools.
1522
- */
1523
- export declare class PlanMode implements NavigationMode {
1524
- private camera;
1525
- /** {@link NavigationMode.enabled} */
1526
- enabled: boolean;
1527
- /** {@link NavigationMode.id} */
1528
- readonly id = "Plan";
1529
- private mouseAction1?;
1530
- private mouseAction2?;
1531
- private mouseInitialized;
1532
- private readonly defaultAzimuthSpeed;
1533
- private readonly defaultPolarSpeed;
1534
- constructor(camera: any);
1535
- /** {@link NavigationMode.set} */
1536
- set(active: boolean): void;
1537
- }
1538
1353
  import * as THREE from "three";
1539
- import { CameraProjection } from "./types";
1540
- import { Event } from "../../../core";
1541
- import { OrthoPerspectiveCamera } from "../index";
1354
+ import { Components } from "../../Components";
1355
+ import { Event, World, Disposable } from "../../Types";
1356
+ import { Mouse } from "./mouse";
1542
1357
  /**
1543
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1358
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1359
+ * that allows to easily get items from the scene using the mouse and touch
1360
+ * events.
1544
1361
  */
1545
- export declare class ProjectionManager {
1546
- /**
1547
- * Event that fires when the {@link CameraProjection} changes.
1548
- */
1549
- readonly onChanged: Event<THREE.Camera>;
1550
- current: CameraProjection;
1551
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1552
- private _component;
1553
- private _previousDistance;
1554
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1555
- matchOrthoDistanceEnabled: boolean;
1556
- constructor(camera: OrthoPerspectiveCamera);
1362
+ export declare class SimpleRaycaster implements Disposable {
1363
+ /** {@link Component.enabled} */
1364
+ enabled: boolean;
1365
+ components: Components;
1366
+ /** {@link Disposable.onDisposed} */
1367
+ readonly onDisposed: Event<unknown>;
1368
+ /** The position of the mouse in the screen. */
1369
+ readonly mouse: Mouse;
1370
+ readonly three: THREE.Raycaster;
1371
+ world: World;
1372
+ constructor(components: Components, world: World);
1373
+ /** {@link Disposable.dispose} */
1374
+ dispose(): void;
1557
1375
  /**
1558
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1376
+ * Throws a ray from the camera to the mouse or touch event point and returns
1377
+ * the first item found. This also takes into account the clipping planes
1378
+ * used by the renderer.
1559
1379
  *
1560
- * @param projection - the new projection to set. If it is the current projection,
1561
- * it will have no effect.
1380
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1381
+ * to query. If not provided, it will query all the meshes stored in
1382
+ * {@link Components.meshes}.
1562
1383
  */
1563
- set(projection: CameraProjection): Promise<void>;
1384
+ castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1385
+ 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;
1386
+ private intersect;
1387
+ private filterClippingPlanes;
1388
+ }
1389
+ import * as THREE from "three";
1390
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1391
+ import { Components } from "../../Components";
1392
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1564
1393
  /**
1565
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1566
- * and vice versa.
1394
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1567
1395
  */
1568
- toggle(): Promise<void>;
1569
- private setOrthoCamera;
1570
- private getDims;
1571
- private setupOrthoCamera;
1572
- private getDistance;
1573
- private setPerspectiveCamera;
1396
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1397
+ readonly onAfterUpdate: Event<unknown>;
1398
+ readonly onBeforeUpdate: Event<unknown>;
1399
+ enabled: boolean;
1400
+ uuid: string;
1401
+ readonly onDisposed: Event<unknown>;
1402
+ private _scene?;
1403
+ private _camera?;
1404
+ private _renderer;
1405
+ get scene(): T;
1406
+ set scene(scene: T);
1407
+ get camera(): U;
1408
+ set camera(camera: U);
1409
+ get renderer(): S | null;
1410
+ set renderer(renderer: S | null);
1411
+ constructor(components: Components);
1412
+ update(delta?: number): void;
1413
+ dispose(disposeResources?: boolean): void;
1574
1414
  }
1415
+ import * as THREE from "three";
1416
+ import { Disposable, Event } from "../../Types";
1575
1417
  /**
1576
- * The projection system of the camera.
1577
- */
1578
- export type CameraProjection = "Perspective" | "Orthographic";
1579
- /**
1580
- * The extensible list of supported navigation modes.
1418
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1419
+ * to work with tools like the
1420
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1421
+ * been transformed through CSS or doesn't occupy the whole screen.
1581
1422
  */
1582
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1423
+ export declare class Mouse implements Disposable {
1424
+ dom: HTMLCanvasElement;
1425
+ private _event?;
1426
+ private _position;
1427
+ /** {@link Disposable.onDisposed} */
1428
+ readonly onDisposed: Event<unknown>;
1429
+ constructor(dom: HTMLCanvasElement);
1430
+ /**
1431
+ * The real position of the mouse of the Three.js canvas.
1432
+ */
1433
+ get position(): THREE.Vector2;
1434
+ /** {@link Disposable.dispose} */
1435
+ dispose(): void;
1436
+ private getPositionY;
1437
+ private getPositionX;
1438
+ private updateMouseInfo;
1439
+ private setupEvents;
1440
+ }
1441
+ import * as THREE from "three";
1442
+ import { BaseRenderer, Event } from "../../Types";
1443
+ import { Components } from "../../Components";
1583
1444
  /**
1584
- * An object that determines the behavior of the camera controls
1585
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1445
+ * A basic renderer capable of rendering
1446
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1586
1447
  */
1587
- export interface NavigationMode {
1588
- /** The unique ID of this navigation mode. */
1589
- id: NavModeID;
1590
- /**
1591
- * Enable or disable this navigation mode.
1592
- * When a new navigation mode is enabled, the previous navigation mode
1593
- * must be disabled.
1594
- *
1595
- * @param active - whether to enable or disable this mode.
1596
- * @param options - any additional data required to enable or disable it.
1597
- * */
1598
- set: (active: boolean, options?: any) => void;
1599
- /** Whether this navigation mode is active or not. */
1448
+ export declare class SimpleRenderer extends BaseRenderer {
1600
1449
  enabled: boolean;
1450
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1451
+ container: HTMLElement;
1452
+ three: THREE.WebGLRenderer;
1453
+ protected _canvas: HTMLCanvasElement;
1454
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1455
+ protected _resizeObserver: ResizeObserver | null;
1456
+ protected onContainerUpdated: Event<HTMLElement>;
1457
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1458
+ /** {@link Updateable.update} */
1459
+ update(): void;
1460
+ /** {@link Disposable.dispose} */
1461
+ dispose(): void;
1462
+ /** {@link Resizeable.getSize}. */
1463
+ getSize(): THREE.Vector2;
1464
+ /** {@link Resizeable.resize} */
1465
+ resize: (size?: THREE.Vector2) => void;
1466
+ setupEvents(active: boolean): void;
1467
+ private resizeEvent;
1468
+ private setupRenderer;
1469
+ private onContextLost;
1470
+ private onContextBack;
1601
1471
  }
1602
- /// <reference types="node" />
1603
1472
  import * as THREE from "three";
1604
- import { Hideable, Event, World } from "../../Types";
1473
+ import { BaseScene, Configurable, Event } from "../../Types";
1605
1474
  import { Components } from "../../Components";
1606
- export interface GridConfig {
1607
- color: THREE.Color;
1608
- size1: number;
1609
- size2: number;
1610
- distance: number;
1475
+ export interface SimpleSceneConfig {
1476
+ directionalLight: {
1477
+ color: THREE.Color;
1478
+ intensity: number;
1479
+ position: THREE.Vector3;
1480
+ };
1481
+ ambientLight: {
1482
+ color: THREE.Color;
1483
+ intensity: number;
1484
+ };
1611
1485
  }
1612
1486
  /**
1613
- * An infinite grid. Created by
1614
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1615
- * and translated to typescript by
1616
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1487
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1488
+ * objects hierarchically, and easily dispose them when you are finished with it.
1489
+ * @noInheritDoc
1617
1490
  */
1618
- export declare class SimpleGrid implements Hideable, Disposable {
1491
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1492
+ /** {@link Configurable.isSetup} */
1493
+ isSetup: boolean;
1494
+ three: THREE.Scene;
1495
+ /** {@link Configurable.onSetup} */
1496
+ readonly onSetup: Event<SimpleScene>;
1497
+ config: Required<SimpleSceneConfig>;
1498
+ constructor(components: Components);
1499
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1500
+ setup(config?: Partial<SimpleSceneConfig>): void;
1501
+ }
1502
+ import * as THREE from "three";
1503
+ import CameraControls from "camera-controls";
1504
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1505
+ import { Components } from "../../Components";
1506
+ /**
1507
+ * A basic camera that uses
1508
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1509
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1510
+ * what features it offers.
1511
+ */
1512
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1513
+ /** {@link Updateable.onBeforeUpdate} */
1514
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1515
+ /** {@link Updateable.onAfterUpdate} */
1516
+ readonly onAfterUpdate: Event<SimpleCamera>;
1517
+ readonly onAspectUpdated: Event<unknown>;
1619
1518
  /** {@link Disposable.onDisposed} */
1620
- readonly onDisposed: Event<unknown>;
1621
- world: World;
1622
- components: Components;
1623
- /** {@link Hideable.visible} */
1624
- get visible(): boolean;
1625
- /** {@link Hideable.visible} */
1626
- set visible(visible: boolean);
1627
- /** The material of the grid. */
1628
- get material(): THREE.ShaderMaterial;
1629
- /**
1630
- * Whether the grid should fade away with distance. Recommended to be true for
1631
- * perspective cameras and false for orthographic cameras.
1632
- */
1633
- get fade(): boolean;
1519
+ readonly onDisposed: Event<string>;
1520
+ readonly three: THREE.PerspectiveCamera;
1521
+ private _allControls;
1634
1522
  /**
1635
- * Whether the grid should fade away with distance. Recommended to be true for
1636
- * perspective cameras and false for orthographic cameras.
1523
+ * The object that controls the camera. An instance of
1524
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1525
+ * Transforming the camera directly will have no effect: you need to use this
1526
+ * object to move, rotate, look at objects, etc.
1637
1527
  */
1638
- set fade(active: boolean);
1639
- private readonly _grid;
1640
- private _fade;
1641
- constructor(components: Components, world: World, config: GridConfig);
1642
- [Symbol.dispose](): void;
1643
- /** {@link Component.get} */
1644
- get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1528
+ get controls(): CameraControls;
1529
+ /** {@link Component.enabled} */
1530
+ get enabled(): boolean;
1531
+ /** {@link Component.enabled} */
1532
+ set enabled(enabled: boolean);
1533
+ constructor(components: Components);
1645
1534
  /** {@link Disposable.dispose} */
1646
1535
  dispose(): void;
1536
+ /** {@link Updateable.update} */
1537
+ update(_delta: number): void;
1538
+ /**
1539
+ * Updates the aspect of the camera to match the size of the
1540
+ * {@link Components.renderer}.
1541
+ */
1542
+ updateAspect: () => void;
1543
+ private setupCamera;
1544
+ private newCameraControls;
1647
1545
  private setupEvents;
1648
- private updateZoom;
1546
+ private static getSubsetOfThree;
1649
1547
  }
1650
1548
  import * as THREE from "three";
1651
1549
  import { Components } from "../../Components";
@@ -1726,84 +1624,22 @@ export declare class MeshCullerRenderer extends CullerRenderer {
1726
1624
  threshold: number;
1727
1625
  readonly onViewUpdated: Event<{
1728
1626
  seen: Set<THREE.Mesh>;
1729
- unseen: Set<THREE.Mesh>;
1730
- }>;
1731
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1732
- isProcessing: boolean;
1733
- private _colorCodeMeshMap;
1734
- private _meshIDColorCodeMap;
1735
- private _currentVisibleMeshes;
1736
- private _recentlyHiddenMeshes;
1737
- private _intervalID;
1738
- private readonly _transparentMat;
1739
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1740
- dispose(): void;
1741
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1742
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1743
- private handleWorkerMessage;
1744
- private getAvailableMaterial;
1745
- }
1746
- import * as THREE from "three";
1747
- import { Disposable, Event } from "../../Types";
1748
- /**
1749
- * A helper to easily get the real position of the mouse in the Three.js canvas
1750
- * to work with tools like the
1751
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1752
- * been transformed through CSS or doesn't occupy the whole screen.
1753
- */
1754
- export declare class Mouse implements Disposable {
1755
- dom: HTMLCanvasElement;
1756
- private _event?;
1757
- private _position;
1758
- /** {@link Disposable.onDisposed} */
1759
- readonly onDisposed: Event<unknown>;
1760
- constructor(dom: HTMLCanvasElement);
1761
- /**
1762
- * The real position of the mouse of the Three.js canvas.
1763
- */
1764
- get position(): THREE.Vector2;
1765
- /** {@link Disposable.dispose} */
1766
- dispose(): void;
1767
- private getPositionY;
1768
- private getPositionX;
1769
- private updateMouseInfo;
1770
- private setupEvents;
1771
- }
1772
- import * as THREE from "three";
1773
- import { Components } from "../../Components";
1774
- import { Event, World, Disposable } from "../../Types";
1775
- import { Mouse } from "./mouse";
1776
- /**
1777
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1778
- * that allows to easily get items from the scene using the mouse and touch
1779
- * events.
1780
- */
1781
- export declare class SimpleRaycaster implements Disposable {
1782
- /** {@link Component.enabled} */
1783
- enabled: boolean;
1784
- components: Components;
1785
- /** {@link Disposable.onDisposed} */
1786
- readonly onDisposed: Event<unknown>;
1787
- /** The position of the mouse in the screen. */
1788
- readonly mouse: Mouse;
1789
- readonly three: THREE.Raycaster;
1790
- world: World;
1791
- constructor(components: Components, world: World);
1792
- /** {@link Disposable.dispose} */
1793
- dispose(): void;
1794
- /**
1795
- * Throws a ray from the camera to the mouse or touch event point and returns
1796
- * the first item found. This also takes into account the clipping planes
1797
- * used by the renderer.
1798
- *
1799
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1800
- * to query. If not provided, it will query all the meshes stored in
1801
- * {@link Components.meshes}.
1802
- */
1803
- castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1804
- 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;
1805
- private intersect;
1806
- private filterClippingPlanes;
1627
+ unseen: Set<THREE.Mesh>;
1628
+ }>;
1629
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1630
+ isProcessing: boolean;
1631
+ private _colorCodeMeshMap;
1632
+ private _meshIDColorCodeMap;
1633
+ private _currentVisibleMeshes;
1634
+ private _recentlyHiddenMeshes;
1635
+ private _intervalID;
1636
+ private readonly _transparentMat;
1637
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1638
+ dispose(): void;
1639
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1640
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1641
+ private handleWorkerMessage;
1642
+ private getAvailableMaterial;
1807
1643
  }
1808
1644
  import * as THREE from "three";
1809
1645
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1866,20 +1702,169 @@ export declare class SimplePlane implements Disposable, Hideable {
1866
1702
  private newHelper;
1867
1703
  private static newPlaneMesh;
1868
1704
  }
1705
+ /// <reference types="node" />
1869
1706
  import * as THREE from "three";
1870
- import * as WEBIFC from "web-ifc";
1871
- import * as FRAGS from "@thatopen/fragments";
1872
- export declare class CivilReader {
1873
- defLineMat: THREE.LineBasicMaterial;
1874
- read(webIfc: WEBIFC.IfcAPI): {
1875
- alignments: Map<number, FRAGS.Alignment>;
1876
- coordinationMatrix: THREE.Matrix4;
1877
- } | undefined;
1878
- get(civilItems: any): {
1879
- alignments: Map<number, FRAGS.Alignment>;
1880
- coordinationMatrix: THREE.Matrix4;
1881
- } | undefined;
1882
- private getCurves;
1707
+ import { Hideable, Event, World } from "../../Types";
1708
+ import { Components } from "../../Components";
1709
+ export interface GridConfig {
1710
+ color: THREE.Color;
1711
+ size1: number;
1712
+ size2: number;
1713
+ distance: number;
1714
+ }
1715
+ /**
1716
+ * An infinite grid. Created by
1717
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1718
+ * and translated to typescript by
1719
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1720
+ */
1721
+ export declare class SimpleGrid implements Hideable, Disposable {
1722
+ /** {@link Disposable.onDisposed} */
1723
+ readonly onDisposed: Event<unknown>;
1724
+ world: World;
1725
+ components: Components;
1726
+ /** {@link Hideable.visible} */
1727
+ get visible(): boolean;
1728
+ /** {@link Hideable.visible} */
1729
+ set visible(visible: boolean);
1730
+ /** The material of the grid. */
1731
+ get material(): THREE.ShaderMaterial;
1732
+ /**
1733
+ * Whether the grid should fade away with distance. Recommended to be true for
1734
+ * perspective cameras and false for orthographic cameras.
1735
+ */
1736
+ get fade(): boolean;
1737
+ /**
1738
+ * Whether the grid should fade away with distance. Recommended to be true for
1739
+ * perspective cameras and false for orthographic cameras.
1740
+ */
1741
+ set fade(active: boolean);
1742
+ private readonly _grid;
1743
+ private _fade;
1744
+ constructor(components: Components, world: World, config: GridConfig);
1745
+ [Symbol.dispose](): void;
1746
+ /** {@link Component.get} */
1747
+ get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1748
+ /** {@link Disposable.dispose} */
1749
+ dispose(): void;
1750
+ private setupEvents;
1751
+ private updateZoom;
1752
+ }
1753
+ import { NavigationMode } from "./types";
1754
+ /**
1755
+ * A {@link NavigationMode} that allows first person navigation,
1756
+ * simulating FPS video games.
1757
+ */
1758
+ export declare class FirstPersonMode implements NavigationMode {
1759
+ private camera;
1760
+ /** {@link NavigationMode.enabled} */
1761
+ enabled: boolean;
1762
+ /** {@link NavigationMode.id} */
1763
+ readonly id = "FirstPerson";
1764
+ constructor(camera: any);
1765
+ /** {@link NavigationMode.set} */
1766
+ set(active: boolean): void;
1767
+ private setupFirstPersonCamera;
1768
+ }
1769
+ import { NavigationMode } from "./types";
1770
+ /**
1771
+ * A {@link NavigationMode} that allows 3D navigation and panning
1772
+ * like in many 3D and CAD softwares.
1773
+ */
1774
+ export declare class OrbitMode implements NavigationMode {
1775
+ camera: any;
1776
+ /** {@link NavigationMode.enabled} */
1777
+ enabled: boolean;
1778
+ /** {@link NavigationMode.id} */
1779
+ readonly id = "Orbit";
1780
+ constructor(camera: any);
1781
+ /** {@link NavigationMode.set} */
1782
+ set(active: boolean): void;
1783
+ private activateOrbitControls;
1784
+ }
1785
+ import { NavigationMode } from "./types";
1786
+ /**
1787
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1788
+ * like many BIM tools.
1789
+ */
1790
+ export declare class PlanMode implements NavigationMode {
1791
+ private camera;
1792
+ /** {@link NavigationMode.enabled} */
1793
+ enabled: boolean;
1794
+ /** {@link NavigationMode.id} */
1795
+ readonly id = "Plan";
1796
+ private mouseAction1?;
1797
+ private mouseAction2?;
1798
+ private mouseInitialized;
1799
+ private readonly defaultAzimuthSpeed;
1800
+ private readonly defaultPolarSpeed;
1801
+ constructor(camera: any);
1802
+ /** {@link NavigationMode.set} */
1803
+ set(active: boolean): void;
1804
+ }
1805
+ import * as THREE from "three";
1806
+ import { CameraProjection } from "./types";
1807
+ import { Event } from "../../../core";
1808
+ import { OrthoPerspectiveCamera } from "../index";
1809
+ /**
1810
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1811
+ */
1812
+ export declare class ProjectionManager {
1813
+ /**
1814
+ * Event that fires when the {@link CameraProjection} changes.
1815
+ */
1816
+ readonly onChanged: Event<THREE.Camera>;
1817
+ current: CameraProjection;
1818
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1819
+ private _component;
1820
+ private _previousDistance;
1821
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1822
+ matchOrthoDistanceEnabled: boolean;
1823
+ constructor(camera: OrthoPerspectiveCamera);
1824
+ /**
1825
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1826
+ *
1827
+ * @param projection - the new projection to set. If it is the current projection,
1828
+ * it will have no effect.
1829
+ */
1830
+ set(projection: CameraProjection): Promise<void>;
1831
+ /**
1832
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1833
+ * and vice versa.
1834
+ */
1835
+ toggle(): Promise<void>;
1836
+ private setOrthoCamera;
1837
+ private getDims;
1838
+ private setupOrthoCamera;
1839
+ private getDistance;
1840
+ private setPerspectiveCamera;
1841
+ }
1842
+ /**
1843
+ * The projection system of the camera.
1844
+ */
1845
+ export type CameraProjection = "Perspective" | "Orthographic";
1846
+ /**
1847
+ * The extensible list of supported navigation modes.
1848
+ */
1849
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1850
+ /**
1851
+ * An object that determines the behavior of the camera controls
1852
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1853
+ */
1854
+ export interface NavigationMode {
1855
+ /** The unique ID of this navigation mode. */
1856
+ id: NavModeID;
1857
+ /**
1858
+ * Enable or disable this navigation mode.
1859
+ * When a new navigation mode is enabled, the previous navigation mode
1860
+ * must be disabled.
1861
+ *
1862
+ * @param active - whether to enable or disable this mode.
1863
+ * @param options - any additional data required to enable or disable it.
1864
+ * */
1865
+ set: (active: boolean, options?: any) => void;
1866
+ /** Whether this navigation mode is active or not. */
1867
+ enabled: boolean;
1883
1868
  }
1884
1869
  import * as WEBIFC from "web-ifc";
1885
1870
  /** Configuration of the IFC-fragment conversion. */
@@ -1908,10 +1893,35 @@ export declare class IfcFragmentSettings {
1908
1893
  autoSetWasm: boolean;
1909
1894
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1910
1895
  }
1896
+ import * as THREE from "three";
1897
+ import * as WEBIFC from "web-ifc";
1898
+ import * as FRAGS from "@thatopen/fragments";
1899
+ export declare class CivilReader {
1900
+ defLineMat: THREE.LineBasicMaterial;
1901
+ read(webIfc: WEBIFC.IfcAPI): {
1902
+ alignments: Map<number, FRAGS.Alignment>;
1903
+ coordinationMatrix: THREE.Matrix4;
1904
+ } | undefined;
1905
+ get(civilItems: any): {
1906
+ alignments: Map<number, FRAGS.Alignment>;
1907
+ coordinationMatrix: THREE.Matrix4;
1908
+ } | undefined;
1909
+ private getCurves;
1910
+ }
1911
1911
  import * as WEBIFC from "web-ifc";
1912
1912
  export declare class IfcMetadataReader {
1913
1913
  get(webIfc: WEBIFC.IfcAPI, type: number): string;
1914
1914
  }
1915
+ import * as WEBIFC from "web-ifc";
1916
+ import * as THREE from "three";
1917
+ export declare class Units {
1918
+ factor: number;
1919
+ complement: number;
1920
+ apply(matrix: THREE.Matrix4): void;
1921
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1922
+ private getLengthUnits;
1923
+ private getScaleMatrix;
1924
+ }
1915
1925
  import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1916
1926
  /** Configuration of the IFC-fragment streaming. */
1917
1927
  export declare class IfcStreamingSettings extends IfcFragmentSettings {
@@ -1922,6 +1932,21 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1922
1932
  export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1923
1933
  propertiesSize: number;
1924
1934
  }
1935
+ export interface StreamedGeometries {
1936
+ [id: number]: {
1937
+ boundingBox: Float32Array;
1938
+ hasHoles: boolean;
1939
+ geometryFile?: string;
1940
+ };
1941
+ }
1942
+ export interface StreamedAsset {
1943
+ id: number;
1944
+ geometries: {
1945
+ geometryID: number;
1946
+ transformation: number[];
1947
+ color: number[];
1948
+ }[];
1949
+ }
1925
1950
  import * as WEBIFC from "web-ifc";
1926
1951
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1927
1952
  import { PropertiesStreamingSettings } from "./streaming-settings";
@@ -1949,31 +1974,6 @@ export declare class FragmentPropsStreamConverter extends Component implements D
1949
1974
  private getIndices;
1950
1975
  private cleanUp;
1951
1976
  }
1952
- export interface StreamedGeometries {
1953
- [id: number]: {
1954
- boundingBox: Float32Array;
1955
- hasHoles: boolean;
1956
- geometryFile?: string;
1957
- };
1958
- }
1959
- export interface StreamedAsset {
1960
- id: number;
1961
- geometries: {
1962
- geometryID: number;
1963
- transformation: number[];
1964
- color: number[];
1965
- }[];
1966
- }
1967
- import * as WEBIFC from "web-ifc";
1968
- import * as THREE from "three";
1969
- export declare class Units {
1970
- factor: number;
1971
- complement: number;
1972
- apply(matrix: THREE.Matrix4): void;
1973
- setUp(webIfc: WEBIFC.IfcAPI): void;
1974
- private getLengthUnits;
1975
- private getScaleMatrix;
1976
- }
1977
1977
  export type RelationsMap = Map<number, Map<number, number[]>>;
1978
1978
  export interface ModelsRelationMap {
1979
1979
  [modelID: string]: RelationsMap;