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

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 (34) 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/{FragmentBoundingBox → BoundingBoxes}/index.d.ts +2 -2
  6. package/dist/fragments/FragmentClassifier/index.d.ts +4 -3
  7. package/dist/fragments/FragmentIfcLoader/src/index.d.ts +1 -0
  8. package/dist/fragments/{FragmentIfcStreamer/src/fragment-ifc-stream-converter.d.ts → IfcGeometryTiler/index.d.ts} +4 -4
  9. package/dist/fragments/{FragmentIfcStreamer → IfcGeometryTiler}/src/fragment-props-stream-converter.d.ts +4 -4
  10. package/dist/fragments/{FragmentIfcStreamer → IfcGeometryTiler}/src/index.d.ts +0 -1
  11. package/dist/fragments/IfcPropertiesTiler/index.d.ts +26 -0
  12. package/dist/fragments/index.d.ts +3 -2
  13. package/dist/ifc/IfcRelationsIndexer/index.d.ts +43 -14
  14. package/dist/ifc/IfcRelationsIndexer/src/getRelationMap.d.ts +3 -0
  15. package/dist/ifc/IfcRelationsIndexer/src/relToAttributesMap.d.ts +4 -0
  16. package/dist/ifc/IfcRelationsIndexer/src/types.d.ts +24 -0
  17. package/dist/index.cjs +5 -5
  18. package/dist/index.d.ts +0 -1
  19. package/dist/index.mjs +2169 -1856
  20. package/dist/namespace.d.ts +1277 -1204
  21. package/package.json +6 -5
  22. package/dist/fragments/FragmentIfcStreamer/index.d.ts +0 -1
  23. package/dist/navigation/index.d.ts +0 -1
  24. /package/dist/{navigation → core}/MiniMap/index.d.ts +0 -0
  25. /package/dist/{navigation → core}/MiniMap/src/index.d.ts +0 -0
  26. /package/dist/{navigation → core}/OrthoPerspectiveCamera/index.d.ts +0 -0
  27. /package/dist/{navigation → core}/OrthoPerspectiveCamera/src/first-person-mode.d.ts +0 -0
  28. /package/dist/{navigation → core}/OrthoPerspectiveCamera/src/index.d.ts +0 -0
  29. /package/dist/{navigation → core}/OrthoPerspectiveCamera/src/orbit-mode.d.ts +0 -0
  30. /package/dist/{navigation → core}/OrthoPerspectiveCamera/src/plan-mode.d.ts +0 -0
  31. /package/dist/{navigation → core}/OrthoPerspectiveCamera/src/projections.d.ts +0 -0
  32. /package/dist/{navigation → core}/OrthoPerspectiveCamera/src/types.d.ts +0 -0
  33. /package/dist/fragments/{FragmentIfcStreamer → IfcGeometryTiler}/src/base-types.d.ts +0 -0
  34. /package/dist/fragments/{FragmentIfcStreamer → IfcGeometryTiler}/src/streaming-settings.d.ts +0 -0
@@ -43,7 +43,7 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
43
43
  list: T[];
44
44
  protected PlaneType: new (...args: any) => SimplePlane | T;
45
45
  /** The material used in all the clipping planes. */
46
- protected _material: THREE.Material;
46
+ protected _material: THREE.MeshBasicMaterial;
47
47
  private _size;
48
48
  private _enabled;
49
49
  private _visible;
@@ -56,9 +56,9 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
56
56
  /** {@link Hideable.visible } */
57
57
  set visible(state: boolean);
58
58
  /** The material of the clipping plane representation. */
59
- get material(): THREE.Material;
59
+ get material(): THREE.MeshBasicMaterial;
60
60
  /** The material of the clipping plane representation. */
61
- set material(material: THREE.Material);
61
+ set material(material: THREE.MeshBasicMaterial);
62
62
  /** The size of the geometric representation of the clippings planes. */
63
63
  get size(): number;
64
64
  /** The size of the geometric representation of the clippings planes. */
