@thatopen/components 2.0.0-alpha.7 → 2.0.0-alpha.8

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