@thatopen/components 2.0.11 → 2.0.12
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.
- package/dist/core/Clipper/index.d.ts +1 -1
- package/dist/core/Clipper/src/simple-plane.d.ts +16 -16
- package/dist/core/Components/index.d.ts +2 -2
- package/dist/core/Cullers/index.d.ts +3 -3
- package/dist/core/Cullers/src/culler-renderer.d.ts +1 -1
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +6 -6
- package/dist/core/Disposer/index.d.ts +1 -1
- package/dist/core/Grids/index.d.ts +10 -9
- package/dist/core/Grids/src/simple-grid.d.ts +16 -4
- package/dist/core/MiniMap/index.d.ts +20 -19
- package/dist/core/MiniMap/src/index.d.ts +16 -16
- package/dist/core/OrthoPerspectiveCamera/index.d.ts +8 -8
- package/dist/core/Raycasters/index.d.ts +2 -1
- package/dist/core/Raycasters/src/mouse.d.ts +1 -4
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +9 -11
- package/dist/core/Types/src/base-camera.d.ts +1 -1
- package/dist/core/Types/src/base-renderer.d.ts +19 -19
- package/dist/core/Types/src/base-scene.d.ts +3 -3
- package/dist/core/Worlds/index.d.ts +15 -15
- package/dist/core/Worlds/src/simple-camera.d.ts +1 -1
- package/dist/core/Worlds/src/simple-scene.d.ts +3 -3
- package/dist/fragments/BoundingBoxer/index.d.ts +151 -1
- package/dist/fragments/Classifier/index.d.ts +133 -0
- package/dist/fragments/Exploder/index.d.ts +39 -2
- package/dist/fragments/FragmentsManager/index.d.ts +45 -6
- package/dist/fragments/Hider/index.d.ts +28 -0
- package/dist/fragments/IfcGeometryTiler/index.d.ts +62 -4
- package/dist/fragments/IfcGeometryTiler/src/base-types.d.ts +14 -0
- package/dist/fragments/IfcGeometryTiler/src/index.d.ts +0 -1
- package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +11 -5
- package/dist/fragments/IfcLoader/index.d.ts +89 -4
- package/dist/fragments/IfcLoader/src/ifc-fragment-settings.d.ts +14 -0
- package/dist/fragments/IfcPropertiesTiler/index.d.ts +44 -4
- package/dist/fragments/IfcPropertiesTiler/src/index.d.ts +1 -0
- package/dist/fragments/IfcPropertiesTiler/src/streaming-settings.d.ts +11 -0
- package/dist/ifc/IfcJsonExporter/index.d.ts +7 -2
- package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +3 -0
- package/dist/ifc/IfcJsonExporter/src/index.d.ts +1 -0
- package/dist/ifc/IfcPropertiesManager/index.d.ts +195 -11
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +20 -11
- package/dist/ifc/Utils/ifc-category-map.d.ts +3 -0
- package/dist/ifc/Utils/ifc-elements-map.d.ts +8 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +3564 -2892
- package/dist/measurement/MeasurementUtils/index.d.ts +76 -0
- package/dist/measurement/index.d.ts +1 -1
- package/dist/namespace.d.ts +2578 -1722
- package/package.json +1 -1
- package/dist/fragments/IfcGeometryTiler/src/fragment-props-stream-converter.d.ts +0 -27
- package/dist/measurement/Utils/index.d.ts +0 -24
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
4
|
+
*/
|
|
3
5
|
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
6
|
+
/**
|
|
7
|
+
* Minimum number of geometries to be streamed.
|
|
8
|
+
* Defaults to 10 geometries.
|
|
9
|
+
*/
|
|
4
10
|
minGeometrySize: number;
|
|
11
|
+
/**
|
|
12
|
+
* Minimum amount of assets to be streamed.
|
|
13
|
+
* Defaults to 1000 assets.
|
|
14
|
+
*/
|
|
5
15
|
minAssetsSize: number;
|
|
6
16
|
}
|
|
7
|
-
/** Configuration of the IFC-fragment streaming. */
|
|
8
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
9
|
-
propertiesSize: number;
|
|
10
|
-
}
|
|
@@ -2,15 +2,37 @@ import * as WEBIFC from "web-ifc";
|
|
|
2
2
|
import * as FRAGS from "@thatopen/fragments";
|
|
3
3
|
import { IfcFragmentSettings } from "./src";
|
|
4
4
|
import { Component, Components, Event, Disposable } from "../../core";
|
|
5
|
+
export * from "./src/ifc-fragment-settings";
|
|
6
|
+
/**
|
|
7
|
+
* The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
|
|
8
|
+
*/
|
|
5
9
|
export declare class IfcLoader extends Component implements Disposable {
|
|
10
|
+
/**
|
|
11
|
+
* A unique identifier for the component.
|
|
12
|
+
* This UUID is used to register the component within the Components system.
|
|
13
|
+
*/
|
|
6
14
|
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
7
|
-
readonly onIfcStartedLoading: Event<void>;
|
|
8
|
-
readonly onSetup: Event<void>;
|
|
9
15
|
/** {@link Disposable.onDisposed} */
|
|
10
16
|
readonly onDisposed: Event<string>;
|
|
17
|
+
/**
|
|
18
|
+
* An event triggered when the IFC file starts loading.
|
|
19
|
+
*/
|
|
20
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
21
|
+
/**
|
|
22
|
+
* An event triggered when the setup process is completed.
|
|
23
|
+
*/
|
|
24
|
+
readonly onSetup: Event<void>;
|
|
25
|
+
/**
|
|
26
|
+
* The settings for the IfcLoader.
|
|
27
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
28
|
+
*/
|
|
11
29
|
settings: IfcFragmentSettings;
|
|
12
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
32
|
+
*/
|
|
13
33
|
webIfc: WEBIFC.IfcAPI;
|
|
34
|
+
/** {@link Component.enabled} */
|
|
35
|
+
enabled: boolean;
|
|
14
36
|
private _material;
|
|
15
37
|
private _spatialTree;
|
|
16
38
|
private _metaData;
|
|
@@ -19,12 +41,75 @@ export declare class IfcLoader extends Component implements Disposable {
|
|
|
19
41
|
private _visitedFragments;
|
|
20
42
|
private _materialT;
|
|
21
43
|
constructor(components: Components);
|
|
44
|
+
/** {@link Disposable.dispose} */
|
|
22
45
|
dispose(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
48
|
+
*
|
|
49
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
50
|
+
* If not provided, the existing settings will be used.
|
|
51
|
+
*
|
|
52
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* If the `autoSetWasm` option is enabled in the configuration,
|
|
56
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const ifcLoader = new IfcLoader(components);
|
|
61
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
23
64
|
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
67
|
+
*
|
|
68
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
69
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
70
|
+
*
|
|
71
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
76
|
+
* const group = await ifcLoader.load(ifcData);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
24
79
|
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
80
|
+
/**
|
|
81
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
82
|
+
*
|
|
83
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
84
|
+
*
|
|
85
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
89
|
+
* It also opens the IFC model using the provided data and settings.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
94
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
25
97
|
readIfcFile(data: Uint8Array): Promise<number>;
|
|
26
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
100
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
108
|
+
* ifcLoader.cleanUp();
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
27
111
|
cleanUp(): void;
|
|
112
|
+
private getAllGeometries;
|
|
28
113
|
private getMesh;
|
|
29
114
|
private getGeometry;
|
|
30
115
|
private autoSetWasm;
|
|
@@ -22,6 +22,20 @@ export declare class IfcFragmentSettings {
|
|
|
22
22
|
saveLocations: boolean;
|
|
23
23
|
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
24
24
|
webIfc: WEBIFC.LoaderSettings;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
27
|
+
* If set to true, the path will be set to the default path of the WASM file.
|
|
28
|
+
* If set to false, the path must be provided manually in the `wasm.path` property.
|
|
29
|
+
* Default value is true.
|
|
30
|
+
*/
|
|
25
31
|
autoSetWasm: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
34
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
35
|
+
* If set to null, the default file location handler will be used.
|
|
36
|
+
*
|
|
37
|
+
* @param url - The URL of the file to locate.
|
|
38
|
+
* @returns The absolute path of the file.
|
|
39
|
+
*/
|
|
26
40
|
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
27
41
|
}
|
|
@@ -1,23 +1,63 @@
|
|
|
1
1
|
import * as WEBIFC from "web-ifc";
|
|
2
2
|
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
3
|
-
import { PropertiesStreamingSettings } from "
|
|
3
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
4
|
+
export * from "./src";
|
|
5
|
+
/**
|
|
6
|
+
* A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
|
|
7
|
+
*/
|
|
4
8
|
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
9
|
+
/**
|
|
10
|
+
* A unique identifier for the component.
|
|
11
|
+
* This UUID is used to register the component within the Components system.
|
|
12
|
+
*/
|
|
5
13
|
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
6
|
-
|
|
14
|
+
/**
|
|
15
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
16
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
17
|
+
*/
|
|
18
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
7
19
|
type: number;
|
|
8
20
|
data: {
|
|
9
21
|
[id: number]: any;
|
|
10
22
|
};
|
|
11
23
|
}>;
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
/**
|
|
25
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
26
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
27
|
+
*/
|
|
28
|
+
readonly onProgress: AsyncEvent<number>;
|
|
29
|
+
/**
|
|
30
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
31
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
32
|
+
*/
|
|
33
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
14
34
|
/** {@link Disposable.onDisposed} */
|
|
15
35
|
readonly onDisposed: Event<string>;
|
|
36
|
+
/** {@link Component.enabled} */
|
|
16
37
|
enabled: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
40
|
+
*/
|
|
17
41
|
settings: PropertiesStreamingSettings;
|
|
42
|
+
/**
|
|
43
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
44
|
+
*/
|
|
18
45
|
webIfc: WEBIFC.IfcAPI;
|
|
46
|
+
/** {@link Disposable.dispose} */
|
|
19
47
|
dispose(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
50
|
+
*
|
|
51
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
52
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
53
|
+
*/
|
|
20
54
|
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
57
|
+
*
|
|
58
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
59
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
60
|
+
*/
|
|
21
61
|
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
22
62
|
private readIfcFile;
|
|
23
63
|
private streamIfcFile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./streaming-settings";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2
|
+
/**
|
|
3
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
4
|
+
*/
|
|
5
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
6
|
+
/**
|
|
7
|
+
* Amount of properties to be streamed.
|
|
8
|
+
* Defaults to 100 properties.
|
|
9
|
+
*/
|
|
10
|
+
propertiesSize: number;
|
|
11
|
+
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import * as WEBIFC from "web-ifc";
|
|
2
2
|
import * as FRAG from "@thatopen/fragments";
|
|
3
3
|
import { Component, Components } from "../../core";
|
|
4
|
+
export * from "./src";
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
|
|
6
7
|
*/
|
|
7
8
|
export declare class IfcJsonExporter extends Component {
|
|
9
|
+
/**
|
|
10
|
+
* A unique identifier for the component.
|
|
11
|
+
* This UUID is used to register the component within the Components system.
|
|
12
|
+
*/
|
|
8
13
|
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
9
14
|
/** {@link Component.enabled} */
|
|
10
15
|
enabled: boolean;
|
|
11
16
|
constructor(components: Components);
|
|
12
17
|
/**
|
|
13
18
|
* Exports all the properties of an IFC into an array of JS objects.
|
|
14
|
-
* @param webIfc The instance of [web-ifc]
|
|
19
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
15
20
|
* @param modelID ID of the IFC model whose properties to extract.
|
|
16
21
|
* @param indirect whether to get the indirect relationships as well.
|
|
17
22
|
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ifc-geometry-types";
|
|
@@ -1,72 +1,256 @@
|
|
|
1
1
|
import * as WEBIFC from "web-ifc";
|
|
2
2
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
3
3
|
import { Component, Disposable, Event, Components } from "../../core";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Types for boolean properties in IFC schema.
|
|
6
|
+
*/
|
|
7
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
8
|
+
/**
|
|
9
|
+
* Types for string properties in IFC schema.
|
|
10
|
+
*/
|
|
11
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
12
|
+
/**
|
|
13
|
+
* Types for numeric properties in IFC schema.
|
|
14
|
+
*/
|
|
15
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
16
|
+
/**
|
|
17
|
+
* Interface representing a map of changed entities in a model. The keys are model UUIDs, and the values are sets of express IDs of changed entities.
|
|
18
|
+
*/
|
|
19
|
+
export interface ChangeMap {
|
|
8
20
|
[modelID: string]: Set<number>;
|
|
9
21
|
}
|
|
10
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Interface representing a map of attribute listeners. The keys are model UUIDs, and the values are objects with express IDs as keys, and objects with attribute names as keys, and Event objects as values.
|
|
24
|
+
*/
|
|
25
|
+
export interface AttributeListener {
|
|
11
26
|
[modelID: string]: {
|
|
12
27
|
[expressID: number]: {
|
|
13
28
|
[attributeName: string]: Event<String | Boolean | Number>;
|
|
14
29
|
};
|
|
15
30
|
};
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
34
|
+
*/
|
|
17
35
|
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
36
|
+
/**
|
|
37
|
+
* A unique identifier for the component.
|
|
38
|
+
* This UUID is used to register the component within the Components system.
|
|
39
|
+
*/
|
|
18
40
|
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
19
41
|
/** {@link Disposable.onDisposed} */
|
|
20
42
|
readonly onDisposed: Event<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Event triggered when a file is requested for export.
|
|
45
|
+
*/
|
|
21
46
|
readonly onRequestFile: Event<unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
49
|
+
*/
|
|
22
50
|
ifcToExport: ArrayBuffer | null;
|
|
51
|
+
/**
|
|
52
|
+
* Event triggered when an element is added to a Pset.
|
|
53
|
+
*/
|
|
23
54
|
readonly onElementToPset: Event<{
|
|
24
55
|
model: FragmentsGroup;
|
|
25
56
|
psetID: number;
|
|
26
57
|
elementID: number;
|
|
27
58
|
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Event triggered when a property is added to a Pset.
|
|
61
|
+
*/
|
|
28
62
|
readonly onPropToPset: Event<{
|
|
29
63
|
model: FragmentsGroup;
|
|
30
64
|
psetID: number;
|
|
31
65
|
propID: number;
|
|
32
66
|
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Event triggered when a Pset is removed.
|
|
69
|
+
*/
|
|
33
70
|
readonly onPsetRemoved: Event<{
|
|
34
71
|
model: FragmentsGroup;
|
|
35
72
|
psetID: number;
|
|
36
73
|
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Event triggered when data in the model changes.
|
|
76
|
+
*/
|
|
37
77
|
readonly onDataChanged: Event<{
|
|
38
78
|
model: FragmentsGroup;
|
|
39
79
|
expressID: number;
|
|
40
80
|
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Configuration for the WebAssembly module.
|
|
83
|
+
*/
|
|
41
84
|
wasm: {
|
|
42
85
|
path: string;
|
|
43
86
|
absolute: boolean;
|
|
44
87
|
};
|
|
88
|
+
/** {@link Component.enabled} */
|
|
45
89
|
enabled: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Map of attribute listeners.
|
|
92
|
+
*/
|
|
46
93
|
attributeListeners: AttributeListener;
|
|
94
|
+
/**
|
|
95
|
+
* The currently selected model.
|
|
96
|
+
*/
|
|
47
97
|
selectedModel?: FragmentsGroup;
|
|
98
|
+
/**
|
|
99
|
+
* Map of changed entities in the model.
|
|
100
|
+
*/
|
|
48
101
|
changeMap: ChangeMap;
|
|
49
102
|
constructor(components: Components);
|
|
103
|
+
/** {@link Disposable.dispose} */
|
|
50
104
|
dispose(): void;
|
|
51
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
107
|
+
*
|
|
108
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
109
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
110
|
+
* @returns The IFC schema associated with the given model.
|
|
111
|
+
*/
|
|
52
112
|
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Method to set properties data in the model.
|
|
115
|
+
*
|
|
116
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
117
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
118
|
+
* Each object must have an `expressID` property, which is the express ID of the entity in the model.
|
|
119
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
120
|
+
*
|
|
121
|
+
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
122
|
+
*
|
|
123
|
+
* @throws Will throw an error if any of the `expressID` properties are missing in the `dataToSave` array.
|
|
124
|
+
*/
|
|
56
125
|
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
128
|
+
*
|
|
129
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
130
|
+
* @param name - The name of the Pset.
|
|
131
|
+
* @param description - (Optional) The description of the Pset.
|
|
132
|
+
*
|
|
133
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
134
|
+
*
|
|
135
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
136
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
137
|
+
*/
|
|
57
138
|
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
58
139
|
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
59
140
|
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
60
141
|
}>;
|
|
142
|
+
/**
|
|
143
|
+
* Removes a Property Set (Pset) from the given model.
|
|
144
|
+
*
|
|
145
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
146
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
147
|
+
*
|
|
148
|
+
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
149
|
+
*
|
|
150
|
+
* @throws Will throw an error if any of the `expressID` properties are missing in the `psetID` array.
|
|
151
|
+
* @throws Will throw an error if the Pset to be removed is not of type `IFCPROPERTYSET`.
|
|
152
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
153
|
+
*/
|
|
61
154
|
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
62
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Creates a new single-value property of type string in the given model.
|
|
157
|
+
*
|
|
158
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
159
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
160
|
+
* @param name - The name of the property.
|
|
161
|
+
* @param value - The value of the property. Must be a string.
|
|
162
|
+
*
|
|
163
|
+
* @returns The newly created single-value property.
|
|
164
|
+
*
|
|
165
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
166
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
167
|
+
*/
|
|
63
168
|
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
169
|
+
/**
|
|
170
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
171
|
+
*
|
|
172
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
173
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
174
|
+
* @param name - The name of the property.
|
|
175
|
+
* @param value - The value of the property. Must be a number.
|
|
176
|
+
*
|
|
177
|
+
* @returns The newly created single-value property.
|
|
178
|
+
*
|
|
179
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
180
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
181
|
+
*/
|
|
64
182
|
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
183
|
+
/**
|
|
184
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
185
|
+
*
|
|
186
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
187
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
188
|
+
* @param name - The name of the property.
|
|
189
|
+
* @param value - The value of the property. Must be a boolean.
|
|
190
|
+
*
|
|
191
|
+
* @returns The newly created single-value property.
|
|
192
|
+
*
|
|
193
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
194
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
195
|
+
*/
|
|
65
196
|
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
197
|
+
/**
|
|
198
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
199
|
+
*
|
|
200
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
201
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
202
|
+
* @param propID - The express ID of the property to be removed.
|
|
203
|
+
*
|
|
204
|
+
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
205
|
+
*
|
|
206
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
207
|
+
* @throws Will throw an error if the Pset to be removed is not of type `IFCPROPERTYSET`.
|
|
208
|
+
*/
|
|
66
209
|
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
67
210
|
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
213
|
+
*
|
|
214
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
215
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
216
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
217
|
+
*
|
|
218
|
+
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
219
|
+
*
|
|
220
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
221
|
+
* @throws Will throw an error if the Pset to be added to is not of type `IFCPROPERTYSET`.
|
|
222
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
223
|
+
*/
|
|
68
224
|
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Saves the changes made to the model to a new IFC file.
|
|
227
|
+
*
|
|
228
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
229
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
230
|
+
*
|
|
231
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
232
|
+
*
|
|
233
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
234
|
+
*/
|
|
69
235
|
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
236
|
+
/**
|
|
237
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
238
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
239
|
+
*
|
|
240
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
241
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
242
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
243
|
+
*
|
|
244
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
245
|
+
*
|
|
246
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
247
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
248
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
249
|
+
*/
|
|
70
250
|
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
251
|
+
private increaseMaxID;
|
|
252
|
+
private newGUID;
|
|
253
|
+
private getOwnerHistory;
|
|
254
|
+
private registerChange;
|
|
255
|
+
private newSingleProperty;
|
|
71
256
|
}
|
|
72
|
-
export {};
|
|
@@ -2,21 +2,30 @@ import * as WEBIFC from "web-ifc";
|
|
|
2
2
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
3
3
|
import { Disposable, Event, Component, Components } from "../../core";
|
|
4
4
|
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
5
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
5
6
|
/**
|
|
6
|
-
* Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. 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.
|
|
7
|
+
* Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. 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. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
|
|
7
8
|
*/
|
|
8
9
|
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
10
|
+
/**
|
|
11
|
+
* A unique identifier for the component.
|
|
12
|
+
* This UUID is used to register the component within the Components system.
|
|
13
|
+
*/
|
|
9
14
|
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
10
15
|
/** {@link Disposable.onDisposed} */
|
|
11
16
|
readonly onDisposed: Event<string>;
|
|
12
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Event triggered when relations for a model have been indexed.
|
|
19
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
20
|
+
*
|
|
21
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
22
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
23
|
+
* 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.
|
|
24
|
+
*/
|
|
13
25
|
readonly onRelationsIndexed: Event<{
|
|
14
26
|
modelID: string;
|
|
15
27
|
relationsMap: RelationsMap;
|
|
16
28
|
}>;
|
|
17
|
-
private _relToAttributesMap;
|
|
18
|
-
private _inverseAttributes;
|
|
19
|
-
private _ifcRels;
|
|
20
29
|
/**
|
|
21
30
|
* Holds the relationship mappings for each model processed by the indexer.
|
|
22
31
|
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
@@ -26,6 +35,11 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
26
35
|
* of entity relationships within a model.
|
|
27
36
|
*/
|
|
28
37
|
readonly relationMaps: ModelsRelationMap;
|
|
38
|
+
/** {@link Component.enabled} */
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
private _relToAttributesMap;
|
|
41
|
+
private _inverseAttributes;
|
|
42
|
+
private _ifcRels;
|
|
29
43
|
constructor(components: Components);
|
|
30
44
|
private onFragmentsDisposed;
|
|
31
45
|
private indexRelations;
|
|
@@ -122,11 +136,6 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
122
136
|
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
123
137
|
*/
|
|
124
138
|
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
125
|
-
/**
|
|
126
|
-
* Disposes the component, cleaning up resources and detaching event listeners.
|
|
127
|
-
* This ensures that the component is properly cleaned up and does not leave behind any
|
|
128
|
-
* references that could prevent garbage collection.
|
|
129
|
-
*/
|
|
139
|
+
/** {@link Disposable.dispose} */
|
|
130
140
|
dispose(): void;
|
|
131
141
|
}
|
|
132
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
3
|
+
*/
|
|
1
4
|
export declare const IfcCategoryMap: {
|
|
2
5
|
[key: number]: string;
|
|
3
6
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
6
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
1
9
|
export declare const IfcElements: {
|
|
2
10
|
[key: number]: string;
|
|
3
11
|
};
|