@@ -1,5 +1,5 @@
1
1
  import * as THREE from "three";
2
- import { Component, Disposable, Event, World } from "../Types";
2
+ import { Component, Disposable, Event } from "../Types";
3
3
  import { Components } from "../Components";
4
4
  /**
5
5
  * A tool to easily handle the materials of massive amounts of
@@ -9,7 +9,6 @@ export declare class Materials extends Component implements Disposable {
9
9
  static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
10
10
  /** {@link Component.enabled} */
11
11
  enabled: boolean;
12
- private _originalBackground;
13
12
  /** {@link Disposable.onDisposed} */
14
13
  readonly onDisposed: Event<string>;
15
14
  list: {
@@ -20,6 +19,8 @@ export declare class Materials extends Component implements Disposable {
20
19
  };
21
20
  private _originals;
22
21
  constructor(components: Components);
22
+ /** {@link Disposable.dispose} */
23
+ dispose(): void;
23
24
  /**
24
25
  * Turns the specified material styles on or off.
25
26
  *
@@ -27,19 +28,6 @@ export declare class Materials extends Component implements Disposable {
27
28
  * @param ids the ids of the style to turn on or off.
28
29
  */
29
30
  set(active: boolean, ids?: string[]): void;
30
- /** {@link Disposable.dispose} */
31
- dispose(): void;
32
- /**
33
- * Sets the color of the background of the scene.
34
- *
35
- * @param color: the color to apply.
36
- */
37
- setBackgroundColor(color: THREE.Color, world: World): void;
38
- /**
39
- * Resets the scene background to the color that was being used
40
- * before applying the material manager.
41
- */
42
- resetBackgroundColor(world: World): void;
43
31
  /**
44
32
  * Creates a new material style.
45
33
  * @param id the identifier of the style to create.
@@ -6,15 +6,15 @@ import { Components } from "../../Components";
6
6
  * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
7
7
  */
8
8
  export declare class SimpleRenderer extends BaseRenderer {
9
- /** {@link Component.enabled} */
10
9
  enabled: boolean;
11
10
  /** The HTML container of the THREE.js canvas where the scene is rendered. */
12
- container: HTMLElement | null;
11
+ container: HTMLElement;
13
12
  three: THREE.WebGLRenderer;
14
13
  protected _canvas: HTMLCanvasElement;
15
14
  protected _parameters?: Partial<THREE.WebGLRendererParameters>;
15
+ protected _resizeObserver: ResizeObserver | null;
16
16
  protected onContainerUpdated: Event<HTMLElement>;
17
- constructor(components: Components, container?: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
17
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
18
18
  /** {@link Updateable.update} */
19
19
  update(): void;
20
20
  /** {@link Disposable.dispose} */
@@ -28,5 +28,4 @@ export declare class SimpleRenderer extends BaseRenderer {
28
28
  private setupRenderer;
29
29
  private onContextLost;
30
30
  private onContextBack;
31
- private updateContainer;
32
31
  }
@@ -7,3 +7,5 @@ export * from "./Grids";
7
7
  export * from "./Clipper";
8
8
  export * from "./Materials";
9
9
  export * from "./Cullers";
10
+ export * from "./MiniMap";
11
+ export * from "./OrthoPerspectiveCamera";
@@ -6,7 +6,7 @@ import { Component, Components, Disposable, Event } from "../../core";
6
6
  * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
7
7
  * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
8
8
  */
9
- export declare class FragmentBoundingBox extends Component implements Disposable {
9
+ export declare class BoundingBoxes extends Component implements Disposable {
10
10
  static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
11
11
  /** {@link Component.enabled} */
12
12
  enabled: boolean;
@@ -31,6 +31,6 @@ export declare class FragmentBoundingBox extends Component implements Disposable
31
31
  getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
32
32
  reset(): void;
33
33
  add(group: FragmentsGroup): void;
34
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
34
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
35
35
  private static getFragmentBounds;
36
36
  }
@@ -1,3 +1,4 @@
1
+ import * as THREE from "three";
1
2
  import * as FRAGS from "@thatopen/fragments";
2
3
  import { Disposable, Component, Event, Components } from "../../core";
3
4
  export interface Classification {
@@ -9,13 +10,11 @@ export declare class FragmentClassifier extends Component implements Disposable
9
10
  static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
10
11
  /** {@link Component.enabled} */
11
12
  enabled: boolean;
12
- private _groupSystems;
13
+ list: Classification;
13
14
  /** {@link Disposable.onDisposed} */
14
15
  readonly onDisposed: Event<unknown>;
15
16
  constructor(components: Components);
16
17
  private onFragmentsDisposed;
17
- /** {@link Component.get} */
18
- get(): Classification;
19
18
  dispose(): void;
20
19
  remove(guid: string): void;
21
20
  find(filter?: {
@@ -26,5 +25,7 @@ export declare class FragmentClassifier extends Component implements Disposable
26
25
  byEntity(group: FRAGS.FragmentsGroup): void;
27
26
  byStorey(group: FRAGS.FragmentsGroup): void;
28
27
  byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
28
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
29
+ resetColor(items: FRAGS.FragmentIdMap): void;
29
30
  private saveItem;
30
31
  }
@@ -1,3 +1,4 @@
1
1
  export * from "./ifc-fragment-settings";
2
+ export * from "./spatial-structure";
2
3
  export * from "./civil-reader";
3
4
  export * from "./ifc-metadata-reader";
@@ -1,8 +1,8 @@
1
1
  import * as WEBIFC from "web-ifc";
2
- import { Components, Disposable, Event, Component } from "../../../core";
3
- import { IfcStreamingSettings } from "./streaming-settings";
4
- import { StreamedGeometries, StreamedAsset } from "./base-types";
5
- export declare class FragmentIfcStreamConverter extends Component implements Disposable {
2
+ import { Components, Disposable, Event, Component } from "../../core";
3
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
4
+ export * from "./src";
5
+ export declare class IfcGeometryTiler extends Component implements Disposable {
6
6
  static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
7
7
  onGeometryStreamed: Event<{
8
8
  buffer: Uint8Array;
@@ -1,16 +1,16 @@
1
1
  import * as WEBIFC from "web-ifc";
2
- import { Component, Disposable, Event } from "../../../core";
2
+ import { AsyncEvent, Component, Disposable, Event } from "../../../core";
3
3
  import { PropertiesStreamingSettings } from "./streaming-settings";
4
4
  export declare class FragmentPropsStreamConverter extends Component implements Disposable {
5
5
  static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
6
- onPropertiesStreamed: Event<{
6
+ onPropertiesStreamed: AsyncEvent<{
7
7
  type: number;
8
8
  data: {
9
9
  [id: number]: any;
10
10
  };
11
11
  }>;
12
- onProgress: Event<number>;
13
- onIndicesStreamed: Event<number[][]>;
12
+ onProgress: AsyncEvent<number>;
13
+ onIndicesStreamed: AsyncEvent<number[][]>;
14
14
  /** {@link Disposable.onDisposed} */
15
15
  readonly onDisposed: Event<string>;
16
16
  enabled: boolean;
@@ -1,4 +1,3 @@
1
1
  export * from "./streaming-settings";
2
2
  export * from "./fragment-props-stream-converter";
3
- export * from "./fragment-ifc-stream-converter";
4
3
  export * from "./base-types";
@@ -0,0 +1,26 @@
1
+ import * as WEBIFC from "web-ifc";
2
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
3
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
4
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
5
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
6
+ onPropertiesStreamed: AsyncEvent<{
7
+ type: number;
8
+ data: {
9
+ [id: number]: any;
10
+ };
11
+ }>;
12
+ onProgress: AsyncEvent<number>;
13
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
14
+ /** {@link Disposable.onDisposed} */
15
+ readonly onDisposed: Event<string>;
16
+ enabled: boolean;
17
+ settings: PropertiesStreamingSettings;
18
+ webIfc: WEBIFC.IfcAPI;
19
+ dispose(): Promise<void>;
20
+ streamFromBuffer(data: Uint8Array): Promise<void>;
21
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
22
+ private readIfcFile;
23
+ private streamIfcFile;
24
+ private streamAllProperties;
25
+ private cleanUp;
26
+ }
@@ -1,7 +1,8 @@
1
- export * from "./FragmentBoundingBox";
1
+ export * from "./BoundingBoxes";
2
2
  export * from "./FragmentClassifier";
3
3
  export * from "./FragmentExploder";
4
4
  export * from "./FragmentHider";
5
5
  export * from "./FragmentIfcLoader";
6
- export * from "./FragmentIfcStreamer";
7
6
  export * from "./FragmentManager";
7
+ export * from "./IfcGeometryTiler";
8
+ export * from "./IfcPropertiesTiler";
@@ -1,8 +1,7 @@
1
+ import * as WEBIFC from "web-ifc";
1
2
  import { FragmentsGroup } from "@thatopen/fragments";
2
3
  import { Disposable, Event, Component, Components } from "../../core";
3
- interface RelationMap {
4
- [modelID: string]: Map<number, Map<number, number[]>>;
5
- }
4
+ import { RelationsMap, ModelsRelationMap, InverseAttributes, InverseAttribute } from "./src/types";
6
5
  /**
7
6
  * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
8
7
  * 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.
@@ -12,12 +11,16 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
12
11
  /** {@link Disposable.onDisposed} */
13
12
  readonly onDisposed: Event<string>;
14
13
  enabled: boolean;
14
+ readonly onRelationsIndexed: Event<{
15
+ modelID: string;
16
+ relationsMap: RelationsMap;
17
+ }>;
18
+ private _relToAttributesMap;
15
19
  /**
16
- * All the inverse attributes this component can processes.
20
+ * Array of inverse attribute names.
21
+ * This array is used to define the inverse attributes that the indexer will process and index.
17
22
  */
18
- readonly inverseAttributes: string[];
19
- inverseAttributesToProcess: string[];
20
- private _relToAttributesMap;
23
+ readonly inverseAttributes: InverseAttributes;
21
24
  /**
22
25
  * Holds the relationship mappings for each model processed by the indexer.
23
26
  * The structure is a map where each key is a model's UUID, and the value is another map.
@@ -26,11 +29,19 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
26
29
  * that are related through that relation type. This structure allows for efficient querying
27
30
  * of entity relationships within a model.
28
31
  */
29
- readonly relationMaps: RelationMap;
32
+ readonly relationMaps: ModelsRelationMap;
30
33
  constructor(components: Components);
31
34
  private onFragmentsDisposed;
32
35
  private getAttributeRels;
33
- private setRelMap;
36
+ /**
37
+ * Adds a relation map to the model's relations map.
38
+ *
39
+ * @param model - The `FragmentsGroup` model to which the relation map will be added.
40
+ * @param relationMap - The `RelationsMap` to be added to the model's relations map.
41
+ *
42
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
43
+ */
44
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
34
45
  /**
35
46
  * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
36
47
  * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
@@ -47,7 +58,16 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
47
58
  * representation of the relations indexed by entity expressIDs and relation types.
48
59
  * @throws An error if the model does not have properties loaded.
49
60
  */
50
- process(model: FragmentsGroup): Promise<Map<number, Map<number, number[]>>>;
61
+ process(model: FragmentsGroup): Promise<RelationsMap>;
62
+ /**
63
+ * Processes a given model from a WebIfc API to index its IFC entities relations based on predefined inverse attributes.
64
+ *
65
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
66
+ * @param modelID - The unique identifier of the model within the WebIfc API.
67
+ * @returns A promise that resolves to the relations map for the processed model.
68
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
69
+ */
70
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
51
71
  /**
52
72
  * Retrieves the relations of a specific entity within a model based on the given relation name.
53
73
  * This method searches the indexed relation maps for the specified model and entity,
@@ -59,7 +79,17 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
59
79
  * @returns An array of express IDs representing the related entities, or `null` if no relations are found
60
80
  * or the specified relation name is not indexed.
61
81
  */
62
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: string): number[] | null;
82
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
83
+ /**
84
+ * Serializes the relations of a given relation map into a JSON string.
85
+ * 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,
86
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
87
+ * The resulting object is then serialized into a JSON string.
88
+ *
89
+ * @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.
90
+ * @returns A JSON string representing the serialized relations of the given relation map.
91
+ */
92
+ serializeRelations(relationMap: RelationsMap): string;
63
93
  /**
64
94
  * Serializes the relations of a specific model into a JSON string.
65
95
  * This method iterates through the relations indexed for the given model,
@@ -82,7 +112,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
82
112
  * @returns A JSON string representing the serialized relations of all models processed by the indexer.
83
113
  * If no relations have been indexed, an empty object is returned as a JSON string.
84
114
  */
85
- serializeRelations(): string;
115
+ serializeAllRelations(): string;
86
116
  /**
87
117
  * Converts a JSON string representing relations between entities into a structured map.
88
118
  * This method parses the JSON string to reconstruct the relations map that indexes
@@ -95,7 +125,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
95
125
  * is another `Map`. This inner map's key is the relation type ID as a number, and its value
96
126
  * is an array of express IDs (as numbers) of entities related through that relation type.
97
127
  */
98
- getRelationsMapFromJSON(json: string): Map<number, Map<number, number[]>>;
128
+ getRelationsMapFromJSON(json: string): RelationsMap;
99
129
  /**
100
130
  * Disposes the component, cleaning up resources and detaching event listeners.
101
131
  * This ensures that the component is properly cleaned up and does not leave behind any
@@ -103,4 +133,3 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
103
133
  */
104
134
  dispose(): void;
105
135
  }
106
- export {};
@@ -0,0 +1,3 @@
1
+ export declare const getRelationMap: (properties: Record<string, Record<string, any>>, relationType: number, onElementsFound?: ((relatingID: number, relatedIDs: number[]) => void) | undefined) => {
2
+ [relatingID: number]: number[];
3
+ };
@@ -0,0 +1,4 @@
1
+ export declare const relToAttributesMap: Map<number, {
2
+ forRelating?: "IsDecomposedBy" | "Decomposes" | "AssociatedTo" | "HasAssociations" | "ClassificationForObjects" | "IsGroupedBy" | "HasAssignments" | "IsDefinedBy" | "DefinesOcurrence" | "IsTypedBy" | "Types" | "Defines" | "ContainedInStructure" | "ContainsElements" | undefined;
3
+ forRelated?: "IsDecomposedBy" | "Decomposes" | "AssociatedTo" | "HasAssociations" | "ClassificationForObjects" | "IsGroupedBy" | "HasAssignments" | "IsDefinedBy" | "DefinesOcurrence" | "IsTypedBy" | "Types" | "Defines" | "ContainedInStructure" | "ContainsElements" | undefined;
4
+ }>;
@@ -0,0 +1,24 @@
1
+ export type RelationsMap = Map<number, Map<number, number[]>>;
2
+ export interface ModelsRelationMap {
3
+ [modelID: string]: RelationsMap;
4
+ }
5
+ /**
6
+ * Type alias for an array of inverse attribute names.
7
+ */
8
+ export type InverseAttributes = [
9
+ "IsDecomposedBy",
10
+ "Decomposes",
11
+ "AssociatedTo",
12
+ "HasAssociations",
13
+ "ClassificationForObjects",
14
+ "IsGroupedBy",
15
+ "HasAssignments",
16
+ "IsDefinedBy",
17
+ "DefinesOcurrence",
18
+ "IsTypedBy",
19
+ "Types",
20
+ "Defines",
21
+ "ContainedInStructure",
22
+ "ContainsElements"
23
+ ];
24
+ export type InverseAttribute = InverseAttributes[number];